correct a bug in sh and changed the discovery of active detectors in C
authorschutz <schutz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 26 Nov 2009 23:51:10 +0000 (23:51 +0000)
committerschutz <schutz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 26 Nov 2009 23:51:10 +0000 (23:51 +0000)
prod/cosmic/rawqa.C
prod/cosmic/rawqa.sh

index 0d2ca78..8f285ae 100644 (file)
 #include <TSystem.h>
 
 #include "AliCDBManager.h"
+#include "AliCDBEntry.h"
 #include "AliDAQ.h"
+#include "AliGRPObject.h"
 #include "AliLog.h"
 #include "AliQAv1.h"
 #include "AliQAManager.h"
 #include "AliRawReader.h"
 #include "AliRawReaderRoot.h"
-//#include "AliTRDrawStreamBase.h"
 #include "AliGeomManager.h"
+#include "AliRecoParam.h"
 
 TString ClassName() { return "rawqa" ; } 
 
 //________________________________qa______________________________________
-void rawqa(Char_t * filename, Int_t run) 
+void rawqa(Char_t * filename, Int_t run, AliRecoParam::EventSpecie_t es=AliRecoParam::kDefault) 
 {      
 //  TGrid * grid = TGrid::Connect("alien://") ; 
 //  TString filename ; 
@@ -36,65 +38,70 @@ void rawqa(Char_t * filename, Int_t run)
   AliCDBManager * man = AliCDBManager::Instance();
 //  man->SetDefaultStorage("local://cdb2");
   man->SetDefaultStorage("raw://");
-  
-  // set the location of reference data 
-  //AliQAv1::SetQARefStorage(Form("%s%s/", AliQAv1::GetQARefDefaultStorage(), year)) ;  
+  man->SetRun(run);
+  AliCDBEntry *  entry    = man->Get("GRP/GRP/Data");  
+  if (!entry) 
+    return ;
+  AliGRPObject * fGRPData = dynamic_cast<AliGRPObject*>(entry->GetObject());
+  if (!fGRPData) {
+    printf("ERROR: No GRP entry found in OCDB") ; 
+    return ; 
+  }
+  Int_t activeDetectors = fGRPData->GetDetectorMask();
+  const char * detNameOff[AliDAQ::kNDetectors] = { 
+    "ITS",
+    "ITS",
+    "ITS",
+    "TPC",
+    "TRD",
+    "TOF",
+    "HMPID",
+    "PHOS",
+    "CPV",
+    "PMD",
+    "MUON",
+    "MUON",
+    "FMD",
+    "T0",
+    "VZERO", // Name to be changed to V0 ?
+    "ZDC",
+    "ACORDE",
+    "TRG",
+    "EMCAL",
+    "DAQ_TEST",
+    "HLT"
+  } ; 
+  TString detectors  = ""; 
+  TString detectorsW ; 
+  for(Int_t iDet = 0; iDet < (AliDAQ::kNDetectors-1); iDet++) {
+    if ((activeDetectors >> iDet) & 0x1) {
+      if (!detectors.Contains(detNameOff[iDet])) {
+        detectors +=detNameOff[iDet] ; 
+        detectors += " " ;  
+      }
+    }
+  }
   AliQAv1::SetQARefStorage("local://$ALICE_ROOT/QAref") ;
-       
+
   AliLog::SetGlobalDebugLevel(0) ; 
        
-       
-  Bool_t detIn[AliDAQ::kNDetectors] = {kFALSE} ;
-  const char * detNameOff[AliDAQ::kNDetectors] = {"ITS", "ITS", "ITS", "TPC", "TRD", "TOF", "HMPID", "PHOS", "PHOS", 
-          "PMD", "MUON", "MUON", "FMD", "T0", "VZERO", "ZDC", "ACORDE", "TRG", 
-          "EMCAL", "DAQ_TEST", "HLT"} ; 
-       
   AliQAManager * qam = AliQAManager::QAManager(AliQAv1::kRECMODE) ; 
   qam->SetEventSpecie(AliRecoParam::kCosmic) ; 
-  AliQAv1::Instance()->SetEventSpecie(AliRecoParam::kCosmic) ; 
-  TString detectors  = ""; 
-  TString detectorsW = ""; 
+  AliQAv1::Instance()->SetEventSpecie(es) ; 
+//  TString detectorsW = ""; 
   UShort_t eventsProcessed = 0 ; 
   UShort_t filesProcessed  = 1 ; 
-  man->SetRun(run);
   AliGeomManager::LoadGeometry();
-  printf("INFO: Proccessing file %s\n", filename) ;
-  // check which detectors are present 
-  TString alienName = Form("alien://%s", filename) ;
-  AliRawReader * rawReader = new AliRawReaderRoot(alienName.Data());
-  //AliTRDrawStreamBase::SetRawStreamVersion("TB");
-  while ( rawReader->NextEvent() ) {
-    man->SetRun(rawReader->GetRunNumber());
-    AliLog::Flush();
-    UChar_t * data ; 
-    while (rawReader->ReadNextData(data)) {
-      Int_t detID = rawReader->GetDetectorID();
-      if (detID < 0 || detID >= AliDAQ::kNDetectors) {
-        printf("INFO: Wrong detector ID! Skipping payload...\n");
-        continue;
-      }
-      detIn[detID] = kTRUE ; 
-    }
-    for (Int_t detID = 0; detID < AliDAQ::kNDetectors ; detID++) {
-      if (detIn[detID]) {
-        if ( ! detectors.Contains(detNameOff[detID]) ) {
-          detectors.Append(detNameOff[detID]) ;
-          detectors.Append(" ") ;
-        }
-      }
-    }
-    if ( !detectors.IsNull() )
-      break ; 
-  }
+  printf("INFO: Proccessing detectors %s from file %s\n", detectors.Data(), filename) ;
   if ( !detectors.IsNull() ) {
          qam->SetMaxEvents(-1) ; 
-    qam->SetTasks(Form("%d", AliQAv1::kRAWS));                         
+    qam->SetTasks(Form("%d", AliQAv1::kRAWS));                 
+    AliRawReader * rawReader = new AliRawReaderRoot(Form("alien://%s", filename));
     detectorsW = qam->Run(detectors, rawReader) ;
     qam->Reset() ;
   } else {
-                 printf("ERROR: No valid detectors found") ; 
+    printf("ERROR: No valid detectors found") ; 
   } 
-  delete rawReader ;
   eventsProcessed += qam->GetCurrentEvent() ; 
        //qam->Merge(run) ; 
        
index d6d201e..5b1faf8 100755 (executable)
@@ -32,8 +32,8 @@ VERSION=1.0
 TITLE="Standalone QA checking of Grid rawdata chunks. v$VERSION"
 
 # Retrieve the list of chunks from AliEn.......
-export BASEDIR="/alice/data/20"$YEAR
-PATTERN="/raw/"$YEAR"0000"$RUNNUM"*0.root"
+export BASEDIR="/alice/data/20"$YEAR/LHC${YEAR}*
+PATTERN="$RUNNUM/raw/${YEAR}*${RUNNUM}*.root"
 #aliensh -c "gbbox find $BASEDIR $PATTERN" | head --lines=-1 > collection.tmp
 aliensh -c "gbbox find $BASEDIR $PATTERN" > collection.tmp
 
@@ -74,7 +74,7 @@ for filename in $CHUNKS; do
      rm $RUNNUM"/"QA.$SUBCHUNK.root 
      cd       $RUNNUM"/"$CHUNK
 $PROGRAM -b <<EOF
-.L $ALICE_ROOT/test/cosmic/rawqa.C+
+.L $ALICE_ROOT/prod/cosmic/rawqa.C+
 rawqa($filename, $RUNNUM)
 EOF