Public Member Functions | Private Member Functions | Private Attributes | List of all members
gar::geo::seg::ChannelMapStandardAlg Class Reference

#include <ChannelMapStandardAlg.h>

Inheritance diagram for gar::geo::seg::ChannelMapStandardAlg:
gar::geo::seg::ChannelMapAlg

Public Member Functions

 ChannelMapStandardAlg (fhicl::ParameterSet const &p)
 
void Initialize (GeometryCore &geo) override
 
void Uninitialize () override
 
unsigned int Nchannels () const override
 
unsigned int NearestChannel (float const *xyz) const override
 
void NearestChannelInfo (float const *xyz, gar::geo::ChanWithNeighbors &cwn) const override
 
void ChannelToPosition (unsigned int chan, float *xyz) const override
 
unsigned int GapChannelNumber () const override
 
float GetIROCInnerRadius () const override
 
float GetIROCOuterRadius () const override
 
float GetOROCInnerRadius () const override
 
float GetOROCOuterRadius () const override
 
float GetOROCPadHeightChangeRadius () const override
 
- Public Member Functions inherited from gar::geo::seg::ChannelMapAlg
virtual ~ChannelMapAlg ()=default
 

Private Member Functions

void NearestChannelWithROCType (float const *xyz, gar::geo::ROCType &roctype, unsigned int &nearestchannel) const
 
void CheckPositions ()
 Method to check consistency of NearestChannel and ChannelToPosition. More...
 

Private Attributes

const gar::geo::GeometryCorefGeo
 
AliTPCROCfROC
 TPC Readout geometry from ALICE software stack. More...
 
UInt_t fNumSectors
 Number of sectors – should be 18. More...
 
float fSectorOffsetAngleDeg
 Angle to rotate to the middle of the first sector – should be 10 degrees. More...
 
float fPhiSectorWidth
 width of a sector in phi (in radians) More...
 
UInt_t fNumPadRowsIROC
 Number of pad rows in the inner ROC – 64 (TDR) or 63 (ALICE code) More...
 
UInt_t fNumPadRowsOROCI
 Number of small-pitch pad rows in the outer ROC. More...
 
UInt_t fNumPadRowsOROCO
 Number of large-pitch pad rows in the outer ROC. More...
 
float fPadHeightIROC
 Pad height in the inner ROC (cm) More...
 
float fPadWidthIROC
 Pad width in the inner ROC (cm) More...
 
float fPadHeightOROCI
 Pad height in the outer ROC inner part (cm) More...
 
float fPadHeightOROCO
 Pad height in the outer ROC outer part (cm) More...
 
float fPadWidthOROC
 Pad width in the OROC (assumed same for both sections) More...
 
float fIROCInnerRadius
 Radius from the beam in cm along the midline of the sector to the inner IROC row inner edge. More...
 
float fIROCOuterRadius
 Radius from the beam in cm along the midline of the sector to the outer IROC row outer edge. More...
 
float fOROCInnerRadius
 Radius from the beam in cm along the midline of the sector to the inner OROC row inner edge. More...
 
float fOROCPadHeightChangeRadius
 Radius from the beam in cm along the midline of the sector to the OROC pad height change. More...
 
float fOROCOuterRadius
 Radius from the beam in cm along the midline of the sector to the outer OROC row outer edge. More...
 
float fXPlaneLoc
 Location of pixel plane in X (only positive. Assume other one is at -X) More...
 
std::vector< UInt_t > fNumPadsPerRow
 indexed by "global" pad row number for a single sector More...
 
std::vector< UInt_t > fFirstPadInRow
 indexed by "global" pad row number for a single sector More...
 
std::vector< XYZPosfPixelCenters
 pixel centers (in cm) – for the entire detector More...
 
UInt_t fNumChansPerSector
 Number of TPC pad channels per sector. More...
 
std::vector< UInt_t > fCenterNumPadsPerRow
 pads per row for the center hole filler More...
 
std::vector< UInt_t > fCenterFirstPadInRow
 first pad in row for center hole filler More...
 
float fCenterPadWidth
 Width of square pads in center hole filler. More...
 
UInt_t fNumChansCenter
 Number of channels in center hole filler. More...
 
XYZPos fTPCCenter
 Location of the center of the TPC. More...
 
UInt_t fGapChannelNumber
 channel number GetNearestChannel returns when xyz is in a gap More...
 

Detailed Description

Definition at line 43 of file ChannelMapStandardAlg.h.

Constructor & Destructor Documentation

gar::geo::seg::ChannelMapStandardAlg::ChannelMapStandardAlg ( fhicl::ParameterSet const &  p)

Definition at line 18 of file ChannelMapStandardAlg.cxx.

19  {
20  }

Member Function Documentation

void gar::geo::seg::ChannelMapStandardAlg::ChannelToPosition ( unsigned int  chan,
float *  xyz 
) const
overridevirtual

Implements gar::geo::seg::ChannelMapAlg.

Definition at line 555 of file ChannelMapStandardAlg.cxx.

557  {
558  if (chan < fPixelCenters.size())
559  {
560  xyz[0] = fPixelCenters[chan].x;
561  xyz[1] = fPixelCenters[chan].y;
562  xyz[2] = fPixelCenters[chan].z;
563  }
564  else // gap channel
565  {
566  xyz[0] = -999;
567  xyz[1] = -999;
568  xyz[2] = -999;
569  }
570  return;
571  }
std::vector< XYZPos > fPixelCenters
pixel centers (in cm) – for the entire detector
void gar::geo::seg::ChannelMapStandardAlg::CheckPositions ( )
private

Method to check consistency of NearestChannel and ChannelToPosition.

Definition at line 180 of file ChannelMapStandardAlg.cxx.

181  {
182  std::cout << "gar::ChannelMapStandardAlg::CheckPositions -- checking positions" << std::endl;
183 
184  UInt_t numchans = Nchannels();
185  float xyz[3] = {0, 0, 0};
186 
187  for (UInt_t ichan = 0; ichan < numchans; ++ichan)
188  {
189 
190  ChannelToPosition(ichan, xyz);
191  // if we are in just one drift volume, check only the postiive X channels
192  if (xyz[0] < fGeo->TPCXCent() && fGeo->TPCNumDriftVols() == 1) continue;
193 
194  UInt_t chancheck = NearestChannel(xyz);
195  if (chancheck != ichan)
196  {
197  std::cout << "gar::ChannelMapStandardAlg::CheckPositions mismatch, input chan, xyz, output chan " << ichan << " "
198  << xyz[0] << " " << xyz[1] << " " << xyz[2] << " " << chancheck << std::endl;
199  }
200 
201  //if (ichan == 30000 || ichan == 100000 || ichan == 230000 || ichan == 13 || ichan == 3001 || ichan == 6001 || ichan == 309000)
202  //{
203  //std::cout << "trjc " << ichan << " " << xyz[1] << " " << xyz[2] << std::endl;
204  //float varxyz[3] = {0,0,0};
205  //for (float dy=-2.0; dy<2.0; dy += 0.01)
206  // {
207  // varxyz[1] = xyz[1] + dy;
208  // for (float dz=-2.0; dz<2.0; dz += 0.01)
209  // {
210  // varxyz[2] = xyz[2] + dz;
211  // UInt_t chancheck2 = NearestChannel(varxyz);
212  // if (chancheck2 == ichan)
213  // {
214  // std::cout << "trjc " << ichan << " " << varxyz[1] << " " << varxyz[2] << std::endl;
215  // }
216  // }
217  // }
218  //}
219 
220  }
221 
222  std::cout << "gar::ChannelMapStandardAlg::CheckPositions -- done checking positions" << std::endl;
223  }
unsigned int NearestChannel(float const *xyz) const override
void ChannelToPosition(unsigned int chan, float *xyz) const override
int TPCNumDriftVols() const
Returns number of TPC drift volumes.
Definition: GeometryCore.h:771
float TPCXCent() const
Returns the X location of the center of the TPC in cm.
Definition: GeometryCore.h:778
const gar::geo::GeometryCore * fGeo
unsigned int Nchannels() const override
QTextStream & endl(QTextStream &s)
unsigned int gar::geo::seg::ChannelMapStandardAlg::GapChannelNumber ( ) const
inlineoverridevirtual

Implements gar::geo::seg::ChannelMapAlg.

Definition at line 55 of file ChannelMapStandardAlg.h.

55 { return fGapChannelNumber; };
UInt_t fGapChannelNumber
channel number GetNearestChannel returns when xyz is in a gap
float gar::geo::seg::ChannelMapStandardAlg::GetIROCInnerRadius ( ) const
inlineoverridevirtual

Implements gar::geo::seg::ChannelMapAlg.

Definition at line 56 of file ChannelMapStandardAlg.h.

56 {return fIROCInnerRadius;};
float fIROCInnerRadius
Radius from the beam in cm along the midline of the sector to the inner IROC row inner edge...
float gar::geo::seg::ChannelMapStandardAlg::GetIROCOuterRadius ( ) const
inlineoverridevirtual

Implements gar::geo::seg::ChannelMapAlg.

Definition at line 57 of file ChannelMapStandardAlg.h.

57 {return fIROCOuterRadius;};
float fIROCOuterRadius
Radius from the beam in cm along the midline of the sector to the outer IROC row outer edge...
float gar::geo::seg::ChannelMapStandardAlg::GetOROCInnerRadius ( ) const
inlineoverridevirtual

Implements gar::geo::seg::ChannelMapAlg.

Definition at line 58 of file ChannelMapStandardAlg.h.

58 {return fOROCInnerRadius;};
float fOROCInnerRadius
Radius from the beam in cm along the midline of the sector to the inner OROC row inner edge...
float gar::geo::seg::ChannelMapStandardAlg::GetOROCOuterRadius ( ) const
inlineoverridevirtual

Implements gar::geo::seg::ChannelMapAlg.

Definition at line 59 of file ChannelMapStandardAlg.h.

59 {return fOROCOuterRadius;};
float fOROCOuterRadius
Radius from the beam in cm along the midline of the sector to the outer OROC row outer edge...
float gar::geo::seg::ChannelMapStandardAlg::GetOROCPadHeightChangeRadius ( ) const
inlineoverridevirtual

Implements gar::geo::seg::ChannelMapAlg.

Definition at line 60 of file ChannelMapStandardAlg.h.

float fOROCPadHeightChangeRadius
Radius from the beam in cm along the midline of the sector to the OROC pad height change...
void gar::geo::seg::ChannelMapStandardAlg::Initialize ( GeometryCore geo)
overridevirtual

Implements gar::geo::seg::ChannelMapAlg.

Definition at line 24 of file ChannelMapStandardAlg.cxx.

25  {
26  // start over:
27  Uninitialize();
28 
29  fGeo = &geo;
30 
32 
33  //std::string driftvolname = geo.GetGArTPCVolumeName();
34 
35  fTPCCenter.x = geo.TPCXCent();
36  fTPCCenter.y = geo.TPCYCent();
37  fTPCCenter.z = geo.TPCZCent();
38 
39  std::cout << "Initializing TPC channel standard map alg with TPC Center: " << fTPCCenter.x << " " << fTPCCenter.y << " " << fTPCCenter.z << std::endl;
40 
41  // get these from the geometry?
42  // all dimensions are in cm
43 
44  fNumSectors = 18;
45  fSectorOffsetAngleDeg = 10.0;
46  fPhiSectorWidth = 2.0*TMath::Pi()/fNumSectors;
55 
61 
62  // old hardcoded numbers
63  //fOROCOuterRadius = 246.6;
64  //fOROCInnerRadius = 134.6;
65  //fIROCOuterRadius = 132.1;
66 
67  fGapChannelNumber = 10000000;
68 
69  fCenterPadWidth = 0.6;
70  fXPlaneLoc = geo.TPCLength()/2.0;
71  //std::cout << "Plane loc from geometry service " << fXPlaneLoc << std::endl;
72  //float TsectorH = TMath::Tan(TMath::DegToRad()*(360/(fNumSectors*2)));
73 
74  // count up channels
75  // get the xyz center for each pixel and fill pad row information -- nominal geometry, negative x side
76 
77 
78  for (UInt_t isector = 0; isector < fNumSectors; ++isector)
79  {
80  UInt_t ipadacc=0;
81 
82  // Inner Readout Chamber
83 
84  for (UInt_t irow = 0; irow < fNumPadRowsIROC; ++irow)
85  {
86  UInt_t numpads = fROC->GetNPads(isector,irow);
87  if (isector == 0)
88  {
89  fNumPadsPerRow.push_back(numpads);
90  fFirstPadInRow.push_back(ipadacc);
91  }
92  for (UInt_t ipad = 0; ipad < numpads; ++ipad)
93  {
94  Float_t pos[3];
95  fROC->GetPositionGlobal(isector,irow,ipad,pos);
96  pos[2] = pos[0];
97  pos[0] = -fXPlaneLoc;
98  fPixelCenters.emplace_back(pos[0]+fTPCCenter.x,pos[1]+fTPCCenter.y,pos[2]+fTPCCenter.z);
99  ipadacc++;
100  }
101  }
102 
103  // Outer readout chamber
104 
105  for (UInt_t irow = 0; irow < fNumPadRowsOROCI + fNumPadRowsOROCO; ++irow)
106  {
107 
108  UInt_t numpads = fROC->GetNPads(isector + 36,irow);
109  if (isector == 0)
110  {
111  fNumPadsPerRow.push_back(numpads);
112  fFirstPadInRow.push_back(ipadacc);
113  }
114  for (UInt_t ipad = 0; ipad < numpads; ++ipad)
115  {
116  Float_t pos[3];
117  fROC->GetPositionGlobal(isector + 36,irow,ipad,pos);
118  pos[2] = pos[0];
119  pos[0] = -fXPlaneLoc;
120  fPixelCenters.emplace_back(pos[0]+fTPCCenter.x,pos[1]+fTPCCenter.y,pos[2]+fTPCCenter.z);
121  ipadacc++;
122  }
123  if (isector == 0) fNumChansPerSector = ipadacc;
124  }
125  } // end of loop over sectors
126 
127  // fill in the hole with a rectangular grid of pixels. Make x,y,z=0 a pad corner. Put pads under the cover electrode for now
128 
129  fNumChansCenter = 0;
130  float rcenter = fIROCInnerRadius - 2.0;
131  UInt_t nrowscenter = 2*TMath::Floor(rcenter/fCenterPadWidth);
132  for (UInt_t irow = 0; irow < nrowscenter; ++irow)
133  {
134  float yloc = ( (float) irow - (float) nrowscenter/2 + 0.5 )*fCenterPadWidth;
135  UInt_t numpads = 2*TMath::Floor( TMath::Sqrt(rcenter*rcenter - yloc*yloc)/fCenterPadWidth );
136  fCenterNumPadsPerRow.push_back(numpads);
138  float zloc = 0;
139  for (UInt_t ipad = 0; ipad < numpads; ++ipad)
140  {
141  zloc = ( (float) ipad - (float) numpads/2 + 0.5 )*fCenterPadWidth;
142  XYZPos pixpos(-fXPlaneLoc+fTPCCenter.x,yloc+fTPCCenter.y,zloc+fTPCCenter.z);
143  fPixelCenters.push_back(pixpos);
144  fNumChansCenter++;
145  }
146  }
147 
148  //done with all channels on one side
149 
150  UInt_t numpixside = fPixelCenters.size();
151 
152  // duplicate the yz geometry for the opposite side -- positive x
153 
154  for (UInt_t ipix = 0; ipix < numpixside; ++ipix)
155  {
156  XYZPos pixpos(fXPlaneLoc+fTPCCenter.x,fPixelCenters[ipix].y,fPixelCenters[ipix].z);
157  fPixelCenters.push_back(pixpos);
158  //std::cout << "trjpix " << fPixelCenters[ipix].z << " " << fPixelCenters[ipix].y << std::endl;
159  }
160 
161 
162  MF_LOG_DEBUG("ChannelMapStandardAlg")
163  << "There are "
164  << fPixelCenters.size()
165  << " pixels and each sector has "
166  << fNumPadsPerRow.size()
167  << " pad rows";
168 
169  CheckPositions();
170 
171  return;
172  }
float fPadWidthOROC
Pad width in the OROC (assumed same for both sections)
UInt_t fNumChansPerSector
Number of TPC pad channels per sector.
UInt_t fNumPadRowsOROCO
Number of large-pitch pad rows in the outer ROC.
std::vector< UInt_t > fCenterNumPadsPerRow
pads per row for the center hole filler
float fPhiSectorWidth
width of a sector in phi (in radians)
Float_t GetOuterPadWidth() const
Definition: AliTPCROC.h:56
Float_t GetInnerPadLength() const
Definition: AliTPCROC.h:54
float fPadHeightOROCI
Pad height in the outer ROC inner part (cm)
float fPadHeightOROCO
Pad height in the outer ROC outer part (cm)
Float_t GetOuter1PadLength() const
Definition: AliTPCROC.h:57
float fIROCOuterRadius
Radius from the beam in cm along the midline of the sector to the outer IROC row outer edge...
static AliTPCROC * Instance()
Definition: AliTPCROC.cxx:34
UInt_t GetNRowLow() const
Definition: AliTPCROC.h:51
AliTPCROC * fROC
TPC Readout geometry from ALICE software stack.
std::vector< UInt_t > fFirstPadInRow
indexed by "global" pad row number for a single sector
std::vector< UInt_t > fCenterFirstPadInRow
first pad in row for center hole filler
Float_t GetOuterRadiusUp() const
Definition: AliTPCROC.h:40
float fXPlaneLoc
Location of pixel plane in X (only positive. Assume other one is at -X)
float fOROCInnerRadius
Radius from the beam in cm along the midline of the sector to the inner OROC row inner edge...
float fPadWidthIROC
Pad width in the inner ROC (cm)
float fOROCPadHeightChangeRadius
Radius from the beam in cm along the midline of the sector to the OROC pad height change...
XYZPos fTPCCenter
Location of the center of the TPC.
float fIROCInnerRadius
Radius from the beam in cm along the midline of the sector to the inner IROC row inner edge...
float fCenterPadWidth
Width of square pads in center hole filler.
UInt_t fNumPadRowsIROC
Number of pad rows in the inner ROC – 64 (TDR) or 63 (ALICE code)
float fOROCOuterRadius
Radius from the beam in cm along the midline of the sector to the outer OROC row outer edge...
UInt_t fNumSectors
Number of sectors – should be 18.
void CheckPositions()
Method to check consistency of NearestChannel and ChannelToPosition.
float fPadHeightIROC
Pad height in the inner ROC (cm)
std::vector< UInt_t > fNumPadsPerRow
indexed by "global" pad row number for a single sector
Float_t GetOuterRadiusLow() const
Definition: AliTPCROC.h:39
std::vector< XYZPos > fPixelCenters
pixel centers (in cm) – for the entire detector
UInt_t fNumChansCenter
Number of channels in center hole filler.
UInt_t GetNRowUp2() const
Definition: AliTPCROC.h:53
UInt_t GetNPads(UInt_t sector, UInt_t row) const
Definition: AliTPCROC.h:30
float fSectorOffsetAngleDeg
Angle to rotate to the middle of the first sector – should be 10 degrees.
#define MF_LOG_DEBUG(id)
Float_t GetInnerPadWidth() const
Definition: AliTPCROC.h:55
Float_t GetOuter2PadLength() const
Definition: AliTPCROC.h:58
const gar::geo::GeometryCore * fGeo
UInt_t GetNRowUp1() const
Definition: AliTPCROC.h:52
UInt_t fGapChannelNumber
channel number GetNearestChannel returns when xyz is in a gap
Float_t GetInnerRadiusUp() const
Definition: AliTPCROC.h:38
LArSoft geometry interface.
Definition: ChannelGeo.h:16
Float_t GetInnerRadiusLow() const
Definition: AliTPCROC.h:37
UInt_t fNumPadRowsOROCI
Number of small-pitch pad rows in the outer ROC.
QTextStream & endl(QTextStream &s)
void GetPositionGlobal(UInt_t sector, UInt_t row, UInt_t pad, Float_t *pos)
Definition: AliTPCROC.cxx:432
unsigned int gar::geo::seg::ChannelMapStandardAlg::Nchannels ( ) const
overridevirtual

Implements gar::geo::seg::ChannelMapAlg.

Definition at line 226 of file ChannelMapStandardAlg.cxx.

227  {
228  return (fPixelCenters.size());
229  }
std::vector< XYZPos > fPixelCenters
pixel centers (in cm) – for the entire detector
unsigned int gar::geo::seg::ChannelMapStandardAlg::NearestChannel ( float const *  xyz) const
overridevirtual

Implements gar::geo::seg::ChannelMapAlg.

Definition at line 234 of file ChannelMapStandardAlg.cxx.

235  {
236  gar::geo::ROCType roctype = HFILLER;
237  unsigned int nearestchannel;
238  NearestChannelWithROCType(xyz, roctype, nearestchannel);
239  return nearestchannel;
240  }
enum gar::geo::ROCType_ ROCType
void NearestChannelWithROCType(float const *xyz, gar::geo::ROCType &roctype, unsigned int &nearestchannel) const
void gar::geo::seg::ChannelMapStandardAlg::NearestChannelInfo ( float const *  xyz,
gar::geo::ChanWithNeighbors cwn 
) const
overridevirtual

Implements gar::geo::seg::ChannelMapAlg.

Definition at line 408 of file ChannelMapStandardAlg.cxx.

409  {
410 
411  // make a list of nearby pads we want to distribute charge using the pad response function
412  TVector3 xvec(xyz[0],xyz[1],xyz[2]);
413  float xyztest[3] = {0,0,0};
414  TVector3 xvectestm(0,0,0);
415  bool havem = false;
416  TVector3 xvectestp(0,0,0);
417  bool havep = false;
418 
419  TVector3 zerovec(0,0,0); // dummy vector to put in until we have directions worked out
420 
421  cwn.clear();
422  unsigned int chan;
423  gar::geo::ROCType roctype;
424  NearestChannelWithROCType(xyz,roctype,chan); // get the nearest channel ID and add it to the list
425  ChannelToPosition(chan,xyztest);
426  TVector3 xvecchan(xyztest[0],xyztest[1],xyztest[2]);
427  gar::geo::ChanWithPos centerchanwithpos = {chan, xvecchan, zerovec, roctype}; // put the direction vector in later
428  cwn.push_back(centerchanwithpos);
429  if (chan == fGapChannelNumber) return; // we're in a gap so don't look for neighbors
430 
431  if (chan>0) // look on one side in this pad row -- assume channels are numbered along pad rows
432  {
433  ChannelToPosition(chan-1,xyztest); // if we're in a gap, we get -999's here.
434  xvectestm.SetXYZ(xyztest[0],xyztest[1],xyztest[2]);
435  if ( (xvecchan-xvectestm).Mag() < 5.0 ) // if we run off the end of the row (start another), skip this side.
436  {
437  gar::geo::ChanWithPos cwp = {chan-1, xvectestm, zerovec, roctype}; // put the direction vector in later
438  cwn.push_back(cwp);
439  havem = true;
440  }
441  }
442  ChannelToPosition(chan+1,xyztest); // now look on the other side, same pad row.
443  xvectestp.SetXYZ(xyztest[0],xyztest[1],xyztest[2]);
444  if ( (xvecchan-xvectestp).Mag() < 5.0 ) // if we run off the end of the row (start another), skip this side.
445  {
446  gar::geo::ChanWithPos cwp = {chan+1, xvectestp, zerovec, roctype}; // put the direction vector in later
447  cwn.push_back(cwp);
448  havep = true;
449  }
450 
451  TVector3 dvec(0,0,0);
452  if (havem)
453  {
454  dvec = xvectestm - xvecchan;
455  }
456  else if (havep)
457  {
458  dvec = xvectestp - xvecchan;
459  }
460  else
461  {
462  return;
463  // we have a lone pad in this row. No geometrical info to go to another row, so skip.
464  // shouldn't happen, unless a simulated hole-filler pad row has just one pad in it.
465  // throw cet::exception("ChannelMapStandardAlg")
466  // << "Pad has no neighboring pads in its row, geometry problem " << chan;
467  }
468  float dvm = dvec.Mag();
469  if (dvm == 0)
470  {
471  throw cet::exception("ChannelMapStandardAlg")
472  << "Pad neighbor has same coordinates as pad, geometry problem " << chan;
473  }
474  dvec *= 1.0/dvm;
475  // fill in the pad row direction vectors now that we know them.
476  cwn.at(0).padrowdir = dvec;
477  if (havem || havep)
478  {
479  cwn.at(1).padrowdir = dvec;
480  }
481  if (havem && havep)
482  {
483  cwn.at(2).padrowdir = dvec;
484  }
485 
486 
487  TVector3 ndp(0,-dvec.Z(),dvec.Y());
488  float mag = ndp.Mag();
489  ndp *= (0.8/mag); // go out 8 mm -- guarantee to get to the next pad row.
490 
491  TVector3 nextrowhyp = xvecchan + ndp;
493  unsigned int nextrowchan;
494  float nextrowhyparray[3] = {0,0,0};
495  nextrowhyp.GetXYZ(nextrowhyparray);
496  NearestChannelWithROCType(nextrowhyparray,rtp,nextrowchan);
497  if (nextrowchan != fGapChannelNumber)
498  {
499  ChannelToPosition(nextrowchan,nextrowhyparray);
500  TVector3 nrv(nextrowhyparray[0],nextrowhyparray[1],nextrowhyparray[2]);
501  gar::geo::ChanWithPos cwp = {nextrowchan, nrv, dvec, rtp};
502  cwn.push_back(cwp);
503  if (nextrowchan>0)
504  {
505  ChannelToPosition(nextrowchan-1,xyztest);
506  TVector3 xvt(xyztest[0],xyztest[1],xyztest[2]);
507  if ( (xvecchan-xvt).Mag() < 5.0 ) // if we run off the end of the row (start another), skip this side.
508  {
509  gar::geo::ChanWithPos cwp2 = {nextrowchan-1, xvt, dvec, rtp};
510  cwn.push_back(cwp2);
511  }
512  }
513  ChannelToPosition(nextrowchan+1,xyztest);
514  TVector3 xvtp(xyztest[0],xyztest[1],xyztest[2]);
515  if ( (xvecchan-xvtp).Mag() < 5.0 ) // if we run off the end of the row (start another), skip this side.
516  {
517  gar::geo::ChanWithPos cwp2 = {nextrowchan+1, xvtp, dvec, rtp};
518  cwn.push_back(cwp2);
519  }
520  }
521 
522  // look for another row going the other way.
523  nextrowhyp = xvecchan - ndp;
524  nextrowhyp.GetXYZ(nextrowhyparray);
525  NearestChannelWithROCType(nextrowhyparray,rtp,nextrowchan);
526  if (nextrowchan != fGapChannelNumber)
527  {
528  ChannelToPosition(nextrowchan,nextrowhyparray);
529  TVector3 nrv(nextrowhyparray[0],nextrowhyparray[1],nextrowhyparray[2]);
530  gar::geo::ChanWithPos cwp = {nextrowchan, nrv, dvec, rtp};
531  cwn.push_back(cwp);
532 
533  if (nextrowchan>0)
534  {
535  ChannelToPosition(nextrowchan-1,xyztest);
536  TVector3 xvt(xyztest[0],xyztest[1],xyztest[2]);
537  if ( (xvecchan-xvt).Mag() < 5.0 ) // if we run off the end of the row (start another), skip this side.
538  {
539  gar::geo::ChanWithPos cwp2 = {nextrowchan-1, xvt, dvec, rtp};
540  cwn.push_back(cwp2);
541  }
542  }
543  ChannelToPosition(nextrowchan+1,xyztest);
544  TVector3 xvtp(xyztest[0],xyztest[1],xyztest[2]);
545  if ( (xvecchan-xvtp).Mag() < 5.0 ) // if we run off the end of the row (start another), skip this side.
546  {
547  gar::geo::ChanWithPos cwp2 = {nextrowchan+1, xvtp, dvec, rtp};
548  cwn.push_back(cwp2);
549  }
550  }
551  }
void ChannelToPosition(unsigned int chan, float *xyz) const override
enum gar::geo::ROCType_ ROCType
UInt_t fGapChannelNumber
channel number GetNearestChannel returns when xyz is in a gap
void NearestChannelWithROCType(float const *xyz, gar::geo::ROCType &roctype, unsigned int &nearestchannel) const
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void gar::geo::seg::ChannelMapStandardAlg::NearestChannelWithROCType ( float const *  xyz,
gar::geo::ROCType roctype,
unsigned int &  nearestchannel 
) const
private

Definition at line 243 of file ChannelMapStandardAlg.cxx.

244  {
245  roctype = HFILLER;
246 
247  float xyz[3] = {xyz_input[0] - fTPCCenter.x, xyz_input[1] - fTPCCenter.y, xyz_input[2] - fTPCCenter.z};
248 
249  // so far the calculations are formulaic lookups not relying on fPixelCenters. So
250  UInt_t ichan=fGapChannelNumber; // 10 million is the flag channel for no channel at this point
251 
252  float phi = TMath::ATan2(xyz[1],xyz[2]);
253  if (phi<0) phi += 2.0*TMath::Pi();
254  float phisc = phi/( fPhiSectorWidth );
255  UInt_t isector = TMath::Floor(phisc); // assumes the sector boundary is at phi=0 // goes from 0 to 17
256 
257  // rotate this back down to a single sector
258 
259  float rotang = TMath::DegToRad()*( isector*360/fNumSectors + fSectorOffsetAngleDeg );
260  float crot = TMath::Cos(rotang);
261  float srot = TMath::Sin(rotang);
262  float zrot = xyz[2]*crot + xyz[1]*srot;
263  float yrot = - xyz[2]*srot + xyz[1]*crot;
264 
265 
266  //std::cout << "zrot, yrot, isector: " << zrot << " " << yrot << " " << isector << std::endl;
267  if (zrot>fIROCInnerRadius-0.4)
268  {
269 
270  roctype = IROC;
271 
272  //std::cout << "Rotation: " << rotang << " " << xyz[1] << " " << xyz[2] << " " << zrot << " " << yrot << std::endl;
273  // zrot is r, and yrot=0 is centered on the midplane
274 
275  float rtmp=zrot;
276  if (zrot > fOROCOuterRadius)
277  {
278  nearestchannel = fGapChannelNumber;
279  return;
280  }
281 
282  //std::cout << "in iroc rtmp: " << rtmp << std::endl;
283 
284  float padwidthloc = fPadWidthOROC;
285  UInt_t irow = 0;
286  if (rtmp <= fIROCOuterRadius)
287  {
288  irow = TMath::Floor( (rtmp-(fIROCInnerRadius-0.4))/fPadHeightIROC );
289  if (irow >= fNumPadRowsIROC)
290  {
291  nearestchannel = fGapChannelNumber;
292  return;
293  }
294  // don't be this forgiving irow = TMath::Min(fNumPadRowsIROC-1,irow);
295  padwidthloc = fPadWidthIROC;
296  }
297  else if (rtmp < fOROCPadHeightChangeRadius)
298  {
299  //std::cout << "in IOROC rtmp: " << rtmp << std::endl;
300 
301  roctype = IOROC;
302 
303  irow = TMath::Floor( (rtmp-(fOROCInnerRadius-0.5))/fPadHeightOROCI ) + fNumPadRowsIROC;
304  if (irow < fNumPadRowsIROC)
305  {
306  nearestchannel = fGapChannelNumber;
307  return;
308  }
309  //std::cout << "Inner OROC row calc: " << irow << " " << fNumPadRowsIROC << std::endl;
310  padwidthloc = fPadWidthOROC;
311  }
312  else
313  {
314  //std::cout << "in OOROC rtmp: " << rtmp << std::endl;
315 
316  roctype = OOROC;
317 
319  padwidthloc = fPadWidthOROC;
320  }
321 
322  //std::cout << "irow: " << irow << std::endl;
323 
324  UInt_t totpadrows = fNumPadRowsIROC + fNumPadRowsOROCI + fNumPadRowsOROCO;
325  if (irow >= totpadrows)
326  {
327  nearestchannel = fGapChannelNumber;
328  return;
329  }
330 
331  // to do -- put in small corrections to make the pads projective
332 
333  int ichanrowoff = TMath::Floor(yrot/padwidthloc) + fNumPadsPerRow.at(irow)/2;
334  if (ichanrowoff < 0 || (UInt_t) ichanrowoff >= fNumPadsPerRow.at(irow))
335  {
336  nearestchannel = fGapChannelNumber;
337  return;
338  }
339  UInt_t ichansector = fFirstPadInRow.at(irow) + ichanrowoff;
340  //std::cout << "ichansector calc: " << yrot/padwidthloc << " " << fNumPadsPerRow.at(irow) << " " << fFirstPadInRow.at(irow) << " " << ichansector << std::endl;
341 
342  ichan = ichansector + fNumChansPerSector * isector;
343 
344  //if (ichan>1000000)
345  //{
346  // std::cout << "Channel ID. in gaps " << xyz[0] << " " << xyz[1] << " " << xyz[2] << " " << ichan << std::endl;
347  // std::cout << irow << " " << rtmp << " " << r << " " << ichansector << " " << isector << " " << fNumChansPerSector << std::endl;
348  // std::cout << yrot << " " << zrot << " " << crot << " " << srot << std::endl;
349  //}
350 
351  } // end test if we are outside the inner radius of the ALICE chambers
352  else // must be in the hole filler
353  {
354  roctype = HFILLER;
355 
356  float tvar = xyz[1]/fCenterPadWidth + fCenterNumPadsPerRow.size()/2;
357  if (tvar<0)
358  {
359  nearestchannel = fGapChannelNumber;
360  return;
361  }
362  UInt_t irow = TMath::Floor(tvar);
363  if (irow > fCenterFirstPadInRow.size()-1)
364  {
365  nearestchannel = fGapChannelNumber;
366  return;
367  }
368  tvar = xyz[2]/fCenterPadWidth + fCenterNumPadsPerRow.at(irow)/2.0;
369  if (tvar<0)
370  {
371  nearestchannel = fGapChannelNumber;
372  return;
373  }
374  UInt_t ivar = TMath::Floor(tvar);
375  if (ivar >= fCenterNumPadsPerRow.at(irow))
376  {
377  nearestchannel = fGapChannelNumber;
378  return;
379  }
380  ichan = ivar + fCenterFirstPadInRow.at(irow) + fNumSectors*fNumChansPerSector;
381  // ichan = fCenterFirstPadInRow.at(irow) + TMath::Min((UInt_t) fCenterNumPadsPerRow.at(irow)-1,
382  // (UInt_t) TMath::Floor(TMath::Max((float)0.0,(float) (xyz[2]/fCenterPadWidth + fCenterNumPadsPerRow.at(irow)/2))))
383  // + fNumSectors*fNumChansPerSector;
384 
385  //if (ichan>1000000)
386  //{
387  // std::cout << "Problem Channel ID, inner filler " << xyz[0] << " " << xyz[1] << " " << xyz[2] << " " << ichan << std::endl;
388  // std::cout << irow << std::endl;
389  //}
390 
391  }
392 
393  // assume positive side X for the lone readout plane if we are using just one
394 
395  if (xyz[0] > fGeo->TPCXCent() || fGeo->TPCNumDriftVols() == 1)
396  {
397  ichan += fNumSectors*fNumChansPerSector + fNumChansCenter; // the opposite side of the TPC.
398  }
399 
400  nearestchannel = TMath::Max(TMath::Min(ichan, (UInt_t) fPixelCenters.size() - 1), (UInt_t) 0);
401  return;
402  }
float fPadWidthOROC
Pad width in the OROC (assumed same for both sections)
UInt_t fNumChansPerSector
Number of TPC pad channels per sector.
UInt_t fNumPadRowsOROCO
Number of large-pitch pad rows in the outer ROC.
std::vector< UInt_t > fCenterNumPadsPerRow
pads per row for the center hole filler
float fPhiSectorWidth
width of a sector in phi (in radians)
int TPCNumDriftVols() const
Returns number of TPC drift volumes.
Definition: GeometryCore.h:771
float fPadHeightOROCI
Pad height in the outer ROC inner part (cm)
float fPadHeightOROCO
Pad height in the outer ROC outer part (cm)
float TPCXCent() const
Returns the X location of the center of the TPC in cm.
Definition: GeometryCore.h:778
float fIROCOuterRadius
Radius from the beam in cm along the midline of the sector to the outer IROC row outer edge...
std::vector< UInt_t > fFirstPadInRow
indexed by "global" pad row number for a single sector
std::vector< UInt_t > fCenterFirstPadInRow
first pad in row for center hole filler
float fOROCInnerRadius
Radius from the beam in cm along the midline of the sector to the inner OROC row inner edge...
float fPadWidthIROC
Pad width in the inner ROC (cm)
float fOROCPadHeightChangeRadius
Radius from the beam in cm along the midline of the sector to the OROC pad height change...
XYZPos fTPCCenter
Location of the center of the TPC.
float fIROCInnerRadius
Radius from the beam in cm along the midline of the sector to the inner IROC row inner edge...
float fCenterPadWidth
Width of square pads in center hole filler.
UInt_t fNumPadRowsIROC
Number of pad rows in the inner ROC – 64 (TDR) or 63 (ALICE code)
float fOROCOuterRadius
Radius from the beam in cm along the midline of the sector to the outer OROC row outer edge...
UInt_t fNumSectors
Number of sectors – should be 18.
float fPadHeightIROC
Pad height in the inner ROC (cm)
std::vector< UInt_t > fNumPadsPerRow
indexed by "global" pad row number for a single sector
std::vector< XYZPos > fPixelCenters
pixel centers (in cm) – for the entire detector
UInt_t fNumChansCenter
Number of channels in center hole filler.
float fSectorOffsetAngleDeg
Angle to rotate to the middle of the first sector – should be 10 degrees.
const gar::geo::GeometryCore * fGeo
UInt_t fGapChannelNumber
channel number GetNearestChannel returns when xyz is in a gap
UInt_t fNumPadRowsOROCI
Number of small-pitch pad rows in the outer ROC.
void gar::geo::seg::ChannelMapStandardAlg::Uninitialize ( )
overridevirtual

Implements gar::geo::seg::ChannelMapAlg.

Definition at line 175 of file ChannelMapStandardAlg.cxx.

176  {
177  fROC = 0;
178  }
AliTPCROC * fROC
TPC Readout geometry from ALICE software stack.

Member Data Documentation

std::vector<UInt_t> gar::geo::seg::ChannelMapStandardAlg::fCenterFirstPadInRow
private

first pad in row for center hole filler

Definition at line 100 of file ChannelMapStandardAlg.h.

std::vector<UInt_t> gar::geo::seg::ChannelMapStandardAlg::fCenterNumPadsPerRow
private

pads per row for the center hole filler

Definition at line 99 of file ChannelMapStandardAlg.h.

float gar::geo::seg::ChannelMapStandardAlg::fCenterPadWidth
private

Width of square pads in center hole filler.

Definition at line 102 of file ChannelMapStandardAlg.h.

std::vector<UInt_t> gar::geo::seg::ChannelMapStandardAlg::fFirstPadInRow
private

indexed by "global" pad row number for a single sector

Definition at line 91 of file ChannelMapStandardAlg.h.

UInt_t gar::geo::seg::ChannelMapStandardAlg::fGapChannelNumber
private

channel number GetNearestChannel returns when xyz is in a gap

Definition at line 109 of file ChannelMapStandardAlg.h.

const gar::geo::GeometryCore* gar::geo::seg::ChannelMapStandardAlg::fGeo
private

Definition at line 60 of file ChannelMapStandardAlg.h.

float gar::geo::seg::ChannelMapStandardAlg::fIROCInnerRadius
private

Radius from the beam in cm along the midline of the sector to the inner IROC row inner edge.

Definition at line 82 of file ChannelMapStandardAlg.h.

float gar::geo::seg::ChannelMapStandardAlg::fIROCOuterRadius
private

Radius from the beam in cm along the midline of the sector to the outer IROC row outer edge.

Definition at line 83 of file ChannelMapStandardAlg.h.

UInt_t gar::geo::seg::ChannelMapStandardAlg::fNumChansCenter
private

Number of channels in center hole filler.

Definition at line 103 of file ChannelMapStandardAlg.h.

UInt_t gar::geo::seg::ChannelMapStandardAlg::fNumChansPerSector
private

Number of TPC pad channels per sector.

Definition at line 95 of file ChannelMapStandardAlg.h.

UInt_t gar::geo::seg::ChannelMapStandardAlg::fNumPadRowsIROC
private

Number of pad rows in the inner ROC – 64 (TDR) or 63 (ALICE code)

Definition at line 73 of file ChannelMapStandardAlg.h.

UInt_t gar::geo::seg::ChannelMapStandardAlg::fNumPadRowsOROCI
private

Number of small-pitch pad rows in the outer ROC.

Definition at line 74 of file ChannelMapStandardAlg.h.

UInt_t gar::geo::seg::ChannelMapStandardAlg::fNumPadRowsOROCO
private

Number of large-pitch pad rows in the outer ROC.

Definition at line 75 of file ChannelMapStandardAlg.h.

std::vector<UInt_t> gar::geo::seg::ChannelMapStandardAlg::fNumPadsPerRow
private

indexed by "global" pad row number for a single sector

Definition at line 90 of file ChannelMapStandardAlg.h.

UInt_t gar::geo::seg::ChannelMapStandardAlg::fNumSectors
private

Number of sectors – should be 18.

Definition at line 69 of file ChannelMapStandardAlg.h.

float gar::geo::seg::ChannelMapStandardAlg::fOROCInnerRadius
private

Radius from the beam in cm along the midline of the sector to the inner OROC row inner edge.

Definition at line 84 of file ChannelMapStandardAlg.h.

float gar::geo::seg::ChannelMapStandardAlg::fOROCOuterRadius
private

Radius from the beam in cm along the midline of the sector to the outer OROC row outer edge.

Definition at line 86 of file ChannelMapStandardAlg.h.

float gar::geo::seg::ChannelMapStandardAlg::fOROCPadHeightChangeRadius
private

Radius from the beam in cm along the midline of the sector to the OROC pad height change.

Definition at line 85 of file ChannelMapStandardAlg.h.

float gar::geo::seg::ChannelMapStandardAlg::fPadHeightIROC
private

Pad height in the inner ROC (cm)

Definition at line 76 of file ChannelMapStandardAlg.h.

float gar::geo::seg::ChannelMapStandardAlg::fPadHeightOROCI
private

Pad height in the outer ROC inner part (cm)

Definition at line 78 of file ChannelMapStandardAlg.h.

float gar::geo::seg::ChannelMapStandardAlg::fPadHeightOROCO
private

Pad height in the outer ROC outer part (cm)

Definition at line 79 of file ChannelMapStandardAlg.h.

float gar::geo::seg::ChannelMapStandardAlg::fPadWidthIROC
private

Pad width in the inner ROC (cm)

Definition at line 77 of file ChannelMapStandardAlg.h.

float gar::geo::seg::ChannelMapStandardAlg::fPadWidthOROC
private

Pad width in the OROC (assumed same for both sections)

Definition at line 80 of file ChannelMapStandardAlg.h.

float gar::geo::seg::ChannelMapStandardAlg::fPhiSectorWidth
private

width of a sector in phi (in radians)

Definition at line 71 of file ChannelMapStandardAlg.h.

std::vector<XYZPos> gar::geo::seg::ChannelMapStandardAlg::fPixelCenters
private

pixel centers (in cm) – for the entire detector

Definition at line 93 of file ChannelMapStandardAlg.h.

AliTPCROC* gar::geo::seg::ChannelMapStandardAlg::fROC
private

TPC Readout geometry from ALICE software stack.

Definition at line 68 of file ChannelMapStandardAlg.h.

float gar::geo::seg::ChannelMapStandardAlg::fSectorOffsetAngleDeg
private

Angle to rotate to the middle of the first sector – should be 10 degrees.

Definition at line 70 of file ChannelMapStandardAlg.h.

XYZPos gar::geo::seg::ChannelMapStandardAlg::fTPCCenter
private

Location of the center of the TPC.

Definition at line 107 of file ChannelMapStandardAlg.h.

float gar::geo::seg::ChannelMapStandardAlg::fXPlaneLoc
private

Location of pixel plane in X (only positive. Assume other one is at -X)

Definition at line 88 of file ChannelMapStandardAlg.h.


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