]> git.uio.no Git - u/mrichter/AliRoot.git/blame - JETAN/AliJetMCReader.cxx
Add required AliVParticle functionality (Markus)
[u/mrichter/AliRoot.git] / JETAN / AliJetMCReader.cxx
CommitLineData
99e5fe42 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// Jet MC Reader
17// MC reader for jet analysis
18// Author: Mercedes Lopez Noriega (mercedes.lopez.noriega@cern.ch)
19
20// From root ...
21#include <TClonesArray.h>
22#include <TPDGCode.h>
23#include <TParticle.h>
24#include <TParticlePDG.h>
25#include <TVector3.h>
26#include <TLorentzVector.h>
27#include <TSystem.h>
28// From AliRoot ...
29#include "AliJetMCReader.h"
30#include "AliJetMCReaderHeader.h"
1b307662 31#include "AliESDEvent.h"
99e5fe42 32#include "AliESDtrack.h"
33
87f40625 34ClassImp(AliJetMCReader)
99e5fe42 35
b45b0c92 36
37AliJetMCReader::AliJetMCReader():
38 AliJetESDReader(),
39 fChainMC(0x0)
99e5fe42 40{
41 // Constructor
99e5fe42 42}
43
44//____________________________________________________________________________
45
46AliJetMCReader::~AliJetMCReader()
47{
48 // Destructor
b45b0c92 49 delete fChainMC;
99e5fe42 50}
51
52//____________________________________________________________________________
53
54
0ffa8579 55Bool_t AliJetMCReader::FillMomentumArray(Int_t event)
99e5fe42 56{
57// Fill momentum array
58 TClonesArray &arrayMC = *fArrayMC;
59 Int_t goodTrack = 0;
60 Int_t nt = 0;
61 Float_t pt, e;
62 TVector3 p;
63
64 // clear array
65 ClearArray();
66 // get event from chains
67 fChain->GetEntry(event);
68 fChainMC->GetEntry(event);
69 // get number of tracks in event (for the loop)
70 nt = fESD->GetNumberOfTracks();
71
72 // get cuts set by user
73 Double_t ptMin = ((AliJetMCReaderHeader*) fReaderHeader)->GetPtCut();
74
75 //loop over particles
76 for (Int_t it = 0; it < nt; it++) {
77 AliESDtrack *track = fESD->GetTrack(it); //track
78 UInt_t status = track->GetStatus();
79 if ((status & AliESDtrack::kITSrefit) == 0) continue; // quality check
80 // track->GetImpactParameters(dca,z);
81 // if (dca > dcaMax) continue; // check track is reasonable
82 Int_t label = TMath::Abs(track->GetLabel());
83 TParticle *part = (TParticle*)arrayMC[label]; //particle
84 pt = part->Pt(); // pt of the particle
85 if (pt < ptMin) continue; //check cuts
86 p = part->P();
87 e = part->Energy();
99e5fe42 88 // fill momentum array
89 new ((*fMomentumArray)[goodTrack]) TLorentzVector(p.X(), p.Y(), p.Z(), e);
90 goodTrack++;
91 }
92 printf("\nNumber of good tracks %d \n", goodTrack);
0ffa8579 93 return kTRUE;
99e5fe42 94}
95
96