X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=STEER%2FAliFMDMap.cxx;h=1b8ce2a0505c4275391bec94221bea98b5af70fe;hb=ecc0fb268b6ff298f3adcac391c2644d3bb2b0b3;hp=06d2ca153b71da98bac67a8e5ef241a5eb372f09;hpb=9eeb02aac34b5fd6191f80511146550cf61f5fa8;p=u%2Fmrichter%2FAliRoot.git diff --git a/STEER/AliFMDMap.cxx b/STEER/AliFMDMap.cxx index 06d2ca153b7..1b8ce2a0505 100755 --- a/STEER/AliFMDMap.cxx +++ b/STEER/AliFMDMap.cxx @@ -25,6 +25,11 @@ // #include "AliFMDMap.h" // ALIFMDMAP_H #include "AliLog.h" +//#include +//#include +#include +#include +#include //____________________________________________________________________ ClassImp(AliFMDMap) @@ -49,8 +54,19 @@ AliFMDMap::AliFMDMap(UShort_t maxDet, // maxRinf Maximum # of rings // maxSec Maximum # of sectors // maxStr Maximum # of strips + SetBit(kNeedUShort, kFALSE); } +//____________________________________________________________________ +void +AliFMDMap::CheckNeedUShort(TFile* file) +{ + if (!file) return; + TObject* o = file->GetStreamerInfoList()->FindObject("AliFMDMap"); + if (!o) return; + TStreamerInfo* info = static_cast(o); + if (info->GetClassVersion() == 2) SetBit(kNeedUShort); +} //____________________________________________________________________ Int_t AliFMDMap::CheckIndex(UShort_t det, Char_t ring, UShort_t sec, UShort_t str) const @@ -59,15 +75,17 @@ AliFMDMap::CheckIndex(UShort_t det, Char_t ring, UShort_t sec, UShort_t str) con // on error. if (det < 1) return -1; UShort_t ringi = (ring == 'I' || ring == 'i' ? 0 : 1); - UShort_t idx = + Int_t idx = (str + fMaxStrips * (sec + fMaxSectors * (ringi + fMaxRings * (det-1)))); - if (idx >= fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips) return -1; + if (TestBit(kNeedUShort)) idx = UShort_t(idx); + if (idx < 0 || idx >= fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips) + return -1; return idx; } //____________________________________________________________________ -UShort_t +Int_t AliFMDMap::CalcIndex(UShort_t det, Char_t ring, UShort_t sec, UShort_t str) const { // Calculate index into storage from arguments. @@ -91,9 +109,30 @@ AliFMDMap::CalcIndex(UShort_t det, Char_t ring, UShort_t sec, UShort_t str) cons (sec >= fMaxSectors ? "Sector" : "Strip"))))); return 0; } - return UShort_t(idx); + return idx; } +#if 0 +//___________________________________________________________________ +void AliFMDMap::Streamer(TBuffer &R__b) +{ + // Stream an object of class AliFMDMap. + // This is overridden so that we can know the version of the object + // that we are reading in. In this way, we can fix problems that + // might occur in the class. + if (R__b.IsReading()) { + // read the class version from the buffer + UInt_t R__s, R__c; + Version_t version = R__b.ReadVersion(&R__s, &R__c, this->Class()); + TFile *file = (TFile*)R__b.GetParent(); + if (file && file->GetVersion() < 30000) version = -1; + AliFMDMap::Class()->ReadBuffer(R__b, this, version, R__s, R__c); + if (version == 2) SetBit(kNeedUShort); + } else { + AliFMDMap::Class()->WriteBuffer(R__b, this); + } +} +#endif //___________________________________________________________________ //