CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
HDetIdAssociator Class Referenceabstract

#include <DetIdAssociator.h>

Inheritance diagram for HDetIdAssociator:
HCaloDetIdAssociator HEcalDetIdAssociator HHcalDetIdAssociator

Public Member Functions

virtual std::set< DetIdgetCrossedDetIds (const std::set< DetId > &, const std::vector< GlobalPoint > &trajectory)
 
virtual std::set< DetIdgetDetIdsCloseToAPoint (const GlobalPoint &, const int idR=0)
 
virtual std::set< DetIdgetDetIdsCloseToAPoint (const GlobalPoint &point, const double dR=0)
 
virtual std::set< DetIdgetDetIdsInACone (const std::set< DetId > &, const std::vector< GlobalPoint > &trajectory, const double)
 
virtual std::set< DetIdgetMaxEDetId (const std::set< DetId > &, edm::Handle< CaloTowerCollection > caloTowers)
 
virtual std::set< DetIdgetMaxEDetId (const std::set< DetId > &, edm::Handle< HBHERecHitCollection > recHits)
 
virtual std::vector< GlobalPointgetTrajectory (const FreeTrajectoryState &, const std::vector< GlobalPoint > &)
 
 HDetIdAssociator ()
 
 HDetIdAssociator (const int nPhi, const int nEta, const double etaBinSize)
 
virtual int iEta (const GlobalPoint &)
 
virtual int iPhi (const GlobalPoint &)
 
virtual void setPropagator (Propagator *ptr)
 
virtual ~HDetIdAssociator ()
 

Protected Member Functions

virtual void buildMap ()
 
virtual void check_setup ()
 
virtual std::set< DetIdgetASetOfValidDetIds ()=0
 
virtual std::vector< GlobalPointgetDetIdPoints (const DetId &)=0
 
virtual GlobalPoint getPosition (const DetId &)=0
 
virtual bool insideElement (const GlobalPoint &, const DetId &)=0
 
virtual bool nearElement (const GlobalPoint &point, const DetId &id, const double distance)
 

Protected Attributes

const double etaBinSize_
 
PropagatorivProp_
 
const int nEta_
 
const int nPhi_
 
std::vector< std::vector< std::set< DetId > > > * theMap_
 

Detailed Description

Definition at line 32 of file DetIdAssociator.h.

Constructor & Destructor Documentation

◆ HDetIdAssociator() [1/2]

HDetIdAssociator::HDetIdAssociator ( )
inline

Definition at line 34 of file DetIdAssociator.h.

34 : theMap_(nullptr), nPhi_(0), nEta_(0), etaBinSize_(0), ivProp_(nullptr){};

◆ HDetIdAssociator() [2/2]

HDetIdAssociator::HDetIdAssociator ( const int  nPhi,
const int  nEta,
const double  etaBinSize 
)
inline

Definition at line 35 of file DetIdAssociator.h.

36  : theMap_(nullptr), nPhi_(nPhi), nEta_(nEta), etaBinSize_(etaBinSize), ivProp_(nullptr){};

◆ ~HDetIdAssociator()

virtual HDetIdAssociator::~HDetIdAssociator ( )
inlinevirtual

Definition at line 38 of file DetIdAssociator.h.

38 {};

Member Function Documentation

◆ buildMap()

void HDetIdAssociator::buildMap ( )
protectedvirtual

Definition at line 281 of file DetIdAssociator.cc.

281  {
282  // modified version: take only detector central position
283  check_setup();
284  LogTrace("HDetIdAssociator") << "building map"
285  << "\n";
286  if (theMap_)
287  delete theMap_;
288  theMap_ = new std::vector<std::vector<std::set<DetId> > >(nEta_, std::vector<std::set<DetId> >(nPhi_));
289  int numberOfDetIdsOutsideEtaRange = 0;
290  int numberOfDetIdsActive = 0;
291  std::set<DetId> validIds = getASetOfValidDetIds();
292  for (std::set<DetId>::const_iterator id_itr = validIds.begin(); id_itr != validIds.end(); id_itr++) {
293  // std::vector<GlobalPoint> points = getDetIdPoints(*id_itr);
294  GlobalPoint point = getPosition(*id_itr);
295  // reject fake DetIds (eta=0 - what are they anyway???)
296  if (point.eta() == 0)
297  continue;
298 
299  int ieta = iEta(point);
300  int iphi = iPhi(point);
301  int etaMax(-1);
302  int etaMin(nEta_);
303  int phiMax(-1);
304  int phiMin(nPhi_);
305  if (iphi >= nPhi_)
306  iphi = iphi % nPhi_;
307  assert(iphi >= 0);
308  if (etaMin > ieta)
309  etaMin = ieta;
310  if (etaMax < ieta)
311  etaMax = ieta;
312  if (phiMin > iphi)
313  phiMin = iphi;
314  if (phiMax < iphi)
315  phiMax = iphi;
316  // for abs(eta)>1.8 one tower covers two phi segments
317  if ((ieta > 54 || ieta < 15) && iphi % 2 == 0)
318  phiMax++;
319  if ((ieta > 54 || ieta < 15) && iphi % 2 == 1)
320  phiMin--;
321 
322  if (etaMax < 0 || phiMax < 0 || etaMin >= nEta_ || phiMin >= nPhi_) {
323  LogTrace("HDetIdAssociator") << "Out of range: DetId:" << id_itr->rawId() << "\n\teta (min,max): " << etaMin
324  << "," << etaMax << "\n\tphi (min,max): " << phiMin << "," << phiMax
325  << "\nTower id: " << id_itr->rawId() << "\n";
326  numberOfDetIdsOutsideEtaRange++;
327  continue;
328  }
329 
330  if (phiMax - phiMin > phiMin + nPhi_ - phiMax) {
331  phiMin += nPhi_;
333  }
334  for (int ieta = etaMin; ieta <= etaMax; ieta++)
335  for (int iphi = phiMin; iphi <= phiMax; iphi++)
336  (*theMap_)[ieta][iphi % nPhi_].insert(*id_itr);
337  numberOfDetIdsActive++;
338  }
339  LogTrace("HDetIdAssociator") << "Number of elements outside the allowed range ( |eta|>" << nEta_ / 2 * etaBinSize_
340  << "): " << numberOfDetIdsOutsideEtaRange << "\n";
341  LogTrace("HDetIdAssociator") << "Number of active DetId's mapped: " << numberOfDetIdsActive << "\n";
342 }

References cms::cuda::assert(), check_setup(), etaBinSize_, ALCARECOTkAlBeamHalo_cff::etaMax, ALCARECOTkAlBeamHalo_cff::etaMin, getASetOfValidDetIds(), getPosition(), iEta(), LEDCalibrationChannels::ieta, iPhi(), LEDCalibrationChannels::iphi, LogTrace, nEta_, nPhi_, AlignmentTrackSelector_cfi::phiMax, AlignmentTrackSelector_cfi::phiMin, point, std::swap(), and theMap_.

Referenced by getDetIdsCloseToAPoint().

◆ check_setup()

virtual void HDetIdAssociator::check_setup ( )
inlineprotectedvirtual

Reimplemented in HCaloDetIdAssociator.

Definition at line 65 of file DetIdAssociator.h.

65  {
66  if (nEta_ == 0)
67  throw cms::Exception("FatalError") << "Number of eta bins is not set.\n";
68  if (nPhi_ == 0)
69  throw cms::Exception("FatalError") << "Number of phi bins is not set.\n";
70  if (ivProp_ == nullptr)
71  throw cms::Exception("FatalError") << "Track propagator is not defined\n";
72  if (etaBinSize_ == 0)
73  throw cms::Exception("FatalError") << "Eta bin size is not set.\n";
74  }

References etaBinSize_, Exception, ivProp_, nEta_, and nPhi_.

Referenced by buildMap(), HCaloDetIdAssociator::check_setup(), getCrossedDetIds(), getDetIdsCloseToAPoint(), getDetIdsInACone(), getMaxEDetId(), and getTrajectory().

◆ getASetOfValidDetIds()

virtual std::set<DetId> HDetIdAssociator::getASetOfValidDetIds ( )
protectedpure virtual

◆ getCrossedDetIds()

std::set< DetId > HDetIdAssociator::getCrossedDetIds ( const std::set< DetId > &  inset,
const std::vector< GlobalPoint > &  trajectory 
)
virtual

Definition at line 394 of file DetIdAssociator.cc.

395  {
396  check_setup();
397  std::set<DetId> outset;
398  for (std::set<DetId>::const_iterator id_iter = inset.begin(); id_iter != inset.end(); id_iter++)
399  for (std::vector<GlobalPoint>::const_iterator point_iter = trajectory.begin(); point_iter != trajectory.end();
400  point_iter++)
401  if (insideElement(*point_iter, *id_iter))
402  outset.insert(*id_iter);
403  return outset;
404 }

References check_setup(), and insideElement().

◆ getDetIdPoints()

virtual std::vector<GlobalPoint> HDetIdAssociator::getDetIdPoints ( const DetId )
protectedpure virtual

Implemented in HCaloDetIdAssociator.

◆ getDetIdsCloseToAPoint() [1/2]

std::set< DetId > HDetIdAssociator::getDetIdsCloseToAPoint ( const GlobalPoint direction,
const int  idR = 0 
)
virtual

Definition at line 138 of file DetIdAssociator.cc.

138  {
139  std::set<DetId> set;
140  check_setup();
141  int nDets = 0;
142  if (!theMap_)
143  buildMap();
144  LogTrace("MatchPoint") << "point (eta,phi): " << direction.eta() << "," << direction.phi() << "\n";
145  int ieta = iEta(direction);
146  int iphi = iPhi(direction);
147 
148  LogTrace("MatchPoint") << "(ieta,iphi): " << ieta << "," << iphi << "\n";
149 
150  if (ieta >= 0 && ieta < nEta_ && iphi >= 0 && iphi < nPhi_) {
151  set = (*theMap_)[ieta][iphi];
152  nDets++;
153  if (idR > 0) {
154  LogTrace("MatchPoint") << "Add neighbors (ieta,iphi): " << ieta << "," << iphi << "\n";
155  //add neighbors
156  int maxIEta = ieta + idR;
157  int minIEta = ieta - idR;
158  if (maxIEta >= nEta_)
159  maxIEta = nEta_ - 1;
160  if (minIEta < 0)
161  minIEta = 0;
162  int maxIPhi = iphi + idR;
163  int minIPhi = iphi - idR;
164  if (minIPhi < 0) {
165  minIPhi += nPhi_;
166  maxIPhi += nPhi_;
167  }
168  LogTrace("MatchPoint") << "\tieta (min,max): " << minIEta << "," << maxIEta << "\n";
169  LogTrace("MatchPoint") << "\tiphi (min,max): " << minIPhi << "," << maxIPhi << "\n";
170  for (int i = minIEta; i <= maxIEta; i++)
171  for (int j = minIPhi; j <= maxIPhi; j++) {
172  if (i == ieta && j == iphi)
173  continue; // already in the set
174  set.insert((*theMap_)[i][j % nPhi_].begin(), (*theMap_)[i][j % nPhi_].end());
175  nDets++;
176  }
177  }
178  }
179  // if(set.size() > 0) {
180  // if (ieta+idR<55 && ieta-idR>14 && set.size() != (2*idR+1)*(2*idR+1)){
181  // std::cout<<" RRRA: "<<set.size()<<" DetIds in region "<<ieta<<" "<<iphi<<std::endl;
182  // for( std::set<DetId>::const_iterator itr=set.begin(); itr!=set.end(); itr++) {
183  // GlobalPoint point = getPosition(*itr);
184  // std::cout << "DetId: " <<itr->rawId() <<" (eta,phi): " << point.eta() << "," << point.phi()<<" "<<iEta(point)<<" "<<iPhi(point)<<std::endl;
185  // }
186  // }
187  // else {
188  // std::cout <<" HDetIdAssociator::getDetIdsCloseToAPoint::There are strange days "<<std::endl;
189  // }
190  return set;
191 }

References buildMap(), check_setup(), mps_fire::end, PV3DBase< T, PVType, FrameType >::eta(), mps_fire::i, iEta(), LEDCalibrationChannels::ieta, iPhi(), LEDCalibrationChannels::iphi, dqmiolumiharvest::j, LogTrace, nEta_, nPhi_, PV3DBase< T, PVType, FrameType >::phi(), and theMap_.

Referenced by getDetIdsCloseToAPoint().

◆ getDetIdsCloseToAPoint() [2/2]

virtual std::set<DetId> HDetIdAssociator::getDetIdsCloseToAPoint ( const GlobalPoint point,
const double  dR = 0 
)
inlinevirtual

Definition at line 44 of file DetIdAssociator.h.

44  {
45  int etaIdR = int(dR / etaBinSize_);
46  int phiIdR = int(dR / (2 * 3.1416) * nPhi_);
47  if (etaIdR > phiIdR)
48  return getDetIdsCloseToAPoint(point, 1 + etaIdR);
49  else
50  return getDetIdsCloseToAPoint(point, 1 + phiIdR);
51  }

References HGC3DClusterGenMatchSelector_cfi::dR, etaBinSize_, getDetIdsCloseToAPoint(), createfilelist::int, nPhi_, and point.

◆ getDetIdsInACone()

std::set< DetId > HDetIdAssociator::getDetIdsInACone ( const std::set< DetId > &  inset,
const std::vector< GlobalPoint > &  trajectory,
const double  dR 
)
virtual

Definition at line 345 of file DetIdAssociator.cc.

347  {
348  // modified version: if dR<0, returns 3x3 towers around the input one (Michal)
349  check_setup();
350  std::set<DetId> outset;
351 
352  if (dR >= 0) {
353  for (std::set<DetId>::const_iterator id_iter = inset.begin(); id_iter != inset.end(); id_iter++)
354  for (std::vector<GlobalPoint>::const_iterator point_iter = trajectory.begin(); point_iter != trajectory.end();
355  point_iter++)
356  if (nearElement(*point_iter, *id_iter, dR))
357  outset.insert(*id_iter);
358  } else {
359  if (inset.size() != 1)
360  return outset;
361  std::set<DetId>::const_iterator id_inp = inset.begin();
362  int ieta;
363  int iphi;
364  GlobalPoint point = getPosition(*id_inp);
365  ieta = iEta(point);
366  iphi = iPhi(point);
367  for (int i = ieta - 1; i <= ieta + 1; i++) {
368  for (int j = iphi - 1; j <= iphi + 1; j++) {
369  // if( i==ieta && j==iphi) continue;
370  if (i < 0 || i >= nEta_)
371  continue;
372  int j2fill = j % nPhi_;
373  if (j2fill < 0)
374  j2fill += nPhi_;
375  if ((*theMap_)[i][j2fill].empty())
376  continue;
377  outset.insert((*theMap_)[i][j2fill].begin(), (*theMap_)[i][j2fill].end());
378  }
379  }
380  }
381 
382  // if (outset.size() > 0) {
383  // std::cout<<" RRRA: DetIds in cone:"<<std::endl;
384  // for( std::set<DetId>::const_iterator itr=outset.begin(); itr!=outset.end(); itr++) {
385  // GlobalPoint point = getPosition(*itr);
386  // std::cout << "DetId: " <<itr->rawId() <<" (eta,phi): " << point.eta() << "," << point.phi()<<std::endl;
387  // }
388  // }
389 
390  return outset;
391 }

References check_setup(), HGC3DClusterGenMatchSelector_cfi::dR, relativeConstraints::empty, mps_fire::end, getPosition(), mps_fire::i, iEta(), LEDCalibrationChannels::ieta, iPhi(), LEDCalibrationChannels::iphi, dqmiolumiharvest::j, nearElement(), nEta_, nPhi_, point, and theMap_.

◆ getMaxEDetId() [1/2]

std::set< DetId > HDetIdAssociator::getMaxEDetId ( const std::set< DetId > &  inset,
edm::Handle< CaloTowerCollection caloTowers 
)
virtual

Definition at line 407 of file DetIdAssociator.cc.

408  {
409  // returns the most energetic tower in the NxN box (Michal)
410  check_setup();
411  std::set<DetId> outset;
412  std::set<DetId>::const_iterator id_max = inset.begin();
413  double Ehadmax = 0;
414 
415  for (std::set<DetId>::const_iterator id_iter = inset.begin(); id_iter != inset.end(); id_iter++) {
416  DetId id(*id_iter);
417  // GlobalPoint point = getPosition(*id_iter);
418  // int ieta = iEta(point);
419  // int iphi = iPhi(point);
420  CaloTowerCollection::const_iterator tower = (*caloTowers).find(id);
421  if (tower != (*caloTowers).end() && tower->hadEnergy() > Ehadmax) {
422  id_max = id_iter;
423  Ehadmax = tower->hadEnergy();
424  }
425  }
426 
427  if (Ehadmax > 0)
428  outset.insert(*id_max);
429 
430  // if (outset.size() > 0) {
431  // std::cout<<" RRRA: Most energetic DetId:"<<std::endl;
432  // for( std::set<DetId>::const_iterator itr=outset.begin(); itr!=outset.end(); itr++) {
433  // GlobalPoint point = getPosition(*itr);
434  // std::cout << "DetId: " <<itr->rawId() <<" (eta,phi): " << point.eta() << "," << point.phi()<<std::endl;
435  // }
436  // }
437 
438  return outset;
439 }

References check_setup(), triggerObjects_cff::id, and hgcalTowerProducer_cfi::tower.

◆ getMaxEDetId() [2/2]

std::set< DetId > HDetIdAssociator::getMaxEDetId ( const std::set< DetId > &  inset,
edm::Handle< HBHERecHitCollection recHits 
)
virtual

Definition at line 442 of file DetIdAssociator.cc.

443  {
444  // returns the most energetic tower in the NxN box - from RecHits (Michal)
445  check_setup();
446  std::set<DetId> outset;
447  std::set<DetId>::const_iterator id_max = inset.begin();
448  double Ehadmax = 0;
449 
450  for (std::set<DetId>::const_iterator id_iter = inset.begin(); id_iter != inset.end(); id_iter++) {
451  DetId id(*id_iter);
452  // GlobalPoint point = getPosition(*id_iter);
453  // int ieta = iEta(point);
454  // int iphi = iPhi(point);
455  HBHERecHitCollection::const_iterator hit = (*recHits).find(id);
456  if (hit != (*recHits).end() && hit->energy() > Ehadmax) {
457  id_max = id_iter;
458  Ehadmax = hit->energy();
459  }
460  }
461 
462  if (Ehadmax > 0)
463  outset.insert(*id_max);
464 
465  // if (outset.size() > 0) {
466  // std::cout<<" RRRA: Most energetic DetId:"<<std::endl;
467  // for( std::set<DetId>::const_iterator itr=outset.begin(); itr!=outset.end(); itr++) {
468  // GlobalPoint point = getPosition(*itr);
469  // std::cout << "DetId: " <<itr->rawId() <<" (eta,phi): " << point.eta() << "," << point.phi()<<std::endl;
470  // }
471  // }
472 
473  return outset;
474 }

References check_setup(), and triggerObjects_cff::id.

◆ getPosition()

virtual GlobalPoint HDetIdAssociator::getPosition ( const DetId )
protectedpure virtual

Implemented in HCaloDetIdAssociator.

Referenced by buildMap(), getDetIdsInACone(), and nearElement().

◆ getTrajectory()

std::vector< GlobalPoint > HDetIdAssociator::getTrajectory ( const FreeTrajectoryState ftsStart,
const std::vector< GlobalPoint > &  surfaces 
)
virtual

Definition at line 25 of file DetIdAssociator.cc.

26  {
27  check_setup();
28  std::vector<GlobalPoint> trajectory;
29  TrajectoryStateOnSurface tSOSDest;
30  FreeTrajectoryState ftsCurrent = ftsStart;
31 
32  for (std::vector<GlobalPoint>::const_iterator surface_iter = surfaces.begin(); surface_iter != surfaces.end();
33  surface_iter++) {
34  // this stuff is some weird pointer, which destroy itself
35  std::unique_ptr<Cylinder> cylinder =
36  std::make_unique<Cylinder>(surface_iter->perp(), Surface::PositionType(0, 0, 0), Surface::RotationType());
37  std::unique_ptr<Plane> forwardEndcap =
38  std::make_unique<Plane>(Surface::PositionType(0, 0, surface_iter->z()), Surface::RotationType());
39  std::unique_ptr<Plane> backwardEndcap =
40  std::make_unique<Plane>(Surface::PositionType(0, 0, -surface_iter->z()), Surface::RotationType());
41 
42  LogTrace("StartingPoint") << "Propagate from "
43  << "\n"
44  << "\tx: " << ftsStart.position().x() << "\n"
45  << "\ty: " << ftsStart.position().y() << "\n"
46  << "\tz: " << ftsStart.position().z() << "\n"
47  << "\tmomentum eta: " << ftsStart.momentum().eta() << "\n"
48  << "\tmomentum phi: " << ftsStart.momentum().phi() << "\n"
49  << "\tmomentum: " << ftsStart.momentum().mag() << "\n";
50 
51  float tanTheta = ftsCurrent.momentum().perp() / ftsCurrent.momentum().z();
52  float corner = surface_iter->perp() / surface_iter->z();
53  /*
54  std::cout<<"Propagate from "<< "\n"
55  << "\tx: " << ftsCurrent.position().x()<< "\n"
56  << "\ty: " << ftsCurrent.position().y()<< "\n"
57  << "\tz: " << ftsCurrent.position().z()<< "\n"
58  << "\tz: " << ftsCurrent.position().perp()<< "\n"
59  << "\tz: " << tanTheta<<" "<< corner <<"\n"
60  << "\tmomentum eta: " << ftsCurrent.momentum().eta()<< "\n"
61  << "\tmomentum phi: " << ftsCurrent.momentum().phi()<< "\n"
62  << "\tmomentum: " << ftsCurrent.momentum().mag()<<std::endl;
63 */
64  // First propage the track to the cylinder if |eta|<1, othewise to the encap
65  // and correct depending on the result
66  int ibar = 0;
67  if (fabs(tanTheta) > corner) {
68  tSOSDest = ivProp_->propagate(ftsCurrent, *cylinder);
69  // std::cout<<" Propagate to cylinder "<<std::endl;
70  } else if (tanTheta > 0.) {
71  tSOSDest = ivProp_->propagate(ftsCurrent, *forwardEndcap);
72  ibar = 1;
73  } else {
74  tSOSDest = ivProp_->propagate(ftsCurrent, *backwardEndcap);
75  ibar = -1;
76  }
77 
78  // std::cout<<" Trajectory valid? "<<tSOSDest.isValid()<<" First propagation in "<<ibar<<std::endl;
79 
80  if (!tSOSDest.isValid()) {
81  // barrel
82  if (ibar == 0) {
83  if (tanTheta < 0)
84  tSOSDest = ivProp_->propagate(ftsCurrent, *forwardEndcap);
85  if (tanTheta >= 0)
86  tSOSDest = ivProp_->propagate(ftsCurrent, *backwardEndcap);
87  } else {
88  tSOSDest = ivProp_->propagate(ftsCurrent, *cylinder);
89  }
90  } else {
91  // missed target
92  if (abs(ibar) > 0) {
93  if (tSOSDest.globalPosition().perp() > surface_iter->perp()) {
94  tSOSDest = ivProp_->propagate(ftsCurrent, *cylinder);
95  }
96  } else {
97  if (tanTheta < 0)
98  tSOSDest = ivProp_->propagate(ftsCurrent, *forwardEndcap);
99  if (tanTheta >= 0)
100  tSOSDest = ivProp_->propagate(ftsCurrent, *backwardEndcap);
101  }
102  }
103 
104  // If missed the target, propagate to again
105  // if ((!tSOSDest.isValid()) && point.perp() > surface_iter->perp())
106  // {tSOSDest = ivProp_->propagate(ftsCurrent, *cylinder);std::cout<<" Propagate again 1 "<<std::endl;}
107  // std::cout<<" Track is ok after repropagation to cylinder or not? "<<tSOSDest.isValid()<<std::endl;
108  // if ((!tSOSDest.isValid()) && ftsStart.momentum().eta()>0. && fabs(ftsStart.momentum().eta())>1.)
109  // {tSOSDest = ivProp_->propagate(ftsStart, *forwardEndcap);std::cout<<" Propagate again 2 "<<std::endl;}
110  // std::cout<<" Track is ok after repropagation forward or not? "<<tSOSDest.isValid()<<std::endl;
111  // if ((!tSOSDest.isValid()) && ftsStart.momentum().eta()<0.&&fabs(ftsStart.momentum().eta())>1.)
112  // {tSOSDest = ivProp_->propagate(ftsStart, *backwardEndcap);std::cout<<" Propagate again 3 "<<std::endl;}
113  // std::cout<<" Track is after repropagation backward ok or not? "<<tSOSDest.isValid()<<std::endl;
114 
115  if (!tSOSDest.isValid())
116  return trajectory;
117 
118  // std::cout<<" Propagate reach something"<<std::endl;
119  LogTrace("SuccessfullPropagation") << "Great, I reached something."
120  << "\n"
121  << "\tx: " << tSOSDest.freeState()->position().x() << "\n"
122  << "\ty: " << tSOSDest.freeState()->position().y() << "\n"
123  << "\tz: " << tSOSDest.freeState()->position().z() << "\n"
124  << "\teta: " << tSOSDest.freeState()->position().eta() << "\n"
125  << "\tphi: " << tSOSDest.freeState()->position().phi() << "\n";
126 
127  // std::cout<<" The position of trajectory "<<tSOSDest.freeState()->position().perp()<<" "<<tSOSDest.freeState()->position().z()<<std::endl;
128 
129  GlobalPoint point = tSOSDest.freeState()->position();
130  point = tSOSDest.freeState()->position();
131  ftsCurrent = *tSOSDest.freeState();
132  trajectory.push_back(point);
133  }
134  return trajectory;
135 }

References funct::abs(), check_setup(), TCMET_cfi::corner, PV3DBase< T, PVType, FrameType >::eta(), TrajectoryStateOnSurface::freeState(), TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::isValid(), ivProp_, LogTrace, PV3DBase< T, PVType, FrameType >::mag(), FreeTrajectoryState::momentum(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), point, FreeTrajectoryState::position(), Propagator::propagate(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

◆ iEta()

int HDetIdAssociator::iEta ( const GlobalPoint point)
virtual

Definition at line 194 of file DetIdAssociator.cc.

194  {
195  // unequal bin sizes for endcap, following HCAL geometry
196  int iEta1 = int(point.eta() / etaBinSize_ + nEta_ / 2);
197  if (point.eta() > 1.827 && point.eta() <= 1.830)
198  return iEta1 - 1;
199  else if (point.eta() > 1.914 && point.eta() <= 1.930)
200  return iEta1 - 1;
201  else if (point.eta() > 2.001 && point.eta() <= 2.043)
202  return iEta1 - 1;
203  else if (point.eta() > 2.088 && point.eta() <= 2.172)
204  return iEta1 - 1;
205  else if (point.eta() > 2.175 && point.eta() <= 2.262)
206  return iEta1 - 1;
207  else if (point.eta() > 2.262 && point.eta() <= 2.332)
208  return iEta1 - 2;
209  else if (point.eta() > 2.332 && point.eta() <= 2.349)
210  return iEta1 - 1;
211  else if (point.eta() > 2.349 && point.eta() <= 2.436)
212  return iEta1 - 2;
213  else if (point.eta() > 2.436 && point.eta() <= 2.500)
214  return iEta1 - 3;
215  else if (point.eta() > 2.500 && point.eta() <= 2.523)
216  return iEta1 - 2;
217  else if (point.eta() > 2.523 && point.eta() <= 2.610)
218  return iEta1 - 3;
219  else if (point.eta() > 2.610 && point.eta() <= 2.650)
220  return iEta1 - 4;
221  else if (point.eta() > 2.650 && point.eta() <= 2.697)
222  return iEta1 - 3;
223  else if (point.eta() > 2.697 && point.eta() <= 2.784)
224  return iEta1 - 4;
225  else if (point.eta() > 2.784 && point.eta() <= 2.868)
226  return iEta1 - 5;
227  else if (point.eta() > 2.868 && point.eta() <= 2.871)
228  return iEta1 - 4;
229  else if (point.eta() > 2.871 && point.eta() <= 2.958)
230  return iEta1 - 5;
231  else if (point.eta() > 2.958)
232  return iEta1 - 6;
233  else if (point.eta() < -1.827 && point.eta() >= -1.830)
234  return iEta1 + 1;
235  else if (point.eta() < -1.914 && point.eta() >= -1.930)
236  return iEta1 + 1;
237  else if (point.eta() < -2.001 && point.eta() >= -2.043)
238  return iEta1 + 1;
239  else if (point.eta() < -2.088 && point.eta() >= -2.172)
240  return iEta1 + 1;
241  else if (point.eta() < -2.175 && point.eta() >= -2.262)
242  return iEta1 + 1;
243  else if (point.eta() < -2.262 && point.eta() >= -2.332)
244  return iEta1 + 2;
245  else if (point.eta() < -2.332 && point.eta() >= -2.349)
246  return iEta1 + 1;
247  else if (point.eta() < -2.349 && point.eta() >= -2.436)
248  return iEta1 + 2;
249  else if (point.eta() < -2.436 && point.eta() >= -2.500)
250  return iEta1 + 3;
251  else if (point.eta() < -2.500 && point.eta() >= -2.523)
252  return iEta1 + 2;
253  else if (point.eta() < -2.523 && point.eta() >= -2.610)
254  return iEta1 + 3;
255  else if (point.eta() < -2.610 && point.eta() >= -2.650)
256  return iEta1 + 4;
257  else if (point.eta() < -2.650 && point.eta() >= -2.697)
258  return iEta1 + 3;
259  else if (point.eta() < -2.697 && point.eta() >= -2.784)
260  return iEta1 + 4;
261  else if (point.eta() < -2.784 && point.eta() >= -2.868)
262  return iEta1 + 5;
263  else if (point.eta() < -2.868 && point.eta() >= -2.871)
264  return iEta1 + 4;
265  else if (point.eta() < -2.871 && point.eta() >= -2.958)
266  return iEta1 + 5;
267  else if (point.eta() < -2.349)
268  return iEta1 + 6;
269  else
270  return iEta1;
271 }

References etaBinSize_, createfilelist::int, nEta_, and point.

Referenced by buildMap(), getDetIdsCloseToAPoint(), and getDetIdsInACone().

◆ insideElement()

virtual bool HDetIdAssociator::insideElement ( const GlobalPoint ,
const DetId  
)
protectedpure virtual

Implemented in HCaloDetIdAssociator.

Referenced by getCrossedDetIds().

◆ iPhi()

int HDetIdAssociator::iPhi ( const GlobalPoint point)
virtual

Definition at line 274 of file DetIdAssociator.cc.

274  {
275  double pi = 4 * atan(1.);
276  int iPhi1 = int((double(point.phi()) + pi) / (2 * pi) * nPhi_);
277  return iPhi1;
278 }

References createfilelist::int, nPhi_, pi, and point.

Referenced by buildMap(), getDetIdsCloseToAPoint(), and getDetIdsInACone().

◆ nearElement()

virtual bool HDetIdAssociator::nearElement ( const GlobalPoint point,
const DetId id,
const double  distance 
)
inlineprotectedvirtual

Definition at line 82 of file DetIdAssociator.h.

82  {
83  GlobalPoint center = getPosition(id);
84  return sqrt(pow(point.eta() - center.eta(), 2) + pow(point.phi() - center.phi(), 2)) < distance;
85  };

References HLT_FULL_cff::distance, PV3DBase< T, PVType, FrameType >::eta(), getPosition(), PV3DBase< T, PVType, FrameType >::phi(), point, funct::pow(), and mathSSE::sqrt().

Referenced by getDetIdsInACone().

◆ setPropagator()

virtual void HDetIdAssociator::setPropagator ( Propagator ptr)
inlinevirtual

Definition at line 62 of file DetIdAssociator.h.

62 { ivProp_ = ptr; };

References ivProp_.

Member Data Documentation

◆ etaBinSize_

const double HDetIdAssociator::etaBinSize_
protected

Definition at line 90 of file DetIdAssociator.h.

Referenced by buildMap(), check_setup(), getDetIdsCloseToAPoint(), and iEta().

◆ ivProp_

Propagator* HDetIdAssociator::ivProp_
protected

Definition at line 91 of file DetIdAssociator.h.

Referenced by check_setup(), getTrajectory(), and setPropagator().

◆ nEta_

const int HDetIdAssociator::nEta_
protected

◆ nPhi_

const int HDetIdAssociator::nPhi_
protected

◆ theMap_

std::vector<std::vector<std::set<DetId> > >* HDetIdAssociator::theMap_
protected

Definition at line 85 of file DetIdAssociator.h.

Referenced by buildMap(), getDetIdsCloseToAPoint(), and getDetIdsInACone().

HDetIdAssociator::nPhi_
const int nPhi_
Definition: DetIdAssociator.h:88
TkRotation< float >
FreeTrajectoryState::momentum
GlobalVector momentum() const
Definition: FreeTrajectoryState.h:68
ALCARECOTkAlBeamHalo_cff.etaMin
etaMin
GeV.
Definition: ALCARECOTkAlBeamHalo_cff.py:32
mps_fire.i
i
Definition: mps_fire.py:428
HDetIdAssociator::ivProp_
Propagator * ivProp_
Definition: DetIdAssociator.h:91
edm::SortedCollection< CaloTower >::const_iterator
std::vector< CaloTower >::const_iterator const_iterator
Definition: SortedCollection.h:80
HDetIdAssociator::iPhi
virtual int iPhi(const GlobalPoint &)
Definition: DetIdAssociator.cc:274
HDetIdAssociator::nEta_
const int nEta_
Definition: DetIdAssociator.h:89
HLT_FULL_cff.nEta
nEta
Definition: HLT_FULL_cff.py:6586
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
TrajectoryStateOnSurface::globalPosition
GlobalPoint globalPosition() const
Definition: TrajectoryStateOnSurface.h:65
HDetIdAssociator::iEta
virtual int iEta(const GlobalPoint &)
Definition: DetIdAssociator.cc:194
hgcalTowerProducer_cfi.tower
tower
Definition: hgcalTowerProducer_cfi.py:4
cms::cuda::assert
assert(be >=bs)
HDetIdAssociator::getASetOfValidDetIds
virtual std::set< DetId > getASetOfValidDetIds()=0
FreeTrajectoryState::position
GlobalPoint position() const
Definition: FreeTrajectoryState.h:67
HLT_FULL_cff.etaBinSize
etaBinSize
Definition: HLT_FULL_cff.py:6585
GloballyPositioned< float >::RotationType
TkRotation< float > RotationType
Definition: GloballyPositioned.h:22
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
DetId
Definition: DetId.h:17
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
TrajectoryStateOnSurface::freeState
FreeTrajectoryState const * freeState(bool withErrors=true) const
Definition: TrajectoryStateOnSurface.h:58
HDetIdAssociator::buildMap
virtual void buildMap()
Definition: DetIdAssociator.cc:281
std::swap
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
Definition: DataFrameContainer.h:209
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
AlignmentTrackSelector_cfi.phiMin
phiMin
Definition: AlignmentTrackSelector_cfi.py:18
mps_fire.end
end
Definition: mps_fire.py:242
AlignmentTrackSelector_cfi.phiMax
phiMax
Definition: AlignmentTrackSelector_cfi.py:17
Point3DBase< float, GlobalTag >
HDetIdAssociator::insideElement
virtual bool insideElement(const GlobalPoint &, const DetId &)=0
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
HDetIdAssociator::getPosition
virtual GlobalPoint getPosition(const DetId &)=0
HDetIdAssociator::check_setup
virtual void check_setup()
Definition: DetIdAssociator.h:65
HDetIdAssociator::getDetIdsCloseToAPoint
virtual std::set< DetId > getDetIdsCloseToAPoint(const GlobalPoint &, const int idR=0)
Definition: DetIdAssociator.cc:138
PV3DBase::eta
T eta() const
Definition: PV3DBase.h:73
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
HLT_FULL_cff.nPhi
nPhi
Definition: HLT_FULL_cff.py:6587
createfilelist.int
int
Definition: createfilelist.py:10
HDetIdAssociator::etaBinSize_
const double etaBinSize_
Definition: DetIdAssociator.h:90
Propagator::propagate
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
PV3DBase::mag
T mag() const
Definition: PV3DBase.h:64
GloballyPositioned< float >::PositionType
Point3DBase< float, GlobalTag > PositionType
Definition: GloballyPositioned.h:21
FreeTrajectoryState
Definition: FreeTrajectoryState.h:27
HDetIdAssociator::theMap_
std::vector< std::vector< std::set< DetId > > > * theMap_
Definition: DetIdAssociator.h:85
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
Exception
Definition: hltDiff.cc:245
HDetIdAssociator::nearElement
virtual bool nearElement(const GlobalPoint &point, const DetId &id, const double distance)
Definition: DetIdAssociator.h:82
ALCARECOTkAlBeamHalo_cff.etaMax
etaMax
Definition: ALCARECOTkAlBeamHalo_cff.py:33
TCMET_cfi.corner
corner
Definition: TCMET_cfi.py:34
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
pi
const Double_t pi
Definition: trackSplitPlot.h:36
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
HGC3DClusterGenMatchSelector_cfi.dR
dR
Definition: HGC3DClusterGenMatchSelector_cfi.py:7
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
point
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
HLT_FULL_cff.distance
distance
Definition: HLT_FULL_cff.py:7733
PV3DBase::perp
T perp() const
Definition: PV3DBase.h:69
PV3DBase::phi
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
TrajectoryStateOnSurface::isValid
bool isValid() const
Definition: TrajectoryStateOnSurface.h:54
hit
Definition: SiStripHitEffFromCalibTree.cc:88