]>
Commit | Line | Data |
---|---|---|
b400ddd3 | 1 | AliAnalysisTask *AddTask_mfigueredo_JPsi(TString prod="",ULong64_t triggers=AliVEvent::kEMCEGA | AliVEvent::kEMCEJE){ |
2 | ||
a2c36791 | 3 | //get the current analysis manager |
4 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
5 | if (!mgr) { | |
6 | ::Error("AddTask_mfigueredo_JPsi", "No analysis manager found."); | |
7 | return NULL; | |
8 | } | |
9 | if (!mgr->GetInputEventHandler()) { | |
10 | ::Error("AddTask_mfigueredo_JPsi", "This task requires an input event handler"); | |
11 | return NULL; | |
12 | } | |
13 | ||
6fdf1dbb | 14 | |
15 | //Do we have an MC handler? | |
16 | Bool_t hasMC = kFALSE; | |
17 | TString list = gSystem->Getenv("LIST"); | |
19b3ac96 | 18 | if( list.IsNull()) list=prod; |
6fdf1dbb | 19 | if( list.Contains("LHC10h") || list.Contains("LHC11h") ) hasMC=kFALSE; |
20 | if( list.Contains("LHC11a10") || list.Contains("LHC12a17") ) hasMC=kTRUE; | |
a2c36791 | 21 | |
bffbeda1 | 22 | TString configFile(""); |
23 | printf("%s \n",gSystem->pwd()); | |
6fdf1dbb | 24 | |
b400ddd3 | 25 | configFile="ConfigJpsi_mf_PbPb.C"; |
26 | ||
bffbeda1 | 27 | if(!gSystem->Exec("alien_cp alien:///alice/cern.ch/user/m/mfiguere/PWGDQ/dielectron/macrosJPSI/ConfigJpsi_mf_PbPb.C .")) |
28 | configFile=Form("%s/ConfigJpsi_mf_PbPb.C",gSystem->pwd()); // alien config | |
29 | else | |
30 | configFile="$ALICE_ROOT/PWGDQ/dielectron/macrosJPSI/ConfigJpsi_mf_PbPb.C"; // aliroot config | |
31 | ||
a2c36791 | 32 | Bool_t isAOD=mgr->GetInputEventHandler()->IsA()==AliAODInputHandler::Class(); |
33 | ||
34 | //create task and add it to the manager | |
b400ddd3 | 35 | // AliAnalysisTaskMultiDielectron *task=new AliAnalysisTaskMultiDielectron("MultiDie"); |
36 | ||
37 | // trigger selection | |
38 | ULong64_t triggerSets[]={AliVEvent::kEMCEGA ,AliVEvent::kEMCEJE}; | |
39 | const char* triggerNames[]={"EMCEGA","EMCEJE"}; | |
40 | ||
41 | // find out the configured triggers | |
42 | Int_t j=0; | |
43 | for(j=0; j<2; j++) { | |
44 | if(triggers!=triggerSets[j]) continue; | |
45 | else break; | |
46 | } | |
a2c36791 | 47 | |
b400ddd3 | 48 | // print task configuration |
49 | printf("production: %s MC: %d \n", list.Data(),hasMC); | |
50 | printf("triggers: %s \n", triggerNames[j] ); | |
51 | ||
52 | task = new AliAnalysisTaskMultiDielectron((Form("MultiDieData_%s",triggerNames[j]))); | |
53 | ||
a2c36791 | 54 | //load dielectron configuration file |
55 | TString checkconfig="ConfigJpsi_mf_pp"; | |
56 | if (!gROOT->GetListOfGlobalFunctions()->FindObject(checkconfig.Data())) | |
57 | gROOT->LoadMacro(configFile.Data()); | |
58 | ||
59 | //add dielectron analysis with different cuts to the task | |
60 | for (Int_t i=0; i<nDie; ++i){ //nDie defined in config file | |
6fdf1dbb | 61 | AliDielectron *jpsi; |
62 | jpsi=ConfigJpsi_mf_PbPb(i,isAOD); | |
a2c36791 | 63 | if (jpsi) task->AddDielectron(jpsi); |
b400ddd3 | 64 | if (jpsi ) printf(" %s added\n",jpsi->GetName()); |
a2c36791 | 65 | } |
66 | ||
67 | //Add event filter | |
68 | AliDielectronEventCuts *eventCuts=new AliDielectronEventCuts("eventCuts","Vertex Track && |vtxZ|<10 && ncontrib>0"); | |
69 | if(isAOD) eventCuts->SetVertexType(AliDielectronEventCuts::kVtxAny); | |
70 | eventCuts->SetRequireVertex(); | |
71 | eventCuts->SetMinVtxContributors(1); | |
72 | eventCuts->SetVertexZ(-10.,10.); | |
6fdf1dbb | 73 | eventCuts->SetCentralityRange(0.0,90.0); |
a2c36791 | 74 | // add event filter |
6fdf1dbb | 75 | task->SetEventFilter(eventCuts); |
a2c36791 | 76 | |
77 | // pileup rejection | |
b400ddd3 | 78 | task->SetTriggerMask(triggers); |
79 | task->UsePhysicsSelection(); | |
80 | ||
81 | mgr->AddTask(task); | |
82 | ||
a2c36791 | 83 | //---------------------- |
84 | //create data containers | |
85 | //---------------------- | |
86 | ||
87 | TString containerName = mgr->GetCommonFileName(); | |
88 | containerName += ":PWGDQ_dielectron"; | |
89 | ||
90 | //create output container | |
b400ddd3 | 91 | //create output container |
a2c36791 | 92 | AliAnalysisDataContainer *cOutputHist1 = |
b400ddd3 | 93 | mgr->CreateContainer(Form("mfigueredo_QA_%s",triggerNames[j]), |
94 | TList::Class(), | |
95 | AliAnalysisManager::kOutputContainer, | |
96 | Form("mfig_%s.root",triggerNames[j])); | |
97 | ||
a2c36791 | 98 | AliAnalysisDataContainer *cOutputHist2 = |
b400ddd3 | 99 | mgr->CreateContainer(Form("mfigueredo_CF_%s",triggerNames[j]), |
100 | TList::Class(), | |
101 | AliAnalysisManager::kOutputContainer, | |
102 | Form("mfig_%s.root",triggerNames[j])); | |
a2c36791 | 103 | |
104 | AliAnalysisDataContainer *cOutputHist3 = | |
b400ddd3 | 105 | mgr->CreateContainer(Form("mfigueredo_EventStat_%s",triggerNames[j]), |
106 | TH1D::Class(), | |
107 | AliAnalysisManager::kOutputContainer, | |
108 | Form("mfig_%s.root",triggerNames[j])); | |
a2c36791 | 109 | |
b400ddd3 | 110 | |
a2c36791 | 111 | mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer()); |
112 | mgr->ConnectOutput(task, 1, cOutputHist1); | |
113 | mgr->ConnectOutput(task, 2, cOutputHist2); | |
114 | mgr->ConnectOutput(task, 3, cOutputHist3); | |
115 | ||
116 | return task; | |
117 | } |