AliPhysics  db95e02 (db95e02)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliJetRandomizerTask.cxx
Go to the documentation of this file.
1 // $Id$
2 //
3 // Jet randomizer task.
4 //
5 // Author: S.Aiola, C.Loizides
6 
7 #include <TClonesArray.h>
8 #include <TLorentzVector.h>
9 #include <TRandom3.h>
10 
11 #include "AliAnalysisManager.h"
12 #include "AliVEvent.h"
13 #include "AliVCluster.h"
14 #include "AliEMCALDigit.h"
15 #include "AliEMCALRecPoint.h"
16 #include "AliPicoTrack.h"
17 #include "AliEMCALGeometry.h"
18 #include "AliLog.h"
19 
20 #include "AliJetRandomizerTask.h"
21 
23 
24 //________________________________________________________________________
27  fRandomizeEta(0)
28 {
29  // Default constructor.
30 
31  SetSuffix("Randomized");
32  SetMarkMC(0);
33 }
34 
35 //________________________________________________________________________
37  AliJetModelBaseTask(name),
38  fRandomizeEta(0)
39 {
40  // Standard constructor.
41 
42  SetSuffix("Randomized");
43  SetMarkMC(0);
44 }
45 
46 //________________________________________________________________________
48 {
49  // Destructor
50 }
51 
52 //________________________________________________________________________
54 {
55  // Execute per event.
56 
57  if (!fCopyArray) {
58  AliWarning("fCopyArray == kFALSE not allowed for AliJetRandomizerTask, will set kTRUE");
59  fCopyArray = kTRUE;
60  }
61 
62  if (!fIsInit) {
63  ExecOnce();
64  fIsInit = 1;
65  }
66 
67  Run();
68 }
69 
70 //________________________________________________________________________
72 {
73  // Randomize particles.
74 
75  Double_t eta = -999;
76 
77  if (fNClusters > 0 && fOutClusters) {
78  const Int_t nClusters = fClusters->GetEntriesFast();
79  for (Int_t i = 0; i < nClusters; ++i) {
80  AliVCluster *cluster = dynamic_cast<AliVCluster*>(fClusters->At(i));
81  if (!cluster)
82  continue;
83  if (!cluster->IsEMCAL())
84  continue;
85 
86  Float_t pos[3];
87  cluster->GetPosition(pos);
88  TVector3 clusVec(pos);
89  if (fRandomizeEta == 0)
90  eta = clusVec.Eta();
91  else if (fRandomizeEta == 2)
92  eta = -clusVec.Eta();
93  AddCluster(cluster->E(), eta);
94  }
95  }
96 
97  if (fNTracks > 0 && fOutTracks) {
98  const Int_t nTracks = fTracks->GetEntriesFast();
99  for (Int_t i = 0; i < nTracks; ++i) {
100  AliPicoTrack *track = dynamic_cast<AliPicoTrack*>(fTracks->At(i));
101  if (!track)
102  continue;
103  if (fRandomizeEta == 0)
104  eta = track->Eta();
105  else if (fRandomizeEta == 2)
106  eta = -track->Eta();
107  AddTrack(track->Pt(), eta);
108  }
109  }
110 }
double Double_t
Definition: External.C:58
TClonesArray * fClusters
! cluster collection
TClonesArray * fOutClusters
! output cluster collection
Bool_t fIsInit
! =true if initialized
Base class for embedding into an event.
TClonesArray * fOutTracks
! output track collection
Double_t Eta() const
Definition: AliPicoTrack.h:37
Int_t fNTracks
how many tracks are being processed
int Int_t
Definition: External.C:63
float Float_t
Definition: External.C:68
Int_t fNClusters
how many clusters are being processed
Double_t Pt() const
Definition: AliPicoTrack.h:23
Bool_t fCopyArray
whether or not the array will be copied to a new one before modelling
void Run()
intialize task
AliVCluster * AddCluster(Double_t e=-1, Double_t eta=-999, Double_t phi=-1, Int_t label=0)
add a cell with given energy, position and times
const char Option_t
Definition: External.C:48
void SetSuffix(const char *s)
AliPicoTrack * AddTrack(Double_t pt=-999, Double_t eta=-999, Double_t phi=-999, Byte_t type=0, Double_t etaemc=0, Double_t phiemc=0, Double_t ptemc=0, Bool_t ise=kFALSE, Int_t label=0, Short_t charge=1, Double_t mass=0.1396)
add a cluster (copy)
TClonesArray * fTracks
! track collection
virtual Bool_t ExecOnce()
generate a particle with random eta,phi, and correlated pt,mass values
ClassImp(AliJetRandomizerTask) AliJetRandomizerTask