]>
Commit | Line | Data |
---|---|---|
1 | AliAnalysisTask *AddTask_jbook_JPsi(TString config="1", | |
2 | Bool_t gridconf=kFALSE, | |
3 | Bool_t hasMC=kFALSE, | |
4 | ULong64_t triggers=AliVEvent::kCentral | AliVEvent::kSemiCentral | AliVEvent::kMB){ | |
5 | ||
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 | } | |
12 | ||
13 | //Do we have an MC handler? | |
14 | TString list = gSystem->Getenv("LIST"); | |
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 | } | |
19 | ||
20 | //Do we have an AOD handler? | |
21 | Bool_t isAOD=(mgr->GetInputEventHandler()->IsA()==AliAODInputHandler::Class() ? kTRUE : kFALSE); | |
22 | ||
23 | // set AOD debug levels | |
24 | if(isAOD) { | |
25 | mgr->AddClassDebug("AliAODTrack", AliLog::kFatal); | |
26 | mgr->AddClassDebug("AliAODpidUtil", AliLog::kInfo); | |
27 | } | |
28 | ||
29 | //set config file name | |
30 | TString configFile(""); | |
31 | printf("%s \n",gSystem->pwd()); | |
32 | TString trainRoot=gSystem->Getenv("TRAIN_ROOT"); | |
33 | ||
34 | // gsi config | |
35 | if (!trainRoot.IsNull()) configFile="$TRAIN_ROOT/jbook_jpsi/ConfigJpsi_jb_PbPb.C"; | |
36 | // alien config | |
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())); | |
39 | configFile=Form("%s/ConfigJpsi_jb_PbPb.C",gSystem->pwd()); | |
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 | } | |
46 | ||
47 | // aliroot config | |
48 | if(!gridconf && trainRoot.IsNull()) | |
49 | configFile="$ALICE_ROOT/PWGDQ/dielectron/macrosJPSI/ConfigJpsi_jb_PbPb.C"; // aliroot config | |
50 | ||
51 | ||
52 | //create task | |
53 | AliAnalysisTaskMultiDielectron *task; | |
54 | ||
55 | // trigger selection | |
56 | ULong64_t triggerSets[]={AliVEvent::kCentral , AliVEvent::kSemiCentral , AliVEvent::kMB, | |
57 | AliVEvent::kCentral | AliVEvent::kSemiCentral | AliVEvent::kMB}; | |
58 | const char* triggerNames[]={"Central","SemiCentral","MB","ALL"}; | |
59 | const char* onlineRejection[]={"","CCENT","",""}; | |
60 | ||
61 | // find out the configured triggers | |
62 | Int_t j=0; | |
63 | for(j=0; j<4; j++) { | |
64 | if(triggers!=triggerSets[j]) continue; | |
65 | else break; | |
66 | } | |
67 | ||
68 | // print overall configuration | |
69 | printf("production: %s MC: %d \n", list.Data(),hasMC); | |
70 | printf("triggers: %s \n", triggerNames[j] ); | |
71 | printf("config: %s Grid: %d \n",configFile.Data(),gridconf); | |
72 | ||
73 | //load dielectron configuration file (only once) | |
74 | TString checkconfig="ConfigJpsi_jb_PbPb"; | |
75 | if (!gROOT->GetListOfGlobalFunctions()->FindObject(checkconfig.Data())) | |
76 | gROOT->LoadMacro(configFile.Data()); | |
77 | ||
78 | //define default output container | |
79 | TString containerName = "JPSI.root"; | |
80 | ||
81 | //add dielectron analysis with different cuts to the task | |
82 | for (Int_t i=0; i<nDie; ++i) { //nDie defined in config file | |
83 | ||
84 | //only configs switched ON will pass | |
85 | if(config(i,1)!="1") { printf(" %d switched OFF \n",i,config[i]); continue; } | |
86 | ||
87 | // load configuration | |
88 | AliDielectron *jpsi=ConfigJpsi_jb_PbPb(i,hasMC,triggers); | |
89 | if(!jpsi) continue; | |
90 | ||
91 | // create unique title | |
92 | TString unitit = Form("%s_%s",triggerNames[j],jpsi->GetName()); | |
93 | ||
94 | // create single tasks instead of one multi task (decreasing size of CF container) | |
95 | task = new AliAnalysisTaskMultiDielectron(Form("MultiDieJB_%s",unitit.Data())); | |
96 | task->SetBeamEnergy(1380.); | |
97 | task->SetTriggerMask(triggers); | |
98 | if(strlen(onlineRejection[j])) task->SetFiredTriggerName(onlineRejection[j],kTRUE); | |
99 | if(!hasMC) task->UsePhysicsSelection(); | |
100 | ||
101 | // add dielectron to the task and manager | |
102 | task->AddDielectron(jpsi); | |
103 | mgr->AddTask(task); | |
104 | ||
105 | //create output sub containers | |
106 | AliAnalysisDataContainer *cOutputHist1 = | |
107 | mgr->CreateContainer(Form("jbook_QA_%s",unitit.Data()), | |
108 | TList::Class(), | |
109 | AliAnalysisManager::kOutputContainer, | |
110 | containerName.Data()); | |
111 | ||
112 | AliAnalysisDataContainer *cOutputHist2 = | |
113 | mgr->CreateContainer(Form("jbook_CF_%s",unitit.Data()), | |
114 | TList::Class(), | |
115 | AliAnalysisManager::kOutputContainer, | |
116 | containerName.Data()); | |
117 | ||
118 | AliAnalysisDataContainer *cOutputHist3 = | |
119 | mgr->CreateContainer(Form("jbook_EventStat_%s",unitit.Data()), | |
120 | TH1D::Class(), | |
121 | AliAnalysisManager::kOutputContainer, | |
122 | containerName.Data()); | |
123 | ||
124 | mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer()); | |
125 | // mgr->ConnectOutput(task, 0, coutput1 ); | |
126 | mgr->ConnectOutput(task, 1, cOutputHist1); | |
127 | mgr->ConnectOutput(task, 2, cOutputHist2); | |
128 | mgr->ConnectOutput(task, 3, cOutputHist3); | |
129 | ||
130 | printf(" %s added\n",jpsi->GetName()); | |
131 | ||
132 | } | |
133 | ||
134 | ||
135 | return task; | |
136 | } |