From: schutz Date: Thu, 12 Dec 2002 17:42:19 +0000 (+0000) Subject: Bug in evaluation absId fixed X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=commitdiff_plain;h=503394a63cd623dfac7c40b820eafa63060815a2 Bug in evaluation absId fixed --- diff --git a/PHOS/AliPHOSConTableDB.cxx b/PHOS/AliPHOSConTableDB.cxx index 2011f94ce98..f2dea016a35 100644 --- a/PHOS/AliPHOSConTableDB.cxx +++ b/PHOS/AliPHOSConTableDB.cxx @@ -44,6 +44,7 @@ ClassImp(AliPHOSConTableDB) fColOffset = 0 ; fGeom = 0; fAbsIdMap = 0 ; + fRawIdMap = 0 ; } //____________________________________________________________________________ @@ -54,6 +55,8 @@ ClassImp(AliPHOSConTableDB) fProtoColumns = 0 ; fRawOffset = 0 ; fColOffset = 0 ; + fAbsIdMap = 0 ; + fRawIdMap = 0 ; fGeom = AliPHOSGeometry::GetInstance("GPS2","") ; @@ -64,6 +67,8 @@ ClassImp(AliPHOSConTableDB) { if(fAbsIdMap) delete [] fAbsIdMap ; + if(fRawIdMap) + delete [] fRawIdMap ; } //____________________________________________________________________________ @@ -79,15 +84,22 @@ void AliPHOSConTableDB::BuildDB(void) fRawOffset = (fGeom->GetNPhi() - fProtoRaws)/2 ; fColOffset = (fGeom->GetNZ() - fProtoColumns )/ 2 ; fAbsIdMap = new TArrayS(fNcrInProto) ; - for(Int_t raw =0; raw < fProtoRaws; raw ++){ + fMinAbsId = fGeom->GetNCristalsInModule()*2 + + fRawOffset*fGeom->GetNZ()+fColOffset+1 ; + fMaxAbsId = fGeom->GetNCristalsInModule()*2 + + (fRawOffset + fProtoRaws)*fGeom->GetNZ()- + fColOffset ; + fRawIdMap = new TArrayS(fMaxAbsId-fMinAbsId+1) ; + for(Int_t raw =0; raw < fProtoRaws ; raw ++){ for(Int_t col = 0; col < fProtoColumns ; col ++){ - Int_t rawId = col*fProtoRaws + raw ; + Int_t rawId = raw*fProtoColumns + col ; Int_t rel[4] = {3,0,0,0} ; //We assume, that we deal with third module - rel[2]=raw + fRawOffset ; - rel[3]=col + fColOffset ; + rel[2]=raw + fRawOffset+1 ; + rel[3]=col + fColOffset+1 ; Int_t absId ; fGeom->RelToAbsNumbering(rel,absId) ; fAbsIdMap->AddAt(static_cast(absId),rawId) ; + fRawIdMap->AddAt(static_cast(rawId),absId-fMinAbsId) ; } } @@ -136,6 +148,16 @@ void AliPHOSConTableDB::PlotProtoMap(Option_t * opt) } //____________________________________________________________________________ +Int_t AliPHOSConTableDB::AbsId2Raw(Int_t absId){ + //converts numbering of modules in PHOS into + //numbering in prototype + if(absId >= fMinAbsId && absId<=fMaxAbsId){ + return fRawIdMap->At(absId-fMinAbsId) ; + } + else + return -1 ; +} +//____________________________________________________________________________ Int_t AliPHOSConTableDB::Raw2AbsId(Int_t rawId){ //converts numbering of modules in prototipe into //numbering in PHOS diff --git a/PHOS/AliPHOSConTableDB.h b/PHOS/AliPHOSConTableDB.h index 2985c4b56d2..c6523349321 100644 --- a/PHOS/AliPHOSConTableDB.h +++ b/PHOS/AliPHOSConTableDB.h @@ -30,6 +30,9 @@ public: //Calculate table from known numbe of raws/columns //assuming that prototype is situated in the center of 3 PHOS mod. void BuildDB(void) ; + Int_t GetNchanels(){return fNcrInProto ; } + Int_t GetNRaws(){return fProtoRaws ;} + Int_t GetNColumns(){return fProtoColumns ;} //set the number of columns in prototype void SetNCols(Int_t ncolumns){fProtoColumns = ncolumns ;} @@ -45,7 +48,7 @@ public: Int_t Raw2AbsId(Int_t raw) ; //Transforms AbsId number in PHOS into channel number in prototype - Int_t AbsId2Raw(Int_t AbsId){return 0 ;} //To be implemented + Int_t AbsId2Raw(Int_t AbsId) ; virtual void Print(Option_t * option="") const ; @@ -57,7 +60,10 @@ private: Int_t fRawOffset ; //correspondance Int_t fColOffset ; //map Int_t fNcrInProto ; //Number of channels in prototype + Int_t fMinAbsId ; + Int_t fMaxAbsId ; TArrayS * fAbsIdMap ; //Map of correspondance between Raw and PHOS ID + TArrayS * fRawIdMap ; //Map of correspondance between AbsId and Raw ClassDef(AliPHOSConTableDB,1) // description