From 68aba90aa791d8a42ae9dfd095975f63a44915f3 Mon Sep 17 00:00:00 2001 From: hdalsgaa Date: Mon, 8 Sep 2008 15:44:21 +0000 Subject: [PATCH] Bug fixes and preparation for physics reconstruction --- FMD/AliFMDBaseDigitizer.cxx | 2 +- FMD/AliFMDParameters.cxx | 13 +++++++--- FMD/AliFMDParameters.h | 2 ++ FMD/AliFMDReconstructor.cxx | 46 +++++++++++++++++++++++++++-------- FMD/scripts/MakeCalibration.C | 2 +- 5 files changed, 50 insertions(+), 15 deletions(-) diff --git a/FMD/AliFMDBaseDigitizer.cxx b/FMD/AliFMDBaseDigitizer.cxx index 06fec4496bd..3513dd540bc 100644 --- a/FMD/AliFMDBaseDigitizer.cxx +++ b/FMD/AliFMDBaseDigitizer.cxx @@ -466,7 +466,7 @@ AliFMDBaseDigitizer::ConvertToCount(Float_t edep, // = 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->GetPulseGain(detector,ring,sector,strip); Int_t ped = MakePedestal(detector,ring,sector,strip); Int_t maxAdc = param->GetAltroChannelSize()-1; if (maxAdc < 0) { diff --git a/FMD/AliFMDParameters.cxx b/FMD/AliFMDParameters.cxx index 5694f654f7e..6911a62eb65 100644 --- a/FMD/AliFMDParameters.cxx +++ b/FMD/AliFMDParameters.cxx @@ -875,11 +875,18 @@ AliFMDParameters::GetEdepMip() const } return fEdepMip; } - - - +//____________________________________________________________________ +Float_t +AliFMDParameters::GetDACPerMIP() const +{ + //This is the conversion from the Digital-to-Analog-Converter setting + // to the number of MIPs. The number was measured in the NBI lab during + // August 2008. + return 29.67; +} + //____________________________________________________________________ // // EOF diff --git a/FMD/AliFMDParameters.h b/FMD/AliFMDParameters.h index 0cf5a5c0ff9..0a48809dafb 100644 --- a/FMD/AliFMDParameters.h +++ b/FMD/AliFMDParameters.h @@ -191,6 +191,8 @@ public: UShort_t GetChannelsPerAltro() const { return fChannelsPerAltro; } /** @return The average energy deposited by one MIP */ Float_t GetEdepMip() const; + /** @return The conversion factor from DAC to ADC */ + Float_t GetDACPerMIP() const; /** @return The factor used of signal acceptance */ Float_t GetPedestalFactor() const { return fPedestalFactor; } /** @param n Number of pre-samples to keep during zero-suppression - diff --git a/FMD/AliFMDReconstructor.cxx b/FMD/AliFMDReconstructor.cxx index bb1717fa1d9..6a6b1c11487 100644 --- a/FMD/AliFMDReconstructor.cxx +++ b/FMD/AliFMDReconstructor.cxx @@ -48,6 +48,8 @@ #include #include #include +#include + class AliRawReader; //____________________________________________________________________ @@ -68,7 +70,7 @@ AliFMDReconstructor::AliFMDReconstructor() fAngleCorrect(kTRUE), fVertexType(kNoVertex), fESD(0x0), - fDiagnostics(kFALSE), + fDiagnostics(kTRUE), fDiagStep1(0), fDiagStep2(0), fDiagStep3(0), @@ -313,14 +315,18 @@ AliFMDReconstructor::ProcessDigits(TClonesArray* digits) const // Substract pedestal. UShort_t counts = SubtractPedestal(digit); + if(counts == USHRT_MAX) continue; // Gain match digits. Double_t edep = Adc2Energy(digit, eta, counts); - + // Get rid of nonsense energy + if(edep < 0) continue; + // Make rough multiplicity Double_t mult = Energy2Multiplicity(digit, edep); - - AliFMDDebug(10, ("FMD%d%c[%2d,%3d]: " + // Get rid of nonsense mult + if(mult < 0) continue; + AliFMDDebug(5, ("FMD%d%c[%2d,%3d]: " "ADC: %d, Counts: %d, Energy: %f, Mult: %f", digit->Detector(), digit->Ring(), digit->Sector(), digit->Strip(), digit->Counts(), counts, edep, mult)); @@ -365,8 +371,14 @@ AliFMDReconstructor::SubtractPedestal(AliFMDDigit* digit) const digit->Ring(), digit->Sector(), digit->Strip()); - AliFMDDebug(15, ("Subtracting pedestal %f from signal %d", - ped, digit->Counts())); + if(ped < 0 || noise < 0) { + AliWarning(Form("Invalid pedestal (%f) or noise (%f) for %s", + ped, noise, digit->GetName())); + return USHRT_MAX; + } + + AliFMDDebug(5, ("Subtracting pedestal %f from signal %d", + ped, digit->Counts())); // if (digit->Count3() > 0) adc = digit->Count3(); // else if (digit->Count2() > 0) adc = digit->Count2(); // else adc = digit->Count1(); @@ -390,7 +402,7 @@ AliFMDReconstructor::Adc2Energy(AliFMDDigit* digit, // classes to do strip-specific look-ups in databases or the like, // to find the proper gain for a strip. // - // In this simple version, we calculate the energy deposited as + // In the first simple version, we calculate the energy deposited as // // EnergyDeposited = cos(theta) * gain * count // @@ -401,16 +413,28 @@ AliFMDReconstructor::Adc2Energy(AliFMDDigit* digit, // ADC_channel_size // // is constant and the same for all strips. + // + // For the production we use the conversion measured in the NBI lab. + // The total conversion is then: + // gain = ADC / DAC + // => energy = EdepMip*count / gain*DACPerADC + // + // if (count <= 0) return 0; AliFMDParameters* param = AliFMDParameters::Instance(); Float_t gain = param->GetPulseGain(digit->Detector(), digit->Ring(), digit->Sector(), digit->Strip()); - AliFMDDebug(15, ("Converting counts %d to energy via factor %f", - count, gain)); + // 'Tagging' bad gains as bad energy + if (gain < 0) { + AliWarning(Form("Invalid gain (%f) for %s", gain, digit->GetName())); + return -1; + } + AliFMDDebug(5, ("Converting counts %d to energy via factor %f and DAC2MIP %f", + count, gain,param->GetDACPerMIP())); - Double_t edep = count * gain; + Double_t edep = (count * param->GetEdepMip()) / (gain * param->GetDACPerMIP()); if (fDiagStep2) fDiagStep2->Fill(count, edep); if (fAngleCorrect) { Double_t theta = 2 * TMath::ATan(TMath::Exp(-eta)); @@ -446,9 +470,11 @@ AliFMDReconstructor::Energy2Multiplicity(AliFMDDigit* /* digit */, AliFMDParameters* param = AliFMDParameters::Instance(); Double_t edepMIP = param->GetEdepMip(); Float_t mult = edep / edepMIP; +#if 0 if (edep > 0) AliFMDDebug(15, ("Translating energy %f to multiplicity via " "divider %f->%f", edep, edepMIP, mult)); +#endif if (fDiagStep4) fDiagStep4->Fill(edep, mult); return mult; } diff --git a/FMD/scripts/MakeCalibration.C b/FMD/scripts/MakeCalibration.C index 7e4cb905610..6611f805616 100644 --- a/FMD/scripts/MakeCalibration.C +++ b/FMD/scripts/MakeCalibration.C @@ -15,7 +15,7 @@ Float_t AdcPerMip2Gain(Int_t adc) { - return 1. / adc * AliFMDParameters::Instance()->GetEdepMip(); + return 2.9;// / adc * AliFMDParameters::Instance()->GetEdepMip(); } void -- 2.39.3