1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 //_________________________________________________________________________
21 //*-- Author : (SUBATECH)
22 //////////////////////////////////////////////////////////////////////////////
24 // --- ROOT system ---
28 // --- Standard library ---
30 // --- AliRoot header files ---
31 #include "AliPHOSGeometry.h"
32 #include "AliPHOSConTableDB.h"
34 ClassImp(AliPHOSConTableDB)
37 //____________________________________________________________________________
38 AliPHOSConTableDB::AliPHOSConTableDB():TNamed("AliPHOSConTableDB","Beamtest2002")
50 //____________________________________________________________________________
51 AliPHOSConTableDB::AliPHOSConTableDB(const char * title):TNamed("AliPHOSConTableDB",title)
61 fGeom = AliPHOSGeometry::GetInstance("GPS2","") ;
65 //____________________________________________________________________________
66 AliPHOSConTableDB::~AliPHOSConTableDB()
74 //____________________________________________________________________________
75 void AliPHOSConTableDB::BuildDB(void)
77 //Make a map between Protopype cristalls and PHOS crystalls
78 //assuming, that prototype is centered in the third module of the PHOS
79 fNcrInProto =fProtoRaws*fProtoColumns ;
81 Error("BuildDB", "configuratio of prototype is not known!!!\n Specify number of raws and columns in prototype") ;
84 fRawOffset = (fGeom->GetNPhi() - fProtoRaws)/2 ;
85 fColOffset = (fGeom->GetNZ() - fProtoColumns )/ 2 ;
86 fAbsIdMap = new TArrayS(fNcrInProto) ;
87 fMinAbsId = fGeom->GetNCristalsInModule()*2 +
88 fRawOffset*fGeom->GetNZ()+fColOffset+1 ;
89 fMaxAbsId = fGeom->GetNCristalsInModule()*2 +
90 (fRawOffset + fProtoRaws)*fGeom->GetNZ()-
92 fRawIdMap = new TArrayS(fMaxAbsId-fMinAbsId+1) ;
93 for(Int_t raw =0; raw < fProtoRaws ; raw ++){
94 for(Int_t col = 0; col < fProtoColumns ; col ++){
95 Int_t rawId = raw*fProtoColumns + col ;
96 Int_t rel[4] = {3,0,0,0} ; //We assume, that we deal with third module
97 rel[2]=raw + fRawOffset+1 ;
98 rel[3]=col + fColOffset+1 ;
100 fGeom->RelToAbsNumbering(rel,absId) ;
101 fAbsIdMap->AddAt(static_cast<UInt_t>(absId),rawId) ;
102 fRawIdMap->AddAt(static_cast<UInt_t>(rawId),absId-fMinAbsId) ;
107 //____________________________________________________________________________
108 void AliPHOSConTableDB::PlotProtoMap(Option_t * opt)
110 //Visualyse connection table
112 TH2S * hMapProto = new TH2S("hMap","Map of Prototype ids",
113 fGeom->GetNPhi(),0,fGeom->GetNPhi(),
114 fGeom->GetNZ(),0,fGeom->GetNZ()) ;
115 TH2S * hMapPHOS = new TH2S("hMapPHOS","Map of PHOS ids",
116 fGeom->GetNPhi(),0,fGeom->GetNPhi(),
117 fGeom->GetNZ(),0,fGeom->GetNZ()) ;
118 TH2C * hMapBox = new TH2C("hMapBox","Map of Prototype ids",
119 fGeom->GetNPhi(),0,fGeom->GetNPhi(),
120 fGeom->GetNZ(),0,fGeom->GetNZ()) ;
121 for(Int_t raw =0; raw <fGeom->GetNPhi() ; raw ++)
122 for(Int_t col = 0; col <fGeom->GetNZ() ; col ++)
123 hMapBox->SetBinContent(raw+1,col+1,1) ;
125 for(Int_t raw =0; raw < fProtoRaws; raw ++){
126 for(Int_t col = 0; col < fProtoColumns ; col ++){
127 Int_t rawId = col*fProtoRaws + raw ;
128 Int_t rel[4] = {3,0,0,0} ; //We assume, that we deal with third module
129 rel[2]=raw + fRawOffset ;
130 rel[3]=col + fColOffset ;
131 hMapProto->SetBinContent(rel[2]+1,rel[3]+1,rawId);
133 fGeom->RelToAbsNumbering(rel,absId) ;
134 hMapPHOS->SetBinContent(rel[2]+1,rel[3]+1,absId) ;
139 if(strstr(opt,"Zoom")||strstr(opt,"zoom")){
140 static_cast<TAxis *>(hMapBox->GetXaxis())->SetRange(fRawOffset+1,fGeom->GetNPhi()-fRawOffset) ;
141 static_cast<TAxis *>(hMapBox->GetYaxis())->SetRange(fColOffset+1,fGeom->GetNZ()-fColOffset) ;
143 hMapBox->Draw("box") ;
144 if(strstr(opt,"PHOS"))
145 hMapPHOS->Draw("textsame") ;
147 hMapProto->Draw("textsame") ;
150 //____________________________________________________________________________
151 Int_t AliPHOSConTableDB::AbsId2Raw(Int_t absId){
152 //converts numbering of modules in PHOS into
153 //numbering in prototype
154 if(absId >= fMinAbsId && absId<=fMaxAbsId){
155 return fRawIdMap->At(absId-fMinAbsId) ;
160 //____________________________________________________________________________
161 Int_t AliPHOSConTableDB::Raw2AbsId(Int_t rawId){
162 //converts numbering of modules in prototipe into
164 if(rawId >= 0 && rawId<fNcrInProto)
165 return fAbsIdMap->At(rawId) ;
169 //____________________________________________________________________________
170 void AliPHOSConTableDB::Print(Option_t * option)const {
173 message = " %s %s\n" ;
174 message += "PHOS Geometry configured for " ;
176 message += "%s %s \n" ;
178 message += " null \n" ;
180 Info("Print", message.Data(), GetName(), GetTitle(), fGeom->GetName(), fGeom->GetTitle() ) ;
182 message = "-------Prototype parameters--------\n" ;
183 message += " number of columns: %d" ;
184 message += " number of raws: %d" ;
185 message += " centered in third PHOS module with offsets: " ;
186 message += " raw: %d of %d\n" ;
187 message += " col: %d of %d\n" ;
188 message += "------------------------------------" ;
190 Info("Print", message.Data(), fProtoColumns, fProtoRaws, fRawOffset, fGeom->GetNPhi(), fColOffset,fGeom->GetNZ() );