AliCollisionNormalization:
[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("alice-caf","workers=20");// limit the number of workers
6   //  gROOT->ProcessLine(Form(".include %s/include",gSystem->ExpandPathName("$ALICE_ROOT")));
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 //   gProof->UploadPackage("STEERBase.par");
22 //   gProof->EnablePackage("STEERBase");
23 //   gProof->UploadPackage("ESD.par");
24 //   gProof->EnablePackage("ESD");
25 //   gProof->UploadPackage("AOD.par");
26 //   gProof->EnablePackage("AOD");
27 //   gProof->UploadPackage("ANALYSIS.par");
28 //   gProof->EnablePackage("ANALYSIS");
29 //   gProof->UploadPackage("ANALYSISalice.par");
30 //   gProof->EnablePackage("ANALYSISalice");
31 //   gProof->UploadPackage("CORRFW.par");
32 //   gProof->EnablePackage("CORRFW"); 
33
34   // Make the analysis manager
35   AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
36   //  mgr->SetDebugLevel(3);
37   // Add ESD handler
38   AliESDInputHandler* esdH = new AliESDInputHandler; 
39
40   mgr->SetInputEventHandler(esdH);
41         
42   if(isMC) {
43     AliMCEventHandler *mc = new AliMCEventHandler();
44     mc->SetReadTR(kFALSE);
45     mgr->SetMCtruthEventHandler(mc);
46   }
47   //____________________________________________//
48   // assign simple task
49   AliCollisionNormalizationTask * task = new AliCollisionNormalizationTask("TaskNormalization");
50   //  task->SetMC();
51   task->SetMC(isMC);
52   mgr->AddTask(task);
53
54
55   gROOT->LoadMacro("$(ALICE_ROOT)/ANALYSIS/macros/AddTaskPhysicsSelection.C");
56   AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(isMC,1,!isMC); // Use Physics Selection. Enable computation of BG if is not MC
57   //  task->SelectCollisionCandidates(); /// This should be disabled, at least for MC: we need all the events
58   physSelTask->GetPhysicsSelection()->SetBin0Callback("TaskNormalization");
59
60   AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();   
61   mgr->ConnectInput(task,0,cinput1);
62
63
64   
65   // Attach output
66   cOutput = mgr->CreateContainer("Norm", TList::Class(), AliAnalysisManager::kOutputContainer,filename);
67   mgr->ConnectOutput(task, 1, cOutput);      
68         
69   if (!mgr->InitAnalysis()) return;
70         
71   mgr->PrintStatus();
72   mgr->StartAnalysis("proof",dataSetPath+dataset+"#esdTree",nev);
73
74 }