AliPhysics  vAN-20150630 (513c479)
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
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 
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 (!fInitialized)
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 SetMatchedPtr(TObjArray *arr)
void AddObjectToEvent(TObject *obj)
TClonesArray * fCaloClustersOut
track array out
TClonesArray * fCaloClusters
tracks
ClassImp(AliEmcalParticleMaker) AliEmcalParticleMaker
TClonesArray * fTracks
emcal geometry
Double_t fVertex[3]
event plane V0C