CbmRoot
NicaGeneratorReadUnigen.cxx
Go to the documentation of this file.
1 /*
2  * NicaGeneratorReadUnigen.cxx
3  *
4  * Created on: 13 sie 2015
5  * Author: Daniel Wielanek
6  * E-mail: daniel.wielanek@gmail.com
7  * Warsaw University of Technology, Faculty of Physics
8  */
10 
11 
13  Int_t status = NicaGeneratorReadTree::ReadEvent();
14  if (status != EventOk()) return status;
15  fEventParameters->SetInt(fInEvent->GetEventNr(), fEventNr_Id);
16  fEventParameters->SetInt(fInEvent->GetNes(), fENes_Id);
17  fEventParameters->SetInt(fInEvent->GetStepNr(), fEStepNr_Id);
18  fEventParameters->SetDouble(fInEvent->GetPhi(), fPhi_Id);
19  fEventParameters->SetDouble(fInEvent->GetB(), fB_Id);
20  WriteEventHeader();
21  for (int i = 0; i < fInEvent->GetNpa(); i++) {
22  UParticle* part = fInEvent->GetParticle(i);
23  fTrackParameters->SetInt(part->GetIndex(), fIndex_Id);
24  fTrackParameters->SetInt(part->GetStatus(), fStatus_Id);
25  fTrackParameters->SetInt(part->GetParent(), fParent_Id);
26  fTrackParameters->SetInt(part->GetParentDecay(), fParentDecay_Id);
27  fTrackParameters->SetInt(part->GetMate(), fMate_Id);
28  fTrackParameters->SetInt(part->GetDecay(), fDecay_Id);
29  fTrackParameters->SetInt(part->GetFirstChild(), fChild1_Id);
30  fTrackParameters->SetInt(part->GetLastChild(), fChild2_Id);
31  fTrackParameters->SetDouble(part->Px(), fPx_Id);
32  fTrackParameters->SetDouble(part->Py(), fPy_Id);
33  fTrackParameters->SetDouble(part->Pz(), fPz_Id);
34  fTrackParameters->SetDouble(part->E(), fE_Id);
35  fTrackParameters->SetDouble(part->X(), fX_Id);
36  fTrackParameters->SetDouble(part->Y(), fY_Id);
37  fTrackParameters->SetDouble(part->Z(), fZ_Id);
38  fTrackParameters->SetDouble(part->T(), fT_Id);
39  fTrackParameters->SetInt(part->GetPdg(), fPdg_Id);
40  WriteParticle();
41  }
42  return EventOk();
43 }
44 
46  Int_t stat = NicaGeneratorReadTree::Reopen();
47  if (stat != FileOk()) { return stat; }
48  if (fInEvent == NULL) fInEvent = new UEvent();
49  fBranch->SetAddress(&fInEvent);
50  fInTree->GetEntry(0);
51  return FileOk();
52 }
53 
55  Bool_t multi_mode)
56  : NicaGeneratorReadTree(name, "events", "event", multi_mode)
57  , fInEvent(NULL)
58  , fStatus_Id(0)
59  , fParent_Id(0)
60  , fParentDecay_Id(0)
61  , fMate_Id(0)
62  , fDecay_Id(0)
63  , fChild1_Id(0)
64  , fChild2_Id(0)
65  , fX_Id(0)
66  , fY_Id(0)
67  , fZ_Id(0)
68  , fT_Id(0)
69  , fWeight_Id(0)
70  , fENes_Id(0)
71  , fEStepNr_Id(0)
72  , fEStepT_Id(0) {
73  fInEvent = new UEvent();
74 }
75 
77  NicaGeneratorRead::CheckParameters();
78  fStatus_Id = CheckParameter("status");
79  fParent_Id = CheckParameter("parent");
80  fParentDecay_Id = CheckParameter("parent_decay");
81  fMate_Id = CheckParameter("mate");
82  fDecay_Id = CheckParameter("decay_id");
83  fChild1_Id = CheckParameter("first_child");
84  fChild2_Id = CheckParameter("last_child");
85  fX_Id = CheckParameter("frx");
86  fY_Id = CheckParameter("fry");
87  fZ_Id = CheckParameter("frz");
88  fT_Id = CheckParameter("frt");
89  fWeight_Id = CheckParameter("weight");
90  ;
91  fENes_Id = CheckParameter("Nes");
92  fEStepNr_Id = CheckParameter("Step_nr");
93  fEStepT_Id = CheckParameter("Step_t");
94 }
95 
97  // TODO Auto-generated destructor stub
98 }
UParticle::Pz
Double_t Pz() const
Definition: UParticle.h:79
UEvent::GetPhi
Double_t GetPhi() const
Definition: UEvent.h:33
UEvent::GetB
Double_t GetB() const
Definition: UEvent.h:32
UParticle
Definition: UParticle.h:10
NicaGeneratorReadUnigen::fDecay_Id
Int_t fDecay_Id
Definition: NicaGeneratorReadUnigen.h:26
NicaGeneratorReadUnigen::fChild2_Id
Int_t fChild2_Id
Definition: NicaGeneratorReadUnigen.h:27
UParticle::GetPdg
Int_t GetPdg() const
Definition: UParticle.h:69
NicaGeneratorReadUnigen::fInEvent
UEvent * fInEvent
Definition: NicaGeneratorReadUnigen.h:25
NicaGeneratorReadUnigen::Reopen
virtual Int_t Reopen()
Definition: NicaGeneratorReadUnigen.cxx:45
UEvent::GetNpa
Int_t GetNpa() const
Definition: UEvent.h:37
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
UParticle::Y
Double_t Y() const
Definition: UParticle.h:88
NicaGeneratorReadUnigen::fChild1_Id
Int_t fChild1_Id
Definition: NicaGeneratorReadUnigen.h:27
NicaGeneratorReadUnigen::fStatus_Id
Int_t fStatus_Id
Definition: NicaGeneratorReadUnigen.h:26
NicaGeneratorReadUnigen::~NicaGeneratorReadUnigen
virtual ~NicaGeneratorReadUnigen()
Definition: NicaGeneratorReadUnigen.cxx:96
UEvent::GetStepNr
Int_t GetStepNr() const
Definition: UEvent.h:35
UEvent
Definition: UEvent.h:12
UParticle::T
Double_t T() const
Definition: UParticle.h:90
NicaGeneratorReadUnigen::fParent_Id
Int_t fParent_Id
Definition: NicaGeneratorReadUnigen.h:26
NicaGeneratorReadUnigen::CheckParameters
virtual void CheckParameters()
Definition: NicaGeneratorReadUnigen.cxx:76
NicaGeneratorReadUnigen::fENes_Id
Int_t fENes_Id
Definition: NicaGeneratorReadUnigen.h:29
UParticle::GetLastChild
Int_t GetLastChild() const
Definition: UParticle.h:76
NicaGeneratorReadUnigen.h
UParticle::GetParent
Int_t GetParent() const
Definition: UParticle.h:71
UParticle::GetDecay
Int_t GetDecay() const
Definition: UParticle.h:74
UEvent::GetParticle
UParticle * GetParticle(Int_t index) const
Definition: UEvent.cxx:92
NicaGeneratorReadUnigen::fEStepNr_Id
Int_t fEStepNr_Id
Definition: NicaGeneratorReadUnigen.h:29
NicaGeneratorReadUnigen::fT_Id
Int_t fT_Id
Definition: NicaGeneratorReadUnigen.h:28
NicaGeneratorReadUnigen::fEStepT_Id
Int_t fEStepT_Id
Definition: NicaGeneratorReadUnigen.h:29
UParticle::Z
Double_t Z() const
Definition: UParticle.h:89
UParticle::X
Double_t X() const
Definition: UParticle.h:87
UParticle::E
Double_t E() const
Definition: UParticle.h:80
NicaGeneratorReadUnigen::fZ_Id
Int_t fZ_Id
Definition: NicaGeneratorReadUnigen.h:28
NicaGeneratorReadUnigen::ReadEvent
virtual Int_t ReadEvent()
Definition: NicaGeneratorReadUnigen.cxx:12
NicaGeneratorReadUnigen::fMate_Id
Int_t fMate_Id
Definition: NicaGeneratorReadUnigen.h:26
UParticle::GetStatus
Int_t GetStatus() const
Definition: UParticle.h:70
UParticle::GetParentDecay
Int_t GetParentDecay() const
Definition: UParticle.h:72
UParticle::GetMate
Int_t GetMate() const
Definition: UParticle.h:73
UParticle::Px
Double_t Px() const
Definition: UParticle.h:77
UEvent::GetNes
Int_t GetNes() const
Definition: UEvent.h:34
NicaGeneratorReadUnigen::NicaGeneratorReadUnigen
NicaGeneratorReadUnigen(TString name, Bool_t multi_mode=kFALSE)
Definition: NicaGeneratorReadUnigen.cxx:54
UParticle::GetFirstChild
Int_t GetFirstChild() const
Definition: UParticle.h:75
NicaGeneratorReadUnigen::fParentDecay_Id
Int_t fParentDecay_Id
Definition: NicaGeneratorReadUnigen.h:26
NicaGeneratorReadUnigen::fX_Id
Int_t fX_Id
Definition: NicaGeneratorReadUnigen.h:28
NicaGeneratorReadUnigen::fY_Id
Int_t fY_Id
Definition: NicaGeneratorReadUnigen.h:28
UParticle::Py
Double_t Py() const
Definition: UParticle.h:78
NicaGeneratorReadUnigen::fWeight_Id
Int_t fWeight_Id
Definition: NicaGeneratorReadUnigen.h:28
UEvent::GetEventNr
Int_t GetEventNr() const
Definition: UEvent.h:31
UParticle::GetIndex
Int_t GetIndex() const
Definition: UParticle.h:68