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

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)
 
 ~TrackingRegionsFromSuperClustersProducer () override
 
- 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
 
void validateConfigSettings () const
 

Private Attributes

edm::EDGetTokenT< reco::BeamSpotbeamSpotToken_
 
double defaultZ_
 
double deltaEtaRegion_
 
double deltaPhiRegion_
 
edm::EDGetTokenT< MeasurementTrackerEventmeasTrackerEventToken_
 
double minBSDeltaZ_
 
double nrSigmaForBSDeltaZ_
 
double originHalfLength_
 
double originRadius_
 
bool precise_
 
double ptMin_
 
std::vector< edm::EDGetTokenT< std::vector< reco::SuperClusterRef > > > superClustersTokens_
 
bool useZInBeamspot_
 
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 151 of file TrackingRegionsFromSuperClustersProducer.h.

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

153 {
154  edm::ParameterSet regionPSet = cfg.getParameter<edm::ParameterSet>("RegionPSet");
155 
156  ptMin_ = regionPSet.getParameter<double>("ptMin");
157  originRadius_ = regionPSet.getParameter<double>("originRadius");
158  originHalfLength_ = regionPSet.getParameter<double>("originHalfLength");
159  deltaPhiRegion_ = regionPSet.getParameter<double>("deltaPhiRegion");
160  deltaEtaRegion_ = regionPSet.getParameter<double>("deltaEtaRegion");
161  useZInVertex_ = regionPSet.getParameter<bool>("useZInVertex");
162  useZInBeamspot_ = regionPSet.getParameter<bool>("useZInBeamspot");
163  nrSigmaForBSDeltaZ_ = regionPSet.getParameter<double>("nrSigmaForBSDeltaZ");
164  defaultZ_ = regionPSet.getParameter<double>("defaultZ");
165  minBSDeltaZ_ = regionPSet.getParameter<double>("minBSDeltaZ");
166  precise_ = regionPSet.getParameter<bool>("precise");
167  whereToUseMeasTracker_ = strToEnum<RectangularEtaPhiTrackingRegion::UseMeasurementTracker>(regionPSet.getParameter<std::string>("whereToUseMeasTracker"));
168 
170 
171  auto verticesTag = regionPSet.getParameter<edm::InputTag>("vertices");
172  auto beamSpotTag = regionPSet.getParameter<edm::InputTag>("beamSpot");
173  auto superClustersTags = regionPSet.getParameter<std::vector<edm::InputTag> >("superClusters");
174  auto measTrackerEventTag = regionPSet.getParameter<edm::InputTag>("measurementTrackerEvent");
175 
176  if(useZInVertex_){
177  verticesToken_ = iC.consumes<reco::VertexCollection>(verticesTag);
178  }else{
179  beamSpotToken_ = iC.consumes<reco::BeamSpot>(beamSpotTag);
180  }
182  measTrackerEventToken_ = iC.consumes<MeasurementTrackerEvent>(measTrackerEventTag);
183  }
184  for(const auto& tag : superClustersTags){
185  superClustersTokens_.emplace_back(iC.consumes<std::vector<reco::SuperClusterRef>>(tag));
186  }
187 }
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_
TrackingRegionsFromSuperClustersProducer::~TrackingRegionsFromSuperClustersProducer ( )
inlineoverride

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 286 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().

290 {
291  const GlobalPoint clusterPos(superCluster.position().x(), superCluster.position().y(), superCluster.position().z());
292  const double energy = superCluster.energy();
293 
294  FreeTrajectoryState freeTrajState = FTSFromVertexToPointFactory::get(magField, clusterPos, vtxPos, energy, static_cast<int>(charge));
295  return std::make_unique<RectangularEtaPhiTrackingRegion>(freeTrajState.momentum(),
296  vtxPos,
297  ptMin_,
299  deltaZVertex,
303  precise_,
304  measTrackerEvent);
305 }
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:131
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:126
GlobalVector momentum() const
void TrackingRegionsFromSuperClustersProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 192 of file TrackingRegionsFromSuperClustersProducer.h.

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

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

193 {
195 
196  desc.add<double>("ptMin", 1.5);
197  desc.add<double>("originRadius", 0.2);
198  desc.add<double>("originHalfLength", 15.0)->setComment("z range is +/- this value except when using the beamspot (useZInBeamspot=true)");
199  desc.add<double>("deltaPhiRegion",0.4);
200  desc.add<double>("deltaEtaRegion",0.1);
201  desc.add<bool>("useZInVertex", false)->setComment("use the leading vertex position +/-orginHalfLength, mutually exclusive with useZInBeamspot");
202  desc.add<bool>("useZInBeamspot", true)->setComment("use the beamspot position +/- nrSigmaForBSDeltaZ* sigmaZ_{bs}, mutually exclusive with useZInVertex");
203  desc.add<double>("nrSigmaForBSDeltaZ",3.0)->setComment("# of sigma to extend the z region when using the beamspot, only active if useZInBeamspot=true");
204  desc.add<double>("minBSDeltaZ",0.0)->setComment("a minimum value of the beamspot sigma z to use, only active if useZInBeamspot=true");
205  desc.add<double>("defaultZ",0.)->setComment("the default z position, only used if useZInVertex and useZInBeamspot are both false");
206  desc.add<bool>("precise", true);
207  desc.add<std::string>("whereToUseMeasTracker","kNever");
208  desc.add<edm::InputTag>("beamSpot", edm::InputTag("hltOnlineBeamSpot"))->setComment("only used if useZInBeamspot is true");
209  desc.add<edm::InputTag>("vertices", edm::InputTag())->setComment("only used if useZInVertex is true");
210  desc.add<std::vector<edm::InputTag> >("superClusters", std::vector<edm::InputTag>{edm::InputTag{"hltEgammaSuperClustersToPixelMatch"}});
211  desc.add<edm::InputTag>("measurementTrackerEvent",edm::InputTag());
212 
213  edm::ParameterSetDescription descRegion;
214  descRegion.add<edm::ParameterSetDescription>("RegionPSet", desc);
215 
216  descriptions.add("trackingRegionsFromSuperClusters", descRegion);
217 }
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 249 of file TrackingRegionsFromSuperClustersProducer.h.

References beamSpotToken_, createTrackingRegion(), defaultZ_, SiStripPI::max, minBSDeltaZ_, nrSigmaForBSDeltaZ_, originHalfLength_, MetAnalyzer::pv(), fftjetvertexadder_cfi::sigmaZ, mathSSE::sqrt(), useZInBeamspot_, useZInVertex_, and verticesToken_.

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

250 {
251  if(useZInVertex_){
252  auto verticesHandle = getHandle(iEvent,verticesToken_);
253  //we throw if the vertices are not there but if no vertex is
254  //recoed in the event, we default to 0,0,defaultZ as the vertex
255  if(!verticesHandle->empty()){
256  deltaZVertex = originHalfLength_;
257  const auto& pv = verticesHandle->front();
258  return GlobalPoint(pv.x(),pv.y(),pv.z());
259  }else{
260  deltaZVertex = originHalfLength_;
261  return GlobalPoint(0,0,defaultZ_);
262  }
263  }else{
264 
265  auto beamSpotHandle = getHandle(iEvent,beamSpotToken_);
266  const reco::BeamSpot::Point& bsPos = beamSpotHandle->position();
267 
268  if(useZInBeamspot_){
269  //as this is what has been done traditionally for e/gamma, others just use sigmaZ
270  const double bsSigmaZ = std::sqrt(beamSpotHandle->sigmaZ()*beamSpotHandle->sigmaZ() +
271  beamSpotHandle->sigmaZ0Error()*beamSpotHandle->sigmaZ0Error());
272  const double sigmaZ = std::max(bsSigmaZ,minBSDeltaZ_);
273  deltaZVertex = nrSigmaForBSDeltaZ_*sigmaZ;
274 
275  return GlobalPoint(bsPos.x(),bsPos.y(),bsPos.z());
276  }else{
277  deltaZVertex = originHalfLength_;
278  return GlobalPoint(bsPos.x(),bsPos.y(),defaultZ_);
279  }
280  }
281 
282 }
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:7
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 223 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().

224 {
225  std::vector<std::unique_ptr<TrackingRegion> > trackingRegions;
226 
227  double deltaZVertex=0;
228  GlobalPoint vtxPos = getVtxPos(iEvent,deltaZVertex);
229 
230  const MeasurementTrackerEvent *measTrackerEvent = nullptr;
232  measTrackerEvent = getHandle(iEvent,measTrackerEventToken_).product();
233  }
234  edm::ESHandle<MagneticField> magFieldHandle;
235  iSetup.get<IdealMagneticFieldRecord>().get(magFieldHandle);
236 
237  for(auto& superClustersToken : superClustersTokens_){
238  auto superClustersHandle = getHandle(iEvent,superClustersToken);
239  for(auto& superClusterRef : *superClustersHandle){
240  //do both charge hypothesises
241  trackingRegions.emplace_back(createTrackingRegion(*superClusterRef,vtxPos,deltaZVertex,Charge::POS,measTrackerEvent,*magFieldHandle));
242  trackingRegions.emplace_back(createTrackingRegion(*superClusterRef,vtxPos,deltaZVertex,Charge::NEG,measTrackerEvent,*magFieldHandle));
243  }
244  }
245  return trackingRegions;
246 }
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
edm::EDGetTokenT< MeasurementTrackerEvent > measTrackerEventToken_
T get() const
Definition: EventSetup.h:62
bool isUninitialized() const
Definition: EDGetToken.h:73
GlobalPoint getVtxPos(const edm::Event &iEvent, double &deltaZVertex) const
void TrackingRegionsFromSuperClustersProducer::validateConfigSettings ( ) const
private

Definition at line 307 of file TrackingRegionsFromSuperClustersProducer.h.

References Exception, useZInBeamspot_, and useZInVertex_.

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

308 {
310  throw cms::Exception("InvalidConfiguration") <<" when constructing TrackingRegionsFromSuperClustersProducer both useZInVertex ("<<useZInVertex_<<") and useZInBeamspot ("<<useZInBeamspot_<<") can not be true as they are mutually exclusive options"<<std::endl;
311  }
312 }

Member Data Documentation

edm::EDGetTokenT<reco::BeamSpot> TrackingRegionsFromSuperClustersProducer::beamSpotToken_
private
double TrackingRegionsFromSuperClustersProducer::defaultZ_
private
double TrackingRegionsFromSuperClustersProducer::deltaEtaRegion_
private
double TrackingRegionsFromSuperClustersProducer::deltaPhiRegion_
private
edm::EDGetTokenT<MeasurementTrackerEvent> TrackingRegionsFromSuperClustersProducer::measTrackerEventToken_
private
double TrackingRegionsFromSuperClustersProducer::minBSDeltaZ_
private
double TrackingRegionsFromSuperClustersProducer::nrSigmaForBSDeltaZ_
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::useZInBeamspot_
private
bool TrackingRegionsFromSuperClustersProducer::useZInVertex_
private
edm::EDGetTokenT<reco::VertexCollection> TrackingRegionsFromSuperClustersProducer::verticesToken_
private
RectangularEtaPhiTrackingRegion::UseMeasurementTracker TrackingRegionsFromSuperClustersProducer::whereToUseMeasTracker_
private