54 #include "StMessMgr.h"
55 #include "StThreeVectorD.hh"
58 #include "Sti/Base/Factory.h"
59 #include "Sti/StiPlanarShape.h"
60 #include "Sti/StiCylindricalShape.h"
61 #include "Sti/StiMaterial.h"
62 #include "Sti/StiPlacement.h"
63 #include "Sti/StiDetector.h"
67 #include "StiRnD/Ist/StiIstIsActiveFunctor.h"
68 #include "StiRnD/Ist/StiIstDetectorBuilder.h"
70 #include "StiRnD/Ist/StiIstDetectorBuilder.h"
71 #include "StDetectorDbMaker/StiIst1HitErrorCalculator.h"
87 StiIstDetectorBuilder::~StiIstDetectorBuilder()
90 void StiIstDetectorBuilder::loadDS(
TDataSet& ds){
91 cout<<
"StiIstDetectorBuilder::loadDS(TDataSet& ds) -I- started: "<<endl;
101 gMessMgr->Info() <<
"StiIstDetectorBuilder::buildDetectors() - I - Started "<<endm;
109 cout <<
"StiIstDetectorBuilder::buildDetectors() -I- Use VMC geometry" << endl;
110 SetCurrentDetectorBuilder(
this);
119 {
"SILICON", &_siMat},
120 {
"SILICON", &_hybridMat}
122 Int_t M =
sizeof(map)/
sizeof(Material_t);
123 for (Int_t i = 0; i < M; i++) {
124 const TGeoMaterial *mat = gGeoManager->GetMaterial(map[i].name);
126 Double_t PotI = StiVMCToolKit::GetPotI(mat);
131 mat->GetDensity()*mat->GetRadLen(),
138 {
"IBSS",
"active silicon",
"HALL_1/CAVE_1/IDSM_1/IBMO_1",
"",
""},
139 {
"IBSP",
"inactive silicon",
"HALL_1/CAVE_1/IDSM_1/IBMO_1",
"",
""}
141 Int_t NoIstVols =
sizeof(IstVolumes)/
sizeof(
VolumeMap_t);
142 gGeoManager->RestoreMasterVolume();
143 gGeoManager->CdTop();
144 for (Int_t i = 0; i < NoIstVols; i++) {
145 gGeoManager->cd(IstVolumes[i].path);
146 TGeoNode *nodeT = gGeoManager->GetCurrentNode();
147 if (! nodeT)
continue;;
148 StiVMCToolKit::LoopOverNodes(nodeT, IstVolumes[i].path, IstVolumes[i].name, MakeAverageVolume);
152 void StiIstDetectorBuilder::AverageVolume(TGeoPhysicalNode *nodeP) {
154 LOG_DEBUG <<
"StiDetectorBuilder::AverageVolume -I TGeoPhysicalNode\t" << nodeP->GetName() << endm;
158 const Int_t NWAFERS = 12;
160 TString nameP(nodeP->GetName());
163 nameP.ReplaceAll(
"HALL_1/CAVE_1/",
"");
165 temp.ReplaceAll(
"IDSM_1/IBMO_1",
"");
166 int q=temp.Index(
"_");
167 temp.Replace(0,q+1,
"");
168 TString num0=temp(0,2);
169 if(!num0.IsDigit()) num0=temp(0,1);
170 int layer=num0.Atoi();
172 temp.Replace(0,q+1,
"");
173 TString num1=temp(0,2);
174 if(!num1.IsDigit()) num1=temp(0,1);
175 int ladder=num1.Atoi();
177 temp.Replace(0,q+1,
"");
178 TString num2=temp(0,2);
179 if(!num2.IsDigit()) num2=temp(0,1);
182 temp.Replace(0,q+1,
"");
183 TString num3=temp(0,1);
185 if(ladder!=1)
return;
188 Bool_t ActiveVolume = kFALSE;
189 if (nodeP->GetVolume()->GetMedium()->GetParam(0) == 1) {
190 ActiveVolume = kTRUE;
194 TGeoMaterial *matP = nodeP->GetVolume()->GetMaterial();
195 Double_t PotI = StiVMCToolKit::GetPotI(matP);
197 if (! matS) matS = add(
new StiMaterial(matP->GetName(),
201 matP->GetDensity()*matP->GetRadLen(),
210 TGeoBBox *box = (TGeoBBox *) nodeP->GetShape();
212 NWAFERS*box->GetDZ(),
218 TGeoHMatrix *hmat = nodeP->GetMatrix();
219 Double_t *xyz = hmat->GetTranslation();
220 Double_t *rot = hmat->GetRotationMatrix();
227 normalVector /= normalVector.magnitude();
231 Double_t phi = centerVector.phi();
232 Double_t phiD = normalVector.phi();
233 Double_t r = centerVector.perp();
234 pPlacement->setZcenter(0);
235 pPlacement->setLayerRadius(r);
243 if(nameP.Contains(
"IBSS")) pPlacement->setLayerAngle(phi);
244 if(nameP.Contains(
"IBSP")) pPlacement->setLayerAngle(phi-.05);
245 pPlacement->setRegion(StiPlacement::kMidRapidity);
246 pPlacement->setNormalRep(phiD, r*TMath::Cos(phi-phiD), r*TMath::Sin(phi-phiD));
252 pDetector->
setName(nameP.Data());
253 pDetector->setIsOn(
false);
259 cout<<
"active volume: "<<nameP<<endl;
264 cout<<
"inactive volume: "<<nameP<<endl;
267 pDetector->setIsContinuousMedium(
false);
268 pDetector->setIsDiscreteScatterer(
true);
269 pDetector->setShape(sh);
270 pDetector->setPlacement(pPlacement);
271 pDetector->setGas(GetCurrentDetectorBuilder()->getGasMat());
272 pDetector->setMaterial(matS);
274 pDetector->setHitErrorCalculator(StiIst1HitErrorCalculator::instance());
278 add(addLayer,layer,pDetector);
280 LOG_INFO <<
"StiIstDetectorBuilder: Added detector -I- " << pDetector->
getName() << endm;
virtual void buildDetectors(StMaker &source)
function object for determine a Ist padrow's active regions
virtual void useVMCGeometry()
StiIstDetectorBuilder(bool active, bool buildIdealGeom=true)
virtual Abstract * getInstance()=0
Get a pointer to instance of objects served by this factory.
virtual void setNRows(UInt_t nRows)
void setName(const string &newName)
Set the name of the object.
const string & getName() const
Get the name of the object.
Class implements an object which is never active.