]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONDigitizerV3.cxx
New option to discard mono-cathod clusters (by changing their resolution) and refit...
[u/mrichter/AliRoot.git] / MUON / AliMUONDigitizerV3.cxx
index 4f4ac60dd84546e993be48ac9957cf54cb681225..91fb1e8d2cd0edc6de9c2cbc9333a981b369f8bd 100644 (file)
@@ -47,7 +47,7 @@
 #include "AliCodeTimer.h"
 #include "AliLog.h"
 #include "AliRun.h"
-#include "AliRunDigitizer.h"
+#include "AliDigitizationInput.h"
 #include "AliLoader.h"
 #include "AliRunLoader.h"
 
@@ -110,15 +110,15 @@ ClassImp(AliMUONDigitizerV3)
 /// \endcond
 
 //_____________________________________________________________________________
-AliMUONDigitizerV3::AliMUONDigitizerV3(AliRunDigitizer* manager
+AliMUONDigitizerV3::AliMUONDigitizerV3(AliDigitizationInput* digInput
                                        Int_t generateNoisyDigits)
-: AliDigitizer(manager),
+: AliDigitizer(digInput),
 fIsInitialized(kFALSE),
 fCalibrationData(0x0),
 fTriggerProcessor(0x0),
 fNoiseFunctionTrig(0x0),
 fGenerateNoisyDigits(generateNoisyDigits),
-fLogger(new AliMUONLogger(1000)),
+fLogger(new AliMUONLogger(4207)), /* 4207 = 25% of the 16828 MCH manus */
 fTriggerStore(new AliMUONTriggerStoreV1),
 fDigitStore(0x0),
 fOutputDigitStore(0x0),
@@ -130,7 +130,7 @@ fEfficiencyResponse(2*AliMUONConstants::NTriggerCh()*AliMUONConstants::NTriggerC
 {
   /// Ctor.
 
-  AliDebug(1,Form("AliRunDigitizer=%p",fManager));
+  AliDebug(1,Form("AliDigitizationInput=%p",fDigInput));
 
 }
 
@@ -202,20 +202,27 @@ AliMUONDigitizerV3::ApplyResponseToTrackerDigit(AliMUONVDigit& digit, Bool_t add
     digit.SetADC(0);
     return;
   }
-      
+
+  TString calibrationMode(fRecoParam->GetCalibrationMode());
+  calibrationMode.ToUpper();
+
   AliMUONVCalibParam* gain = fCalibrationData->Gains(detElemId,manuId);
   if (!gain)
   {
-    fLogger->Log(Form("%s:%d:Could not get gain for DE=%4d manuId=%4d. Disabling.",
-                      __FILE__,__LINE__,
-                      detElemId,manuId));
-    digit.SetADC(0);
-    return;        
+    
+    if (!calibrationMode.Contains("NOGAIN") )
+    {
+      fLogger->Log(Form("%s:%d:Could not get gain for DE=%4d manuId=%4d. Disabling.",
+                        __FILE__,__LINE__,
+                        detElemId,manuId));
+      digit.SetADC(0);
+      return;        
+    }
   }    
 
-  Int_t adc = DecalibrateTrackerDigit(*pedestal,*gain,manuChannel,charge,addNoise,
+  Int_t adc = DecalibrateTrackerDigit(*pedestal,gain,manuChannel,charge,addNoise,
                                       digit.IsNoiseOnly(),
-                                      fRecoParam->GetCalibrationMode());
+                                      calibrationMode);
   
   digit.SetADC(adc);
 }
@@ -236,6 +243,17 @@ AliMUONDigitizerV3::ApplyResponseToTriggerDigit(AliMUONVDigit& digit)
   Int_t cathode = digit.Cathode();
   Int_t trigCh = detElemId/100 - 11;
   
+  // Masked channels
+  Bool_t isMasked = fTriggerUtilities->IsMasked(digit);
+  AliDebug(1,Form("detElemId %i  cath %i  board %i  strip %i  is masked %i\n", detElemId, cathode, localCircuit, strip, isMasked));
+  if ( isMasked ) {
+    digit.SetCharge(0);
+    digit.SetADC(0);
+    //AliDebug(1,Form("ch %i  cath %i  board %i  strip %i  masked\n", trigCh, cathode, localCircuit, strip));
+    return;
+  }
+  
+  
   Int_t arrayIndex = GetArrayIndex(cathode, trigCh, localCircuit);
   
   // Trigger chamber efficiency
@@ -248,24 +266,14 @@ AliMUONDigitizerV3::ApplyResponseToTriggerDigit(AliMUONVDigit& digit)
       fEfficiencyResponse[arrayIndexBend] = isTrig[0];
       fEfficiencyResponse[arrayIndexNonBend] = isTrig[1];
     }
-    AliDebug(1,Form("ch %i  cath %i  board %i  strip %i  efficiency %i\n", trigCh, cathode, localCircuit, strip, fEfficiencyResponse[arrayIndex]));
+    AliDebug(1,Form("detElemId %i  cath %i  board %i  strip %i  efficiency %i\n", detElemId, cathode, localCircuit, strip, fEfficiencyResponse[arrayIndex]));
     if ( fEfficiencyResponse[arrayIndex] == 0 ) {
       digit.SetCharge(0);
       digit.SetADC(0);
       //AliDebug(1,Form("ch %i  cath %i  board %i  strip %i  NOT efficient\n", trigCh, cathode, localCircuit, strip));
       return;
     }
-  }
-  
-  // Masked channels
-  Bool_t isMasked = fTriggerUtilities->IsMasked(digit);
-  AliDebug(1,Form("ch %i  cath %i  board %i  strip %i  mask %i\n", trigCh, cathode, localCircuit, strip, !isMasked));
-  if ( isMasked ) {
-    digit.SetCharge(0);
-    digit.SetADC(0);
-    //AliDebug(1,Form("ch %i  cath %i  board %i  strip %i  masked\n", trigCh, cathode, localCircuit, strip));
-    return;
-  }
+  }  
 }
 
 
@@ -311,7 +319,7 @@ AliMUONDigitizerV3::ApplyResponse(const AliMUONVDigitStore& store,
 //_____________________________________________________________________________
 Int_t 
 AliMUONDigitizerV3::DecalibrateTrackerDigit(const AliMUONVCalibParam& pedestals,
-                                            const AliMUONVCalibParam& gains,
+                                            const AliMUONVCalibParam* gains,
                                             Int_t channel,
                                             Float_t charge,
                                             Bool_t addNoise,
@@ -341,16 +349,20 @@ AliMUONDigitizerV3::DecalibrateTrackerDigit(const AliMUONVCalibParam& pedestals,
                
   if ( ! nogain )
   {
-    a0 = gains.ValueAsFloat(channel,0);
-    a1 = gains.ValueAsFloat(channel,1);
-    thres = gains.ValueAsInt(channel,2);
-    qual = gains.ValueAsInt(channel,3);
+    if  (!gains)
+    {
+      AliFatalClass("Cannot make gain decalibration without gain values !");
+    }
+    a0 = gains->ValueAsFloat(channel,0);
+    a1 = gains->ValueAsFloat(channel,1);
+    thres = gains->ValueAsInt(channel,2);
+    qual = gains->ValueAsInt(channel,3);
   }
   
   Float_t pedestalMean = pedestals.ValueAsFloat(channel,0);
   Float_t pedestalSigma = pedestals.ValueAsFloat(channel,1);
   
-  AliDebugClass(1,Form("DE %04d MANU %04d CH %02d PEDMEAN %7.2f PEDSIGMA %7.2f",
+  AliDebugClass(2,Form("DE %04d MANU %04d CH %02d PEDMEAN %7.2f PEDSIGMA %7.2f",
                       pedestals.ID0(),pedestals.ID1(),channel,pedestalMean,pedestalSigma));
   
   if ( qual <= 0 ) return 0;
@@ -440,14 +452,14 @@ AliMUONDigitizerV3::DecalibrateTrackerDigit(const AliMUONVCalibParam& pedestals,
     // this is an error only in specific cases
     if ( !addNoise || (addNoise && noiseOnly) ) 
     {
-      AliErrorClass(Form(" DE %04d Manu %04d Channel %02d "
-                         " a0 %7.2f a1 %7.2f thres %04d ped %7.2f pedsig %7.2f adcNoise %7.2f "
-                         " charge=%7.2f padc=%7.2f adc=%04d ZS=%04d fgNSigmas=%e addNoise %d noiseOnly %d ",
-                         pedestals.ID0(),pedestals.ID1(),channel, 
-                         a0, a1, thres, pedestalMean, pedestalSigma, adcNoise,
-                         charge, padc, adc, 
-                         TMath::Nint(pedestalMean + fgNSigmas*pedestalSigma + 0.5),
-                         fgNSigmas,addNoise,noiseOnly));
+      AliDebugClass(1,Form(" DE %04d Manu %04d Channel %02d "
+                                                                                                        " a0 %7.2f a1 %7.2f thres %04d ped %7.2f pedsig %7.2f adcNoise %7.2f "
+                                                                                                        " charge=%7.2f padc=%7.2f adc=%04d ZS=%04d fgNSigmas=%e addNoise %d noiseOnly %d ",
+                                                                                                        pedestals.ID0(),pedestals.ID1(),channel, 
+                                                                                                        a0, a1, thres, pedestalMean, pedestalSigma, adcNoise,
+                                                                                                        charge, padc, adc, 
+                                                                                                        TMath::Nint(pedestalMean + fgNSigmas*pedestalSigma + 0.5),
+                                                                                                        fgNSigmas,addNoise,noiseOnly));
     }
     
     adc = 0;
@@ -478,9 +490,9 @@ AliMUONDigitizerV3::CreateInputDigitStores()
   
   fInputDigitStores->SetOwner(kTRUE);
   
-  for ( Int_t iFile = 0; iFile < fManager->GetNinputs(); ++iFile )
+  for ( Int_t iFile = 0; iFile < fDigInput->GetNinputs(); ++iFile )
   {    
-    AliLoader* inputLoader = GetLoader(fManager->GetInputFolderName(iFile));
+    AliLoader* inputLoader = GetLoader(fDigInput->GetInputFolderName(iFile));
     
     inputLoader->LoadSDigits("READ");
     
@@ -496,7 +508,7 @@ AliMUONDigitizerV3::CreateInputDigitStores()
 
 //_____________________________________________________________________________
 void
-AliMUONDigitizerV3::Exec(Option_t*)
+AliMUONDigitizerV3::Digitize(Option_t*)
 {
   /// Main method.
   /// We first loop over input files, and merge the sdigits we found there.
@@ -506,7 +518,7 @@ AliMUONDigitizerV3::Exec(Option_t*)
     
   AliCodeTimerAuto("",0)
   
-  if ( fManager->GetNinputs() == 0 )
+  if ( fDigInput->GetNinputs() == 0 )
   {
     AliWarning("No input set. Nothing to do.");
     return;
@@ -518,9 +530,9 @@ AliMUONDigitizerV3::Exec(Option_t*)
     return;
   }
   
-  Int_t nInputFiles = fManager->GetNinputs();
+  Int_t nInputFiles = fDigInput->GetNinputs();
   
-  AliLoader* outputLoader = GetLoader(fManager->GetOutputFolderName());
+  AliLoader* outputLoader = GetLoader(fDigInput->GetOutputFolderName());
   
   outputLoader->MakeDigitsContainer();
   
@@ -536,7 +548,7 @@ AliMUONDigitizerV3::Exec(Option_t*)
   
   for ( Int_t iFile = 0; iFile < nInputFiles; ++iFile )
   {  
-    AliLoader* inputLoader = GetLoader(fManager->GetInputFolderName(iFile));
+    AliLoader* inputLoader = GetLoader(fDigInput->GetInputFolderName(iFile));
 
     inputLoader->LoadSDigits("READ");
 
@@ -557,7 +569,7 @@ AliMUONDigitizerV3::Exec(Option_t*)
     
     iTreeS->GetEvent(0);
 
-    MergeWithSDigits(fDigitStore,*dstore,fManager->GetMask(iFile));
+    MergeWithSDigits(fDigitStore,*dstore,fDigInput->GetMask(iFile));
 
     inputLoader->UnloadSDigits();
     
@@ -845,7 +857,7 @@ AliMUONDigitizerV3::GetLoader(const TString& folderName)
 Bool_t
 AliMUONDigitizerV3::Init()
 {
-  /// Initialization of the TTask :
+  /// Initialization of the digitization :
   /// a) create the calibrationData, according to run number
   /// b) create the trigger processing task
 
@@ -857,9 +869,9 @@ AliMUONDigitizerV3::Init()
     return kFALSE;
   }
   
-  if (!fManager)
+  if (!fDigInput)
   {
-    AliError("fManager is null !");
+    AliError("fDigInput is null !");
     return kFALSE;
   }