Split: fix refs to AddTaskCentrality.C
[u/mrichter/AliRoot.git] / PWGPP / VZERO / runAnaTrigProof.C
CommitLineData
e5f60c5a 1// 2010
2// .x runAnaTrigProof.C(0,"/alice/data","LHC10h_000138396_hlt_clustering",28,kFALSE,"CMBACS2")
3// 2011
4// .x runAnaTrigProof.C(0,"/alice/data","LHC11h_000166532_p1_HLT",28,kTRUE,"CPBI")
5
6void runAnaTrigProof(Int_t mode = 0, const char *folder = "/alice/data",
7 const char *dataset = "LHC10h_000138396_hlt_clustering",
8 Int_t workers=28,
8d939043 9 Bool_t usePS = kFALSE,
e5f60c5a 10 const char *minBias = "CPBI",
11 Int_t firstFile = 0, Int_t lastFile = -1)
c014f07d 12{
13 gSystem->Load("libANALYSIS");
14 gSystem->Load("libANALYSISalice");
e5f60c5a 15 gSystem->Load("libOADB");
c014f07d 16 gSystem->AddIncludePath("-I$ALICE_ROOT/include ");
17
e5f60c5a 18 if (mode==0) {
19 // Connect to Proof
20 gEnv->SetValue("XSec.GSI.DelegProxy","2");
21 Char_t *alienuser = gSystem->Getenv("alien_API_USER");
22 cout<<"==> Your AliEn username is: "<<alienuser<<endl;
c014f07d 23
e5f60c5a 24 TProof *p = TProof::Open(alienuser!=0 ? Form("%s@alice-caf.cern.ch",
25 alienuser) : "alice-caf.cern.ch",
26 workers>0 ? Form("workers=%d",workers) : "");
c014f07d 27
e5f60c5a 28 // gProof->GetManager()->SetROOTVersion("VO_ALICE@ROOT::v5-28-00f");
8d939043 29 gProof->EnablePackage("VO_ALICE@AliRoot::v5-02-11-AN");
30
31 // gProof->Exec("TGrid::Connect(\"alien://\")",kTRUE);
32 // gSystem->Setenv("OADB_PATH","alien:///alice/cern.ch/user/c/cheshkov/OADB");
33 // gProof->Exec("gSystem->Setenv(\"OADB_PATH\",\"alien:///alice/cern.ch/user/c/cheshkov/OADB\")",kTRUE);
34 // gSystem->Setenv("OADB_PATH","alien:///alice/cern.ch/user/a/atoia/OADB");
35 // gProof->Exec("gSystem->Setenv(\"OADB_PATH\",\"alien:///alice/cern.ch/user/a/atoia/OADB\")",kTRUE);
e5f60c5a 36 }
c014f07d 37
38 // Create the analysis manager
39 AliAnalysisManager *mgr = new AliAnalysisManager("AliAnaFwdDet");
40
41 AliESDInputHandler* esdH = new AliESDInputHandler();
42 esdH->SetInactiveBranches("FMD AliRawDataErrorLogs CaloClusters Cascades EMCALCells EMCALTrigger ESDfriend.fTracks Kinks MuonTracks TrdTracks");
43 // esdH->SetReadFriends(kTRUE);
44 esdH->SetReadFriends(kFALSE);
45 mgr->SetInputEventHandler(esdH);
46
47 // physics and centrality selection
8d939043 48 if (usePS) {
49 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
50 AliPhysicsSelectionTask *physicsSelectionTask = AddTaskPhysicsSelection(kFALSE);
51 // Trigger analysis defaults
52 AliOADBTriggerAnalysis * oadbTrigAnalysis = new AliOADBTriggerAnalysis("CustomTA");
53 oadbTrigAnalysis->SetZDCCorrParameters(0, 0, 4*0.7, 4*0.7);
54 physicsSelectionTask->GetPhysicsSelection()->SetCustomOADBObjects(0,0,oadbTrigAnalysis);
55 // DefaultPbPb
56 AliOADBPhysicsSelection * oadbDefaultPbPb = new AliOADBPhysicsSelection("oadbCustomPbPb");
e5f60c5a 57
8d939043 58 Int_t triggerCount = 0;
59 oadbDefaultPbPb->AddCollisionTriggerClass ( AliVEvent::kMB,"+CPBI1-B-NOPF-ALLNOTRD,CPBI2_B1-B-[NOPF|PF]-ALLNOTRD","B",triggerCount);
60 oadbDefaultPbPb->AddBGTriggerClass ( AliVEvent::kMB,"+CPBI[1|2_B1]-AC-NOPF-ALLNOTRD","AC",triggerCount);
61 oadbDefaultPbPb->AddBGTriggerClass ( AliVEvent::kMB,"+CPBI[1|2_B1]-E-NOPF-ALLNOTRD","E",triggerCount);
62 oadbDefaultPbPb->SetHardwareTrigger ( triggerCount,"V0A && V0C");
63 oadbDefaultPbPb->SetOfflineTrigger ( triggerCount,"V0A && V0C && !V0ABG && !V0CBG && !TPCLaserWarmUp && ZDCTime");
64
65 triggerCount++;
66 // Bug in early running, CVHN_R2-B-NOPF-ALLNOTRD needed explicitly up to run 167814 (to be moved to custom object as soon as all other things are fine)
67 // oadbDefaultPbPb->AddCollisionTriggerClass ( AliVEvent::kCentral,"+CVHN-B-NOPF-ALLNOTRD,CVHN_R2-B-NOPF-ALLNOTRD,CVHN-B-NOPF-CENTNOTRD,CVHN-B-NOPF-CENTNOTRD,CVHN-B-PF-ALLNOTRD,CVHN-B-PF-CENTNOTRD","B",triggerCount);
68 // oadbDefaultPbPb->AddCollisionTriggerClass ( AliVEvent::kCentral,"+CVHN[|_R2]-B-[NOPF|PF]-[ALL|CENT]NOTRD","B",triggerCount);
69 // oadbDefaultPbPb->AddBGTriggerClass ( AliVEvent::kCentral,"+CVHN-AC-NOPF-[ALL|CENT]NOTRD","AC",triggerCount);
70 // oadbDefaultPbPb->AddBGTriggerClass ( AliVEvent::kCentral,"+CVHN-E-NOPF-[ALL|CENT]NOTRD","E",triggerCount);
71 // Also include the semicentral class in the online classes selection (in order not to loose event due to the different time sharing of central and semi-central)
72 oadbDefaultPbPb->AddCollisionTriggerClass ( AliVEvent::kCentral,"+CVHN[|_R2]-B-[NOPF|PF]-[ALL|CENT]NOTRD,CVLN[|_B2|_R1]-B-[NOPF|PF]-ALLNOTRD","B",triggerCount);
73 oadbDefaultPbPb->AddBGTriggerClass ( AliVEvent::kCentral,"+CVHN-AC-NOPF-[ALL|CENT]NOTRD,CVLN-AC-NOPF-ALLNOTRD","AC",triggerCount);
74 oadbDefaultPbPb->AddBGTriggerClass ( AliVEvent::kCentral,"+CVHN-E-NOPF-[ALL|CENT]NOTRD,CVLN-E-NOPF-ALLNOTRD","E",triggerCount);
75 oadbDefaultPbPb->SetHardwareTrigger ( triggerCount,"V0A && V0C && Central");
76 oadbDefaultPbPb->SetOfflineTrigger ( triggerCount,"V0A && V0C && !V0ABG && !V0CBG && !TPCLaserWarmUp && ZDCTime");
77
78 triggerCount++;
79 // semicentral includes central ones (and might have different downscaling)
80 // Bug in early running, CVHN_R2-B-NOPF-ALLNOTRD,CVLN_B2-B-NOPF-ALLNOTRD needed explicitly up to run 167814 (to be moved to custom object as soon as all other things are fine)
81 // oadbDefaultPbPb->AddCollisionTriggerClass ( AliVEvent::kSemiCentral,"+CVHN-B-NOPF-ALLNOTRD,CVHN_R2-B-NOPF-ALLNOTRD,CVHN-B-NOPF-CENTNOTRD,CVHN-B-PF-ALLNOTRD,CVHN-B-PF-CENTNOTRD,CVLN-B-NOPF-ALLNOTRD,CVLN_B2-B-NOPF-ALLNOTRD,CVLN-B-PF-ALLNOTRD","B",triggerCount);
82 // oadbDefaultPbPb->AddCollisionTriggerClass ( AliVEvent::kSemiCentral,"+CVHN[|_R2]-B-[NOPF|PF]-[ALL|CENT]NOTRD,CVLN[|_B2]-B-[NOPF|PF]-ALLNOTRD","B",triggerCount);
83 oadbDefaultPbPb->AddCollisionTriggerClass ( AliVEvent::kSemiCentral,"+CVHN[|_R2]-B-[NOPF|PF]-[ALL|CENT]NOTRD,CVLN[|_B2|_R1]-B-[NOPF|PF]-ALLNOTRD","B",triggerCount);
84 oadbDefaultPbPb->AddBGTriggerClass ( AliVEvent::kSemiCentral,"+CVHN-AC-NOPF-[ALL|CENT]NOTRD,CVLN-AC-NOPF-ALLNOTRD","AC",triggerCount);
85 oadbDefaultPbPb->AddBGTriggerClass ( AliVEvent::kSemiCentral,"+CVHN-E-NOPF-[ALL|CENT]NOTRD,CVLN-E-NOPF-ALLNOTRD","E",triggerCount);
86 oadbDefaultPbPb->SetHardwareTrigger ( triggerCount,"V0A && V0C && SemiCentral && !Central");
87 oadbDefaultPbPb->SetOfflineTrigger ( triggerCount,"V0A && V0C && !V0ABG && !V0CBG && !TPCLaserWarmUp && ZDCTime");
88
89 triggerCount++;
90 oadbDefaultPbPb->AddCollisionTriggerClass ( AliVEvent::kEMCEJE,"+CPBI2EJE-B-NOPF-CENTNOTRD","B",triggerCount);
91 oadbDefaultPbPb->AddBGTriggerClass ( AliVEvent::kEMCEJE,"+CPBI2EJE-ACE-NOPF-CENTNOTRD","ACE",triggerCount);
92 oadbDefaultPbPb->SetHardwareTrigger ( triggerCount,"V0A && V0C");
93 // TODO EMC offline check missing, https://savannah.cern.ch/bugs/index.php?87104
94 oadbDefaultPbPb->SetOfflineTrigger ( triggerCount,"V0A && V0C && !V0ABG && !V0CBG && !TPCLaserWarmUp && ZDCTime");
95
96 triggerCount++;
97 oadbDefaultPbPb->AddCollisionTriggerClass ( AliVEvent::kEMCEGA,"+CPBI2EGA-B-NOPF-CENTNOTRD","B",triggerCount);
98 oadbDefaultPbPb->AddBGTriggerClass ( AliVEvent::kEMCEGA,"+CPBI2EGA-ACE-NOPF-CENTNOTRD","ACE",triggerCount);
99 oadbDefaultPbPb->SetHardwareTrigger ( triggerCount,"V0A && V0C");
100 // TODO EMC offline check missing, https://savannah.cern.ch/bugs/index.php?87104
101 oadbDefaultPbPb->SetOfflineTrigger ( triggerCount,"V0A && V0C && !V0ABG && !V0CBG && !TPCLaserWarmUp && ZDCTime");
e5f60c5a 102
8d939043 103 triggerCount++;
104 oadbDefaultPbPb->AddCollisionTriggerClass ( AliVEvent::kMUSPB,"+CPBI1MSL-B-NOPF-MUON","B", triggerCount);
105 oadbDefaultPbPb->AddBGTriggerClass ( AliVEvent::kMUSPB,"+CPBI1MSL-ACE-NOPF-MUON","ACE",triggerCount);
106 oadbDefaultPbPb->SetHardwareTrigger ( triggerCount,"V0A && V0C");
107 oadbDefaultPbPb->SetOfflineTrigger ( triggerCount,"V0A && V0C && !V0ABG && !V0CBG && !TPCLaserWarmUp && ZDCTime");
108
109 triggerCount++;
110 oadbDefaultPbPb->AddCollisionTriggerClass ( AliVEvent::kMUSHPB,"+CPBI1MSH-B-NOPF-MUON","B", triggerCount);
111 oadbDefaultPbPb->AddBGTriggerClass ( AliVEvent::kMUSHPB,"+CPBI1MSH-ACE-NOPF-MUON","ACE",triggerCount);
112 oadbDefaultPbPb->SetHardwareTrigger ( triggerCount,"V0A && V0C");
113 oadbDefaultPbPb->SetOfflineTrigger ( triggerCount,"V0A && V0C && !V0ABG && !V0CBG && !TPCLaserWarmUp && ZDCTime");
e5f60c5a 114
8d939043 115 triggerCount++;
116 oadbDefaultPbPb->AddCollisionTriggerClass ( AliVEvent::kMuonUnlikePB,"+CPBI1MUL-B-NOPF-MUON","B", triggerCount);
117 oadbDefaultPbPb->AddBGTriggerClass ( AliVEvent::kMuonUnlikePB,"+CPBI1MUL-ACE-NOPF-MUON","ACE",triggerCount);
118 oadbDefaultPbPb->SetHardwareTrigger ( triggerCount,"V0A && V0C");
119 oadbDefaultPbPb->SetOfflineTrigger ( triggerCount,"V0A && V0C && !V0ABG && !V0CBG && !TPCLaserWarmUp && ZDCTime");
120
121 triggerCount++;
122 oadbDefaultPbPb->AddCollisionTriggerClass ( AliVEvent::kMuonLikePB,"+CPBI1MLL-B-NOPF-MUON","B", triggerCount);
123 oadbDefaultPbPb->AddBGTriggerClass ( AliVEvent::kMuonLikePB,"+CPBI1MLL-ACE-NOPF-MUON","ACE",triggerCount);
124 oadbDefaultPbPb->SetHardwareTrigger ( triggerCount,"V0A && V0C");
125 oadbDefaultPbPb->SetOfflineTrigger ( triggerCount,"V0A && V0C && !V0ABG && !V0CBG && !TPCLaserWarmUp && ZDCTime");
126
127 triggerCount++;
128 oadbDefaultPbPb->AddCollisionTriggerClass ( AliVEvent::kPHOSPb,"+CPBI2PHS-B-NOPF-CENTNOTRD","B", triggerCount);
129 oadbDefaultPbPb->AddBGTriggerClass ( AliVEvent::kPHOSPb,"+CPBI2PHS-ACE-NOPF-CENTNOTRD","ACE",triggerCount);
130 oadbDefaultPbPb->SetHardwareTrigger ( triggerCount,"V0A && V0C");
131 oadbDefaultPbPb->SetOfflineTrigger ( triggerCount,"V0A && V0C && !V0ABG && !V0CBG && !TPCLaserWarmUp && ZDCTime");
132
133 physicsSelectionTask->GetPhysicsSelection()->SetCustomOADBObjects(oadbDefaultPbPb,0,0);
e5f60c5a 134 }
c014f07d 135
1c06a186 136 gROOT->LoadMacro("$ALICE_ROOT/OADB/macros/AddTaskCentrality.C");
c014f07d 137 AliCentralitySelectionTask *taskCentrality = AddTaskCentrality();
138
139 // Create task
e5f60c5a 140 if (mode==0) {
141 gProof->Load(Form("%s/AliAnaVZEROTrigger.cxx++g",
142 gSystem->pwd()));
143 }
144 else {
145 gROOT->LoadMacro(Form("%s/AliAnaVZEROTrigger.cxx++g",
146 gSystem->pwd()));
147 }
c014f07d 148 AliAnaVZEROTrigger *task = new AliAnaVZEROTrigger("AliAnaVZEROTrigger");
e5f60c5a 149 task->SetMBTrigName(minBias);
c014f07d 150 task->Setup("trigger.txt");
8d939043 151 if (usePS) task->SetUsePhysSel(kTRUE);
c014f07d 152
153 // Add task
154 mgr->AddTask(task);
155
156 // Create containers for input/output
157 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
158 AliAnalysisDataContainer *coutput =
159 mgr->CreateContainer("coutput", TList::Class(),
8d939043 160 AliAnalysisManager::kOutputContainer, (!usePS) ? Form("VZERO.Trigger.%s.root",dataset) : Form("VZERO.Trigger.PS.%s.root",dataset));
c014f07d 161
162 // Connect input/output
163 mgr->ConnectInput(task, 0, cinput);
164 mgr->ConnectOutput(task, 1, coutput);
165
166
167 // Enable debug printouts
e5f60c5a 168 mgr->SetDebugLevel(3);
c014f07d 169
170 if (!mgr->InitAnalysis())
171 return;
172
173 mgr->PrintStatus();
174
e5f60c5a 175 if (mode==0)
176 mgr->StartAnalysis("proof", Form("%s/%s",folder,dataset));
177 else {
178 TGrid::Connect("alien://");
179 TChain *chain = new TChain("esdTree");
180 TGridResult *res = gGrid->Query(folder,"AliESDs.root");
181 Int_t nFiles = res->GetEntries();
182 if (lastFile < 0) lastFile = nFiles - 1;
183 for(Int_t iFile = firstFile; iFile <= lastFile; ++iFile) {
184 TString filename = res->GetKey(iFile, "turl");
185 if(filename == "") continue;
186 chain->AddFile(filename.Data());
187 }
188 mgr->StartAnalysis("local", chain);
189 }
c014f07d 190}
191