- updates for AN67
[u/mrichter/AliRoot.git] / PWGDQ / dielectron / macrosJPSI / AddTask_jbook_JPsiQA.C
CommitLineData
94c26f30 1AliAnalysisTask *AddTask_jbook_JPsiQA(TString prod="", Bool_t gridconf=kFALSE){
d28542ba 2 //get the current analysis manager
3 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
4 if (!mgr) {
5 Error("AddTask_jbook_JPsiQA", "No analysis manager found.");
6 return 0;
7 }
8
9 //Do we have an MC handler?
2d7910f3 10 Bool_t hasMC = kFALSE;
11 TString list = gSystem->Getenv("LIST");
12 if( list.IsNull()) list=prod;
13 if( list.Contains("LHC10h") || list.Contains("LHC11h") ) hasMC=kFALSE;
14 if( list.Contains("LHC11a10") || list.Contains("LHC12a17") ) hasMC=kTRUE;
2d7910f3 15
d28542ba 16 //Do we have an AOD handler?
17 Bool_t isAOD=(mgr->GetInputEventHandler()->IsA()==AliAODInputHandler::Class() ? kTRUE : kFALSE);
d6aec652 18
19 // set AOD debug levels
20 if(isAOD) {
21 mgr->AddClassDebug("AliAODTrack", AliLog::kFatal);
22 mgr->AddClassDebug("AliAODpidUtil", AliLog::kInfo);
23 }
d28542ba 24
25 //set config file name
94c26f30 26 TString configFile("");
27 printf("%s \n",gSystem->pwd());
3e831a33 28 TString trainRoot=gSystem->Getenv("TRAIN_ROOT");
94c26f30 29 if (!trainRoot.IsNull())
30 configFile="$TRAIN_ROOT/jbook_jpsi/ConfigJpsiQA_jb_PbPb.C"; // gsi config
31 else if(!gSystem->Exec("alien_cp alien:///alice/cern.ch/user/j/jbook/PWGDQ/dielectron/macrosJPSI/ConfigJpsiQA_jb_PbPb.C ."))
32 configFile=Form("%s/ConfigJpsiQA_jb_PbPb.C",gSystem->pwd()); // alien config
33 else
34 configFile="$ALICE_ROOT/PWGDQ/dielectron/macrosJPSI/ConfigJpsiQA_jb_PbPb.C"; // aliroot config
35
36 if(!gridconf)
37 configFile="$ALICE_ROOT/PWGDQ/dielectron/macrosJPSI/ConfigJpsiQA_jb_PbPb.C"; // aliroot config
d28542ba 38
d28542ba 39 //create task and add it to the manager
40 AliAnalysisTaskMultiDielectron *task=new AliAnalysisTaskMultiDielectron("MultiDieData");
41 task->SetTriggerMask(AliVEvent::kMB+AliVEvent::kCentral+AliVEvent::kSemiCentral);
42 if (!hasMC) task->UsePhysicsSelection();
43 mgr->AddTask(task);
44
45 //load dielectron configuration file
46 TString checkconfig="ConfigJpsiQA_jb_PbPb";
47 if (!gROOT->GetListOfGlobalFunctions()->FindObject(checkconfig.Data()))
48 gROOT->LoadMacro(configFile.Data());
49
50 //add dielectron analysis with different cuts to the task
51 for (Int_t i=0; i<nDie; ++i){ //nDie defined in config file
2d7910f3 52 AliDielectron *jpsi=ConfigJpsiQA_jb_PbPb(i,list);
d28542ba 53 if (jpsi ) task->AddDielectron(jpsi);
ef0426e6 54 if (jpsi ) printf("add: %s\n",jpsi->GetName());
d28542ba 55 }
56
57 //Add event filter
58 AliDielectronEventCuts *eventCuts=new AliDielectronEventCuts("eventCuts","Vertex Track && |vtxZ|<10 && ncontrib>0");
59 if (isAOD) eventCuts->SetVertexType(AliDielectronEventCuts::kVtxAny);
60 eventCuts->SetRequireVertex();
61 eventCuts->SetMinVtxContributors(1);
62 eventCuts->SetVertexZ(-10.,10.);
63 eventCuts->SetCentralityRange(0.0,80.0);
64 task->SetEventFilter(eventCuts);
65
66
67 //create output container
68 AliAnalysisDataContainer *coutput1 =
69 mgr->CreateContainer("jbookQA_tree",
70 TTree::Class(),
71 AliAnalysisManager::kExchangeContainer,
72 "jbook_default");
73
74 AliAnalysisDataContainer *cOutputHist1 =
75 mgr->CreateContainer("jbookQA",
76 TList::Class(),
77 AliAnalysisManager::kOutputContainer,
78 "jbookQA.root");
79
2d7910f3 80
81 AliAnalysisDataContainer *cOutputHist2 =
d28542ba 82 mgr->CreateContainer("jbookQA_CF",
83 TList::Class(),
256b2ae5 84 AliAnalysisManager::kOutputContainer,//AliAnalysisManager::kExchangeContainer,
85 "jbookQA.root");
2d7910f3 86
d28542ba 87 AliAnalysisDataContainer *cOutputHist3 =
88 mgr->CreateContainer("jbookQA_EventStat",
89 TH1D::Class(),
90 AliAnalysisManager::kOutputContainer,
91 "jbookQA.root");
92
93 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
94 mgr->ConnectOutput(task, 0, coutput1 );
95 mgr->ConnectOutput(task, 1, cOutputHist1);
2d7910f3 96 mgr->ConnectOutput(task, 2, cOutputHist2);
d28542ba 97 mgr->ConnectOutput(task, 3, cOutputHist3);
98
99 return task;
100}