]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONDigitizerV3.cxx
Clean-up of include files
[u/mrichter/AliRoot.git] / MUON / AliMUONDigitizerV3.cxx
index 548212871cd66d76694ba10138c7a594a84aa89f..bd7d91be4ccb0bd8d124781484ca2253e2b301fd 100644 (file)
@@ -44,6 +44,7 @@
 #include "AliLog.h"
 #include "AliRun.h"
 #include "AliRunDigitizer.h"
+#include "AliLoader.h"
 #include "AliRunLoader.h"
 
 #include <Riostream.h>
@@ -53,6 +54,7 @@
 #include <TRandom.h>
 #include <TString.h>
 #include <TSystem.h>
+#include <TTree.h>
 
 //-----------------------------------------------------------------------------
 /// \class AliMUONDigitizerV3
@@ -144,7 +146,7 @@ AliMUONDigitizerV3::ApplyResponseToTrackerDigit(AliMUONVDigit& digit, Bool_t add
   /// - add some electronics noise (thus leading to a realistic adc), if requested to do so
   /// - sets the signal to zero if below 3*sigma of the noise
 
-  Float_t charge = digit.Charge();
+  Float_t charge = digit.IsChargeInFC() ? digit.Charge()*AliMUONConstants::FC2ADC() : digit.Charge();
   
   // We set the charge to 0, as the only relevant piece of information
   // after Digitization is the ADC value.  
@@ -210,7 +212,9 @@ AliMUONDigitizerV3::ApplyResponse(const AliMUONVDigitStore& store,
     
     if ( stationType != AliMp::kStationTrigger )
     {
-      ApplyResponseToTrackerDigit(*digit,kAddNoise);
+      Bool_t addNoise = kAddNoise;
+      if (digit->IsConverted()) addNoise = kFALSE; // No need to add extra noise to a converted real digit
+      ApplyResponseToTrackerDigit(*digit,addNoise);
     }
 
     if ( digit->ADC() > 0  || digit->Charge() > 0 )
@@ -241,12 +245,13 @@ AliMUONDigitizerV3::DecalibrateTrackerDigit(const AliMUONVCalibParam& pedestals,
   Float_t pedestalSigma = pedestals.ValueAsFloat(channel,1);
   
   AliDebugClass(1,Form("DE %04d MANU %04d CH %02d PEDMEAN %7.2f PEDSIGMA %7.2f",
-                       pedestals.ID0(),pedestals.ID1(),channel,pedestalMean,pedestalSigma));
+                      pedestals.ID0(),pedestals.ID1(),channel,pedestalMean,pedestalSigma));
   
   Float_t a0 = gains.ValueAsFloat(channel,0);
   Float_t a1 = gains.ValueAsFloat(channel,1);
   Int_t thres = gains.ValueAsInt(channel,2);
   Int_t qual = gains.ValueAsInt(channel,3);
+
   if ( qual <= 0 ) return 0;
   
   Float_t chargeThres = a0*thres;
@@ -324,6 +329,19 @@ AliMUONDigitizerV3::DecalibrateTrackerDigit(const AliMUONVCalibParam& pedestals,
   
   if ( adc < TMath::Nint(pedestalMean + fgNSigmas*pedestalSigma + 0.5) ) 
   {
+    // 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));
+    }
+    
     adc = 0;
   }
   
@@ -409,7 +427,7 @@ AliMUONDigitizerV3::Exec(Option_t*)
   // files.
   
   for ( Int_t iFile = 0; iFile < nInputFiles; ++iFile )
-  {    
+  {  
     AliLoader* inputLoader = GetLoader(fManager->GetInputFolderName(iFile));
 
     inputLoader->LoadSDigits("READ");
@@ -437,6 +455,7 @@ AliMUONDigitizerV3::Exec(Option_t*)
     
     dstore->Clear();
   }
+
   
   // At this point, we do have digit arrays (one per chamber) which contains 
   // the merging of all the sdigits of the input file(s).
@@ -453,9 +472,8 @@ AliMUONDigitizerV3::Exec(Option_t*)
     // Generate noise-only digits for trigger.
     GenerateNoisyDigitsForTrigger(*fDigitStore);
   }
-
   ApplyResponse(*fDigitStore,*fOutputDigitStore);
-  
+
   if ( fGenerateNoisyDigits )
   {
     // Generate noise-only digits for tracker.