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 
11 
14 
17 
20 
23 
24 #include "TMath.h"
25 
27 
28  public:
29 
31 
32  edm::ParameterSet regionPSet = cfg.getParameter<edm::ParameterSet>("RegionPSet");
33  thePtMin = regionPSet.getParameter<double>("ptMin");
34  theOriginRadius = regionPSet.getParameter<double>("originRadius");
35  theNSigmaZ = regionPSet.getParameter<double>("nSigmaZ");
36  theBeamSpotTag = regionPSet.getParameter<edm::InputTag>("beamSpot");
37  thePrecise = regionPSet.getParameter<bool>("precise");
38  theSiPixelRecHits = regionPSet.getParameter<edm::InputTag>("siPixelRecHits");
39  doVariablePtMin = regionPSet.getParameter<bool>("doVariablePtMin");
40  double xDir = regionPSet.getParameter<double>("directionXCoord");
41  double yDir = regionPSet.getParameter<double>("directionYCoord");
42  double zDir = regionPSet.getParameter<double>("directionZCoord");
43  theDirection = GlobalVector(xDir, yDir, zDir);
44 
45  // for using vertex instead of beamspot
46  theSigmaZVertex = regionPSet.getParameter<double>("sigmaZVertex");
47  theFixedError = regionPSet.getParameter<double>("fixedError");
48  theUseFoundVertices = regionPSet.getParameter<bool>("useFoundVertices");
49  theUseFixedError = regionPSet.getParameter<bool>("useFixedError");
50  vertexCollName = regionPSet.getParameter<edm::InputTag>("VertexCollection");
51  }
52 
54 
56  (const edm::Event& ev, const edm::EventSetup& es) const
57  {
58  //rechits
60  ev.getByLabel(theSiPixelRecHits, recHitColl);
61 
62  std::vector<const TrackingRecHit*> theChosenHits;
64  edmNew::copyDetSetRange(*recHitColl,theChosenHits,acc.pixelBarrelLayer(1));
65  return theChosenHits.size();
66 
67  }
68 
69  virtual std::vector<TrackingRegion* > regions(const edm::Event& ev, const edm::EventSetup& es) const {
70 
71  int estMult = estimateMultiplicity(ev, es);
72 
73  // from MC relating first layer pixel hits to "findable" sim tracks with pt>1 GeV
74  float cc = -38.6447;
75  float bb = 0.0581765;
76  float aa = 1.34306e-06;
77 
78  float estTracks = aa*estMult*estMult+bb*estMult+cc;
79 
80  LogTrace("heavyIonHLTVertexing")<<"[HIVertexing]";
81  LogTrace("heavyIonHLTVertexing")<<" [HIVertexing: hits in the 1. layer:" << estMult << "]";
82  LogTrace("heavyIonHLTVertexing")<<" [HIVertexing: estimated number of tracks:" << estTracks << "]";
83 
84  float regTracking = 60.; //if we have more tracks -> regional tracking
85  float etaB = 10.;
86  float phiB = TMath::Pi()/2.;
87 
88  float decEta = estTracks/90.;
89  etaB = 2.5/decEta;
90 
91  if(estTracks>regTracking) {
92  LogTrace("heavyIonHLTVertexing")<<" [HIVertexing: Regional Tracking]";
93  LogTrace("heavyIonHLTVertexing")<<" [Regional Tracking: eta range: -" << etaB << ", "<< etaB <<"]";
94  LogTrace("heavyIonHLTVertexing")<<" [Regional Tracking: phi range: -" << phiB << ", "<< phiB <<"]";
95  LogTrace("heavyIonHLTVertexing")<<" [Regional Tracking: factor of decrease: " << decEta*2. << "]"; // 2:from phi
96  }
97 
98  float minpt = thePtMin;
99  float varPtCutoff = 1500; //cutoff
100  if(doVariablePtMin && estMult < varPtCutoff) {
101  minpt = 0.075;
102  if(estMult > 0) minpt += estMult * (thePtMin - 0.075)/varPtCutoff; // lower ptMin linearly with pixel hit multiplicity
103  }
104 
105  // tracking region selection
106  std::vector<TrackingRegion* > result;
107  double halflength;
108  GlobalPoint origin;
110  ev.getByLabel( theBeamSpotTag, bsHandle);
111  if(bsHandle.isValid()) {
112  const reco::BeamSpot & bs = *bsHandle;
113  origin=GlobalPoint(bs.x0(), bs.y0(), bs.z0());
114  halflength=theNSigmaZ*bs.sigmaZ();
115 
117  {
119  ev.getByLabel(vertexCollName,vertexCollection);
120 
121  for(reco::VertexCollection::const_iterator iV=vertexCollection->begin();
122  iV != vertexCollection->end() ; iV++) {
123  if (iV->isFake() || !iV->isValid()) continue;
124  origin = GlobalPoint(bs.x0(),bs.y0(),iV->z());
125  halflength = (theUseFixedError ? theFixedError : (iV->zError())*theSigmaZVertex);
126  }
127  }
128 
129  if(estTracks>regTracking) { // regional tracking
130  result.push_back(
131  new RectangularEtaPhiTrackingRegion(theDirection, origin, thePtMin, theOriginRadius, halflength, etaB, phiB, 0, thePrecise) );
132  }
133  else { // global tracking
134  LogTrace("heavyIonHLTVertexing")<<" [HIVertexing: Global Tracking]";
135  result.push_back(
136  new GlobalTrackingRegion(minpt, origin, theOriginRadius, halflength, thePrecise) );
137  }
138  }
139  return result;
140  }
141 
142  private:
143  double thePtMin;
145  double theNSigmaZ;
151 
153  double theFixedError;
157 
158 
159 };
160 
161 #endif
const double Pi
T getParameter(std::string const &) const
double z0() const
z coordinate
Definition: BeamSpot.h:69
void copyDetSetRange(DSTV const &dstv, std::vector< T const * > &v, std::pair< A, B > const &sel)
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
tuple vertexCollection
virtual std::vector< TrackingRegion * > regions(const edm::Event &ev, const edm::EventSetup &es) const
tuple result
Definition: query.py:137
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
#define LogTrace(id)
double sigmaZ() const
sigma z
Definition: BeamSpot.h:81
std::pair< DetId, DetIdPXBSameLayerComparator > pixelBarrelLayer(int layer)
double y0() const
y coordinate
Definition: BeamSpot.h:67
int estimateMultiplicity(const edm::Event &ev, const edm::EventSetup &es) const
HITrackingRegionForPrimaryVtxProducer(const edm::ParameterSet &cfg)
Global3DVector GlobalVector
Definition: GlobalVector.h:10
double x0() const
x coordinate
Definition: BeamSpot.h:65