2 // This class contains the secondary correction
3 // for the central region
5 #include "AliCentralCorrSecondaryMap.h"
11 //____________________________________________________________________
12 AliCentralCorrSecondaryMap::AliCentralCorrSecondaryMap()
17 // Default constructor
19 fArray.SetOwner(kTRUE);
20 fArray.SetName("rings");
21 fVertexAxis.SetName("vtxAxis");
22 fVertexAxis.SetTitle("v_{z} [cm]");
25 //____________________________________________________________________
26 AliCentralCorrSecondaryMap::AliCentralCorrSecondaryMap(const
27 AliCentralCorrSecondaryMap& 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 AliCentralCorrSecondaryMap::~AliCentralCorrSecondaryMap()
51 //____________________________________________________________________
52 AliCentralCorrSecondaryMap&
53 AliCentralCorrSecondaryMap::operator=(const AliCentralCorrSecondaryMap& o)
56 // Assignment operator
59 // o Object to assign from
62 // Reference to this object
65 SetVertexAxis(o.fVertexAxis);
69 //____________________________________________________________________
71 AliCentralCorrSecondaryMap::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 AliCentralCorrSecondaryMap::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 TObject* o = fArray.At(b-1);
107 AliWarning(Form("No dead channels map found for SPD in vertex bin %d",
111 return static_cast<TH2D*>(o);
114 //____________________________________________________________________
116 AliCentralCorrSecondaryMap::FindVertexBin(Double_t v) const
119 // Find the vertex bin that corresponds to the passed vertex
122 // vertex The interaction points @f$z@f$-coordinate
125 // Vertex bin in @f$[1,N_{\mbox{vertex}}]@f$ or negative if
128 if (fVertexAxis.GetNbins() <= 0) {
129 AliWarning("No vertex array defined");
132 Int_t bin = const_cast<TAxis&>(fVertexAxis).FindBin(v);
133 if (bin <= 0 || bin > fVertexAxis.GetNbins()) {
134 AliWarning(Form("vertex %+8.4f out of range [%+8.4f,%+8.4f]",
135 v, fVertexAxis.GetXmin(), fVertexAxis.GetXmax()));
141 //____________________________________________________________________
143 AliCentralCorrSecondaryMap::SetCorrection(UShort_t b, TH2D* h)
146 // Set the acceptance correction @f$ a_{r,v}(\eta)@f$
147 // Note, that the object takes ownership of the passed pointer.
150 // d Detector number (1-3)
151 // r Ring identifier (I or O)
152 // b Bin corresponding to the primary interaction point
153 // @f$z@f$ coordinate (1 based)
154 // h @f$ a_{r,v}(\eta)@f$
157 // true if operation succeeded
160 if (b <= 0 || b > fVertexAxis.GetNbins()) {
161 AliWarning(Form("Vertex bin %3d out of range [1,%3d]",
162 b, fVertexAxis.GetNbins()));
165 h->SetName(Form("SPD_vtxbin%03d", b));
166 h->SetTitle(Form("Secondary correction %+5.1f<v_{z}<%+5.1f]",
167 fVertexAxis.GetBinLowEdge(b),
168 fVertexAxis.GetBinUpEdge(b)));
169 h->SetXTitle("#eta");
170 h->SetYTitle("#varphi [radians]");
171 h->SetZTitle("dN_{ch}/d#eta / #sum_{i} N_{ch,i}");
172 h->SetFillStyle(3001);
173 h->SetFillColor(kRed+1);
174 h->SetMarkerStyle(20);
175 h->SetMarkerColor(kRed+1);
178 fArray.AddAtAndExpand(h, b-1);
181 //____________________________________________________________________
183 AliCentralCorrSecondaryMap::SetCorrection(Double_t v, TH2D* h)
186 // Set the acceptance correction @f$ a_{r,v}(\eta)@f$.
187 // Note, that the object takes ownership of the passed pointer.
190 // d Detector number (1-3)
191 // r Ring identifier (I or O)
192 // v Primary interaction point @f$z@f$ coordinate
193 // h @f$ a_{r,v}(\eta)@f$
196 // true if operation succeeded
198 Int_t b = FindVertexBin(v);
199 if (b <= 0 || b > fVertexAxis.GetNbins()) {
200 AliWarning(Form("Vertex %+8.4f out of range [%+8.4f,%+8.4f]",
201 v, fVertexAxis.GetXmin(), fVertexAxis.GetXmax()));
204 return SetCorrection( UShort_t(b), h);
206 //____________________________________________________________________
208 AliCentralCorrSecondaryMap::Browse(TBrowser* b)
211 // Browse this object in the browser
217 b->Add(&fVertexAxis);
219 //____________________________________________________________________
221 AliCentralCorrSecondaryMap::Print(Option_t* /* option */) const
229 std::cout << " SecondaryMap correction\n"
230 << " # of vertex bins: " << fVertexAxis.GetNbins() << "\n"
231 << " Vertex range: [" << fVertexAxis.GetXmin()
232 << "," << fVertexAxis.GetXmax() << "]\n"
237 while ((o = next())) std::cout << o->GetName() << " ";
238 std::cout << std::endl;
241 //____________________________________________________________________