]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGGA/EMCALJetTasks/AliJetRandomizerTask.cxx
cosmetics
[u/mrichter/AliRoot.git] / PWGGA / EMCALJetTasks / AliJetRandomizerTask.cxx
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
22 ClassImp(AliJetRandomizerTask)
23
24 //________________________________________________________________________
25 AliJetRandomizerTask::AliJetRandomizerTask() : 
26   AliJetModelBaseTask("AliJetRandomizerTask")
27 {
28   // Default constructor.
29
30   SetSuffix("Randomized");
31 }
32
33 //________________________________________________________________________
34 AliJetRandomizerTask::AliJetRandomizerTask(const char *name) : 
35   AliJetModelBaseTask(name)
36 {
37   // Standard constructor.
38
39   SetSuffix("Randomized");
40 }
41
42 //________________________________________________________________________
43 AliJetRandomizerTask::~AliJetRandomizerTask()
44 {
45   // Destructor
46 }
47
48 //________________________________________________________________________
49 void AliJetRandomizerTask::Run() 
50 {
51   // Randomize particles.
52
53   if (fNClusters > 0 && fOutClusters) {
54     const Int_t nClusters = fClusters->GetEntriesFast();
55     for (Int_t i = 0; i < nClusters; ++i) {
56       AliVCluster *cluster = dynamic_cast<AliVCluster*>(fClusters->At(i));
57       if (!cluster)
58         continue;
59       if (!cluster->IsEMCAL())
60         continue;
61
62       Float_t pos[3];
63       cluster->GetPosition(pos);
64       TVector3 clusVec(pos);
65
66       AddCluster(cluster->E(), clusVec.Eta());
67     }
68   }
69  
70   if (fNTracks > 0 && fOutTracks) {
71     const Int_t nTracks = fTracks->GetEntriesFast();
72     for (Int_t i = 0; i < nTracks; ++i) {
73       AliPicoTrack *track = dynamic_cast<AliPicoTrack*>(fTracks->At(i));
74       if (!track)
75         continue;
76
77       AddTrack(track->Pt(), track->Eta());
78     }
79   }
80 }
81
82 //________________________________________________________________________
83 void AliJetRandomizerTask::UserExec(Option_t *) 
84 {
85   // Execute per event.
86
87   if (!fCopyArray) {
88     AliWarning("fCopyArray == kFALSE not allowed for AliJetRandomizerTask, will set kTRUE");
89     fCopyArray = kTRUE;
90   }
91
92   Init();
93
94   Run();
95 }