]>
Commit | Line | Data |
---|---|---|
bf000c32 | 1 | //____________________________________________________________________ |
088f8e79 | 2 | // |
3 | // $Id$ | |
4 | // | |
5 | // Script that contains a class to draw eloss from hits, versus ADC | |
6 | // counts from digits, using the AliFMDInputHits class in the util library. | |
7 | // | |
8 | // It draws the energy loss versus the p/(mq^2). It can be overlayed | |
9 | // with the Bethe-Bloc curve to show how the simulation behaves | |
10 | // relative to the expected. | |
11 | // | |
12 | // Use the script `Compile.C' to compile this class using ACLic. | |
13 | // | |
14 | #include <TH2D.h> | |
15 | #include <AliFMDHit.h> | |
16 | #include <AliFMDDigit.h> | |
17 | #include <AliFMDInput.h> | |
18 | #include <AliFMDEdepMap.h> | |
19 | #include <iostream> | |
20 | #include <TStyle.h> | |
21 | #include <TArrayF.h> | |
8ec606c2 | 22 | #include <AliLog.h> |
f95a63c4 | 23 | #include <TMath.h> |
088f8e79 | 24 | |
9b48326f | 25 | /** @class DrawHitsDigits |
26 | @brief Draw hit energy loss versus digit ADC | |
27 | @code | |
28 | Root> .L Compile.C | |
29 | Root> Compile("DrawHitsDigits.C") | |
30 | Root> DrawHitsDigits c | |
31 | Root> c.Run(); | |
32 | @endcode | |
33 | @ingroup FMD_script | |
34 | */ | |
8ec606c2 | 35 | class DrawHitsDigits : public AliFMDInput |
088f8e79 | 36 | { |
37 | private: | |
38 | TH2D* fElossVsAdc; // Histogram | |
39 | AliFMDEdepMap fMap; | |
40 | public: | |
bf000c32 | 41 | //__________________________________________________________________ |
088f8e79 | 42 | DrawHitsDigits(Int_t n=900, Double_t emin=1e-3, Double_t emax=10, |
43 | Int_t m=1100, Double_t amin=-0.5, Double_t amax=1099.5) | |
44 | { | |
45 | AddLoad(kDigits); | |
8ec606c2 | 46 | AddLoad(kHits); |
088f8e79 | 47 | TArrayF eloss(MakeLogScale(n, emin, emax)); |
48 | TArrayF adcs(m+1); | |
49 | adcs[0] = amin; | |
50 | for (Int_t i = 1; i < m+1; i++) adcs[i] = adcs[i-1] + (amax-amin)/m; | |
51 | fElossVsAdc = new TH2D("bad", "#Delta E vs. ADC", | |
52 | eloss.fN-1, eloss.fArray, adcs.fN-1, adcs.fArray); | |
53 | fElossVsAdc->SetXTitle("#Delta E/#Delta x [MeV/cm]"); | |
54 | fElossVsAdc->SetYTitle("ADC value"); | |
55 | } | |
bf000c32 | 56 | //__________________________________________________________________ |
9b48326f | 57 | /** Begining of event |
58 | @param ev Event number | |
59 | @return @c false on error */ | |
088f8e79 | 60 | Bool_t Begin(Int_t ev) |
61 | { | |
62 | fMap.Reset(); | |
8ec606c2 | 63 | return AliFMDInput::Begin(ev); |
088f8e79 | 64 | } |
bf000c32 | 65 | //__________________________________________________________________ |
088f8e79 | 66 | Bool_t ProcessHit(AliFMDHit* hit, TParticle*) |
67 | { | |
faf80567 | 68 | // Info("ProcessHit", "Processing hit %p", hit); |
088f8e79 | 69 | // Cache the energy loss |
70 | if (!hit) return kFALSE; | |
71 | UShort_t det = hit->Detector(); | |
72 | Char_t rng = hit->Ring(); | |
73 | UShort_t sec = hit->Sector(); | |
74 | UShort_t str = hit->Strip(); | |
8f6ee336 | 75 | if (str > 511) { |
76 | AliWarning(Form("Bad strip number %d in hit", str)); | |
77 | return kTRUE; | |
78 | } | |
088f8e79 | 79 | fMap(det, rng, sec, str).fEdep += hit->Edep(); |
80 | fMap(det, rng, sec, str).fN++; | |
faf80567 | 81 | // hit->Print(); |
088f8e79 | 82 | return kTRUE; |
83 | } | |
bf000c32 | 84 | //__________________________________________________________________ |
85 | Bool_t ProcessDigit(AliFMDDigit* digit) | |
088f8e79 | 86 | { |
faf80567 | 87 | // Info("ProcessDigit", "Processing digit %p", digit); |
8ec606c2 | 88 | if (!digit) return kFALSE; |
bf000c32 | 89 | UShort_t det = digit->Detector(); |
90 | Char_t rng = digit->Ring(); | |
91 | UShort_t sec = digit->Sector(); | |
92 | UShort_t str = digit->Strip(); | |
93 | if (str > 511) { | |
94 | AliWarning(Form("Bad strip number %d in digit", str)); | |
a9579262 | 95 | return kFALSE; |
088f8e79 | 96 | } |
bf000c32 | 97 | fElossVsAdc->Fill(fMap(det, rng, sec, str).fEdep, digit->Counts()); |
faf80567 | 98 | if (fMap(det, rng, sec, str).fEdep > 0) |
99 | Info("ProcessDigit", "FMD%d%c[%2d,%3d] Edep=%8.5f -> ADC=0x%03x", | |
100 | det, rng, sec, str, | |
101 | fMap(det, rng, sec, str).fEdep, digit->Counts()); | |
088f8e79 | 102 | return kTRUE; |
103 | } | |
bf000c32 | 104 | //__________________________________________________________________ |
088f8e79 | 105 | Bool_t Finish() |
106 | { | |
107 | gStyle->SetPalette(1); | |
108 | gStyle->SetOptTitle(0); | |
109 | gStyle->SetCanvasColor(0); | |
110 | gStyle->SetCanvasBorderSize(0); | |
111 | gStyle->SetPadColor(0); | |
112 | gStyle->SetPadBorderSize(0); | |
113 | fElossVsAdc->SetStats(kFALSE); | |
114 | fElossVsAdc->Draw("COLZ"); | |
115 | return kTRUE; | |
116 | } | |
8f6ee336 | 117 | |
118 | ClassDef(DrawHitsDigits,0); | |
088f8e79 | 119 | }; |
120 | ||
121 | //____________________________________________________________________ | |
122 | // | |
123 | // EOF | |
124 | // |