]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ESDCheck/ana.C
Added some more scripts
[u/mrichter/AliRoot.git] / ESDCheck / ana.C
index 9f1c0c456f219108dcf0bab5d18a3930590fe5a3..fe20a19b26f367a492b4939302dc4fdecea7e1af 100644 (file)
@@ -12,18 +12,28 @@ Bool_t LoadLib( const char* pararchivename)
   
   // Setup par File
   if (pararchivename) {
+   char parpar[80] ; 
+   sprintf(parpar, "%s.par", pararchivename) ;
+   if ( gSystem->AccessPathName(parpar) ) {
+    gSystem->ChangeDirectory(gSystem->Getenv("ALICE_ROOT")) ;
     char processline[1024];
-    sprintf(processline,".! tar xvzf %s.par",pararchivename);
+    sprintf(processline, ".! make %s", parpar) ; 
+    cout << processline << endl ; 
+    gROOT->ProcessLine(processline) ;
+    gSystem->ChangeDirectory(cdir) ; 
+    sprintf(processline, ".! mv /tmp/%s .", parpar) ;
+    gROOT->ProcessLine(processline) ;  
+    sprintf(processline,".! tar xvzf %s",parpar);
     gROOT->ProcessLine(processline);
-    gSystem->ChangeDirectory(pararchivename);
-
+   }
+   gSystem->ChangeDirectory(pararchivename);
+   
     // check for BUILD.sh and execute
     if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) {
       printf("*** Building PAR archive  %s  ***\n", pararchivename);
 
       if (gSystem->Exec("PROOF-INF/BUILD.sh")) {
        AliError(Form("Cannot Build the PAR Archive %s! - Abort!", pararchivename) );
-
         return kFALSE ;
       }
     }
@@ -55,10 +65,11 @@ Bool_t LoadLib( const char* pararchivename)
 }
 
 //______________________________________________________________________
-void ana() 
-{  
+void ana(const Int_t kEvent=100)  
+{ 
   if (! gIsAnalysisLoaded ) {
     LoadLib("ESD") ; 
+    LoadLib("AOD") ; 
     LoadLib("ANALYSIS") ; 
     LoadLib("AnalysisCheck") ; 
   }
@@ -68,56 +79,50 @@ void ana()
 
   // definition of analysis tasks
  
-  const Int_t knumberOfTasks = 10 ; 
-  AliAnalysisTask * taskList[knumberOfTasks] ; 
-  TClass * taskInputList[knumberOfTasks]  ; 
-  TClass * taskOutputList[knumberOfTasks] ; 
-
-  taskList[0]       = new AliPHOSQATask("PHOS") ;
-  taskInputList[0]  = TChain::Class() ; 
-  taskOutputList[0] = TObjArray::Class() ; 
-
-  taskList[1]       = new AliEMCALQATask("EMCal") ;
-  taskInputList[1]  = taskInputList[0] ; // only one top input container allowed 
-  taskOutputList[1] = TObjArray::Class() ; 
-
-  taskList[2]       = new AliPMDQATask("PMD") ;
-  taskInputList[2]  = taskInputList[0] ; // only one top input container allowed 
-  taskOutputList[2] = TObjArray::Class() ; 
-
-  taskList[3]       = new AliAnalysisTaskPt("Pt") ;
-  taskInputList[3]  = taskInputList[0] ; // only one top input container allowed 
-  taskOutputList[3] = TObjArray::Class() ; 
-  
-  taskList[4]       = new AliHMPIDQATask("HMPID") ;
-  taskInputList[4]  = taskInputList[0] ; // only one top input container allowed 
-  taskOutputList[4] = TObjArray::Class() ; 
+  AliPHOSQATask * phos  =  new AliPHOSQATask("PHOS") ;
+  AliAnalysisDataContainer * phosIn = ag->ConnectInput(phos, TChain::Class(), 0) ; 
+  ag->ConnectOuput(phos, TObjArray::Class(), 0) ;  
 
-  taskList[5]       = new AliT0QATask("T0") ;
-  taskInputList[5]  = taskInputList[0] ; // only one top input container allowed 
-  taskOutputList[5] = TObjArray::Class() ; 
+  AliEMCALQATask *emcal = new AliEMCALQATask("EMCal") ;
+  ag->ConnectInput(emcal, phosIn, 0) ; 
+  ag->ConnectOuput(emcal, TObjArray::Class(), 0) ;  
 
-  taskList[6]       = new AliMUONQATask("MUON") ;
-  taskInputList[6]  = taskInputList[0] ; // only one top input container allowed 
-  taskOutputList[6] = TObjArray::Class() ; 
-  
-  taskList[7]       = new AliTRDQATask("TRD") ;
-  taskInputList[7]  = taskInputList[0] ; // only one top input container allowed 
-  taskOutputList[7] = TObjArray::Class() ; 
+  AliPMDQATask * pmd    = new AliPMDQATask("PMD") ;
+  ag->ConnectInput(pmd, phosIn, 0) ; 
+  ag->ConnectOuput(pmd, TObjArray::Class(), 0) ;  
 
-  taskList[8]       = new AliTOFQATask("TOF") ;
-  taskInputList[8]  = taskInputList[0] ; // only one top input container allowed 
-  taskOutputList[8] = TObjArray::Class() ; 
+  AliAnalysisTaskPt * pt = new AliAnalysisTaskPt("Pt") ;
+  ag->ConnectInput(pt, phosIn, 0) ; 
+  ag->ConnectOuput(pt, TObjArray::Class(), 0) ;  
 
-  taskList[9]       = new AliVZEROQATask("VZERO") ;
-  taskInputList[9]  = taskInputList[0] ; // only one top input container allowed 
-  taskOutputList[9] = TObjArray::Class() ; 
+  AliHMPIDQATask * hmpid= new AliHMPIDQATask("HMPID") ;
+  ag->ConnectInput(hmpid, phosIn, 0) ; 
+  ag->ConnectOuput(hmpid, TObjArray::Class(), 0) ;  
 
-//   taskList[8]       = new AliFMDQATask("FMD") ;
-//   taskInputList[8]  = taskInputList[0] ; // only one top input container allowed 
-//   taskOutputList[8] = TObjArray::Class() ; 
-  
-  ag->SetTasks(knumberOfTasks, taskList, taskInputList, taskOutputList) ; 
+  AliT0QATask * t0     = new AliT0QATask("T0") ;
+  ag->ConnectInput(t0, phosIn, 0) ; 
+  ag->ConnectOuput(t0, TObjArray::Class(), 0) ;  
+
+  AliMUONQATask * muon = new AliMUONQATask("MUON") ;
+  ag->ConnectInput(muon, phosIn, 0) ; 
+  ag->ConnectOuput(muon, TObjArray::Class(), 0) ;  
+
+  AliTRDQATask * trd   = new AliTRDQATask("TRD") ;
+  ag->ConnectInput(trd, phosIn, 0) ; 
+  ag->ConnectOuput(trd, TObjArray::Class(), 0) ;  
+
+  AliTOFQATask * tof   = new AliTOFQATask("TOF") ;
+  ag->ConnectInput(tof, phosIn, 0) ; 
+  ag->ConnectOuput(tof, TObjArray::Class(), 0) ;  
+
+  AliVZEROQATask * vzero = new AliVZEROQATask("VZERO") ;
+  ag->ConnectInput(vzero, phosIn, 0) ; 
+  ag->ConnectOuput(vzero, TObjArray::Class(), 0) ;  
+
+  AliFMDQATask * fmd = new AliFMDQATask("FMD") ;
+  ag->ConnectInput(fmd, phosIn, 0) ; 
+  ag->ConnectOuput(fmd, TObjArray::Class(), 0) ;  
 
   // get the data to analyze
 
@@ -149,7 +154,32 @@ void ana()
     //   input = "alien:///alice/cern.ch/user/a/aliprod/prod2006_2/output_pp/105/411/AliESDs.root" ; 
     //   analysisChain->AddFile(input);
     input = "AliESDs.root" ; 
-    analysisChain->AddFile(input);
+    const char * kInDir = gSystem->Getenv("OUTDIR") ; 
+    if ( kInDir ) {
+      if ( ! gSystem->cd(kInDir) ) {
+       printf("%s does not exist\n", kInDir) ;
+       return ;
+      }     
+      Int_t event, skipped=0 ; 
+      char file[120] ;
+      for (event = 0 ; event < kEvent ; event++) {
+        sprintf(file, "%s/%d/AliESDs.root", kInDir,event) ; 
+       TFile * fESD = 0 ; 
+       if ( fESD = TFile::Open(file)) 
+         if ( fESD->Get("esdTree") ) { 
+            printf("++++ Adding %s\n", file) ;
+            analysisChain->AddFile(file);
+         }
+         else { 
+            printf("---- Skipping %s\n", file) ;
+            skipped++ ;
+         }
+      }
+      printf("number of entries # %lld, skipped %d\n", analysisChain->GetEntries(), skipped*100) ;     
+    }
+    else  
+      analysisChain->AddFile(input);
+    
     ag->Process(analysisChain) ; 
   }
   return ;