#include "AliFMDHit.h" // ALIFMDHIT_H
// #include "AliFMDDigit.h" // ALIFMDDIGIT_H
#include "AliFMDParameters.h" // ALIFMDPARAMETERS_H
-// #include <AliRunDigitizer.h> // ALIRUNDIGITIZER_H
+// #include <AliDigitizationInput.h> // ALIRUNDIGITIZER_H
//#include <AliRun.h> // ALIRUN_H
#include <AliLoader.h> // ALILOADER_H
#include <AliRun.h> // ALILOADER_H
AliFMDMap::kMaxRings,
AliFMDMap::kMaxSectors,
AliFMDMap::kMaxStrips),
- fShapingTime(6)
+ fShapingTime(6),
+ fStoreTrackRefs(kTRUE),
+ fIgnoredLabels(0)
{
AliFMDDebug(1, ("Constructed"));
// Default ctor - don't use it
}
//____________________________________________________________________
-AliFMDBaseDigitizer::AliFMDBaseDigitizer(AliRunDigitizer* manager)
- : AliDigitizer(manager, "AliFMDBaseDigitizer", "FMD Digitizer base class"),
+AliFMDBaseDigitizer::AliFMDBaseDigitizer(AliDigitizationInput* digInput)
+ : AliDigitizer(digInput, "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),
+ fIgnoredLabels(0)
{
// 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),
+ fIgnoredLabels(0)
{
// Normal CTOR
AliFMDDebug(1, (" Constructed"));
// Destructor
}
+//____________________________________________________________________
+AliFMDBaseDigitizer&
+AliFMDBaseDigitizer::operator=(const AliFMDBaseDigitizer& o)
+{
+ //
+ // Assignment operator
+ //
+ // Return:
+ // Reference to this object
+ //
+ if (&o == this) return *this;
+ AliDigitizer::operator=(o);
+ fRunLoader = o.fRunLoader;
+ fEdep = o.fEdep;
+ fShapingTime = o.fShapingTime;
+ fStoreTrackRefs = o.fStoreTrackRefs;
+ fIgnoredLabels = o.fIgnoredLabels;
+ return *this;
+}
+
//____________________________________________________________________
Bool_t
AliFMDBaseDigitizer::Init()
UShort_t sector,
UShort_t strip,
Float_t edep,
- Bool_t isPrimary)
+ 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;
- if (isPrimary)
- fEdep(detector, ring, sector, strip).fNPrim += 1;
- AliFMDDebug(15, ("Adding contribution %f to FMD%d%c[%2d,%3d] (%f)",
+ 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,
- fEdep(detector, ring, sector, strip).fEdep));
+ entry.fEdep, (nTrack > 0 ? tracknos[0] : -1)));
}
// the digits array (AliFMD::fDigits)
//
AliFMDDebug(5, ("Will now digitize all the summed signals"));
+ fIgnoredLabels = 0;
AliFMDGeometry* geometry = AliFMDGeometry::Instance();
TArrayI counts(4);
// VA1_ALICE channel.
if (strip % 128 == 0) last = 0;
- Float_t edep = fEdep(detector, ring, sector, strip).fEdep;
- UShort_t ntot = fEdep(detector, ring, sector, strip).fN;
- UShort_t nprim = fEdep(detector, ring, sector, strip).fNPrim;
+ 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));
AddDigit(detector, ring, sector, strip, edep,
UShort_t(counts[0]), Short_t(counts[1]),
Short_t(counts[2]), Short_t(counts[3]),
- ntot, nprim);
+ 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
} // Sector
} // Ring
} // Detector
+ if (fIgnoredLabels > 0)
+ AliWarning(Form("%d track labels could not be associated with digits "
+ "due to limited storage facilities in AliDigit",
+ fIgnoredLabels));
}
//____________________________________________________________________
//____________________________________________________________________
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,
- UShort_t /* ntot */,
- UShort_t /* nprim */) 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);
+ if (fStoreTrackRefs && ntot > 3) fIgnoredLabels += ntot - 3;
}
//____________________________________________________________________
//____________________________________________________________________
void
-AliFMDBaseDigitizer::StoreDigits(AliLoader* loader)
+AliFMDBaseDigitizer::StoreDigits(const AliLoader* loader)
{
// Write the digits to disk
AliFMDDebug(5, ("Storing %d digits", fFMD->Digits()->GetEntries()));