]>
Commit | Line | Data |
---|---|---|
0102bc3d | 1 | AliAnalysisTask *AddTask_pdill_JPsi(TString config="1", |
2 | TString cfg="ConfigJpsi_jb_PbPb.C", | |
3 | Bool_t gridconf=kFALSE, | |
4 | Bool_t hasMC=kFALSE, | |
5 | ULong64_t triggers=AliVEvent::kAnyINT | |
6 | ){ | |
7 | ||
8 | //get the current analysis manager | |
9 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
10 | if (!mgr) { | |
11 | Error("AddTask_pdill_JPsi", "No analysis manager found."); | |
12 | return 0; | |
13 | } | |
14 | printf("------------------------------------------------\n"); | |
15 | ||
16 | //Do we have an MC handler? | |
17 | TString list = gSystem->Getenv("LIST"); | |
18 | if(!list.IsNull()) { | |
19 | if( list.Contains("LHC10c") || list.Contains("LHC11h") ) hasMC=kFALSE; // add periods | |
20 | if( list.Contains("LHC11a10") || list.Contains("LHC12a17") ) hasMC=kTRUE; // to be dapated | |
21 | } | |
22 | ||
23 | //Do we have an AOD handler? | |
24 | Bool_t isAOD=(mgr->GetInputEventHandler()->IsA()==AliAODInputHandler::Class() ? kTRUE : kFALSE); | |
25 | ||
26 | // set AOD debug levels | |
27 | if(isAOD) { | |
28 | mgr->AddClassDebug("AliAODTrack", AliLog::kFatal); | |
29 | mgr->AddClassDebug("AliAODpidUtil", AliLog::kInfo); | |
30 | } | |
31 | ||
32 | //set config file name | |
33 | TString configFile(""); | |
34 | printf("pwd: %s \n",gSystem->pwd()); | |
35 | if(cfg.IsNull()) cfg="ConfigJpsi_pd_pp.C"; | |
36 | ||
37 | // the different paths | |
38 | TString alienPath("alien:///alice/cern.ch/user/p/pdillens/PWGDQ/dielectron/macrosJPSI/"); | |
39 | TString alirootPath("$ALICE_ROOT/PWGDQ/dielectron/macrosJPSI/"); | |
40 | ||
41 | ////////// >>>>>>>>>> alien config | |
42 | if(gridconf) { | |
43 | if(!gSystem->Exec(Form("alien_cp %s/%s .",alienPath.Data(),cfg.Data()))) { | |
44 | gSystem->Exec(Form("ls -l %s",gSystem->pwd())); | |
45 | configFile=gSystem->pwd(); | |
46 | } | |
47 | else { | |
48 | printf("ERROR: couldn't copy file %s/%s from grid \n", alienPath.Data(),cfg.Data() ); | |
49 | return; | |
50 | } | |
51 | } | |
52 | ///////// >>>>>>>>> aliroot config | |
53 | else if(!gridconf) configFile=alirootPath.Data(); | |
54 | ///////// add config to path | |
55 | configFile+="/"; | |
56 | configFile+=cfg.Data(); | |
57 | ||
58 | // trigger selection | |
59 | ULong64_t triggerSets[]={AliVEvent::kAnyINT}; | |
60 | const char* triggerNames[]={"MinBias"}; | |
61 | Int_t j=0; | |
62 | ||
63 | // print overall configuration | |
64 | printf("production: %s MC: %d \n", list.Data(),hasMC); | |
65 | printf("triggers: %s \n", triggerNames[j] ); | |
66 | printf("config: %s Grid: %d \n",configFile.Data(),gridconf); | |
67 | printf("------------------------------------------------\n"); | |
68 | ||
69 | //create task(s) | |
70 | AliAnalysisTaskMultiDielectron *task; | |
71 | // create one multi task | |
72 | task = new AliAnalysisTaskMultiDielectron(Form("MultiDieJB")); | |
73 | task->SetBeamEnergy(3.5); | |
74 | task->SetTriggerMask(triggers); | |
75 | if(!hasMC) task->UsePhysicsSelection(); | |
76 | ||
77 | // event filter | |
78 | AliDielectronEventCuts *eventCuts=new AliDielectronEventCuts("vertex","vertex"); | |
79 | if(isAOD) eventCuts->SetVertexType(AliDielectronEventCuts::kVtxAny); | |
80 | eventCuts->SetRequireVertex(); | |
81 | eventCuts->SetMinVtxContributors(1); | |
82 | if(hasMC) eventCuts->SetVertexZ(-10.,+10.); //for data this is done by in the config | |
83 | eventCuts->Print(); | |
84 | task->SetEventFilter(eventCuts); | |
85 | ||
86 | //load dielectron configuration file (only once) | |
87 | TString checkconfig="ConfigJpsi_pd_pp"; | |
88 | if (!gROOT->GetListOfGlobalFunctions()->FindObject(checkconfig.Data())) | |
89 | gROOT->LoadMacro(configFile.Data()); | |
90 | ||
91 | //define default output container | |
92 | TString containerName = "JPSI.root"; | |
93 | ||
94 | //add dielectron analysis with different cuts to the task | |
95 | for (Int_t i=0; i<nDie; ++i) { //nDie defined in config file | |
96 | ||
97 | //only configs switched ON will pass | |
98 | if(config.Length()<=i || config(i,1)!="1") { | |
99 | printf("================================================\n Skip config %02d\n",i); continue; } | |
100 | ||
101 | // load configuration | |
102 | AliDielectron *jpsi=ConfigJpsi_pd_pp(i,hasMC,""); | |
103 | if(!jpsi) continue; | |
104 | ||
105 | // create unique title | |
106 | TString unitit = Form("%s_%s",triggerNames[j],jpsi->GetName()); | |
107 | ||
108 | // add dielectron to the task and manager | |
109 | task->AddDielectron(jpsi); | |
110 | ||
111 | printf(" Config %s added\n",jpsi->GetName()); | |
112 | ||
113 | } //end : loop over configs | |
114 | ||
115 | // multiple output connection | |
116 | mgr->AddTask(task); | |
117 | ||
118 | //create output sub containers | |
119 | AliAnalysisDataContainer *cOutputHist1 = | |
120 | mgr->CreateContainer("pdill_QA", TList::Class(), AliAnalysisManager::kOutputContainer, containerName.Data()); | |
121 | AliAnalysisDataContainer *cOutputHist2 = | |
122 | mgr->CreateContainer("pdill_CF", TList::Class(), AliAnalysisManager::kOutputContainer, containerName.Data()); | |
123 | AliAnalysisDataContainer *cOutputHist3 = | |
124 | mgr->CreateContainer("pdill_EventStat", TH1D::Class(), AliAnalysisManager::kOutputContainer, containerName.Data()); | |
125 | ||
126 | mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer()); | |
127 | // mgr->ConnectOutput(task, 0, coutput1 ); | |
128 | mgr->ConnectOutput(task, 1, cOutputHist1); | |
129 | mgr->ConnectOutput(task, 2, cOutputHist2); | |
130 | mgr->ConnectOutput(task, 3, cOutputHist3); | |
131 | ||
132 | return task; | |
133 | } |