TENDER becomes Tender
[u/mrichter/AliRoot.git] / PWGPP / macros / runFilteringTask.C
CommitLineData
5ee6cb87 1void runFilteringTask( const char* esdList,
2 Float_t scalingTracks,
3 Float_t scalingV0,
4 const char* ocdb = "local:///cvmfs/alice.gsi.de/alice/data/2010/OCDB/" ,
5 Int_t nFiles = 1000000,
6 Int_t firstFile=0,
7 Int_t nEvents=30000000,
8 Int_t firstEvent =0,
9 const char* esdFileName="AliESDs.root",
10 Bool_t mc=kFALSE)
11{
12 TStopwatch timer;
13 timer.Start();
14
15 printf("\n\n\n");
16 printf("scalingTracks=%d\n",scalingTracks);
17 printf("scalingV0=%d\n",scalingV0);
18 printf("nFiles=%d\n",nFiles);
19
20 gSystem->SetIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include -I$ALICE_ROOT/ITS -I$ALICE_ROOT -I$ALICE_ROOT/TRD");
21
22 gSystem->Load("libANALYSIS");
23 gSystem->Load("libANALYSISalice");
af472fff 24 gSystem->Load("libTender");
5ee6cb87 25 gSystem->Load("libCORRFW");
26 gSystem->Load("libPWGUDbase");
27 gSystem->Load("libTPCcalib");
28 gSystem->Load("libPWGPP");
29 gSystem->Load("libPWGLFspectra");
30
31 //____________________________________________//
32 // Make the analysis manager
33 AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
34 mgr->SetDebugLevel(0);
b3982e10 35 mgr->SetNSysInfo(10);
5ee6cb87 36
37 AliESDInputHandler* esdH = new AliESDInputHandler();
8f63d5f4 38 esdH->SetReadFriends(1);
5ee6cb87 39 mgr->SetInputEventHandler(esdH);
40
41 // Enable MC event handler
42 AliMCEventHandler* handlerMC = new AliMCEventHandler;
43 //handler->SetReadTR(kFALSE);
8f63d5f4 44 mgr->SetMCtruthEventHandler(handlerMC);
5ee6cb87 45
46 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/PilotTrain/AddTaskCDBconnect.C");
47 AddTaskCDBconnect(ocdb);
48
49 if (gSystem->AccessPathName("localOCDBaccessConfig.C", kFileExists)==0) {
50 gROOT->LoadMacro("localOCDBaccessConfig.C");
51 localOCDBaccessConfig();
52 }
53
54 // Create input chain
55 //gROOT->LoadMacro("$ALICE_ROOT/PWGUD/macros/CreateESDChain.C");
56 //TChain* chain = CreateESDChain(esdList, nFiles,firstFile);
57 AliXRDPROOFtoolkit toolkit;
58 AliXRDPROOFtoolkit::FilterList(esdList,Form("%s esdTree",esdFileName),0);
59 TChain * chain = toolkit.MakeChain(Form("%s.Good",esdList),"esdTree","asd",nFiles,firstFile);
60
5ee6cb87 61 if(!chain) {
62 printf("ERROR: chain cannot be created\n");
63 return;
64 }
65 chain->Lookup();
66
67 //
68 // Wagons to run
69 //
70
71
72 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/macros/AddTaskFilteredTree.C");
ced86a0e 73 AliAnalysisTaskFilteredTree* task = (AliAnalysisTaskFilteredTree*)AddTaskFilteredTree("FilterEvents_Trees.root");
5ee6cb87 74 task->SetLowPtTrackDownscaligF(scalingTracks);
75 task->SetLowPtV0DownscaligF(scalingV0);
8f63d5f4 76 task->SetUseESDfriends(kTRUE);
5ee6cb87 77
78 // Init
79 if (!mgr->InitAnalysis())
80 mgr->PrintStatus();
81
82 //
83 // Run on dataset
84 mgr->StartAnalysis("local",chain,nEvents, firstEvent);
85
86 timer.Stop();
87 timer.Print();
88
89 delete mgr;
90}