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

#include <PndSttTubeMapCreatorRoot.h>

Inheritance diagram for PndSttTubeMapCreatorRoot:
PndSttTubeMapCreatorAbs

Public Member Functions

 PndSttTubeMapCreatorRoot ()
 
virtual ~PndSttTubeMapCreatorRoot ()
 
bool IsEdgeStraw (int tubeId) const
 
int IsSectorBorderStraw (int tubeId) const
 
PndSttTubeMapCreateTubeMap ()
 
 ClassDef (PndSttTubeMapCreatorAbs, 1)
 

Protected Member Functions

void AssignNeighbors (PndSttTube *tube)
 
 ClassDef (PndSttTubeMapCreatorRoot, 1)
 

Protected Attributes

int sRowTubeID [6][29]
 
int eRowTubeID [6][29]
 
int additionalSkewedTubeMap [4576]
 

Detailed Description

Definition at line 15 of file PndSttTubeMapCreatorRoot.h.

Constructor & Destructor Documentation

PndSttTubeMapCreatorRoot::PndSttTubeMapCreatorRoot ( )

Definition at line 23 of file PndSttTubeMapCreatorRoot.cxx.

23  {
24  // TODO Auto-generated constructor stub
25 
26 }
PndSttTubeMapCreatorRoot::~PndSttTubeMapCreatorRoot ( )
virtual

Definition at line 28 of file PndSttTubeMapCreatorRoot.cxx.

28  {
29  // TODO Auto-generated destructor stubPndSttTubeIdMapeMap* PndSttTubeMapCreatorRoot::CreateTubeMap()
30 }

Member Function Documentation

void PndSttTubeMapCreatorRoot::AssignNeighbors ( PndSttTube tube)
protected

Definition at line 108 of file PndSttTubeMapCreatorRoot.cxx.

References creator, PndSttNeighborhoodCreator::FindNeighbors(), and PndSttTube::SetNeighborings().

Referenced by CreateTubeMap().

108  {
110  std::vector<int> neighbors = creator.FindNeighbors(tube);
111 // std::cout << "PndSttTubeMapCreatorRoot::AssignNeighbors size vector " << neighbors.size();
112  TArrayI neighborArray;
113  for_each(neighbors.begin(), neighbors.end(), [&neighborArray](int& id){int size = neighborArray.GetSize(); neighborArray.Set(size + 1); neighborArray.AddAt(id, size);});
114  tube->SetNeighborings(neighborArray);
115 // std::cout << " size of Array: " << neighborArray.GetSize() << std::endl;
116 }
std::vector< int > FindNeighbors(PndSttTube *tube)
void SetNeighborings(TArrayI neighborings)
Definition: PndSttTube.cxx:133
PndMvdCreateDefaultApvMap * creator
PndSttTubeMapCreatorAbs::ClassDef ( PndSttTubeMapCreatorAbs  ,
 
)
inherited
PndSttTubeMapCreatorRoot::ClassDef ( PndSttTubeMapCreatorRoot  ,
 
)
protected
PndSttTubeMap * PndSttTubeMapCreatorRoot::CreateTubeMap ( )
virtual

Implements PndSttTubeMapCreatorAbs.

Definition at line 32 of file PndSttTubeMapCreatorRoot.cxx.

References additionalSkewedTubeMap, PndSttTubeMap::AddTube(), AssignNeighbors(), eRowTubeID, PndSttTubeMap::GetMap(), PndGeoHandling::GetPath(), PndSttTubeIdMap::GetRowInSector(), PndGeoHandling::GetSensorNamesWithString(), PndGeoHandling::GetShortID(), PndSttTubeCreator::GetTube(), i, PndSttTubeMap::Instance(), PndSttTubeIdMap::Instance(), PndGeoHandling::Instance(), IsEdgeStraw(), IsSectorBorderStraw(), name, pos, row, PndSttTube::SetLayerLimitFlag(), PndSttTube::SetSectorLimitFlag(), sRowTubeID, TString, and val.

Referenced by PndSttRootGeometryInitTask::Exec().

32  {
33 
34  //create limitation map
35  for (int sector = 0; sector < 6; sector++) {
36  for (int row = 0; row < 29; row++) {
37  int MaxCpyNum = 0;
38  std::vector<int> vecRow = PndSttTubeIdMap::Instance()->GetRowInSector(sector, row);
39 // std::cout<<" vecRow size = "<<vecRow.size()<<std::endl;
40 
41  for (int j = 0; j < vecRow.size(); j++) {
42 // std::cout << "Id = " << vecRow[j] << " pos in row = " << j
43 // << std::endl;
44 // std::cout << PndGeoHandling::Instance()->GetPath(vecRow[j])
45 // << std::endl;
46 
47  TString path = PndGeoHandling::Instance()->GetPath(vecRow[j]);
48  std::string nameString(path.Data());
49  PndStringSeparator sep(nameString, "/-_");
50  std::vector < std::string > stringVector =
51  sep.GetStringVector();
52  auto i =
53  std::find_if(stringVector.begin(), stringVector.end(),
54  [&](const std::string& val) {auto found = val.find("tubestt02"); return found != std::string::npos;});
55  int pos = std::distance(stringVector.begin(), i);
56  int tubeType = std::stoi(stringVector[pos + 1]);
57  int cpyNum = std::stoi(stringVector[pos + 2]);
58 // std::cout << "cpyNum = " << cpyNum << std::endl;
59 
60  if (tubeType != 0) {
61  if (cpyNum == 0)
62  additionalSkewedTubeMap[vecRow[j]] = 1;
63  else
64  additionalSkewedTubeMap[vecRow[j]] = 2;
65 // std::cout << "additionalSkewedTubeMap ID =" << vecRow[j] << std::endl;
66  } else {
67  additionalSkewedTubeMap[vecRow[j]] = 0;
68  if (cpyNum == 0)
69  sRowTubeID[sector][row] = vecRow[j];
70  if (cpyNum > MaxCpyNum) {
71  MaxCpyNum = cpyNum;
72  eRowTubeID[sector][row] = vecRow[j];
73  }
74  }
75  //std::cout<<IsEdgeStraw(tubeId)<<IsSectorBorderStraw(tubeId)<<std::endl;
76  }
77 // std::cout<<sRowTubeID[sector][row]<<":"<<eRowTubeID[sector][row]<<std::endl;
78  }
79  }
80 
82  PndSttTubeCreator tubeCreator;
83  std::vector<TString> nodeNames = PndGeoHandling::Instance()->GetSensorNamesWithString("ArCO2Sensitive");
84 // std::cout << "-I- PndSttTubeMapCreatorRoot::CreateTubeMap Nodes: " << nodeNames.size() << std::endl;
85  for (auto name : nodeNames){
86 // std::cout << "Node: " << name.Data() << std::endl;
87  int tubeId = PndGeoHandling::Instance()->GetShortID(name);
88  PndSttTube* myTube = tubeCreator.GetTube(tubeId);
89  myTube->SetSectorLimitFlag(IsEdgeStraw(tubeId));
90  myTube->SetLayerLimitFlag(IsSectorBorderStraw(tubeId));
91  result->AddTube(tubeId, myTube);
92 // std::cout << *myTube << std::endl;
93 // std::cout << "GeoHandling Matrix: " << std::endl;
94 // TGeoHMatrix* mat = PndGeoHandling::Instance()->GetMatrixPath(name);
95 // mat->Print();
96  }
97 
98  std::map<int, PndSttTube*> tubeMap = result->GetMap();
99  for (auto tubePair : tubeMap){
100  AssignNeighbors(tubePair.second);
101  }
102 // std::cout<<"tubeId = "<<176 << " IsEdgeStraw = "<<IsEdgeStraw(176)<<std::endl;
103 // for_each(tubeMap.begin(), tubeMap.end(), [](std::pair<int, PndSttTube*> pair){ std::cout << *pair.second << std::endl;});
104 
105  return result;
106 }
vector< int > GetRowInSector(int sector, int row)
int row
Definition: anaLmdDigi.C:67
TVector3 pos
PndSttTube * GetTube(int tubeId)
Int_t i
Definition: run_full.C:25
std::map< int, PndSttTube * > GetMap()
Definition: PndSttTubeMap.h:27
void SetLayerLimitFlag(Bool_t flag=kTRUE)
Definition: PndSttTube.h:62
Double_t val[nBoxes][nFEBox]
Definition: createCalib.C:11
void SetSectorLimitFlag(Int_t flag)
Definition: PndSttTube.h:61
std::vector< TString > GetSensorNamesWithString(TString value)
TString GetPath(Int_t shortID)
for a given shortID the path is returned
static PndSttTubeMap * Instance()
bool IsEdgeStraw(int tubeId) const
static PndSttTubeIdMap * Instance()
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()
TString name
int IsSectorBorderStraw(int tubeId) const
void AssignNeighbors(PndSttTube *tube)
void AddTube(int tubeId, PndSttTube *tube)
Definition: PndSttTubeMap.h:21
bool PndSttTubeMapCreatorRoot::IsEdgeStraw ( int  tubeId) const

Definition at line 118 of file PndSttTubeMapCreatorRoot.cxx.

References additionalSkewedTubeMap, eRowTubeID, PndSttTubeIdMap::GetSectorRowFromTubeId(), PndSttTubeIdMap::Instance(), and sRowTubeID.

Referenced by CreateTubeMap().

118  {
119 
120  std::pair<int, int> sectorRow = PndSttTubeIdMap::Instance()->GetSectorRowFromTubeId(tubeId);
121  //std::cout << "sector: " << sectorRow.first << " row:" << sectorRow.second << std::endl;
122 
123  // if (row == 0) return true;
124  if(additionalSkewedTubeMap[tubeId]>0 && sectorRow.first != 1 && sectorRow.first != 4){
125  if (sectorRow.first == 0 || sectorRow.first == 3) {
126  if (additionalSkewedTubeMap[tubeId] == 1)
127  return true;
128  else
129  return false;
130  } else if (sectorRow.first == 2 || sectorRow.first == 5) {
131  if (additionalSkewedTubeMap[tubeId] == 2)
132  return true;
133  else
134  return false;
135  }
136  }
137  int endstraw = 0;
138  switch (sectorRow.first) {
139  case 0:
140  endstraw = sRowTubeID[sectorRow.first][sectorRow.second];
141  break;
142  case 2:
143  endstraw = eRowTubeID[sectorRow.first][sectorRow.second];
144  break;
145  case 3:
146  endstraw = sRowTubeID[sectorRow.first][sectorRow.second];
147  break;
148  case 5:
149  endstraw = eRowTubeID[sectorRow.first][sectorRow.second];
150  break;
151  default:
152  return false;
153  };
154  return (tubeId == endstraw);
155 }
std::pair< int, int > GetSectorRowFromTubeId(int tubeId)
static PndSttTubeIdMap * Instance()
int PndSttTubeMapCreatorRoot::IsSectorBorderStraw ( int  tubeId) const

Definition at line 156 of file PndSttTubeMapCreatorRoot.cxx.

References additionalSkewedTubeMap, eRowTubeID, PndSttTubeIdMap::GetSectorRowFromTubeId(), PndSttTubeIdMap::Instance(), and sRowTubeID.

Referenced by CreateTubeMap().

156  {
157 
158  std::pair<int, int> sectorRow = PndSttTubeIdMap::Instance()->GetSectorRowFromTubeId(tubeId);
159 
160  if(additionalSkewedTubeMap[tubeId]>0){
161  if (additionalSkewedTubeMap[tubeId] == 1)
162  return 1;
163  if (additionalSkewedTubeMap[tubeId] == 2)
164  return -1;
165  }
166  else {
167  int endstrawcw = sRowTubeID[sectorRow.first][sectorRow.second];
168  int endstrawccw = eRowTubeID[sectorRow.first][sectorRow.second];
169  if ( tubeId == endstrawcw) return -1;
170  if ( tubeId == endstrawccw) return 1;
171  }
172 
173  return 0;
174 }
std::pair< int, int > GetSectorRowFromTubeId(int tubeId)
static PndSttTubeIdMap * Instance()

Member Data Documentation

int PndSttTubeMapCreatorRoot::additionalSkewedTubeMap[4576]
protected

Definition at line 28 of file PndSttTubeMapCreatorRoot.h.

Referenced by CreateTubeMap(), IsEdgeStraw(), and IsSectorBorderStraw().

int PndSttTubeMapCreatorRoot::eRowTubeID[6][29]
protected

Definition at line 27 of file PndSttTubeMapCreatorRoot.h.

Referenced by CreateTubeMap(), IsEdgeStraw(), and IsSectorBorderStraw().

int PndSttTubeMapCreatorRoot::sRowTubeID[6][29]
protected

Definition at line 26 of file PndSttTubeMapCreatorRoot.h.

Referenced by CreateTubeMap(), IsEdgeStraw(), and IsSectorBorderStraw().


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