Fix Coverity leaks
[u/mrichter/AliRoot.git] / PWG1 / background / runProofvsTime.C
1
2 void runProofvsTime(const char * dataset = "LHC09b12_7TeV_0.5T", TString dataSetPath ="/PWG0/jgrosseo/",const char * filename = "LHC09b12_7TeV_0.5T_bg.root",Int_t start=0, Int_t stop =1000, Int_t cuts = 0, Bool_t mc = kFALSE, Bool_t useBINT = kFALSE, Int_t nev =123456789) {
3 //void runProofvsTime(const char * dataset = "LHC09b12_7TeV_0.5T", TString dataSetPath ="/PWG0/jgrosseo/",const char * filename = "LHC09b12_7TeV_0.5T_bg.root",Int_t start=0, Int_t stop =1000, Int_t cuts = 0, Bool_t mc = kFALSE, Bool_t useBINT = kFALSE, Int_t nev =10000) {
4   gEnv->SetValue("XSec.GSI.DelegProxy","2");
5   //  TProof::Mgr("alicecaf")->SetROOTVersion("v5-24-00a_dbg");
6   //TProof::Open("alicecaf", "valgrind=workers#4");
7   //  TProof::Open("alicecaf");
8   TProof::Open("mfloris@alicecaf.cern.ch");
9   
10   //  gSystem->AddIncludePath("-I${ALICE_ROOT}/include/ -I${ALICE_ROOT}/PWG0/ -I${ALICE_ROOT}/PWG0/dNdEta/");
11   gSystem->AddIncludePath("-I${ALICE_ROOT}/include/");
12   gProof->UploadPackage("$ALICE_ROOT/STEERBase");
13   gProof->EnablePackage("$ALICE_ROOT/STEERBase");
14   gProof->UploadPackage("$ALICE_ROOT/ESD");
15   gProof->EnablePackage("$ALICE_ROOT/ESD");
16   gProof->UploadPackage("$ALICE_ROOT/AOD");
17   gProof->EnablePackage("$ALICE_ROOT/AOD");
18   gProof->UploadPackage("$ALICE_ROOT/ANALYSIS");
19   gProof->EnablePackage("$ALICE_ROOT/ANALYSIS");
20   gProof->UploadPackage("$ALICE_ROOT/ANALYSISalice");
21   gProof->EnablePackage("$ALICE_ROOT/ANALYSISalice");
22   gProof->UploadPackage("$ALICE_ROOT/CORRFW");
23   gProof->EnablePackage("$ALICE_ROOT/CORRFW");
24  
25
26     // Make the analysis manager
27   AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
28   //  mgr->SetDebugLevel(3);
29   // Add ESD handler
30   AliESDInputHandler* esdH = new AliESDInputHandler; 
31
32   mgr->SetInputEventHandler(esdH);
33   
34   if(mc) {
35     AliMCEventHandler *mch = new AliMCEventHandler();
36     mch->SetReadTR(kFALSE);
37     mgr->SetMCtruthEventHandler(mch);
38   }
39   // assign simple task
40   gProof->Load(gSystem->ExpandPathName("$(ALICE_ROOT)/PWG1/background/AliHistoListWrapper.cxx++g"));   
41   gProof->Load(gSystem->ExpandPathName("$(ALICE_ROOT)/PWG1/background/AliAnalysisTaskBGvsTime.cxx++g"));   
42   //____________________________________________//
43   // assign simple task
44   AliAnalysisTaskBGvsTime * task = new AliAnalysisTaskBGvsTime("TaskBG");
45   //  task->SetMC();
46   const Int_t mult_bins[] = {0,1000};
47   task->SetMultBins(2,mult_bins);
48   //  task->SetBinWidth(2); // binw in secs
49   task->SetBinWidth(300); // binw in secs
50   task->SetTimes(start,stop);
51
52   if(mc) task->SetMC();
53
54   if (cuts == 0 )       task->SetNoCuts();
55   else if (cuts == 2 )  task->SetUsePhysicsSelection();
56   else if (cuts == 3 )  {task->SetUsePhysicsSelection();task->SetUseZeroBin();}
57   else if (cuts == 4 )  {task->SetUsePhysicsSelection();task->SetSkipV0();task->SetUseZeroBin();}
58   else if (cuts == 5 )  {task->SetUsePhysicsSelection();task->SetSkipV0();task->SetSkipZeroBin();}
59
60   if(useBINT) task->SetUseBI();
61   
62   mgr->AddTask(task);
63
64   AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();   
65   mgr->ConnectInput(task,0,cinput1);
66
67   
68   // Attach output
69   cOutput = mgr->CreateContainer("BGvsTime", 
70                                  AliHistoListWrapper::Class(), AliAnalysisManager::kOutputContainer,filename);
71   mgr->ConnectOutput(task, 1, cOutput);      
72   cOutput = mgr->CreateContainer("PhysSel", 
73                                  AliPhysicsSelection::Class(), AliAnalysisManager::kOutputContainer,filename);
74   mgr->ConnectOutput(task, 2, cOutput);      
75
76
77         
78   if (!mgr->InitAnalysis()) return;
79         
80   mgr->PrintStatus();
81   mgr->StartAnalysis("proof",dataSetPath+dataset+"#esdTree",nev);
82
83   if( cuts == 0 ){ 
84     cout << "WARNING: disabled cuts" << endl;
85   } else if (cuts == 2) {
86     cout << "INFO: Using Physics Selection" << endl;
87   }
88
89 }