]>
Commit | Line | Data |
---|---|---|
ebcbb815 | 1 | // $Id$ |
2 | // | |
980821ba | 3 | // Task to setup emcal related global objects. |
ebcbb815 | 4 | // |
cd231d42 | 5 | // Author: C.Loizides |
ebcbb815 | 6 | |
7 | #include "AliEmcalCompatTask.h" | |
2c80cbde | 8 | |
ebcbb815 | 9 | #include <TClonesArray.h> |
2c80cbde | 10 | |
ebcbb815 | 11 | #include "AliAnalysisManager.h" |
2c80cbde | 12 | #include "AliCentrality.h" |
ebcbb815 | 13 | #include "AliESDEvent.h" |
14 | #include "AliEsdTrackExt.h" | |
15 | #include "AliEventplane.h" | |
2c80cbde | 16 | #include "AliInputEventHandler.h" |
17 | ||
ebcbb815 | 18 | ClassImp(AliEmcalCompatTask) |
19 | ||
20 | //________________________________________________________________________ | |
21 | AliEmcalCompatTask::AliEmcalCompatTask() : | |
22 | AliAnalysisTaskSE(), | |
23 | fDoCent(1), | |
24 | fDoEp(1) | |
25 | { | |
26 | // Constructor. | |
27 | } | |
28 | ||
29 | //________________________________________________________________________ | |
30 | AliEmcalCompatTask::AliEmcalCompatTask(const char *name) : | |
31 | AliAnalysisTaskSE(name), | |
32 | fDoCent(1), | |
33 | fDoEp(1) | |
34 | { | |
35 | // Constructor. | |
36 | ||
37 | fBranchNames = "ESD:AliESDHeader.,AliESDRun.,Tracks"; | |
38 | } | |
39 | ||
40 | //________________________________________________________________________ | |
41 | AliEmcalCompatTask::~AliEmcalCompatTask() | |
42 | { | |
43 | // Destructor. | |
44 | } | |
45 | ||
46 | //________________________________________________________________________ | |
47 | void AliEmcalCompatTask::UserExec(Option_t *) | |
48 | { | |
49 | // Main loop, called for each event. | |
50 | ||
51 | AliESDEvent *esdEv = dynamic_cast<AliESDEvent*>(InputEvent()); | |
52 | if (!esdEv) { | |
53 | AliError("Task works only on ESD events, returning"); | |
54 | return; | |
55 | } | |
56 | ||
57 | AliAnalysisManager *am = AliAnalysisManager::GetAnalysisManager(); | |
58 | if (!am) { | |
59 | AliError("Manager zero, returning"); | |
60 | return; | |
61 | } | |
62 | ||
63 | am->LoadBranch("AliESDHeader."); | |
64 | am->LoadBranch("AliESDRun."); | |
2c80cbde | 65 | LoadBranches(); |
ebcbb815 | 66 | |
67 | AliESDHeader *header = esdEv->GetHeader(); | |
4e8ed998 | 68 | TString title; |
69 | if (header) | |
70 | title = header->GetTitle(); | |
2c80cbde | 71 | if (title.Length()==0) { |
72 | AliError("Title should encode offline trigger, returning"); | |
ebcbb815 | 73 | return; |
2c80cbde | 74 | } else { |
75 | UInt_t off = header->GetUniqueID(); | |
76 | off &= 0x4FFFFFFF; | |
77 | UInt_t res = ((AliInputEventHandler*)(am->GetInputEventHandler()))->IsEventSelected(); | |
78 | res &= 0x4FFFFFFF; | |
79 | if (off!=res) { | |
80 | AliWarning(Form("Stored offline trigger not equal computed: %ud %ud", off, res)); | |
d41a0b1c | 81 | } |
82 | } | |
2c80cbde | 83 | |
ebcbb815 | 84 | if (fDoCent) { |
7b63a52b | 85 | am->LoadBranch("Centrality."); |
86 | AliCentrality *centin = dynamic_cast<AliCentrality*>(esdEv->FindListObject("Centrality")); | |
ebcbb815 | 87 | AliCentrality *centout = esdEv->GetCentrality(); |
4e8ed998 | 88 | if (centin&¢out&¢out->GetQuality()==999) { |
ebcbb815 | 89 | centout->SetQuality(centin->GetQuality()); |
90 | centout->SetCentralityV0M(centin->GetCentralityPercentileUnchecked("V0M")); | |
91 | centout->SetCentralityFMD(centin->GetCentralityPercentileUnchecked("FMD")); | |
92 | centout->SetCentralityTRK(centin->GetCentralityPercentileUnchecked("TRK")); | |
93 | centout->SetCentralityTKL(centin->GetCentralityPercentileUnchecked("TKL")); | |
94 | centout->SetCentralityCL0(centin->GetCentralityPercentileUnchecked("CL0")); | |
95 | centout->SetCentralityCL1(centin->GetCentralityPercentileUnchecked("CL1")); | |
96 | centout->SetCentralityV0MvsFMD(centin->GetCentralityPercentileUnchecked("V0MvsFMD")); | |
97 | centout->SetCentralityTKLvsV0M(centin->GetCentralityPercentileUnchecked("TKLvsV0M")); | |
98 | centout->SetCentralityZEMvsZDC(centin->GetCentralityPercentileUnchecked("ZEMvsZDC")); | |
99 | } | |
100 | } | |
101 | ||
102 | if (fDoEp) { | |
7b63a52b | 103 | am->LoadBranch("Eventplane."); |
104 | AliEventplane *epin = dynamic_cast<AliEventplane*>(esdEv->FindListObject("Eventplane")); | |
ebcbb815 | 105 | AliEventplane *epout = esdEv->GetEventplane(); |
4e8ed998 | 106 | if (epin&&epout&&(epout->GetQVector()==0)&&(epin->GetQVector()!=0)) { |
ebcbb815 | 107 | epout->SetQVector(new TVector2(*epin->GetQVector())); |
108 | epout->SetEventplaneQ(epin->GetEventplane("Q")); | |
109 | epout->SetQsub(new TVector2(*epin->GetQsub1()),new TVector2(*epin->GetQsub2())); | |
110 | epout->SetQsubRes(epin->GetQsubRes()); | |
111 | } | |
112 | } | |
113 | ||
114 | TTree *tree = am->GetTree(); | |
2c80cbde | 115 | if (tree&&tree->GetBranch("PicoTracks")) { |
ebcbb815 | 116 | am->LoadBranch("PicoTracks"); |
2c80cbde | 117 | } |
ebcbb815 | 118 | |
4e8ed998 | 119 | if (tree&&tree->GetBranch("Tracks")) { |
ebcbb815 | 120 | am->LoadBranch("Tracks"); |
121 | TClonesArray *ts = dynamic_cast<TClonesArray*>(esdEv->FindListObject("Tracks")); | |
122 | if (ts) { | |
123 | TString clsname(ts->GetClass()->GetName()); | |
124 | if (clsname == "AliEsdTrackExt") { | |
125 | const Int_t N = ts->GetEntries(); | |
126 | for (Int_t i=0; i<N; ++i) { | |
56cbb1d4 | 127 | AliEsdTrackExt *t = static_cast<AliEsdTrackExt*>(ts->At(i)); |
128 | if (t) { | |
129 | t->SetESDEvent(esdEv); | |
130 | t->Setup(); | |
131 | } | |
ebcbb815 | 132 | } |
133 | } | |
134 | } | |
135 | } | |
136 | } |