FairRoot/PandaRoot
Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
PndSttMapCreator Class Reference

#include <PndSttMapCreator.h>

Inheritance diagram for PndSttMapCreator:

Public Member Functions

 PndSttMapCreator ()
 
 PndSttMapCreator (Int_t geoType)
 
 PndSttMapCreator (PndGeoSttPar *par)
 
 ~PndSttMapCreator ()
 
void SetGeneralParameters ()
 
PndSttTubeParametersCreateTubeParameters (FairGeoNode *pnode)
 
Int_t FillSttTubeParameters (PndGeoSttPar *par, TList *volList)
 
Int_t FillSttTubeParametersType2 (PndGeoSttPar *par)
 
TClonesArray * FillTubeArray ()
 
Int_t GetTubeIDFromName (TString name)
 
PndSttTubeGetTubeFromParametersToFill (PndSttTubeParameters *parms)
 
TString GetPathFromTubeID (Int_t tubeid, Bool_t isCopy)
 
TString GetNameFromPath (TString path)
 
Int_t GetTubeIDFromPath (TString path)
 
PndSttTubeGetTubeFromTubeID (Int_t tubeid)
 
PndSttGeometryMapGetGeometryMap ()
 

Protected Attributes

TClonesArray * fTubeArray
 
PndSttTubefSttTube
 
PndSttGeometryMapfMap
 

Private Member Functions

 PndSttMapCreator (const PndSttMapCreator &L)
 
PndSttMapCreatoroperator= (const PndSttMapCreator &)
 
PndSttTubeParametersCreateTubeParametersGeoType1 (FairGeoNode *pnode)
 
Int_t FillSttTubeParametersGeoType1 (PndGeoSttPar *par, TList *volList)
 
TClonesArray * FillTubeArrayGeoType1 ()
 
TString GetNameFromPathGeoType1 (TString path)
 
Int_t GetTubeIDFromNameGeoType1 (TString name)
 
PndSttTubeGetTubeFromParametersToFillGeoType1 (PndSttTubeParameters *parms)
 
TString GetPathFromTubeIDGeoType1 (Int_t tubeid, Bool_t isCopy)
 
Int_t GetTubeIDFromPathGeoType1 (TString path)
 
PndSttTubeGetTubeFromTubeIDGeoType1 (Int_t tubeid)
 
PndSttTubeParametersCreateTubeParametersGeoType2 (FairGeoNode *pnode)
 
TClonesArray * FillTubeArrayGeoType2 ()
 
TString GetNameFromPathGeoType2 (TString path)
 
Int_t GetTubeIDFromNameGeoType2 (TString name)
 
PndSttTubeGetTubeFromParametersToFillGeoType2 (PndSttTubeParameters *parms)
 
TString GetPathFromTubeIDGeoType2 (Int_t tubeid, Bool_t isCopy)
 
Int_t GetTubeIDFromPathGeoType2 (TString path)
 
PndSttTubeGetTubeFromTubeIDGeoType2 (Int_t tubeid)
 

Private Attributes

Int_t fGeoType
 
PndGeoSttParfSttParameters
 
Double_t fTubeInRad
 
Double_t fTubeOutRad
 
std::map< int, int > copy_map
 

Detailed Description

Definition at line 14 of file PndSttMapCreator.h.

Constructor & Destructor Documentation

PndSttMapCreator::PndSttMapCreator ( )

Definition at line 44 of file PndSttMapCreator.cxx.

45  //copy_map.clear();
46 }
PndSttGeometryMap * fMap
PndSttTube * fSttTube
std::map< int, int > copy_map
PndGeoSttPar * fSttParameters
PndSttMapCreator::PndSttMapCreator ( Int_t  geoType)

Definition at line 49 of file PndSttMapCreator.cxx.

References fGeoType, gGeoManager, and SetGeneralParameters().

49  : fGeoType(geoType), fSttParameters(new PndGeoSttPar()), fTubeInRad(0), fTubeOutRad(0), copy_map(), fSttTube(0), fMap(0) {
50  //copy_map.clear();
51 
52  if(fGeoType > 2) cout << "-E- PndSttMapCreator: geometry not supported by map" << endl; // CHECK
53 
54  if(!gGeoManager) cout << "-E- PndSttMapCreator: no geo manager " << endl; // CHECK
55  // set general par
57 
58 }
PndSttGeometryMap * fMap
PndSttTube * fSttTube
std::map< int, int > copy_map
TGeoManager * gGeoManager
PndGeoSttPar * fSttParameters
PndSttMapCreator::PndSttMapCreator ( PndGeoSttPar par)

Definition at line 61 of file PndSttMapCreator.cxx.

References fGeoType, PndGeoSttPar::GetGeometryType(), gGeoManager, and SetGeneralParameters().

61  : fGeoType(-1), fSttParameters(sttPar), fTubeInRad(0), fTubeOutRad(0), fSttTube(0) {
62 
63  if(!gGeoManager) cout << "-E- PndSttMapCreator: no geo manager " << endl; // CHECK
64 
65  // choose geometry type
66  fGeoType = sttPar->GetGeometryType(); // classic, optimized, average, detailed, CAD
67 
68  if(fGeoType > 2) cout << "-E- PndSttMapCreator: geometry not supported by map" << endl; // CHECK
69  // set general par
71 }
PndSttTube * fSttTube
TGeoManager * gGeoManager
PndGeoSttPar * fSttParameters
PndSttMapCreator::~PndSttMapCreator ( )

Definition at line 73 of file PndSttMapCreator.cxx.

References fMap.

73  {
74  if (fMap != NULL) delete(fMap);
75 }
PndSttGeometryMap * fMap
PndSttMapCreator::PndSttMapCreator ( const PndSttMapCreator L)
private

Member Function Documentation

PndSttTubeParameters * PndSttMapCreator::CreateTubeParameters ( FairGeoNode *  pnode)

Definition at line 141 of file PndSttMapCreator.cxx.

References CreateTubeParametersGeoType1(), CreateTubeParametersGeoType2(), and fGeoType.

Referenced by FillSttTubeParametersGeoType1().

141  {
142  if(fGeoType == 1) return CreateTubeParametersGeoType1(pnode);
143  else if (fGeoType == 2) return CreateTubeParametersGeoType2(pnode);
144 
145  return NULL;
146 }
PndSttTubeParameters * CreateTubeParametersGeoType1(FairGeoNode *pnode)
PndSttTubeParameters * CreateTubeParametersGeoType2(FairGeoNode *pnode)
PndSttTubeParameters * PndSttMapCreator::CreateTubeParametersGeoType1 ( FairGeoNode *  pnode)
private

Definition at line 234 of file PndSttMapCreator.cxx.

References Double_t, GetTubeIDFromNameGeoType1(), rot, and TString.

Referenced by CreateTubeParameters().

234  {
235  TString nodename = pnode->getName();
236  Int_t tubeID = GetTubeIDFromNameGeoType1(nodename);
237 
238  FairGeoTransform *lab = pnode->getLabTransform();
239  FairGeoVector tra = lab->getTransVector();
240  FairGeoRotation rot = lab->getRotMatrix();
241  TGeoVolume* rootvol = pnode->getRootVolume();
242  TGeoTube *gtube = (TGeoTube*) rootvol->GetShape();
243  Double_t halflength = gtube->GetDz(); // in cm
244 
245  PndSttTubeParameters *parms = new PndSttTubeParameters(tubeID, halflength);
246  return parms;
247 
248 }
Double_t
TGeoRotation rot
Int_t GetTubeIDFromNameGeoType1(TString name)
PndSttTubeParameters * PndSttMapCreator::CreateTubeParametersGeoType2 ( FairGeoNode *  pnode)
private

Definition at line 428 of file PndSttMapCreator.cxx.

References Double_t, PndGeoHandling::GetShortID(), PndGeoHandling::Instance(), rot, and TString.

Referenced by CreateTubeParameters().

429 {
430  TString nodename = pnode->getName();
431  Int_t tubeID = PndGeoHandling::Instance()->GetShortID(nodename);
432 
433  FairGeoTransform *lab = pnode->getLabTransform();
434  FairGeoVector tra = lab->getTransVector();
435  FairGeoRotation rot = lab->getRotMatrix();
436  TGeoVolume* rootvol = pnode->getRootVolume();
437  TGeoTube *gtube = (TGeoTube*) rootvol->GetShape();
438  Double_t halflength = gtube->GetDz(); // in cm
439 
440  PndSttTubeParameters *parms = new PndSttTubeParameters(tubeID, halflength);
441  return parms;
442 }
Double_t
Int_t GetShortID(TString path)
for a given path the (unique) position of the sensor path in the fSensorNamePar-List is given...
static PndGeoHandling * Instance()
TGeoRotation rot
Int_t PndSttMapCreator::FillSttTubeParameters ( PndGeoSttPar par,
TList *  volList 
)

Definition at line 136 of file PndSttMapCreator.cxx.

References fGeoType, and FillSttTubeParametersGeoType1().

Referenced by PndStt::ConstructGeometry().

136  {
137  if(fGeoType == 1) return FillSttTubeParametersGeoType1(par, volList);
138  return -1;
139 }
Int_t FillSttTubeParametersGeoType1(PndGeoSttPar *par, TList *volList)
Int_t PndSttMapCreator::FillSttTubeParametersGeoType1 ( PndGeoSttPar par,
TList *  volList 
)
private

Definition at line 203 of file PndSttMapCreator.cxx.

References CreateTubeParameters(), fGeoType, fSttParameters, fTubeInRad, fTubeOutRad, PndGeoSttPar::GetTubeParameters(), par, PndGeoSttPar::SetGeometryType(), PndGeoSttPar::SetTubeInRad(), PndGeoSttPar::SetTubeOutRad(), and TString.

Referenced by FillSttTubeParameters().

203  {
205 
209 
210 
211  // store geo parameter
212  TObjArray *pararray = fSttParameters->GetTubeParameters();
213 
214  TListIter iter(volList);
215 
216  FairGeoNode* node = NULL;
217  //FairGeoVolume *aVol=NULL; //[R.K. 01/2017] unused variable?
218  int tubecounter = 0;
220  pararray->AddLast(parms); // add this to have correspondence index <-> tubeid
221  while( (node = (FairGeoNode*) iter.Next()) ) {
222  if ( node->isSensitive() ) continue;
223  TString nodename = node->GetName();
224  if(!nodename.Contains("stt01tube")) continue;
225  tubecounter++;
226 
227  parms = CreateTubeParameters(node);
228  pararray->AddLast(parms);
229  }
230 
231  return tubecounter;
232 }
Double_t par[3]
void SetTubeInRad(Double_t inrad)
Definition: PndGeoSttPar.h:26
PndGeoSttPar * fSttParameters
void SetTubeOutRad(Double_t outrad)
Definition: PndGeoSttPar.h:27
TObjArray * GetTubeParameters()
Definition: PndGeoSttPar.h:22
PndSttTubeParameters * CreateTubeParameters(FairGeoNode *pnode)
void SetGeometryType(Int_t geoType)
Definition: PndGeoSttPar.h:25
Int_t PndSttMapCreator::FillSttTubeParametersType2 ( PndGeoSttPar par)

Definition at line 448 of file PndSttMapCreator.cxx.

References fGeoType, fSttParameters, fTubeInRad, fTubeOutRad, PndGeoHandling::GetSensorNames(), PndGeoSttPar::GetTubeParameters(), gGeoManager, PndGeoHandling::Instance(), par, PndGeoSttPar::SetGeometryType(), PndGeoSttPar::SetTubeInRad(), PndGeoSttPar::SetTubeOutRad(), and TString.

Referenced by PndStt::ConstructGeometry().

448  {
449 
451 
455 //
456 //
457 // // store geo parameter
458  TObjArray *sensorNames = PndGeoHandling::Instance()->GetSensorNames();
459  TIter iter = sensorNames->MakeIterator();
460 
461  TObjArray *pararray = fSttParameters->GetTubeParameters();
462 // std::cout << "SensorNames.GetEntries() " << sensorNames->GetEntries() << std::endl;
463  int tubecounter = 0;
464  TObjString* sensorName;
465  while( (sensorName = (TObjString*)iter.Next()) ) {
466  TString stringName = sensorName->GetString();
467  if (stringName.Contains("ArCO2Sensitive")){
468  gGeoManager->cd(stringName.Data());
469  TGeoNode* node = gGeoManager->GetCurrentNode();
470  TGeoTube* tube = (TGeoTube*)node->GetVolume()->GetShape();
471  PndSttTubeParameters *parms = new PndSttTubeParameters(PndGeoHandling::Instance()->GetShortID(stringName), tube->GetDZ());
472 // std::cout << "-I- PndSttMapCreator::FillSttTubeParameeresType2 " << stringName.Data() << " ID: " << PndGeoHandling::Instance()->GetShortID(stringName) << " z/2 " << tube->GetDZ() << std::endl;
473  pararray->AddLast(parms);
474  tubecounter++;
475  }
476  }
477 
478  return tubecounter;
479 }
Double_t par[3]
void SetTubeInRad(Double_t inrad)
Definition: PndGeoSttPar.h:26
TGeoManager * gGeoManager
PndGeoSttPar * fSttParameters
TObjArray * GetSensorNames()
static PndGeoHandling * Instance()
void SetTubeOutRad(Double_t outrad)
Definition: PndGeoSttPar.h:27
TObjArray * GetTubeParameters()
Definition: PndGeoSttPar.h:22
void SetGeometryType(Int_t geoType)
Definition: PndGeoSttPar.h:25
TClonesArray * PndSttMapCreator::FillTubeArray ( )

Definition at line 128 of file PndSttMapCreator.cxx.

References fGeoType, FillTubeArrayGeoType1(), and FillTubeArrayGeoType2().

Referenced by PndSttHitProducerIdeal::Exec(), if(), PndSttSkewedCombineTask::Init(), PndMvdSttGemRiemannTrackFinderTask::Init(), PndMvdRiemannTrackFinderTask::Init(), PndPatternDBGenerator::Init(), PndSttHitProducerRealFast::Init(), PndSttHelixHitProducer::Init(), PndSttTrackFitterQATask::Init(), PndSttCellTrackFinderAnalysisTask::Init(), PndSttCellTrackFinderTask::Init(), PndSttMvdGemTracking::Init(), PndSttHitProducerRealFull::Init(), PndMixBackgroundEvents::Init(), PndCATracking::Init(), PndTrackingQualityBarrelTaskNewLinks::Init(), PndRecoDafFit::Init(), PndRecoDafFit2::Init(), PndRecoKalmanFit2::Init(), PndTrackingQATask::Init(), PndTrkLegendreNew::Init(), PndTrkLegendreSecTask::Init(), PndTrkLegendreSecTask2::Init(), PndTrkLegendreTask::Init(), PndRecoKalmanFit::Init(), PndTrkCombiLegendreTask::Init(), PndTrkTrackFinder::Init(), PndSttFitTracks::Init(), PndSttIsochroneDraw::Init(), PndTrkTracking2::Init(), PndSttFindTracks::Init(), PndBarrelTrackFinder::Init(), printsttcoords(), runDetectorInfo(), runStreamDisplay(), and runTripletAna().

128  {
129  if(fGeoType == 1) return FillTubeArrayGeoType1();
130  else if (fGeoType == 2) return FillTubeArrayGeoType2();
131 
132  return NULL;
133 }
TClonesArray * FillTubeArrayGeoType2()
TClonesArray * FillTubeArrayGeoType1()
TClonesArray * PndSttMapCreator::FillTubeArrayGeoType1 ( )
private

Definition at line 251 of file PndSttMapCreator.cxx.

References fGeoType, PndSttGeometryMap::FillGeometryParameters(), fMap, fSttParameters, fSttTube, fTubeArray, GetTubeFromParametersToFillGeoType1(), PndSttTubeParameters::GetTubeID(), PndGeoSttPar::GetTubeParameters(), and i.

Referenced by FillTubeArray().

251  {
252  TObjArray *pararray = fSttParameters->GetTubeParameters();
253 
254  fTubeArray = new TClonesArray("PndSttTube");
255  //fTubeArray->Delete();
256 
257  for(int i = 1; i < pararray->GetEntries(); i++) {
258  PndSttTubeParameters *parms = (PndSttTubeParameters*) pararray->At(i);
259  int tubeID = parms->GetTubeID();
260 
262  if(!fSttTube) continue;
263  // correspondance position in TCA <-> tubeID
264  new((*fTubeArray)[tubeID]) PndSttTube(*fSttTube);
265 
266  delete (fSttTube);
267  }
268 
271  return fTubeArray;
272 }
PndSttTube * GetTubeFromParametersToFillGeoType1(PndSttTubeParameters *parms)
PndSttGeometryMap * fMap
Int_t i
Definition: run_full.C:25
PndSttTube * fSttTube
TClonesArray * fTubeArray
PndGeoSttPar * fSttParameters
TObjArray * GetTubeParameters()
Definition: PndGeoSttPar.h:22
TClonesArray * PndSttMapCreator::FillTubeArrayGeoType2 ( )
private

Definition at line 481 of file PndSttMapCreator.cxx.

References fGeoType, PndSttGeometryMap::FillGeometryParameters(), fMap, fSttParameters, fSttTube, fTubeArray, GetTubeFromParametersToFillGeoType2(), PndSttTubeParameters::GetTubeID(), PndGeoSttPar::GetTubeParameters(), and i.

Referenced by FillTubeArray().

481  {
482  TObjArray *pararray = fSttParameters->GetTubeParameters();
483 
484  fTubeArray = new TClonesArray("PndSttTube");
485  //fTubeArray->Delete();
486 
487  for(int i = 1; i < pararray->GetEntries(); i++) {
488  PndSttTubeParameters *parms = (PndSttTubeParameters*) pararray->At(i);
489  int tubeID = parms->GetTubeID();
490 
492  if(!fSttTube) continue;
493  // correspondance position in TCA <-> tubeID
494  new((*fTubeArray)[tubeID]) PndSttTube(*fSttTube);
495 
496  delete (fSttTube);
497  }
498 
501  return fTubeArray;
502 }
PndSttGeometryMap * fMap
Int_t i
Definition: run_full.C:25
PndSttTube * fSttTube
TClonesArray * fTubeArray
PndGeoSttPar * fSttParameters
PndSttTube * GetTubeFromParametersToFillGeoType2(PndSttTubeParameters *parms)
TObjArray * GetTubeParameters()
Definition: PndGeoSttPar.h:22
PndSttGeometryMap* PndSttMapCreator::GetGeometryMap ( )
inline

Definition at line 38 of file PndSttMapCreator.h.

References fMap.

38 { return fMap; }
PndSttGeometryMap * fMap
TString PndSttMapCreator::GetNameFromPath ( TString  path)

Definition at line 109 of file PndSttMapCreator.cxx.

References fGeoType, and GetNameFromPathGeoType1().

109  {
110  if(fGeoType == 1) return GetNameFromPathGeoType1(path);
111  return "";
112 }
TString GetNameFromPathGeoType1(TString path)
TString PndSttMapCreator::GetNameFromPathGeoType1 ( TString  path)
private

Definition at line 156 of file PndSttMapCreator.cxx.

References TString.

Referenced by GetNameFromPath(), and GetTubeIDFromPathGeoType1().

156  {
157  // two possibilities:
158  // copy : /cave_1/stt01assembly_0/stt01tube_XXX/stt01gas_1 --> stt01tube#XXX
159  // solo : /cave_1/stt01assembly_0/stt01tubeXXX_0/stt01gasXXX_0 --> stt01tubeXXX
160 
161  TString tmpstring = path;
162 
163  // cut /cave_1/stt01assembly_0/
164  TString cavename;
165  cavename = "/cave_1/stt01assembly_0/";
166  tmpstring = tmpstring(cavename.Sizeof() - 1, tmpstring.Sizeof());
167 
168  // cut /stt01gas...
169  int index = tmpstring.Index("/");
170  tmpstring = tmpstring(0, index);
171 
172  // replace _ with #
173  if(tmpstring.Contains("_0")) {
174  tmpstring.Chop(); // cut "0"
175  tmpstring.Chop(); // cut "_"
176  }
177  else{
178  tmpstring.Replace(9, 1, "#");
179  }
180 
181  return tmpstring;
182 }
TString PndSttMapCreator::GetNameFromPathGeoType2 ( TString  path)
private
TString PndSttMapCreator::GetPathFromTubeID ( Int_t  tubeid,
Bool_t  isCopy 
)

Definition at line 114 of file PndSttMapCreator.cxx.

References fGeoType, and GetPathFromTubeIDGeoType1().

114  {
115  if(fGeoType == 1) return GetPathFromTubeIDGeoType1(tubeid, isCopy);
116  return "";
117 }
TString GetPathFromTubeIDGeoType1(Int_t tubeid, Bool_t isCopy)
TString PndSttMapCreator::GetPathFromTubeIDGeoType1 ( Int_t  tubeid,
Bool_t  isCopy 
)
private

Definition at line 407 of file PndSttMapCreator.cxx.

References TString.

Referenced by GetPathFromTubeID(), GetTubeFromParametersToFillGeoType1(), and GetTubeFromTubeIDGeoType1().

407  {
408 
409  // two possibilities:
410  // stt01tube#XXX --> copy : /cave_1/stt01assembly_0/stt01tube_XXX/stt01gas_1 --> stt01tube#XXX
411  // stt01tubeXXX --> solo : /cave_1/stt01assembly_0/stt01tubeXXX_0/stt01gasXXX_0 --> stt01tubeXXX
412 
413  TString tmpstring;
414  tmpstring += tubeid ;
415 
416  if(isCopy == kTRUE) tmpstring.Prepend("_");
417  else tmpstring.Append("_0");
418  tmpstring.Prepend("stt01tube");
419 
420  TString cavename;
421  cavename = "/cave_1/stt01assembly_0/";
422  tmpstring.Prepend(cavename);
423 
424 
425  return tmpstring;
426 }
TString PndSttMapCreator::GetPathFromTubeIDGeoType2 ( Int_t  tubeid,
Bool_t  isCopy 
)
private
PndSttTube * PndSttMapCreator::GetTubeFromParametersToFill ( PndSttTubeParameters parms)

Definition at line 120 of file PndSttMapCreator.cxx.

References fGeoType, and GetTubeFromParametersToFillGeoType1().

120  {
121  if(fGeoType == 1) return GetTubeFromParametersToFillGeoType1(parms);
122  return NULL;
123 }
PndSttTube * GetTubeFromParametersToFillGeoType1(PndSttTubeParameters *parms)
PndSttTube * PndSttMapCreator::GetTubeFromParametersToFillGeoType1 ( PndSttTubeParameters parms)
private

Definition at line 274 of file PndSttMapCreator.cxx.

References Bool_t, copy_map, Double_t, fSttParameters, GetPathFromTubeIDGeoType1(), PndSttTubeParameters::GetTubeID(), PndGeoSttPar::GetTubeInRad(), PndGeoSttPar::GetTubeOutRad(), gGeoManager, i, r, rotation, TString, x, y, and z.

Referenced by FillTubeArrayGeoType1(), and GetTubeFromParametersToFill().

274  {
275 
276  Int_t tubeid = parms->GetTubeID();
277  if(tubeid == -1) {
278  cout << "PndSttMapCreator::GetTubeFromParametersToFillGeoType1 (tubeid): tube " << tubeid << " not found (nor as a copy)" << endl;
279  return NULL;
280  }
281 
282  gGeoManager->cd("/cave_1/stt01assembly_0");
283  TGeoNode *assembly_node = gGeoManager->GetCurrentNode();
284  double local[3] = {0., 0., 0.}, master[3];
285  assembly_node->LocalToMaster(local, master);
286  TVector3 assembly_position(master[0], master[1], master[2]);
287 
288 
289  Bool_t isCopy = kTRUE;
290 
291  // try as if it was a copy stt01tube#XXX
292  TString path = GetPathFromTubeIDGeoType1(tubeid, isCopy);
293 
294  bool ispath = gGeoManager->CheckPath(path);
295  if(ispath == kFALSE) { // try as if it was a solo stt01tubeXXX
296  isCopy = kFALSE;
297  path = GetPathFromTubeIDGeoType1(tubeid, isCopy);
298  ispath = gGeoManager->CheckPath(path);
299  }
300  if(ispath == kFALSE) {
301  cout << "PndSttMapCreator::GetTubeFromParametersToFillGeoType1 (ispath): tube " << tubeid << " not found (nor as a copy)" << endl;
302  return NULL;
303  }
304 
305  gGeoManager->cd(path);
306  TGeoNode* tube_node = gGeoManager->GetCurrentNode();
307  tube_node->LocalToMaster(local, master);
308  TVector3 tube_position(master[0], master[1], master[2]);
309  tube_position += assembly_position;
310 
311  // tube_position.Print();
312 
313 
314  // geometrical info
315  double x = tube_position.X();
316  double y = tube_position.Y();
317  double z = tube_position.Z();
318 
319  TGeoMatrix *mat = tube_node->GetMatrix();
320  Double_t const *rotation = mat->GetRotationMatrix();
321 
322  double r[3][3];
323  int irot = 0, i = 0, j = 0;
324  for(i = 0; i < 3; i++) {
325  for(j = 0; j < 3; j++) {
326  r[i][j] = rotation[irot];
327  irot++;
328  }
329  }
330 
331  // sets up the correspondence int (tubeID) <--> int (1 = copy/0 = solo)
332  // copy_map[key] = alloc
333  copy_map[tubeid] = isCopy;
334 
335  return new PndSttTube(parms,
336  (float)x,(float)y,(float)z,
337  r[0][0],r[0][1],r[0][2],
338  r[1][0],r[1][1],r[1][2],
339  r[2][0],r[2][1],r[2][2],
341 
342 }
TString GetPathFromTubeIDGeoType1(Int_t tubeid, Bool_t isCopy)
double r
Definition: RiemannTest.C:14
Int_t i
Definition: run_full.C:25
std::map< int, int > copy_map
TGeoRotation rotation
TGeoManager * gGeoManager
Double_t GetTubeOutRad()
Definition: PndGeoSttPar.h:30
PndGeoSttPar * fSttParameters
Double_t
Double_t z
Double_t GetTubeInRad()
Definition: PndGeoSttPar.h:29
Double_t x
Double_t y
PndSttTube * PndSttMapCreator::GetTubeFromParametersToFillGeoType2 ( PndSttTubeParameters parms)
private

Definition at line 504 of file PndSttMapCreator.cxx.

References Double_t, fSttParameters, PndGeoHandling::GetMatrixShortId(), PndSttTubeParameters::GetTubeID(), PndGeoSttPar::GetTubeInRad(), PndGeoSttPar::GetTubeOutRad(), i, PndGeoHandling::Instance(), PndGeoHandling::LocalToMasterShortId(), r, and rotation.

Referenced by FillTubeArrayGeoType2().

504  {
505 
506  Int_t tubeid = parms->GetTubeID();
507  if(tubeid == -1) {
508  cout << "PndSttMapCreator::GetTubeFromParametersToFillGeoType2 (tubeid): tube " << tubeid << " not found (nor as a copy)" << endl;
509  return NULL;
510  }
511  TVector3 local(0.,0.,0.);
512  TVector3 localToMaster = PndGeoHandling::Instance()->LocalToMasterShortId(local, tubeid);
513  TGeoHMatrix* mat = PndGeoHandling::Instance()->GetMatrixShortId(tubeid);
514  Double_t const *rotation = mat->GetRotationMatrix();
515 
516  double r[3][3];
517  int irot = 0, i = 0, j = 0;
518  for(i = 0; i < 3; i++) {
519  for(j = 0; j < 3; j++) {
520  r[i][j] = rotation[irot];
521  irot++;
522  }
523  }
524 
525  return new PndSttTube(parms,
526  localToMaster.X(), localToMaster.Y(),localToMaster.Z(),
527  r[0][0],r[0][1],r[0][2],
528  r[1][0],r[1][1],r[1][2],
529  r[2][0],r[2][1],r[2][2],
531 
532 }
double r
Definition: RiemannTest.C:14
Int_t i
Definition: run_full.C:25
TGeoRotation rotation
TGeoHMatrix * GetMatrixShortId(Int_t shortId)
Double_t GetTubeOutRad()
Definition: PndGeoSttPar.h:30
PndGeoSttPar * fSttParameters
Double_t
static PndGeoHandling * Instance()
Double_t GetTubeInRad()
Definition: PndGeoSttPar.h:29
TVector3 LocalToMasterShortId(const TVector3 &local, const Int_t &shortId)
PndSttTube * PndSttMapCreator::GetTubeFromTubeID ( Int_t  tubeid)

Definition at line 104 of file PndSttMapCreator.cxx.

References fGeoType, and GetTubeFromTubeIDGeoType1().

Referenced by PndSttRecoHit::PndSttRecoHit(), and PndSttRecoHit2::PndSttRecoHit2().

104  {
105  if(fGeoType == 1) return GetTubeFromTubeIDGeoType1(tubeid);
106  return NULL;
107 }
PndSttTube * GetTubeFromTubeIDGeoType1(Int_t tubeid)
PndSttTube * PndSttMapCreator::GetTubeFromTubeIDGeoType1 ( Int_t  tubeid)
private

Definition at line 344 of file PndSttMapCreator.cxx.

References Bool_t, copy_map, Double_t, fSttParameters, GetPathFromTubeIDGeoType1(), PndGeoSttPar::GetTubeInRad(), PndGeoSttPar::GetTubeOutRad(), PndGeoSttPar::GetTubeParameters(), gGeoManager, i, r, rotation, TString, x, y, and z.

Referenced by GetTubeFromTubeID().

344  {
345 
346  Bool_t isCopy = copy_map[tubeid];
347 
348 
349  gGeoManager->cd("/cave_1/stt01assembly_0");
350  TGeoNode *assembly_node = gGeoManager->GetCurrentNode();
351  double local[3] = {0., 0., 0.}, master[3];
352  assembly_node->LocalToMaster(local, master);
353  TVector3 assembly_position(master[0], master[1], master[2]);
354 
355 
356  // try as if it was a copy stt01tube#XXX
357  TString path = GetPathFromTubeIDGeoType1(tubeid, isCopy);
358 
359  bool ispath = gGeoManager->CheckPath(path);
360 
361  if(ispath == kFALSE) {
362  cout << "PndSttMapCreator::GetTubeFromTubeIDGeoType1 (ispath): tube " << tubeid << " not found (nor as a copy)" << endl;
363  return NULL;
364  }
365 
366  gGeoManager->cd(path);
367  TGeoNode* tube_node = gGeoManager->GetCurrentNode();
368  tube_node->LocalToMaster(local, master);
369  TVector3 tube_position(master[0], master[1], master[2]);
370  tube_position += assembly_position;
371 
372  // tube_position.Print();
373 
374 
375  // geometrical info
376  double x = tube_position.X();
377  double y = tube_position.Y();
378  double z = tube_position.Z();
379 
380  TGeoMatrix *mat = tube_node->GetMatrix();
381  Double_t const *rotation = mat->GetRotationMatrix();
382 
383  double r[3][3];
384  int irot = 0, i = 0, j = 0;
385  for(i = 0; i < 3; i++) {
386  for(j = 0; j < 3; j++) {
387  r[i][j] = rotation[irot];
388  irot++;
389  }
390  }
391 
392  TObjArray *parmsarray = fSttParameters->GetTubeParameters();
393  PndSttTubeParameters *parms = (PndSttTubeParameters*) parmsarray->At(tubeid); // CHECK
394 
395 
396  return new PndSttTube(parms,
397  (float)x,(float)y,(float)z,
398  r[0][0],r[0][1],r[0][2],
399  r[1][0],r[1][1],r[1][2],
400  r[2][0],r[2][1],r[2][2],
402 
403 }
TString GetPathFromTubeIDGeoType1(Int_t tubeid, Bool_t isCopy)
double r
Definition: RiemannTest.C:14
Int_t i
Definition: run_full.C:25
std::map< int, int > copy_map
TGeoRotation rotation
TGeoManager * gGeoManager
Double_t GetTubeOutRad()
Definition: PndGeoSttPar.h:30
PndGeoSttPar * fSttParameters
Double_t
Double_t z
TObjArray * GetTubeParameters()
Definition: PndGeoSttPar.h:22
Double_t GetTubeInRad()
Definition: PndGeoSttPar.h:29
Double_t x
Double_t y
PndSttTube* PndSttMapCreator::GetTubeFromTubeIDGeoType2 ( Int_t  tubeid)
private
Int_t PndSttMapCreator::GetTubeIDFromName ( TString  name)

Definition at line 98 of file PndSttMapCreator.cxx.

References fGeoType, and GetTubeIDFromNameGeoType1().

98  {
99  if(fGeoType == 1) return GetTubeIDFromNameGeoType1(name);
100  return -999;
101 }
TString name
Int_t GetTubeIDFromNameGeoType1(TString name)
Int_t PndSttMapCreator::GetTubeIDFromNameGeoType1 ( TString  name)
private

Definition at line 185 of file PndSttMapCreator.cxx.

References name, and TString.

Referenced by CreateTubeParametersGeoType1(), GetTubeIDFromName(), and GetTubeIDFromPathGeoType1().

185  {
186  // two possibilities: we DON' T CARE and just take the XXX part
187  // copy : stt01tube#XXX --> XXX
188  // solo : stt01tubeXXX --> XXX
189 
190  TString tmpstring = name;
191 
192  if(tmpstring.Contains("#")) {
193  int start = tmpstring.Index("#") + 1;
194  tmpstring = tmpstring(start, tmpstring.Sizeof());
195  }
196  else{
197  int start = tmpstring.Index("e") + 1;
198  tmpstring = tmpstring(start, tmpstring.Sizeof());
199  }
200  return tmpstring.Atoi();
201 }
TString name
Int_t PndSttMapCreator::GetTubeIDFromNameGeoType2 ( TString  name)
private

Definition at line 444 of file PndSttMapCreator.cxx.

445 {
446 }
Int_t PndSttMapCreator::GetTubeIDFromPath ( TString  path)

Definition at line 92 of file PndSttMapCreator.cxx.

References fGeoType, and GetTubeIDFromPathGeoType1().

Referenced by PndStt::ProcessHits().

92  {
93  if(fGeoType == 1) return GetTubeIDFromPathGeoType1(path);
94  return -999;
95 }
Int_t GetTubeIDFromPathGeoType1(TString path)
Int_t PndSttMapCreator::GetTubeIDFromPathGeoType1 ( TString  path)
private

Definition at line 149 of file PndSttMapCreator.cxx.

References GetNameFromPathGeoType1(), GetTubeIDFromNameGeoType1(), and TString.

Referenced by GetTubeIDFromPath().

149  {
150  TString tmpstring = GetNameFromPathGeoType1(path);
151  return GetTubeIDFromNameGeoType1(tmpstring);
152 }
TString GetNameFromPathGeoType1(TString path)
Int_t GetTubeIDFromNameGeoType1(TString name)
Int_t PndSttMapCreator::GetTubeIDFromPathGeoType2 ( TString  path)
private
PndSttMapCreator& PndSttMapCreator::operator= ( const PndSttMapCreator )
inlineprivate

Definition at line 49 of file PndSttMapCreator.h.

49 {return *this;};
void PndSttMapCreator::SetGeneralParameters ( )

Definition at line 77 of file PndSttMapCreator.cxx.

References fGeoType, fTubeInRad, and fTubeOutRad.

Referenced by PndSttMapCreator().

77  { // CHECK whether it depends on geometry or not
78  if(fGeoType == 1) {
79  fTubeInRad = 0.5; // tube inner radius cm
80  fTubeOutRad = 0.001; // tube outer radius cm CHECK why not: fTubeInRad + 0.001
81  } else if (fGeoType == 2) {
82  fTubeInRad = 0.5;
83  fTubeOutRad = 0.001; // copy of values from fGeoType 1. I have no clue why fTubeOutRad is 0.001 but it is used nowhere
84  }
85  else {
86  fTubeInRad = -1;
87  fTubeOutRad = -1;
88  }
89 }

Member Data Documentation

std::map<int, int> PndSttMapCreator::copy_map
private
Int_t PndSttMapCreator::fGeoType
private
PndSttGeometryMap* PndSttMapCreator::fMap
protected
PndGeoSttPar* PndSttMapCreator::fSttParameters
private
PndSttTube* PndSttMapCreator::fSttTube
protected

Definition at line 74 of file PndSttMapCreator.h.

Referenced by FillTubeArrayGeoType1(), and FillTubeArrayGeoType2().

TClonesArray* PndSttMapCreator::fTubeArray
protected

Definition at line 73 of file PndSttMapCreator.h.

Referenced by FillTubeArrayGeoType1(), and FillTubeArrayGeoType2().

Double_t PndSttMapCreator::fTubeInRad
private
Double_t PndSttMapCreator::fTubeOutRad
private

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