]>
Commit | Line | Data |
---|---|---|
7984e5f7 | 1 | // |
2 | // This class contains the secondary correction and the double hit | |
3 | // correction used in low-flux events. | |
4 | // | |
5 | // | |
0bd4b00f | 6 | #include "AliFMDCorrDoubleHit.h" |
7 | #include <TBrowser.h> | |
8 | #include <TH1D.h> | |
9 | #include <AliLog.h> | |
10 | #include <iostream> | |
11 | ||
12 | //____________________________________________________________________ | |
13 | AliFMDCorrDoubleHit::AliFMDCorrDoubleHit() | |
14 | : fCorrections() | |
15 | { | |
7984e5f7 | 16 | // Constructor |
17 | // | |
18 | // | |
0bd4b00f | 19 | fCorrections.SetOwner(kTRUE); |
20 | fCorrections.SetName("doubleHit"); | |
21 | } | |
22 | //____________________________________________________________________ | |
23 | AliFMDCorrDoubleHit::AliFMDCorrDoubleHit(const AliFMDCorrDoubleHit& o) | |
24 | : TObject(o), | |
25 | fCorrections(o.fCorrections) | |
26 | { | |
7984e5f7 | 27 | // Copy constructor |
28 | // | |
29 | // Parameters: | |
30 | // o Object to copy from | |
0bd4b00f | 31 | } |
32 | //____________________________________________________________________ | |
33 | AliFMDCorrDoubleHit::~AliFMDCorrDoubleHit() | |
34 | { | |
7984e5f7 | 35 | // |
36 | // Destructor | |
37 | // | |
0bd4b00f | 38 | fCorrections.Clear(); |
39 | } | |
40 | //____________________________________________________________________ | |
41 | AliFMDCorrDoubleHit& | |
42 | AliFMDCorrDoubleHit::operator=(const AliFMDCorrDoubleHit& o) | |
43 | { | |
7984e5f7 | 44 | // Assignment operator |
45 | // | |
46 | // Parameters: | |
47 | // o Object to assign from | |
0bd4b00f | 48 | fCorrections = o.fCorrections; |
49 | ||
50 | return *this; | |
51 | } | |
52 | //____________________________________________________________________ | |
53 | TH1D* | |
54 | AliFMDCorrDoubleHit::GetCorrection(UShort_t d, Char_t r) const | |
55 | { | |
7984e5f7 | 56 | // |
57 | // Get the double hit correction @f$ h_{r}(\eta)@f$ | |
58 | // | |
59 | // Parameters: | |
60 | // d Detector number | |
61 | // r Ring identifier | |
62 | // | |
63 | // Return: | |
64 | // @f$ h_{r}(\eta)@f$ | |
65 | // | |
0bd4b00f | 66 | Int_t idx = GetRingIndex(d, r); |
67 | if (idx < 0) return 0; | |
68 | ||
69 | TObject* o = fCorrections.At(idx); | |
70 | if (!o) { | |
71 | AliWarning(Form("No double hit correction found for FMD%d%c", d, r)); | |
72 | return 0; | |
73 | } | |
74 | return static_cast<TH1D*>(o); | |
75 | } | |
76 | //____________________________________________________________________ | |
77 | Int_t | |
78 | AliFMDCorrDoubleHit::GetRingIndex(UShort_t d, Char_t r) const | |
79 | { | |
7984e5f7 | 80 | // |
81 | // Get the index corresponding to the given ring | |
82 | // | |
83 | // Parameters: | |
84 | // d Detector | |
85 | // r Ring | |
86 | // | |
87 | // Return: | |
88 | // Index (0 based) or negative in case of errors | |
89 | // | |
90 | ||
0bd4b00f | 91 | switch (d) { |
92 | case 1: return 0; | |
93 | case 2: return (r == 'I' || r == 'i' ? 1 : 2); break; | |
94 | case 3: return (r == 'I' || r == 'i' ? 3 : 4); break; | |
95 | } | |
96 | AliWarning(Form("Index for FMD%d%c not found", d, r)); | |
97 | return -1; | |
98 | } | |
99 | //____________________________________________________________________ | |
100 | Bool_t | |
101 | AliFMDCorrDoubleHit::SetCorrection(UShort_t d, Char_t r, TH1D* h) | |
102 | { | |
7984e5f7 | 103 | // |
104 | // Set the double hit correction @f$ h_{r}(\eta)@f$. Note, that the | |
105 | // object takes ownership of the passed pointer. | |
106 | // | |
107 | // Parameters: | |
108 | // d Detector number (1-3) | |
109 | // r Ring identifier (I or O) | |
110 | // h @f$ h_{r}(\eta)@f$ | |
111 | // | |
112 | // Return: | |
113 | // true if operation succeeded | |
114 | // | |
0bd4b00f | 115 | Int_t idx = GetRingIndex(d, r); |
116 | if (idx < 0) return kFALSE; | |
117 | ||
118 | h->SetName(Form("FMD%d%c", d, r)); | |
119 | h->SetTitle(Form("Double hit correction for FMD%d%c", d,r)); | |
120 | h->SetXTitle("#eta"); | |
121 | h->SetYTitle("#sum_{i} N_{i,strips hit}(#eta)/" | |
122 | "#sum_{i} N_{i,total hits}(#eta)"); | |
123 | // h->SetFillColor(Color(d,r)); | |
124 | h->SetFillStyle(3001); | |
125 | h->SetDirectory(0); | |
126 | h->SetStats(0); | |
127 | ||
128 | fCorrections.AddAtAndExpand(h, idx); | |
129 | return kTRUE; | |
130 | } | |
131 | //____________________________________________________________________ | |
132 | void | |
133 | AliFMDCorrDoubleHit::Browse(TBrowser* b) | |
134 | { | |
7984e5f7 | 135 | // BRowse this object |
136 | // | |
137 | // Parameters: | |
138 | // b Browser to use | |
0bd4b00f | 139 | b->Add(&fCorrections); |
140 | } | |
141 | //____________________________________________________________________ | |
142 | void | |
143 | AliFMDCorrDoubleHit::Print(Option_t* option) const | |
144 | { | |
7984e5f7 | 145 | // Print this object |
146 | // | |
147 | // Parameters: | |
148 | // option Passed to TH2D::Print | |
0bd4b00f | 149 | std::cout << "Double hit correction" << std::endl; |
150 | fCorrections.Print(option); | |
151 | } | |
152 | ||
153 | //____________________________________________________________________ | |
154 | // | |
155 | // EOF | |
156 | // |