]>
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(); | |
af0280a9 | 71 | else { |
72 | AliError(Form("%s: Header zero, returning!", GetName())); | |
73 | return; | |
74 | } | |
75 | ||
2c80cbde | 76 | if (title.Length()==0) { |
af0280a9 | 77 | AliError(Form("%s: Title should encode offline trigger, returning!", GetName())); |
ebcbb815 | 78 | return; |
2c80cbde | 79 | } else { |
80 | UInt_t off = header->GetUniqueID(); | |
81 | off &= 0x4FFFFFFF; | |
82 | UInt_t res = ((AliInputEventHandler*)(am->GetInputEventHandler()))->IsEventSelected(); | |
83 | res &= 0x4FFFFFFF; | |
84 | if (off!=res) { | |
85 | AliWarning(Form("Stored offline trigger not equal computed: %ud %ud", off, res)); | |
d41a0b1c | 86 | } |
87 | } | |
2c80cbde | 88 | |
ebcbb815 | 89 | if (fDoCent) { |
7b63a52b | 90 | am->LoadBranch("Centrality."); |
91 | AliCentrality *centin = dynamic_cast<AliCentrality*>(esdEv->FindListObject("Centrality")); | |
ebcbb815 | 92 | AliCentrality *centout = esdEv->GetCentrality(); |
4e8ed998 | 93 | if (centin&¢out&¢out->GetQuality()==999) { |
ebcbb815 | 94 | centout->SetQuality(centin->GetQuality()); |
95 | centout->SetCentralityV0M(centin->GetCentralityPercentileUnchecked("V0M")); | |
96 | centout->SetCentralityFMD(centin->GetCentralityPercentileUnchecked("FMD")); | |
97 | centout->SetCentralityTRK(centin->GetCentralityPercentileUnchecked("TRK")); | |
98 | centout->SetCentralityTKL(centin->GetCentralityPercentileUnchecked("TKL")); | |
99 | centout->SetCentralityCL0(centin->GetCentralityPercentileUnchecked("CL0")); | |
100 | centout->SetCentralityCL1(centin->GetCentralityPercentileUnchecked("CL1")); | |
101 | centout->SetCentralityV0MvsFMD(centin->GetCentralityPercentileUnchecked("V0MvsFMD")); | |
102 | centout->SetCentralityTKLvsV0M(centin->GetCentralityPercentileUnchecked("TKLvsV0M")); | |
103 | centout->SetCentralityZEMvsZDC(centin->GetCentralityPercentileUnchecked("ZEMvsZDC")); | |
104 | } | |
105 | } | |
106 | ||
107 | if (fDoEp) { | |
7b63a52b | 108 | am->LoadBranch("Eventplane."); |
109 | AliEventplane *epin = dynamic_cast<AliEventplane*>(esdEv->FindListObject("Eventplane")); | |
ebcbb815 | 110 | AliEventplane *epout = esdEv->GetEventplane(); |
4e8ed998 | 111 | if (epin&&epout&&(epout->GetQVector()==0)&&(epin->GetQVector()!=0)) { |
ebcbb815 | 112 | epout->SetQVector(new TVector2(*epin->GetQVector())); |
113 | epout->SetEventplaneQ(epin->GetEventplane("Q")); | |
114 | epout->SetQsub(new TVector2(*epin->GetQsub1()),new TVector2(*epin->GetQsub2())); | |
115 | epout->SetQsubRes(epin->GetQsubRes()); | |
116 | } | |
117 | } | |
118 | ||
119 | TTree *tree = am->GetTree(); | |
2c80cbde | 120 | if (tree&&tree->GetBranch("PicoTracks")) { |
ebcbb815 | 121 | am->LoadBranch("PicoTracks"); |
2c80cbde | 122 | } |
ebcbb815 | 123 | |
4e8ed998 | 124 | if (tree&&tree->GetBranch("Tracks")) { |
ebcbb815 | 125 | am->LoadBranch("Tracks"); |
126 | TClonesArray *ts = dynamic_cast<TClonesArray*>(esdEv->FindListObject("Tracks")); | |
127 | if (ts) { | |
128 | TString clsname(ts->GetClass()->GetName()); | |
129 | if (clsname == "AliEsdTrackExt") { | |
130 | const Int_t N = ts->GetEntries(); | |
131 | for (Int_t i=0; i<N; ++i) { | |
56cbb1d4 | 132 | AliEsdTrackExt *t = static_cast<AliEsdTrackExt*>(ts->At(i)); |
133 | if (t) { | |
134 | t->SetESDEvent(esdEv); | |
135 | t->Setup(); | |
136 | } | |
ebcbb815 | 137 | } |
138 | } | |
139 | } | |
140 | } | |
141 | } |