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

#include <PndSttGeometryMap.h>

Inheritance diagram for PndSttGeometryMap:

Public Member Functions

 PndSttGeometryMap ()
 
 PndSttGeometryMap (TClonesArray *tubearray, Int_t geoType)
 
 ~PndSttGeometryMap ()
 
 PndSttGeometryMap (const PndSttGeometryMap &)=delete
 
PndSttGeometryMapoperator= (const PndSttGeometryMap &)=delete
 
void SetGeneralParameters ()
 
void GenerateStrawMap (Int_t map)
 
Bool_t FillGeometryParameters ()
 
void SetGeneralParametersGeoType1 ()
 
void GenerateStrawMapGeoType1 (Int_t map)
 
Bool_t FillGeometryParametersGeoType1 ()
 
void GenerateStrawMapTubeIDGeoType1 ()
 
void GenerateStrawMapAngleGeoType1 ()
 
int GetRow (int strawindex) const
 
int GetSector (int strawindex) const
 
const vector< int > & GetStrawRow (int sector, int row) const
 
const vector< vector< int > > & GetStrawSector (int sector) const
 
bool IsEdgeStraw (int strawindex) const
 
int IsSectorBorderStraw (int strawindex) const
 
bool IsAxialStraw (int strawindex) const
 
bool IsSkewedStraw (int strawindex) const
 
bool IsAxialRow (int rowindex) const
 
bool IsSkewedRow (int rowindex) const
 
TArrayI FindNeighborings (PndSttTube *tube)
 
TArrayI FindNeighborings (int tubeId)
 
TArrayI GetNeighboringsByMap (int tubeId)
 
void FillStrawNeighborsMap ()
 
Double_t CalculateStrawPoca (PndSttHit *hit1, PndSttHit *hit2, TVector3 &poca)
 
double GetAngleBetweenTubes (int tubeID1, int tubeID2) const
 
bool InStraightLine (int tube1, int tube2, int tube3) const
 
void SetVerbose (int ver)
 

Private Member Functions

void GenerateAngles ()
 

Private Attributes

Int_t fGeoType
 
Int_t fVerbose
 
map< int, vector< vector< int > > > fStrawIndex
 
map< int, TArrayI > fStrawNeighbors
 
vector< int > fSectorOfStraw
 
vector< int > fLayerOfStraw
 
vector< bool > fAxialStraw
 
vector< double > fSectorStart
 
vector< double > fSectorEnd
 
bool fStrawMapInitialized
 
Int_t fNLayers
 
Int_t fNSectors
 
Int_t fNTubes
 
Int_t fNTubes_inner_parallel
 
Int_t fNTubes_outer_parallel
 
Int_t fNTubes_fillup_parallel
 
Int_t fNTubes_skewed
 
Int_t fNLayers_inner_parallel
 
Int_t fNLayers_skew
 
Int_t fNLayers_outer_parallel
 
Int_t fNLayers_fillup_parallel
 
Int_t ** fStartTube
 
Int_t ** fEndTube
 
Int_t ** fShift
 
Int_t ** fShiftSkew
 
TClonesArray * fTubeArray
 

Detailed Description

Definition at line 24 of file PndSttGeometryMap.h.

Constructor & Destructor Documentation

PndSttGeometryMap::PndSttGeometryMap ( )

Definition at line 53 of file PndSttGeometryMap.cxx.

53 : fGeoType(-1), fVerbose(0), fTubeArray(0) {}
TClonesArray * fTubeArray
PndSttGeometryMap::PndSttGeometryMap ( TClonesArray *  tubearray,
Int_t  geoType 
)

Definition at line 56 of file PndSttGeometryMap.cxx.

References fGeoType, GenerateStrawMap(), and SetGeneralParameters().

56  : fGeoType(geoType), fVerbose(0), fTubeArray(tubearray) {
57  if(fGeoType != 1) cout << "ERROR PndSttGeometryMap: fGeoType " << fGeoType << " not supported" << endl;
60 }
TClonesArray * fTubeArray
void GenerateStrawMap(Int_t map)
PndSttGeometryMap::~PndSttGeometryMap ( )

Definition at line 62 of file PndSttGeometryMap.cxx.

62 {}
PndSttGeometryMap::PndSttGeometryMap ( const PndSttGeometryMap )
delete

Member Function Documentation

Double_t PndSttGeometryMap::CalculateStrawPoca ( PndSttHit hit1,
PndSttHit hit2,
TVector3 &  poca 
)

Definition at line 252 of file PndSttGeometryMap.cxx.

References CAMath::Abs(), Double_t, fTubeArray, fVerbose, PndSttTube::GetHalfLength(), PndSttHit::GetTubeID(), PndSttTube::GetWireDirection(), m, p1, p2, r, t1, and t2.

Referenced by PndSttSkewedCombineTask::Exec().

253 {
254  TVector3 p1(hit1->GetX(), hit1->GetY(), hit1->GetZ());
255  TVector3 p2(hit2->GetX(), hit2->GetY(), hit2->GetZ());
256 
257 
258  PndSttTube* tube1 = (PndSttTube*)fTubeArray->At(hit1->GetTubeID());
259  PndSttTube* tube2 = (PndSttTube*)fTubeArray->At(hit2->GetTubeID());
260 
261  TVector3 u1(tube1->GetWireDirection());
262  TVector3 u2(tube2->GetWireDirection());
263 
264  if (fVerbose > 1) {
265  std::cout << "PndSttGeometryMap::CalculateStrawPoca Hit1 center: (" << hit1->GetX() << "/" << hit1->GetY() << "/" << hit1->GetZ()
266  << ") Dir: (" << u1.x() << "/" << u1.y() << "/" << u1.z() << ") HL: " << tube1->GetHalfLength() << std::endl;
267 
268  std::cout << "PndSttGeometryMap::CalculateStrawPoca Hit2 center: (" << hit2->GetX() << "/" << hit2->GetY() << "/" << hit2->GetZ()
269  << ") Dir: (" << u2.x() << "/" << u2.y() << "/" << u2.z() << ") HL: " << tube2->GetHalfLength() << std::endl;
270  }
271  TVector3 p21 = p2 - p1;
272  if (p21.Mag() < 0.000001) {
273  poca = p1;
274  if (fVerbose > 1) std::cout << "Poca: " << poca.x() << "/" << poca.y() << "/" << poca.z() << std::endl;
275  return 0;
276  }
277 // p21.Print();
278  TVector3 m = u2.Cross(u1);
279  if (m.Mag() < 0.000001) {
280  poca = p1 + 0.5*p21;
281  if (fVerbose > 1) std::cout << "Poca: " << poca.x() << "/" << poca.y() << "/" << poca.z() << std::endl;
282  return p21.Mag();
283  }
284 // m.Print();
285  TVector3 mnorm = (1.0/m.Mag2())*m;
286  TVector3 r = p21.Cross(mnorm);
287  Double_t t1 = r.Dot(u2);
288  Double_t t2 = r.Dot(u1);
289 
290  if (t1 > tube1->GetHalfLength()){
291  t1 = tube1->GetHalfLength();
292  } else if (t1 < (-1)*tube1->GetHalfLength()) {
293  t1 = (-1)*tube1->GetHalfLength();
294  }
295 
296  if (t2 > tube2->GetHalfLength()){
297  t2 = tube2->GetHalfLength();
298  } else if (t2 < (-1)*tube2->GetHalfLength()) {
299  t2 = (-1)*tube1->GetHalfLength();
300  }
301 
302  TVector3 q1 = p1+t1*u1;
303  TVector3 q2 = p2+t2*u2;
304  TVector3 q21 = q2 - q1;
305  poca = q1 + 0.5*q21;
306 
307  if (fVerbose > 1) std::cout << "q1: " << q1.x() << "/" << q1.y() << "/" << q1.z() << " t1: " << t1 << std::endl;
308  if (fVerbose > 1) std::cout << "q2: " << q2.x() << "/" << q2.y() << "/" << q2.z() << " t2: " << t2 << std::endl;
309 
310  if (fVerbose > 1) std::cout << "Poca: " << poca.x() << "/" << poca.y() << "/" << poca.z() << std::endl;
311 // cout << "Crosspoints: " << endl;
312 // q1.Print();
313 // q2.Print();
314 // cout << "Poca: " << endl;
315 // poca.Print();
316 // return (TMath::Abs(p21.Dot(m))/m.Mag());
317 
318  return (TMath::Abs(p21.Dot(m))/m.Mag());
319 }
Int_t t1
Definition: hist-t7.C:106
double r
Definition: RiemannTest.C:14
__m128 m
Definition: P4_F32vec4.h:28
Double_t GetHalfLength()
Definition: PndSttTube.cxx:99
TClonesArray * fTubeArray
static T Abs(const T &x)
Definition: PndCAMath.h:39
Double_t
Int_t GetTubeID() const
Definition: PndSttHit.h:75
TPad * p2
Definition: hist-t7.C:117
Int_t t2
Definition: hist-t7.C:106
TPad * p1
Definition: hist-t7.C:116
TVector3 GetWireDirection()
Definition: PndSttTube.cxx:107
Bool_t PndSttGeometryMap::FillGeometryParameters ( )

Definition at line 74 of file PndSttGeometryMap.cxx.

References fGeoType, and FillGeometryParametersGeoType1().

Referenced by PndSttMapCreator::FillTubeArrayGeoType1(), and PndSttMapCreator::FillTubeArrayGeoType2().

74  {
75  if(fGeoType == 1) return FillGeometryParametersGeoType1();
76  else return kFALSE;
77 }
Bool_t FillGeometryParametersGeoType1()
Bool_t PndSttGeometryMap::FillGeometryParametersGeoType1 ( )

Definition at line 106 of file PndSttGeometryMap.cxx.

References FindNeighborings(), fTubeArray, IsEdgeStraw(), IsSectorBorderStraw(), PndSttTube::SetLayerLimitFlag(), PndSttTube::SetNeighborings(), and PndSttTube::SetSectorLimitFlag().

Referenced by FillGeometryParameters().

106  {
107 
108  for (int itube = 1; itube < fTubeArray->GetEntriesFast(); itube++) {
109  PndSttTube* tube = (PndSttTube*) fTubeArray->At(itube);
110  tube->SetLayerLimitFlag(IsEdgeStraw(itube));
112 
113  bool found = true;
114  tube->SetNeighborings(FindNeighborings(tube));
115  if(!found) cout << "ERROR IN FINDIN NEIGHBORING " << endl;
116  }
117  return kTRUE;
118 }
void SetLayerLimitFlag(Bool_t flag=kTRUE)
Definition: PndSttTube.h:62
TClonesArray * fTubeArray
bool IsEdgeStraw(int strawindex) const
void SetSectorLimitFlag(Int_t flag)
Definition: PndSttTube.h:61
void SetNeighborings(TArrayI neighborings)
Definition: PndSttTube.cxx:133
int IsSectorBorderStraw(int strawindex) const
TArrayI FindNeighborings(PndSttTube *tube)
void PndSttGeometryMap::FillStrawNeighborsMap ( )

Definition at line 237 of file PndSttGeometryMap.cxx.

References FindNeighborings(), fNTubes, fStrawNeighbors, and i.

Referenced by GetNeighboringsByMap().

238 {
239  for (int i = 1; i < fNTubes+1; i++){
241  }
242 }
Int_t i
Definition: run_full.C:25
map< int, TArrayI > fStrawNeighbors
TArrayI FindNeighborings(PndSttTube *tube)
TArrayI PndSttGeometryMap::FindNeighborings ( PndSttTube tube)

Definition at line 120 of file PndSttGeometryMap.cxx.

References fNLayers, fNLayers_inner_parallel, fNSectors, fTubeArray, PndSttTube::GetDistance(), PndSttTube::GetLayerID(), PndSttTube::GetSectorID(), GetStrawRow(), PndSttTube::GetTubeID(), PndSttTube::IsParallel(), and PndSttTube::IsSkew().

Referenced by FillGeometryParametersGeoType1(), FillStrawNeighborsMap(), and FindNeighborings().

120  {
121  double tolerance0 = 1.2; // parallel/parallel && inner parallel/skew
122  double tolerance1 = 1.3; // skew/skew
123  double tolerance2 = 1.5;; // outer parallel/skew
124  double tolerance = 1.5; // CHECK tolerance
125 
126  TArrayI neighboring;
127 
128  int isector = tube->GetSectorID();
129  int ilayer = tube->GetLayerID();
130  // cout << "LAYER/SECTOR " << ilayer << " " << isector << endl;
131 
132  // possible lay/sec to check:
133  // same layer/same sector, before, after
134  // layer up/same sector, before, after
135  // layer down/same sector, before, after
136  int possible_lay_sec[9][2] = { { ilayer, isector }, { ilayer, isector + 1 }, { ilayer, isector - 1 }, { ilayer + 1, isector },
137  { ilayer + 1, isector + 1 }, { ilayer + 1, isector - 1 }, { ilayer - 1, isector },
138  { ilayer - 1, isector + 1 }, { ilayer - 1, isector - 1 } };
139 
140  std::vector<int> neigh_candidates;
141  for (int itest = 0; itest < 9; itest++) {
142 
143  PndSttTube *tube2 = NULL;
144  int tubeid = -1;
145  // cout << "is " << possible_lay_sec[itest][0] << " " << possible_lay_sec[itest][1] << "good?" << endl;
146  // check it is an existing layer/sec
147  if (possible_lay_sec[itest][0] < 0 || possible_lay_sec[itest][0] >= fNLayers)
148  continue;
149  if (possible_lay_sec[itest][1] < 0 || possible_lay_sec[itest][1] >= fNSectors)
150  continue;
151  // skip che pipe
152  if ((isector == 0 && possible_lay_sec[itest][1] == 5)
153  || (isector == 5 && possible_lay_sec[itest][1] == 0)
154  || (isector == 2 && possible_lay_sec[itest][1] == 3)
155  || (isector == 3 && possible_lay_sec[itest][1] == 2))
156  continue;
157  // if not @ limit of the sector
158  // if (tube->IsSectorLimit() == kFALSE && (possible_lay_sec[itest][1] == isector + 1 || possible_lay_sec[itest][1] == isector - 1))
159  // continue;
160 
161  // cout << "CHECKING " << possible_lay_sec[itest][0] << " " << possible_lay_sec[itest][1] << endl;
162  neigh_candidates = GetStrawRow(possible_lay_sec[itest][1], possible_lay_sec[itest][0]);
163 
164  for (size_t itube = 0; itube < neigh_candidates.size(); itube++) {
165  tubeid = neigh_candidates.at(itube);
166  if (tube->GetTubeID() == tubeid)
167  continue;
168  if (tubeid != -1)
169  tube2 = (PndSttTube*) fTubeArray->At(tubeid);
170  double distance = 1000;
171  if (tube2) distance = tube->GetDistance(tube2);
172  // pick the correct tolerance
173  if (tube2->IsSkew() == kTRUE && tube->IsSkew() == kTRUE)
174  tolerance = tolerance1;
175  else if (tube2->IsParallel() == kTRUE && tube->IsParallel() == kTRUE)
176  tolerance = tolerance0;
177  else {
178  if (ilayer < fNLayers_inner_parallel + 3)
179  tolerance = tolerance1;
180  else
181  tolerance = tolerance2;
182  }
183  if (distance < tolerance) {
184  int size = neighboring.GetSize();
185  neighboring.Set(size + 1);
186  neighboring.AddAt(tubeid, size);
187  // cout << "ADD " << tubeid << " " << distance << endl;
188  }
189  }
190  }
191  return neighboring;
192 }
const vector< int > & GetStrawRow(int sector, int row) const
TClonesArray * fTubeArray
Double_t GetDistance(PndSttTube *tube)
Definition: PndSttTube.cxx:153
int GetLayerID()
Definition: PndSttTube.cxx:128
Int_t GetTubeID()
Definition: PndSttTube.cxx:103
bool IsParallel()
Definition: PndSttTube.h:66
int GetSectorID()
Definition: PndSttTube.cxx:124
bool IsSkew()
Definition: PndSttTube.h:70
TArrayI PndSttGeometryMap::FindNeighborings ( int  tubeId)

Definition at line 194 of file PndSttGeometryMap.cxx.

References FindNeighborings(), and fTubeArray.

194  {
195 
196  PndSttTube* tube = (PndSttTube*) fTubeArray->At(tubeId);
197  return FindNeighborings(tube);
198 }
TClonesArray * fTubeArray
TArrayI FindNeighborings(PndSttTube *tube)
void PndSttGeometryMap::GenerateAngles ( )
private

Definition at line 332 of file PndSttGeometryMap.cxx.

References fSectorEnd, fSectorStart, and Pi.

Referenced by GenerateStrawMapAngleGeoType1().

333 {
334  fSectorStart.push_back(1.57);
335  fSectorEnd.push_back(2.62);
336  fSectorStart.push_back(2.62);
337  fSectorEnd.push_back(-2.62+2*TMath::Pi());
338  fSectorStart.push_back(-2.62+2*TMath::Pi());
339  fSectorEnd.push_back(-1.57+2*TMath::Pi());
340  fSectorStart.push_back(-1.57+2*TMath::Pi());
341  fSectorEnd.push_back(-0.52+2*TMath::Pi());
342  fSectorStart.push_back(-0.52+2*TMath::Pi());
343  fSectorEnd.push_back(0.52);
344  fSectorStart.push_back(0.52);
345  fSectorEnd.push_back(1.57);
346 }
vector< double > fSectorStart
vector< double > fSectorEnd
Double_t Pi
void PndSttGeometryMap::GenerateStrawMap ( Int_t  map)

Definition at line 70 of file PndSttGeometryMap.cxx.

References fGeoType, and GenerateStrawMapGeoType1().

Referenced by PndSttGeometryMap().

70  {
72 }
PndTransMap * map
Definition: sim_emc_apd.C:99
void GenerateStrawMapGeoType1(Int_t map)
void PndSttGeometryMap::GenerateStrawMapAngleGeoType1 ( )

Definition at line 348 of file PndSttGeometryMap.cxx.

References counter, fAxialStraw, fEndTube, fLayerOfStraw, fNLayers, fNSectors, fSectorEnd, fSectorOfStraw, fSectorStart, fShift, fShiftSkew, fStartTube, fStrawIndex, fStrawMapInitialized, fTubeArray, fVerbose, GenerateAngles(), PndSttTube::GetPosition(), GetStrawRow(), PndSttTube::GetWireDirection(), i, phi, Pi, row, PndSttTube::SetLayerID(), and PndSttTube::SetSectorID().

Referenced by GenerateStrawMapGeoType1().

349 {
350  GenerateAngles();
351 
352  vector<int> currentRow;
353  int sector = 0;
354  int lastsector = 0;
355  int row = 0;
356  fSectorOfStraw.push_back(-1);
357  fLayerOfStraw.push_back(-1);
358  fAxialStraw.push_back(false);
359  if(fVerbose > 0) cout << "Generating straw map for " << fTubeArray->GetEntriesFast() << " straws." << endl;
360  for (int i = 1; i < fTubeArray->GetEntriesFast(); i++) {
361  if(fVerbose > 0) cout << "Finding tube." << endl;
362  PndSttTube* tube = (PndSttTube*) fTubeArray->At(i);
363  if(fVerbose > 0) cout << "Tube address: " << tube << endl;
364  bool isaxial = (tube->GetWireDirection().Theta() < 0.001);
365  if(fVerbose > 0) {
366  cout << "Axial Straw: " << isaxial << endl;
367  cout << "Wire Direction: ";
368  tube->GetWireDirection().Print();
369  }
370  double phi = tube->GetPosition().Phi();
371  if(fVerbose > 0) cout << "Phi: " << phi << endl;
372  if (phi < 0) phi += 2*TMath::Pi();
373  if(fVerbose > 0) cout << "Checking sector." << endl;
374  while ( !( (phi > fSectorStart.at(sector)) && (phi < fSectorEnd.at(sector)) )
375  && !( (sector == 4) && ( (phi > fSectorStart.at(4)) || (phi < fSectorEnd.at(4)) ) ) ) {
376  sector++;
377  sector %= 6;
378  }
379  if (sector != lastsector) {
380  fStrawIndex[lastsector].push_back(currentRow);
381  currentRow.clear();
382  if(fVerbose > 0) cout << "SECTOR COMPLETE: Row " << row << " added to sector " << lastsector << endl;
383  }
384  if (sector < lastsector) row++;
385  lastsector = sector;
386  currentRow.push_back(i);
387  fSectorOfStraw.push_back(sector);
388  fLayerOfStraw.push_back(row);
389  fAxialStraw.push_back(isaxial);
390  if(fVerbose > 0) cout << "Straw " << i << " added to " << sector << ", " << row << endl;
391 
392  tube->SetLayerID(row);
393  tube->SetSectorID(sector);
394 
395 
396  }
397  fStrawIndex[lastsector].push_back(currentRow);
398  if(fVerbose > 0) cout << "STT COMPLETE. SECTOR COMPLETE: Row " << row << " added to sector " << lastsector << endl;
399 
400  fStartTube = (int**) malloc(sizeof(int*) * fNSectors);
401  fEndTube = (int**) malloc(sizeof(int*) * fNSectors);
402  fShift = (int**) malloc(sizeof(int*) * fNSectors);
403  fShiftSkew = (int**) malloc(sizeof(int*) * fNSectors);
404  for(int i = 0; i < fNSectors; i++) {
405  fStartTube[i] = (int*) malloc(sizeof(int*) * fNLayers);
406  fEndTube[i] = (int*) malloc(sizeof(int*) * fNLayers);
407  fShift[i] = (int*) malloc(sizeof(int*) * fNLayers);
408  fShiftSkew[i] = (int*) malloc(sizeof(int*) * fNLayers);
409  }
410 
411  const int size = 26* 6; // fNLayers * fNSectors
412  int shift_list[size] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 7, 11, 16,
413  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 5, 7, 10, 14, 19,
414  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 5, 7, 10, 14, 19,
415  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 7, 11, 16,
416  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 5, 7, 10, 14, 19,
417  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 5, 7, 10, 14, 19};
418  const int sizeskew = 8*6; //fNLayers_skew * fNSectors;
419  int shift_list_skew[sizeskew] = {16, 19, 16, 16, 19, 16,
420  17, 20, 17, 17, 20, 17,
421  19, 21, 19, 19, 21, 19,
422  20, 22, 20, 20, 22, 20,
423  21, 24, 21, 21, 24, 21,
424  22, 25, 22, 22, 25, 22,
425  24, 26, 24, 24, 26, 24,
426  25, 27, 25, 25, 27, 25};
427 
428  int counter = 0;
429  for(int i = 0; i < fNSectors; i++) {
430  for(int j = 0; j < fNLayers; j++) {
431  fStartTube[i][j] = GetStrawRow(i,j).front();
432  fEndTube[i][j] = GetStrawRow(i,j).back();
433  fShift[i][j] = shift_list[counter];
434  if (j<8 || j>15)
435  fShiftSkew[i][j] = 0;
436  else
437  fShiftSkew[i][j] = shift_list_skew[(j-8)*6+i];
438  counter++;
439  }
440  }
441 
442  if(fVerbose > 0) {
443  // =============== PRINT
444  for(int irow = 0; irow < fNSectors; irow++) {
445  for(int icol = 0; icol < fNLayers; icol++) {
446  cout << " " << fStartTube[irow][icol];
447  }
448  cout << endl;
449  }
450  cout << endl;
451  for(int irow = 0; irow < fNSectors; irow++) {
452  for(int icol = 0; icol < fNLayers; icol++) {
453  cout << " " << fEndTube[irow][icol];
454  }
455  cout << endl;
456  }
457  cout << endl;
458  for(int irow = 0; irow < fNSectors; irow++) {
459  for(int icol = 0; icol < fNLayers; icol++) {
460  cout << " " << fShift[irow][icol];
461  }
462  cout << endl;
463  }
464  cout << endl;
465  }
466 
467  fStrawMapInitialized = true;
468 }
int row
Definition: anaLmdDigi.C:67
void SetSectorID(int id)
Definition: PndSttTube.cxx:117
const vector< int > & GetStrawRow(int sector, int row) const
map< int, vector< vector< int > > > fStrawIndex
vector< int > fLayerOfStraw
Int_t i
Definition: run_full.C:25
TClonesArray * fTubeArray
vector< int > fSectorOfStraw
int counter
Definition: ZeeAnalysis.C:59
vector< double > fSectorStart
TVector3 GetPosition()
Definition: PndSttTube.cxx:87
vector< double > fSectorEnd
Double_t Pi
TVector3 GetWireDirection()
Definition: PndSttTube.cxx:107
void SetLayerID(int id)
Definition: PndSttTube.cxx:120
vector< bool > fAxialStraw
void PndSttGeometryMap::GenerateStrawMapGeoType1 ( Int_t  map)

Definition at line 325 of file PndSttGeometryMap.cxx.

References GenerateStrawMapAngleGeoType1(), and GenerateStrawMapTubeIDGeoType1().

Referenced by GenerateStrawMap().

325  {
327  else if(map == 1) GenerateStrawMapAngleGeoType1();
328 }
PndTransMap * map
Definition: sim_emc_apd.C:99
void PndSttGeometryMap::GenerateStrawMapTubeIDGeoType1 ( )

Definition at line 538 of file PndSttGeometryMap.cxx.

References fEndTube, fLayerOfStraw, fSectorOfStraw, fStartTube, fStrawIndex, fTubeArray, fVerbose, PndSttTube::GetWireDirection(), PndSttTube::SetLayerID(), and PndSttTube::SetSectorID().

Referenced by GenerateStrawMapGeoType1().

539 {
540  vector<int> currentRow;
541  int isector = 0, ilayer = 0;
542  int lastsector = 0;
543  fSectorOfStraw.push_back(-1);
544  fLayerOfStraw.push_back(-1);
545 
546  if(fVerbose > 0) cout << "Generating straw map for " << fTubeArray->GetEntriesFast() << " straws." << endl;
547  for (int itube = 1; itube < fTubeArray->GetEntriesFast(); itube++) {
548  if(fVerbose > 0) cout << "Finding tube." << endl;
549  PndSttTube* tube = (PndSttTube*) fTubeArray->At(itube);
550  bool isaxial = (tube->GetWireDirection().Theta() < 0.001);
551  if(fVerbose > 0) {
552  cout << "Axial Straw: " << isaxial << endl;
553  cout << "Wire Direction: ";
554  tube->GetWireDirection().Print();
555  }
556 
557  while(!(itube >= fStartTube[0][ilayer] && itube <= fEndTube[5][ilayer])) {
558  ilayer++;
559  isector = 0;
560  }
561 
562  while(!(itube >= fStartTube[isector][ilayer] && itube <= fEndTube[isector][ilayer])) {
563  isector++;
564  isector %= 6;
565  }
566 
567  if (isector != lastsector) {
568  fStrawIndex[lastsector].push_back(currentRow);
569  currentRow.clear();
570  if(fVerbose > 0) cout << "SECTOR COMPLETE: Row " << ilayer << " added to sector " << lastsector << endl;
571  }
572  // if (isector < lastsector) ilayer++;
573  lastsector = isector;
574  currentRow.push_back(itube);
575  fSectorOfStraw.push_back(isector);
576  fLayerOfStraw.push_back(ilayer);
577 
578  tube->SetLayerID(ilayer);
579  tube->SetSectorID(isector);
580 
581  if(fVerbose > 0) cout << "Straw " << itube << " added to " << isector << ", " << ilayer << endl;
582  }
583  fStrawIndex[lastsector].push_back(currentRow);
584  if(fVerbose > 0) cout << "SECTOR COMPLETE: Row " << ilayer << " added to sector " << lastsector << endl;
585 
586 }
void SetSectorID(int id)
Definition: PndSttTube.cxx:117
map< int, vector< vector< int > > > fStrawIndex
vector< int > fLayerOfStraw
TClonesArray * fTubeArray
vector< int > fSectorOfStraw
TVector3 GetWireDirection()
Definition: PndSttTube.cxx:107
void SetLayerID(int id)
Definition: PndSttTube.cxx:120
double PndSttGeometryMap::GetAngleBetweenTubes ( int  tubeID1,
int  tubeID2 
) const

Definition at line 200 of file PndSttGeometryMap.cxx.

References fTubeArray, PndSttTube::GetPosition(), phi, and Pi.

Referenced by InStraightLine().

200  {
201 
202  PndSttTube *tube1, *tube2;
203  tube1 = (PndSttTube*) fTubeArray->At(tubeID1);
204  tube2 = (PndSttTube*) fTubeArray->At(tubeID2);
205 
206  TVector3 pos1, pos2, direction;
207  pos1 = tube1->GetPosition();
208  pos2 = tube2->GetPosition();
209 
210  direction = pos2 - pos1;
211 
212  double phi = direction.Phi();
213  if (phi < 0)
214  phi = 2 * TMath::Pi() + phi;
215 
216  return phi;
217 }
TClonesArray * fTubeArray
TVector3 GetPosition()
Definition: PndSttTube.cxx:87
Double_t Pi
TArrayI PndSttGeometryMap::GetNeighboringsByMap ( int  tubeId)
int PndSttGeometryMap::GetRow ( int  strawindex) const
inline

Definition at line 47 of file PndSttGeometryMap.h.

References fLayerOfStraw.

Referenced by IsEdgeStraw(), and IsSectorBorderStraw().

47 {return fLayerOfStraw.at(strawindex);}
vector< int > fLayerOfStraw
int PndSttGeometryMap::GetSector ( int  strawindex) const
inline

Definition at line 48 of file PndSttGeometryMap.h.

References fSectorOfStraw.

Referenced by IsEdgeStraw(), and IsSectorBorderStraw().

48 {return fSectorOfStraw.at(strawindex);}
vector< int > fSectorOfStraw
const vector<int>& PndSttGeometryMap::GetStrawRow ( int  sector,
int  row 
) const
inline

Definition at line 49 of file PndSttGeometryMap.h.

References fStrawIndex.

Referenced by FindNeighborings(), GenerateStrawMapAngleGeoType1(), IsAxialRow(), IsEdgeStraw(), IsSectorBorderStraw(), and IsSkewedRow().

49 {return (fStrawIndex.find(sector))->second.at(row);}
int row
Definition: anaLmdDigi.C:67
map< int, vector< vector< int > > > fStrawIndex
const vector<vector<int> >& PndSttGeometryMap::GetStrawSector ( int  sector) const
inline

Definition at line 50 of file PndSttGeometryMap.h.

References fStrawIndex.

50 {return (fStrawIndex.find(sector))->second;}
map< int, vector< vector< int > > > fStrawIndex
bool PndSttGeometryMap::InStraightLine ( int  tube1,
int  tube2,
int  tube3 
) const

Definition at line 219 of file PndSttGeometryMap.cxx.

References GetAngleBetweenTubes(), and Pi.

219  {
220 
221  double diff = abs(
222  GetAngleBetweenTubes(tube1, tube2)
223  - GetAngleBetweenTubes(tube1, tube3));
224 
225  //accept a deviation of 1 percent
226  //if ((TMath::Pi() * 0.99) < diff & diff < (TMath::Pi() * 1.01)) {
227  if (((TMath::Pi() * 0.99) < diff) && (diff < (TMath::Pi() * 1.01))) { //[R.K. 01/2017] more explicit parenthesis logic
228  //tube1 is in the middle
229  return true;
230  } else if (diff < 0.01) {
231  //tube1 is at the edge of the line
232  return true;
233  } else
234  return false;
235 }
double GetAngleBetweenTubes(int tubeID1, int tubeID2) const
Double_t Pi
bool PndSttGeometryMap::IsAxialRow ( int  rowindex) const

Definition at line 521 of file PndSttGeometryMap.cxx.

References GetStrawRow(), and IsAxialStraw().

522 {
523  //only works if all straws in one row are of the same type
524  //which is the case for the current geometry
525  return IsAxialStraw(GetStrawRow(0, rowindex).at(0));
526 }
const vector< int > & GetStrawRow(int sector, int row) const
bool IsAxialStraw(int strawindex) const
bool PndSttGeometryMap::IsAxialStraw ( int  strawindex) const
inline

Definition at line 55 of file PndSttGeometryMap.h.

References fAxialStraw.

Referenced by IsAxialRow().

55 {return fAxialStraw.at(strawindex);}
vector< bool > fAxialStraw
bool PndSttGeometryMap::IsEdgeStraw ( int  strawindex) const

Definition at line 470 of file PndSttGeometryMap.cxx.

References GetRow(), GetSector(), and GetStrawRow().

Referenced by FillGeometryParametersGeoType1().

471 {
472  if (GetRow(strawindex) == 0) return true;
473  int endstraw = 0; //there is no straw index 0
474  switch (GetSector(strawindex)) {
475  case 0: endstraw = GetStrawRow(GetSector(strawindex), GetRow(strawindex)).front();
476  break;
477  case 2: endstraw = GetStrawRow(GetSector(strawindex), GetRow(strawindex)).back();
478  break;
479  case 3: endstraw = GetStrawRow(GetSector(strawindex), GetRow(strawindex)).front();
480  break;
481  case 5: endstraw = GetStrawRow(GetSector(strawindex), GetRow(strawindex)).back();
482  break;
483  default: return false;
484  };
485  return (strawindex == endstraw);
486 }
const vector< int > & GetStrawRow(int sector, int row) const
int GetRow(int strawindex) const
int GetSector(int strawindex) const
int PndSttGeometryMap::IsSectorBorderStraw ( int  strawindex) const

Definition at line 488 of file PndSttGeometryMap.cxx.

References fShiftSkew, fTubeArray, PndSttTube::GetHalfLength(), GetRow(), GetSector(), GetStrawRow(), and PndSttTube::IsParallel().

Referenced by FillGeometryParametersGeoType1().

489 {
490  PndSttTube* tube = (PndSttTube*) fTubeArray->At(strawindex);
491  if (tube->IsParallel()) {
492  int endstrawcw = GetStrawRow(GetSector(strawindex), GetRow(strawindex)).front();
493  int endstrawccw = GetStrawRow(GetSector(strawindex), GetRow(strawindex)).back();
494  if (strawindex == endstrawcw) return -1;
495  if (strawindex == endstrawccw) return 1;
496  return 0;
497  }
498  else {
499  int endstrawcw = GetStrawRow(GetSector(strawindex), GetRow(strawindex)).front();
500  int endstrawscw = endstrawcw + fShiftSkew[GetSector(strawindex)][GetRow(strawindex)];
501  int endstrawccw = endstrawscw -1;
502  if (tube->GetHalfLength()==75) {
503  if (strawindex == endstrawcw) return -1;
504  if (strawindex == endstrawccw) return 1;
505  return 0;
506  }
507  else {
508  if (strawindex==endstrawccw+1 || strawindex==endstrawccw+3 || strawindex==endstrawccw+5 ||
509  strawindex==endstrawccw+7 || strawindex==endstrawccw+9 || strawindex==endstrawccw+11 ||
510  strawindex==endstrawccw+13 || strawindex==endstrawccw+15)
511  return 1;
512  else if (strawindex==endstrawscw +1 || strawindex==endstrawscw+3 || strawindex==endstrawscw+5 ||
513  strawindex==endstrawscw+7 || strawindex==endstrawscw+9 || strawindex==endstrawscw+11 ||
514  strawindex==endstrawscw+13 || strawindex==endstrawscw+15)
515  return -1;
516  }
517  }
518  return -1000;
519 }
const vector< int > & GetStrawRow(int sector, int row) const
Double_t GetHalfLength()
Definition: PndSttTube.cxx:99
TClonesArray * fTubeArray
int GetRow(int strawindex) const
int GetSector(int strawindex) const
bool IsParallel()
Definition: PndSttTube.h:66
bool PndSttGeometryMap::IsSkewedRow ( int  rowindex) const

Definition at line 528 of file PndSttGeometryMap.cxx.

References GetStrawRow(), and IsSkewedStraw().

529 {
530  //only works if all straws in one row are of the same type
531  //which is the case for the current geometry
532  return IsSkewedStraw(GetStrawRow(0, rowindex).at(0));
533 }
const vector< int > & GetStrawRow(int sector, int row) const
bool IsSkewedStraw(int strawindex) const
bool PndSttGeometryMap::IsSkewedStraw ( int  strawindex) const
inline

Definition at line 56 of file PndSttGeometryMap.h.

References fAxialStraw.

Referenced by IsSkewedRow(), and PndSttCellTrackFinderData::PndSttCellTrackFinderData().

56 {return !(fAxialStraw.at(strawindex));}
vector< bool > fAxialStraw
PndSttGeometryMap& PndSttGeometryMap::operator= ( const PndSttGeometryMap )
delete
void PndSttGeometryMap::SetGeneralParameters ( )

Definition at line 66 of file PndSttGeometryMap.cxx.

References fGeoType, and SetGeneralParametersGeoType1().

Referenced by PndSttGeometryMap().

66  {
68 }
void PndSttGeometryMap::SetGeneralParametersGeoType1 ( )

Definition at line 82 of file PndSttGeometryMap.cxx.

References fNLayers, fNLayers_fillup_parallel, fNLayers_inner_parallel, fNLayers_outer_parallel, fNLayers_skew, fNSectors, fNTubes, fNTubes_fillup_parallel, fNTubes_inner_parallel, fNTubes_outer_parallel, and fNTubes_skewed.

Referenced by SetGeneralParameters().

82  { // CHECK whether it depends on geometry or not
83 
84  // fNLayers = 18;
85  // fNSectors = 6;
86  // const int size = 18* 6; // CHECK
87 
88  fNLayers = 26;
89  fNSectors = 6;
90  //const int size = 26* 6; // CHECK //[R.K. 01/2017] unused variable?
91 
92 
96  fNTubes_skewed = 1744;
98 
100  fNLayers_skew = 8;
103 
104 }
void PndSttGeometryMap::SetVerbose ( int  ver)
inline

Definition at line 76 of file PndSttGeometryMap.h.

References fVerbose.

76 { fVerbose = ver; }

Member Data Documentation

vector<bool> PndSttGeometryMap::fAxialStraw
private

Definition at line 88 of file PndSttGeometryMap.h.

Referenced by GenerateStrawMapAngleGeoType1(), IsAxialStraw(), and IsSkewedStraw().

Int_t ** PndSttGeometryMap::fEndTube
private
Int_t PndSttGeometryMap::fGeoType
private
vector<int> PndSttGeometryMap::fLayerOfStraw
private
Int_t PndSttGeometryMap::fNLayers
private
Int_t PndSttGeometryMap::fNLayers_fillup_parallel
private

Definition at line 95 of file PndSttGeometryMap.h.

Referenced by SetGeneralParametersGeoType1().

Int_t PndSttGeometryMap::fNLayers_inner_parallel
private

Definition at line 95 of file PndSttGeometryMap.h.

Referenced by FindNeighborings(), and SetGeneralParametersGeoType1().

Int_t PndSttGeometryMap::fNLayers_outer_parallel
private

Definition at line 95 of file PndSttGeometryMap.h.

Referenced by SetGeneralParametersGeoType1().

Int_t PndSttGeometryMap::fNLayers_skew
private

Definition at line 95 of file PndSttGeometryMap.h.

Referenced by SetGeneralParametersGeoType1().

Int_t PndSttGeometryMap::fNSectors
private
Int_t PndSttGeometryMap::fNTubes
private

Definition at line 95 of file PndSttGeometryMap.h.

Referenced by FillStrawNeighborsMap(), and SetGeneralParametersGeoType1().

Int_t PndSttGeometryMap::fNTubes_fillup_parallel
private

Definition at line 95 of file PndSttGeometryMap.h.

Referenced by SetGeneralParametersGeoType1().

Int_t PndSttGeometryMap::fNTubes_inner_parallel
private

Definition at line 95 of file PndSttGeometryMap.h.

Referenced by SetGeneralParametersGeoType1().

Int_t PndSttGeometryMap::fNTubes_outer_parallel
private

Definition at line 95 of file PndSttGeometryMap.h.

Referenced by SetGeneralParametersGeoType1().

Int_t PndSttGeometryMap::fNTubes_skewed
private

Definition at line 95 of file PndSttGeometryMap.h.

Referenced by SetGeneralParametersGeoType1().

vector<double> PndSttGeometryMap::fSectorEnd
private

Definition at line 90 of file PndSttGeometryMap.h.

Referenced by GenerateAngles(), and GenerateStrawMapAngleGeoType1().

vector<int> PndSttGeometryMap::fSectorOfStraw
private
vector<double> PndSttGeometryMap::fSectorStart
private

Definition at line 89 of file PndSttGeometryMap.h.

Referenced by GenerateAngles(), and GenerateStrawMapAngleGeoType1().

Int_t ** PndSttGeometryMap::fShift
private

Definition at line 96 of file PndSttGeometryMap.h.

Referenced by GenerateStrawMapAngleGeoType1().

Int_t ** PndSttGeometryMap::fShiftSkew
private

Definition at line 96 of file PndSttGeometryMap.h.

Referenced by GenerateStrawMapAngleGeoType1(), and IsSectorBorderStraw().

Int_t** PndSttGeometryMap::fStartTube
private
map<int, vector< vector<int> > > PndSttGeometryMap::fStrawIndex
private
bool PndSttGeometryMap::fStrawMapInitialized
private

Definition at line 91 of file PndSttGeometryMap.h.

Referenced by GenerateStrawMapAngleGeoType1().

map<int, TArrayI> PndSttGeometryMap::fStrawNeighbors
private

Definition at line 85 of file PndSttGeometryMap.h.

Referenced by FillStrawNeighborsMap(), and GetNeighboringsByMap().

TClonesArray* PndSttGeometryMap::fTubeArray
private
Int_t PndSttGeometryMap::fVerbose
private

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