1 #ifndef STI_DETECTOR_BUILDER_H
2 #define STI_DETECTOR_BUILDER_H
9 #include "StDetectorDbMaker/StiTrackingParameters.h"
10 #include "Sti/StiMapUtilities.h"
11 #include "Sti/Base/Named.h"
12 #include "StThreeVector.hh"
13 #include "StiVMCToolKit.h"
23 template<
class Factorized>
class Factory;
27 typedef map<NameMapKey, StiMaterial*> materialMap;
28 typedef materialMap::value_type materialMapValType;
29 typedef map<NameMapKey, StiShape*> shapeMap;
30 typedef shapeMap::value_type shapeMapValType;
31 typedef map<NameMapKey, StiDetector*> detectorMap;
32 typedef detectorMap::const_iterator detectorIterator;
33 typedef detectorMap::value_type detectorMapValType;
34 typedef std::pair<NameMapKey, StiDetector*> DetectorMapPair;
48 detectorMap getDetectors(){
return mDetectorMap; }
53 virtual void del(UInt_t row, UInt_t sector);
54 virtual StiMaterial * findMaterial(
const string& szName)
const;
55 virtual StiShape * findShape(
const string& szName)
const;
56 virtual StiDetector * findDetector(
const string& szName)
const;
57 virtual StiDetector * getDetector(UInt_t layer, UInt_t sector)
const;
58 virtual void setDetector(UInt_t layer, UInt_t sector,
StiDetector * detector);
61 virtual void setNRows(UInt_t nRows) {
if (_detectors.size() < nRows) _detectors.resize(nRows);}
62 virtual UInt_t getNRows()
const {
return _detectors.size();}
63 virtual UInt_t getNSectors(UInt_t row=0)
const;
64 virtual void setNSectors(UInt_t row, UInt_t nSectors) {
65 setNRows(row+1);
if (_detectors[row].size() < nSectors) _detectors[row].resize(nSectors);
67 virtual bool hasMore()
const;
69 virtual void build(
StMaker&source);
70 virtual void buildDetectors(
StMaker&source);
72 double nice(
double angle)
const;
73 void setGroupId(
int id) { _groupId = id;}
74 int getGroupId()
const {
return _groupId;}
78 virtual void AverageVolume(TGeoPhysicalNode *nodeP);
79 virtual void useVMCGeometry() {}
82 void setSplit(
double relThick=0.5,
int maxSplit=20) {mThkSplit=relThick;mMaxSplit=maxSplit;}
84 static void setDebug(
int m = 0) {_debug = m;}
85 static int debug() {
return _debug;}
86 static StiDetectorBuilder *GetCurrentDetectorBuilder(){
return fCurrentDetectorBuilder;}
87 static void MakeAverageVolume(TGeoPhysicalNode *nodeP)
88 {
if (fCurrentDetectorBuilder) fCurrentDetectorBuilder->AverageVolume(nodeP);}
91 friend ostream& operator<<(ostream &os,
const DetectorMapPair &detMapEntry);
98 materialMap mMaterialMap;
100 detectorMap mDetectorMap;
101 detectorIterator mDetectorIterator;
102 vector< vector<StiDetector*> > _detectors;
110 inline double StiDetectorBuilder::nice(
double angle)
const
112 while(angle >= M_PI){ angle -= 2.*M_PI; }
113 while(angle < -M_PI){ angle += 2.*M_PI; }
118 #endif // ifndef STI_DETECTOR_BUILDER_H
virtual void setNRows(UInt_t nRows)