3 // Task to setup emcal related global objects.
7 #include "AliEmcalCompatTask.h"
9 #include <TClonesArray.h>
11 #include "AliAnalysisManager.h"
12 #include "AliCentrality.h"
13 #include "AliESDEvent.h"
14 #include "AliEsdTrackExt.h"
15 #include "AliEventplane.h"
16 #include "AliInputEventHandler.h"
18 ClassImp(AliEmcalCompatTask)
20 //________________________________________________________________________
21 AliEmcalCompatTask::AliEmcalCompatTask() :
29 //________________________________________________________________________
30 AliEmcalCompatTask::AliEmcalCompatTask(const char *name) :
31 AliAnalysisTaskSE(name),
37 fBranchNames = "ESD:AliESDHeader.,AliESDRun.,Tracks";
40 //________________________________________________________________________
41 AliEmcalCompatTask::~AliEmcalCompatTask()
46 //________________________________________________________________________
47 void AliEmcalCompatTask::UserExec(Option_t *)
49 // Main loop, called for each event.
51 AliESDEvent *esdEv = dynamic_cast<AliESDEvent*>(InputEvent());
53 AliError("Task works only on ESD events, returning");
57 AliAnalysisManager *am = AliAnalysisManager::GetAnalysisManager();
59 AliError("Manager zero, returning");
63 am->LoadBranch("AliESDHeader.");
64 am->LoadBranch("AliESDRun.");
67 AliESDHeader *header = esdEv->GetHeader();
70 title = header->GetTitle();
72 AliError(Form("%s: Header zero, returning!", GetName()));
76 if (title.Length()==0) {
77 AliError(Form("%s: Title should encode offline trigger, returning!", GetName()));
80 UInt_t off = header->GetUniqueID();
82 UInt_t res = ((AliInputEventHandler*)(am->GetInputEventHandler()))->IsEventSelected();
85 AliWarning(Form("Stored offline trigger not equal computed: %ud %ud", off, res));
90 am->LoadBranch("Centrality.");
91 AliCentrality *centin = dynamic_cast<AliCentrality*>(esdEv->FindListObject("Centrality"));
92 AliCentrality *centout = esdEv->GetCentrality();
93 if (centin&¢out&¢out->GetQuality()==999) {
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"));
108 am->LoadBranch("Eventplane.");
109 AliEventplane *epin = dynamic_cast<AliEventplane*>(esdEv->FindListObject("Eventplane"));
110 AliEventplane *epout = esdEv->GetEventplane();
111 if (epin&&epout&&(epout->GetQVector()==0)&&(epin->GetQVector()!=0)) {
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());
119 TTree *tree = am->GetTree();
120 if (tree&&tree->GetBranch("PicoTracks")) {
121 am->LoadBranch("PicoTracks");
124 if (tree&&tree->GetBranch("Tracks")) {
125 am->LoadBranch("Tracks");
126 TClonesArray *ts = dynamic_cast<TClonesArray*>(esdEv->FindListObject("Tracks"));
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) {
132 AliEsdTrackExt *t = static_cast<AliEsdTrackExt*>(ts->At(i));
134 t->SetESDEvent(esdEv);