]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliCaloCalibPedestal.cxx
added low and high flux parameter options
[u/mrichter/AliRoot.git] / EMCAL / AliCaloCalibPedestal.cxx
index b45b833995e2021369d01950bb1efd4933e11cf7..14d516260a471469f9bf4cbfffdbcc90952b5ae3 100644 (file)
@@ -65,6 +65,8 @@ AliCaloCalibPedestal::AliCaloCalibPedestal(kDetType detectorType) :
   fPeakMinusPedLowGainRatio(),
   fPeakMinusPedHighGainRatio(),
   fDeadMap(),
+  fNEvents(0),
+  fNChanFills(0),
   fDeadTowers(0),
   fNewDeadTowers(0),
   fResurrectedTowers(0),
@@ -73,6 +75,8 @@ AliCaloCalibPedestal::AliCaloCalibPedestal(kDetType detectorType) :
   fColumns(0),
   fRows(0),
   fModules(0),
+  fCaloString(),
+  fMapping(NULL),
   fRunNumber(-1)
 {
   //Default constructor. First we set the detector-type related constants.
@@ -80,6 +84,7 @@ AliCaloCalibPedestal::AliCaloCalibPedestal(kDetType detectorType) :
     fColumns = fgkPhosCols;
     fRows = fgkPhosRows;
     fModules = fgkPhosModules;
+    fCaloString = "PHOS";
   } 
   else {
     //We'll just trust the enum to keep everything in line, so that if detectorType
@@ -88,6 +93,7 @@ AliCaloCalibPedestal::AliCaloCalibPedestal(kDetType detectorType) :
     fColumns = fgkEmCalCols;
     fRows = fgkEmCalRows;
     fModules = fgkEmCalModules;
+    fCaloString = "EMCAL";
   } 
   fDetType = detectorType;
  
@@ -178,6 +184,8 @@ AliCaloCalibPedestal::AliCaloCalibPedestal(const AliCaloCalibPedestal &ped) :
   fPeakMinusPedLowGainRatio(),
   fPeakMinusPedHighGainRatio(),
   fDeadMap(),
+  fNEvents(ped.GetNEvents()),
+  fNChanFills(ped.GetNChanFills()),
   fDeadTowers(ped.GetDeadTowerCount()),
   fNewDeadTowers(ped.GetDeadTowerNew()),
   fResurrectedTowers(ped.GetDeadTowerResurrected()),
@@ -186,6 +194,8 @@ AliCaloCalibPedestal::AliCaloCalibPedestal(const AliCaloCalibPedestal &ped) :
   fColumns(ped.GetColumns()),
   fRows(ped.GetRows()),
   fModules(ped.GetModules()),
+  fCaloString(ped.GetCaloString()),
+  fMapping(NULL), //! note that we are not copying the map info
   fRunNumber(ped.GetRunNumber())
 {
   // Then the ObjArray ones; we add the histograms rather than trying TObjArray = assignment
@@ -243,6 +253,8 @@ void AliCaloCalibPedestal::Reset()
       GetPeakProfileHighGainRatio(i)->Reset();
     }
   }
+  fNEvents = 0;
+  fNChanFills = 0;
   fDeadTowers = 0;
   fNewDeadTowers = 0;
   fResurrectedTowers = 0;
@@ -250,12 +262,38 @@ void AliCaloCalibPedestal::Reset()
   //To think about: should fReference be deleted too?... let's not do it this time, at least...
 }
 
+//_____________________________________________________________________
+Bool_t AliCaloCalibPedestal::AddInfo(const AliCaloCalibPedestal *ped)
+{
+  // just do this for the basic histograms/profiles that get filled in ProcessEvent
+  // may not have data for all modules, but let's just Add everything..
+  for (int i = 0; i < fModules; i++) {
+    GetPedProfileLowGain(i)->Add( ped->GetPedProfileLowGain(i) );
+    GetPedProfileHighGain(i)->Add( ped->GetPedProfileHighGain(i) );
+    GetPeakProfileLowGain(i)->Add( ped->GetPeakProfileLowGain(i) );
+    GetPeakProfileHighGain(i)->Add( ped->GetPeakProfileHighGain(i) );
+  }//end for nModules 
+
+  // DeadMap; Diff profiles etc would need to be redone after this operation
+
+  return kTRUE;//We succesfully added info from the supplied object
+}
+
+//_____________________________________________________________________
+Bool_t AliCaloCalibPedestal::ProcessEvent(AliRawReader *rawReader)
+{ 
+  // if fMapping is NULL the rawstream will crate its own mapping
+  AliCaloRawStream rawStream(rawReader, fCaloString, (AliAltroMapping**)fMapping);
+  return ProcessEvent(&rawStream);
+}
+
 //_____________________________________________________________________
 Bool_t AliCaloCalibPedestal::ProcessEvent(AliCaloRawStream *in)
 { 
   // Method to process=analyze one event in the data stream
   if (!in) return kFALSE; //Return right away if there's a null pointer
   
+  fNEvents++; // one more event
   int sample, i = 0; //The sample temp, and the sample number in current event.
   int max = fgkSampleMin, min = fgkSampleMax;//Use these for picking the pedestal
   int gain = 0;
@@ -280,6 +318,7 @@ Bool_t AliCaloCalibPedestal::ProcessEvent(AliCaloRawStream *in)
        printf("Oh no: arrayPos = %i.\n", arrayPos); 
       }
 
+      fNChanFills++; // one more channel found, and profile to be filled
       //NOTE: coordinates are (column, row) for the profiles
       if (gain == 0) {
        //fill the low gain histograms
@@ -290,7 +329,7 @@ Bool_t AliCaloCalibPedestal::ProcessEvent(AliCaloRawStream *in)
        ((TProfile2D*)fPedestalHighGain[arrayPos])->Fill(in->GetColumn(), -in->GetRow() - 1, min);
        ((TProfile2D*)fPeakMinusPedHighGain[arrayPos])->Fill(in->GetColumn(), -in->GetRow() - 1, max - min);
       }//end if gain
-      
+
       max = fgkSampleMin; min = fgkSampleMax;
       i = 0;