]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGDQ/dielectron/macrosJPSI/AddTask_jbook_JPsi.C
-update
[u/mrichter/AliRoot.git] / PWGDQ / dielectron / macrosJPSI / AddTask_jbook_JPsi.C
CommitLineData
bffbeda1 1AliAnalysisTask *AddTask_jbook_JPsi(TString prod="",
34b225f8 2 Bool_t gridconf=kFALSE,
3 ULong64_t triggers=AliVEvent::kCentral | AliVEvent::kSemiCentral | AliVEvent::kMB) {
bffbeda1 4
8c06b662 5 //get the current analysis manager
6 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
7 if (!mgr) {
8 Error("AddTask_jbook_JPsi", "No analysis manager found.");
9 return 0;
10 }
bffbeda1 11
8c06b662 12 //Do we have an MC handler?
2d7910f3 13 Bool_t hasMC = kFALSE;
14 TString list = gSystem->Getenv("LIST");
15 if( list.IsNull()) list=prod;
16 if( list.Contains("LHC10h") || list.Contains("LHC11h") ) hasMC=kFALSE;
17 if( list.Contains("LHC11a10") || list.Contains("LHC12a17") ) hasMC=kTRUE;
2d7910f3 18
8c06b662 19 //Do we have an AOD handler?
20 Bool_t isAOD=(mgr->GetInputEventHandler()->IsA()==AliAODInputHandler::Class() ? kTRUE : kFALSE);
94c26f30 21
d6aec652 22 // set AOD debug levels
23 if(isAOD) {
24 mgr->AddClassDebug("AliAODTrack", AliLog::kFatal);
bffbeda1 25 mgr->AddClassDebug("AliAODpidUtil", AliLog::kInfo);
d6aec652 26 }
bffbeda1 27
8c06b662 28 //set config file name
94c26f30 29 TString configFile("");
30 printf("%s \n",gSystem->pwd());
31 TString trainRoot=gSystem->Getenv("TRAIN_ROOT");
32 if (!trainRoot.IsNull())
33 configFile="$TRAIN_ROOT/jbook_jpsi/ConfigJpsi_jb_PbPb.C"; // gsi config
34 else if(!gSystem->Exec("alien_cp alien:///alice/cern.ch/user/j/jbook/PWGDQ/dielectron/macrosJPSI/ConfigJpsi_jb_PbPb.C ."))
35 configFile=Form("%s/ConfigJpsi_jb_PbPb.C",gSystem->pwd()); // alien config
94c26f30 36
37 if(!gridconf)
38 configFile="$ALICE_ROOT/PWGDQ/dielectron/macrosJPSI/ConfigJpsi_jb_PbPb.C"; // aliroot config
8c06b662 39
8c06b662 40 //create task and add it to the manager
51efbccb 41 AliAnalysisTaskMultiDielectron *task;
94c26f30 42
51efbccb 43 // trigger selection
bffbeda1 44 ULong64_t triggerSets[]={AliVEvent::kCentral , AliVEvent::kSemiCentral , AliVEvent::kMB,
45 AliVEvent::kCentral | AliVEvent::kSemiCentral | AliVEvent::kMB};
51efbccb 46 const char* triggerNames[]={"Central","SemiCentral","MB","MB+Cent+SemiCent"};
8c06b662 47
bffbeda1 48 // find out the configured triggers
49 Int_t j=0;
50 for(j=0; j<4; j++) {
51 if(triggers!=triggerSets[j]) continue;
52 else break;
53 }
54
55 // print task configuration
56 printf("production: %s MC: %d \n", list.Data(),hasMC);
57 printf("triggers: %s \n", triggerNames[j] );
58 printf("config: %s Grid: %d \n",configFile.Data(),gridconf);
59
eee1b2f2 60 task = new AliAnalysisTaskMultiDielectron((Form("MultiDieJB_%s",triggerNames[j])));
bffbeda1 61 task->SetTriggerMask(triggers);
c5af1b57 62 //task->SetTriggerMask(AliVEvent::kMB);
bffbeda1 63
64 if (!hasMC) task->UsePhysicsSelection();
65 mgr->AddTask(task);
66
67 //load dielectron configuration file
68 TString checkconfig="ConfigJpsi_jb_PbPb";
69 if (!gROOT->GetListOfGlobalFunctions()->FindObject(checkconfig.Data()))
70 gROOT->LoadMacro(configFile.Data());
71
72 //add dielectron analysis with different cuts to the task
73 for (Int_t i=0; i<6; ++i) { //nDie defined in config file
b863bc83 74 AliDielectron *jpsi=ConfigJpsi_jb_PbPb(i,list,triggers);
bffbeda1 75 if (jpsi ) task->AddDielectron(jpsi);
2f73de50 76 if (jpsi ) printf(" %s added\n",jpsi->GetName());
51efbccb 77 }
bffbeda1 78
bffbeda1 79 //create output container
bffbeda1 80 AliAnalysisDataContainer *cOutputHist1 =
4c91dae0 81 mgr->CreateContainer(Form("jbook_QA_%s",triggerNames[j]),
bffbeda1 82 TList::Class(),
83 AliAnalysisManager::kOutputContainer,
84 Form("jbook_%s.root",triggerNames[j]));
85
86 AliAnalysisDataContainer *cOutputHist2 =
4c91dae0 87 mgr->CreateContainer(Form("jbook_CF_%s",triggerNames[j]),
bffbeda1 88 TList::Class(),
89 AliAnalysisManager::kOutputContainer,
90 Form("jbook_%s.root",triggerNames[j]));
91
92 AliAnalysisDataContainer *cOutputHist3 =
4c91dae0 93 mgr->CreateContainer(Form("jbook_EventStat_%s",triggerNames[j]),
bffbeda1 94 TH1D::Class(),
95 AliAnalysisManager::kOutputContainer,
96 Form("jbook_%s.root",triggerNames[j]));
97
98 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
99 // mgr->ConnectOutput(task, 0, coutput1 );
100 mgr->ConnectOutput(task, 1, cOutputHist1);
101 mgr->ConnectOutput(task, 2, cOutputHist2);
102 mgr->ConnectOutput(task, 3, cOutputHist3);
103
104 return task;
8c06b662 105}