/* $Id$ */
+/* History of cvs commits:
+ *
+ * $Log$
+ * Revision 1.11 2005/05/28 14:19:04 schutz
+ * Compilation warnings fixed by T.P.
+ *
+ */
+
//_________________________________________________________________________
-// Short description
+// Class provides correspondence between "raw numbers" i.e. number of crustall
+// in prototype and PHOT AbsId numer, used in reconstruction.
+// First it calculates correspondence automatically, assuming, that
+// prototype, having N raws and M columns is situated in the center
+// of middle (third) PHOS module. Then this correspondence can be edited
+// manually. One can convert Raw->AbsId and visa versa AbsId->RawId.
//
-//*-- Author : (SUBATECH)
+//*-- Author : D.Peressounko ("RRC Kurchatov Institute")
//////////////////////////////////////////////////////////////////////////////
// --- ROOT system ---
#include "TH2S.h"
// --- Standard library ---
-#include <iostream.h>
+
// --- AliRoot header files ---
+#include "AliLog.h"
#include "AliPHOSGeometry.h"
#include "AliPHOSConTableDB.h"
//____________________________________________________________________________
- AliPHOSConTableDB::AliPHOSConTableDB():TNamed("AliPHOSConTableDB","Beamtest2002")
+AliPHOSConTableDB::AliPHOSConTableDB():
+ TNamed("AliPHOSConTableDB","Beamtest2002"),
+ fGeom(0),
+ fProtoRaws(0),
+ fProtoColumns(0),
+ fRawOffset(0),
+ fColOffset(0),
+ fNcrInProto(0),
+ fMinAbsId(0),
+ fMaxAbsId(0),
+ fAbsIdMap(0),
+ fRawIdMap(0)
{
- fNcrInProto = 0 ;
- fProtoRaws = 0 ;
- fProtoColumns = 0 ;
- fRawOffset = 0 ;
- fColOffset = 0 ;
- fGeom = 0;
- fAbsIdMap = 0 ;
+ //default constructor, nothing created.
}
//____________________________________________________________________________
- AliPHOSConTableDB::AliPHOSConTableDB(const char * title):TNamed("AliPHOSConTableDB",title)
+AliPHOSConTableDB::AliPHOSConTableDB(const char * title):
+ TNamed("AliPHOSConTableDB",title),
+ fGeom(0),
+ fProtoRaws(0),
+ fProtoColumns(0),
+ fRawOffset(0),
+ fColOffset(0),
+ fNcrInProto(0),
+ fMinAbsId(0),
+ fMaxAbsId(0),
+ fAbsIdMap(0),
+ fRawIdMap(0)
{
- fNcrInProto = 0 ;
- fProtoRaws = 0 ;
- fProtoColumns = 0 ;
- fRawOffset = 0 ;
- fColOffset = 0 ;
-
- fGeom = AliPHOSGeometry::GetInstance("GPS2","") ;
+ //Normally used constructor
+ fGeom = AliPHOSGeometry::GetInstance("IHEP","") ;
+}
+//____________________________________________________________________________
+AliPHOSConTableDB::AliPHOSConTableDB(const AliPHOSConTableDB& cdb):
+ TNamed(cdb.GetName(), cdb.GetTitle()),
+ fGeom(0),
+ fProtoRaws(cdb.fProtoRaws),
+ fProtoColumns(cdb.fProtoColumns),
+ fRawOffset(cdb.fRawOffset),
+ fColOffset(cdb.fColOffset),
+ fNcrInProto(cdb.fNcrInProto),
+ fMinAbsId(cdb.fMinAbsId),
+ fMaxAbsId(cdb.fMaxAbsId),
+ fAbsIdMap(new TArrayS(*(cdb.fAbsIdMap))),
+ fRawIdMap(new TArrayS(*(cdb.fRawIdMap)))
+{
+ //Copy constructor
}
//____________________________________________________________________________
AliPHOSConTableDB::~AliPHOSConTableDB()
{
if(fAbsIdMap)
- delete [] fAbsIdMap ;
+ delete fAbsIdMap ;
+ if(fRawIdMap)
+ delete fRawIdMap ;
}
//____________________________________________________________________________
//assuming, that prototype is centered in the third module of the PHOS
fNcrInProto =fProtoRaws*fProtoColumns ;
if(!fNcrInProto){
- cout << "configuratio of prototype is not known!!!" << endl ;
- cout << "specify number of raws and columns in prototype" << endl ;
+ AliError(Form("configuratio of prototype is not known!!!\n Specify number of raws and columns in prototype"));
return ;
}
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::Raw2AbsId(Int_t rawId){
+Int_t AliPHOSConTableDB::AbsId2Raw(Int_t absId)const{
+ //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)const{
//converts numbering of modules in prototipe into
//numbering in PHOS
if(rawId >= 0 && rawId<fNcrInProto)
return 0 ;
}
//____________________________________________________________________________
-void AliPHOSConTableDB::Print(Option_t * option)const {
+void AliPHOSConTableDB::Print(const Option_t *)const {
+//prints configuraion
- cout << GetName() << " " << GetTitle() << endl ;
- cout << "PHOS Geometry configured for " ;
+ TString message ;
+ message = " %s %s\n" ;
+ message += "PHOS Geometry configured for " ;
if(fGeom)
- cout << fGeom->GetName() << " " << fGeom->GetTitle() << endl ;
+ message += "%s %s \n" ;
else
- cout << " null " << endl ;
- cout << "-------Prototype parameters--------" << endl ;
- cout << " number of columns: " << fProtoColumns << endl ;
- cout << " number of raws: " << fProtoRaws << endl ;
- cout << " centered in third PHOS module with offsets: " <<endl ;
- cout << " raw: " << fRawOffset << " of " << fGeom->GetNPhi() << endl ;
- cout << " col: " << fColOffset << " of " << fGeom->GetNZ() << endl ;
- cout << "------------------------------------" << endl ;
+ message += " null \n" ;
+
+ AliInfo(Form(message.Data(), GetName(), GetTitle(), fGeom->GetName(), fGeom->GetTitle() )) ;
+
+ message = "\n-------Prototype parameters--------\n" ;
+ message += " number of columns: %d \n" ;
+ message += " number of raws: %d \n" ;
+ message += " centered in third PHOS module with offsets: \n " ;
+ message += " raw: %d of %d\n" ;
+ message += " col: %d of %d\n" ;
+ message += "------------------------------------ \n" ;
+
+ AliInfo(Form(message.Data(), fProtoColumns, fProtoRaws, fRawOffset, fGeom->GetNPhi(), fColOffset,fGeom->GetNZ() ));
+}
+//____________________________________________________________________________
+AliPHOSConTableDB& AliPHOSConTableDB::operator=(const AliPHOSConTableDB& cdb){
+//Operator for coding convetion
+ fGeom=cdb.fGeom ; //! PHOS geometry class
+ fProtoRaws=cdb.fProtoRaws ; // Parameters
+ fProtoColumns=cdb.fProtoColumns ; // used to calculate
+ fRawOffset=cdb.fRawOffset ; // correspondance
+ fColOffset=cdb.fColOffset ; // map
+ fNcrInProto=cdb.fNcrInProto ; //Number of channels in prototype
+ fMinAbsId=cdb.fMinAbsId ; //Minimal AbsId, corresponding to some prototype cristall.
+ fMaxAbsId=cdb.fMaxAbsId ; //Maximal AbsId, corresponding to some prototype cristall
+ fAbsIdMap=new TArrayS(*(cdb.fAbsIdMap)) ; //Map of correspondance between Raw and PHOS ID
+ fRawIdMap=new TArrayS(*(cdb.fRawIdMap)) ; //Map of correspondance between AbsId and Raw
+ return *this ;
}
+
+
+