X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=FMD%2FAliFMDBaseDigitizer.cxx;h=1970eb348a35e2758d13ff83f6ccc712fcfd4441;hb=2691ce9cc4770afad101bec5dcff0317b931c46d;hp=3513dd540bc8ee3ba722d76b87ba48678c2e4b59;hpb=68aba90aa791d8a42ae9dfd095975f63a44915f3;p=u%2Fmrichter%2FAliRoot.git diff --git a/FMD/AliFMDBaseDigitizer.cxx b/FMD/AliFMDBaseDigitizer.cxx index 3513dd540bc..1970eb348a3 100644 --- a/FMD/AliFMDBaseDigitizer.cxx +++ b/FMD/AliFMDBaseDigitizer.cxx @@ -230,7 +230,8 @@ AliFMDBaseDigitizer::AliFMDBaseDigitizer() AliFMDMap::kMaxRings, AliFMDMap::kMaxSectors, AliFMDMap::kMaxStrips), - fShapingTime(6) + fShapingTime(6), + fStoreTrackRefs(kTRUE) { AliFMDDebug(1, ("Constructed")); // Default ctor - don't use it @@ -241,11 +242,9 @@ AliFMDBaseDigitizer::AliFMDBaseDigitizer(AliRunDigitizer* manager) : 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")); @@ -258,11 +257,9 @@ AliFMDBaseDigitizer::AliFMDBaseDigitizer(const Char_t* name, : 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")); @@ -309,11 +306,22 @@ AliFMDBaseDigitizer::AddContribution(UShort_t detector, 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", @@ -327,14 +335,34 @@ AliFMDBaseDigitizer::AddContribution(UShort_t detector, // 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))); + } //____________________________________________________________________ @@ -378,10 +406,18 @@ AliFMDBaseDigitizer::DigitizeHits() const // 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 @@ -401,9 +437,10 @@ AliFMDBaseDigitizer::DigitizeHits() const // 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 @@ -466,7 +503,8 @@ AliFMDBaseDigitizer::ConvertToCount(Float_t edep, // = E + (l - E) * ext(-B * t) // AliFMDParameters* param = AliFMDParameters::Instance(); - Float_t convF = param->GetDACPerMIP()*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) { @@ -475,7 +513,7 @@ AliFMDBaseDigitizer::ConvertToCount(Float_t edep, } 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)); @@ -492,6 +530,7 @@ AliFMDBaseDigitizer::ConvertToCount(Float_t edep, detector,ring,sector,strip,edep,counts[0],convF,ped)); return; } + // Create a pedestal Float_t b = fShapingTime; @@ -502,24 +541,33 @@ AliFMDBaseDigitizer::ConvertToCount(Float_t edep, 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); } //____________________________________________________________________