12 #ifndef STTOFRGEOMETRY_H
13 #define STTOFRGEOMETRY_H
31 #include "TGeometry.h"
32 #include "StThreeVectorD.hh"
33 #include "StHelixD.hh"
35 #include "TVolumePosition.h"
36 #include "TVolumeView.h"
37 #include "TVolumeViewIter.h"
40 #ifndef ST_NO_NAMESPACES
44 #if !defined(ST_NO_TEMPLATE_DEF_ARGS)
45 typedef vector<Int_t> IntVec;
46 typedef vector<Double_t> DoubleVec;
47 typedef vector<StThreeVector<double> > PointVec;
49 typedef vector<Int_t, allocator<Int_t> > IntVec;
50 typedef vector<Double_t, allocator<Double_t> > DoubleVec;
51 typedef vector<StThreeVector<double>, allocator<StThreeVector<double>>> PointVec;
70 class StTofrGeomNode :
public TNode {
72 Double_t mTransMRS[3];
87 StTofrGeomNode(
const char* name,
const char* title, TBRIK* brik,
88 const Double_t x,
const Double_t y,
const Double_t z,
89 TRotMatrix* matrix=0);
97 static void DebugOn() { mDebug = kTRUE; }
98 static void DebugOff() { mDebug = kFALSE; }
99 static Bool_t IsDebugOn() {
return mDebug; }
101 static void CalcMatrix(TNode* son, Double_t* trans, Double_t* rot,
102 StTofrGeomNode* mother=0);
103 static void ConvertPos( TNode* from,
const Double_t* pos_from,
104 StTofrGeomNode* to, Double_t* pos_to);
105 void Local2Master(
const Double_t* local, Double_t* master);
106 void Master2Local(
const Double_t* master, Double_t* local);
113 Double_t GetEtaMin()
const {
return mEtaMin; }
114 Double_t GetEtaMax()
const {
return mEtaMax; }
115 Double_t GetPhiMin()
const {
return mPhiMin; }
116 Double_t GetPhiMax()
const {
return mPhiMax; }
117 Bool_t IsLocalPointIn(
const Double_t x,
const Double_t y,
118 const Double_t z)
const;
120 Bool_t HelixCross(
const StHelixD &helix,
122 virtual void Print()
const;
124 C_l_assDef(StTofrGeomNode,2)
143 Double_t mTransMRS[3];
155 static Bool_t mDebug;
172 TVolumeView* GetTopNode()
const {
return mMasterNode; }
173 static void DebugOn() { mDebug = kTRUE; }
174 static void DebugOff() { mDebug = kFALSE; }
175 static Bool_t IsDebugOn() {
return mDebug; }
177 static void CalcMatrix(
StTofrNode* son, Double_t* trans, Double_t* rot,
179 static void ConvertPos(
StTofrNode* from,
const Double_t* pos_from,
181 void Local2Master(
const Double_t* local, Double_t* master);
182 void Master2Local(
const Double_t* master, Double_t* local);
183 TShape *GetShape()
const {
return fView->GetPosition()->GetNode()->GetShape();}
190 Double_t GetEtaMin()
const {
return mEtaMin; }
191 Double_t GetEtaMax()
const {
return mEtaMax; }
192 Double_t GetPhiMin()
const {
return mPhiMin; }
193 Double_t GetPhiMax()
const {
return mPhiMax; }
194 Bool_t IsLocalPointIn(
const Double_t x,
const Double_t y,
197 Bool_t HelixCross(
const StHelixD &helix,
199 virtual void Print(
const Option_t *opt=
"")
const;
221 static Bool_t mDebug;
243 static void DebugOn() { mDebug = kTRUE; }
244 static void DebugOff() { mDebug = kFALSE; }
245 static Bool_t IsDebugOn() {
return mDebug; }
247 Int_t BTOHIndex()
const {
return mBTOHIndex; }
248 Int_t Index()
const {
return mTrayIndex; }
250 virtual void Print(
const Option_t *opt=
"")
const;
268 static Int_t
const mCells = 6;
269 Double_t mCellY[mCells+1];
270 static Double_t
const mSensorDy;
273 static Bool_t mDebug;
292 static void DebugOn() { mDebug = kTRUE; }
293 static void DebugOff() { mDebug = kFALSE; }
294 static Bool_t IsDebugOn() {
return mDebug; }
296 static Int_t GetCells() {
return mCells; }
298 Int_t Index()
const {
return mModuleIndex; }
299 Double_t GetCellYMin(
const Int_t icell)
const;
300 Double_t GetCellYMax(
const Int_t icell)
const;
301 Int_t FindCellIndex(
const Double_t* local);
302 Int_t PrevCellIndex(
const Int_t icell)
const;
303 Int_t NextCellIndex(
const Int_t icell)
const;
305 virtual void Print(Option_t *opt=
"")
const ;
311 inline Int_t StTofrGeomSensor::PrevCellIndex(
const Int_t icell)
315 if (icell>mCells) ret=mCells;
316 else if (icell>0) ret=icell-1;
321 inline Int_t StTofrGeomSensor::NextCellIndex(
const Int_t icell)
326 else if (icell<mCells) ret=icell+1;
340 static Int_t
const mNTrays = 120;
341 static Int_t
const mNModules = 33;
347 const char* mRootFile;
350 Int_t mModulesInTray;
351 Int_t mCellsInModule;
359 Int_t mNValidModules;
361 static Int_t
const mY03TrayIndex = 83;
363 static Bool_t mDebug;
366 static const char*
const trayPref ;
367 static const char*
const senPref ;
377 const char* title=
"Simplified Tofr Geometry");
383 Bool_t IsBSEC(
const TVolume* element)
const
384 {
return !(strcmp(element->GetName(),
sectorPref)); }
385 Bool_t IsBTRA(
const TVolume* element)
const
386 {
return !(strcmp(element->GetName(), trayPref)); }
387 Bool_t IsBRMD(
const TVolume* element)
const
388 {
return !(strcmp(element->GetName(), senPref)); }
390 Bool_t ContainOthers(
TVolume *element);
392 static Bool_t LackThis(
const char* fromWhere);
394 static void DebugOn() { mDebug = kTRUE; }
395 static void DebugOff() { mDebug = kFALSE; }
396 static Bool_t IsDebugOn() {
return mDebug; }
402 void InitFromStar(
TVolume *starHall);
405 Bool_t IsInitDone()
const {
return mInitFlag; }
406 Bool_t IsCellValid(
const Int_t icell)
const;
407 Bool_t IsSensorValid(
const Int_t imodule)
const;
408 Bool_t IsTrayValid(
const Int_t itray)
const;
410 Int_t CalcCellId(
const Int_t volumeId,
const Double_t* local)
const;
411 Int_t CalcCellId(
const Int_t volumeId,
const Float_t* local)
const;
412 Int_t CalcSensorId(
const Int_t imodule,
const Int_t itray=0)
const;
413 Int_t PrevCellId(
const Int_t cellId)
const;
414 Int_t NextCellId(
const Int_t cellId)
const;
417 Int_t CalcCellId(
const Int_t icell,
const Int_t imodule,
418 const Int_t itray=0)
const;
419 void DecodeVolumeId(
const Int_t volumeId,
420 Int_t &imodule, Int_t &itray)
const;
421 Bool_t DecodeSensorId(
const Int_t sensorId, Int_t &imodule,
423 Bool_t DecodeCellId(
const Int_t cellId, Int_t &icell,
424 Int_t &imodule, Int_t &itray)
const;
425 Int_t GetCellIndex(
const Int_t cellId)
const;
427 Int_t CellsInModule(
const Int_t imodule=0,
const Int_t itray=0)
const
428 {
return StTofrGeomSensor::GetCells(); }
429 Int_t ModulesInTray(
const Int_t itray=0)
const
430 {
return mModulesInTray; }
431 Int_t Trays()
const {
return mTrays; }
433 const char* GeoRootFile() {
return mRootFile; }
434 virtual void Print(Option_t *opt=
"")
const ;
436 TVolumeView* GetTopNode()
const {
return mTopNode; }
439 const Int_t itray=0)
const;
442 Int_t GetAtOfTray(
const Int_t itray=0)
const;
446 Bool_t HelixCrossCellIds(
const StHelixD &helix, IntVec &idVec,
447 DoubleVec &pathVec, PointVec &crossVec)
const;
448 Bool_t HelixCrossCellIds(
const StHelixD &helix, IntVec validModuleVec, IntVec projTrayVec, IntVec &idVec, DoubleVec &pathVec, PointVec &crossVec)
const;
449 Bool_t HelixCross(
const StHelixD &helix)
const;
450 Bool_t HelixCross(
const StHelixD &helix, IntVec validModuleVec, IntVec projTrayVec)
const;
451 Bool_t projTrayVector(
const StHelixD &helix, IntVec &trayVec)
const;
458 #endif //end of STTOFRGEOMETRY_H
static const char *const sectorPref
Control message printing of this class.
void CreateGeomCells()
Control message printing of this class.
Int_t mSectorsInBTOH
the root file of geometry