4 // Script that contains a class to draw eloss from hits, versus ADC
5 // counts from digits, using the AliFMDInputHits class in the util library.
7 // It draws the energy loss versus the p/(mq^2). It can be overlayed
8 // with the Bethe-Bloc curve to show how the simulation behaves
9 // relative to the expected.
11 // Use the script `Compile.C' to compile this class using ACLic.
14 #include <AliFMDHit.h>
15 #include <AliFMDDigit.h>
16 #include <AliFMDInput.h>
17 #include <AliFMDEdepMap.h>
22 class DrawHitsDigits : public AliFMDInputHits
25 TH2D* fElossVsAdc; // Histogram
28 TArrayF MakeLogScale(Int_t n, Double_t min, Double_t max)
31 Float_t dp = n / TMath::Log10(max / min);
32 Float_t pmin = TMath::Log10(min);
34 for (Int_t i = 1; i < n+1; i++) {
35 Float_t p = pmin + i / dp;
36 bins[i] = TMath::Power(10, p);
40 DrawHitsDigits(Int_t n=900, Double_t emin=1e-3, Double_t emax=10,
41 Int_t m=1100, Double_t amin=-0.5, Double_t amax=1099.5)
44 TArrayF eloss(MakeLogScale(n, emin, emax));
47 for (Int_t i = 1; i < m+1; i++) adcs[i] = adcs[i-1] + (amax-amin)/m;
48 fElossVsAdc = new TH2D("bad", "#Delta E vs. ADC",
49 eloss.fN-1, eloss.fArray, adcs.fN-1, adcs.fArray);
50 fElossVsAdc->SetXTitle("#Delta E/#Delta x [MeV/cm]");
51 fElossVsAdc->SetYTitle("ADC value");
53 Bool_t Begin(Int_t ev)
56 return AliFMDInputHits::Begin(ev);
58 Bool_t ProcessHit(AliFMDHit* hit, TParticle*)
60 // Cache the energy loss
61 if (!hit) return kFALSE;
62 UShort_t det = hit->Detector();
63 Char_t rng = hit->Ring();
64 UShort_t sec = hit->Sector();
65 UShort_t str = hit->Strip();
66 fMap(det, rng, sec, str).fEdep += hit->Edep();
67 fMap(det, rng, sec, str).fN++;
72 if (!AliFMDInputHits::Event()) return kFALSE;
73 Int_t nEv = fTreeD->GetEntries();
74 for (Int_t i = 0; i < nEv; i++) {
75 Int_t digitRead = fTreeD->GetEntry(i);
76 if (digitRead <= 0) continue;
77 Int_t nDigit = fArrayD->GetEntries();
78 if (nDigit <= 0) continue;
79 for (Int_t j = 0; j < nDigit; j++) {
80 AliFMDDigit* digit = static_cast<AliFMDDigit*>(fArrayD->At(j));
82 UShort_t det = digit->Detector();
83 Char_t rng = digit->Ring();
84 UShort_t sec = digit->Sector();
85 UShort_t str = digit->Strip();
86 fElossVsAdc->Fill(fMap(det, rng, sec, str).fEdep, digit->Counts());
93 gStyle->SetPalette(1);
94 gStyle->SetOptTitle(0);
95 gStyle->SetCanvasColor(0);
96 gStyle->SetCanvasBorderSize(0);
97 gStyle->SetPadColor(0);
98 gStyle->SetPadBorderSize(0);
99 fElossVsAdc->SetStats(kFALSE);
100 fElossVsAdc->Draw("COLZ");
105 //____________________________________________________________________