2 // This class contains the acceptance correction due to dead channels
5 #include "AliCentralCorrAcceptance.h"
11 //____________________________________________________________________
12 AliCentralCorrAcceptance::AliCentralCorrAcceptance()
17 // Default constructor
19 fArray.SetOwner(kTRUE);
20 fArray.SetName("acceptance");
21 fVertexAxis.SetName("vtxAxis");
22 fVertexAxis.SetTitle("v_{z} [cm]");
25 //____________________________________________________________________
26 AliCentralCorrAcceptance::AliCentralCorrAcceptance(const
27 AliCentralCorrAcceptance& o)
30 fVertexAxis(o.fVertexAxis.GetNbins(), o.fVertexAxis.GetXmin(),
31 o.fVertexAxis.GetXmax())
37 // o Object to copy from
39 fVertexAxis.SetName("vtxAxis");
40 fVertexAxis.SetTitle("v_{z} [cm]");
42 //____________________________________________________________________
43 AliCentralCorrAcceptance::~AliCentralCorrAcceptance()
51 //____________________________________________________________________
52 AliCentralCorrAcceptance&
53 AliCentralCorrAcceptance::operator=(const AliCentralCorrAcceptance& o)
56 // Assignment operator
59 // o Object to assign from
62 // Reference to this object
65 SetVertexAxis(o.fVertexAxis);
69 //____________________________________________________________________
71 AliCentralCorrAcceptance::GetCorrection(Double_t v) const
74 // Get the acceptance correction @f$ a_{r,v}@f$
77 // d Detector number (1-3)
78 // r Ring identifier (I or O)
79 // v Primary interaction point @f$z@f$ coordinate
82 // The correction @f$ a_{r,v}@f$
84 Int_t b = FindVertexBin(v);
86 return GetCorrection(UShort_t(b));
88 //____________________________________________________________________
90 AliCentralCorrAcceptance::GetCorrection(UShort_t b) const
93 // Get the acceptance correction @f$ a_{r,v}@f$
96 // d Detector number (1-3)
97 // r Ring identifier (I or O)
98 // b Bin corresponding to the primary interaction point
99 // @f$z@f$ coordinate (1 based)
102 // The correction @f$ a_{r,v}@f$
105 // TObjArray* ringArray = GetRingArray(d, r);
106 //if (!ringArray) return 0;
108 if (b <= 0 || b > fArray.GetEntriesFast()) {
109 AliWarning(Form("vertex bin %d out of range [1,%d]",
110 b, fArray.GetEntriesFast()));
114 TObject* o = fArray.At(b-1);
116 AliWarning(Form("No dead channels map found for SPD in vertex bin %d",
120 return static_cast<TH1D*>(o);
123 //____________________________________________________________________
125 AliCentralCorrAcceptance::FindVertexBin(Double_t v) const
128 // Find the vertex bin that corresponds to the passed vertex
131 // vertex The interaction points @f$z@f$-coordinate
134 // Vertex bin in @f$[1,N_{\mbox{vertex}}]@f$ or negative if
137 if (fVertexAxis.GetNbins() <= 0) {
138 AliWarning("No vertex array defined");
141 Int_t bin = const_cast<TAxis&>(fVertexAxis).FindBin(v);
142 if (bin <= 0 || bin > fVertexAxis.GetNbins()) {
143 AliWarning(Form("vertex %+8.4f out of range [%+8.4f,%+8.4f]",
144 v, fVertexAxis.GetXmin(), fVertexAxis.GetXmax()));
150 //____________________________________________________________________
152 AliCentralCorrAcceptance::SetCorrection(UShort_t b, TH1D* h)
155 // Set the acceptance correction @f$ a_{r,v}(\eta)@f$
156 // Note, that the object takes ownership of the passed pointer.
159 // b Bin corresponding to the primary interaction point
160 // @f$z@f$ coordinate (1 based)
161 // h @f$ a_{r,v}(\eta)@f$
164 // true if operation succeeded
167 if (b <= 0 || b > fVertexAxis.GetNbins()) {
168 AliWarning(Form("Vertex bin %3d out of range [1,%3d]",
169 b, fVertexAxis.GetNbins()));
173 h->SetName(Form("SPD_vtxbin%03d", b));
174 h->SetTitle(Form("Acceptance correction for SPD "
175 "in vertex bin %d [%+8.4f,%+8.4f]",
176 b, fVertexAxis.GetBinLowEdge(b),
177 fVertexAxis.GetBinUpEdge(b)));
178 h->SetXTitle("#eta");
179 h->SetYTitle("dN_{ch}/d#eta / sum_i N_{ch,i}");
180 h->SetFillStyle(3001);
183 fArray.AddAtAndExpand(h, b-1);
186 //____________________________________________________________________
188 AliCentralCorrAcceptance::SetCorrection(Double_t v, TH1D* h)
191 // Set the acceptance correction @f$ a_{r,v}(\eta)@f$.
192 // Note, that the object takes ownership of the passed pointer.
195 // v Primary interaction point @f$z@f$ coordinate
196 // h @f$ a_{r,v}(\eta)@f$
199 // true if operation succeeded
201 Int_t b = FindVertexBin(v);
202 if (b <= 0 || b > fVertexAxis.GetNbins()) {
203 AliWarning(Form("Vertex %+8.4f out of range [%+8.4f,%+8.4f]",
204 v, fVertexAxis.GetXmin(), fVertexAxis.GetXmax()));
207 return SetCorrection(UShort_t(b), h);
209 //____________________________________________________________________
211 AliCentralCorrAcceptance::Browse(TBrowser* b)
214 // Browse this object in the browser
220 b->Add(&fVertexAxis);
222 //____________________________________________________________________
224 AliCentralCorrAcceptance::Print(Option_t* option) const
232 std::cout << "Acceptance correction due to dead channels" << std::endl;
233 fArray.Print(option);
234 fVertexAxis.Print(option);
237 //____________________________________________________________________