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("acc_vtxbin%03d", b));
174 h->SetTitle(Form("Acceptance correction [%+5.1f<v_{z}<%+5.1f]",
175 fVertexAxis.GetBinLowEdge(b),
176 fVertexAxis.GetBinUpEdge(b)));
177 h->SetXTitle("#eta");
178 h->SetYTitle("dN_{ch}/d#eta / sum_i N_{ch,i}");
179 h->SetFillStyle(3001);
182 fArray.AddAtAndExpand(h, b-1);
185 //____________________________________________________________________
187 AliCentralCorrAcceptance::SetCorrection(Double_t v, TH1D* h)
190 // Set the acceptance correction @f$ a_{r,v}(\eta)@f$.
191 // Note, that the object takes ownership of the passed pointer.
194 // v Primary interaction point @f$z@f$ coordinate
195 // h @f$ a_{r,v}(\eta)@f$
198 // true if operation succeeded
200 Int_t b = FindVertexBin(v);
201 if (b <= 0 || b > fVertexAxis.GetNbins()) {
202 AliWarning(Form("Vertex %+8.4f out of range [%+8.4f,%+8.4f]",
203 v, fVertexAxis.GetXmin(), fVertexAxis.GetXmax()));
206 return SetCorrection(UShort_t(b), h);
208 //____________________________________________________________________
210 AliCentralCorrAcceptance::Browse(TBrowser* b)
213 // Browse this object in the browser
219 b->Add(&fVertexAxis);
221 //____________________________________________________________________
223 AliCentralCorrAcceptance::Print(Option_t* /* option */) const
231 std::cout << " Acceptance correction due to dead channels"
232 << " # of vertex bins: " << fVertexAxis.GetNbins() << "\n"
233 << " Vertex range: [" << fVertexAxis.GetXmin()
234 << "," << fVertexAxis.GetXmax() << "]\n"
239 while ((o = next())) std::cout << o->GetName() << " ";
240 std::cout << std::endl;
243 //____________________________________________________________________