1 ////////////////////////////////////////////////////////////////////////////////
3 // AliFemtoEventReaderESDChainKine - the reader class for the Alice ESD and //
4 // the model Kinematics information tailored for the Task framework and the //
5 // Reads in AliESDfriend to create shared hit/quality information //
6 // Authors: Adam Kisiel kisiel@mps.ohio-state.edu //
8 ////////////////////////////////////////////////////////////////////////////////
9 #include "AliFemtoEventReaderESDChainKine.h"
13 #include "AliESDEvent.h"
14 #include "AliESDtrack.h"
15 #include "AliESDVertex.h"
17 #include "AliFmPhysicalHelixD.h"
18 #include "AliFmThreeVectorF.h"
20 #include "SystemOfUnits.h"
22 #include "AliFemtoEvent.h"
24 #include "AliAODParticle.h"
25 #include "TParticle.h"
26 #include "AliFemtoModelHiddenInfo.h"
28 ClassImp(AliFemtoEventReaderESDChainKine)
30 #if !(ST_NO_NAMESPACES)
31 using namespace units;
35 //____________________________
36 AliFemtoEventReaderESDChainKine::AliFemtoEventReaderESDChainKine():
45 //constructor with 0 parameters , look at default settings
49 AliFemtoEventReaderESDChainKine::AliFemtoEventReaderESDChainKine(const AliFemtoEventReaderESDChainKine& aReader):
59 fConstrained = aReader.fConstrained;
60 fNumberofEvent = aReader.fNumberofEvent;
61 fCurEvent = aReader.fCurEvent;
62 fCurFile = aReader.fCurFile;
63 fEvent = new AliESDEvent();
64 fStack = aReader.fStack;
67 AliFemtoEventReaderESDChainKine::~AliFemtoEventReaderESDChainKine()
74 AliFemtoEventReaderESDChainKine& AliFemtoEventReaderESDChainKine::operator=(const AliFemtoEventReaderESDChainKine& aReader)
76 // Assignment operator
80 fConstrained = aReader.fConstrained;
81 fNumberofEvent = aReader.fNumberofEvent;
82 fCurEvent = aReader.fCurEvent;
83 fCurFile = aReader.fCurFile;
84 if (fEvent) delete fEvent;
85 fEvent = new AliESDEvent();
86 fStack = aReader.fStack;
92 AliFemtoString AliFemtoEventReaderESDChainKine::Report()
94 AliFemtoString temp = "\n This is the AliFemtoEventReaderESDChainKine\n";
99 void AliFemtoEventReaderESDChainKine::SetConstrained(const bool constrained)
101 // Select whether to read constrained or not constrained momentum
102 fConstrained=constrained;
105 bool AliFemtoEventReaderESDChainKine::GetConstrained() const
107 // Check whether we read constrained or not constrained momentum
111 AliFemtoEvent* AliFemtoEventReaderESDChainKine::ReturnHbtEvent()
113 // Get the event, read all the relevant information
114 // and fill the AliFemtoEvent class
115 // Returns a valid AliFemtoEvent
116 AliFemtoEvent *hbtEvent = 0;
117 string tFriendFileName;
119 // Get the friend information
120 cout<<"starting to read event "<<fCurEvent<<endl;
121 // fEvent->SetESDfriend(fEventFriend);
123 hbtEvent = new AliFemtoEvent;
124 //setting basic things
125 // hbtEvent->SetEventNumber(fEvent->GetEventNumber());
126 hbtEvent->SetRunNumber(fEvent->GetRunNumber());
127 //hbtEvent->SetNumberOfTracks(fEvent->GetNumberOfTracks());
128 hbtEvent->SetMagneticField(fEvent->GetMagneticField()*kilogauss);//to check if here is ok
129 hbtEvent->SetZDCN1Energy(fEvent->GetZDCN1Energy());
130 hbtEvent->SetZDCP1Energy(fEvent->GetZDCP1Energy());
131 hbtEvent->SetZDCN2Energy(fEvent->GetZDCN2Energy());
132 hbtEvent->SetZDCP2Energy(fEvent->GetZDCP2Energy());
133 hbtEvent->SetZDCEMEnergy(fEvent->GetZDCEMEnergy());
134 hbtEvent->SetZDCParticipants(fEvent->GetZDCParticipants());
135 hbtEvent->SetTriggerMask(fEvent->GetTriggerMask());
136 hbtEvent->SetTriggerCluster(fEvent->GetTriggerCluster());
140 fEvent->GetVertex()->GetXYZ(fV1);
142 AliFmThreeVectorF vertex(fV1[0],fV1[1],fV1[2]);
143 hbtEvent->SetPrimVertPos(vertex);
145 //starting to reading tracks
146 int nofTracks=0; //number of reconstructed tracks in event
147 nofTracks=fEvent->GetNumberOfTracks();
148 int realnofTracks=0;//number of track which we use ina analysis
150 for (int i=0;i<nofTracks;i++)
152 bool tGoodMomentum=true; //flaga to chcek if we can read momentum of this track
154 AliFemtoTrack* trackCopy = new AliFemtoTrack();
155 const AliESDtrack *esdtrack=fEvent->GetTrack(i);//getting next track
156 // const AliESDfriendTrack *tESDfriendTrack = esdtrack->GetFriendTrack();
158 trackCopy->SetCharge((short)esdtrack->GetSign());
160 //in aliroot we have AliPID
161 //0-electron 1-muon 2-pion 3-kaon 4-proton 5-photon 6-pi0 7-neutron 8-kaon0 9-eleCon
162 //we use only 5 first
164 esdtrack->GetESDpid(esdpid);
165 trackCopy->SetPidProbElectron(esdpid[0]);
166 trackCopy->SetPidProbMuon(esdpid[1]);
167 trackCopy->SetPidProbPion(esdpid[2]);
168 trackCopy->SetPidProbKaon(esdpid[3]);
169 trackCopy->SetPidProbProton(esdpid[4]);
172 if (fConstrained==true)
173 tGoodMomentum=esdtrack->GetConstrainedPxPyPz(pxyz); //reading constrained momentum
175 tGoodMomentum=esdtrack->GetPxPyPz(pxyz);//reading noconstarined momentum
177 AliFemtoThreeVector v(pxyz[0],pxyz[1],pxyz[2]);
178 if (v.mag() < 0.0001) {
179 // cout << "Found 0 momentum ???? " <<endl;
183 trackCopy->SetP(v);//setting momentum
184 trackCopy->SetPt(sqrt(pxyz[0]*pxyz[0]+pxyz[1]*pxyz[1]));
185 const AliFmThreeVectorD kP(pxyz[0],pxyz[1],pxyz[2]);
186 const AliFmThreeVectorD kOrigin(fV1[0],fV1[1],fV1[2]);
187 //setting helix I do not if it is ok
188 AliFmPhysicalHelixD helix(kP,kOrigin,(double)(fEvent->GetMagneticField())*kilogauss,(double)(trackCopy->Charge()));
189 trackCopy->SetHelix(helix);
191 trackCopy->SetTrackId(esdtrack->GetID());
192 trackCopy->SetFlags(esdtrack->GetStatus());
193 trackCopy->SetLabel(esdtrack->GetLabel());
195 //some stuff which could be useful
198 esdtrack->GetImpactParameters(impact,covimpact);
199 trackCopy->SetImpactD(impact[0]);
200 trackCopy->SetImpactZ(impact[1]);
201 trackCopy->SetCdd(covimpact[0]);
202 trackCopy->SetCdz(covimpact[1]);
203 trackCopy->SetCzz(covimpact[2]);
204 trackCopy->SetITSchi2(esdtrack->GetITSchi2());
205 trackCopy->SetITSncls(esdtrack->GetNcls(0));
206 trackCopy->SetTPCchi2(esdtrack->GetTPCchi2());
207 trackCopy->SetTPCncls(esdtrack->GetTPCNcls());
208 trackCopy->SetTPCnclsF(esdtrack->GetTPCNclsF());
209 trackCopy->SetTPCsignalN((short)esdtrack->GetTPCsignalN()); //due to bug in aliesdtrack class
210 trackCopy->SetTPCsignalS(esdtrack->GetTPCsignalSigma());
213 trackCopy->SetTPCClusterMap(esdtrack->GetTPCClusterMap());
214 trackCopy->SetTPCSharedMap(esdtrack->GetTPCSharedMap());
217 fEvent->GetPrimaryVertex()->GetXYZ(pvrt);
220 esdtrack->GetInnerXYZ(xtpc);
222 trackCopy->SetNominalTPCEntrancePoint(xtpc);
224 esdtrack->GetOuterXYZ(xtpc);
226 trackCopy->SetNominalTPCExitPoint(xtpc);
229 for (int ik=0; ik<3; ik++) {
230 indexes[ik] = esdtrack->GetKinkIndex(ik);
232 trackCopy->SetKinkIndexes(indexes);
234 // Fill the hidden information with the simulated data
235 TParticle *tPart = fStack->Particle(TMath::Abs(esdtrack->GetLabel()));
236 AliAODParticle* tParticle= new AliAODParticle(*tPart,i);
237 AliFemtoModelHiddenInfo *tInfo = new AliFemtoModelHiddenInfo();
238 tInfo->SetPDGPid(tParticle->GetMostProbable());
239 tInfo->SetTrueMomentum(tParticle->Px(), tParticle->Py(), tParticle->Pz());
240 Double_t mass2 = (tParticle->E()*tParticle->E() -
241 tParticle->Px()*tParticle->Px() -
242 tParticle->Py()*tParticle->Py() -
243 tParticle->Pz()*tParticle->Pz());
247 tInfo->SetMass(TMath::Sqrt(mass2));
250 tInfo->SetEmissionPoint(tParticle->Vx(), tParticle->Vy(), tParticle->Vz(), tParticle->T());
251 trackCopy->SetHiddenInfo(tInfo);
253 //decision if we want this track
254 //if we using diffrent labels we want that this label was use for first time
255 //if we use hidden info we want to have match between sim data and ESD
256 if (tGoodMomentum==true)
258 hbtEvent->TrackCollection()->push_back(trackCopy);//adding track to analysis
259 realnofTracks++;//real number of tracks
269 hbtEvent->SetNumberOfTracks(realnofTracks);//setting number of track which we read in event
271 cout<<"end of reading nt "<<nofTracks<<" real number "<<realnofTracks<<endl;
274 //___________________
275 void AliFemtoEventReaderESDChainKine::SetESDSource(AliESDEvent *aESD)
277 // The chain loads the ESD for us
278 // You must provide the address where it can be found
281 //___________________
282 void AliFemtoEventReaderESDChainKine::SetStackSource(AliStack *aStack)
284 // The chain loads the stack for us
285 // You must provide the address where it can be found