fColOffset = 0 ;
fGeom = 0;
fAbsIdMap = 0 ;
+ fRawIdMap = 0 ;
}
//____________________________________________________________________________
fProtoColumns = 0 ;
fRawOffset = 0 ;
fColOffset = 0 ;
+ fAbsIdMap = 0 ;
+ fRawIdMap = 0 ;
fGeom = AliPHOSGeometry::GetInstance("GPS2","") ;
{
if(fAbsIdMap)
delete [] fAbsIdMap ;
+ if(fRawIdMap)
+ delete [] fRawIdMap ;
}
//____________________________________________________________________________
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<UInt_t>(absId),rawId) ;
+ fRawIdMap->AddAt(static_cast<UInt_t>(rawId),absId-fMinAbsId) ;
}
}
}
//____________________________________________________________________________
+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
//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 ;}
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 ;
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