Heavy ion Analysis Libriares
Loading...
Searching...
No Matches
EventVertexCut.cxx
1/*
2 * EventVertexCut.cxx
3 *
4 * Created on: 4 cze 2018
5 * Author: Daniel Wielanek
6 * E-mail: daniel.wielanek@gmail.com
7 * Warsaw University of Technology, Faculty of Physics
8 */
9#include "EventVertexCut.h"
10
11#include "DataFormatManager.h"
12#include "ExpEvent.h"
13#include "Package.h"
14#include <TLorentzVector.h>
15
16namespace Hal {
17 EventVertexCut::EventVertexCut() : EventCut(2) {
18 SetUnitName("Vertex R_{t} [cm]", Rt());
19 SetUnitName("Vertex Z [cm]", Z());
20 }
21
22 Bool_t EventVertexCut::Pass(Event* event) {
23 Event* ev = (Event*) event;
24 const TLorentzVector* pos = ev->GetVertex();
25 Double_t x = pos->X();
26 Double_t y = pos->Y();
27 SetValue(TMath::Sqrt(x * x + y * y), Rt());
28 SetValue(pos->Z(), Z());
29 return Validate();
30 }
31
32 Bool_t EventVertexCut::Init(Int_t /*format_id*/) { return kTRUE; }
33
34 //========================= Z vertex cut ===========================================
35
36 EventVertexZCut::EventVertexZCut() : EventCut(1) { SetUnitName("V_{z} [cm]"); }
37
39 SetValue(event->GetVertex()->Z());
40 return Validate();
41 }
42 //=========================XYZ vertex cut========================================
43
44 EventVertexXYZCut::EventVertexXYZCut() : EventCut(4), fShift(TVector3(0, 0, 0)) {
45 SetUnitName("V_{xy} [cm]", Rt());
46 SetUnitName("V_{x} [cm]", X());
47 SetUnitName("V_{y} [cm]", Y());
48 SetUnitName("V_{z} [cm]", Z());
49 }
50
51 void EventVertexXYZCut::SetShift(const TVector3& vec) { fShift = vec; }
52
54 Double_t x = event->GetVertex()->X() - fShift.X();
55 Double_t y = event->GetVertex()->Y() - fShift.Y();
56 Double_t z = event->GetVertex()->Z() - fShift.Z();
57 SetValue(TMath::Sqrt(x * x + y * y), Rt());
58 SetValue(x, X());
59 SetValue(y, Y());
60 SetValue(z, Z());
61 return Validate();
62 }
63
65 Package* report = EventCut::Report();
66 report->AddObject(fShift.Clone());
67 return report;
68 }
69
70} // namespace Hal
void SetValue(Double_t val, Int_t i=0)
Definition Cut.h:235
Bool_t Validate()
Definition Cut.cxx:43
void SetUnitName(TString name, Int_t i=0)
Definition Cut.h:241
virtual Package * Report() const
Definition EventCut.cxx:18
Package * Report() const
Bool_t Pass(Event *event)
Bool_t Pass(Event *event)
TLorentzVector * GetVertex() const
Definition Event.h:261
void AddObject(TObject *object)
Definition Package.cxx:209