]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/AliEMCALJetFinderInputSimPrep.cxx
Reset the Getter in the dtor
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALJetFinderInputSimPrep.cxx
CommitLineData
f7d5860b 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16
ee6b678f 17/* $Id$ */
f7d5860b 18
19//_________________________________________________________________________
20// Class for JetFinder Input preparation from simulated data
21//
22//*-- Author: Mark Horner (LBL/UCT)
23//
24
25
26
27#include "AliEMCALJetFinderInputSimPrep.h"
28
29#include <TParticle.h>
30#include <TParticlePDG.h>
31#include <TPDGCode.h>
32#include <TFile.h>
33#include <TTree.h>
34#include <TObjectTable.h>
35#include <TMath.h>
36
37
38#include "AliRun.h"
39#include "AliMagF.h"
40#include "AliEMCALFast.h"
41#include "AliEMCAL.h"
42#include "AliEMCALHit.h"
43#include "AliEMCALGeometry.h"
44#include "AliEMCALGetter.h"
45#include "AliGenEventHeader.h"
46#include "AliGenPythiaEventHeader.h"
47#include "AliGenerator.h"
48#include "AliHeader.h"
5d12ce38 49#include "AliMC.h"
f7d5860b 50
51
52ClassImp(AliEMCALJetFinderInputSimPrep)
53
54AliEMCALJetFinderInputSimPrep::AliEMCALJetFinderInputSimPrep()
55{
44f59d68 56 // Default constructor
f7d5860b 57if (fDebug > 0) Info("AliEMCALJetFinderInputSimPrep","Beginning Constructor");
58
59 fDebug = 0;
60 fSmearType = kSmearEffic;
61 fEMCALType = kHits;
62 fTrackType = kCharged;
63 fEfficiency = 0.90;
64
65}
66AliEMCALJetFinderInputSimPrep::~AliEMCALJetFinderInputSimPrep()
67{
68if (fDebug > 0) Info("~AliEMCALJetFinderInputSimPrep","Beginning Destructor");
69
70}
71
72void AliEMCALJetFinderInputSimPrep::Reset(AliEMCALJetFinderResetType_t resettype)
73{
44f59d68 74 // Method to reset data
f7d5860b 75if (fDebug > 1) Info("Reset","Beginning Reset");
76 switch (resettype){
77
78 case kResetData:
79 fInputObject.Reset(resettype);
80 break;
81 case kResetTracks:
82 fInputObject.Reset(resettype);
83 break;
84 case kResetDigits:
85 fInputObject.Reset(resettype);
86 break;
87 case kResetParameters:
88 fSmearType = kSmearEffic;
89 fEMCALType = kHits;
90 fTrackType = kCharged;
91 break;
92 case kResetAll:
93 fSmearType = kSmearEffic;
94 fEMCALType = kHits;
95 fTrackType = kCharged;
96 fInputObject.Reset(resettype);
97 break;
98 case kResetPartons:
99 Warning("FillFromFile", "kResetPartons not implemented") ;
100 break;
101 case kResetParticles:
102 Warning("FillFromFile", "kResetParticles not implemented") ;
103 break;
104 case kResetJets:
105 Warning("FillFromFile", "kResetJets not implemented") ;
106 break;
107 }// end switch
108
109}
110
111Int_t AliEMCALJetFinderInputSimPrep::FillFromFile(TString *filename, AliEMCALJetFinderFileType_t filetype,Int_t EventNumber)
112{
113 // gObjectTable->Print();
114 // Test that file exists - Getter doesn't like bogus filenames
115if (fDebug > 1) Info("FillFromFile","Beginning FillFromFile");
116 fFileType = filetype;
117 TFile file(filename->Data());
118 if (!file.IsOpen()){
119 Error("FillFromFile","Could not open file in FillFromFile");
120 return -1;
121 }
122 file.Close();
123 /*
124 gAlice = static_cast<AliRun *>(file.Get("gAlice"));
125 AliEMCAL* pEMCAL = (AliEMCAL*) gAlice->GetModule("EMCAL");
126 if (gAlice->GetEvent(EventNumber) < 0){
127 Error("FillFromFile","Could not open event in FillFromFile");
128 file.Close();
129 return -1;
130 }*/
131 AliEMCALGetter *gime = AliEMCALGetter::Instance(filename->Data());
132 gime->Event(EventNumber) ;
133
134 if ( fEMCALType == kHits ||
135 fEMCALType == kTimeCut ) FillHits();
136 if ( fTrackType != kNoTracks ) FillTracks();
137 if ( fFileType != kData){
138 FillPartons();
139// FillParticles();
140 }
141 //gime->CloseFile();
142// gObjectTable->Print();
143 delete gime;
144 return 0;
145}
146
44f59d68 147void AliEMCALJetFinderInputSimPrep::FillHits()
f7d5860b 148{
44f59d68 149 // Fill from the hits to input object from simulation
f7d5860b 150if (fDebug > 1) Info("FillHits","Beginning FillHits");
151
152// Access hit information
153 AliEMCALHit *mHit;
154 AliEMCAL* pEMCAL = (AliEMCAL*) gAlice->GetModule("EMCAL");
155 Info("AliEMCALJetFinderInputSimPrep","Title of the geometry is %s",pEMCAL->GetTitle());
156 AliEMCALGeometry* geom = AliEMCALGetter::Instance()->EMCALGeometry();
157// Float_t samplingF = geom->GetSampling();
158 Float_t samplingF = 11.6;
159 Info("AliEMCALJetFinderInputSimPrep","Sampling fraction is %f",samplingF);
160 TTree *treeH = AliEMCALGetter::Instance()->TreeH();
161 Int_t ntracks = (Int_t) treeH->GetEntries();
162//
163// Loop over tracks
164//
165 Int_t nbytes = 0;
166 Double_t etH = 0.0;
167
168 for (Int_t track=0; track<ntracks;track++) {
169 gAlice->ResetHits();
170 nbytes += treeH->GetEvent(track);
171//
172// Loop over hits
173//
174 for(mHit=(AliEMCALHit*) pEMCAL->FirstHit(-1);
175 mHit;
176 mHit=(AliEMCALHit*) pEMCAL->NextHit())
177 {
178 if (fEMCALType == kTimeCut &&
179 (mHit->GetTime()>fTimeCut) ) continue;
180 Float_t x = mHit->X(); // x-pos of hit
181 Float_t y = mHit->Y(); // y-pos
182 Float_t z = mHit->Z(); // z-pos
183 Float_t eloss = mHit->GetEnergy(); // deposited energy
184
185 Float_t r = TMath::Sqrt(x*x+y*y);
186 Float_t theta = TMath::ATan2(r,z);
187 Float_t eta = -TMath::Log(TMath::Tan(theta/2.));
188 Float_t phi = TMath::ATan2(y,x);
189 etH = samplingF*eloss*TMath::Sin(theta);
190 if (fDebug > 10) Info("FillHits","Values of hit energy %i",Int_t(1e7*etH));
191 if (geom->TowerIndexFromEtaPhi(eta,180.0/TMath::Pi()*phi) == -1)
192 {
193 if (fDebug >5)
194 {
195 Error("FillHits","Hit not inside EMCAL!");
196 mHit->Dump();
197 }
198 continue;
199 }
200 fInputObject.AddEnergyToDigit(geom->TowerIndexFromEtaPhi(eta,180.0/TMath::Pi()*phi)-1,Int_t(1e7*etH));
201 } // Hit Loop
202 } // Track Loop
203
204
205}
44f59d68 206void AliEMCALJetFinderInputSimPrep::FillTracks()
f7d5860b 207{
44f59d68 208 // Fill from particles simulating a TPC to input object from simulation
f7d5860b 209
210 if (fDebug > 1) Info("FillTracks","Beginning FillTracks");
211
212 TParticlePDG* pdgP = 0;
44f59d68 213 TParticle *mPart;
f7d5860b 214 Int_t npart = (gAlice->GetHeader())->GetNprimary();
215 Float_t bfield,rEMCAL;
216
217 if (fDebug > 1) Info("FillTracks","Defining the geometry");
218
219 AliEMCAL* pEMCAL = (AliEMCAL*) gAlice->GetModule("EMCAL");
220 AliEMCALGeometry* geom = AliEMCALGeometry::GetInstance(pEMCAL->GetTitle(), "");
221 fEtaMax = geom->GetArm1EtaMax();
222 fEtaMin = geom->GetArm1EtaMin();
223 fPhiMax = TMath::Pi()/180.0*geom->GetArm1PhiMax();
224 fPhiMin = TMath::Pi()/180.0*geom->GetArm1PhiMin();
225
226 if (fDebug > 1) Info("FillTracks","Starting particle loop");
227
228 for (Int_t part = 0; part < npart; part++) {
44f59d68 229 mPart = gAlice->GetMCApp()->Particle(part);
f7d5860b 230 //if (part%10) gObjectTable->Print();
44f59d68 231 pdgP = mPart->GetPDG();
f7d5860b 232
233 if (fDebug > 5) Info("FillTracks","Checking if track is a primary");
234
235 if (fFileType == kPythia) {
44f59d68 236 if (mPart->GetStatusCode() != 1) continue;
f7d5860b 237 } else if (fFileType == kHijing) {
44f59d68 238 if (mPart->GetFirstDaughter() >= 0 && mPart->GetFirstDaughter() < npart) continue;
f7d5860b 239 }
240
44f59d68 241 if (fDebug > 15) Info("FillTracks","Checking if track (eta - %f, phi - %f) is in acceptance",mPart->Eta(),mPart->Phi());
f7d5860b 242 if (fDebug > 10) Info("FillTracks","Checking if EMCAL acceptance ( %f < eta < %f, %f < phi < %f) is in acceptance",fEtaMin,fEtaMax,fPhiMin,fPhiMax);
243
44f59d68 244 if (mPart->Eta() > fEtaMax || mPart->Eta() < fEtaMin) continue;
245 if (mPart->Phi() > fPhiMax || mPart->Phi() < fPhiMin ) continue;
f7d5860b 246
247/*
248 {kProton, kProtonBar, kElectron, kPositron,
249 kNuE, kNuEBar, kGamma, kNeutron, kNeutronBar,
250 kMuonPlus, kMuonMinus, kK0Long , kPiPlus, kPiMinus,
251 kKPlus, kKMinus, kLambda0, kLambda0Bar, kK0Short,
252 kSigmaMinus, kSigmaPlus, kSigma0, kPi0, kK0, kK0Bar,
253 0,kNuMu,kNuMuBar
254*/
255
256 if (fDebug > 15) Info("FillTracks","Checking if track is rejected");
257
258 if ((fSmearType == kEfficiency ||
259 fSmearType == kSmearEffic) &&
260 pdgP->Charge()!=0) {
261 if (AliEMCALFast::RandomReject(fEfficiency)) {
262 continue;
263 }
264 }
265
266 bfield = gAlice->Field()->SolenoidField();
267 rEMCAL = AliEMCALGeometry::GetInstance()->GetIPDistance();
44f59d68 268 Float_t rB = 3335.6 * mPart->Pt() / bfield; // [cm] (case of |charge|=1)
f7d5860b 269 if (2.*rB < rEMCAL) continue; // track curls away
270
271 //if (part%10) gObjectTable->Print();
272 switch(fTrackType)
273 {
274
275 case kAll: // All Stable particles to be included
276 if (fDebug > 5) Info("FillTracks","Storing track");
277 if (fSmearType == kSmear ||
278 fSmearType == kSmearEffic ){
44f59d68 279 Smear(mPart);/*
f7d5860b 280 TParticle *tmp = Smear(MPart);
281 fInputObject.AddTrack(Smear(MPart));
282 delete tmp;*/
283 }else{
44f59d68 284 fInputObject.AddTrack(*mPart);
f7d5860b 285 }
286 break;
287 case kEM: // All Electromagnetic particles
44f59d68 288 if (mPart->GetPdgCode() == kElectron ||
289 mPart->GetPdgCode() == kMuonPlus ||
290 mPart->GetPdgCode() == kMuonMinus ||
291 mPart->GetPdgCode() == kPositron ){
f7d5860b 292 if (fDebug > 5) Info("FillTracks","Storing electron or positron");
293 if (fSmearType == kSmear ||
294 fSmearType == kSmearEffic ){
44f59d68 295 Smear(mPart);/*
f7d5860b 296 TParticle *tmp = Smear(MPart);
297 fInputObject.AddTrack(tmp);
298 delete tmp;*/
299 }else{
44f59d68 300 fInputObject.AddTrack(*mPart);
f7d5860b 301 }
302 }
44f59d68 303 if ( mPart->GetPdgCode() == kGamma ){
304 fInputObject.AddTrack(*mPart);
f7d5860b 305 if (fDebug > 5) Info("FillTracks","Storing gamma");
306 }
307
308 break;
309 case kCharged: // All Particles with non-zero charge
310 if (pdgP->Charge() != 0) {
311 if (fDebug > 5) Info("FillTracks","Storing charged track");
312 if (fSmearType == kSmear ||
313 fSmearType == kSmearEffic ){
44f59d68 314 Smear(mPart);/*
f7d5860b 315 TParticle *tmp = Smear(MPart);
316 fInputObject.AddTrack(tmp);
317 delete tmp;*/
318 }else{
44f59d68 319 fInputObject.AddTrack(*mPart);
f7d5860b 320 }
321 }
322 break;
323 case kNeutral: // All particles with no charge
324 if (pdgP->Charge() == 0){
44f59d68 325 fInputObject.AddTrack(*mPart);
f7d5860b 326 if (fDebug > 5) Info("FillTracks","Storing neutral");
327 }
328 break;
329 case kHadron: //All hadrons
44f59d68 330 if (mPart->GetPdgCode() != kElectron &&
331 mPart->GetPdgCode() != kPositron &&
332 mPart->GetPdgCode() != kMuonPlus &&
333 mPart->GetPdgCode() != kMuonMinus &&
334 mPart->GetPdgCode() != kGamma )
f7d5860b 335 {
336 if (fDebug > 5) Info("FillTracks","Storing hadron");
337 if (pdgP->Charge() == 0){
44f59d68 338 fInputObject.AddTrack(*mPart);
f7d5860b 339 }else{
340 if (fSmearType == kSmear ||
341 fSmearType == kSmearEffic ){
44f59d68 342 Smear(mPart);/*
f7d5860b 343 TParticle *tmp = Smear(MPart);
344 fInputObject.AddTrack(tmp);
345 delete tmp;*/
346 }else{
44f59d68 347 fInputObject.AddTrack(*mPart);
f7d5860b 348 }
349 }
350 }
351 break;
352 case kChargedHadron: // only charged hadrons
44f59d68 353 if (mPart->GetPdgCode() != kElectron &&
354 mPart->GetPdgCode() != kPositron &&
355 mPart->GetPdgCode() != kGamma &&
356 mPart->GetPdgCode() != kMuonPlus &&
357 mPart->GetPdgCode() != kMuonMinus &&
f7d5860b 358 pdgP->Charge() != 0 ){
359 if (fDebug > 5) Info("FillTracks","Storing charged hadron");
360 if (fSmearType == kSmear ||
361 fSmearType == kSmearEffic ){
44f59d68 362 Smear(mPart);/*
f7d5860b 363 TParticle *tmp = Smear(MPart);
364 fInputObject.AddTrack(tmp);
365 delete tmp;*/
366 }else{
44f59d68 367 fInputObject.AddTrack(*mPart);
f7d5860b 368 }
369 }
370 break;
371 case kNoTracks:
372 break;
373 default:
374 break;
44f59d68 375 delete mPart;
f7d5860b 376 } //end of switch
377// Info("FillTracks","After Particle Storage");
378 //if (part%10) gObjectTable->Print();
379
380 } //end of particle loop
381 //gObjectTable->Print();
382}
383
44f59d68 384void AliEMCALJetFinderInputSimPrep::FillPartons()
f7d5860b 385{
44f59d68 386 // Fill partons to
387 // input object from simulation
f7d5860b 388if (fDebug > 1) Info("FillPartons","Beginning FillPartons");
389
390 AliGenEventHeader* evHeader = ((AliHeader*)(gAlice->GetHeader()))->GenEventHeader();
391 Float_t triggerJetValues[4];
392 AliEMCALParton tempParton;
393
394 if (fFileType == kPythia)
395 {
396 Int_t ntriggerjets = ((AliGenPythiaEventHeader*)evHeader)->NTriggerJets();
397 if (fDebug > 1) Info("FillPartons","Number of trigger jets --> %i",ntriggerjets);
398 for (Int_t jetcounter = 0 ; jetcounter < ntriggerjets; jetcounter++){
399 ((AliGenPythiaEventHeader*)evHeader)->TriggerJet(jetcounter,triggerJetValues);
400 TLorentzVector tempLParton;
401 tempLParton.SetPxPyPzE(triggerJetValues[0],triggerJetValues[1],triggerJetValues[2],triggerJetValues[3]);
402 tempParton.SetEnergy(tempLParton.Energy());
403 tempParton.SetEta(tempLParton.Eta());
404 tempParton.SetPhi(tempLParton.Phi());
405 FillPartonTracks(&tempParton);
406 fInputObject.AddParton(&tempParton);
407 }
408
409 }
410}
411
44f59d68 412void AliEMCALJetFinderInputSimPrep::FillParticles()
f7d5860b 413{
44f59d68 414 // Fill particles to input object from simulation
f7d5860b 415if (fDebug > 1) Info("FillParticles","Beginning FillParticles");
416
417 Int_t npart = (gAlice->GetHeader())->GetNprimary();
418 TParticlePDG* pdgP = 0;
419
420 for (Int_t part = 0; part < npart; part++) {
44f59d68 421 TParticle *mPart = gAlice->GetMCApp()->Particle(part);
422 pdgP = mPart->GetPDG();
f7d5860b 423
424 if (fDebug > 10) Info("FillParticles","Checking if particle is a primary");
425
426 if (fFileType == kPythia) {
44f59d68 427 if (mPart->GetStatusCode() != 1) continue;
f7d5860b 428 } else if (fFileType == kHijing) {
44f59d68 429 if (mPart->GetFirstDaughter() >= 0 && mPart->GetFirstDaughter() < npart) continue;
f7d5860b 430 }
431
432 if (fDebug > 10) Info("FillParticles","Checking if particle is in acceptance");
433
44f59d68 434 if (mPart->Eta() > fEtaMax || mPart->Eta() < fEtaMin) continue;
435 if (mPart->Phi() > fPhiMax || mPart->Phi() < fPhiMin ) continue;
f7d5860b 436
437
438/*
439 {kProton, kProtonBar, kElectron, kPositron,
440 kNuE, kNuEBar, kGamma, kNeutron, kNeutronBar,
441 kMuonPlus, kMuonMinus, kK0Long , kPiPlus, kPiMinus,
442 kKPlus, kKMinus, kLambda0, kLambda0Bar, kK0Short,
443 kSigmaMinus, kSigmaPlus, kSigma0, kPi0, kK0, kK0Bar,
444 0,kNuMu,kNuMuBar
445*/
446 switch(fTrackType)
447 {
448
449 case kAll: // All Stable particles to be included
450 if (fDebug > 5) Info("FillParticles","Storing particle");
44f59d68 451 fInputObject.AddParticle(mPart);
f7d5860b 452 break;
453 case kEM: // All Electromagnetic particles
44f59d68 454 if (mPart->GetPdgCode() == kElectron ||
455 mPart->GetPdgCode() == kPositron ||
456 mPart->GetPdgCode() == kGamma){
f7d5860b 457 if (fDebug > 5) Info("FillParticles","Storing electromagnetic particle");
44f59d68 458 fInputObject.AddParticle(mPart);
f7d5860b 459 }
460 break;
461 case kCharged: // All Particles with non-zero charge
462 if (pdgP->Charge() != 0) {
463 if (fDebug > 5) Info("FillParticles","Storing charged particle");
44f59d68 464 fInputObject.AddParticle(mPart);
f7d5860b 465 }
466 break;
467 case kNeutral: // All particles with no charge
468 if (pdgP->Charge() == 0){
469 if (fDebug > 5) Info("FillParticles","Storing neutral particle");
44f59d68 470 fInputObject.AddParticle(mPart);
f7d5860b 471 }
472 break;
473 case kHadron: //All hadrons
44f59d68 474 if (mPart->GetPdgCode() != kElectron &&
475 mPart->GetPdgCode() != kPositron &&
476 mPart->GetPdgCode() != kGamma )
f7d5860b 477 {
478
479 if (fDebug > 5) Info("FillParticles","Storing hadron");
44f59d68 480 fInputObject.AddParticle(mPart);
f7d5860b 481 }
482 break;
483 case kChargedHadron: // only charged hadrons
44f59d68 484 if (mPart->GetPdgCode() != kElectron &&
485 mPart->GetPdgCode() != kPositron &&
486 mPart->GetPdgCode() != kGamma &&
f7d5860b 487 pdgP->Charge() != 0 ){
488 if (fDebug > 5) Info("FillParticles","Storing charged hadron");
44f59d68 489 fInputObject.AddParticle(mPart);
f7d5860b 490 }
491 break;
492 case kNoTracks:
493 break;
494 default:
495 break;
496 } //end of switch
497 }// end of loop over particles
498
499}
44f59d68 500void AliEMCALJetFinderInputSimPrep::FillDigits()
f7d5860b 501{
44f59d68 502 // Fill digits to input object
f7d5860b 503
504}
505
506void AliEMCALJetFinderInputSimPrep::Smear(TParticle *particle)
507{
44f59d68 508 // Smear particle momentum
f7d5860b 509if (fDebug > 5) Info("Smear","Beginning Smear");
510
511 Float_t tmp = AliEMCALFast::SmearMomentum(1,particle->P());
512 Float_t tmpt = (tmp/particle->P()) * particle->Pt();
513 if (fDebug > 10) Info("Smear","Smearing changed P from %f to %f",particle->Pt(),tmpt);
514 TLorentzVector tmpvector;
515 tmpvector.SetPtEtaPhiM(tmpt,particle->Eta(), particle->Phi(), particle->GetMass());
516// create a new particle with smearing momentum - and no daughter or parent information and the same
517// vertex
518
519 TParticle tmparticle(particle->GetPdgCode(), 1, 0, 0,0,0,
520 tmpvector.Px() , tmpvector.Py(), tmpvector.Pz(), tmpvector.Energy(),
521 particle->Vx(), particle->Vy(), particle->Vz(), particle->T());
522 fInputObject.AddTrack(tmparticle);
523 return;
524}
525
526void AliEMCALJetFinderInputSimPrep::FillPartonTracks(AliEMCALParton *parton)
527{
44f59d68 528 // Populate parton tracks for input distributions
f7d5860b 529 if (fDebug>1) Info("FillPartonTracks","Beginning FillPartonTracks");
530 Int_t npart = (gAlice->GetHeader())->GetNprimary();
531 Int_t ntracks =0;
532 TParticlePDG *getpdg;
533 TParticle *tempPart;
534 for (Int_t part = 0; part < npart; part++)
535 {
5d12ce38 536 tempPart = gAlice->GetMCApp()->Particle(part);
f7d5860b 537 if (tempPart->GetStatusCode() != 1) continue;
538 if (tempPart->Eta() > fEtaMax || tempPart->Eta() < fEtaMin ||
539 tempPart->Phi() > fPhiMax || tempPart->Phi() < fPhiMin ){
540 if (fDebug>10) Info("FillPartonTracks","Excluding particle not pointing at the EMCAL");
541 continue;
542 }
543 getpdg = tempPart->GetPDG();
544 if (getpdg->Charge() == 0.0 ) {
545 if (fDebug>10) Info("FillPartonTracks","Excluding a neutral particle");
546 continue;
547 }
548 if ( (parton->Eta() - tempPart->Eta())*(parton->Eta() - tempPart->Eta()) +
549 (parton->Phi() - tempPart->Phi())*(parton->Phi() - tempPart->Phi()) < 1.0 ) ntracks++;
550 }
44f59d68 551 Float_t *energy = new Float_t[ntracks];
552 Float_t *eta = new Float_t[ntracks];
553 Float_t *phi = new Float_t[ntracks];
554 Int_t *pdg = new Int_t[ntracks];
f7d5860b 555 ntracks=0;
556 for (Int_t part = 0; part < npart; part++)
557 {
5d12ce38 558 tempPart = gAlice->GetMCApp()->Particle(part);
f7d5860b 559 if (tempPart->GetStatusCode() != 1) continue;
560 if (tempPart->Eta() > fEtaMax || tempPart->Eta() < fEtaMin ||
561 tempPart->Phi() > fPhiMax || tempPart->Phi() < fPhiMin ){
562 if (fDebug>10) Info("FillPartonTracks","Excluding particle not pointing at the EMCAL");
563 continue;
564 }
565 if (tempPart->GetStatusCode() != 1) continue;
566 getpdg = tempPart->GetPDG();
567 if (getpdg->Charge() == 0.0 ) {
568 if (fDebug>10) Info("FillPartonTracks","Excluding a neutral particle");
569 continue;
570 }
571 if ( (parton->Eta() - tempPart->Eta())*(parton->Eta() - tempPart->Eta()) +
572 (parton->Phi() - tempPart->Phi())*(parton->Phi() - tempPart->Phi()) < 1.0 )
573 {
44f59d68 574 energy[ntracks] = tempPart->Pt();
575 eta[ntracks] = tempPart->Eta();
576 phi[ntracks] = tempPart->Phi();
577 pdg[ntracks] = tempPart->GetPdgCode();
f7d5860b 578 ntracks++;
579 }
580 }
44f59d68 581 parton->SetTrackList(ntracks,energy,eta,phi,pdg);
f7d5860b 582}
583