CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
TrackingRegionsFromSuperClustersProducer Class Reference

#include <TrackingRegionsFromSuperClustersProducer.h>

Inheritance diagram for TrackingRegionsFromSuperClustersProducer:
TrackingRegionProducer

Public Types

enum  Charge { Charge::NEG =-1, Charge::POS =+1 }
 

Public Member Functions

virtual std::vector< std::unique_ptr< TrackingRegion > > regions (const edm::Event &iEvent, const edm::EventSetup &iSetup) const override
 
 TrackingRegionsFromSuperClustersProducer (const edm::ParameterSet &cfg, edm::ConsumesCollector &&cc)
 
virtual ~TrackingRegionsFromSuperClustersProducer ()
 
- Public Member Functions inherited from TrackingRegionProducer
virtual ~TrackingRegionProducer ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

std::unique_ptr< TrackingRegioncreateTrackingRegion (const reco::SuperCluster &superCluster, const GlobalPoint &vtxPos, const double deltaZVertex, const Charge charge, const MeasurementTrackerEvent *measTrackerEvent, const MagneticField &magField) const
 
GlobalPoint getVtxPos (const edm::Event &iEvent, double &deltaZVertex) const
 

Private Attributes

edm::EDGetTokenT< reco::BeamSpotbeamSpotToken_
 
double deltaEtaRegion_
 
double deltaPhiRegion_
 
edm::EDGetTokenT< MeasurementTrackerEventmeasTrackerEventToken_
 
double originHalfLength_
 
double originRadius_
 
bool precise_
 
double ptMin_
 
std::vector< edm::EDGetTokenT< std::vector< reco::SuperClusterRef > > > superClustersTokens_
 
bool useZInVertex_
 
edm::EDGetTokenT< reco::VertexCollectionverticesToken_
 
RectangularEtaPhiTrackingRegion::UseMeasurementTracker whereToUseMeasTracker_
 

Detailed Description

Definition at line 80 of file TrackingRegionsFromSuperClustersProducer.h.

Member Enumeration Documentation

Enumerator
NEG 
POS 

Definition at line 83 of file TrackingRegionsFromSuperClustersProducer.h.

83  {
84  NEG=-1,POS=+1
85  };

Constructor & Destructor Documentation

TrackingRegionsFromSuperClustersProducer::TrackingRegionsFromSuperClustersProducer ( const edm::ParameterSet cfg,
edm::ConsumesCollector &&  cc 
)

Definition at line 139 of file TrackingRegionsFromSuperClustersProducer.h.

References AlignmentProducer_cff::beamSpotTag, beamSpotToken_, deltaEtaRegion_, deltaPhiRegion_, fillDescriptions(), edm::ParameterSet::getParameter(), RectangularEtaPhiTrackingRegion::kNever, measTrackerEventToken_, originHalfLength_, originRadius_, precise_, ptMin_, AlCaHLTBitMon_QueryRunRegistry::string, superClustersTokens_, GlobalPosition_Frontier_DevDB_cff::tag, useZInVertex_, verticesToken_, and whereToUseMeasTracker_.

141 {
142  edm::ParameterSet regionPSet = cfg.getParameter<edm::ParameterSet>("RegionPSet");
143 
144  ptMin_ = regionPSet.getParameter<double>("ptMin");
145  originRadius_ = regionPSet.getParameter<double>("originRadius");
146  originHalfLength_ = regionPSet.getParameter<double>("originHalfLength");
147  deltaPhiRegion_ = regionPSet.getParameter<double>("deltaPhiRegion");
148  deltaEtaRegion_ = regionPSet.getParameter<double>("deltaEtaRegion");
149  useZInVertex_ = regionPSet.getParameter<bool>("useZInVertex");
150  precise_ = regionPSet.getParameter<bool>("precise");
151  whereToUseMeasTracker_ = strToEnum<RectangularEtaPhiTrackingRegion::UseMeasurementTracker>(regionPSet.getParameter<std::string>("whereToUseMeasTracker"));
152 
153  auto verticesTag = regionPSet.getParameter<edm::InputTag>("vertices");
154  auto beamSpotTag = regionPSet.getParameter<edm::InputTag>("beamSpot");
155  auto superClustersTags = regionPSet.getParameter<std::vector<edm::InputTag> >("superClusters");
156  auto measTrackerEventTag = regionPSet.getParameter<edm::InputTag>("measurementTrackerEvent");
157 
158  if(useZInVertex_){
159  verticesToken_ = iC.consumes<reco::VertexCollection>(verticesTag);
160  }else{
161  beamSpotToken_ = iC.consumes<reco::BeamSpot>(beamSpotTag);
162  }
164  measTrackerEventToken_ = iC.consumes<MeasurementTrackerEvent>(measTrackerEventTag);
165  }
166  for(const auto& tag : superClustersTags){
167  superClustersTokens_.emplace_back(iC.consumes<std::vector<reco::SuperClusterRef>>(tag));
168  }
169 }
T getParameter(std::string const &) const
RectangularEtaPhiTrackingRegion::UseMeasurementTracker whereToUseMeasTracker_
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
std::vector< edm::EDGetTokenT< std::vector< reco::SuperClusterRef > > > superClustersTokens_
edm::EDGetTokenT< reco::VertexCollection > verticesToken_
edm::EDGetTokenT< MeasurementTrackerEvent > measTrackerEventToken_
virtual TrackingRegionsFromSuperClustersProducer::~TrackingRegionsFromSuperClustersProducer ( )
inlinevirtual

Member Function Documentation

std::unique_ptr< TrackingRegion > TrackingRegionsFromSuperClustersProducer::createTrackingRegion ( const reco::SuperCluster superCluster,
const GlobalPoint vtxPos,
const double  deltaZVertex,
const Charge  charge,
const MeasurementTrackerEvent measTrackerEvent,
const MagneticField magField 
) const
private

Definition at line 254 of file TrackingRegionsFromSuperClustersProducer.h.

References deltaEtaRegion_, deltaPhiRegion_, reco::CaloCluster::energy(), FTSFromVertexToPointFactory::get(), FreeTrajectoryState::momentum(), originRadius_, reco::CaloCluster::position(), precise_, ptMin_, and whereToUseMeasTracker_.

Referenced by getVtxPos(), regions(), and ~TrackingRegionsFromSuperClustersProducer().

258 {
259  const GlobalPoint clusterPos(superCluster.position().x(), superCluster.position().y(), superCluster.position().z());
260  const double energy = superCluster.energy();
261 
262  FreeTrajectoryState freeTrajState = FTSFromVertexToPointFactory::get(magField, clusterPos, vtxPos, energy, static_cast<int>(charge));
263  return std::make_unique<RectangularEtaPhiTrackingRegion>(freeTrajState.momentum(),
264  vtxPos,
265  ptMin_,
267  deltaZVertex,
271  precise_,
272  measTrackerEvent);
273 }
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:129
static FreeTrajectoryState get(MagneticField const &magField, GlobalPoint const &xmeas, GlobalPoint const &xvert, float momentum, TrackCharge charge)
RectangularEtaPhiTrackingRegion::UseMeasurementTracker whereToUseMeasTracker_
double energy() const
cluster energy
Definition: CaloCluster.h:124
GlobalVector momentum() const
void TrackingRegionsFromSuperClustersProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 174 of file TrackingRegionsFromSuperClustersProducer.h.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), regions(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by TrackingRegionsFromSuperClustersProducer(), and ~TrackingRegionsFromSuperClustersProducer().

175 {
177 
178  desc.add<double>("ptMin", 1.5);
179  desc.add<double>("originRadius", 0.2);
180  desc.add<double>("originHalfLength", 15.0);
181  desc.add<double>("deltaPhiRegion",0.4);
182  desc.add<double>("deltaEtaRegion",0.1);
183  desc.add<bool>("useZInVertex", false);
184  desc.add<bool>("precise", true);
185  desc.add<std::string>("whereToUseMeasTracker","kNever");
186  desc.add<edm::InputTag>("beamSpot", edm::InputTag("hltOnlineBeamSpot"));
187  desc.add<edm::InputTag>("vertices", edm::InputTag());
188  desc.add<std::vector<edm::InputTag> >("superClusters", std::vector<edm::InputTag>{edm::InputTag{"hltEgammaSuperClustersToPixelMatch"}});
189  desc.add<edm::InputTag>("measurementTrackerEvent",edm::InputTag());
190 
191  edm::ParameterSetDescription descRegion;
192  descRegion.add<edm::ParameterSetDescription>("RegionPSet", desc);
193 
194  descriptions.add("trackingRegionsFromSuperClusters", descRegion);
195 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
GlobalPoint TrackingRegionsFromSuperClustersProducer::getVtxPos ( const edm::Event iEvent,
double &  deltaZVertex 
) const
private

Definition at line 227 of file TrackingRegionsFromSuperClustersProducer.h.

References beamSpotToken_, createTrackingRegion(), originHalfLength_, MetAnalyzer::pv(), fftjetvertexadder_cfi::sigmaZ, mathSSE::sqrt(), useZInVertex_, and verticesToken_.

Referenced by regions(), and ~TrackingRegionsFromSuperClustersProducer().

228 {
229  if(useZInVertex_){
230  auto verticesHandle = getHandle(iEvent,verticesToken_);
231  if(!verticesHandle->empty()){
232  deltaZVertex = originHalfLength_;
233  const auto& pv = verticesHandle->front();
234  return GlobalPoint(pv.x(),pv.y(),pv.z());
235  }
236  }
237 
238  //if the vertex collection is empty or we dont want to use the z in the vertex
239  //we fall back to beamspot mode
240  auto beamSpotHandle = getHandle(iEvent,beamSpotToken_);
241  const reco::BeamSpot::Point& bsPos = beamSpotHandle->position();
242  //SH: this is what SeedFilter did, no idea what its trying to achieve....
243  const double sigmaZ = beamSpotHandle->sigmaZ();
244  const double sigmaZ0Error = beamSpotHandle->sigmaZ0Error();
245  deltaZVertex = 3*std::sqrt(sigmaZ*sigmaZ+sigmaZ0Error*sigmaZ0Error);
246  // std::cout <<"z "<<bsPos.z()<<" deltaZ "<<deltaZVertex<<std::endl;
247  //deltaZVertex = 30.;
248  return GlobalPoint(bsPos.x(),bsPos.y(),bsPos.z());
249  //return GlobalPoint(bsPos.x(),bsPos.y(),0);
250 }
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
math::XYZPoint Point
point in the space
Definition: BeamSpot.h:29
T sqrt(T t)
Definition: SSEVec.h:18
def pv(vc)
Definition: MetAnalyzer.py:6
edm::EDGetTokenT< reco::VertexCollection > verticesToken_
std::vector< std::unique_ptr< TrackingRegion > > TrackingRegionsFromSuperClustersProducer::regions ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overridevirtual

Implements TrackingRegionProducer.

Definition at line 201 of file TrackingRegionsFromSuperClustersProducer.h.

References createTrackingRegion(), edm::EventSetup::get(), getVtxPos(), edm::EDGetTokenT< T >::isUninitialized(), measTrackerEventToken_, NEG, POS, superClustersTokens_, and HiRegitMuonDetachedTripletStep_cff::trackingRegions.

Referenced by fillDescriptions(), and ~TrackingRegionsFromSuperClustersProducer().

202 {
203  std::vector<std::unique_ptr<TrackingRegion> > trackingRegions;
204 
205  double deltaZVertex=0;
206  GlobalPoint vtxPos = getVtxPos(iEvent,deltaZVertex);
207 
208  const MeasurementTrackerEvent *measTrackerEvent = nullptr;
210  measTrackerEvent = getHandle(iEvent,measTrackerEventToken_).product();
211  }
212  edm::ESHandle<MagneticField> magFieldHandle;
213  iSetup.get<IdealMagneticFieldRecord>().get(magFieldHandle);
214 
215  for(auto& superClustersToken : superClustersTokens_){
216  auto superClustersHandle = getHandle(iEvent,superClustersToken);
217  for(auto& superClusterRef : *superClustersHandle){
218  //do both charge hypothesises
219  trackingRegions.emplace_back(createTrackingRegion(*superClusterRef,vtxPos,deltaZVertex,Charge::POS,measTrackerEvent,*magFieldHandle));
220  trackingRegions.emplace_back(createTrackingRegion(*superClusterRef,vtxPos,deltaZVertex,Charge::NEG,measTrackerEvent,*magFieldHandle));
221  }
222  }
223  return trackingRegions;
224 }
std::vector< edm::EDGetTokenT< std::vector< reco::SuperClusterRef > > > superClustersTokens_
std::unique_ptr< TrackingRegion > createTrackingRegion(const reco::SuperCluster &superCluster, const GlobalPoint &vtxPos, const double deltaZVertex, const Charge charge, const MeasurementTrackerEvent *measTrackerEvent, const MagneticField &magField) const
const T & get() const
Definition: EventSetup.h:56
edm::EDGetTokenT< MeasurementTrackerEvent > measTrackerEventToken_
bool isUninitialized() const
Definition: EDGetToken.h:73
GlobalPoint getVtxPos(const edm::Event &iEvent, double &deltaZVertex) const

Member Data Documentation

edm::EDGetTokenT<reco::BeamSpot> TrackingRegionsFromSuperClustersProducer::beamSpotToken_
private
double TrackingRegionsFromSuperClustersProducer::deltaEtaRegion_
private
double TrackingRegionsFromSuperClustersProducer::deltaPhiRegion_
private
edm::EDGetTokenT<MeasurementTrackerEvent> TrackingRegionsFromSuperClustersProducer::measTrackerEventToken_
private
double TrackingRegionsFromSuperClustersProducer::originHalfLength_
private
double TrackingRegionsFromSuperClustersProducer::originRadius_
private
bool TrackingRegionsFromSuperClustersProducer::precise_
private
double TrackingRegionsFromSuperClustersProducer::ptMin_
private
std::vector<edm::EDGetTokenT<std::vector<reco::SuperClusterRef> > > TrackingRegionsFromSuperClustersProducer::superClustersTokens_
private
bool TrackingRegionsFromSuperClustersProducer::useZInVertex_
private
edm::EDGetTokenT<reco::VertexCollection> TrackingRegionsFromSuperClustersProducer::verticesToken_
private
RectangularEtaPhiTrackingRegion::UseMeasurementTracker TrackingRegionsFromSuperClustersProducer::whereToUseMeasTracker_
private