2 class AliAnalysisAlien;
5 AliAnalysisAlien* CreateAlienHandler(const char *plugin_mode);
7 Int_t iCollisionType = 0;
8 UInt_t kTriggerInt = AliVEvent::kAnyINT;
9 UInt_t kTriggerMuonAll = AliVEvent::kMUL7 | AliVEvent::kMUSH7 | AliVEvent::kMUU7 | AliVEvent::kMUS7;
10 UInt_t kTriggerMuonBarell = AliVEvent::kMUU7;
11 UInt_t kTriggerEMC = AliVEvent::kEMC7;
12 UInt_t kTriggerHM = AliVEvent::kHighMult;
13 UInt_t kTriggerMask = kTriggerInt;
14 TString grid_datadir = "/alice/data/2011/LHC11h/";
15 TString data_pattern = "*ESDs/pass1_std/*ESDs.root";
16 Int_t runNumbers[5] = {166532};
17 Int_t debug_level = 1; // Debugging
19 void RunTOFqa(const char* plugin_mode="full") {
21 // macro to run the TOF qa
22 gSystem->SetIncludePath("-I. -I$ROOTSYS/include -I$ALICE_ROOT/include -I$ALICE_ROOT -I$ALICE_ROOT/ITS -I$ALICE_ROOT/TRD -I$ALICE_ROOT/PWG1");
24 TString trainName = "TOFqa";
25 TString analysisMode = "grid"; // "local", "grid", or "proof"
26 TString inputMode = "list"; // "list", "xml", or "dataset"
27 Long64_t nentries=123567890,firstentry=0;
28 Bool_t saveProofToAlien=kFALSE;
29 TString proofOutdir = "";
30 if(analysisMode=="grid") {
32 TGrid::Connect("alien://");
34 else if(analysisMode=="proof") {
35 // Connect to the PROOF cluster
36 if(inputMode!="dataset") {printf("Input mode must be dataset, for proof analysis\n"); return;}
37 gEnv->SetValue("XSec.GSI.DelegProxy","2");
38 TProof::Open("alicecaf");
39 if(saveProofToAlien) {
40 TGrid::Connect("alien://");
42 TString homedir = gGrid->GetHomeDirectory();
43 TString workdir = homedir + trainName;
44 if(!gGrid->Cd(workdir)) {
46 if(gGrid->Mkdir(workdir)) {
48 ::Info("TOFqa::Connect()", "Directory %s created", gGrid->Pwd());
51 gGrid->Mkdir("proof_output");
52 gGrid->Cd("proof_output");
53 proofOutdir = Form("alien://%s", gGrid->Pwd());
60 if(analysisMode=="local" || analysisMode=="grid") {
63 else if (analysisMode=="proof") {
67 if(analysisMode!="grid") {printf("Analysis mode must be grid, to use alien plugin\n"); return;}
68 AliAnalysisAlien *alienHandler = CreateAlienHandler(plugin_mode);
69 if(!alienHandler) return;
71 // Create the analysis manager
72 AliAnalysisManager *mgr = new AliAnalysisManager("My Manager","My Manager");
73 mgr->SetDebugLevel(10);
75 // Connect plug-in to the analysis manager
76 mgr->SetGridHandler(alienHandler);
79 AliESDInputHandler *esdHandler = new AliESDInputHandler();
80 esdHandler->SetReadFriends(kTRUE);
81 esdHandler->SetActiveBranches("ESDfriend");
82 mgr->SetInputEventHandler(esdHandler);
83 mgr->SetDebugLevel(debug_level);
84 if(saveProofToAlien) mgr->SetSpecialOutputLocation(proofOutdir);
87 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
88 AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(kFALSE /*MC*/);
91 gROOT->LoadMacro("$ALICE_ROOT/PWG1/TOF/AddTaskTOFQA.C");
92 AliAnalysisTaskTOFqa *tofQA = AddTaskTOFQA();
93 tofQA->SelectCollisionCandidates(kTriggerMask);
96 if (mgr->InitAnalysis()) {
98 if (!strcmp(plugin_mode, "local")) mgr->StartAnalysis("local");
99 else mgr->StartAnalysis("grid");
107 Printf("Loading libs");
108 gSystem->Load("libANALYSIS");
109 gSystem->Load("libANALYSISalice");
110 gSystem->Load("libCORRFW");
111 gSystem->Load("libTENDER");
112 gSystem->Load("libPWG0base.so");
113 gSystem->Load("libPWG0dep.so");
114 gSystem->Load("libPWG0selectors.so");
115 gSystem->Load("libPWG1.so");
120 //_____________________________________________________________________________
122 AliAnalysisAlien* CreateAlienHandler(const char* plugin_mode)
125 AliAnalysisAlien *plugin = new AliAnalysisAlien();
126 // Set the run mode (can be "full", "test", "offline", "submit" or "terminate")
127 plugin->SetRunMode(plugin_mode);
128 plugin->SetUser("zampolli");
129 plugin->SetNtestFiles(3);
130 // Set versions of used packages
131 plugin->SetAPIVersion("V1.1x");
132 plugin->SetROOTVersion("v5-30-03-1");
133 plugin->SetAliROOTVersion("v5-02-08-AN");
134 plugin->AddIncludePath("-I. -I$ROOTSYS/include -I$ALICE_ROOT/include -I$ALICE_ROOT/ITS -I$ALICE_ROOT/TRD");
135 plugin->SetAdditionalLibs("libCORRFW.so libTENDER.so libPWG0base.so libPWG0dep.so libPWG0selectors.so libPWG1.so \
136 libEMCALUtils.so libPHOSUtils.so libPWG4PartCorrBase.so libPWG4PartCorrDep.so \
137 libPWG3base.so libPWG3muon.so libPWG3muondep.so libPWG2forward2.so");
138 // Declare input data to be processed.
139 plugin->SetGridDataDir(grid_datadir); // specify LHC period
140 plugin->SetDataPattern(data_pattern); // specify reco pass and AOD set
141 plugin->SetRunPrefix("000");
142 for (Int_t i=0; i<5; i++) {
143 if (!runNumbers[i]) break;
144 plugin->AddRunNumber(runNumbers[i]);
147 plugin->SetGridWorkingDir("QATOF_1");
148 plugin->SetGridOutputDir("output"); // In this case will be $HOME/work/output
149 //plugin->SetAdditionalLibs();
150 plugin->SetDefaultOutputs(kTRUE);
151 plugin->SetAnalysisMacro("TOFqa_1.C");
152 plugin->SetExecutable("TOFqa_1.sh");
153 plugin->SetSplitMaxInputFileNumber(100);
154 plugin->SetInputFormat("xml-single");
155 plugin->SetJDLName("TOFqa_1.jdl");
156 plugin->SetSplitMode("se");
157 plugin->SetMergeViaJDL(kTRUE);
158 plugin->SetExecutableCommand("aliroot -b -q");
159 //plugin->SetOneStageMerging(kFALSE); // One can use this to force a single stage
160 plugin->SetMaxMergeStages(2); // adapt n to your expected number of files