13 #ifndef STBTOFGEOMETRY_H
14 #define STBTOFGEOMETRY_H
32 #include "TGeometry.h"
33 #include "StThreeVectorD.hh"
34 #include "StHelixD.hh"
36 #include "TVolumeView.h"
37 #include "TVolumeViewIter.h"
42 typedef std::vector<Int_t> IntVec;
43 typedef std::vector<Double_t> DoubleVec;
44 typedef std::vector<StThreeVector<double> > PointVec;
51 class TGeoPhysicalNode;
64 Double_t mTransMRS[3];
92 if ( TestBit(kIsOwner) ) {
93 if (pView != fView->GetPosition())
delete pView;
103 TVolumeView* GetTopNode()
const {
return mMasterNode; }
104 static void DebugOn() {
mDebug = kTRUE; }
105 static void DebugOff() {
mDebug = kFALSE; }
106 static Bool_t IsDebugOn() {
return mDebug; }
108 static void CalcMatrix(
StBTofNode* son, Double_t* align, Double_t* trans, Double_t* rot,
110 static void ConvertPos(
StBTofNode* from,
const Double_t* pos_from,
112 void Local2Master(
const Double_t* local, Double_t* master);
113 void Master2Local(
const Double_t* master, Double_t* local);
114 TShape *GetShape()
const {
return fView->GetPosition()->GetNode()->GetShape();}
121 Double_t GetEtaMin()
const {
return mEtaMin; }
122 Double_t GetEtaMax()
const {
return mEtaMax; }
123 Double_t GetPhiMin()
const {
return mPhiMin; }
124 Double_t GetPhiMax()
const {
return mPhiMax; }
125 Bool_t IsLocalPointIn(
const Double_t x,
const Double_t y,
131 virtual void Print(
const Option_t *opt=
"")
const;
180 static void DebugOn() {
mDebug = kTRUE; }
181 static void DebugOff() {
mDebug = kFALSE; }
182 static Bool_t IsDebugOn() {
return mDebug; }
184 Int_t BTOHIndex()
const {
return mBTOHIndex; }
185 Int_t Index()
const {
return mTrayIndex; }
186 virtual void Print(
const Option_t *opt=
"")
const;
204 static Int_t
const mCells = 6;
205 Double_t mCellY[mCells+1];
206 static Double_t
const mSensorDy;
209 static Bool_t mDebug;
223 static void DebugOn() { mDebug = kTRUE; }
224 static void DebugOff() { mDebug = kFALSE; }
225 static Bool_t IsDebugOn() {
return mDebug; }
227 static Int_t GetCells() {
return mCells; }
228 void SetIndex(Int_t imod);
229 Int_t Index()
const {
return mModuleIndex; }
230 Double_t GetCellYMin(
const Int_t icell)
const;
231 Double_t GetCellYMax(
const Int_t icell)
const;
232 Int_t FindCellIndex(
const Double_t* local);
233 Int_t PrevCellIndex(
const Int_t icell)
const;
234 Int_t NextCellIndex(
const Int_t icell)
const;
236 virtual void Print(Option_t *opt=
"")
const ;
241 inline void StBTofGeomSensor::SetIndex(Int_t imod){ mModuleIndex = imod;}
244 inline Int_t StBTofGeomSensor::PrevCellIndex(
const Int_t icell)
248 if (icell>mCells) ret=mCells;
249 else if (icell>0) ret=icell-1;
254 inline Int_t StBTofGeomSensor::NextCellIndex(
const Int_t icell)
259 else if (icell<mCells) ret=icell+1;
276 static Int_t
const mNTrays = 120;
277 static Int_t
const mNModules = 32;
279 std::string FormTGeoPath(TGeoManager &geoManager,
int trayId,
bool hasGmt =
false,
int moduleId = -1);
281 static bool mGemTofGeom;
282 static bool TrayHasGmtModules(
int trayId);
284 void InitFrom(
TVolume &starHall);
287 void InitFrom(TGeoManager &geoManager);
291 const char* mRootFile;
294 Int_t mModulesInTray;
295 Int_t mCellsInModule;
308 static const char* trayPref ;
309 static const char* senPref ;
313 Double_t mTrayY0[mNTrays];
314 Double_t mTrayZ0[mNTrays];
318 const char* title=
"Simplified BTof Geometry");
321 Bool_t IsBSEC(
const TVolume* element)
const
322 {
return !(strcmp(element->GetName(),
sectorPref)); }
323 Bool_t IsBTRA(
const TVolume* element)
const
324 {
return !(strcmp(element->GetName(), trayPref)); }
325 Bool_t IsBRMD(
const TVolume* element)
const
326 {
return !(strcmp(element->GetName(), senPref)); }
328 Bool_t ContainOthers(
TVolume *element);
330 static Bool_t LackThis(
const char* fromWhere);
332 static void DebugOn() {
mDebug = kTRUE; }
333 static void DebugOff() {
mDebug = kFALSE; }
334 static Bool_t IsDebugOn() {
return mDebug; }
335 void SetMCOn() { mIsMC = kTRUE; }
336 void SetMCOff() { mIsMC = kFALSE; }
338 void SetAlignFile(
const Char_t *infile=
"") {
mAlignFile = infile; }
340 void Init(
StMaker *maker,
TVolume *starHall, TGeoManager* geoManager =
nullptr);
342 Bool_t IsInitDone()
const {
return mInitFlag; }
343 Bool_t IsCellValid(
const Int_t icell)
const;
344 Bool_t IsSensorValid(
const Int_t imodule)
const;
345 Bool_t IsTrayValid(
const Int_t itray)
const;
347 Int_t CalcCellId(
const Int_t volumeId,
const Double_t* local)
const;
348 Int_t CalcCellId(
const Int_t volumeId,
const Float_t* local)
const;
349 Int_t CalcSensorId(
const Int_t imodule,
const Int_t itray=0)
const;
350 Int_t PrevCellId(
const Int_t cellId)
const;
351 Int_t NextCellId(
const Int_t cellId)
const;
352 Int_t CalcCellId(
const Int_t icell,
const Int_t imodule,
353 const Int_t itray=0)
const;
354 void DecodeVolumeId(
const Int_t volumeId,
355 Int_t &imodule, Int_t &itray)
const;
356 Bool_t DecodeSensorId(
const Int_t sensorId, Int_t &imodule,
358 Bool_t DecodeCellId(
const Int_t cellId, Int_t &icell,
359 Int_t &imodule, Int_t &itray)
const;
360 Int_t GetCellIndex(
const Int_t cellId)
const;
362 Int_t CellsInModule(
const Int_t imodule=0,
const Int_t itray=0)
const
363 {
return StBTofGeomSensor::GetCells(); }
364 Int_t ModulesInTray(
const Int_t itray=0)
const
365 {
return mModulesInTray; }
366 Int_t Trays()
const {
return mNValidTrays; }
368 const char* GeoRootFile() {
return mRootFile; }
369 virtual void Print(Option_t *opt=
"")
const ;
371 TVolumeView* GetTopNode()
const {
return mTopNode; }
374 const Int_t itray=0)
const;
377 Int_t GetTrayIndexAt(
const Int_t idx=0)
const;
378 Int_t GetAtOfTray(
const Int_t itray=0)
const;
383 Bool_t
HelixCrossCellIds(
const StHelixD &helix, IntVec &idVec, DoubleVec &pathVec, PointVec &crossVec, DoubleVec &thetaVec)
const;
384 Bool_t
HelixCrossCellIds(
const StHelixD &helix, IntVec validModuleVec, IntVec projTrayVec, IntVec &idVec, DoubleVec &pathVec, PointVec &crossVec)
const;
385 Bool_t HelixCross(
const StHelixD &helix)
const;
386 Bool_t HelixCross(
const StHelixD &helix, IntVec validModuleVec, IntVec projTrayVec)
const;
387 Bool_t projTrayVector(
const StHelixD &helix, IntVec &trayVec)
const;
394 #endif //end of STBTOFGEOMETRY_H
static const char * sectorPref
filename for alignment input
Bool_t HelixCrossCellIds(const StHelixD &helix, IntVec &idVec, DoubleVec &pathVec, PointVec &crossVec) const
Double_t mTrayX0[mNTrays]
Alignment parameters.
void CreateGeomCells()
Control message printing of this class.
static Bool_t mDebug
Alignment parameters.
string mAlignFile
Control message printing of this class.
static Bool_t mDebug
Control MC input (ignore alignment corrections)
Int_t mSectorsInBTOH
the root file of geometry