ATLAS Offline Software
DerivationFramework/DerivationFrameworkTileCal/src/TrackTools.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /*
6  * File: TrackTools.cxx
7  * Author: Marco van Woerden <mvanwoer@cern.ch>, Archil Durglishvili <archil.durglishvili@cern.ch>
8  * Description: Track tools.
9  *
10  * Created in February 2013.
11  * Updated in November 2014
12  */
13 #include "TrackTools.h"
14 #include "CaloIdentifier/TileID.h"
19 
20 namespace TileCal {
21 
22 //==================================
24 //=================================
25 
26  ATH_MSG_INFO( "Initializing TrackTools" );
27 
28  if (m_isCollision) {
29  ATH_MSG_INFO( "Beam type = Collision" );
30  } else {
31  ATH_MSG_INFO( "Beam type = Cosmic" );
32  }
33 
34  ATH_CHECK(m_caloExtensionTool.retrieve());
35 
37 
38  //=== TileDetDescrManager
40 
41  return StatusCode::SUCCESS;
42 } // TrackTools::initialize
43 
44 //================================
46 //===============================
47  ATH_MSG_INFO( "Finalizing TrackTools" );
48  return StatusCode::SUCCESS;
49 } // TRACKTOOLS::FINALIZE
50 
51 //==================================================================================================
52 std::unique_ptr<const Trk::TrackParameters> TrackTools::getTrackInCellSampling(const TRACK* track, CaloSampling::CaloSample sampling) const {
53 //==================================================================================================
54  if( !m_caloExtensionTool.empty() ){
55  std::unique_ptr<Trk::CaloExtension> extension =
56  m_caloExtensionTool->caloExtension(Gaudi::Hive::currentContext(), *track);
57  if (!extension)
58  return nullptr;
59 
60  Trk::TrackParametersIdHelper parsIdHelper;
61 
62  std::map<CaloSampling::CaloSample,const Trk::CurvilinearParameters*> Samplings;
63 
64  // loop over calo layers, keep track of previous layer
65  auto cur = extension->caloLayerIntersections().begin();
66  auto prev = cur;
67  for( ; cur != extension->caloLayerIntersections().end() ; ++cur ){
68  // check that prev and cur are not the same, if not fill if the previous was an entry layer
69  if( prev != cur && parsIdHelper.isEntryToVolume((*prev).cIdentifier()) )
70  {
71  TrackParametersIdentifier id = (*prev).cIdentifier();
72  CaloSampling::CaloSample sample = parsIdHelper.caloSample(id);
73  Samplings[sample] = &(*prev);
74  }
75  prev=cur;
76  }
77  if(!Samplings[sampling]) {return nullptr ;}
78  else {return std::make_unique<const Trk::CurvilinearParameters> (*(Samplings[sampling]));}
79  }
80  return nullptr;
81 }
82 
83 //==================================================================================================
84 std::vector< double > TrackTools::getXYZEtaPhiInCellSampling(const TRACK* track, CaloSampling::CaloSample sampling) const {
85 //==================================================================================================
86  std::vector<double> coordinates;
87  if( !m_caloExtensionTool.empty() ){
88  std::unique_ptr<Trk::CaloExtension> extension =
89  m_caloExtensionTool->caloExtension(Gaudi::Hive::currentContext(), *track);
90  if (!extension)
91  return coordinates;
92 
93  Trk::TrackParametersIdHelper parsIdHelper;
94 
95  std::map<CaloSampling::CaloSample,const Trk::TrackParameters*> Samplings;
96 
97  // loop over calo layers, keep track of previous layer
98  auto cur = extension->caloLayerIntersections().begin();
99  auto prev = cur;
100  for( ; cur != extension->caloLayerIntersections().end() ; ++cur ){
101  // check that prev and cur are not the same, if not fill if the previous was an entry layer
102  if( prev != cur && parsIdHelper.isEntryToVolume((*prev).cIdentifier()) )
103  {
104  TrackParametersIdentifier id = (*prev).cIdentifier();
105  CaloSampling::CaloSample sample = parsIdHelper.caloSample(id);
106  Samplings[sample] = &(*prev);
107  }
108  prev=cur;
109  }
110  if(!(Samplings[sampling])) return coordinates;
111  coordinates.push_back(Samplings[sampling]->position().x());
112  coordinates.push_back(Samplings[sampling]->position().y());
113  coordinates.push_back(Samplings[sampling]->position().z());
114  coordinates.push_back(Samplings[sampling]->position().eta());
115  coordinates.push_back(Samplings[sampling]->position().phi());
116  }
117  return coordinates;
118 } // getXYZEtaPhiInCellSampling
119 
120 
121 //==========================================================================================================
122 std::vector< double > TrackTools::getXYZEtaPhiInCellSampling(const TRACK* track, const CaloCell *cell) const {
123 //==========================================================================================================
124  std::vector<double> coordinates;
125 
126  if(!cell || !track) return coordinates;
127  // GET CELL DESCRIPTOR AND SAMPLING
128  const CaloDetDescrElement* dde = cell->caloDDE();
129  if(!dde) return coordinates;
130  CaloSampling::CaloSample sampling = dde->getSampling();
131 
132  return getXYZEtaPhiInCellSampling(track,sampling);
133 } // getXYZEtaPhiInCellSampling
134 
135 
136 //=====================================================================================================
137 std::vector< std::vector<double> > TrackTools::getXYZEtaPhiPerLayer(const TRACK* track) const {
138 //====================================================================================================
139  std::vector< std::vector<double> > coordinates(11);
140 
141  for(unsigned int sample=0 ; sample<21; ++sample) //Samplings:http://acode-browser.usatlas.bnl.gov/lxr/source/atlas/Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.def
142  {
143  std::vector<double> TrkPars(5);
144  std::vector<double> XYZEtaPhi = getXYZEtaPhiInCellSampling( track, (CaloSampling::CaloSample)sample );
145  TrkPars[0] = ( XYZEtaPhi.size()!=5 ) ? -9999. : XYZEtaPhi[0] ;
146  TrkPars[1] = ( XYZEtaPhi.size()!=5 ) ? -9999. : XYZEtaPhi[1] ;
147  TrkPars[2] = ( XYZEtaPhi.size()!=5 ) ? -9999. : XYZEtaPhi[2] ;
148  TrkPars[3] = ( XYZEtaPhi.size()!=5 ) ? -9999. : XYZEtaPhi[3] ;
149  TrkPars[4] = ( XYZEtaPhi.size()!=5 ) ? -9999. : XYZEtaPhi[4] ;
150  int lay=-1;
151  if (sample==0 || sample==4 ){lay=0;}
152  else if(sample==1 || sample==5 ){lay=1;}
153  else if(sample==2 || sample==6 ){lay=2;}
154  else if(sample==3 || sample==7 ){lay=3;}
155  else if(sample==12 || sample==18){lay=4;}
156  else if(sample==13 || sample==19){lay=5;}
157  else if(sample==15 || sample==17){lay=5;}
158  else if(sample==14 || sample==20){lay=6;}
159  else if(sample==16) {lay=6;}
160  else if(sample==8 ){lay=7;}
161  else if(sample==9 ){lay=8;}
162  else if(sample==10 ){lay=9;}
163  else if(sample==11 ){lay=10;}
164  if(lay!=-1) coordinates[lay] = TrkPars;
165  } // FOR
166 
167  return coordinates;
168 } // TrackTools::getXYZEtaPhiPerLayer
169 
170 //=====================================================================================================
171 std::vector< std::vector<double> > TrackTools::getXYZEtaPhiPerSampling(const TRACK* track) const {
172 //====================================================================================================
173  std::vector< std::vector<double> > coordinates;
174 
175  for(unsigned int s=0 ; s<21; ++s) //Samplings: http://acode-browser.usatlas.bnl.gov/lxr/source/atlas/Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.def
176  {
177  std::vector<double> TrkPars(5);
178  std::vector<double> XYZEtaPhi = getXYZEtaPhiInCellSampling( track, (CaloSampling::CaloSample)s );
179  TrkPars[0] = ( XYZEtaPhi.size()!=5 ) ? -9999. : XYZEtaPhi[0] ;
180  TrkPars[1] = ( XYZEtaPhi.size()!=5 ) ? -9999. : XYZEtaPhi[1] ;
181  TrkPars[2] = ( XYZEtaPhi.size()!=5 ) ? -9999. : XYZEtaPhi[2] ;
182  TrkPars[3] = ( XYZEtaPhi.size()!=5 ) ? -9999. : XYZEtaPhi[3] ;
183  TrkPars[4] = ( XYZEtaPhi.size()!=5 ) ? -9999. : XYZEtaPhi[4] ;
184  coordinates.push_back(TrkPars);
185  } // FOR
186 
187  return coordinates;
188 } // TrackTools::getXYZEtaPhiPerSampling
189 
190 
191 //======================================================================
193  const CaloCellContainer* input,
195  double cone,
196  bool includelar) const {
197 //======================================================================
198  // CELLS WITHIN CONE AROUND TRACK
201  for(;icell!=end;++icell){
202  const CaloCell* cell = (*icell);
203  const CaloDetDescrElement* dde = cell->caloDDE();
204 
205  // REASONS TO SKIP THIS CELL OR BREAK THE LOOP
206  if(!dde) continue;
207  if(!includelar && dde->getSubCalo() == CaloCell_ID::LAREM) continue;
208  if(dde->getSubCalo() != CaloCell_ID::LAREM && dde->getSubCalo() != CaloCell_ID::TILE) continue;
209 
210  std::vector<double> coordinates = getXYZEtaPhiInCellSampling(track,dde->getSampling());
211  if(coordinates.size()!=5) continue;
212 
213  double deltaR = KinematicUtils::deltaR( cell->eta(),coordinates[3], cell->phi(),coordinates[4]);
214 
215  if(deltaR<=cone)
216  {
217  unsigned int i=0;
218  while(i!=output->size()){if(output->at(i)==cell){break;}i++;}
219  if(i==output->size())
220  {
221  output->push_back(cell);
222  }
223  }
224  } // FOR
225 } // TrackTools::getCellsWithinConeAroundTrack
226 
227 //======================================================================================
228 double TrackTools::getPathInsideCell(const TRACK *track, const CaloCell *cell) const {
229 //======================================================================================
230 
231  ATH_MSG_DEBUG("in TrackInCaloTools::getPathInsideCell" );
232 
233 
234 
235  // GET CELL DESCRIPTOR AND SAMPLING
236  const CaloDetDescrElement* dde = cell->caloDDE();
237  if(!dde) return 0.;
238  int sampling = dde->getSampling();
239  int sampling_entrance = 0;
240  int sampling_exit = 0;
241  int cell_tower = m_tileID->tower(cell->ID());
242 
243  // The type of physics (collision or cosmic) determines the entrance and exit cell for the muons, therefore these different switches are defined accordingly.
244  if (m_isCollision) {
245  switch(sampling){
246  case 12:
247  sampling_entrance = 12;
248  if (cell_tower>=0 && cell_tower<=6) sampling_exit = 14;
249  else if (cell_tower==7) sampling_exit = 13; // for A8, the exit is BC8
250  else if (cell_tower>=8 && cell_tower<=9) sampling_exit = 20; // for A9 and A10, the exit is D5
251  break;
252  case 13:
253  sampling_entrance = 12;
254  if (cell_tower>=0 && cell_tower<=6) sampling_exit = 14;
255  else if (cell_tower==7) sampling_exit = 13; // for BC8, the exit is BC8
256  else if (cell_tower==8) sampling_exit = 20; // for B9, the exit is D5
257  break;
258  case 14: sampling_entrance = 12; sampling_exit = 14; break;
259  case 15: sampling_entrance = 12; sampling_exit = 20; break; // for C10, the entrance is A10, the exit is D5
260  case 16: sampling_entrance = 12; sampling_exit = 13; break;
261  case 17:
262  sampling_entrance = 17;
263  if (cell_tower == 10) { // E1
264  sampling_exit = 19; // the exit is B11
265  } else if (cell_tower == 11) { // E2
266  if (getTrackInCellSampling(track, CaloSampling::CaloSample::TileExt0)) sampling_exit = 18; // the exit is A12
267  else sampling_exit = 19; // the exit is B11
268  } else if ((cell_tower == 13) || (cell_tower == 15)) { // E3 or E4
269  if (getTrackInCellSampling(track, CaloSampling::CaloSample::PreSamplerE)) sampling_exit = 4; // the exit is PreSamplerE
270  else sampling_exit = 18; // the exit is TileExt0
271  }
272  break;
273  case 18:
274  sampling_entrance = 18;
275  if (cell_tower>=11 && cell_tower<=13) sampling_exit = 20;
276  else if (cell_tower>=14 && cell_tower<=15) sampling_exit = 19; // for A15 and A16, the exit is B15
277  break;
278  case 19:
279  if (cell_tower==10) {sampling_entrance = 19; sampling_exit = 20;} // for B11, the entrance is B11, the exit is D5
280  else if (cell_tower>=11 && cell_tower<=13) {sampling_entrance = 18; sampling_exit = 20;} // for B12-B14, the entrance is EBA cells, the exit is EBD cells
281  else if (cell_tower==14) {sampling_entrance = 18; sampling_exit = 19;} // for B15, the entrance is A15, the exit is B15
282  break;
283  case 20:
284  if (cell_tower==10) {sampling_entrance = 19; sampling_exit = 20;} // for D5, the entrance is B11, the exit is D5
285  else if (cell_tower==12) {sampling_entrance = 18; sampling_exit = 20;} // for D6, the entrance is A13 cells, the exit is D6
286  break;
287  default: return 0.;
288  } // SWITCH
289  }
290  else {
291  switch(sampling){
292  case 12: sampling_entrance = 12; sampling_exit = 14; break;
293  case 13: sampling_entrance = 12; sampling_exit = 14; break;
294  case 14: sampling_entrance = 12; sampling_exit = 14; break;
295  case 15: sampling_entrance = 13; sampling_exit = 14; break;
296  case 16: sampling_entrance = 12; sampling_exit = 13; break;
297  case 17: sampling_entrance = 17; sampling_exit = 19; break;
298  case 18: sampling_entrance = 18; sampling_exit = 20; break;
299  case 19: sampling_entrance = 18; sampling_exit = 20; break;
300  case 20: sampling_entrance = 18; sampling_exit = 20; break;
301  default: return 0.;
302  } // SWITCH
303  }
304 
305  std::unique_ptr<const Trk::TrackParameters> pars_entrance =
307  std::unique_ptr<const Trk::TrackParameters> pars_exit =
309 
310  if( !pars_entrance || !pars_exit ) return 0.;
311 
312  return getPath(cell, pars_entrance.get(), pars_exit.get());
313 } // TrackTools::getPathInsideCell
314 
315 //=====================================================================================================================================
316 double TrackTools::getPath(const CaloCell* cell, const Trk::TrackParameters *entrance, const Trk::TrackParameters *exit) const {
317 //====================================================================================================================================
318  ATH_MSG_DEBUG("IN getPath...");
319 
320  // OBTAIN LAYER INDICES FOR LINEAR INTERPOLATION
321  unsigned int sampleID = cell->caloDDE()->getSampling();
322 
323  // OBTAIN TRACK AND CELL PARAMETERS
324  double pathl = 0.;
325  double layer1X = exit->position().x();
326  double layer1Y = exit->position().y();
327  double layer1Z = exit->position().z();
328  double layer2X = entrance->position().x();
329  double layer2Y = entrance->position().y();
330  double layer2Z = entrance->position().z();
331 
332  double cellPhi = cell->caloDDE()->phi();
333  double cellDPhi = cell->caloDDE()->dphi();
334  double cellPhimin = cellPhi - cellDPhi / 2.;
335  double cellPhimax = cellPhi + cellDPhi / 2.;
336  double cellZ = cell->caloDDE()->z();
337  double cellDZ = cell->caloDDE()->dz();
338  double cellZmin = cellZ - cellDZ / 2.;
339  double cellZmax = cellZ + cellDZ / 2.;
340  double cellR = cell->caloDDE()->r();
341  double cellDR = cell->caloDDE()->dr();
342  double cellRmin = cellR - cellDR / 2.;
343  double cellRmax = cellR + cellDR / 2.;
344 
345  double cellXimp[2], cellYimp[2], cellZimp[2];
346  double x(0), y(0), z(0), r(0), phi(0);
347  double deltaPhi;
348 
349  // COMPUTE PATH
350  bool compute = true;
351  int lBC(0);
352  while(compute){
353  if ((lBC == 1) && (sampleID == 13) && (m_tileID->tower(cell->ID()) == 8)) break; // B9
354  int np = 0;
355  if(std::sqrt((layer1X - layer2X) * (layer1X - layer2X) + (layer1Y - layer2Y) * (layer1Y - layer2Y)) < 3818.5){
356  if(sampleID == 13){
357  TileCellDim* cellDim = m_tileMgr->get_cell_dim(cell->ID());
358  if(lBC == 0){
359  cellRmin = cellDim->getRMin(TILE_RAW_FIRST);
360  cellRmax = cellDim->getRMax(TILE_RAW_THIRD);
361  cellZmin = cellDim->getZMin(TILE_RAW_SECOND);
362  cellZmax = cellDim->getZMax(TILE_RAW_SECOND);
363  } else if(lBC == 1){
364  cellRmin = cellDim->getRMin(TILE_RAW_FOURTH);
365  cellRmax = cellDim->getRMax(TILE_RAW_SIXTH);
366  cellZmin = cellDim->getZMin(TILE_RAW_FIFTH);
367  cellZmax = cellDim->getZMax(TILE_RAW_FIFTH);
368  }
369  }
370  // CALCULATE POINTS OF INTERSECTION
371  // INTERSECTIONS R PLANES
372  double radius(cellRmin);
373 
374  double x0int = exit->position().x();
375  double x1int = entrance->position().x();
376  double y0int = exit->position().y();
377  double y1int = entrance->position().y();
378  double z0int = exit->position().z();
379  double z1int = entrance->position().z();
380  double s = (y1int - y0int) / (x1int - x0int);
381  double a = 1 + s * s;
382  double b = 2 * s * y0int - 2 * s * s * x0int;
383  double c = y0int * y0int - radius * radius + s * s * x0int * x0int - 2 * y0int * s * x0int;
384  double x1 = (-b + std::sqrt(b * b - 4 * a * c)) / (2 * a);
385  double x2 = (-b - std::sqrt(b * b - 4 * a * c)) / (2 * a);
386  double y1 = y0int + s * (x1 - x0int);
387  double y2 = y0int + s * (x2 - x0int);
388  double s1 = (z1int - z0int) / (x1int - x0int);
389  double z1 = z0int + s1 * (x1 - x0int);
390  double z2 = z0int + s1 * (x2 - x0int);
391 
392  x = x1;
393  y = y1;
394  z = z1;
395 
396  if( ((x1 - x0int) * (x1 - x0int) + (y1 - y0int) * (y1 - y0int) + (z1 - z0int) * (z1 - z0int)) >
397  ((x2 - x0int) * (x2 - x0int) + (y2 - y0int) * (y2 - y0int) + (z2 - z0int) * (z2 - z0int)) ){
398  x = x2;
399  y = y2;
400  z = z2;
401  } // IF
402 
403  phi = std::acos(x / std::sqrt(x * x + y * y));
404  if(y <= 0) phi = -phi;
405  r = cellRmin;
406 
407  if(z >= cellZmin && z <= cellZmax && phi >= cellPhimin && phi <= cellPhimax){
408  cellXimp[np] = x;
409  cellYimp[np] = y;
410  cellZimp[np] = z;
411  np = np + 1;
412 
413  } // IF
414 
415  radius = cellRmax;
416 
417  c = y0int * y0int - radius * radius + s * s * x0int * x0int - 2 * y0int * s * x0int;
418  x1 = ((-b + std::sqrt(b * b - 4 * a * c)) / (2 * a));
419  x2 = ((-b - std::sqrt(b * b - 4 * a * c)) / (2 * a));
420  y1 = (y0int + s * (x1 - x0int));
421  y2 = (y0int + s * (x2 - x0int));
422  z1 = (z0int + s1 * (x1 - x0int));
423  z2 = (z0int + s1 * (x2 - x0int));
424  s1 = ((z1int - z0int) / (x1int - x0int));
425 
426  x = x1;
427  y = y1;
428  z = z1;
429 
430  if( ((x1 - x0int) * (x1 - x0int) + (y1 - y0int) * (y1 - y0int) + (z1 - z0int) * (z1 - z0int)) >
431  ((x2 - x0int) * (x2 - x0int) + (y2 - y0int) * (y2 - y0int) + (z2 - z0int) * (z2 - z0int)) ){
432  x = x2;
433  y = y2;
434  z = z2;
435  } // IF
436 
437  phi = std::acos(x / std::sqrt(x * x + y * y));
438  if (y <= 0) phi = -phi;
439  r = cellRmax;
440 
441  if(z >= cellZmin && z <= cellZmax && phi >= cellPhimin && phi <= cellPhimax){
442  cellXimp[np] = x;
443  cellYimp[np] = y;
444  cellZimp[np] = z;
445  np=np + 1;
446 
447  } // IF
448 
449  // INTERSECTIONS Z PLANES
450  if(np < 2){
451  double sxz = (layer2X - layer1X) / (layer2Z - layer1Z);
452  double syz = (layer2Y - layer1Y) / (layer2Z - layer1Z);
453  z = cellZmin;
454  x = layer1X + sxz * (z - layer1Z);
455  y = layer1Y + syz * (z - layer1Z);
456  r = std::sqrt(x * x + y * y);
457  phi = std::acos(x / r);
458  if(y <= 0) phi=-phi;
459  if(r >= cellRmin && r <= cellRmax && phi >= cellPhimin && phi <= cellPhimax){
460  cellXimp[np] = x;
461  cellYimp[np] = y;
462  cellZimp[np] = z;
463  np=np + 1;
464 
465  } // IF
466  } // IF
467 
468  if(np < 2){
469  double sxz = (layer2X - layer1X) / (layer2Z - layer1Z);
470  double syz = (layer2Y - layer1Y) / (layer2Z - layer1Z);
471  z = cellZmax;
472  x = layer1X + sxz * (z - layer1Z);
473  y = layer1Y + syz * (z - layer1Z);
474  r = std::sqrt(x * x + y * y);
475  phi = std::acos(x / r);
476  if(y <= 0) phi = -phi;
477  if(r >= cellRmin && r <= cellRmax && phi >= cellPhimin && phi <= cellPhimax){
478  cellXimp[np] = x;
479  cellYimp[np] = y;
480  cellZimp[np] = z;
481  np = np + 1;
482 
483  } // IF
484  } // IF
485 
486  // INTERSECTIONS PHI PLANES
487  if(np < 2){
488  double sxy = (layer2X - layer1X) / (layer2Y - layer1Y);
489  double sxz = (layer2X - layer1X) / (layer2Z - layer1Z);
490  x = (layer1X - sxy * layer1Y) / (1 - sxy * tan(cellPhimin));
491  y = x * std::tan(cellPhimin);
492  z = layer1Z + (1 / sxz) * (x - layer1X);
493  r = std::sqrt(x * x + y * y);
494  phi = std::acos(x / r);
495  if(y <= 0) phi = -phi;
496  deltaPhi = std::abs(phi - cellPhimin);
497  if(deltaPhi > 3.141593) deltaPhi = std::abs(phi + cellPhimin);
498  if(r >= cellRmin && r <= cellRmax && z >= cellZmin && z <= cellZmax && deltaPhi < 0.0001){
499  cellXimp[np] = x;
500  cellYimp[np] = y;
501  cellZimp[np] = z;
502  np = np + 1;
503  } // IF
504  } // IF
505  if(np < 2){
506  double sxy = (layer2X - layer1X) / (layer2Y - layer1Y);
507  double sxz = (layer2X - layer1X) / (layer2Z - layer1Z);
508  x = (layer1X - sxy * layer1Y) / (1 - sxy * tan(cellPhimax));
509  y = x * std::tan(cellPhimax);
510  z = layer1Z + (1 / sxz) * (x - layer1X);
511  r = std::sqrt(x * x + y * y);
512  phi = std::acos(x / r);
513  if(y <= 0) phi = -phi;
514  deltaPhi = std::abs(phi - cellPhimax);
515  if(deltaPhi > 3.141593) deltaPhi = std::abs(phi + cellPhimax);
516  if(r >= cellRmin && r <= cellRmax && z >= cellZmin && z <= cellZmax && deltaPhi < 0.0001){
517  cellXimp[np] = x;
518  cellYimp[np] = y;
519  cellZimp[np] = z;
520  np = np + 1;
521  } // IF
522  } // IF
523 
524  // CALCULATE PATH IF TWO INTERSECTIONS WERE FOUND
525  if(np == 2){
526 
527  pathl += std::sqrt( (cellXimp[0] - cellXimp[1]) * (cellXimp[0] - cellXimp[1]) +
528  (cellYimp[0] - cellYimp[1]) * (cellYimp[0] - cellYimp[1]) +
529  (cellZimp[0] - cellZimp[1]) * (cellZimp[0] - cellZimp[1]) );
530  } // IF
531  } // IF
532  if(sampleID == 13 && lBC == 0) ++lBC;
533  else compute = false;
534  } // WHILE (FOR LBBC LAYER)
535 
536  return pathl;
537 } // TrackTools::getPath
538 
539 //=====================================================
540 int TrackTools::retrieveIndex(int sampling, float eta) const {
541 //====================================================
542  // STORE ETA MAP
543  float etamap[81] = { -0.95,-0.85,-0.75,-0.65,-0.55,-0.45,-0.35,-0.25,-0.15,-0.05, // CELLS A-10 TO A-1 (SAMPLING 12) INDICES 0:9
544  0.05, 0.15, 0.25, 0.35, 0.45, 0.55, 0.65, 0.75, 0.85, 0.95, // CELLS A1 TO A10 (SAMPLING 12) INDICES 10:19
545  -0.85,-0.75,-0.65,-0.55,-0.45,-0.35,-0.25,-0.15,-0.05, // CELLS BC-9 TO BC-1 (SAMPLING 13) INDICES 20:28
546  0.05, 0.15, 0.25, 0.35, 0.45, 0.55, 0.65, 0.75, 0.85, // CELLS BC1 TO BC9 (SAMPLING 13) INDICES 29:37
547  -0.60,-0.40,-0.20, // CELLS D-3 TO D-1 (SAMPLING 14) INDICES 38:40
548  0.00, 0.20, 0.40, 0.60, // CELLS D0 TO D3 (SAMPLING 14) INDICES 41:44
549  -0.956279,0.9583722, // CELLS C-10 TO C10 (SAMPLING 15) INDICES 45:46
550  -0.855940,0.8579205, // CELLS D-4 TO D4 (SAMPLING 16) INDICES 47:48
551  -1.507772,-1.307385,-1.156978,-1.056676, // CELLS E-4 TO E-1 (SAMPLING 17) INDICES 49:52
552  1.0589020,1.1593041,1.3098471,1.5103633, // CELLS E1 TO E4 (SAMPLING 17) INDICES 53:56
553  -1.554988,-1.455460,-1.355965,-1.256501,-1.157065, // CELLS A-16 TO A-12 (SAMPLING 18) INDICES 57:61
554  1.1594202,1.258668,1.3579534,1.4572804,1.5566510, // CELLS A12 TO A16 (SAMPLING 18) INDICES 62:66
555  -1.454651,-1.355081,-1.255538,-1.156018,-1.056519, // CELLS B-15 TO B-11 (SAMPLING 19) INDICES 67:71
556  1.0586925,1.1580252,1.2573844,1.3567756,1.4562022, // CELLS B11 TO B15 (SAMPLING 19) INDICES 72:76
557  -1.204743,-1.005559, // CELLS D-6 TO D-5 (SAMPLING 20) INDICES 77:78
558  1.0074122,1.2063241}; // CELLS D5 TO D6 (SAMPLING 20) INDICES 79:80
559  // CALCULATE INDEX
560  int index(999),i_start(999),i_end(999);
561  switch(sampling){
562  case 12: i_start = 0; i_end = 19; break;
563  case 13: i_start = 20; i_end = 37; break;
564  case 14: i_start = 38; i_end = 44; break;
565  case 15: i_start = 45; i_end = 46; break;
566  case 16: i_start = 47; i_end = 48; break;
567  case 17: i_start = 49; i_end = 56; break;
568  case 18: i_start = 57; i_end = 66; break;
569  case 19: i_start = 67; i_end = 76; break;
570  case 20: i_start = 77; i_end = 80; break;
571  default: break;
572  } // SWITCH
573 
574  if(i_start==999 || i_end==999) return -1;
575 
576  index = i_start;
577 
578  for(int i=i_start;i <= i_end;++i) index = std::abs(eta-etamap[i]) <= std::abs(eta-etamap[index]) ? i : index;
579  return index;
580 } // TRACKTOOLS::RETRIEVEINDEX
581 
582 } // TileCal namespace
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
TileDetDescrManager::get_cell_dim
TileCellDim * get_cell_dim(const Identifier &cell_id) const
Definition: TileDetDescrManager.cxx:952
TileCal::TrackTools::getXYZEtaPhiPerSampling
std::vector< std::vector< double > > getXYZEtaPhiPerSampling(const TRACK *track) const override
Definition: DerivationFramework/DerivationFrameworkTileCal/src/TrackTools.cxx:171
beamspotman.r
def r
Definition: beamspotman.py:676
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
TileCal::TrackTools::TILE_RAW_SECOND
@ TILE_RAW_SECOND
Definition: DerivationFramework/DerivationFrameworkTileCal/src/TrackTools.h:62
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
WriteCellNoiseToCool.icell
icell
Definition: WriteCellNoiseToCool.py:339
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
TileCal::TrackTools::getCellsWithinConeAroundTrack
void getCellsWithinConeAroundTrack(const xAOD::TrackParticle *track, const CaloCellContainer *input, ConstDataVector< CaloCellContainer > *output, double cone, bool includelar) const override
Definition: DerivationFramework/DerivationFrameworkTileCal/src/TrackTools.cxx:192
TileCal::TrackTools::finalize
StatusCode finalize() override final
Definition: DerivationFramework/DerivationFrameworkTileCal/src/TrackTools.cxx:45
beamspotman.cur
def cur
Definition: beamspotman.py:671
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
Trk::ParametersBase::position
const Amg::Vector3D & position() const
Access method for the position.
index
Definition: index.py:1
CaloCell_ID_FCS::TileExt0
@ TileExt0
Definition: FastCaloSim_CaloCell_ID.h:37
xAOD::deltaPhi
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap setEtaBin setIsTgcFailure setDeltaPt deltaPhi
Definition: L2StandAloneMuon_v1.cxx:160
plotBeamSpotCompare.x2
x2
Definition: plotBeamSpotCompare.py:218
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
TileCal::TrackTools::TILE_RAW_THIRD
@ TILE_RAW_THIRD
Definition: DerivationFramework/DerivationFrameworkTileCal/src/TrackTools.h:62
TileCal::TrackTools::m_tileID
const TileID * m_tileID
Definition: DerivationFramework/DerivationFrameworkTileCal/src/TrackTools.h:60
TrackTools.h
TileCal::TrackTools::m_caloExtensionTool
ToolHandle< Trk::IParticleCaloExtensionTool > m_caloExtensionTool
Definition: DerivationFramework/DerivationFrameworkTileCal/src/TrackTools.h:57
TileCal::TrackTools::TILE_RAW_FIRST
@ TILE_RAW_FIRST
Definition: DerivationFramework/DerivationFrameworkTileCal/src/TrackTools.h:62
Trk::TrackParametersIdHelper::caloSample
CaloSampling::CaloSample caloSample(TrackParametersIdentifier id) const
CaloSample encoded in id, returns CaloSampling::Unknown if id is not valid
Definition: TrackParametersIdHelper.h:91
Tile_Base_ID::tower
int tower(const Identifier &id) const
Definition: Tile_Base_ID.cxx:165
TileCal::TrackTools::getPathInsideCell
double getPathInsideCell(const TRACK *track, const CaloCell *cell) const override
Definition: DerivationFramework/DerivationFrameworkTileCal/src/TrackTools.cxx:228
PlotPulseshapeFromCool.np
np
Definition: PlotPulseshapeFromCool.py:64
TileCal::TrackTools::m_tileMgr
const TileDetDescrManager * m_tileMgr
Definition: DerivationFramework/DerivationFrameworkTileCal/src/TrackTools.h:61
x
#define x
Trk::TrackParametersIdHelper::isEntryToVolume
bool isEntryToVolume(TrackParametersIdentifier id) const
returns true if the id belongs to the volume entrance
Definition: TrackParametersIdHelper.h:81
TileCal
Definition: DerivationFramework/DerivationFrameworkTileCal/src/ITrackTools.h:71
makeTRTBarrelCans.y1
tuple y1
Definition: makeTRTBarrelCans.py:15
TileID.h
TileDetDescrManager.h
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
TileCal::TrackTools::TILE_RAW_FIFTH
@ TILE_RAW_FIFTH
Definition: DerivationFramework/DerivationFrameworkTileCal/src/TrackTools.h:62
CaloDetDescrElement::getSubCalo
CaloCell_ID::SUBCALO getSubCalo() const
cell subcalo
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:433
TileCellDim
Definition: TileCellDim.h:19
GeoPrimitives.h
Trk::TrackParametersIdHelper
helper class to encode and decode a TrackParametersIdentifier
Definition: TrackParametersIdHelper.h:18
TileCellDim::getRMax
double getRMax(unsigned int index) const
Definition: TileCellDim.cxx:39
TrackParametersIdHelper.h
FullCPAlgorithmsTest_eljob.sample
sample
Definition: FullCPAlgorithmsTest_eljob.py:100
lumiFormat.i
int i
Definition: lumiFormat.py:92
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
z
#define z
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TileCal::TrackTools::getXYZEtaPhiInCellSampling
std::vector< double > getXYZEtaPhiInCellSampling(const TRACK *track, const CaloCell *cell) const override
Definition: DerivationFramework/DerivationFrameworkTileCal/src/TrackTools.cxx:122
makeTRTBarrelCans.y2
tuple y2
Definition: makeTRTBarrelCans.py:18
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CaloCell_Base_ID::TILE
@ TILE
Definition: CaloCell_Base_ID.h:46
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
Trk::ParametersBase
Definition: ParametersBase.h:55
TileCellDim::getRMin
double getRMin(unsigned int index) const
Definition: TileCellDim.cxx:31
calibdata.exit
exit
Definition: calibdata.py:236
TileCal::TrackTools::retrieveIndex
int retrieveIndex(int sampling, float eta) const override
Definition: DerivationFramework/DerivationFrameworkTileCal/src/TrackTools.cxx:540
TrackParametersIdentifier
unsigned int TrackParametersIdentifier
Definition: TrackParametersIdHelper.h:13
TileCal::TrackTools::getXYZEtaPhiPerLayer
std::vector< std::vector< double > > getXYZEtaPhiPerLayer(const TRACK *track) const override
Definition: DerivationFramework/DerivationFrameworkTileCal/src/TrackTools.cxx:137
merge.output
output
Definition: merge.py:17
python.TriggerEDMRun2.Samplings
Samplings
Definition: TriggerEDMRun2.py:76
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
TileCal::TrackTools::getTrackInCellSampling
std::unique_ptr< const Trk::TrackParameters > getTrackInCellSampling(const TRACK *track, CaloSampling::CaloSample sampling) const override
Definition: DerivationFramework/DerivationFrameworkTileCal/src/TrackTools.cxx:52
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
TileCellDim::getZMax
double getZMax(unsigned int index) const
Definition: TileCellDim.cxx:55
CaloCellContainer
Container class for CaloCell.
Definition: CaloCellContainer.h:55
ParticleGun_SamplingFraction.radius
radius
Definition: ParticleGun_SamplingFraction.py:96
TileCellDim.h
DeMoScan.index
string index
Definition: DeMoScan.py:362
TileCal::TrackTools::initialize
StatusCode initialize() override final
Definition: DerivationFramework/DerivationFrameworkTileCal/src/TrackTools.cxx:23
TileCal::TrackTools::TILE_RAW_SIXTH
@ TILE_RAW_SIXTH
Definition: DerivationFramework/DerivationFrameworkTileCal/src/TrackTools.h:62
a
TList * a
Definition: liststreamerinfos.cxx:10
y
#define y
CaloCell
Data object for each calorimeter readout cell.
Definition: CaloCell.h:57
CaloDetDescrElement::getSampling
CaloCell_ID::CaloSample getSampling() const
cell sampling
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:395
CaloCell_ID_FCS::PreSamplerE
@ PreSamplerE
Definition: FastCaloSim_CaloCell_ID.h:23
ConstDataVector< CaloCellContainer >
TileCal::TrackTools::getPath
double getPath(const CaloCell *cell, const Trk::TrackParameters *entrance, const Trk::TrackParameters *exit) const override
Definition: DerivationFramework/DerivationFrameworkTileCal/src/TrackTools.cxx:316
TileCal::TrackTools::m_isCollision
Gaudi::Property< bool > m_isCollision
Definition: DerivationFramework/DerivationFrameworkTileCal/src/TrackTools.h:55
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
KinematicUtils::deltaR
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: D3PDMaker/TileD3PDMaker/src/ITrackTools.h:114
TileCal::TrackTools::TILE_RAW_FOURTH
@ TILE_RAW_FOURTH
Definition: DerivationFramework/DerivationFrameworkTileCal/src/TrackTools.h:62
Trk::CaloExtension::caloLayerIntersections
const std::vector< CurvilinearParameters > & caloLayerIntersections() const
access to the intersections with the calorimeter layers.
Definition: CaloExtension.h:76
CaloCell_Base_ID::LAREM
@ LAREM
Definition: CaloCell_Base_ID.h:46
makeComparison.deltaR
float deltaR
Definition: makeComparison.py:36
python.compressB64.c
def c
Definition: compressB64.py:93
TileCellDim::getZMin
double getZMin(unsigned int index) const
Definition: TileCellDim.cxx:47