1 #ifndef ALIFMDENCODEDEDX_H 2 #define ALIFMDENCODEDEDX_H 74 Spec(UShort_t nb, Double_t l, Double_t h)
75 : nBins(nb), min(l), max(h),
76 cutBin1(UShort_t(nb * 0.75 + .5)),
77 cutVal1((max-min) / 10 + min),
78 cutBin2(UShort_t(nb * 0.95 + .5)),
79 cutVal2((max-min) / 5 + min)
101 else if (v > cutVal1) {
108 return off + UInt_t(n*(v-low)/(high-low));
130 else if (b >= cutBin1) {
138 return off + w * (b+.5);
162 Double_t w0 = (cutVal1 -
min) / cutBin1;
163 Double_t w1 = (cutVal2 -
cutVal1) / (cutBin2 - cutBin1);
164 Double_t w2 = (max -
cutVal2) / (nBins - cutBin2);
165 for (UInt_t i = 1; i <=
cutBin1; i++) a[i] = a[i-1] + w0;
166 for (UInt_t i = cutBin1+1; i <=
cutBin2; i++) a[i] = a[i-1] + w1;
167 for (UInt_t i = cutBin2+1; i <=
nBins; i++) a[i] = a[i-1] + w2;
176 Printf(
"Spec: [%8.4f,%8.4f] in %3d bins, cuts %8.4f (%3d) %8.4f (%3d)",
177 min, max, nBins, cutVal1, cutBin1, cutVal2, cutBin2);
178 if (opt[0] ==
'T' || opt[0] ==
't') {
179 for (Int_t i = 0; i <
nBins; i++) {
181 Double_t x =
Decode(i,w );
183 Printf(
"%3d -> %8.4f (%7.4f) -> %3d", i, x, w, j);
222 static Spec* dEAxis = 0;
223 if (!dEAxis) dEAxis =
new Spec((1<<
kNEBits), 0 , 11);
234 static Spec* dLAxis = 0;
235 if (!dLAxis) dLAxis =
new Spec((1<<
kNLBits), 0 , 0.7);
246 static UInt_t
Encode(Double_t edep, Double_t length)
259 static void Decode(UInt_t bits, Double_t& edep, Double_t& length)
273 static void Decode(UInt_t bits, Double_t& edep, Double_t& length,
274 Double_t& wEdep, Double_t& wLength)
290 static TH1*
Make1D(
const char* name,
const char* title, UShort_t mode=
true)
297 for (Int_t i = 0; i < aa.GetSize(); i++) aa[i] *= 100;
300 TH1* h =
new TH1D(name, title, aa.GetSize()-1, aa.GetArray());
301 h->SetXTitle(mode == 0 ?
"d#Delta [MeV]" :
302 mode == 1 ?
"dx [cm]" :
303 mode == 2 ?
"d#Delta/dx [MeV/cm]" :
"?");
304 h->SetFillStyle(3001);
305 h->SetMarkerStyle(20);
321 static TH2*
Make2D(
const char* name,
const char* title, Bool_t xedep=
true)
327 TH2* h =
new TH2D(name, title,
328 aa1.GetSize()-1, aa1.GetArray(),
329 aa2.GetSize()-1, aa2.GetArray());
330 h->SetXTitle(xedep ?
"d#Delta [MeV]" :
"dx [cm]");
331 h->SetYTitle(xedep ?
"dx [cm]" :
"d#Delta [MeV]");
349 const UInt_t target = 64491;
350 return alirootRev >= target;
363 if (v < a.
min)
return 0;
static TH1 * Make1D(const char *name, const char *title, UShort_t mode=true)
static TH2 * Make2D(const char *name, const char *title, Bool_t xedep=true)
static Double_t DecodeOne(UInt_t b, Double_t &w, const Spec &a)
static const Spec & GetdEAxis()
Double_t Decode(UInt_t b) const
static UInt_t EncodeOne(Double_t v, const Spec &a)
static Double_t DecodeOne(UInt_t b, const Spec &a)
static void Decode(UInt_t bits, Double_t &edep, Double_t &length)
void FillBinArray(TArrayD &a) const
static const Spec & GetdLAxis()
Spec(UShort_t nb, Double_t l, Double_t h)
Double_t Decode(UInt_t b, Double_t &w) const
static UInt_t Encode(Double_t edep, Double_t length)
virtual ~AliFMDEncodedEdx()
static Bool_t IsAvailable(UInt_t alirootRev)
static void Decode(UInt_t bits, Double_t &edep, Double_t &length, Double_t &wEdep, Double_t &wLength)
void Print(Option_t *opt="") const
UInt_t Encode(Double_t v) const