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")
49 //____________________________________________________________________________
50 AliPHOSConTableDB::AliPHOSConTableDB(const char * title):TNamed("AliPHOSConTableDB",title)
58 fGeom = AliPHOSGeometry::GetInstance("GPS2","") ;
62 //____________________________________________________________________________
63 AliPHOSConTableDB::~AliPHOSConTableDB()
69 //____________________________________________________________________________
70 void AliPHOSConTableDB::BuildDB(void)
72 //Make a map between Protopype cristalls and PHOS crystalls
73 //assuming, that prototype is centered in the third module of the PHOS
74 fNcrInProto =fProtoRaws*fProtoColumns ;
76 Error("BuildDB", "configuratio of prototype is not known!!!\n Specify number of raws and columns in prototype") ;
79 fRawOffset = (fGeom->GetNPhi() - fProtoRaws)/2 ;
80 fColOffset = (fGeom->GetNZ() - fProtoColumns )/ 2 ;
81 fAbsIdMap = new TArrayS(fNcrInProto) ;
82 for(Int_t raw =0; raw < fProtoRaws; raw ++){
83 for(Int_t col = 0; col < fProtoColumns ; col ++){
84 Int_t rawId = col*fProtoRaws + raw ;
85 Int_t rel[4] = {3,0,0,0} ; //We assume, that we deal with third module
86 rel[2]=raw + fRawOffset ;
87 rel[3]=col + fColOffset ;
89 fGeom->RelToAbsNumbering(rel,absId) ;
90 fAbsIdMap->AddAt(static_cast<UInt_t>(absId),rawId) ;
95 //____________________________________________________________________________
96 void AliPHOSConTableDB::PlotProtoMap(Option_t * opt)
98 //Visualyse connection table
100 TH2S * hMapProto = new TH2S("hMap","Map of Prototype ids",
101 fGeom->GetNPhi(),0,fGeom->GetNPhi(),
102 fGeom->GetNZ(),0,fGeom->GetNZ()) ;
103 TH2S * hMapPHOS = new TH2S("hMapPHOS","Map of PHOS ids",
104 fGeom->GetNPhi(),0,fGeom->GetNPhi(),
105 fGeom->GetNZ(),0,fGeom->GetNZ()) ;
106 TH2C * hMapBox = new TH2C("hMapBox","Map of Prototype ids",
107 fGeom->GetNPhi(),0,fGeom->GetNPhi(),
108 fGeom->GetNZ(),0,fGeom->GetNZ()) ;
109 for(Int_t raw =0; raw <fGeom->GetNPhi() ; raw ++)
110 for(Int_t col = 0; col <fGeom->GetNZ() ; col ++)
111 hMapBox->SetBinContent(raw+1,col+1,1) ;
113 for(Int_t raw =0; raw < fProtoRaws; raw ++){
114 for(Int_t col = 0; col < fProtoColumns ; col ++){
115 Int_t rawId = col*fProtoRaws + raw ;
116 Int_t rel[4] = {3,0,0,0} ; //We assume, that we deal with third module
117 rel[2]=raw + fRawOffset ;
118 rel[3]=col + fColOffset ;
119 hMapProto->SetBinContent(rel[2]+1,rel[3]+1,rawId);
121 fGeom->RelToAbsNumbering(rel,absId) ;
122 hMapPHOS->SetBinContent(rel[2]+1,rel[3]+1,absId) ;
127 if(strstr(opt,"Zoom")||strstr(opt,"zoom")){
128 static_cast<TAxis *>(hMapBox->GetXaxis())->SetRange(fRawOffset+1,fGeom->GetNPhi()-fRawOffset) ;
129 static_cast<TAxis *>(hMapBox->GetYaxis())->SetRange(fColOffset+1,fGeom->GetNZ()-fColOffset) ;
131 hMapBox->Draw("box") ;
132 if(strstr(opt,"PHOS"))
133 hMapPHOS->Draw("textsame") ;
135 hMapProto->Draw("textsame") ;
138 //____________________________________________________________________________
139 Int_t AliPHOSConTableDB::Raw2AbsId(Int_t rawId){
140 //converts numbering of modules in prototipe into
142 if(rawId >= 0 && rawId<fNcrInProto)
143 return fAbsIdMap->At(rawId) ;
147 //____________________________________________________________________________
148 void AliPHOSConTableDB::Print(Option_t * option)const {
151 message = " %s %s\n" ;
152 message += "PHOS Geometry configured for " ;
154 message += "%s %s \n" ;
156 message += " null \n" ;
158 Info("Print", message.Data(), GetName(), GetTitle(), fGeom->GetName(), fGeom->GetTitle() ) ;
160 message = "-------Prototype parameters--------\n" ;
161 message += " number of columns: %d" ;
162 message += " number of raws: %d" ;
163 message += " centered in third PHOS module with offsets: " ;
164 message += " raw: %d of %d\n" ;
165 message += " col: %d of %d\n" ;
166 message += "------------------------------------" ;
168 Info("Print", message.Data(), fProtoColumns, fProtoRaws, fRawOffset, fGeom->GetNPhi(), fColOffset,fGeom->GetNZ() );