104{
105 TDatabasePDG* pdgBase = TDatabasePDG::Instance();
107 Double_t
dx = 0,
dy = 0;
108 std::unordered_map<int, int> muList;
109 std::unordered_map<int, std::vector<int>> moList;
112 muList.clear();
113 moList.clear();
116 LOGF(info,
"Reading event %i",
fn);
117 }
118
119 if (TMath::Abs(int(id))==13) {
120 mass = pdgBase->GetParticle(
id)->Mass();
122 tof = 0;
123 break;}
124 if (id==-1){
125 Bool_t found = false;
128 Int_t abspid = TMath::Abs(
v->PdgCode());
129 if (abspid==13 or (not
followMuons and abspid!=12 and abspid!=14) ){
130 found = true;
131 Int_t muIndex =
v->GetTrackID();
133 else if (abspid==13 ){
136 }
137 else{
138 muList.insert( { muIndex,
i });
139 }
140 }
141 }
142 }
143
144
145 std::unordered_map<int, std::vector<int>>::iterator it = moList.begin();
146 while( it!=moList.end()){
147 if (gRandom->Uniform(0.,1.)>0.99){
148 std::vector<int> list = it->second;
149 for ( Int_t i=0;
i < list.size();
i++){
151 Int_t muIndex =
v->GetTrackID();
152 muList.insert( { muIndex,
i });
153 }
154 }
155 it++;
156 }
157 if (!found) {
158 LOGF(warn,
"No muon found %i",
fn-1);
159 }
160 if (found) {break;}
161 }
162 }
164 LOGF(info,
"End of file reached %i",
fNevents);
165 return kFALSE;
166 }
169 LOGF(debug, "Seed: %d", theSeed);
170 gRandom->SetSeed(theSeed);
171 }
175 Double_t _phi = gRandom->Uniform(0., 2.) * TMath::Pi();
176 dx =
r * TMath::Cos(_phi);
177 dy =
r * TMath::Sin(_phi);
178 }
179 if (id==-1){
180 for (
unsigned i = 0;
i<
MCTrack->GetEntries();
i++ ){
182 Int_t abspid = TMath::Abs(
track->GetPdgCode());
187 Double_t phi0 = TMath::ATan2(
py,
px);
189 px =
pt*TMath::Cos(phi+phi0);
190 py =
pt*TMath::Sin(phi+phi0);
191 }
195 tof =
track->GetStartT()/1E9;
196 e =
track->GetEnergy();
197 Bool_t wanttracking = false;
198 for (std::pair<int, int> element : muList){
199 if (element.first==i){
200 wanttracking = true;
203 TVector3 lpv =
v->LastPoint();
204 TVector3 lmv =
v->LastMom();
205 if (abspid == 22){ e=lmv.Mag();}
206 else{ e = TMath::Sqrt(lmv.Mag2()+(
track->GetMass())*(
track->GetMass()));}
213 tof =
v->GetTime()/1E9;
214 }
215 break;
216 }
217 }
218 cpg->AddTrack(
track->GetPdgCode(),
px,
py,
pz,
vx,
vy,
vz,
track->GetMotherId(),wanttracking,e,tof,
track->GetWeight(),(TMCProcess)
track->GetProcID());
219 }
220 }else{
225 px =
pt*TMath::Cos(phi);
226 py =
pt*TMath::Sin(phi);
227 }
228 cpg->AddTrack(
int(
pythiaid),
px,
py,
pz,
vx*100.,
vy*100.,
vz*100.,-1.,
false,e,
pythiaid,
parentid);
229 cpg->AddTrack(
int(
id),
px,
py,
pz,
vx*100.,
vy*100.,
vz*100.,-1.,
true,e,tof,
w);
230 }
231 return kTRUE;
232}
Bool_t checkDiMuon(Int_t muIndex)