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