// -1 + B + exp(-B)
//
+#include <TMath.h>
#include <TTree.h> // ROOT_TTree
//#include <TRandom.h> // ROOT_TRandom
-#include <AliLog.h> // ALILOG_H
+// #include <AliLog.h> // ALILOG_H
+#include "AliFMDDebug.h" // Better debug macros
#include "AliFMDBaseDigitizer.h" // ALIFMDDIGITIZER_H
#include "AliFMD.h" // ALIFMD_H
#include "AliFMDGeometry.h" // ALIFMDGEOMETRY_H
#include "AliFMDDetector.h" // ALIFMDDETECTOR_H
#include "AliFMDRing.h" // ALIFMDRING_H
#include "AliFMDHit.h" // ALIFMDHIT_H
-#include "AliFMDDigit.h" // ALIFMDDIGIT_H
+// #include "AliFMDDigit.h" // ALIFMDDIGIT_H
#include "AliFMDParameters.h" // ALIFMDPARAMETERS_H
-#include <AliRunDigitizer.h> // ALIRUNDIGITIZER_H
+// #include <AliRunDigitizer.h> // ALIRUNDIGITIZER_H
//#include <AliRun.h> // ALIRUN_H
#include <AliLoader.h> // ALILOADER_H
#include <AliRunLoader.h> // ALIRUNLOADER_H
//____________________________________________________________________
AliFMDBaseDigitizer::AliFMDBaseDigitizer()
- : fRunLoader(0)
+ : fRunLoader(0),
+ fEdep(AliFMDMap::kMaxDetectors,
+ AliFMDMap::kMaxRings,
+ AliFMDMap::kMaxSectors,
+ AliFMDMap::kMaxStrips),
+ fShapingTime(0)
{
// Default ctor - don't use it
}
fEdep(AliFMDMap::kMaxDetectors,
AliFMDMap::kMaxRings,
AliFMDMap::kMaxSectors,
- AliFMDMap::kMaxStrips)
+ AliFMDMap::kMaxStrips),
+ fShapingTime(0)
{
// Normal CTOR
- AliDebug(1," processed");
+ AliFMDDebug(1, (" processed"));
SetShapingTime();
}
AliFMDMap::kMaxStrips)
{
// Normal CTOR
- AliDebug(1," processed");
+ AliFMDDebug(1, (" processed"));
SetShapingTime();
}
UShort_t sector = fmdHit->Sector();
UShort_t strip = fmdHit->Strip();
Float_t edep = fmdHit->Edep();
- UShort_t minstrip = param->GetMinStrip(detector, ring, sector, strip);
- UShort_t maxstrip = param->GetMaxStrip(detector, ring, sector, strip);
+ // UShort_t minstrip = param->GetMinStrip(detector, ring, sector, strip);
+ // UShort_t maxstrip = param->GetMaxStrip(detector, ring, sector, strip);
// Check if strip is `dead'
+ AliFMDDebug(2, ("Hit in FMD%d%c[%2d,%3d]=%f",
+ detector, ring, sector, strip, edep));
if (param->IsDead(detector, ring, sector, strip)) {
- AliDebug(5, Form("FMD%d%c[%2d,%3d] is marked as dead",
+ AliFMDDebug(1, ("FMD%d%c[%2d,%3d] is marked as dead",
detector, ring, sector, strip));
continue;
}
// Check if strip is out-side read-out range
- if (strip < minstrip || strip > maxstrip) {
- AliDebug(5, Form("FMD%d%c[%2d,%3d] is outside range [%3d,%3d]",
- detector, ring, sector, strip, minstrip, maxstrip));
- continue;
- }
+ // if (strip < minstrip || strip > maxstrip) {
+ // AliFMDDebug(5, ("FMD%d%c[%2d,%3d] is outside range [%3d,%3d]",
+ // detector,ring,sector,strip,minstrip,maxstrip));
+ // continue;
+ // }
// Give warning in case of double hit
if (fEdep(detector, ring, sector, strip).fEdep != 0)
- AliDebug(5, Form("Double hit in %d%c(%d,%d)",
+ AliFMDDebug(5, ("Double hit in %d%c(%d,%d)",
detector, ring, sector, strip));
// Sum energy deposition
// Add this to the energy deposited for this strip
} // hit loop
} // track loop
- AliDebug(1, Form("Size of cache: %d bytes, read %d bytes",
+ AliFMDDebug(1, ("Size of cache: %d bytes, read %d bytes",
sizeof(fEdep), read));
}
TArrayI counts(3);
for (UShort_t detector=1; detector <= 3; detector++) {
+ AliFMDDebug(5, ("Processing hits in FMD%d", detector));
// Get pointer to subdetector
AliFMDDetector* det = geometry->GetDetector(detector);
if (!det) continue;
for (UShort_t ringi = 0; ringi <= 1; ringi++) {
Char_t ring = ringi == 0 ? 'I' : 'O';
+ AliFMDDebug(5, (" Processing hits in FMD%d%c", detector,ring));
// Get pointer to Ring
AliFMDRing* r = det->GetRing(ring);
if (!r) continue;
UShort_t nSectors = UShort_t(360. / r->GetTheta());
// Loop over the number of sectors
for (UShort_t sector = 0; sector < nSectors; sector++) {
+ AliFMDDebug(5, (" Processing hits in FMD%d%c[%2d]",
+ detector,ring,sector));
// Get number of strips
UShort_t nStrips = r->GetNStrips();
// Loop over the stips
AddDigit(fmd, detector, ring, sector, strip, edep,
UShort_t(counts[0]), Short_t(counts[1]),
Short_t(counts[2]));
+ AliFMDDebug(10, (" Adding digit in FMD%d%c[%2d,%3d]=%d",
+ detector,ring,sector,strip,counts[0]));
#if 0
// This checks if the digit created will give the `right'
// number of particles when reconstructed, using a naiive
// = E + (l - E) * ext(-B * t)
//
AliFMDParameters* param = AliFMDParameters::Instance();
- Float_t convF = 1/param->GetPulseGain(detector,ring,sector,strip);
- UShort_t ped = MakePedestal(detector,ring,sector,strip);
- UInt_t maxAdc = param->GetAltroChannelSize();
+ Float_t convF = 1./param->GetPulseGain(detector,ring,sector,strip);
+ Int_t ped = MakePedestal(detector,ring,sector,strip);
+ Int_t maxAdc = param->GetAltroChannelSize()-1;
+ if (maxAdc < 0) {
+ AliWarning(Form("Maximum ADC is %d < 0, forcing it to 1023", maxAdc));
+ maxAdc = 1023;
+ }
UShort_t rate = param->GetSampleRate(detector,ring,sector,strip);
- UShort_t size = param->GetAltroChannelSize();
+ if (rate < 1 || rate > 3) rate = 1;
// In case we don't oversample, just return the end value.
if (rate == 1) {
- counts[0] = UShort_t(TMath::Min(edep * convF + ped, Float_t(maxAdc)));
- AliDebug(2, Form("FMD%d%c[%2d,%3d]: converting ELoss %f to ADC %d (%f)",
- detector,ring,sector,strip,edep,counts[0],convF));
+ Float_t a = edep * convF + ped;
+ if (a < 0) a = 0;
+ counts[0] = UShort_t(TMath::Min(a, Float_t(maxAdc)));
+ AliFMDDebug(2, ("FMD%d%c[%2d,%3d]: converting ELoss %f to "
+ "ADC %4d (%f,%d)",
+ detector,ring,sector,strip,edep,counts[0],convF,ped));
return;
}
// Create a pedestal
Float_t b = fShapingTime;
for (Ssiz_t i = 0; i < rate; i++) {
- Float_t t = Float_t(i) / rate;
- Float_t s = edep + (last - edep) * TMath::Exp(-b * t);
- counts[i] = UShort_t(TMath::Min(s * convF + ped, Float_t(maxAdc)));
+ Float_t t = Float_t(i) / rate;
+ Float_t s = edep + (last - edep) * TMath::Exp(-b * t);
+ Float_t a = Int_t(s * convF + ped);
+ if (a < 0) a = 0;
+ counts[i] = UShort_t(TMath::Min(a, Float_t(maxAdc)));
}
}