CbmRoot
NicaUnigenEvent.cxx
Go to the documentation of this file.
1 /*
2  * NicaUnigen.cxx
3  *
4  * Created on: 23-06-2014
5  * Author: Daniel Wielanek
6  * E-mail: daniel.wielanek@gmail.com
7  * Warsaw University of Technology, Faculty of Physics
8  */
9 
10 #include "NicaUnigenEvent.h"
11 #include "FairRootManager.h"
13 
14 NicaUnigenEvent::NicaUnigenEvent() : NicaMCEvent("NicaUnigenTrack") {}
15 
17  UEvent* temp = ((NicaUnigenEventInterface*) fSource)->fEvent;
18  fB = temp->GetB();
19  fPhi = temp->GetPhi();
20  fTotalTracksNo = temp->GetNpa();
21  fTracks->Clear();
22  for (int i = 0; i < fTotalTracksNo; i++) {
23  UParticle* particle = temp->GetParticle(i);
24  TParticlePDG* pdg_part = fPDG->GetParticle(particle->GetPdg());
25  Double_t charge = 0;
26  if (pdg_part) { charge = pdg_part->Charge() / 3.0; }
27  NicaMCTrack* target_track = (NicaMCTrack*) fTracks->ConstructedAt(i);
28  if (particle->GetMate() < 0) {
29  target_track->SetPrimary(kTRUE);
30  } else {
31  target_track->SetPrimary(kFALSE);
32  }
33  target_track->SetID(i);
34  target_track->SetCharge(charge);
35  target_track->SetPdg(particle->GetPdg());
36  target_track->GetLink()->Clear();
37  target_track->GetLink()->SetLink(0, i);
38  target_track->GetMomentum()->SetPxPyPzE(
39  particle->Px(), particle->Py(), particle->Pz(), particle->E());
40  target_track->GetFreezoutPosition()->SetXYZT(
41  particle->X(), particle->Y(), particle->Z(), particle->T());
42  target_track->SetStatus(particle->GetStatus());
43  target_track->SetEvent(this);
44  }
45 }
46 
47 void NicaUnigenEvent::Clear(Option_t* opt) {
48  NicaMCEvent::Clear(opt);
49  if (fSource) fSource->Clear(opt);
50 }
51 
53  : NicaMCEvent(other) {}
54 
56  fSource = new NicaUnigenEventInterface();
57 }
58 
60 
61 TString NicaUnigenEvent::GetFormatName() const { return "UnigenFormat"; }
62 
64  FairRootManager* manager = FairRootManager::Instance();
65  if (manager->CheckBranch("UEvent.")) { return kTRUE; }
66  return kFALSE;
67 }
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
UParticle::GetPdg
Int_t GetPdg() const
Definition: UParticle.h:69
UEvent::GetNpa
Int_t GetNpa() const
Definition: UEvent.h:37
NicaUnigenEvent::ExistInTree
virtual Bool_t ExistInTree() const
Definition: NicaUnigenEvent.cxx:63
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
NicaUnigenEvent::~NicaUnigenEvent
virtual ~NicaUnigenEvent()
Definition: NicaUnigenEvent.cxx:59
UParticle::Y
Double_t Y() const
Definition: UParticle.h:88
NicaUnigenEvent.h
NicaUnigenEvent::GetFormatName
virtual TString GetFormatName() const
Definition: NicaUnigenEvent.cxx:61
NicaUnigenEvent::NicaUnigenEvent
NicaUnigenEvent()
Definition: NicaUnigenEvent.cxx:14
UEvent
Definition: UEvent.h:12
UParticle::T
Double_t T() const
Definition: UParticle.h:90
NicaUnigenEvent::Clear
virtual void Clear(Option_t *opt=" ")
Definition: NicaUnigenEvent.cxx:47
NicaUnigenEvent::Update
virtual void Update()
Definition: NicaUnigenEvent.cxx:16
UParticle::SetPdg
void SetPdg(Int_t pdg)
Definition: UParticle.h:99
NicaUnigenEventInterface.h
NicaUnigenEvent::CreateSource
void CreateSource()
Definition: NicaUnigenEvent.cxx:55
UEvent::GetParticle
UParticle * GetParticle(Int_t index) const
Definition: UEvent.cxx:92
NicaUnigenEvent
Definition: NicaUnigenEvent.h:20
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
UParticle::GetStatus
Int_t GetStatus() const
Definition: UParticle.h:70
NicaUnigenEventInterface
Definition: NicaUnigenEventInterface.h:21
UParticle::GetMate
Int_t GetMate() const
Definition: UParticle.h:73
UParticle::Px
Double_t Px() const
Definition: UParticle.h:77
UParticle::Py
Double_t Py() const
Definition: UParticle.h:78