]>
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 | |
1d9e26fc | 51 | //create task |
51efbccb | 52 | AliAnalysisTaskMultiDielectron *task; |
94c26f30 | 53 | |
51efbccb | 54 | // trigger selection |
bffbeda1 | 55 | ULong64_t triggerSets[]={AliVEvent::kCentral , AliVEvent::kSemiCentral , AliVEvent::kMB, |
56 | AliVEvent::kCentral | AliVEvent::kSemiCentral | AliVEvent::kMB}; | |
1d9e26fc | 57 | const char* triggerNames[]={"Central","SemiCentral","MB","ALL"}; |
f1be3e2e | 58 | const char* onlineRejection[]={"","CCENT","",""}; |
8c06b662 | 59 | |
bffbeda1 | 60 | // find out the configured triggers |
61 | Int_t j=0; | |
62 | for(j=0; j<4; j++) { | |
63 | if(triggers!=triggerSets[j]) continue; | |
64 | else break; | |
65 | } | |
66 | ||
1d9e26fc | 67 | // print overall configuration |
bffbeda1 | 68 | printf("production: %s MC: %d \n", list.Data(),hasMC); |
69 | printf("triggers: %s \n", triggerNames[j] ); | |
70 | printf("config: %s Grid: %d \n",configFile.Data(),gridconf); | |
71 | ||
359a5e52 | 72 | //load dielectron configuration file (only once) |
bffbeda1 | 73 | TString checkconfig="ConfigJpsi_jb_PbPb"; |
74 | if (!gROOT->GetListOfGlobalFunctions()->FindObject(checkconfig.Data())) | |
75 | gROOT->LoadMacro(configFile.Data()); | |
76 | ||
1d9e26fc | 77 | //define default output container |
78 | TString containerName = "JPSI.root"; | |
79 | ||
bffbeda1 | 80 | //add dielectron analysis with different cuts to the task |
ab5dc7f9 | 81 | for (Int_t i=0; i<nDie; ++i) { //nDie defined in config file |
1d9e26fc | 82 | |
359a5e52 | 83 | //only configs switched ON will pass |
62b050c9 | 84 | if(config.Length()<=i || config(i,1)!="1") { printf(" %d switched OFF \n",i); continue; } |
359a5e52 | 85 | |
1d9e26fc | 86 | // load configuration |
ab5dc7f9 | 87 | AliDielectron *jpsi=ConfigJpsi_jb_PbPb(i,hasMC,triggers); |
1d9e26fc | 88 | if(!jpsi) continue; |
89 | ||
90 | // create unique title | |
91 | TString unitit = Form("%s_%s",triggerNames[j],jpsi->GetName()); | |
92 | ||
359a5e52 | 93 | // create single tasks instead of one multi task (decreasing size of CF container) |
1d9e26fc | 94 | task = new AliAnalysisTaskMultiDielectron(Form("MultiDieJB_%s",unitit.Data())); |
95 | task->SetBeamEnergy(1380.); | |
96 | task->SetTriggerMask(triggers); | |
97 | if(strlen(onlineRejection[j])) task->SetFiredTriggerName(onlineRejection[j],kTRUE); | |
98 | if(!hasMC) task->UsePhysicsSelection(); | |
99 | ||
d51fac5a | 100 | // event filter |
101 | AliDielectronEventCuts *eventCuts=new AliDielectronEventCuts("vertex","vertex"); | |
102 | if(isAOD) eventCuts->SetVertexType(AliDielectronEventCuts::kVtxAny); | |
103 | eventCuts->SetRequireVertex(); | |
104 | eventCuts->SetMinVtxContributors(1); | |
105 | eventCuts->SetVertexZ(-10.,+10.); | |
106 | eventCuts->SetCentralityRange(0,90.); | |
107 | eventCuts->Print(); | |
108 | task->SetEventFilter(eventCuts); | |
109 | ||
1d9e26fc | 110 | // add dielectron to the task and manager |
111 | task->AddDielectron(jpsi); | |
112 | mgr->AddTask(task); | |
113 | ||
114 | //create output sub containers | |
115 | AliAnalysisDataContainer *cOutputHist1 = | |
116 | mgr->CreateContainer(Form("jbook_QA_%s",unitit.Data()), | |
117 | TList::Class(), | |
118 | AliAnalysisManager::kOutputContainer, | |
119 | containerName.Data()); | |
120 | ||
121 | AliAnalysisDataContainer *cOutputHist2 = | |
122 | mgr->CreateContainer(Form("jbook_CF_%s",unitit.Data()), | |
123 | TList::Class(), | |
124 | AliAnalysisManager::kOutputContainer, | |
125 | containerName.Data()); | |
126 | ||
127 | AliAnalysisDataContainer *cOutputHist3 = | |
128 | mgr->CreateContainer(Form("jbook_EventStat_%s",unitit.Data()), | |
129 | TH1D::Class(), | |
130 | AliAnalysisManager::kOutputContainer, | |
131 | containerName.Data()); | |
132 | ||
133 | mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer()); | |
134 | // mgr->ConnectOutput(task, 0, coutput1 ); | |
135 | mgr->ConnectOutput(task, 1, cOutputHist1); | |
136 | mgr->ConnectOutput(task, 2, cOutputHist2); | |
137 | mgr->ConnectOutput(task, 3, cOutputHist3); | |
138 | ||
139 | printf(" %s added\n",jpsi->GetName()); | |
140 | ||
51efbccb | 141 | } |
bffbeda1 | 142 | |
bffbeda1 | 143 | |
144 | return task; | |
8c06b662 | 145 | } |