AliFMDMap::kMaxRings,
AliFMDMap::kMaxSectors,
AliFMDMap::kMaxStrips),
- fShapingTime(6)
+ fShapingTime(6),
+ fStoreTrackRefs(kTRUE)
{
AliFMDDebug(1, ("Constructed"));
// Default ctor - don't use it
: AliDigitizer(manager, "AliFMDBaseDigitizer", "FMD Digitizer base class"),
fFMD(0),
fRunLoader(0),
- fEdep(AliFMDMap::kMaxDetectors,
- AliFMDMap::kMaxRings,
- AliFMDMap::kMaxSectors,
- AliFMDMap::kMaxStrips),
- fShapingTime(6)
+ fEdep(0), // nDet==0 means 51200 slots
+ fShapingTime(6),
+ fStoreTrackRefs(kTRUE)
{
// Normal CTOR
AliFMDDebug(1, ("Constructed"));
: AliDigitizer(name, title),
fFMD(0),
fRunLoader(0),
- fEdep(AliFMDMap::kMaxDetectors,
- AliFMDMap::kMaxRings,
- AliFMDMap::kMaxSectors,
- AliFMDMap::kMaxStrips),
- fShapingTime(6)
+ fEdep(0), // nDet==0 means 51200 slots
+ fShapingTime(6),
+ fStoreTrackRefs(kTRUE)
{
// Normal CTOR
AliFMDDebug(1, (" Constructed"));
Char_t ring,
UShort_t sector,
UShort_t strip,
- Float_t edep)
+ Float_t edep,
+ Bool_t isPrimary,
+ Int_t nTrack,
+ Int_t* tracknos)
{
// Add edep contribution from (detector,ring,sector,strip) to cache
AliFMDParameters* param = AliFMDParameters::Instance();
-
+ AliFMDDebug(10, ("Adding contribution %7.5f for FMD%d%c[%2d,%3d] "
+ " from %d tracks (%s)",
+ edep,
+ detector,
+ ring,
+ sector,
+ strip,
+ nTrack,
+ (isPrimary ? "primary" : "secondary")));
// Check if strip is `dead'
if (param->IsDead(detector, ring, sector, strip)) {
AliFMDDebug(5, ("FMD%d%c[%2d,%3d] is marked as dead",
// continue;
// }
+ AliFMDEdepHitPair& entry = fEdep(detector, ring, sector, strip);
+
// Give warning in case of double sdigit
- if (fEdep(detector, ring, sector, strip).fEdep != 0)
- AliFMDDebug(5, ("Double digit in %d%c(%d,%d)",
+ if (entry.fEdep != 0)
+ AliFMDDebug(5, ("Double digit in FMD%d%c[%2d,%3d]",
detector, ring, sector, strip));
// Sum energy deposition
- fEdep(detector, ring, sector, strip).fEdep += edep;
- fEdep(detector, ring, sector, strip).fN += 1;
+ Int_t oldN = entry.fN;
+ entry.fEdep += edep;
+ entry.fN += nTrack;
+ if (isPrimary) entry.fNPrim += nTrack;
+ if (fStoreTrackRefs) {
+ if (entry.fLabels.fN < entry.fN) {
+ AliFMDDebug(15, ("== New label array size %d, was %d, added %d",
+ entry.fN, entry.fLabels.fN, nTrack));
+ entry.fLabels.Set(entry.fN);
+ }
+ for (Int_t i = 0; i < nTrack; i++) {
+ AliFMDDebug(15, ("=> Setting track label # %d", oldN+i));
+ entry.fLabels[oldN + i] = tracknos[i];
+ AliFMDDebug(15, ("<= Setting track label # %d", oldN+i));
+ }
+ }
+ AliFMDDebug(15,("Adding contribution %f to FMD%d%c[%2d,%3d] (%f) track %d",
+ edep, detector, ring, sector, strip,
+ entry.fEdep, (nTrack > 0 ? tracknos[0] : -1)));
+
}
//____________________________________________________________________
// VA1_ALICE channel.
if (strip % 128 == 0) last = 0;
- Float_t edep = fEdep(detector, ring, sector, strip).fEdep;
+ const AliFMDEdepHitPair& entry = fEdep(detector,ring,sector,strip);
+ Float_t edep = entry.fEdep;
+ UShort_t ntot = entry.fN;
+ UShort_t nprim = entry.fNPrim;
+ const TArrayI& labels = entry.fLabels;
+ if (edep > 0)
+ AliFMDDebug(15, ("Edep = %f for FMD%d%c[%2d,%3d]",
+ edep, detector, ring, sector, strip));
ConvertToCount(edep, last, detector, ring, sector, strip, counts);
last = edep;
+
// The following line was introduced - wrongly - by Peter
// Hristov. It _will_ break the digitisation and the
// following reconstruction. The behviour of the
// if (edep<=0) continue;
AddDigit(detector, ring, sector, strip, edep,
UShort_t(counts[0]), Short_t(counts[1]),
- Short_t(counts[2]), Short_t(counts[3]));
+ Short_t(counts[2]), Short_t(counts[3]),
+ ntot, nprim, labels);
AliFMDDebug(15, (" Adding digit in FMD%d%c[%2d,%3d]=%d",
- detector,ring,sector,strip,counts[0]));
+ 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);
+ Float_t convF = (param->GetDACPerMIP() / param->GetEdepMip() *
+ param->GetPulseGain(detector,ring,sector,strip));
Int_t ped = MakePedestal(detector,ring,sector,strip);
Int_t maxAdc = param->GetAltroChannelSize()-1;
if (maxAdc < 0) {
}
UShort_t rate = param->GetSampleRate(detector,ring,sector,strip);
AliFMDDebug(15, ("Sample rate for FMD%d%c[%2d,%3d] = %d",
- detector, ring, sector, strip, rate));
+ detector, ring, sector, strip, rate));
if (rate < 1 || rate > 4) {
AliWarning(Form("Invalid sample rate for for FMD%d%c[%2d,%3d] = %d",
detector, ring, sector, strip, rate));
detector,ring,sector,strip,edep,counts[0],convF,ped));
return;
}
+
// Create a pedestal
Float_t b = fShapingTime;
if (a < 0) a = 0;
counts[i] = UShort_t(TMath::Min(a, Float_t(maxAdc)));
}
+ AliFMDDebug(15, ("Converted edep = %f to ADC (%x,%x,%x,%x) "
+ "[gain: %f=(%f/%f*%f), pedestal: %d, rate: %d]",
+ edep, counts[0], counts[1], counts[2], counts[3],
+ convF, param->GetDACPerMIP(),param->GetEdepMip(),
+ param->GetPulseGain(detector,ring,sector,strip),
+ ped, rate));
}
//____________________________________________________________________
void
-AliFMDBaseDigitizer::AddDigit(UShort_t detector,
- Char_t ring,
- UShort_t sector,
- UShort_t strip,
- Float_t /* edep */,
- UShort_t count1,
- Short_t count2,
- Short_t count3,
- Short_t count4) const
+AliFMDBaseDigitizer::AddDigit(UShort_t detector,
+ Char_t ring,
+ UShort_t sector,
+ UShort_t strip,
+ Float_t /* edep */,
+ UShort_t count1,
+ Short_t count2,
+ Short_t count3,
+ Short_t count4,
+ UShort_t ntot,
+ UShort_t /* nprim */,
+ const TArrayI& refs) const
{
// Add a digit or summable digit
-
fFMD->AddDigitByFields(detector, ring, sector, strip,
- count1, count2, count3, count4);
+ count1, count2, count3, count4,
+ ntot, fStoreTrackRefs ? refs.fArray : 0);
}
//____________________________________________________________________