32 #include <TStreamerInfo.h> 45 : fMaxDetectors(maxDet),
76 TObject* o = file->GetStreamerInfoList()->FindObject(
"AliFMDMap");
78 TStreamerInfo*
info =
static_cast<TStreamerInfo*
>(o);
79 if (info->GetClassVersion() == 2) SetBit(
kNeedUShort);
94 ring = (rng == 0 ?
'I' :
'O');
139 if (det < 1)
return -1;
140 UShort_t ringi = (ring ==
'I' || ring ==
'i' ? 0 : 1);
156 UShort_t irg = (ring ==
'I' || ring ==
'i' ?
kInner :
158 if (irg >
kOuter)
return -1;
162 case 1: idx =
kFMD1Base;
if (irg > 0)
return -1;
break;
168 if (sec >= nSec)
return -1;
170 if (str >= nStr)
return -1;
171 idx += nStr * sec + str;
206 UShort_t ringi = (ring ==
'I' || ring ==
'i' ? 0 :
207 (ring ==
'O' || ring ==
'o' ? 1 : 2));
208 AliFatal(Form(
"Index FMD%d%c[%2d,%3d] out of bounds, " 209 "in particular the %s index ",
219 #define INCOMP_OP(self, other, OP) do { \ 220 AliWarning("Incompatible sized AliFMDMap"); \ 221 UShort_t maxDet = TMath::Min(self->MaxDetectors(), other.MaxDetectors()); \ 222 UShort_t maxRng = TMath::Min(self->MaxRings(), other.MaxRings()); \ 223 UShort_t maxSec = TMath::Min(self->MaxSectors(), other.MaxSectors()); \ 224 UShort_t maxStr = TMath::Min(self->MaxStrips(), other.MaxStrips()); \ 225 for (UShort_t d = 1; d <= maxDet; d++) { \ 226 UShort_t nRng = TMath::Min(UShort_t(d == 1 ? 1 : 2), maxRng); \ 227 for (UShort_t q = 0; q < nRng; q++) { \ 228 Char_t r = (q == 0 ? 'I' : 'O'); \ 229 UShort_t nSec = TMath::Min(UShort_t(q == 0 ? 20 : 40), maxSec); \ 230 UShort_t nStr = TMath::Min(UShort_t(q == 0 ? 512 : 256), maxStr); \ 231 for (UShort_t s = 0; s < nSec; s++) { \ 232 for (UShort_t t = 0; t < nStr; t++) { \ 233 Int_t idx1 = self->CalcIndex(d, r, s, t); \ 234 Int_t idx2 = other.CalcIndex(d, r, s, t); \ 235 if (idx1 < 0 || idx2 < 0) { \ 236 AliWarning("Index out of bounds"); \ 239 if (self->IsFloat()) \ 240 self->AtAsFloat(idx1) OP other.AtAsFloat(idx2); \ 241 else if (self->IsInt()) \ 242 self->AtAsInt(idx1) OP other.AtAsInt(idx2); \ 243 else if (self->IsUShort()) \ 244 self->AtAsUShort(idx1) OP other.AtAsUShort(idx2); \ 245 else if (self->IsBool()) \ 246 self->AtAsBool(idx1) OP other.AtAsBool(idx2); \ 253 #define COMP_OP(self,other,OP) do { \ 254 for (Int_t i = 0; i < self->MaxIndex(); i++) { \ 255 if (self->IsFloat()) \ 256 self->AtAsFloat(i) OP other.AtAsFloat(i); \ 257 else if (self->IsInt()) \ 258 self->AtAsInt(i) OP other.AtAsInt(i); \ 259 else if (self->IsUShort()) \ 260 self->AtAsUShort(i) OP other.AtAsUShort(i); \ 261 else if (self->IsBool()) \ 262 self->AtAsBool(i) OP other.AtAsBool(i); \ 339 for (Int_t i = 0; i < this->
MaxIndex(); i++) {
345 rr = algo.operator()(d, r, s, t, this->
AtAsFloat(i));
347 rr = algo.operator()(d, r, s, t, this->
AtAsInt(i));
349 rr = algo.operator()(d, r, s, t, this->
AtAsUShort(i));
351 rr = algo.operator()(d, r, s, t, this->
AtAsBool(i));
373 : fFormat(format), fOldD(0), fOldR(
'-'), fOldS(1024)
397 printf(
"\n %s ring", (r ==
'I' ?
"Inner" :
"Outer"));
403 if (t % 4 == 0)
printf(
"\n %3d-%3d ", t, t+3);
444 void AliFMDMap::Streamer(TBuffer &R__b)
450 if (R__b.IsReading()) {
453 Version_t version = R__b.ReadVersion(&R__s, &R__c, this->Class());
454 TFile *file = (TFile*)R__b.GetParent();
455 if (file && file->GetVersion() < 30000) version = -1;
456 AliFMDMap::Class()->ReadBuffer(R__b,
this, version, R__s, R__c);
459 AliFMDMap::Class()->WriteBuffer(R__b,
this);
AliFMDMap & operator-=(const AliFMDMap &o)
printf("Chi2/npoints = %f\n", TMath::Sqrt(chi2/npoints))
#define INCOMP_OP(self, other, OP)
Printer(const char *format)
virtual Bool_t AtAsBool(Int_t idx) const
Int_t CheckIndex(UShort_t det, Char_t ring, UShort_t sec, UShort_t str) const
virtual Int_t AtAsInt(Int_t idx) const
virtual void Print(Option_t *option="") const
virtual Float_t AtAsFloat(Int_t idx) const
AliFMDMap & operator*=(const AliFMDMap &o)
virtual Bool_t IsBool() const
AliFMDMap(UShort_t maxDet=0, UShort_t maxRing=0, UShort_t maxSec=0, UShort_t maxStr=0)
Base class for caches of per-strip information.This is used to index a strip. Data stored depends on ...
Int_t Coords2IndexOld(UShort_t det, Char_t ring, UShort_t sec, UShort_t str) const
void CheckNeedUShort(TFile *file)
void Print(const char *method, TStopwatch &timer, Int_t n)
#define COMP_OP(self, other, OP)
void Index2Coords(Int_t idx, UShort_t &det, Char_t &ring, UShort_t &sec, UShort_t &str) const
virtual Bool_t IsUShort() const
virtual Bool_t IsInt() const
void Index2CoordsOld(Int_t idx, UShort_t &det, Char_t &ring, UShort_t &sec, UShort_t &str) const
virtual void PrintHeadings(UShort_t d, Char_t r, UShort_t s, UShort_t t)
virtual Bool_t ForEach(ForOne &algo) const
#define AliFatal(message)
Bool_t operator()(UShort_t d, Char_t r, UShort_t s, UShort_t t, Float_t m)
virtual UShort_t AtAsUShort(Int_t idx) const
AliFMDMap & operator/=(const AliFMDMap &o)
Int_t Coords2Index(UShort_t det, Char_t ring, UShort_t sec, UShort_t str) const
virtual Bool_t IsFloat() const
AliFMDMap & operator+=(const AliFMDMap &o)
void CalcCoords(Int_t idx, UShort_t &det, Char_t &ring, UShort_t &sec, UShort_t &str) const
Int_t CalcIndex(UShort_t det, Char_t ring, UShort_t sec, UShort_t str) const
virtual Int_t MaxIndex() const =0