TENDER becomes Tender
[u/mrichter/AliRoot.git] / PWGLF / SPECTRA / PiKaPr / TOF / pPb502 / task / SteerAnalysisTaskTOFSpectraPbPb.C
CommitLineData
59e49925 1SteerAnalysisTaskTOFSpectraPbPb(const Char_t *inputfilename, Bool_t mcFlag = kFALSE, Bool_t mcTuneFlag = kFALSE, Bool_t pbpbFlag = kTRUE, Int_t maxFiles = kMaxInt, Int_t maxEv = kMaxInt)
2{
3
4 /* include path for ACLic */
5 gSystem->AddIncludePath("-I$ALICE_ROOT/include");
6 gSystem->AddIncludePath("-I$ALICE_ROOT/TOF");
7 /* load libraries */
8 gSystem->Load("libANALYSIS");
9 gSystem->Load("libANALYSISalice");
af472fff 10 gSystem->Load("libTender");
11 gSystem->Load("libTenderSupplies");
59e49925 12 /* build analysis task class */
13 gROOT->LoadMacro("AliAnalysisParticle.cxx+g");
14 gROOT->LoadMacro("AliAnalysisEvent.cxx+g");
15 gROOT->LoadMacro("AliAnalysisTrack.cxx+g");
16 gROOT->LoadMacro("AliAnalysisTaskTOFSpectraPbPb.cxx+g");
17
18 /* Setup input chain */
19 TString str = inputfilename;
20 const Char_t *filename;
21 TChain *chain = new TChain("esdTree");
22 if (str.EndsWith(".xml")) {
23 TGrid::Connect("alien://");
24 Info("SteerTaskTOFSpectraPbPb", "reading data list from collection:");
25 TAlienCollection coll(inputfilename, maxFiles);
26 coll.Reset();
27 while (coll.Next()) {
28 filename = coll.GetTURL();
29 Info("SteerTaskTOFSpectraPbPb", Form("%s", filename));
30 chain->Add(filename);
31 }
32 }
33 else if (str.EndsWith(".txt")) {
34 Info("SteerTaskTOFSpectraPbPb", "reading data list from text file:");
35 ifstream is(inputfilename);
36 Char_t buf[4096];
37 while(!is.eof()) {
38 is.getline(buf, 4096);
39 if (is.eof()) break;
40 chain->Add(buf);
41 Info("SteerTaskTOFSpectraPbPb", Form("%s", buf));
42 }
43 is.close();
44 }
45 else {
46 Info("SteerTaskTOFSpectraPbPb", "single file:");
47 filename = inputfilename;
48 Info("SteerTaskTOFSpectraPbPb", Form("%s", filename));
49 chain->Add(filename);
50 }
51 Info("SteerTaskTOFSpectraPbPb", Form("chain is ready: %d events", chain->GetEntries()));
52
53 /* create analysis manager */
54 AliAnalysisManager *mgr = new AliAnalysisManager("TOFSpectraPbPb");
55
56 /* define input event handler */
57 AliESDInputHandler *esdh = new AliESDInputHandler();
58 esdh->SetReadFriends(kFALSE);
59 mgr->SetInputEventHandler(esdh);
60
61 /* define MC truth event handler */
62 if (mcFlag) {
63 AliMCEventHandler *mch = new AliMCEventHandler();
64 mgr->SetMCtruthEventHandler(mch);
65 }
66
67 /* define output handler */
68 AliAODHandler *outputh = new AliAODHandler();
69 mgr->SetOutputEventHandler(outputh);
70
71 /* add tasks */
72
73#if 0
74 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
75 AddTaskPIDResponse();
76
77 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/TenderSupplies/AddTaskTender.C");
78 AddTaskTender(kFALSE,
79 kFALSE,
80 kTRUE,
81 kFALSE,
82 kFALSE,
83 kFALSE,
84 kFALSE,
85 kFALSE,
86 kFALSE);
87#endif
88
89 /* create tender, setup and add to manager */
af472fff 90 AliTender *tender = new AliTender("Tender");
59e49925 91 tender->SetCheckEventSelection(kFALSE); /* was kFALSE */
92 tender->SetDefaultCDBStorage("raw://");
93 mgr->AddTask(tender);
94 mgr->ConnectInput(tender, 0, inputc);
95 mgr->ConnectOutput(tender, 1, outputc);
af472fff 96 AliTOFTenderSupply *TOFtender = new AliTOFTenderSupply("TOF-Tender");
59e49925 97 tender->AddSupply(TOFtender);
98
99 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
100 AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(mcFlag);
101
102 /* pA trigger fix */
103 // gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/PhysicsSelectionOADB_CINT5_pA.C");
104 // AliOADBPhysicsSelection *oadb = OADBSelection_CINT5_V0AND();
105 // physSelTask->GetPhysicsSelection()->SetCustomOADBObjects(oadb,0);
106
107 if (pbpbFlag) {
108 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskCentrality.C");
109 AliCentralitySelectionTask *centralityTask = AddTaskCentrality();
110 // centralityTask->SetPass(2);
111 if (mcFlag) centralityTask->SetMCInput();
112 }
113 gROOT->LoadMacro("AddAnalysisTaskTOFSpectraPbPb.C");
114 AliAnalysisTaskTOFSpectraPbPb *thisTask = AddAnalysisTaskTOFSpectraPbPb(mcFlag, mcTuneFlag, pbpbFlag);
115
116 /* start analysis */
117 mgr->SetDebugLevel(0);
118 if (!mgr->InitAnalysis()) return;
119 mgr->PrintStatus();
120 mgr->StartAnalysis("local", chain, maxEv);
121
122 /* create dummy file to tell we are done */
123 gSystem->Exec("touch done");
124
125}