introduce option to run QA for selected detectors and for selected tasks
authorschutz <schutz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 10 Jun 2008 11:55:43 +0000 (11:55 +0000)
committerschutz <schutz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 10 Jun 2008 11:55:43 +0000 (11:55 +0000)
STEER/AliSimulation.cxx
STEER/AliSimulation.h

index e06b9233dfa1ff29b28d9be1438bff6c31f52075..9a311e52a9666ef26f258b3da23672d5f22acb5f 100644 (file)
@@ -181,6 +181,8 @@ AliSimulation::AliSimulation(const char* configFileName,
   fInitRunNumberCalled(kFALSE),
   fSetRunNumberFromDataCalled(kFALSE),
   fEmbeddingFlag(kFALSE),
   fInitRunNumberCalled(kFALSE),
   fSetRunNumberFromDataCalled(kFALSE),
   fEmbeddingFlag(kFALSE),
+  fQADetectors("ALL"),                  
+  fQATasks("ALL"),     
   fRunQA(kTRUE), 
   fRunHLT("default")
 {
   fRunQA(kTRUE), 
   fRunHLT("default")
 {
@@ -227,7 +229,9 @@ AliSimulation::AliSimulation(const AliSimulation& sim) :
   fInitRunNumberCalled(sim.fInitRunNumberCalled),
   fSetRunNumberFromDataCalled(sim.fSetRunNumberFromDataCalled),
   fEmbeddingFlag(sim.fEmbeddingFlag),
   fInitRunNumberCalled(sim.fInitRunNumberCalled),
   fSetRunNumberFromDataCalled(sim.fSetRunNumberFromDataCalled),
   fEmbeddingFlag(sim.fEmbeddingFlag),
-  fRunQA(kTRUE), 
+  fQADetectors(sim.fQADetectors),                  
+  fQATasks(sim.fQATasks),      
+  fRunQA(sim.fRunQA), 
   fRunHLT(sim.fRunHLT)
 {
 // copy constructor
   fRunHLT(sim.fRunHLT)
 {
 // copy constructor
@@ -1755,19 +1759,64 @@ Bool_t AliSimulation::RunQA()
 
        TString detectorsw("") ;  
        Bool_t rv = kTRUE ; 
 
        TString detectorsw("") ;  
        Bool_t rv = kTRUE ; 
-       detectorsw =  qas.Run("ALL", AliQA::kHITS) ; 
-//     qas.Reset() ; 
-       detectorsw += qas.Run(fMakeSDigits.Data(), AliQA::kSDIGITS) ;   
+       if (fQATasks.Contains(Form("%d", AliQA::kHITS))) 
+               detectorsw =  qas.Run(fQADetectors.Data(), AliQA::kHITS) ; 
 //     qas.Reset() ; 
 //     qas.Reset() ; 
-       detectorsw += qas.Run(fMakeDigits.Data(), AliQA::kDIGITS) ;     
+       if (fQATasks.Contains(Form("%d", AliQA::kSDIGITS))) 
+               detectorsw += qas.Run(fQADetectors.Data(), AliQA::kSDIGITS) ;   
 //     qas.Reset() ; 
 //     qas.Reset() ; 
-       detectorsw += qas.Run(fMakeDigitsFromHits.Data(), AliQA::kDIGITS) ; 
-       
+       if (fQATasks.Contains(Form("%d", AliQA::kDIGITS))) 
+               detectorsw += qas.Run(fQADetectors.Data(), AliQA::kDIGITS) ;    
+
        if ( detectorsw.IsNull() ) 
                rv = kFALSE ; 
        return rv ; 
 }
 
        if ( detectorsw.IsNull() ) 
                rv = kFALSE ; 
        return rv ; 
 }
 
+//_____________________________________________________________________________
+Bool_t AliSimulation::SetRunQA(TString detAndAction) 
+{
+       // Allows to run QA for a selected set of detectors
+       // and a selected set of tasks among HITS, SDIGITS and DIGITS
+       // all selected detectors run the same selected tasks
+       
+       if (!detAndAction.Contains(":")) {
+               AliError( Form("%s is a wrong syntax, use \"DetectorList:ActionList\" \n", detAndAction.Data()) ) ;
+               fRunQA = kFALSE ;
+               return kFALSE ;                 
+       }
+       Int_t colon = detAndAction.Index(":") ; 
+       fQADetectors = detAndAction(0, colon) ; 
+       if (fQADetectors.Contains("ALL") )
+               fQADetectors = Form("%s %s", fMakeDigits.Data(), fMakeDigitsFromHits.Data()) ; 
+       fQATasks   = detAndAction(colon+1, detAndAction.Sizeof() ) ; 
+       if (fQATasks.Contains("ALL") ) {
+               fQATasks = Form("%d %d %d", AliQA::kHITS, AliQA::kSDIGITS, AliQA::kDIGITS) ; 
+       } else {
+               fQATasks.ToUpper() ; 
+               TString tempo("") ; 
+               if ( fQATasks.Contains("HIT") ) 
+                       tempo = Form("%d ", AliQA::kHITS) ; 
+               if ( fQATasks.Contains("SDIGIT") ) 
+                       tempo += Form("%d ", AliQA::kSDIGITS) ; 
+               if ( fQATasks.Contains("DIGIT") ) 
+                       tempo += Form("%d ", AliQA::kDIGITS) ; 
+               fQATasks = tempo ; 
+               if (fQATasks.IsNull()) {
+                       AliInfo("No QA requested\n")  ;
+                       fRunQA = kFALSE ;
+                       return kTRUE ; 
+               }
+       }       
+       TString tempo(fQATasks) ; 
+    tempo.ReplaceAll(Form("%d", AliQA::kHITS), AliQA::GetTaskName(AliQA::kHITS))       ;
+    tempo.ReplaceAll(Form("%d", AliQA::kSDIGITS), AliQA::GetTaskName(AliQA::kSDIGITS)) ;       
+    tempo.ReplaceAll(Form("%d", AliQA::kDIGITS), AliQA::GetTaskName(AliQA::kDIGITS)) ;         
+       AliInfo( Form("QA will be done on \"%s\" for \"%s\"\n", fQADetectors.Data(), tempo.Data()) ) ;  
+       fRunQA = kTRUE ;
+       return kTRUE; 
+} 
+
 //_____________________________________________________________________________
 void AliSimulation::ProcessEnvironmentVars()
 {
 //_____________________________________________________________________________
 void AliSimulation::ProcessEnvironmentVars()
 {
index 74399354e24860a9e328eb1cf68233c7879c9369..fc8ba3a5d346e5e48fd43b0ea19288b379574c84 100644 (file)
@@ -108,7 +108,7 @@ public:
   const Int_t GetQACycles(const char * detector) { return fQACycles[GetDetIndex(detector)] ; }
   void        SetQACycles(const char * detector, const Int_t cycles) { fQACycles[GetDetIndex(detector)] = cycles ; }
   Bool_t      RunQA() ;
   const Int_t GetQACycles(const char * detector) { return fQACycles[GetDetIndex(detector)] ; }
   void        SetQACycles(const char * detector, const Int_t cycles) { fQACycles[GetDetIndex(detector)] = cycles ; }
   Bool_t      RunQA() ;
-  void        SetQA(const Bool_t val) { fRunQA = val ; } 
+  Bool_t      SetRunQA(TString detAndAction="ALL:ALL") ; 
   
 private:
   void                  InitCDB();
   
 private:
   void                  InitCDB();
@@ -159,6 +159,8 @@ private:
   static const Int_t   fgkNDetectors = 15 ;             // number of detectors
   static const char *  fgkDetectorName[fgkNDetectors] ; // names of detectors
   Int_t                fQACycles[fgkNDetectors] ;       // cycle length (# events) over which QA data are accumulated
   static const Int_t   fgkNDetectors = 15 ;             // number of detectors
   static const char *  fgkDetectorName[fgkNDetectors] ; // names of detectors
   Int_t                fQACycles[fgkNDetectors] ;       // cycle length (# events) over which QA data are accumulated
+  TString              fQADetectors ;                   // list of detectors to be QA'ed       
+  TString              fQATasks ;                       // list of QA tasks to be performed    
   Bool_t               fRunQA ;                         // Runs the QA at the end of simulation
 
   //HLT
   Bool_t               fRunQA ;                         // Runs the QA at the end of simulation
 
   //HLT