#include "AliMUONDigitizerV3.h"
-#include "AliLog.h"
#include "AliMUON.h"
#include "AliMUONCalibrationData.h"
#include "AliMUONConstants.h"
#include "AliMUONDataIterator.h"
#include "AliMUONDigit.h"
#include "AliMUONSegmentation.h"
-#include "AliMUONTriggerDecisionV1.h"
#include "AliMUONTriggerEfficiencyCells.h"
#include "AliMUONTriggerElectronics.h"
#include "AliMUONVCalibParam.h"
+
#include "AliMpDEIterator.h"
#include "AliMpDEManager.h"
#include "AliMpIntPair.h"
#include "AliMpPad.h"
#include "AliMpStationType.h"
+#include "AliMpSegmentation.h"
#include "AliMpVSegmentation.h"
+#include "AliMpDEManager.h"
+
#include "AliRun.h"
#include "AliRunDigitizer.h"
#include "AliRunLoader.h"
+#include "AliLog.h"
+
#include "Riostream.h"
#include "TF1.h"
#include "TRandom.h"
#include "TString.h"
///
+/// \class AliMUONDigitizerV3
/// The digitizer is performing the transformation to go from SDigits (digits
/// w/o any electronic noise) to Digits (w/ electronic noise, and decalibration)
///
{
return static_cast<AliMUON*>(gAlice->GetModule("MUON"));
}
-
- AliMUONSegmentation* Segmentation()
- {
- static AliMUONSegmentation* segmentation = muon()->GetSegmentation();
- return segmentation;
- }
}
const Double_t AliMUONDigitizerV3::fgkNSigmas=3;
+/// \cond CLASSIMP
ClassImp(AliMUONDigitizerV3)
+/// \endcond
//_____________________________________________________________________________
AliMUONDigitizerV3::AliMUONDigitizerV3(AliRunDigitizer* manager,
- ETriggerCodeVersion triggerCodeVersion,
- Bool_t useTriggerEfficiency,
Bool_t generateNoisyDigits)
: AliDigitizer(manager),
fIsInitialized(kFALSE),
fOutputData(0x0),
fCalibrationData(0x0),
fTriggerProcessor(0x0),
-fTriggerCodeVersion(triggerCodeVersion),
-fUseTriggerEfficiency(useTriggerEfficiency),
fTriggerEfficiency(0x0),
+fFindDigitIndexTimer(),
+fGenerateNoisyDigitsTimer(),
+fExecTimer(),
fNoiseFunction(0x0),
fGenerateNoisyDigits(generateNoisyDigits)
{
- //
- // Ctor.
- //
+ /// Ctor.
+
AliDebug(1,Form("AliRunDigitizer=%p",fManager));
fGenerateNoisyDigitsTimer.Start(kTRUE); fGenerateNoisyDigitsTimer.Stop();
fExecTimer.Start(kTRUE); fExecTimer.Stop();
fFindDigitIndexTimer.Start(kTRUE); fFindDigitIndexTimer.Stop();
}
-//______________________________________________________________________________
-AliMUONDigitizerV3::AliMUONDigitizerV3(const AliMUONDigitizerV3& right)
- : AliDigitizer(right)
-{
-/// Protected copy constructor (not implemented)
-
- AliFatal("Copy constructor not provided.");
-}
-
//_____________________________________________________________________________
AliMUONDigitizerV3::~AliMUONDigitizerV3()
{
- //
- // Dtor. Note we're the owner of some pointers.
- //
+ /// Dtor. Note we're the owner of some pointers.
+
AliDebug(1,"dtor");
delete fOutputData;
delete fTriggerProcessor;
delete fNoiseFunction;
- AliInfo(Form("Execution time for FindDigitIndex() : R:%.2fs C:%.2fs",
+ AliDebug(1, Form("Execution time for FindDigitIndex() : R:%.2fs C:%.2fs",
fFindDigitIndexTimer.RealTime(),fFindDigitIndexTimer.CpuTime()));
if ( fGenerateNoisyDigits )
{
- AliInfo(Form("Execution time for GenerateNoisyDigits() : R:%.2fs C:%.2fs",
+ AliDebug(1, Form("Execution time for GenerateNoisyDigits() : R:%.2fs C:%.2fs",
fGenerateNoisyDigitsTimer.RealTime(),
fGenerateNoisyDigitsTimer.CpuTime()));
}
- AliInfo(Form("Execution time for Exec() : R:%.2fs C:%.2fs",
+ AliDebug(1, Form("Execution time for Exec() : R:%.2fs C:%.2fs",
fExecTimer.RealTime(),fExecTimer.CpuTime()));
}
-//______________________________________________________________________________
-AliMUONDigitizerV3&
-AliMUONDigitizerV3::operator=(const AliMUONDigitizerV3& right)
-{
-/// Protected assignement operator (not implemented)
-
- // check assignement to self
- if (this == &right) return *this;
-
- AliFatal("Assignement operator not provided.");
-
- return *this;
-}
-
//_____________________________________________________________________________
void
AliMUONDigitizerV3::ApplyResponseToTrackerDigit(AliMUONDigit& digit, Bool_t addNoise)
{
- // For tracking digits, starting from an ideal digit's charge, we :
- //
- // - add some noise (thus leading to a realistic charge), if requested to do so
- // - divide by a gain (thus decalibrating the digit)
- // - add a pedestal (thus decalibrating the digit)
- // - sets the signal to zero if below 3*sigma of the noise
- //
+ /// For tracking digits, starting from an ideal digit's charge, we :
+ ///
+ /// - add some noise (thus leading to a realistic charge), if requested to do so
+ /// - divide by a gain (thus decalibrating the digit)
+ /// - add a pedestal (thus decalibrating the digit)
+ /// - sets the signal to zero if below 3*sigma of the noise
static const Int_t kMaxADC = (1<<12)-1; // We code the charge on a 12 bits ADC.
AliMUONDigitizerV3::ApplyResponseToTriggerDigit(AliMUONDigit& digit,
AliMUONData* data)
{
+ /// \todo add comment
+
if ( !fTriggerEfficiency ) return;
AliMUONDigit* correspondingDigit = FindCorrespondingDigit(digit,data);
+ if(!correspondingDigit)return;//reject bad correspondences
+
Int_t detElemId = digit.DetElemId();
-
+
+ AliMpSegmentation* segmentation = AliMpSegmentation::Instance();
const AliMpVSegmentation* segment[2] =
{
- Segmentation()->GetMpSegmentation(detElemId,digit.Cathode()),
- Segmentation()->GetMpSegmentation(detElemId,correspondingDigit->Cathode())
+ segmentation->GetMpSegmentation(detElemId,digit.Cathode()),
+ segmentation->GetMpSegmentation(detElemId,correspondingDigit->Cathode())
};
AliMpPad pad[2] =
void
AliMUONDigitizerV3::ApplyResponse()
{
- //
- // Loop over all chamber digits, and apply the response to them
- // Note that this method may remove digits.
- //
+ /// Loop over all chamber digits, and apply the response to them
+ /// Note that this method may remove digits.
+
const Bool_t kAddNoise = kTRUE;
for ( Int_t ich = 0; ich < AliMUONConstants::NCh(); ++ich )
AliMUONDigitizerV3::AddOrUpdateDigit(TClonesArray& array,
const AliMUONDigit& digit)
{
- //
- // Add or update a digit, depending on whether there's already a digit
- // for the corresponding channel.
- //
+ /// Add or update a digit, depending on whether there's already a digit
+ /// for the corresponding channel.
+
Int_t ix = FindDigitIndex(array,digit);
if (ix>=0)
void
AliMUONDigitizerV3::Exec(Option_t*)
{
- //
- // Main method.
- // We first loop over input files, and merge the sdigits we found there.
- // Second, we digitize all the resulting sdigits
- // Then we generate noise-only digits (for tracker only)
- // And we finally generate the trigger outputs.
- //
+ /// Main method.
+ /// We first loop over input files, and merge the sdigits we found there.
+ /// Second, we digitize all the resulting sdigits
+ /// Then we generate noise-only digits (for tracker only)
+ /// And we finally generate the trigger outputs.
AliDebug(1, "Running digitizer.");
//_____________________________________________________________________________
AliMUONDigit*
AliMUONDigitizerV3::FindCorrespondingDigit(AliMUONDigit& digit,
- AliMUONData* data)
+ AliMUONData* data) const
{
- AliMUONDataIterator it(data,"D",AliMUONDataIterator::kAllChambers);
+ /// \todo add comment
+
+ AliMUONDataIterator it(data,"D",AliMUONDataIterator::kTriggerChambers);
AliMUONDigit* cd;
+
+ for(;;){
+ cd = static_cast<AliMUONDigit*>(it.Next());
+ if(!cd)continue;
+ if (cd->DetElemId() == digit.DetElemId() &&
+ cd->PadX() == digit.PadX() &&
+ cd->PadY() == digit.PadY() &&
+ cd->Cathode() == digit.Cathode()){
+ break;
+ }
+ }
+ //The corresponding digit is searched only forward in the AliMUONData.
+ //In this way when the first digit of the couple is given, the second digit is found and the efficiency is applied to both.
+ //Afterwards, when the second digit of the couple is given the first one is not found and hence efficiency is not applied again
while ( ( cd = static_cast<AliMUONDigit*>(it.Next()) ) )
{
+ if(!cd)continue;//avoid problems when 1 digit is removed
if ( cd->DetElemId() == digit.DetElemId() &&
cd->Hit() == digit.Hit() &&
cd->Cathode() != digit.Cathode() )
AliMUONDigitizerV3::FindDigitIndex(TClonesArray& array,
const AliMUONDigit& digit) const
{
- //
- // Return the index of digit within array, if that digit is there,
- // otherwise returns -1
- //
- // FIXME: this is of course not the best implementation you can think of.
- // Reconsider the use of hit/digit map... ? (but be sure it's needed!)
- //
+ /// Return the index of digit within array, if that digit is there,
+ /// otherwise returns -1
+ ///
+ /// \todo FIXME: this is of course not the best implementation you can think of.
+ /// Reconsider the use of hit/digit map... ? (but be sure it's needed!)
fFindDigitIndexTimer.Start(kFALSE);
void
AliMUONDigitizerV3::GenerateNoisyDigits()
{
- //
- // According to a given probability, generate digits that
- // have a signal above the noise cut (ped+n*sigma_ped), i.e. digits
- // that are "only noise".
- //
+ /// According to a given probability, generate digits that
+ /// have a signal above the noise cut (ped+n*sigma_ped), i.e. digits
+ /// that are "only noise".
if ( !fNoiseFunction )
{
void
AliMUONDigitizerV3::GenerateNoisyDigitsForOneCathode(Int_t detElemId, Int_t cathode)
{
- //
- // Generate noise-only digits for one cathode of one detection element.
- // Called by GenerateNoisyDigits()
- //
+ /// Generate noise-only digits for one cathode of one detection element.
+ /// Called by GenerateNoisyDigits()
- TClonesArray* digits = fOutputData->Digits(detElemId/100-1);
+ Int_t chamberId = AliMpDEManager::GetChamberId(detElemId);
+ TClonesArray* digits = fOutputData->Digits(chamberId);
- const AliMpVSegmentation* seg = Segmentation()->GetMpSegmentation(detElemId,cathode);
+ const AliMpVSegmentation* seg
+ = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,cathode);
Int_t nofPads = seg->NofPads();
Int_t maxIx = seg->MaxPadIndexX();
Int_t maxIy = seg->MaxPadIndexY();
- static const Double_t probToBeOutsideNsigmas = 1 - TMath::Erf(fgkNSigmas/TMath::Sqrt(2.0));
+ static const Double_t kProbToBeOutsideNsigmas = TMath::Erfc(fgkNSigmas/TMath::Sqrt(2.0)) / 2. ;
- Int_t nofNoisyPads = TMath::Nint(probToBeOutsideNsigmas*nofPads);
+ Int_t nofNoisyPads = TMath::Nint(kProbToBeOutsideNsigmas*nofPads);
if ( !nofNoisyPads ) return;
nofNoisyPads =
AliMUONData*
AliMUONDigitizerV3::GetDataAccess(const TString& folderName)
{
- //
- // Create an AliMUONData to deal with data found in folderName.
- //
+ /// Create an AliMUONData to deal with data found in folderName.
+
AliDebug(1,Form("Getting access to folder %s",folderName.Data()));
AliRunLoader* runLoader = AliRunLoader::GetRunLoader(folderName);
if (!runLoader)
Bool_t
AliMUONDigitizerV3::Init()
{
- //
- // Initialization of the TTask :
- // a) set the outputData pointer
- // b) create the calibrationData, according to run number
- // c) create the trigger processing task
- //
+ /// Initialization of the TTask :
+ /// a) set the outputData pointer
+ /// b) create the calibrationData, according to run number
+ /// c) create the trigger processing task
+
AliDebug(1,"");
if ( fIsInitialized )
fCalibrationData = new AliMUONCalibrationData(runnumber);
- switch (fTriggerCodeVersion)
- {
- case kTriggerDecision:
- fTriggerProcessor = new AliMUONTriggerDecisionV1(fOutputData);
- break;
- case kTriggerElectronics:
- fTriggerProcessor = new AliMUONTriggerElectronics(fOutputData,fCalibrationData);
- break;
- default:
- AliFatal("Unknown trigger processor type");
- break;
- }
- AliDebug(1,Form("Using the following trigger code %s - %s",
- fTriggerProcessor->GetName(),fTriggerProcessor->GetTitle()));
+ fTriggerProcessor = new AliMUONTriggerElectronics(fOutputData,fCalibrationData);
- if ( fUseTriggerEfficiency )
+ if ( muon()->GetTriggerEffCells() )
{
fTriggerEfficiency = fCalibrationData->TriggerEfficiency();
if ( fTriggerEfficiency )
{
- AliInfo("Will apply trigger efficiency");
+ AliDebug(1, "Will apply trigger efficiency");
}
else
{
if ( fGenerateNoisyDigits )
{
- AliInfo("Will generate noise-only digits for tracker");
+ AliDebug(1, "Will generate noise-only digits for tracker");
}
fIsInitialized = kTRUE;
AliMUONDigitizerV3::MergeDigits(const AliMUONDigit& src,
AliMUONDigit& srcAndDest)
{
- //
- // Merge 2 digits (src and srcAndDest) into srcAndDest.
- //
+ /// Merge 2 digits (src and srcAndDest) into srcAndDest.
+
AliDebug(1,"Merging the following digits:");
StdoutToAliDebug(1,src.Print("tracks"););
StdoutToAliDebug(1,srcAndDest.Print("tracks"););
AliMUONDigitizerV3::MergeWithSDigits(AliMUONData& outputData,
const AliMUONData& inputData, Int_t mask)
{
- //
- // Merge the sdigits in inputData with the digits already present in outputData
- //
+ /// Merge the sdigits in inputData with the digits already present in outputData
+
AliDebug(1,"");
for ( Int_t ich = 0; ich < AliMUONConstants::NCh(); ++ich )
// Then add or update the digit to the output.
AddOrUpdateDigit(*oDigits,*sdigit);
}
- }
+ }
}
}