//*-- AUTHOR : Ilse Koenig //*-- Created : 29/07/2003 ///////////////////////////////////////////////////////////// // HGeoHit // // Base class for hit definition in GEANT // ///////////////////////////////////////////////////////////// #include "hgeohit.h" #include "FairGeoSet.h" #include "FairGeoNode.h" #include "TString.h" #include "ctype.h" ClassImp(HGeoHit) HGeoHit::HGeoHit(FairGeoSet* p) { pSet=p; currentNode=0; nh=0; chnamh=0; nbitsh=0; orig=0; fact=0; nv=0; chnmsv=0; nbitsv=0; copies=0; } HGeoHit::~HGeoHit() { if (chnamh) { delete [] chnamh; chnamh=0; } if (nbitsh) { delete [] nbitsh; nbitsh=0; } if (orig) { delete [] orig; orig=0; } if (fact) { delete [] fact; fact=0; } if (chnmsv) { delete [] chnmsv; chnmsv=0; } if (nbitsv) { delete nbitsv; nbitsv=0; } if (copies) { copies->Delete(); delete copies; copies=0; } } const char* HGeoHit::getDetectorName() { return pSet->GetName(); } void HGeoHit::read(fstream& fin) { cout<<"reading hits"<>tmp; tmp.Strip(tmp.kBoth); if (tmp.IsNull() || tmp.BeginsWith("/")) fin.getline(buf,maxbuf); else { fName=tmp(0,4); fin>>nh; if (nh>0) { chnamh=new char[nh*5]; nbitsh=new Int_t[nh]; orig=new Float_t[nh]; fact=new Float_t[nh]; for(Int_t i=0;i>tmp; strcpy(&chnamh[i*5],(tmp(0,4)).Data()); } for(Int_t i=0;i>nbitsh[i]; for(Int_t i=0;i>orig[i]; for(Int_t i=0;i>fact[i]; } } } print(); } void HGeoHit::write(fstream& fout) { fout<0) { fout<<&chnamh[0]; for(Int_t i=1;i0) { cout<<&chnamh[0]; for(Int_t i=1;i0) { cout<<"Hits for sensitive volume: "<GetName() <<" idtype: "<GetName(),4); compName[4]='\0'; if (!copies) { copies=new TList; TListIter iter(pSet->getListOfVolumes()); FairGeoNode* vol; while((vol=(FairGeoNode*)iter.Next())) { Int_t num=vol->getCopyNo(); if (num>1) { TString volName(vol->GetName(),4); HGeoCopyNodeNum* v=(HGeoCopyNodeNum*)(copies->FindObject(volName.Data())); if (v) { if (num>v->maxCopyNum) v->maxCopyNum=num; } else copies->Add(new HGeoCopyNodeNum(volName,num)); } } copies->ls(); } char treeNames[20][5]; Int_t i, j, copyNo[20], nvmax=20; FairGeoNode* pNode=currentNode; while (pNode&&nv<=nvmax) { if (nv==nvmax) { Error("restoreTree()", "number of levels in tree too large, only %i allowed!\n",nvmax); return kFALSE; } TString nodeName(pNode->GetName()); if (nodeName.Length()<=4) { strcpy(treeNames[nv],nodeName.Data()); copyNo[nv]=1; } else { TString s(nodeName,4); HGeoCopyNodeNum* v=(HGeoCopyNodeNum*)(copies->FindObject(s)); strcpy(treeNames[nv],s.Data()); copyNo[nv]=v->maxCopyNum; } nv++; if (pNode->isModule()) break; pNode=pNode->getMotherNode(); } chnmsv=new char[nv*5]; nbitsv=new Int_t[nv]; for(j=0,i=nv-1;j0) return kTRUE; return kFALSE; } Bool_t HGeoHit::calcRefPos(FairGeoTransform& refTransform,TString& shape) { shape=currentNode->getShape(); return currentNode->calcModuleTransform(refTransform); }