]>
Commit | Line | Data |
---|---|---|
359a5e52 JB |
1 | AliAnalysisTask *AddTask_jbook_JPsi(TString config="1", |
2 | Bool_t gridconf=kFALSE, | |
ab5dc7f9 | 3 | Bool_t hasMC=kFALSE, |
1d9e26fc | 4 | ULong64_t triggers=AliVEvent::kCentral | AliVEvent::kSemiCentral | AliVEvent::kMB){ |
bffbeda1 | 5 | |
8c06b662 | 6 | //get the current analysis manager |
7 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
8 | if (!mgr) { | |
9 | Error("AddTask_jbook_JPsi", "No analysis manager found."); | |
10 | return 0; | |
11 | } | |
bffbeda1 | 12 | |
8c06b662 | 13 | //Do we have an MC handler? |
2d7910f3 | 14 | TString list = gSystem->Getenv("LIST"); |
ab5dc7f9 | 15 | if(!list.IsNull()) { |
16 | if( list.Contains("LHC10h") || list.Contains("LHC11h") ) hasMC=kFALSE; | |
17 | if( list.Contains("LHC11a10") || list.Contains("LHC12a17") ) hasMC=kTRUE; | |
18 | } | |
2d7910f3 | 19 | |
8c06b662 | 20 | //Do we have an AOD handler? |
21 | Bool_t isAOD=(mgr->GetInputEventHandler()->IsA()==AliAODInputHandler::Class() ? kTRUE : kFALSE); | |
94c26f30 | 22 | |
d6aec652 | 23 | // set AOD debug levels |
24 | if(isAOD) { | |
25 | mgr->AddClassDebug("AliAODTrack", AliLog::kFatal); | |
bffbeda1 | 26 | mgr->AddClassDebug("AliAODpidUtil", AliLog::kInfo); |
d6aec652 | 27 | } |
bffbeda1 | 28 | |
8c06b662 | 29 | //set config file name |
94c26f30 | 30 | TString configFile(""); |
31 | printf("%s \n",gSystem->pwd()); | |
32 | TString trainRoot=gSystem->Getenv("TRAIN_ROOT"); | |
359a5e52 JB |
33 | |
34 | // gsi config | |
35 | if (!trainRoot.IsNull()) configFile="$TRAIN_ROOT/jbook_jpsi/ConfigJpsi_jb_PbPb.C"; | |
36 | // alien config | |
f6a71c64 | 37 | else if(!gSystem->Exec("alien_cp alien:///alice/cern.ch/user/j/jbook/PWGDQ/dielectron/macrosJPSI/ConfigJpsi_jb_PbPb.C .")) { |
38 | gSystem->Exec(Form("ls -l %s",gSystem->pwd())); | |
359a5e52 | 39 | configFile=Form("%s/ConfigJpsi_jb_PbPb.C",gSystem->pwd()); |
f6a71c64 | 40 | } |
41 | else { | |
42 | printf("ERROR: couldn't copy file %s from grid \n", | |
43 | "alien:///alice/cern.ch/user/j/jbook/PWGDQ/dielectron/macrosJPSI/ConfigJpsi_jb_PbPb.C"); | |
44 | return; | |
45 | } | |
94c26f30 | 46 | |
359a5e52 | 47 | // aliroot config |
1d9e26fc | 48 | if(!gridconf && trainRoot.IsNull()) |
94c26f30 | 49 | configFile="$ALICE_ROOT/PWGDQ/dielectron/macrosJPSI/ConfigJpsi_jb_PbPb.C"; // aliroot config |
8c06b662 | 50 | |
d2a85148 | 51 | // load efficiency maps |
52 | if(!gSystem->Exec("alien_cp alien:///alice/cern.ch/user/j/jbook/PWGDQ/dielectron/files/effMap*.root .")) | |
53 | gSystem->Exec(Form("ls -l %s",gSystem->pwd())); | |
54 | else { | |
55 | printf("ERROR: couldn't copy file %s from grid \n", | |
56 | "alien:///alice/cern.ch/user/j/jbook/PWGDQ/dielectron/files/effMap*.root"); | |
57 | return; | |
58 | } | |
f6a71c64 | 59 | |
1d9e26fc | 60 | //create task |
51efbccb | 61 | AliAnalysisTaskMultiDielectron *task; |
94c26f30 | 62 | |
51efbccb | 63 | // trigger selection |
bffbeda1 | 64 | ULong64_t triggerSets[]={AliVEvent::kCentral , AliVEvent::kSemiCentral , AliVEvent::kMB, |
65 | AliVEvent::kCentral | AliVEvent::kSemiCentral | AliVEvent::kMB}; | |
1d9e26fc | 66 | const char* triggerNames[]={"Central","SemiCentral","MB","ALL"}; |
f1be3e2e | 67 | const char* onlineRejection[]={"","CCENT","",""}; |
8c06b662 | 68 | |
bffbeda1 | 69 | // find out the configured triggers |
70 | Int_t j=0; | |
71 | for(j=0; j<4; j++) { | |
72 | if(triggers!=triggerSets[j]) continue; | |
73 | else break; | |
74 | } | |
75 | ||
1d9e26fc | 76 | // print overall configuration |
bffbeda1 | 77 | printf("production: %s MC: %d \n", list.Data(),hasMC); |
78 | printf("triggers: %s \n", triggerNames[j] ); | |
79 | printf("config: %s Grid: %d \n",configFile.Data(),gridconf); | |
80 | ||
359a5e52 | 81 | //load dielectron configuration file (only once) |
bffbeda1 | 82 | TString checkconfig="ConfigJpsi_jb_PbPb"; |
83 | if (!gROOT->GetListOfGlobalFunctions()->FindObject(checkconfig.Data())) | |
84 | gROOT->LoadMacro(configFile.Data()); | |
85 | ||
1d9e26fc | 86 | //define default output container |
87 | TString containerName = "JPSI.root"; | |
88 | ||
bffbeda1 | 89 | //add dielectron analysis with different cuts to the task |
ab5dc7f9 | 90 | for (Int_t i=0; i<nDie; ++i) { //nDie defined in config file |
1d9e26fc | 91 | |
359a5e52 | 92 | //only configs switched ON will pass |
62b050c9 | 93 | if(config.Length()<=i || config(i,1)!="1") { printf(" %d switched OFF \n",i); continue; } |
359a5e52 | 94 | |
1d9e26fc | 95 | // load configuration |
ab5dc7f9 | 96 | AliDielectron *jpsi=ConfigJpsi_jb_PbPb(i,hasMC,triggers); |
1d9e26fc | 97 | if(!jpsi) continue; |
98 | ||
99 | // create unique title | |
100 | TString unitit = Form("%s_%s",triggerNames[j],jpsi->GetName()); | |
101 | ||
359a5e52 | 102 | // create single tasks instead of one multi task (decreasing size of CF container) |
1d9e26fc | 103 | task = new AliAnalysisTaskMultiDielectron(Form("MultiDieJB_%s",unitit.Data())); |
104 | task->SetBeamEnergy(1380.); | |
105 | task->SetTriggerMask(triggers); | |
106 | if(strlen(onlineRejection[j])) task->SetFiredTriggerName(onlineRejection[j],kTRUE); | |
107 | if(!hasMC) task->UsePhysicsSelection(); | |
108 | ||
d51fac5a | 109 | // event filter |
110 | AliDielectronEventCuts *eventCuts=new AliDielectronEventCuts("vertex","vertex"); | |
111 | if(isAOD) eventCuts->SetVertexType(AliDielectronEventCuts::kVtxAny); | |
112 | eventCuts->SetRequireVertex(); | |
113 | eventCuts->SetMinVtxContributors(1); | |
114 | eventCuts->SetVertexZ(-10.,+10.); | |
115 | eventCuts->SetCentralityRange(0,90.); | |
116 | eventCuts->Print(); | |
117 | task->SetEventFilter(eventCuts); | |
118 | ||
1d9e26fc | 119 | // add dielectron to the task and manager |
120 | task->AddDielectron(jpsi); | |
121 | mgr->AddTask(task); | |
122 | ||
123 | //create output sub containers | |
124 | AliAnalysisDataContainer *cOutputHist1 = | |
125 | mgr->CreateContainer(Form("jbook_QA_%s",unitit.Data()), | |
126 | TList::Class(), | |
127 | AliAnalysisManager::kOutputContainer, | |
128 | containerName.Data()); | |
129 | ||
130 | AliAnalysisDataContainer *cOutputHist2 = | |
131 | mgr->CreateContainer(Form("jbook_CF_%s",unitit.Data()), | |
132 | TList::Class(), | |
133 | AliAnalysisManager::kOutputContainer, | |
134 | containerName.Data()); | |
135 | ||
136 | AliAnalysisDataContainer *cOutputHist3 = | |
137 | mgr->CreateContainer(Form("jbook_EventStat_%s",unitit.Data()), | |
138 | TH1D::Class(), | |
139 | AliAnalysisManager::kOutputContainer, | |
140 | containerName.Data()); | |
141 | ||
142 | mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer()); | |
143 | // mgr->ConnectOutput(task, 0, coutput1 ); | |
144 | mgr->ConnectOutput(task, 1, cOutputHist1); | |
145 | mgr->ConnectOutput(task, 2, cOutputHist2); | |
146 | mgr->ConnectOutput(task, 3, cOutputHist3); | |
147 | ||
148 | printf(" %s added\n",jpsi->GetName()); | |
149 | ||
51efbccb | 150 | } |
bffbeda1 | 151 | |
bffbeda1 | 152 | |
153 | return task; | |
8c06b662 | 154 | } |