+//____________________________________________________________________
//
// $Id$
//
#include <iostream>
#include <TStyle.h>
#include <TArrayF.h>
+#include <AliLog.h>
+#include <TMath.h>
-class DrawHitsDigits : public AliFMDInputHits
+/** @class DrawHitsDigits
+ @brief Draw hit energy loss versus digit ADC
+ @code
+ Root> .L Compile.C
+ Root> Compile("DrawHitsDigits.C")
+ Root> DrawHitsDigits c
+ Root> c.Run();
+ @endcode
+ @ingroup FMD_script
+ */
+class DrawHitsDigits : public AliFMDInput
{
private:
TH2D* fElossVsAdc; // Histogram
AliFMDEdepMap fMap;
public:
- TArrayF MakeLogScale(Int_t n, Double_t min, Double_t max)
- {
- TArrayF bins(n+1);
- Float_t dp = n / TMath::Log10(max / min);
- Float_t pmin = TMath::Log10(min);
- bins[0] = min;
- for (Int_t i = 1; i < n+1; i++) {
- Float_t p = pmin + i / dp;
- bins[i] = TMath::Power(10, p);
- }
- return bins;
- }
+ //__________________________________________________________________
DrawHitsDigits(Int_t n=900, Double_t emin=1e-3, Double_t emax=10,
Int_t m=1100, Double_t amin=-0.5, Double_t amax=1099.5)
{
AddLoad(kDigits);
+ AddLoad(kHits);
TArrayF eloss(MakeLogScale(n, emin, emax));
TArrayF adcs(m+1);
adcs[0] = amin;
fElossVsAdc->SetXTitle("#Delta E/#Delta x [MeV/cm]");
fElossVsAdc->SetYTitle("ADC value");
}
+ //__________________________________________________________________
+ /** Begining of event
+ @param ev Event number
+ @return @c false on error */
Bool_t Begin(Int_t ev)
{
fMap.Reset();
- return AliFMDInputHits::Begin(ev);
+ return AliFMDInput::Begin(ev);
}
+ //__________________________________________________________________
Bool_t ProcessHit(AliFMDHit* hit, TParticle*)
{
+ // Info("ProcessHit", "Processing hit %p", hit);
// Cache the energy loss
if (!hit) return kFALSE;
UShort_t det = hit->Detector();
}
fMap(det, rng, sec, str).fEdep += hit->Edep();
fMap(det, rng, sec, str).fN++;
+ // hit->Print();
return kTRUE;
}
- Bool_t Event()
+ //__________________________________________________________________
+ Bool_t ProcessDigit(AliFMDDigit* digit)
{
- if (!AliFMDInputHits::Event()) return kFALSE;
- Int_t nEv = fTreeD->GetEntries();
- for (Int_t i = 0; i < nEv; i++) {
- Int_t digitRead = fTreeD->GetEntry(i);
- if (digitRead <= 0) continue;
- Int_t nDigit = fArrayD->GetEntries();
- if (nDigit <= 0) continue;
- for (Int_t j = 0; j < nDigit; j++) {
- AliFMDDigit* digit = static_cast<AliFMDDigit*>(fArrayD->At(j));
- if (!digit) continue;
- UShort_t det = digit->Detector();
- Char_t rng = digit->Ring();
- UShort_t sec = digit->Sector();
- UShort_t str = digit->Strip();
- if (str > 511) {
- AliWarning(Form("Bad strip number %d in digit", str));
- continue;
- }
- fElossVsAdc->Fill(fMap(det, rng, sec, str).fEdep, digit->Counts());
- }
+ // Info("ProcessDigit", "Processing digit %p", digit);
+ if (!digit) return kFALSE;
+ UShort_t det = digit->Detector();
+ Char_t rng = digit->Ring();
+ UShort_t sec = digit->Sector();
+ UShort_t str = digit->Strip();
+ if (str > 511) {
+ AliWarning(Form("Bad strip number %d in digit", str));
+ return kFALSE;
}
+ fElossVsAdc->Fill(fMap(det, rng, sec, str).fEdep, digit->Counts());
+ if (fMap(det, rng, sec, str).fEdep > 0)
+ Info("ProcessDigit", "FMD%d%c[%2d,%3d] Edep=%8.5f -> ADC=0x%03x",
+ det, rng, sec, str,
+ fMap(det, rng, sec, str).fEdep, digit->Counts());
return kTRUE;
}
+ //__________________________________________________________________
Bool_t Finish()
{
gStyle->SetPalette(1);