Comment out copy ctors and assignment opetators from classes source code, not needed.
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDAnalysisTask.C
CommitLineData
38b8c336 1void AliHMPIDAnalysisTask()
9a8aafa5 2{
3
9a8aafa5 4
38b8c336 5 //
6 // Macro to run the AliHMPIDAnalysisTask
7 //
8 //______ Input settings
9 Int_t nEvents = 10000000; //on Proof
10 Int_t nOffset = 0; //on Proof
11 Int_t nFile2Xml = 10; //on Grid - how many ESD files to chain in xml
12 TString xmlName="run104157.xml";//new.xml"; //name of the xml collection created
13 // char *indataset = "/home/lmolnar/CERN/alice/Dec01_rv5-25-04_gcc/test/cosmic/100923/09000100923018.10";
14// char *indataset = "/COMMON/COMMON/LHC09a4_run8101X";
15 // char *indataset = "/PWG4/kleinb/LHC09a3_90023_checked";///HMPID/lmolnar/run100923";///PWG4/kleinb/LHC09a3_90023_checked";
16 char *indataset = "/home/lmolnar/CERN/alice/Dec01_rv5-25-04_gcc/test/cosmic/100923/09000100923018.10/AliESDs.root";
17 // char *indataset = "/media/data/Data/09000100923018.10/AliESDs.root";
18 // char *indataset = "/media/data/Data/alice/sim/LHC09a1/70213/001/AliESDs.root";
9a8aafa5 19
38b8c336 20 //______ Select Local, Proof or Intercative Grid Analysis (but just only one :-))
21 Bool_t bLOCAL = kFALSE;
22 Bool_t bPROOF = kFALSE;
23 Bool_t bGRIDINT = kTRUE;
24
25 AliLog::SetGlobalDebugLevel(2);
26
27
28 //______ Init data set chain
29 TString dataset(indataset);
30 TChain *chain = new TChain("esdTree");
31
32 //______ Define settings for PROOF
33 const char* proofNode = "lmolnar@alicecaf";
34 gEnv->SetValue("XSec.GSI.DelegProxy","2");
35 gROOT->LoadMacro("$ALICE_ROOT/PWG0/CreateESDChain.C");
36 gSystem->Load("libSTEERBase");
37 gSystem->Load("libESD");
38 gSystem->Load("libAOD");
39 gSystem->Load("libANALYSIS");
40 gSystem->Load("libANALYSISalice");
41 //______ Create analysis manager
42 AliAnalysisManager *mgr = new AliAnalysisManager("HMPID Analysis Train", "HMPID Analysis Train");
43 //______ Create input handler, default ESD
44 AliESDInputHandler *esdHandler = new AliESDInputHandler();
45 mgr->SetInputEventHandler(esdHandler);
46 mgr->SetDebugLevel(0);
47 AliLog::SetGlobalLogLevel(0);
48 //______ Create default input container
49 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
50 AliAnalysisDataContainer *hmpoutput= mgr->CreateContainer("hmpoutput", TList::Class(),AliAnalysisManager::kOutputContainer,"HmpidOutput.root");
51
52 if(bLOCAL)
53 {
54
55 Printf("========> Running LOCAL HMPID Analysis <=========");
56 gROOT->LoadMacro("$ALICE_ROOT/PWG0/CreateESDChain.C");
57 gSystem->Load("libSTEERBase");
58 gSystem->Load("libESD");
59 gSystem->Load("libAOD");
60 gSystem->Load("libANALYSIS");
61 gSystem->Load("libANALYSISalice");
62 //chain = CreateESDChain(dataset.Data());//,1,0,kFALSE,kFALSE,0);
63 chain->Add(indataset);
64 gSystem->SetIncludePath("-I. -I$HOME/HMPID -I$ALICE_ROOT/include -I$ROOTSYS/include");
65 gROOT->LoadMacro(Form("%s/HMPID/AliHMPIDAnalysisTask.cxx++g",gSystem->Getenv("ALICE_ROOT")));//"AliHMPIDAnalysisTask.cxx++");
66 AliHMPIDAnalysisTask *hmpTask = new AliHMPIDAnalysisTask("HMPIDAnalysisTask");
67 mgr->AddTask(hmpTask);
68 }
69 else if(bPROOF)
70 {
71 Printf("========> Running PROOF HMPID Analysis <=========");
72 TProof::Open(proofNode);
73 /*
74 gProof->UploadPackage("STEERBase.par");
75 gProof->EnablePackage("STEERBase");
76 gProof->UploadPackage("ESD.par");
77 gProof->EnablePackage("ESD");
78 gProof->UploadPackage("ANALYSIS.par");
79 gProof->EnablePackage("ANALYSIS");
80 gProof->UploadPackage("ANALYSISalice.par");
81 gProof->EnablePackage("ANALYSISalice");
82 */
83 gProof->UploadPackage("/afs/cern.ch/alice/caf/sw/ALICE/PARs/v4-17-Release/AF-v4-17");
84 gProof->EnablePackage("/afs/cern.ch/alice/caf/sw/ALICE/PARs/v4-17-Release/AF-v4-17");
85 gProof->Load(Form("%s/HMPID/AliHMPIDAnalysisTask.cxx++g",gSystem->Getenv("ALICE_ROOT")));
86 AliHMPIDAnalysisTask *hmpTask = new AliHMPIDAnalysisTask("HMPIDAnalysisTask");
87 mgr->AddTask(hmpTask);
88 }
89 else if(bGRIDINT)
90 {
91 Printf("========> Running INTERCATIVE GRID HMPID Analysis <=========");
92 gSystem->Load("libSTEERBase");
93 gSystem->Load("libESD");
94 gSystem->Load("libANALYSIS");
95 gSystem->Load("libANALYSISalice");
96 //______ Add HMPID task
97 gSystem->SetIncludePath("-I. -I$HOME/HMPID -I$ALICE_ROOT/include -I$ROOTSYS/include");
98 gROOT->LoadMacro("$ALICE_ROOT/HMPID/AliHMPIDAnalysisTask.cxx++");
99
100
101 TGrid::Connect("alien://");
102 chain = CreateChainFromCollection(xmlName.Data(),"esdTree",nFile2Xml);
103 //gROOT->LoadMacro(Form("%s/HMPID/AliHMPIDAnalysisTask.cxx++g",gSystem->Getenv("ALICE_ROOT")));//"AliHMPIDAnalysisTask.cxx++");
104 //gROOT->LoadMacro("$ALICE_ROOT/HMPID/AliHMPIDAnalysisTask.cxx++");
105 AliHMPIDAnalysisTask *hmpTask = new AliHMPIDAnalysisTask("HMPIDAnalysisTask");
106 mgr->AddTask(hmpTask);
107
108 }
109
110
111 if(bLOCAL)
112 {
113 //______ Add HMPID task
114 gROOT->LoadMacro("$ALICE_ROOT/PWG0/CreateESDChain.C");
115 gSystem->Load("libSTEERBase");
116 gSystem->Load("libESD");
117 gSystem->Load("libAOD");
118 gSystem->Load("libANALYSIS");
119 gSystem->Load("libANALYSISalice");
120
9a8aafa5 121
38b8c336 122 }
123 if ( bPROOF )
124 {
125
126 }
127
128 mgr->ConnectInput(hmpTask,0,cinput);
129 mgr->ConnectOutput(hmpTask,0,hmpoutput);
9a8aafa5 130
38b8c336 131
132
133 if (mgr->InitAnalysis()) {
134 mgr->PrintStatus();
135 if(bLOCAL || bGRIDINT) mgr->StartAnalysis("local",chain);
136 else if(bPROOF) mgr->StartAnalysis("proof",dataset.Data(), nEvents,nOffset);
137 }
138
139}
140//__________________________________________________________________________________
141TChain *CreateChainFromCollection(const char* xmlfile, const char *treeName="esdTree",Int_t nFiles = 0)
142{
143// Create a chain from an alien collection.
144 TAlienCollection * myCollection = TAlienCollection::Open(xmlfile);
145
146 if (!myCollection) {
147 ::Error("CreateChainSingle", "Cannot create an AliEn collection from %s", xmlfile) ;
148 return NULL ;
149 }
150
151 TChain* chain = new TChain(treeName);
152 myCollection->Reset() ;
153 Int_t iCount = 0;
154 while ( myCollection->Next() ){
155 if(nFiles!=0)iCount++;
156 if(iCount > nFiles)break;
157 chain->Add(myCollection->GetTURL("")) ;
158 Printf("Adding %s",myCollection->GetTURL(""));
9a8aafa5 159 }
38b8c336 160 chain->ls();
161 return chain;
162}
163//__________________________________________________________________________________
164void SetupPar(char* pararchivename)
165{
166 //Load par files, create analysis libraries
167 //For testing, if par file already decompressed and modified
168 //classes then do not decompress.
9a8aafa5 169
38b8c336 170 TString cdir(Form("%s", gSystem->WorkingDirectory() )) ;
171 TString parpar(Form("%s.par", pararchivename)) ;
172
173 if (!gSystem->AccessPathName(pararchivename) ) {
174 TString processline = Form(".! tar xvzf %s",parpar.Data()) ;
175 gROOT->ProcessLine(processline.Data());
176 }
9a8aafa5 177
38b8c336 178 TString ocwd = gSystem->WorkingDirectory();
179 gSystem->ChangeDirectory(pararchivename);
9a8aafa5 180
38b8c336 181 // check for BUILD.sh and execute
182 if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) {
183 printf("*******************************\n");
184 printf("*** Building PAR archive ***\n");
185 cout<<pararchivename<<endl;
186 printf("*******************************\n");
9a8aafa5 187
38b8c336 188 if (gSystem->Exec("PROOF-INF/BUILD.sh")) {
189 Error("runProcess","Cannot Build the PAR Archive! - Abort!");
190 return -1;
191 }
192 }
193 // check for SETUP.C and execute
194 if (!gSystem->AccessPathName("PROOF-INF/SETUP.C")) {
195 printf("*******************************\n");
196 printf("*** Setup PAR archive ***\n");
197 cout<<pararchivename<<endl;
198 printf("*******************************\n");
199 gROOT->Macro("PROOF-INF/SETUP.C");
200 }
9a8aafa5 201
38b8c336 202 gSystem->ChangeDirectory(ocwd.Data());
203 printf("Current dir: %s\n", ocwd.Data());
9a8aafa5 204}
38b8c336 205