First version of a class to compute the number of collisions corresponding to a data...
[u/mrichter/AliRoot.git] / ANALYSIS / macros / runProofNormalization.C
1
2 void runProofNormalization(const char * dataset = "LHC09b12_7TeV_0.5T", TString dataSetPath ="/PWG0/jgrosseo/",const char * filename = "LHC09b12_7TeV_0.5T_norm.root", Bool_t isMC = 1,Int_t nev =123456789) {
3
4   gEnv->SetValue("XSec.GSI.DelegProxy","2");
5   TProof::Open("alicecaf");
6   
7   //  gSystem->AddIncludePath("-I${ALICE_ROOT}/include/ -I${ALICE_ROOT}/PWG0/ -I${ALICE_ROOT}/PWG0/dNdEta/");
8   gSystem->AddIncludePath("-I${ALICE_ROOT}/include/");
9   gProof->UploadPackage("$ALICE_ROOT/STEERBase");
10   gProof->EnablePackage("$ALICE_ROOT/STEERBase");
11   gProof->UploadPackage("$ALICE_ROOT/ESD");
12   gProof->EnablePackage("$ALICE_ROOT/ESD");
13   gProof->UploadPackage("$ALICE_ROOT/AOD");
14   gProof->EnablePackage("$ALICE_ROOT/AOD");
15   gProof->UploadPackage("$ALICE_ROOT/ANALYSIS");
16   gProof->EnablePackage("$ALICE_ROOT/ANALYSIS");
17   gProof->UploadPackage("$ALICE_ROOT/ANALYSISalice");
18   gProof->EnablePackage("$ALICE_ROOT/ANALYSISalice");
19   gProof->UploadPackage("$ALICE_ROOT/CORRFW");
20   gProof->EnablePackage("$ALICE_ROOT/CORRFW");
21  
22
23   // Make the analysis manager
24   AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
25   //  mgr->SetDebugLevel(3);
26   // Add ESD handler
27   AliESDInputHandler* esdH = new AliESDInputHandler; 
28
29   mgr->SetInputEventHandler(esdH);
30         
31   if(isMC) {
32     AliMCEventHandler *mc = new AliMCEventHandler();
33     mc->SetReadTR(kFALSE);
34     mgr->SetMCtruthEventHandler(mc);
35   }
36   // assign simple task
37 //   gProof->Load("AliCollisionNormalization.cxx++g");   
38 //   gProof->Load("AliCollisionNormalizationTask.cxx++g");   
39   //____________________________________________//
40   // assign simple task
41   AliCollisionNormalizationTask * task = new AliCollisionNormalizationTask("TaskNormalization");
42   //  task->SetMC();
43   task->SetMC(isMC);
44   mgr->AddTask(task);
45
46
47   gROOT->LoadMacro("$(ALICE_ROOT)/ANALYSIS/macros/AddTaskPhysicsSelection.C");
48   AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(isMC,1,!isMC); // Use Physics Selection. Enable computation of BG if is not MC
49   //  task->SelectCollisionCandidates(); /// This should be disabled, at least for MC: we need all the events
50   physSelTask->GetPhysicsSelection()->SetBin0Callback("TaskNormalization");
51
52   AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();   
53   mgr->ConnectInput(task,0,cinput1);
54
55
56   
57   // Attach output
58   cOutput = mgr->CreateContainer("Norm", TList::Class(), AliAnalysisManager::kOutputContainer,filename);
59   mgr->ConnectOutput(task, 1, cOutput);      
60         
61   if (!mgr->InitAnalysis()) return;
62         
63   mgr->PrintStatus();
64   mgr->StartAnalysis("proof",dataSetPath+dataset+"#esdTree",nev);
65
66 }