CMS 3D CMS Logo

HITrackingRegionProducer.h
Go to the documentation of this file.
1 #ifndef RecoHI_HiTracking_HITrackingRegionProducer_H
2 #define RecoHI_HiTracking_HITrackingRegionProducer_H
3 
6 
17 
18 #include "TMath.h"
19 
21 public:
23  edm::ParameterSet regionPSet = cfg.getParameter<edm::ParameterSet>("RegionPSet");
24 
25  thePtMin = regionPSet.getParameter<double>("ptMin");
26  theOriginRadius = regionPSet.getParameter<double>("originRadius");
27  theOriginHalfLength = regionPSet.getParameter<double>("originHalfLength");
28  double xPos = regionPSet.getParameter<double>("originXPos");
29  double yPos = regionPSet.getParameter<double>("originYPos");
30  double zPos = regionPSet.getParameter<double>("originZPos");
31  double xDir = regionPSet.getParameter<double>("directionXCoord");
32  double yDir = regionPSet.getParameter<double>("directionYCoord");
33  double zDir = regionPSet.getParameter<double>("directionZCoord");
34  thePrecise = regionPSet.getParameter<bool>("precise");
35  theSiPixelRecHits = regionPSet.getParameter<edm::InputTag>("siPixelRecHits");
37  theOrigin = GlobalPoint(xPos, yPos, zPos);
38  theDirection = GlobalVector(xDir, yDir, zDir);
39  }
40 
42 
43  int estimateMultiplicity(const edm::Event& ev, const edm::EventSetup& es) const {
44  //rechits
46  ev.getByToken(theSiPixelRecHitsToken, recHitColl);
47 
48  //Retrieve tracker topology from geometry
50  es.get<IdealGeometryRecord>().get(tTopo);
51 
52  int numRecHits = 0;
53  //FIXME: this can be optimized quite a bit by looping only on the per-det 'items' of DetSetVector
54  for (SiPixelRecHitCollection::const_iterator recHitIdIterator = recHitColl->begin(),
55  recHitIdIteratorEnd = recHitColl->end();
56  recHitIdIterator != recHitIdIteratorEnd;
57  recHitIdIterator++) {
58  SiPixelRecHitCollection::DetSet hits = *recHitIdIterator;
59  DetId detId = DetId(hits.detId()); // Get the Detid object
60  unsigned int detType = detId.det(); // det type, tracker=1
61  unsigned int subid = detId.subdetId(); //subdetector type, barrel=1, fpix=2
62 
63  unsigned int layer = 0;
64  layer = tTopo->pxbLayer(detId);
65  if (detType == 1 && subid == 1 && layer == 1) {
66  numRecHits += hits.size();
67  }
68  }
69  return numRecHits;
70  }
71 
72  std::vector<std::unique_ptr<TrackingRegion> > regions(const edm::Event& ev,
73  const edm::EventSetup& es) const override {
74  int estMult = estimateMultiplicity(ev, es);
75 
76  // fit from MC information
77  float aa = 1.90935e-04;
78  float bb = -2.90167e-01;
79  float cc = 3.86125e+02;
80 
81  float estTracks = aa * estMult * estMult + bb * estMult + cc;
82 
83  LogTrace("heavyIonHLTVertexing") << "[HIVertexing]";
84  LogTrace("heavyIonHLTVertexing") << " [HIVertexing: hits in the 1. layer:" << estMult << "]";
85  LogTrace("heavyIonHLTVertexing") << " [HIVertexing: estimated number of tracks:" << estTracks << "]";
86 
87  float regTracking = 400.; //if we have more tracks -> regional tracking
88  float etaB = 10.;
89  float phiB = TMath::Pi() / 2.;
90 
91  float decEta = estTracks / 600.;
92  etaB = 2.5 / decEta;
93 
94  if (estTracks > regTracking) {
95  LogTrace("heavyIonHLTVertexing") << " [HIVertexing: Regional Tracking]";
96  LogTrace("heavyIonHLTVertexing") << " [Regional Tracking: eta range: -" << etaB << ", " << etaB << "]";
97  LogTrace("heavyIonHLTVertexing") << " [Regional Tracking: phi range: -" << phiB << ", " << phiB << "]";
98  LogTrace("heavyIonHLTVertexing") << " [Regional Tracking: factor of decrease: " << decEta * 2.
99  << "]"; // 2:from phi
100  }
101 
102  // tracking region selection
103  std::vector<std::unique_ptr<TrackingRegion> > result;
104  if (estTracks > regTracking) { // regional tracking
105  result.push_back(std::make_unique<RectangularEtaPhiTrackingRegion>(
106  theDirection,
107  theOrigin,
108  thePtMin,
111  etaB,
112  phiB,
114  thePrecise));
115  } else { // global tracking
116  LogTrace("heavyIonHLTVertexing") << " [HIVertexing: Global Tracking]";
117  result.push_back(std::make_unique<GlobalTrackingRegion>(
119  }
120  return result;
121  }
122 
123 private:
126  double thePtMin;
132 };
133 
134 #endif
const double Pi
T getParameter(std::string const &) const
int estimateMultiplicity(const edm::Event &ev, const edm::EventSetup &es) const
const_iterator end(bool update=false) const
HITrackingRegionProducer(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
edm::EDGetTokenT< SiPixelRecHitCollection > theSiPixelRecHitsToken
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
bool ev
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
#define LogTrace(id)
unsigned int pxbLayer(const DetId &id) const
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
Definition: DetId.h:17
id_type detId() const
Definition: DetSetNew.h:66
T get() const
Definition: EventSetup.h:73
size_type size() const
Definition: DetSetNew.h:68
const_iterator begin(bool update=false) const
std::vector< std::unique_ptr< TrackingRegion > > regions(const edm::Event &ev, const edm::EventSetup &es) const override
Global3DVector GlobalVector
Definition: GlobalVector.h:10
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46