//*-- AUTHOR : Ilse Koenig //*-- Created : 10/11/2003 //_HADES_CLASS_DESCRIPTION ///////////////////////////////////////////////////////////// // HGeomTof // // Class for geometry of TOF // ///////////////////////////////////////////////////////////// #include "hgeomtof.h" #include "hgeomnode.h" #include "hgeomtofhit.h" #include #include #include "TString.h" ClassImp(HGeomTof) HGeomTof::HGeomTof() { // Constructor fName="tof"; maxSectors=6; maxKeepinVolumes=1; maxModules=25; Int_t mod[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1}; if (!modules) modules=new TArrayI(maxSectors*maxModules); for (Int_t s=0;sAddAt(mod[m],(s*maxModules+m)); } pHit=new HGeomTofHit(this); } const Char_t* HGeomTof::getKeepinName(Int_t s,Int_t) { // Returns the name of the TOFINO keepin volume in sector s std::memcpy(keepinName,Form("TFN%i",s+1),5); return keepinName; } const Char_t* HGeomTof::getModuleName(Int_t m) { // Returns the name of module m if (m<9) std::memcpy(modName,Form("T0%iF",m+1),5); else std::memcpy(modName,Form("T%iF",m+1) ,5); return modName; } const Char_t* HGeomTof::getEleName(Int_t m) { // Returns the element name in module m if (m<9) std::memcpy(eleName,Form("T0%i",m+1),4); else std::memcpy(eleName,Form("T%i",m+1) ,4); return eleName; } Bool_t HGeomTof::replaceTofKeepin() { // Replace the TOF keepin volume read from old geometry file by the corresponding sector if (!masterNodes) { Error("replaceTofKeepin","Master nodes not found!\n"); return kFALSE; } Char_t mod[6]; Char_t sec[5]; for(Int_t s=1;s<=6;s++) { std::memcpy(sec,Form("SEC%i",s),5); HGeomNode* mo=getMasterNode(sec); if (!mo) { Error("replaceTofKeepin","Mother volume %s not found!\n",sec); return kFALSE; } for(Int_t m=1;m<=22;m++) { if (m<=9) std::memcpy(mod,Form("T0%iF%i",m,s),6); else std::memcpy(mod,Form("T%iF%i",m,s) ,6); HGeomNode* v=getVolume(mod); if (v&&v->getMotherNode()==0) { v->setMother(mo); std::cout<<"New mother of "<GetName(); if (name[1]=='F') node->setVolumeType(kHGeomKeepin); else if (name[3]=='F') node->setVolumeType(kHGeomModule); else node->setVolumeType(kHGeomElement); }