FairRoot/PandaRoot
Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
PndMdtIGeometry Class Reference

#include <PndMdtIGeometry.h>

Inheritance diagram for PndMdtIGeometry:

Classes

struct  InfoType
 
struct  LayerBoundary
 

Public Member Functions

 PndMdtIGeometry ()
 
 ~PndMdtIGeometry ()
 
void SetVerbose (Int_t _v)
 
void AddSensor (TString _v)
 
Bool_t Init ()
 
Bool_t GetTubeCenter (Int_t iDetId, TVector3 &pos) const
 
Bool_t GetTubeLength (Int_t iDetId, Double_t &len) const
 
Bool_t GetStripLength (Int_t iDetId, Double_t &len) const
 
Bool_t GetStripCenter (Int_t iDetId, TVector3 &pos) const
 
Bool_t GetLayerBoundary (Int_t iLayer, TVector3 &LBPos, TVector3 &RTPos) const
 
Bool_t MasterToLocal (Int_t iDetId, TVector3 &master, TVector3 &local)
 
Bool_t MapWireToStrip (Int_t iDetId, const TVector3 &fEntryPos, Int_t &fStripDetID)
 
void Print () const
 

Static Public Member Functions

static PndMdtIGeometryInstance ()
 

Private Types

typedef std::map< Int_t,
LayerBoundary >::iterator 
LayerInfoMapIter
 
typedef std::pair< Int_t,
LayerBoundary
LayerInfoMapValue
 

Private Member Functions

Bool_t FindSensorinPath (TString path)
 
void LoadGeometry (TGeoNode *node)
 
Bool_t GetStripInfo ()
 
Bool_t GetGeometryInfoV2 (const TString &fFullPath, const TString &Name)
 
void InsertLayerInfo (Int_t layerID, const TVector3 &pos, const TVector3 &lwh)
 
Bool_t AddTubeInfo (Int_t detID, const TVector3 &center, Double_t wirelen, TGeoMatrix *matrix)
 
Bool_t AddStripInfo (Int_t detID, TVector3 stripPos, Double_t stripLen, TGeoMatrix *matrix=0)
 
Bool_t AddMatrix (Int_t layerID, TGeoMatrix *matrix)
 
 ClassDef (PndMdtIGeometry, 1)
 

Private Attributes

std::set< TStringfSensorSet
 
Int_t fVerbose
 
Bool_t fGoodGeometry
 
TString fStateTip
 
std::map< Int_t, InfoTypefGeoMap
 
std::map< Int_t, TGeoMatrix * > fMatrixMap
 
std::map< Int_t, LayerBoundaryfLayerInfoMap
 
Int_t fBarrelVersion
 
Int_t fEndcapVersion
 
Int_t fForwardVersion
 
Int_t fMuonFilterVersion
 
Int_t fNumofMdt
 
Int_t fNumofStrip
 
Bool_t fInitialized
 

Static Private Attributes

static PndMdtIGeometryfInstance = 0
 

Detailed Description

Definition at line 18 of file PndMdtIGeometry.h.

Member Typedef Documentation

typedef std::map<Int_t, LayerBoundary>::iterator PndMdtIGeometry::LayerInfoMapIter
private

Definition at line 158 of file PndMdtIGeometry.h.

typedef std::pair<Int_t, LayerBoundary> PndMdtIGeometry::LayerInfoMapValue
private

Definition at line 159 of file PndMdtIGeometry.h.

Constructor & Destructor Documentation

PndMdtIGeometry::PndMdtIGeometry ( )

Default constructor

Definition at line 36 of file PndMdtIGeometry.cxx.

References fBarrelVersion, fEndcapVersion, fForwardVersion, fGoodGeometry, fInitialized, fMuonFilterVersion, fNumofMdt, fNumofStrip, fStateTip, and fVerbose.

Referenced by Instance().

37  : TNamed("PndMdtIGeometry", "parameterized simulation of MDT")
38 {
39  fNumofMdt = 0;
40  fNumofStrip = 0;
41  fVerbose = 0;
42  fGoodGeometry = kFALSE;
43  fStateTip = "Success";
45  fInitialized = kFALSE;
46 }
PndMdtIGeometry::~PndMdtIGeometry ( )

Destructor

Definition at line 47 of file PndMdtIGeometry.cxx.

References fGeoMap, and fLayerInfoMap.

48 {
49  //fWirePosMap.clear();
50  //fWireLengthMap.clear();
51  //fStripPosMap.clear();
52  //fStripLengthMap.clear();
53  fGeoMap.clear();
54  fLayerInfoMap.clear();
55 }
std::map< Int_t, InfoType > fGeoMap
std::map< Int_t, LayerBoundary > fLayerInfoMap

Member Function Documentation

Bool_t PndMdtIGeometry::AddMatrix ( Int_t  layerID,
TGeoMatrix *  matrix 
)
private

Definition at line 335 of file PndMdtIGeometry.cxx.

References fMatrixMap, and fVerbose.

Referenced by GetGeometryInfoV2().

336 {
337  if(fMatrixMap.find(layerID) == fMatrixMap.end()){
338  if(fVerbose>1)
339  cout <<"PndMdtIGeometry::AddMatrix(), MDT layer ID#"<<layerID<<" insert"<<endl;
340  fMatrixMap.insert(std::pair<Int_t, TGeoMatrix*>(layerID, matrix));
341  }
342  return kTRUE;
343 }
std::map< Int_t, TGeoMatrix * > fMatrixMap
void PndMdtIGeometry::AddSensor ( TString  _v)
inline

Definition at line 30 of file PndMdtIGeometry.h.

References fSensorSet.

Referenced by PndMdtDigitization::Init(), and PndMdtPointsToWaveform::Init().

30 { fSensorSet.insert(_v); }
std::set< TString > fSensorSet
Bool_t PndMdtIGeometry::AddStripInfo ( Int_t  detID,
TVector3  stripPos,
Double_t  stripLen,
TGeoMatrix *  matrix = 0 
)
private

Definition at line 364 of file PndMdtIGeometry.cxx.

References fGeoMap, fStateTip, fVerbose, PndMdtIGeometry::InfoType::Length, PndMdtIGeometry::InfoType::Matrix, and PndMdtIGeometry::InfoType::Position.

Referenced by GetStripInfo().

365 {
366  if(fGeoMap.find(detID) != fGeoMap.end()){
367  fStateTip = "AddStripInfo:: detID not unique";
368  cout << "PndMdtIGeometry::"<<fStateTip<<", "<<detID<<endl;;
369  return kFALSE;
370  }else{
371  InfoType _info;
372  _info.Position = stripPos;
373  _info.Length = stripLen;
374  _info.Matrix = matrix;
375  if(fVerbose>1)
376  cout <<"PndMdtIGeometry::AddStripInfo(), MDT detector ID#"<<detID<<" insert"<<endl;
377  fGeoMap.insert(std::pair<Int_t, InfoType>(detID, _info));
378  }
379  return kTRUE;
380 }
std::map< Int_t, InfoType > fGeoMap
Bool_t PndMdtIGeometry::AddTubeInfo ( Int_t  detID,
const TVector3 &  center,
Double_t  wirelen,
TGeoMatrix *  matrix 
)
private

Definition at line 344 of file PndMdtIGeometry.cxx.

References CAMath::Abs(), fGeoMap, fStateTip, fVerbose, PndMdtIGeometry::InfoType::Length, PndMdtIGeometry::InfoType::Matrix, and PndMdtIGeometry::InfoType::Position.

Referenced by GetGeometryInfoV2().

345 {
346  if(fGeoMap.find(detID) != fGeoMap.end()){
347  fStateTip = "AddTubeInfo:: detID not unique";
348  cout << "PndMdtIGeometry::"<<fStateTip<<", "<<detID<<endl;;
349  return kFALSE;
350  }else{
351  InfoType _info;
352  _info.Position = center;
353  if(TMath::Abs(_info.Position.X()) < 1.e-8) _info.Position.SetX(0.);
354  if(TMath::Abs(_info.Position.Y()) < 1.e-8) _info.Position.SetY(0.);
355  if(TMath::Abs(_info.Position.Z()) < 1.e-8) _info.Position.SetZ(0.);
356  _info.Length = wirelen;
357  _info.Matrix = matrix;
358  if(fVerbose>1)
359  cout <<"PndMdtIGeometry::AddTubeInfo(), MDT detector ID#"<<detID<<" insert"<<endl;
360  fGeoMap.insert(std::pair<Int_t, InfoType>(detID, _info));
361  }
362  return kTRUE;
363 }
std::map< Int_t, InfoType > fGeoMap
static T Abs(const T &x)
Definition: PndCAMath.h:39
PndMdtIGeometry::ClassDef ( PndMdtIGeometry  ,
 
)
private
Bool_t PndMdtIGeometry::FindSensorinPath ( TString  path)
inlineprivate

Definition at line 119 of file PndMdtIGeometry.h.

References Bool_t.

Referenced by LoadGeometry().

119  {
120  Bool_t ret=kFALSE;
121  std::set<TString>::iterator it = fSensorSet.begin();
122  std::set<TString>::iterator end = fSensorSet.end();
123  while(it != end){
124  if(path.Contains(*it)) { ret = kTRUE; break; }
125  ++ it;
126  }
127  return ret;
128  }
std::set< TString > fSensorSet
Bool_t PndMdtIGeometry::GetGeometryInfoV2 ( const TString fFullPath,
const TString Name 
)
private

Definition at line 248 of file PndMdtIGeometry.cxx.

References AddMatrix(), AddTubeInfo(), Bool_t, Double_t, fBarrelVersion, fEndcapVersion, fForwardVersion, fMuonFilterVersion, fStateTip, fVerbose, gGeoManager, PndMdtID::Identifier(), InsertLayerInfo(), and PndMdtID::LayerID().

Referenced by LoadGeometry().

249 {
250  Int_t iMod(-1);
251  Int_t iSec(-1);
252  Int_t iSec1(-1);//for barrel special section
253  Int_t iLayer(-1);
254  Int_t iLayer1(-1);
255  Int_t iBox(-1);
256  Int_t iWire(-1);
257  Bool_t isSucc;
258  //read this tube information
259  isSucc = gGeoManager->cd(fFullPath.Data());
260  if(isSucc){
261  Int_t iholder;
262  if(fFullPath.BeginsWith("cave_1/Mdt_1/")){
264  sscanf(Name.Data(),"MDT%is%il%ib%iw%i_%i", &iMod, &iSec, &iLayer, &iBox, &iWire, &iWire);
265  }
266  else if(fFullPath.BeginsWith("cave_1/Mdt")){
267  if(fFullPath.Contains("MdtBarrel")){//
268  fBarrelVersion = 1;
269  sscanf(fFullPath.Data(),"cave_1/MdtBarrel_0/MdtBarrelOct%i_%i/MdtBarrelOct%iLayer%i_%i/BP%is%il%ib%iw%i_%i/BA%i_%i/MDT%is%il%ib%iw%i_%i"
270  , &iSec1, &iSec, &iholder
271  , &iLayer, &iLayer1
272  , &iMod, &iholder, &iholder, &iBox, &iholder, &iholder
273  , &iholder, &iholder
274  , &iholder, &iholder, &iholder, &iholder, &iholder, &iWire);
275  }else if(fFullPath.Contains("MdtEndcap")){
276  fEndcapVersion = 1;
277  sscanf(fFullPath.Data(),"cave_1/MdtEndcap_0/MdtEndcapLayer%i_%i/BP%is%il%ib%iw%i_%i/BA%i_%i/MDT%is%il%ib%iw%i_%i"
278  , &iLayer1, &iLayer //MdtEndcapLayer ...
279  , &iMod, &iSec, &iholder, &iholder, &iholder, &iBox//BP...
280  , &iholder, &iholder //BA ...
281  , &iholder, &iholder, &iholder, &iholder, &iholder, &iWire);//MDT ...
282  }else if(fFullPath.Contains("MdtMF")){
283  fMuonFilterVersion = 1;
284  sscanf(fFullPath.Data(),"cave_1/MdtMF_0/MdtMFLayer%i_%i/BP%is%il%ib%iw%i_%i/BA%i_%i/MDT%is%il%ib%iw%i_%i"
285  , &iLayer1, &iLayer
286  , &iMod, &iSec, &iholder, &iBox, &iholder, &iholder
287  , &iholder, &iholder
288  , &iholder, &iholder, &iholder, &iholder, &iholder, &iWire);
289  }else if(fFullPath.Contains("MdtForward")){
290  fForwardVersion = 1;
291  sscanf(fFullPath.Data(),"cave_1/MdtForward_0/MdtForwardLayer%i_%i/BP%is%il%ib%iw%i_%i/BA%i_%i/MDT%is%il%ib%iw%i_%i"
292  , &iLayer1, &iLayer
293  , &iMod, &iSec, &iholder, &iBox, &iholder, &iholder
294  , &iholder, &iholder
295  , &iholder, &iholder, &iholder, &iholder, &iholder, &iWire);
296  }else{
297  cout<<"PndMdtIGeometry::GetGeometryInfoV2, Unknown geometry pattern."<<endl;
298  }
299  }
300  else if(fFullPath.BeginsWith("cave_1/Mdt")){
302  sscanf(Name.Data(),"MDT%is%il%ib%iw%i_%i", &iMod, &iSec, &iLayer, &iBox, &iWire, &iWire);
303  }else {
304  cout<<"PndMdtIGeometry::GetGeometryInfoV2, Unknown geometry pattern."<<endl;
305  }
306  TVector3 itsPos(0,0,0);
307  TGeoBBox* theShape = (TGeoBBox*)gGeoManager->GetCurrentVolume()->GetShape();
308  TVector3 itsOrigin(theShape->GetOrigin());
309  gGeoManager->LocalToMaster(&itsOrigin[0], &itsPos[0]);
310  TVector3 itsLWH(theShape->GetDX(), theShape->GetDY(), theShape->GetDZ());
311  Double_t wirelen ;
312  if( iMod == 1 ) wirelen = 2.*itsLWH.Z() ;
313  else if(iMod == 2 && iLayer < 2) wirelen = 2.*itsLWH.X();
314  else wirelen = 2.*itsLWH.Y();
315 
316  if(fVerbose > 2){
317  cout<<fFullPath<<endl;
318  cout<<"("<<iMod<<", "<<iSec<<", "<<iLayer<<", "<<iBox<<", "<<iWire<<")" <<itsPos<<", "<<itsLWH<<endl;
319  }
320 
321  TGeoMatrix* matrix = gGeoManager->GetCurrentMatrix()->MakeClone();
322  Int_t detID = PndMdtID::Identifier(iMod, iSec, iLayer, iBox, iWire);
323  isSucc = AddTubeInfo(detID, itsPos, wirelen, matrix);
324  //
325  Int_t layerID = PndMdtID::LayerID(iMod, iSec, iLayer);
326  InsertLayerInfo(layerID, itsPos, itsLWH);
327 
328  AddMatrix(layerID, matrix);
329  }else{
330  fStateTip = "gGeoManager:: nonexisted path";
331  cerr<< "PndMdtIGeometry::GetGeometryInfoV2, "<<fStateTip<<endl;;
332  }
333  return isSucc;
334 }
static Int_t LayerID(Int_t iMod, Int_t iOct, Int_t iLayer)
Definition: PndMdtID.h:16
TGeoManager * gGeoManager
Bool_t AddTubeInfo(Int_t detID, const TVector3 &center, Double_t wirelen, TGeoMatrix *matrix)
static Int_t Identifier(Int_t iMod, Int_t iOct, Int_t iLayer, Int_t iBox, Int_t iWire)
Definition: PndMdtID.h:10
Double_t
void InsertLayerInfo(Int_t layerID, const TVector3 &pos, const TVector3 &lwh)
Bool_t AddMatrix(Int_t layerID, TGeoMatrix *matrix)
Bool_t PndMdtIGeometry::GetLayerBoundary ( Int_t  iLayer,
TVector3 &  LBPos,
TVector3 &  RTPos 
) const
inline

Definition at line 70 of file PndMdtIGeometry.h.

References fLayerInfoMap.

70  {
71  std::map<Int_t, LayerBoundary>::const_iterator it = fLayerInfoMap.find(iLayer);
72  if( it == fLayerInfoMap.end())
73  return kFALSE;
74  LBPos = TVector3(it->second.minX, it->second.minY, it->second.minZ);
75  RTPos = TVector3(it->second.maxX, it->second.maxY, it->second.maxZ);
76  return kTRUE;
77  }
std::map< Int_t, LayerBoundary > fLayerInfoMap
Bool_t PndMdtIGeometry::GetStripCenter ( Int_t  iDetId,
TVector3 &  pos 
) const
inline

Definition at line 62 of file PndMdtIGeometry.h.

References fGeoMap.

Referenced by PndMdtDigitization::exec_e(), and PndMdtDigitization::exec_t().

63  {
64  std::map<Int_t, InfoType>::const_iterator it = fGeoMap.find(iDetId);
65  if( it == fGeoMap.end())
66  return kFALSE;
67  pos = it->second.Position;
68  return kTRUE;
69  }
TVector3 pos
std::map< Int_t, InfoType > fGeoMap
Bool_t PndMdtIGeometry::GetStripInfo ( )
private

Definition at line 145 of file PndMdtIGeometry.cxx.

References CAMath::Abs(), AddStripInfo(), Bool_t, CAMath::Cos(), cx, cy, Double_t, dx, dy, dz, fLayerInfoMap, fNumofStrip, fStateTip, fVerbose, PndMdtID::Identifier(), PndMdtID::Layer(), PndMdtIGeometry::LayerBoundary::maxX, PndMdtIGeometry::LayerBoundary::maxY, PndMdtIGeometry::LayerBoundary::maxZ, PndMdtIGeometry::LayerBoundary::minX, PndMdtIGeometry::LayerBoundary::minY, PndMdtIGeometry::LayerBoundary::minZ, PndMdtID::Module(), Pi, PndMdtID::Sector(), and CAMath::Sin().

Referenced by Init().

146 {
147  static const Double_t cGAPOFBOXANDSTRIP = 0.1;//cent meter
148  static const Double_t cSTRIPWIDTH = 1.; //cent meter;
149  static const Double_t cSTRIPTHICKNESS = 0.20;//cent menter
150  static const Double_t cGAPOFSTRIPS = 0.0;//cent meter;
151 
152  fStateTip = " GetStripInfo:: place strips on ";
153  fStateTip += fLayerInfoMap.size();
154  fStateTip += " layers.";
155  LayerInfoMapIter it = fLayerInfoMap.begin();
156  LayerInfoMapIter end = fLayerInfoMap.end();
157  Double_t mStripZPos;
158  Double_t mStripXPos;
159  Double_t mStripLen;
160  Double_t mDiffX;
161  Double_t mDiffY;
162  Int_t stripNO = 0;
163  Bool_t isSucc = kTRUE;
164  for(; it != end; ++it)
165  {
166  stripNO = 0;
167  Int_t layerID = it->first;
168  LayerBoundary& theBoundary = it->second;
169  Int_t mod = PndMdtID::Module(layerID);
170  Int_t sec = PndMdtID::Sector(layerID);
171  Int_t layer = PndMdtID::Layer(layerID);
172  //put strip
173  if(mod == 1)
174  {//barrel, left angle = 0
175  Double_t zPos = theBoundary.minZ;
176  while( zPos < theBoundary.maxZ)
177  {
178  mStripZPos= zPos + 0.5*cSTRIPWIDTH;
179  zPos += (cSTRIPWIDTH + cGAPOFSTRIPS);
180  mDiffY = theBoundary.maxY - theBoundary.minY;
181  mDiffX = theBoundary.maxX - theBoundary.minX;
182  Double_t cx = 0.5*(theBoundary.minX + theBoundary.maxX);
183  Double_t cy = 0.5*(theBoundary.minY + theBoundary.maxY);
184  mStripLen = TMath::Abs(mDiffX*TMath::Cos(sec*TMath::Pi()/4.)) + TMath::Abs(mDiffY*TMath::Sin(sec*TMath::Pi()/4.));
185  Double_t dx = TMath::Abs((cGAPOFBOXANDSTRIP + 0.5*cSTRIPTHICKNESS + 0.5)*TMath::Cos(sec*TMath::Pi()/4.));
186  Double_t dy = TMath::Abs((cGAPOFBOXANDSTRIP + 0.5*cSTRIPTHICKNESS + 0.5)*TMath::Sin(sec*TMath::Pi()/4.));
187  isSucc = AddStripInfo(PndMdtID::Identifier(mod, sec, layer, stripNO), TVector3(cx+dx,cy+dy,mStripZPos), mStripLen);
188  if(!isSucc) return kFALSE;
189  ++ stripNO;
190  }
191  }else if(mod == 2)//endcap
192  {
193  if(layer < 3){//layer start from 1
194  Double_t xPos = theBoundary.minY;
195  while( xPos < theBoundary.maxY)
196  {
197  mStripXPos= xPos + 0.5*cSTRIPWIDTH;
198  xPos += (cSTRIPWIDTH + cGAPOFSTRIPS);
199  mStripLen = theBoundary.maxX - theBoundary.minX;
200  Double_t cx = 0.5*(theBoundary.minX + theBoundary.maxX);
201  Double_t cz = 0.5*(theBoundary.minZ + theBoundary.maxZ);
202  Double_t dz = (cGAPOFBOXANDSTRIP + 0.5*cSTRIPTHICKNESS + 0.5);
203  isSucc = AddStripInfo(PndMdtID::Identifier(mod, sec, layer, stripNO), TVector3(cx, mStripXPos, cz+dz), mStripLen);
204  if(!isSucc) return kFALSE;
205  ++ stripNO;
206  }
207  }else{
208  Double_t xPos = theBoundary.minX;
209  while( xPos < theBoundary.maxX)
210  {
211  mStripXPos= xPos + 0.5*cSTRIPWIDTH;
212  xPos += (cSTRIPWIDTH + cGAPOFSTRIPS);
213  mStripLen = theBoundary.maxY - theBoundary.minY;
214  Double_t cy = 0.5*(theBoundary.minY + theBoundary.maxY);
215  Double_t cz = 0.5*(theBoundary.minZ + theBoundary.maxZ);
216  Double_t dz = (cGAPOFBOXANDSTRIP + 0.5*cSTRIPTHICKNESS + 0.5);
217  isSucc = AddStripInfo(PndMdtID::Identifier(mod, sec, layer, stripNO), TVector3(mStripXPos, cy, cz+dz), mStripLen);
218  if(!isSucc) return kFALSE;
219  ++ stripNO;
220  }
221  }
222  }
223  else
224  {
225  Double_t xPos = theBoundary.minX;
226  while( xPos < theBoundary.maxX)
227  {
228  mStripXPos= xPos + 0.5*cSTRIPWIDTH;
229  xPos += (cSTRIPWIDTH + cGAPOFSTRIPS);
230  mStripLen = theBoundary.maxY - theBoundary.minY;
231  Double_t cy = 0.5*(theBoundary.minY + theBoundary.maxY);
232  Double_t cz = 0.5*(theBoundary.minZ + theBoundary.maxZ);
233  Double_t dz = (cGAPOFBOXANDSTRIP + 0.5*cSTRIPTHICKNESS + 0.5);
234  isSucc = AddStripInfo(PndMdtID::Identifier(mod, sec, layer, stripNO), TVector3(mStripXPos, cy, cz+dz), mStripLen);
235  if(!isSucc) return kFALSE;
236  ++ stripNO;
237  }
238  }
239  if(fVerbose>2)
240  cout<<"layer ID #"<<layerID<<", mod#"<<mod<<", sec#"<<sec<<", layer#"<<layer
241  <<", X#"<<theBoundary.minX<<", "<<theBoundary.maxX
242  <<", Y#"<<theBoundary.minY<<", "<<theBoundary.maxY
243  <<", Z#"<<theBoundary.minZ<<", "<<theBoundary.maxZ<<", "<<stripNO<<" strips."<<endl;
244  fNumofStrip += stripNO;
245  }
246  return kTRUE;
247 }
double dy
static Short_t Module(Int_t detID)
Definition: PndMdtID.h:20
static Short_t Layer(Int_t detID)
Definition: PndMdtID.h:22
static T Sin(const T &x)
Definition: PndCAMath.h:42
Bool_t AddStripInfo(Int_t detID, TVector3 stripPos, Double_t stripLen, TGeoMatrix *matrix=0)
static T Cos(const T &x)
Definition: PndCAMath.h:43
static Int_t Identifier(Int_t iMod, Int_t iOct, Int_t iLayer, Int_t iBox, Int_t iWire)
Definition: PndMdtID.h:10
static T Abs(const T &x)
Definition: PndCAMath.h:39
static Short_t Sector(Int_t detID)
Definition: PndMdtID.h:21
Double_t
double dx
int cy
Definition: dedx_bands.C:17
std::map< Int_t, LayerBoundary >::iterator LayerInfoMapIter
int cx
Definition: dedx_bands.C:16
Double_t Pi
std::map< Int_t, LayerBoundary > fLayerInfoMap
Bool_t PndMdtIGeometry::GetStripLength ( Int_t  iDetId,
Double_t len 
) const
inline

Definition at line 54 of file PndMdtIGeometry.h.

References fGeoMap.

55  {
56  std::map<Int_t, InfoType>::const_iterator it = fGeoMap.find(iDetId);
57  if( it == fGeoMap.end())
58  return kFALSE;
59  len = it->second.Length;
60  return kTRUE;
61  }
std::map< Int_t, InfoType > fGeoMap
Bool_t PndMdtIGeometry::GetTubeCenter ( Int_t  iDetId,
TVector3 &  pos 
) const
inline

Definition at line 36 of file PndMdtIGeometry.h.

References fGeoMap.

Referenced by PndMdtDigitization::exec_e(), and PndMdtDigitization::exec_t().

37  {
38  std::map<Int_t, InfoType>::const_iterator it = fGeoMap.find(iDetId);
39  if( it == fGeoMap.end())
40  return kFALSE;
41  pos = it->second.Position;
42  return kTRUE;
43  }
TVector3 pos
std::map< Int_t, InfoType > fGeoMap
Bool_t PndMdtIGeometry::GetTubeLength ( Int_t  iDetId,
Double_t len 
) const
inline

Definition at line 45 of file PndMdtIGeometry.h.

References fGeoMap.

46  {
47  std::map<Int_t, InfoType>::const_iterator it = fGeoMap.find(iDetId);
48  if( it == fGeoMap.end())
49  return kFALSE;
50  len = it->second.Length;
51  return kTRUE;
52  }
std::map< Int_t, InfoType > fGeoMap
Bool_t PndMdtIGeometry::Init ( )

Definition at line 57 of file PndMdtIGeometry.cxx.

References fBarrelVersion, fEndcapVersion, fForwardVersion, fGoodGeometry, fInitialized, fMuonFilterVersion, fNumofMdt, fNumofStrip, fStateTip, fVerbose, GetStripInfo(), gGeoManager, and LoadGeometry().

Referenced by PndMdtDigitization::Init(), and PndMdtPointsToWaveform::Init().

58 {
59  if(!fInitialized){
60  fInitialized = kTRUE;
61  TGeoVolume* fTopVol = gGeoManager->GetTopVolume();
62  TGeoNode* fTopNode = gGeoManager->GetTopNode();
63  fGoodGeometry = kFALSE;
64  LoadGeometry(fTopNode);
65  if(fGoodGeometry){
67  }
68  if(fVerbose>0){
69  cout<<"========================================================================="<<endl;
70  cout<<"PndMdtIGeometry::Init(), information of MDT geometry version, \n"
71  <<"\tBarrel #"<<fBarrelVersion<<endl
72  <<"\tEndcap #"<<fEndcapVersion<<endl
73  <<"\tForward #"<<fForwardVersion<<endl
74  <<"\tFilter #"<<fMuonFilterVersion<<endl;
75  cout<<"ROOT Geometry, top volume name#"<<fTopVol->GetName()<<", top node name#"<<fTopNode->GetName()<<endl;
76  cout<<"State :"<<fStateTip<<endl;
77  cout<<(fGoodGeometry?"Succeed to" : "Fail to ")<<" load in "<<fNumofMdt<<" tubes, "<<fNumofStrip<<" strips."<<endl;
78  cout<<"========================================================================="<<endl;
79  }
80  }
81  return fGoodGeometry;
82 }
TGeoManager * gGeoManager
void LoadGeometry(TGeoNode *node)
void PndMdtIGeometry::InsertLayerInfo ( Int_t  layerID,
const TVector3 &  pos,
const TVector3 &  lwh 
)
private

Definition at line 120 of file PndMdtIGeometry.cxx.

References fLayerInfoMap, PndMdtIGeometry::LayerBoundary::maxX, PndMdtIGeometry::LayerBoundary::maxY, PndMdtIGeometry::LayerBoundary::maxZ, PndMdtIGeometry::LayerBoundary::minX, PndMdtIGeometry::LayerBoundary::minY, and PndMdtIGeometry::LayerBoundary::minZ.

Referenced by GetGeometryInfoV2().

121 {
122  LayerInfoMapIter it = fLayerInfoMap.find(layerID);
123  TVector3 pos1 = pos - lwh;
124  TVector3 pos2 = pos + lwh;
125  if( it == fLayerInfoMap.end())
126  {
127  LayerBoundary aLayerBound;
128  aLayerBound.minX = pos1.X();
129  aLayerBound.minY = pos1.Y();
130  aLayerBound.minZ = pos1.Z();
131  aLayerBound.maxX = pos2.X();
132  aLayerBound.maxY = pos2.Y();
133  aLayerBound.maxZ = pos2.Z();
134  fLayerInfoMap.insert(LayerInfoMapValue(layerID, aLayerBound));
135  }else{
136  LayerBoundary& aLayerBound = it->second;
137  if(pos1.X() < aLayerBound.minX) aLayerBound.minX = pos1.X();
138  if(pos1.Y() < aLayerBound.minY) aLayerBound.minY = pos1.Y();
139  if(pos1.Z() < aLayerBound.minZ) aLayerBound.minZ = pos1.Z();
140  if(pos2.X() > aLayerBound.maxX) aLayerBound.maxX = pos2.X();
141  if(pos2.Y() > aLayerBound.maxY) aLayerBound.maxY = pos2.Y();
142  if(pos2.Z() > aLayerBound.maxZ) aLayerBound.maxZ = pos2.Z();
143  }
144 }
TVector3 pos
std::pair< Int_t, LayerBoundary > LayerInfoMapValue
std::map< Int_t, LayerBoundary >::iterator LayerInfoMapIter
std::map< Int_t, LayerBoundary > fLayerInfoMap
PndMdtIGeometry * PndMdtIGeometry::Instance ( )
static

Definition at line 30 of file PndMdtIGeometry.cxx.

References fInstance, and PndMdtIGeometry().

Referenced by PndMdtDigitization::Init(), and PndMdtPointsToWaveform::Init().

31 {
32  if(!fInstance) fInstance = new PndMdtIGeometry();
33  return fInstance;
34 }
static PndMdtIGeometry * fInstance
void PndMdtIGeometry::LoadGeometry ( TGeoNode *  node)
private

Definition at line 92 of file PndMdtIGeometry.cxx.

References fGoodGeometry, FindSensorinPath(), fNumofMdt, GetGeometryInfoV2(), i, name, and TString.

Referenced by Init().

93 {
94  static std::list<TString> stackPath;
95  TString name(node->GetName());
96  stackPath.push_back(name);
97  fGoodGeometry = kTRUE;
98  if(node->GetNdaughters() > 0)
99  {
100  Int_t nd = node->GetNdaughters();
101  for (Int_t i=0; i<nd; i++) {
102  TGeoNode* theNode = node->GetDaughter(i);
103  if(fGoodGeometry)
104  LoadGeometry(theNode);
105  }
106  }else{
107  //if(name.Contains("MDT"))
109  {
110  ++fNumofMdt;
111  TString fFullPath;
112  for_each(stackPath.begin(), stackPath.end(), shadow::FullPathConverter(fFullPath));
113  fFullPath.Remove(fFullPath.Length()-1);
114  fGoodGeometry = GetGeometryInfoV2(fFullPath, stackPath.back());
115  }
116  }
117  stackPath.pop_back();
118 }
Int_t i
Definition: run_full.C:25
void LoadGeometry(TGeoNode *node)
Bool_t FindSensorinPath(TString path)
TString name
Bool_t GetGeometryInfoV2(const TString &fFullPath, const TString &Name)
Bool_t PndMdtIGeometry::MapWireToStrip ( Int_t  iDetId,
const TVector3 &  fEntryPos,
Int_t &  fStripDetID 
)
inline

Definition at line 93 of file PndMdtIGeometry.h.

References Double_t, fLayerInfoMap, PndMdtID::Identifier(), PndMdtID::Layer(), PndMdtID::LayerID(), PndMdtID::Module(), and PndMdtID::Sector().

Referenced by PndMdtPointsToWaveform::exec_e(), and PndMdtPointsToWaveform::exec_t().

93  {
94  static const Double_t cSTRIPWIDTH = 1.; //cent meter;
95  static const Double_t cGAPOFSTRIPS = 0.0;//cent meter;
96  Short_t iMod = PndMdtID::Module(iDetId);
97  Short_t iSec = PndMdtID::Sector(iDetId);
98  Short_t iLayer = PndMdtID::Layer(iDetId);
99  Int_t layerID = PndMdtID::LayerID(iMod, iSec, iLayer);
100  LayerInfoMapIter it = fLayerInfoMap.find(layerID);
101  if( it == fLayerInfoMap.end()) return kFALSE;
102  Int_t fStripNo;
103  if(iMod == 1)
104  fStripNo = (fEntryPos.Z() - it->second.minZ)/(cSTRIPWIDTH + cGAPOFSTRIPS);
105  else if(iMod ==2)//endcap
106  {
107  if(iLayer < 2)
108  fStripNo = (fEntryPos.Y() - it->second.minY)/(cSTRIPWIDTH + cGAPOFSTRIPS);
109  else
110  fStripNo = (fEntryPos.X() - it->second.minX)/(cSTRIPWIDTH + cGAPOFSTRIPS);
111  }else
112  fStripNo = (fEntryPos.X() - it->second.minX)/(cSTRIPWIDTH + cGAPOFSTRIPS);
113  fStripDetID = PndMdtID::Identifier(iMod, iSec, iLayer, fStripNo);
114  return kTRUE;
115  }
static Short_t Module(Int_t detID)
Definition: PndMdtID.h:20
static Short_t Layer(Int_t detID)
Definition: PndMdtID.h:22
static Int_t LayerID(Int_t iMod, Int_t iOct, Int_t iLayer)
Definition: PndMdtID.h:16
static Int_t Identifier(Int_t iMod, Int_t iOct, Int_t iLayer, Int_t iBox, Int_t iWire)
Definition: PndMdtID.h:10
static Short_t Sector(Int_t detID)
Definition: PndMdtID.h:21
Double_t
std::map< Int_t, LayerBoundary >::iterator LayerInfoMapIter
std::map< Int_t, LayerBoundary > fLayerInfoMap
Bool_t PndMdtIGeometry::MasterToLocal ( Int_t  iDetId,
TVector3 &  master,
TVector3 &  local 
)
inline

Definition at line 78 of file PndMdtIGeometry.h.

References fGeoMap.

Referenced by PndMdtPointsToWaveform::exec_e(), and PndMdtPointsToWaveform::exec_t().

79  {
80  std::map<Int_t, InfoType>::const_iterator it = fGeoMap.find(iDetId);
81  if( it == fGeoMap.end())
82  return kFALSE;
83  TVector3 center = it->second.Position;
84  TGeoMatrix* fMtrx = it->second.Matrix;
85  if(!fMtrx) return kFALSE;
86  //fMtrx->Print();
87  //fMtrx->MasterToLocal(&center[0], &local[0]);
88  //std::cout<<"local 1 "<<local<<std::endl;
89  fMtrx->MasterToLocal(&master[0], &local[0]);
90  //std::cout<<"local 2 "<<local<<std::endl;
91  return kTRUE;
92  }
std::map< Int_t, InfoType > fGeoMap
void PndMdtIGeometry::Print ( ) const

Definition at line 381 of file PndMdtIGeometry.cxx.

References PndMdtID::Box(), fGeoMap, PndMdtID::isStrip(), PndMdtID::isWire(), PndMdtID::Layer(), PndMdtID::Module(), out, PndMdtID::Sector(), PndMdtID::Strip(), and PndMdtID::Wire().

Referenced by PndMdtPointsToWaveform::Init().

382 {
383  std::map<Int_t, InfoType>::const_iterator cit = fGeoMap.begin();;
384  std::map<Int_t, InfoType>::const_iterator cend = fGeoMap.end();;
385 
386  std::ofstream ofs1("Tube.map", std::ios::out);
387  ofs1<<"============================================================"<<endl;
388  ofs1<<"==>Tube Placement"<<endl;
389  ofs1<<"============================================================"<<endl;
390  ofs1<<"Mod\t"<<"Sec\t"<<"Layer\t"<<"Box\t"<<"NO.\t"<<"X\t"<<"Y\t"<<"Z\t"<<endl;
391  for(; cit != cend; ++cit){
392  if(PndMdtID::isWire(cit->first))
393  {
394  ofs1<<PndMdtID::Module(cit->first)<<"\t"
395  <<PndMdtID::Sector(cit->first)<<"\t"
396  <<PndMdtID::Layer(cit->first)<<"\t"
397  <<PndMdtID::Box(cit->first)<<"\t"
398  <<PndMdtID::Wire(cit->first)<<"\t"
399  <<cit->second.Position.X()<<"\t"
400  <<cit->second.Position.Y()<<"\t"
401  <<cit->second.Position.Z()<<"\t"<<endl;
402  }
403  }
404  ofs1.close();
405  std::ofstream ofs2("Strip.map", std::ios::out);
406  ofs2<<"============================================================"<<endl;
407  ofs2<<"==>Strip Placement"<<endl;
408  ofs2<<"============================================================"<<endl;
409  ofs2<<"Mod\t"<<"Sec\t"<<"Layer\t"<<"NO.\t"<<"X\t"<<"Y\t"<<"Z\t"<<endl;
410  cit = fGeoMap.begin();;
411  for(; cit != cend; ++cit){
412  if(PndMdtID::isStrip(cit->first))
413  {
414  ofs2<<PndMdtID::Module(cit->first)<<"\t"
415  <<PndMdtID::Sector(cit->first)<<"\t"
416  <<PndMdtID::Layer(cit->first)<<"\t"
417  <<PndMdtID::Strip(cit->first)<<"\t"
418  <<cit->second.Position.X()<<"\t"
419  <<cit->second.Position.Y()<<"\t"
420  <<cit->second.Position.Z()<<"\t"<<endl;
421  }
422  }
423  ofs2.close();
424 }
static Short_t Box(Int_t detID)
Definition: PndMdtID.h:23
static Bool_t isWire(Int_t detID)
Definition: PndMdtID.h:26
static Short_t Module(Int_t detID)
Definition: PndMdtID.h:20
static Short_t Layer(Int_t detID)
Definition: PndMdtID.h:22
std::map< Int_t, InfoType > fGeoMap
static Short_t Sector(Int_t detID)
Definition: PndMdtID.h:21
TFile * out
Definition: reco_muo.C:20
static Short_t Strip(Int_t detID)
Definition: PndMdtID.h:25
static Bool_t isStrip(Int_t detID)
Definition: PndMdtID.h:27
static Short_t Wire(Int_t detID)
Definition: PndMdtID.h:24
void PndMdtIGeometry::SetVerbose ( Int_t  _v)
inline

Definition at line 29 of file PndMdtIGeometry.h.

References fVerbose.

Referenced by PndMdtDigitization::Init(), and PndMdtPointsToWaveform::Init().

29 { fVerbose = _v; }

Member Data Documentation

Int_t PndMdtIGeometry::fBarrelVersion
private

Definition at line 162 of file PndMdtIGeometry.h.

Referenced by GetGeometryInfoV2(), Init(), and PndMdtIGeometry().

Int_t PndMdtIGeometry::fEndcapVersion
private

Definition at line 163 of file PndMdtIGeometry.h.

Referenced by GetGeometryInfoV2(), Init(), and PndMdtIGeometry().

Int_t PndMdtIGeometry::fForwardVersion
private

Definition at line 164 of file PndMdtIGeometry.h.

Referenced by GetGeometryInfoV2(), Init(), and PndMdtIGeometry().

std::map<Int_t, InfoType> PndMdtIGeometry::fGeoMap
private
Bool_t PndMdtIGeometry::fGoodGeometry
private

Definition at line 132 of file PndMdtIGeometry.h.

Referenced by Init(), LoadGeometry(), and PndMdtIGeometry().

Bool_t PndMdtIGeometry::fInitialized
private

Definition at line 168 of file PndMdtIGeometry.h.

Referenced by Init(), and PndMdtIGeometry().

PndMdtIGeometry * PndMdtIGeometry::fInstance = 0
staticprivate

Definition at line 179 of file PndMdtIGeometry.h.

Referenced by Instance().

std::map<Int_t, LayerBoundary> PndMdtIGeometry::fLayerInfoMap
private
std::map<Int_t, TGeoMatrix*> PndMdtIGeometry::fMatrixMap
private

Definition at line 144 of file PndMdtIGeometry.h.

Referenced by AddMatrix().

Int_t PndMdtIGeometry::fMuonFilterVersion
private

Definition at line 165 of file PndMdtIGeometry.h.

Referenced by GetGeometryInfoV2(), Init(), and PndMdtIGeometry().

Int_t PndMdtIGeometry::fNumofMdt
private

Definition at line 166 of file PndMdtIGeometry.h.

Referenced by Init(), LoadGeometry(), and PndMdtIGeometry().

Int_t PndMdtIGeometry::fNumofStrip
private

Definition at line 167 of file PndMdtIGeometry.h.

Referenced by GetStripInfo(), Init(), and PndMdtIGeometry().

std::set<TString> PndMdtIGeometry::fSensorSet
private

Definition at line 118 of file PndMdtIGeometry.h.

Referenced by AddSensor().

TString PndMdtIGeometry::fStateTip
private
Int_t PndMdtIGeometry::fVerbose
private

The documentation for this class was generated from the following files: