]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG1/TRD/run.C
fix warnings
[u/mrichter/AliRoot.git] / PWG1 / TRD / run.C
index 0d662e2b43e0a57424fdabeedf9bdbfe8f9976ac..29e8549f7d98ddb77d042be183b93a94bc95c3b1 100644 (file)
@@ -1,8 +1,9 @@
 // Steer TRD QA train for Reconstruction (Clusterizer, Tracking and PID).
 // 
 // Usage:
-//   run.C(tasks, files)
-//   tasks : "ALL" or one/more of the following:
+//   run.C(optList, files, nev, first, runNo, ocdb_uri, grp_uri)
+//
+//   optList : "ALL" [default] or one/more of the following:
 //     "EFF"  : TRD Tracking Efficiency 
 //     "EFFC" : TRD Tracking Efficiency Combined (barrel + stand alone) - only in case of simulations
 //     "MULT"  : TRD single track selection
 //     "ALGN" : TRD alignment
 //     "PID"  : TRD PID - pion efficiency 
 //     "PIDR" : TRD PID - reference data
+//     "V0"   : monitor V0 performance for use in TRD PID calibration
 //     "DET"  : Basic TRD Detector checks
+//      ****** SPECIAL OPTIONS **********
 //     "NOFR" : Data set does not have AliESDfriends.root 
-//     "NOMC" : Data set does not have Monte Carlo Informations (real data), so all tasks which rely
-//              on MC information are switched off
+//     "NOMC" : Data set does not have Monte Carlo Informations (default have MC), 
 //
+//     files : the list of ESD files to be processed [default AliESds.root from cwd]
+//     nev   : number of events to be processed [default all]
+//     first : first event to process [default 0]
+//     runNo : run number [default 0]
+//     ocdb_uri : OCDB location [default local, $ALICE_ROOT]. In case of AliEn the syntax should be of the form
+//                 alien://folder=/alice/data/2010/OCDB?user=username?cacheF=yourDirectory?cacheS=yourSize
+//     grp_uri  : GRP/GRP/Data location [default cwd]. In case of AliEn the syntax should be of the form
+//                 alien://folder=/alice/data/2010/OCDB?user=username?cacheF=yourDirectory?cacheS=yourSize
 // In compiled mode : 
 // Don't forget to load first the libraries
 // gSystem->Load("libMemStat.so")
 // gSystem->Load("libMemStatGui.so")
 // gSystem->Load("libANALYSIS.so")
 // gSystem->Load("libANALYSISalice.so")
+// gSystem->Load("libTENDER.so");
 // gSystem->Load("libPWG1.so");
 // gSystem->Load("libNetx.so") ;
 // gSystem->Load("libRAliEn.so");
@@ -81,7 +92,7 @@ Bool_t MEM = kFALSE;
 
 TChain* MakeChainLST(const char* filename = 0x0);
 TChain* MakeChainXML(const char* filename = 0x0);
-void run(Char_t *optList="ALL", const Char_t *files=0x0, Long64_t nev=1234567890, Long64_t first = 0, Int_t runNo=0, const Char_t *ocdb_uri="local://$ALICE_ROOT/OCDB", const Char_t *grp_uri=Form("local://%s", gSystem->pwd()))
+void run(Char_t *optList="ALL", const Char_t *files=0x0, Long64_t nev=1234567890, Long64_t first = 0)
 {
   TMemStat *mem = 0x0;
   if(MEM){ 
@@ -94,7 +105,8 @@ void run(Char_t *optList="ALL", const Char_t *files=0x0, Long64_t nev=1234567890
   timer.Start();
 
   // VERY GENERAL SETTINGS
-  AliLog::SetGlobalLogLevel(AliLog::kError);
+  //AliLog::SetGlobalLogLevel(AliLog::kError);
+  gStyle->SetOptStat(0);
   if(gSystem->Load("libANALYSIS.so")<0) return;
   if(gSystem->Load("libANALYSISalice.so")<0) return;
   if(gSystem->Load("libTENDER.so")<0) return;
@@ -103,24 +115,6 @@ void run(Char_t *optList="ALL", const Char_t *files=0x0, Long64_t nev=1234567890
   Bool_t fHasMCdata =  HasReadMCData(optList);
   Bool_t fHasFriends = HasReadFriendData(optList);
   
-  // INITIALIZATION OF RUNNING ENVIRONMENT
-  // initialize OCDB manager
-  AliCDBManager *cdbManager = AliCDBManager::Instance();
-  cdbManager->SetDefaultStorage(ocdb_uri);
-  if(!cdbManager->IsDefaultStorageSet()){
-    Error("run.C", "Error setting OCDB.");
-    return;
-  }
-  cdbManager->SetRun(runNo);
-  cdbManager->SetSpecificStorage("GRP/GRP/Data", grp_uri);
-  cdbManager->SetCacheFlag(kFALSE);
-  // initialize magnetic field from the GRP manager.
-  AliGRPManager grpMan;
-  if(!grpMan.ReadGRPEntry()) return;
-  if(!grpMan.SetMagField()) return;
-  //AliRunInfo *runInfo = grpMan.GetRunInfo();
-  AliGeomManager::LoadGeometry();
-
   // DEFINE DATA CHAIN
   TChain *chain = 0x0;
   if(!files) chain = MakeChainLST();
@@ -130,24 +124,25 @@ void run(Char_t *optList="ALL", const Char_t *files=0x0, Long64_t nev=1234567890
     else chain = MakeChainLST(files);
   }
   if(!chain) return;
-  chain->SetBranchStatus("*FMD*",0);
-  chain->SetBranchStatus("*Calo*",0);
-  chain->SetBranchStatus("Tracks", 1);
-  chain->SetBranchStatus("ESDfriend*",1);
   chain->Lookup();
   chain->GetListOfFiles()->Print();
-  printf("\tFOUND %d ENTRIES\n", (Int_t)chain->GetEntries());
+  Int_t nfound=(Int_t)chain->GetEntries();
+  printf("\tENTRIES FOUND [%d] REQUESTED [%d]\n", nfound, nev>nfound?nfound:nev);
 
 
   // BUILD ANALYSIS MANAGER
   AliAnalysisManager *mgr = new AliAnalysisManager("TRD Reconstruction Performance & Calibration");
-  AliVEventHandler *esdH = 0x0, *mcH = 0x0;
-  mgr->SetInputEventHandler(esdH = new AliESDInputHandler);
+  AliESDInputHandlerRP *esdH(NULL);
+  mgr->SetInputEventHandler(esdH = new AliESDInputHandlerRP);
+  esdH->SetReadFriends(kTRUE);
+  esdH->SetActiveBranches("ESDfriend");
+  AliMCEventHandler *mcH(NULL);
   if(fHasMCdata) mgr->SetMCtruthEventHandler(mcH = new AliMCEventHandler());
   //mgr->SetDebugLevel(10);
+  mgr->SetSkipTerminate(kTRUE);
 
   gROOT->LoadMacro("$ALICE_ROOT/PWG1/macros/AddTrainPerformanceTRD.C");
-  if(!AddTrainPerformanceTRD(fHasMCdata, fHasFriends, optList)) {
+  if(!AddTrainPerformanceTRD(optList)) {
     Error("run.C", "Error loading TRD train.");
     return;
   }
@@ -162,19 +157,15 @@ void run(Char_t *optList="ALL", const Char_t *files=0x0, Long64_t nev=1234567890
   }
   //mgr->PrintStatus();
   mgr->StartAnalysis("local", chain, nev, first);
-
   timer.Stop();
   timer.Print();  
 
-  delete cdbManager;
-
   // verbosity
   printf("\tCLEANING TASK LIST:\n");
   mgr->GetTasks()->Delete();
 
   if(mcH) delete mcH;
   delete esdH;
-  delete mgr;
   delete chain;
   if(MEM) delete mem;
   if(MEM) TMemStatViewerGUI::ShowGUI();