AliPhysics  41af4b0 (41af4b0)
AliEmcalParticleMaker.cxx
Go to the documentation of this file.
1 // $Id$
2 //
3 // Class to make emcal particles in AOD/ESD events.
4 //
5 // Author: S.Aiola
6 
7 #include <TClonesArray.h>
8 
9 #include "AliLog.h"
10 #include "AliVTrack.h"
11 #include "AliVCluster.h"
12 #include "AliEmcalParticle.h"
13 
14 #include "AliEmcalParticleMaker.h"
15 
16 ClassImp(AliEmcalParticleMaker)
17 
18 //________________________________________________________________________
21  fTracksOutName("EmcalTracks"),
22  fCaloOutName("EmcalClusters"),
23  fTracksOut(0),
24  fCaloClustersOut(0)
25 {
26  // Constructor.
27 }
28 
29 //________________________________________________________________________
31  AliAnalysisTaskEmcal(name,kFALSE),
32  fTracksOutName("EmcalTracks"),
33  fCaloOutName("EmcalClusters"),
34  fTracksOut(0),
35  fCaloClustersOut(0)
36 {
37  // Constructor.
38 }
39 
40 //________________________________________________________________________
42 {
43  // Destructor.
44 }
45 
46 //________________________________________________________________________
48 {
49  // Init the analysis.
50 
52 
53  if (!fLocalInitialized)
54  return;
55 
56  if (!fTracksOutName.IsNull()) {
57  fTracksOut = new TClonesArray("AliEmcalParticle");
58  fTracksOut->SetName(fTracksOutName);
60  }
61 
62  if (!fCaloOutName.IsNull()) {
63  fCaloClustersOut = new TClonesArray("AliEmcalParticle");
66  }
67 }
68 
69 //________________________________________________________________________
71 {
72  // Create the emcal particles
73 
74  if (fTracks && fTracksOut) {
75  // clear container (normally a null operation as the event should clean it already)
76  fTracksOut->Delete();
77  const Int_t Ntracks = fTracks->GetEntries();
78  for (Int_t iTracks = 0; iTracks < Ntracks; ++iTracks) {
79  AliVTrack *track = static_cast<AliVTrack*>(fTracks->At(iTracks));
80  AliEmcalParticle *ep = new ((*fTracksOut)[iTracks]) AliEmcalParticle(track, iTracks);
81  if (0&&fCaloClusters)
83  }
84  }
85 
87  // clear container (normally a null operation as the event should clean it already)
88  fCaloClustersOut->Delete();
89  const Int_t Nclusters = fCaloClusters->GetEntries();
90  for (Int_t iClusters = 0, iN=0; iClusters < Nclusters; ++iClusters) {
91  AliVCluster *cluster = static_cast<AliVCluster*>(fCaloClusters->At(iClusters));
92  /* Commented because for simplicity prefer to keep indices aligned with clusters (CL)
93  if (!cluster->IsEMCAL()) continue;
94  */
95  AliEmcalParticle *ep = new ((*fCaloClustersOut)[iN++]) AliEmcalParticle(cluster, iClusters, fVertex[0], fVertex[1], fVertex[2]);
96  if (0&&fTracks)
98  }
99  }
100  return kTRUE;
101 }
void ExecOnce()
Perform steps needed to initialize the analysis.
Base task in the EMCAL framework.
Bool_t fLocalInitialized
whether or not the task has been already initialized
void SetMatchedPtr(TObjArray *arr)
TClonesArray * fCaloClustersOut
track array out
TClonesArray * fCaloClusters
!clusters
int Int_t
Definition: External.C:63
Bool_t Run()
Run function. This is the core function of the analysis and contains the user code. Therefore users have to implement this function.
TClonesArray * fTracks
!tracks
Double_t fVertex[3]
!event vertex
virtual void ExecOnce()
Perform steps needed to initialize the analysis.
void AddObjectToEvent(TObject *obj, Bool_t attempt=kFALSE)
Add object to event.
bool Bool_t
Definition: External.C:53