]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSDigitizer.cxx
Splitting of the QA maker into simulation and reconstruction dependent parts (Yves)
[u/mrichter/AliRoot.git] / PHOS / AliPHOSDigitizer.cxx
index c0d06aa57fb1e6b2b5515562881440a3f4a6d647..86d465962fbe248fe1dc3ee91fd09f1183cba517 100644 (file)
 /* History of cvs commits:
  *
  * $Log$
+ * Revision 1.103  2007/11/07 11:25:06  schutz
+ * Comment out the QA checking before starting digitization
+ *
+ * Revision 1.102  2007/10/19 18:04:29  schutz
+ * The standalone QA data maker is called from AliSimulation and AliReconstruction outside the event loop; i.e. re-reading the data. The QA data making in the event loop has been commented out.
+ *
+ * Revision 1.101  2007/10/14 21:08:10  schutz
+ * Introduced the checking of QA results from previous step before entering the event loop
+ *
+ * Revision 1.100  2007/10/10 09:05:10  schutz
+ * Changing name QualAss to QA
+ *
+ * Revision 1.99  2007/09/30 17:08:20  schutz
+ * Introducing the notion of QA data acquisition cycle (needed by online)
+ *
+ * Revision 1.98  2007/09/26 14:22:17  cvetan
+ * Important changes to the reconstructor classes. Complete elimination of the run-loaders, which are now steered only from AliReconstruction. Removal of the corresponding Reconstruct() and FillESD() methods.
+ *
+ * Revision 1.97  2007/08/07 14:12:03  kharlov
+ * Quality assurance added (Yves Schutz)
+ *
+ * Revision 1.96  2007/04/28 10:43:36  policheh
+ * Dead channels simulation: digit energy sets to 0.
+ *
+ * Revision 1.95  2007/04/10 07:20:52  kharlov
+ * Decalibration should use the same CDB as calibration in AliPHOSClusterizerv1
+ *
+ * Revision 1.94  2007/02/01 10:34:47  hristov
+ * Removing warnings on Solaris x86
+ *
  * Revision 1.93  2006/10/17 13:17:01  kharlov
  * Replace AliInfo by AliDebug
  *
@@ -132,7 +162,9 @@ AliPHOSDigitizer::AliPHOSDigitizer() :
   fNADCcpv(0),
   fEventFolderName(""),
   fFirstEvent(0),
-  fLastEvent(0)
+  fLastEvent(0), 
+//  fQADM (0x0), 
+  fEventCounter(0)
 {
   // ctor
   InitParameters() ; 
@@ -165,13 +197,22 @@ AliPHOSDigitizer::AliPHOSDigitizer(TString alirunFileName,
   fNADCcpv(0),
   fEventFolderName(eventFolderName),
   fFirstEvent(0),
-  fLastEvent(0)
+  fLastEvent(0), 
+//  fQADM (0x0), 
+  fEventCounter(0)
 {
   // ctor
   InitParameters() ; 
   Init() ;
   fDefaultInit = kFALSE ; 
   fManager = 0 ;                     // We work in the standalong mode
+ // //Initialize the quality assurance data maker only once
+//  fQADM = new AliPHOSQADataMaker() ;  
+//  //FIXME: get the run number
+//  Int_t run = 0 ;
+//  //EMXIF    
+//   GetQADataMaker()->Init(AliQA::kDIGITS, run, fgkCycles) ;    
+//   GetQADataMaker()->StartOfCycle(AliQA::kDIGITS) ;    
 }
 
 //____________________________________________________________________________ 
@@ -199,11 +240,20 @@ AliPHOSDigitizer::AliPHOSDigitizer(const AliPHOSDigitizer & d) :
   fNADCcpv(d.fNADCcpv),
   fEventFolderName(d.fEventFolderName),
   fFirstEvent(d.fFirstEvent),
-  fLastEvent(d.fLastEvent)
+  fLastEvent(d.fLastEvent), 
+//  fQADM (d.fQADM), 
+  fEventCounter(0)
+
 {
   // copyy ctor 
   SetName(d.GetName()) ; 
   SetTitle(d.GetTitle()) ; 
+//Initialize the quality assurance data maker only once
+ //FIXME: get the run number
+//  Int_t run = 0 ;
+//  //EMXIF    
+//  GetQADataMaker()->Init(AliQA::kDIGITS, run, fgkCycles) ;    
+//  GetQADataMaker()->StartOfCycle(AliQA::kDIGITS) ;    
 }
 
 //____________________________________________________________________________ 
@@ -231,13 +281,23 @@ AliPHOSDigitizer::AliPHOSDigitizer(AliRunDigitizer * rd) :
   fNADCcpv(0),
   fEventFolderName(fManager->GetInputFolderName(0)),
   fFirstEvent(0),
-  fLastEvent(0)
+  fLastEvent(0), 
+//  fQADM (0x0), 
+  fEventCounter(0)
+
 {
   // ctor Init() is called by RunDigitizer
   fManager = rd ; 
   SetTitle(dynamic_cast<AliStream*>(fManager->GetInputStream(0))->GetFileName(0));
   InitParameters() ; 
   fDefaultInit = kFALSE ; 
+//Initialize the quality assurance data maker only once
+//  fQADM = new AliPHOSQADataMaker() ;  
+// //FIXME: get the run number
+//  Int_t run = 0 ;
+//  //EMXIF    
+//  GetQADataMaker()->Init(AliQA::kDIGITS, run) ;    
+//  GetQADataMaker()->StartOfCycle(AliQA::kDIGITS) ;    
 }
 
 //____________________________________________________________________________ 
@@ -250,7 +310,9 @@ AliPHOSDigitizer::AliPHOSDigitizer(AliRunDigitizer * rd) :
   // dtor
   delete [] fInputFileNames ; 
   delete [] fEventNames ; 
+
+//  delete fQADM ; 
+
 }
 
 //____________________________________________________________________________
@@ -479,6 +541,17 @@ void AliPHOSDigitizer::Digitize(Int_t event)
       digit->SetAmp(DigitizeCPV(digit->GetEnergy(),digit->GetId()) ) ;
     }
   }
+
+  Int_t relId[4];
+
+  //set amplitudes in bad channels to zero
+  for(i = 0 ; i <digits->GetEntries(); i++){
+    digit = dynamic_cast<AliPHOSDigit*>( digits->At(i) ) ;
+    gime->PHOSGeometry()->AbsToRelNumbering(digit->GetId(),relId);
+    if(relId[1] == 0) // Emc
+      if(gime->CalibData()->IsBadChannelEmc(relId[0],relId[3],relId[2])) digit->SetEnergy(0.); 
+  }
+
 }
 
 //____________________________________________________________________________
@@ -500,7 +573,7 @@ void AliPHOSDigitizer::DecalibrateEMC(AliPHOSDigit *digit)
   Int_t row   =relId[2];
   Int_t column=relId[3];
   Float_t decalibration = gime->CalibData()->GetADCchannelEmc(module,column,row);
-  Float_t energy = digit->GetEnergy() * decalibration;
+  Float_t energy = digit->GetEnergy() / decalibration;
   digit->SetEnergy(energy);
 }
 //____________________________________________________________________________
@@ -560,8 +633,20 @@ void AliPHOSDigitizer::Exec(Option_t *option)
     return ; 
   }
   
-  if(strstr(option,"tim"))
-    gBenchmark->Start("PHOSDigitizer");
+ // // check the QA result for Hits and SDigits
+//  AliQA * qa = AliQA::Instance(AliQA::kPHOS) ; 
+//  if ( qa->IsSet(AliQA::kPHOS, AliQA::kSIM, AliQA::kFATAL)) {
+//     AliFatal("QA status in Hits and/or SDIGITS was Fatal") ;
+//  } else if ( qa->IsSet(AliQA::kPHOS, AliQA::kSIM, AliQA::kERROR)) {
+//     AliError("QA status in Hits and/or SDIGITS was Error") ;
+//  } else if ( qa->IsSet(AliQA::kPHOS, AliQA::kSIM, AliQA::kWARNING) ) {
+//     AliWarning("QA status in Hits and/or SDIGITS was Warning") ;
+//  } else if ( qa->IsSet(AliQA::kPHOS, AliQA::kSIM, AliQA::kINFO) ) {
+//     AliInfo("QA status in Hits and/or SDIGITS was Info") ;
+//  }
+   
+ if(strstr(option,"tim"))
+     gBenchmark->Start("PHOSDigitizer");
   
   AliPHOSGetter * gime = AliPHOSGetter::Instance(GetTitle()) ;
 
@@ -578,11 +663,19 @@ void AliPHOSDigitizer::Exec(Option_t *option)
   Int_t ievent ;
 
   for (ievent = fFirstEvent; ievent <= fLastEvent; ievent++) {
+    fEventCounter++ ; 
     gime->Event(ievent,"S") ;
 
     Digitize(ievent) ; //Add prepared SDigits to digits and add the noise
 
+//    //makes the quality assurance data
+//    if (GetQADataMaker()->IsCycleDone() ) {
+//      GetQADataMaker()->EndOfCycle(AliQA::kDIGITS) ; 
+//       GetQADataMaker()->StartOfCycle(AliQA::kDIGITS) ; 
+//    }
+//    GetQADataMaker()->Exec(AliQA::kDIGITS, gime->Digits()) ; 
+//     GetQADataMaker()->Increment() ;
+                                  
     WriteDigits() ;
 
     if(strstr(option,"deb"))
@@ -591,6 +684,12 @@ void AliPHOSDigitizer::Exec(Option_t *option)
     //increment the total number of Digits per run 
     fDigitsInRun += gime->Digits()->GetEntriesFast() ;  
  }
+//   //Write the quality assurance data only after the last event 
+// if ( fEventCounter == gime->MaxEvent() ) { 
+//    GetQADataMaker()->EndOfCycle(AliQA::kDIGITS) ;    
+//     GetQADataMaker()->Finish() ;
+//  }
   
   gime->PhosLoader()->CleanDigitizer();