test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HITrackingRegionForPrimaryVtxProducer.h
Go to the documentation of this file.
1 #ifndef RecoHI_HiTracking_HITrackingRegionForPrimaryVtxProducer_H
2 #define RecoHI_HiTracking_HITrackingRegionForPrimaryVtxProducer _H
3 
5 
12 
15 
18 
22 
25 
26 #include "TMath.h"
27 
29 
30  public:
31 
33 
34  edm::ParameterSet regionPSet = cfg.getParameter<edm::ParameterSet>("RegionPSet");
35  thePtMin = regionPSet.getParameter<double>("ptMin");
36  theOriginRadius = regionPSet.getParameter<double>("originRadius");
37  theNSigmaZ = regionPSet.getParameter<double>("nSigmaZ");
38  theBeamSpotTag = regionPSet.getParameter<edm::InputTag>("beamSpot");
40  thePrecise = regionPSet.getParameter<bool>("precise");
41  theSiPixelRecHits = regionPSet.getParameter<edm::InputTag>("siPixelRecHits");
43  doVariablePtMin = regionPSet.getParameter<bool>("doVariablePtMin");
44  double xDir = regionPSet.getParameter<double>("directionXCoord");
45  double yDir = regionPSet.getParameter<double>("directionYCoord");
46  double zDir = regionPSet.getParameter<double>("directionZCoord");
47  theDirection = GlobalVector(xDir, yDir, zDir);
48 
49  // for using vertex instead of beamspot
50  theSigmaZVertex = regionPSet.getParameter<double>("sigmaZVertex");
51  theFixedError = regionPSet.getParameter<double>("fixedError");
52  theUseFoundVertices = regionPSet.getParameter<bool>("useFoundVertices");
53  theUseFixedError = regionPSet.getParameter<bool>("useFixedError");
54  vertexCollName = regionPSet.getParameter<edm::InputTag>("VertexCollection");
56  }
57 
59 
61  (const edm::Event& ev, const edm::EventSetup& es) const
62  {
63  //rechits
65  ev.getByToken(theSiPixelRecHitsToken, recHitColl);
66 
68  es.get<TrackerTopologyRcd>().get(httopo);
69 
70  std::vector<const TrackingRecHit*> theChosenHits;
71  edmNew::copyDetSetRange(*recHitColl,theChosenHits, httopo->pxbDetIdLayerComparator(1));
72  return theChosenHits.size();
73 
74  }
75 
76  virtual std::vector<std::unique_ptr<TrackingRegion> > regions(const edm::Event& ev, const edm::EventSetup& es) const {
77 
78  int estMult = estimateMultiplicity(ev, es);
79 
80  // from MC relating first layer pixel hits to "findable" sim tracks with pt>1 GeV
81  float cc = -38.6447;
82  float bb = 0.0581765;
83  float aa = 1.34306e-06;
84 
85  float estTracks = aa*estMult*estMult+bb*estMult+cc;
86 
87  LogTrace("heavyIonHLTVertexing")<<"[HIVertexing]";
88  LogTrace("heavyIonHLTVertexing")<<" [HIVertexing: hits in the 1. layer:" << estMult << "]";
89  LogTrace("heavyIonHLTVertexing")<<" [HIVertexing: estimated number of tracks:" << estTracks << "]";
90 
91  float regTracking = 60.; //if we have more tracks -> regional tracking
92  float etaB = 10.;
93  float phiB = TMath::Pi()/2.;
94 
95  float decEta = estTracks/90.;
96  etaB = 2.5/decEta;
97 
98  if(estTracks>regTracking) {
99  LogTrace("heavyIonHLTVertexing")<<" [HIVertexing: Regional Tracking]";
100  LogTrace("heavyIonHLTVertexing")<<" [Regional Tracking: eta range: -" << etaB << ", "<< etaB <<"]";
101  LogTrace("heavyIonHLTVertexing")<<" [Regional Tracking: phi range: -" << phiB << ", "<< phiB <<"]";
102  LogTrace("heavyIonHLTVertexing")<<" [Regional Tracking: factor of decrease: " << decEta*2. << "]"; // 2:from phi
103  }
104 
105  float minpt = thePtMin;
106  float varPtCutoff = 1500; //cutoff
107  if(doVariablePtMin && estMult < varPtCutoff) {
108  minpt = 0.075;
109  if(estMult > 0) minpt += estMult * (thePtMin - 0.075)/varPtCutoff; // lower ptMin linearly with pixel hit multiplicity
110  }
111 
112  // tracking region selection
113  std::vector<std::unique_ptr<TrackingRegion> > result;
114  double halflength;
115  GlobalPoint origin;
117  ev.getByToken(theBeamSpotToken, bsHandle);
118  if(bsHandle.isValid()) {
119  const reco::BeamSpot & bs = *bsHandle;
120  origin=GlobalPoint(bs.x0(), bs.y0(), bs.z0());
121  halflength=theNSigmaZ*bs.sigmaZ();
122 
124  {
126  ev.getByToken(vertexCollToken,vertexCollection);
127 
128  for(reco::VertexCollection::const_iterator iV=vertexCollection->begin();
129  iV != vertexCollection->end() ; iV++) {
130  if (iV->isFake() || !iV->isValid()) continue;
131  origin = GlobalPoint(bs.x0(),bs.y0(),iV->z());
132  halflength = (theUseFixedError ? theFixedError : (iV->zError())*theSigmaZVertex);
133  }
134  }
135 
136  if(estTracks>regTracking) { // regional tracking
137  result.push_back(
138  std::make_unique<RectangularEtaPhiTrackingRegion>(theDirection, origin, thePtMin, theOriginRadius, halflength, etaB, phiB, RectangularEtaPhiTrackingRegion::UseMeasurementTracker::kNever, thePrecise) );
139  }
140  else { // global tracking
141  LogTrace("heavyIonHLTVertexing")<<" [HIVertexing: Global Tracking]";
142  result.push_back(
143  std::make_unique<GlobalTrackingRegion>(minpt, origin, theOriginRadius, halflength, thePrecise) );
144  }
145  }
146  return result;
147  }
148 
149  private:
150  double thePtMin;
152  double theNSigmaZ;
160 
162  double theFixedError;
167 
168 
169 };
170 
171 #endif
const double Pi
T getParameter(std::string const &) const
double z0() const
z coordinate
Definition: BeamSpot.h:68
void copyDetSetRange(DSTV const &dstv, std::vector< T const * > &v, std::pair< A, B > const &sel)
tuple cfg
Definition: looper.py:293
edm::EDGetTokenT< SiPixelRecHitCollection > theSiPixelRecHitsToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
bool ev
tuple vertexCollection
tuple result
Definition: query.py:137
virtual std::vector< std::unique_ptr< TrackingRegion > > regions(const edm::Event &ev, const edm::EventSetup &es) const
bool isValid() const
Definition: HandleBase.h:75
#define LogTrace(id)
HITrackingRegionForPrimaryVtxProducer(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
const T & get() const
Definition: EventSetup.h:56
double sigmaZ() const
sigma z
Definition: BeamSpot.h:80
edm::EDGetTokenT< reco::VertexCollection > vertexCollToken
double y0() const
y coordinate
Definition: BeamSpot.h:66
int estimateMultiplicity(const edm::Event &ev, const edm::EventSetup &es) const
Global3DVector GlobalVector
Definition: GlobalVector.h:10
double x0() const
x coordinate
Definition: BeamSpot.h:64