CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
HGCalTrackCollectionProducer Class Reference
Inheritance diagram for HGCalTrackCollectionProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 HGCalTrackCollectionProducer (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void beginLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &) override
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

edm::ESHandle< MagneticFieldbField_
 
bool debug_
 
float diskInnerRadius_
 
float diskOuterRadius_
 
const std::vector< double > DPtovPtCut_
 
std::array< std::string, 1 > hgc_names_
 
std::array< edm::ESHandle< HGCalGeometry >, 1 > hgcGeometries_
 
std::unique_ptr< PropagatorWithMaterialmat_prop_
 
std::array< std::vector< ReferenceCountingPointer< BoundDisk > >, 1 > minusSurface_
 
const std::vector< unsigned > NHitCut_
 
std::array< std::vector< ReferenceCountingPointer< BoundDisk > >, 1 > plusSurface_
 
edm::EDGetTokenT< edm::View< reco::PFRecTrack > > src_
 
edm::ESHandle< TrackerGeometrytkGeom_
 
const bool useIterTracking_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 44 of file HGCalTrackCollectionProducer.cc.

Constructor & Destructor Documentation

HGCalTrackCollectionProducer::HGCalTrackCollectionProducer ( const edm::ParameterSet iConfig)

Definition at line 75 of file HGCalTrackCollectionProducer.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterSet(), hgc_names_, LogDebug, and AlCaHLTBitMon_QueryRunRegistry::string.

75  :
77  debug_(iConfig.getParameter<bool>("debug")),
78  DPtovPtCut_(iConfig.getParameter<std::vector<double> >("DPtOverPtCuts_byTrackAlgo")),
79  NHitCut_(iConfig.getParameter<std::vector<unsigned> >("NHitCuts_byTrackAlgo")),
80  useIterTracking_(iConfig.getParameter<bool>("useIterativeTracking"))
81 {
82 
83  LogDebug("HGCalTrackCollectionProducer") << " HGCalTrackCollectionProducer::HGCalTrackCollectionProducer " << std::endl;
84 
85  const edm::ParameterSet& geoconf = iConfig.getParameterSet("hgcalGeometryNames");
86  hgc_names_[0] = geoconf.getParameter<std::string>("HGC_ECAL");
87 
88  produces<reco::PFRecTrackCollection>("TracksInHGCal");
89  produces<reco::PFRecTrackCollection>("TracksNotInHGCal");
90 
91 }
#define LogDebug(id)
T getParameter(std::string const &) const
const std::vector< unsigned > NHitCut_
std::array< std::string, 1 > hgc_names_
edm::EDGetTokenT< edm::View< reco::PFRecTrack > > src_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
ParameterSet const & getParameterSet(std::string const &) const
const std::vector< double > DPtovPtCut_

Member Function Documentation

void HGCalTrackCollectionProducer::beginLuminosityBlock ( const edm::LuminosityBlock lumi,
const edm::EventSetup es 
)
overrideprivate

Definition at line 95 of file HGCalTrackCollectionProducer.cc.

References funct::abs(), alongMomentum, bField_, constexpr, diskInnerRadius_, diskOuterRadius_, edm::EventSetup::get(), HGCalDDDConstants::getTrForms(), hgc_names_, hgcGeometries_, mps_fire::i, LogDebug, mat_prop_, minusSurface_, plusSurface_, edm::ESHandle< T >::product(), makeMuonMisalignmentScenario::rot, tkGeom_, and DOFs::Z.

95  {
96  constexpr float m_pion = 0.1396;
97  // get dependencies for setting up propagator
100  // get HGC geometries (assume that layers are ordered in Z!)
101  for( unsigned i = 0; i < hgcGeometries_.size(); ++i ) {
103  }
104 
105  // make propagator
107  // setup HGC layers for track propagation
108  Surface::RotationType rot; //unit rotation matrix
109  for( unsigned i = 0; i < hgcGeometries_.size(); ++i ) {
110  minusSurface_[i].clear();
111  plusSurface_[i].clear();
112  const HGCalDDDConstants &dddCons=hgcGeometries_[i]->topology().dddConstants();
113  std::map<float,float> zrhoCoord;
114  std::map<float,float> innerRadiusCoord;
115  auto theTrForms = dddCons.getTrForms();
116  const auto& firstLayerIt = theTrForms.back();
117  float Z(std::abs(firstLayerIt.h3v.z()));
118  // use hardcoded radii for now (FIX ME)
119  diskInnerRadius_ = 31.5;
120  diskOuterRadius_ = 161.0f;
121  LogDebug("HGCalTrackCollectionProducer") << "O HAI I'm making a bound disk with Outer R=" << diskOuterRadius_ << " Inner R=" << diskInnerRadius_ << " and Z=" << Z << std::endl;
123  new SimpleDiskBounds( diskInnerRadius_, diskOuterRadius_, -0.001, 0.001))));
125  new SimpleDiskBounds( diskInnerRadius_, diskOuterRadius_, -0.001, 0.001))));
126  }
127 }
#define LogDebug(id)
std::array< std::vector< ReferenceCountingPointer< BoundDisk > >, 1 > minusSurface_
std::array< std::string, 1 > hgc_names_
#define constexpr
std::array< std::vector< ReferenceCountingPointer< BoundDisk > >, 1 > plusSurface_
std::vector< HGCalParameters::hgtrform > getTrForms() const
std::unique_ptr< PropagatorWithMaterial > mat_prop_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::ESHandle< MagneticField > bField_
const T & get() const
Definition: EventSetup.h:56
Disk BoundDisk
Definition: BoundDisk.h:62
std::array< edm::ESHandle< HGCalGeometry >, 1 > hgcGeometries_
edm::ESHandle< TrackerGeometry > tkGeom_
T const * product() const
Definition: ESHandle.h:86
void HGCalTrackCollectionProducer::produce ( edm::Event evt,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 129 of file HGCalTrackCollectionProducer.cc.

References funct::abs(), bField_, debug_, DEFINE_FWK_MODULE, diskInnerRadius_, diskOuterRadius_, SoftLeptonByDistance_cfi::distance, DPtovPtCut_, runEdmFileComparison::found, edm::Event::getByToken(), TrajectoryStateOnSurface::globalPosition(), PFTrackAlgoTools::goodPtResolution(), mps_fire::i, TrajectoryStateOnSurface::isValid(), LogDebug, mat_prop_, minusSurface_, eostools::move(), NHitCut_, trajectoryStateTransform::outerStateOnSurface(), PV3DBase< T, PVType, FrameType >::perp(), plusSurface_, edm::ESHandle< T >::product(), EnergyCorrector::pt, edm::Event::put(), mathSSE::sqrt(), src_, tkGeom_, HiIsolationCommonParameters_cff::track, l1t::tracks, useIterTracking_, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

129  {
130 
132  evt.getByToken(src_,trackHandle);
133  const auto& tracks = *trackHandle;
134 
135  auto outputInHGCal = std::make_unique<reco::PFRecTrackCollection>();
136  auto outputNotInHGCal = std::make_unique<reco::PFRecTrackCollection>();
137 
138  for ( unsigned int i = 0 ; i < tracks.size() ; i++) {
139  const auto track = tracks.ptrAt(i);
141  LogDebug("HGCalTrackCollectionProducer") << "HGCalTrackCollectionProducer Track number " << i << " has a goodPtResolution result of " << isGood << std::endl;
142  if (!isGood) continue;
143  bool found = false;
145  auto detbegin = myTSOS.globalPosition().z() > 0 ? plusSurface_.begin() : minusSurface_.begin();
146  auto detend = myTSOS.globalPosition().z() > 0 ? plusSurface_.end() : minusSurface_.end();
147  for( auto det = detbegin; det != detend; ++det ) {
148  LogDebug("HGCalTrackCollectionProducer") << "at HGC detector: " << std::distance(detbegin,det) << std::endl;
149  unsigned layer_count = 1;
150  for( const auto& layer : *det ) {
151  LogDebug("HGCalTrackCollectionProducer") << " at DET layer: " << layer_count++ << std::endl;
152  TrajectoryStateOnSurface piStateAtSurface = mat_prop_->propagate(myTSOS, *layer);
153  if( piStateAtSurface.isValid() ) {
154  LogDebug("HGCalTrackCollectionProducer") << "Extrapolation is valid!" << std::endl;
155  GlobalPoint pt = piStateAtSurface.globalPosition();
156  if (pt.perp() < diskOuterRadius_) {
157  if (pt.perp() > diskInnerRadius_) {
158  LogDebug("HGCalTrackCollectionProducer") << "(x,y,z,r)=(" << pt.x() << ", " << pt.y() << ", " << pt.z() << ", " << sqrt(pt.x()*pt.x() + pt.y()*pt.y()) << ")" << std::endl;
159  if (std::abs(track->trackRef()->eta()) < 1.47) LogDebug("HGCalTrackCollectionProducer") << " ETA IN BARREL REGION: " << track->trackRef()->eta()
160  << " (PT: " << track->trackRef()->pt() << ")" << std::endl;
161  found = true;
162  } else {
163  LogDebug("HGCalTrackCollectionProducer") << " but r=" << pt.perp() << " < diskInnerRadius=" << diskInnerRadius_ << " so skipping " << std::endl;
164  }
165  } else {
166  LogDebug("HGCalTrackCollectionProducer") << " but r=" << pt.perp() << " > diskOuterRadius=" << diskOuterRadius_ << " so skipping " << std::endl;
167  }
168  } else {
169  LogDebug("HGCalTrackCollectionProducer") << "Extrapolation is NOT valid!" << std::endl;
170  }
171  }
172  }
173  if (found) {
174  LogDebug("HGCalTrackCollectionProducer") << " Track going to outputInHGCal pt eta " << track->trackRef()->pt() << " " << track->trackRef()->eta() << std::endl;
175  outputInHGCal->push_back(*track);
176  } else {
177  outputNotInHGCal->push_back(*track);
178  }
179  } // track loop
180 
181  evt.put(std::move(outputInHGCal),"TracksInHGCal");
182  evt.put(std::move(outputNotInHGCal),"TracksNotInHGCal");
183 }
#define LogDebug(id)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
T perp() const
Definition: PV3DBase.h:72
std::array< std::vector< ReferenceCountingPointer< BoundDisk > >, 1 > minusSurface_
TrajectoryStateOnSurface outerStateOnSurface(const reco::Track &tk, const TrackingGeometry &geom, const MagneticField *field, bool withErr=true)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
T y() const
Definition: PV3DBase.h:63
GlobalPoint globalPosition() const
const std::vector< unsigned > NHitCut_
edm::EDGetTokenT< edm::View< reco::PFRecTrack > > src_
std::array< std::vector< ReferenceCountingPointer< BoundDisk > >, 1 > plusSurface_
T sqrt(T t)
Definition: SSEVec.h:18
T z() const
Definition: PV3DBase.h:64
std::unique_ptr< PropagatorWithMaterial > mat_prop_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::ESHandle< MagneticField > bField_
const std::vector< double > DPtovPtCut_
edm::ESHandle< TrackerGeometry > tkGeom_
T x() const
Definition: PV3DBase.h:62
T const * product() const
Definition: ESHandle.h:86
bool goodPtResolution(const reco::TrackRef &, const std::vector< double > &DPtovPtCut, const std::vector< unsigned > &NHitCut, bool useIterTracking, bool debug=false)
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

edm::ESHandle<MagneticField> HGCalTrackCollectionProducer::bField_
private

Definition at line 64 of file HGCalTrackCollectionProducer.cc.

Referenced by beginLuminosityBlock(), and produce().

bool HGCalTrackCollectionProducer::debug_
private

Definition at line 57 of file HGCalTrackCollectionProducer.cc.

Referenced by produce().

float HGCalTrackCollectionProducer::diskInnerRadius_
private

Definition at line 72 of file HGCalTrackCollectionProducer.cc.

Referenced by beginLuminosityBlock(), and produce().

float HGCalTrackCollectionProducer::diskOuterRadius_
private

Definition at line 71 of file HGCalTrackCollectionProducer.cc.

Referenced by beginLuminosityBlock(), and produce().

const std::vector<double> HGCalTrackCollectionProducer::DPtovPtCut_
private

Definition at line 58 of file HGCalTrackCollectionProducer.cc.

Referenced by produce().

std::array<std::string,1> HGCalTrackCollectionProducer::hgc_names_
private
std::array<edm::ESHandle<HGCalGeometry>,1> HGCalTrackCollectionProducer::hgcGeometries_
private

Definition at line 67 of file HGCalTrackCollectionProducer.cc.

Referenced by beginLuminosityBlock().

std::unique_ptr<PropagatorWithMaterial> HGCalTrackCollectionProducer::mat_prop_
private

Definition at line 69 of file HGCalTrackCollectionProducer.cc.

Referenced by beginLuminosityBlock(), and produce().

std::array<std::vector<ReferenceCountingPointer<BoundDisk> >,1> HGCalTrackCollectionProducer::minusSurface_
private

Definition at line 68 of file HGCalTrackCollectionProducer.cc.

Referenced by beginLuminosityBlock(), and produce().

const std::vector<unsigned> HGCalTrackCollectionProducer::NHitCut_
private

Definition at line 59 of file HGCalTrackCollectionProducer.cc.

Referenced by produce().

std::array<std::vector<ReferenceCountingPointer<BoundDisk> >,1> HGCalTrackCollectionProducer::plusSurface_
private

Definition at line 68 of file HGCalTrackCollectionProducer.cc.

Referenced by beginLuminosityBlock(), and produce().

edm::EDGetTokenT<edm::View<reco::PFRecTrack> > HGCalTrackCollectionProducer::src_
private

Definition at line 53 of file HGCalTrackCollectionProducer.cc.

Referenced by produce().

edm::ESHandle<TrackerGeometry> HGCalTrackCollectionProducer::tkGeom_
private

Definition at line 65 of file HGCalTrackCollectionProducer.cc.

Referenced by beginLuminosityBlock(), and produce().

const bool HGCalTrackCollectionProducer::useIterTracking_
private

Definition at line 60 of file HGCalTrackCollectionProducer.cc.

Referenced by produce().