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<>

Public Member Functions

 HGCalTrackCollectionProducer (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

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_
 
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 reco::TrackBase::TrackQuality trackQuality_
 
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
 

Detailed Description

Definition at line 43 of file HGCalTrackCollectionProducer.cc.

Constructor & Destructor Documentation

◆ HGCalTrackCollectionProducer()

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

Definition at line 75 of file HGCalTrackCollectionProducer.cc.

76  : src_(consumes<edm::View<reco::PFRecTrack> >(iConfig.getParameter<edm::InputTag>("src"))),
77  trackQuality_((iConfig.existsAs<std::string>("trackQuality"))
78  ? reco::TrackBase::qualityByName(iConfig.getParameter<std::string>("trackQuality"))
80  DPtovPtCut_(iConfig.getParameter<std::vector<double> >("DPtOverPtCuts_byTrackAlgo")),
81  NHitCut_(iConfig.getParameter<std::vector<unsigned> >("NHitCuts_byTrackAlgo")),
82  useIterTracking_(iConfig.getParameter<bool>("useIterativeTracking")) {
83  LogDebug("HGCalTrackCollectionProducer")
84  << " HGCalTrackCollectionProducer::HGCalTrackCollectionProducer " << std::endl;
85 
86  const edm::ParameterSet& geoconf = iConfig.getParameterSet("hgcalGeometryNames");
87  hgc_names_[0] = geoconf.getParameter<std::string>("HGC_ECAL");
88 
89  produces<reco::PFRecTrackCollection>("TracksInHGCal");
90  produces<reco::PFRecTrackCollection>("TracksNotInHGCal");
91 }

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

Member Function Documentation

◆ beginLuminosityBlock()

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

Definition at line 95 of file HGCalTrackCollectionProducer.cc.

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_
122  << " Inner R=" << diskInnerRadius_ << " and Z=" << Z << std::endl;
127  }
128 }

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

◆ produce()

void HGCalTrackCollectionProducer::produce ( edm::Event evt,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 130 of file HGCalTrackCollectionProducer.cc.

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);
140  bool isGood =
142  LogDebug("HGCalTrackCollectionProducer") << "HGCalTrackCollectionProducer Track number " << i
143  << " has a goodPtResolution result of " << isGood << std::endl;
144  if (!isGood)
145  continue;
146  bool found = false;
147  const TrajectoryStateOnSurface myTSOS =
149  auto detbegin = myTSOS.globalPosition().z() > 0 ? plusSurface_.begin() : minusSurface_.begin();
150  auto detend = myTSOS.globalPosition().z() > 0 ? plusSurface_.end() : minusSurface_.end();
151  for (auto det = detbegin; det != detend; ++det) {
152  LogDebug("HGCalTrackCollectionProducer") << "at HGC detector: " << std::distance(detbegin, det) << std::endl;
153  unsigned layer_count = 1;
154  for (const auto& layer : *det) {
155  LogDebug("HGCalTrackCollectionProducer") << " at DET layer: " << layer_count++ << std::endl;
156  TrajectoryStateOnSurface piStateAtSurface = mat_prop_->propagate(myTSOS, *layer);
157  if (piStateAtSurface.isValid()) {
158  LogDebug("HGCalTrackCollectionProducer") << "Extrapolation is valid!" << std::endl;
159  GlobalPoint pt = piStateAtSurface.globalPosition();
160  if (pt.perp() < diskOuterRadius_) {
161  if (pt.perp() > diskInnerRadius_) {
162  LogDebug("HGCalTrackCollectionProducer")
163  << "(x,y,z,r)=(" << pt.x() << ", " << pt.y() << ", " << pt.z() << ", "
164  << sqrt(pt.x() * pt.x() + pt.y() * pt.y()) << ")" << std::endl;
165  if (std::abs(track->trackRef()->eta()) < 1.47)
166  LogDebug("HGCalTrackCollectionProducer") << " ETA IN BARREL REGION: " << track->trackRef()->eta()
167  << " (PT: " << track->trackRef()->pt() << ")" << std::endl;
168  found = true;
169  } else {
170  LogDebug("HGCalTrackCollectionProducer")
171  << " but r=" << pt.perp() << " < diskInnerRadius=" << diskInnerRadius_ << " so skipping "
172  << std::endl;
173  }
174  } else {
175  LogDebug("HGCalTrackCollectionProducer")
176  << " but r=" << pt.perp() << " > diskOuterRadius=" << diskOuterRadius_ << " so skipping " << std::endl;
177  }
178  } else {
179  LogDebug("HGCalTrackCollectionProducer") << "Extrapolation is NOT valid!" << std::endl;
180  }
181  }
182  }
183  if (found) {
184  LogDebug("HGCalTrackCollectionProducer") << " Track going to outputInHGCal pt eta " << track->trackRef()->pt()
185  << " " << track->trackRef()->eta() << std::endl;
186  outputInHGCal->push_back(*track);
187  } else {
188  outputNotInHGCal->push_back(*track);
189  }
190  } // track loop
191 
192  evt.put(std::move(outputInHGCal), "TracksInHGCal");
193  evt.put(std::move(outputNotInHGCal), "TracksNotInHGCal");
194 }

References funct::abs(), bField_, diskInnerRadius_, diskOuterRadius_, HLT_2018_cff::distance, DPtovPtCut_, newFWLiteAna::found, edm::Event::getByToken(), TrajectoryStateOnSurface::globalPosition(), PFTrackAlgoTools::goodPtResolution(), mps_fire::i, TrajectoryStateOnSurface::isValid(), LogDebug, mat_prop_, minusSurface_, eostools::move(), NHitCut_, trajectoryStateTransform::outerStateOnSurface(), plusSurface_, edm::ESHandle< T >::product(), DiDispStaMuonMonitor_cfi::pt, edm::Event::put(), mathSSE::sqrt(), src_, tkGeom_, HLT_2018_cff::track, trackQuality_, PDWG_EXOHSCP_cff::tracks, useIterTracking_, and PV3DBase< T, PVType, FrameType >::z().

Member Data Documentation

◆ bField_

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

Definition at line 63 of file HGCalTrackCollectionProducer.cc.

Referenced by beginLuminosityBlock(), and produce().

◆ diskInnerRadius_

float HGCalTrackCollectionProducer::diskInnerRadius_
private

Definition at line 72 of file HGCalTrackCollectionProducer.cc.

Referenced by beginLuminosityBlock(), and produce().

◆ diskOuterRadius_

float HGCalTrackCollectionProducer::diskOuterRadius_
private

Definition at line 71 of file HGCalTrackCollectionProducer.cc.

Referenced by beginLuminosityBlock(), and produce().

◆ DPtovPtCut_

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

Definition at line 57 of file HGCalTrackCollectionProducer.cc.

Referenced by produce().

◆ hgc_names_

std::array<std::string, 1> HGCalTrackCollectionProducer::hgc_names_
private

◆ hgcGeometries_

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

Definition at line 66 of file HGCalTrackCollectionProducer.cc.

Referenced by beginLuminosityBlock().

◆ mat_prop_

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

Definition at line 69 of file HGCalTrackCollectionProducer.cc.

Referenced by beginLuminosityBlock(), and produce().

◆ minusSurface_

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

Definition at line 67 of file HGCalTrackCollectionProducer.cc.

Referenced by beginLuminosityBlock(), and produce().

◆ NHitCut_

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

Definition at line 58 of file HGCalTrackCollectionProducer.cc.

Referenced by produce().

◆ plusSurface_

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

Definition at line 67 of file HGCalTrackCollectionProducer.cc.

Referenced by beginLuminosityBlock(), and produce().

◆ src_

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

Definition at line 51 of file HGCalTrackCollectionProducer.cc.

Referenced by produce().

◆ tkGeom_

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

Definition at line 64 of file HGCalTrackCollectionProducer.cc.

Referenced by beginLuminosityBlock(), and produce().

◆ trackQuality_

const reco::TrackBase::TrackQuality HGCalTrackCollectionProducer::trackQuality_
private

Definition at line 56 of file HGCalTrackCollectionProducer.cc.

Referenced by produce().

◆ useIterTracking_

const bool HGCalTrackCollectionProducer::useIterTracking_
private

Definition at line 59 of file HGCalTrackCollectionProducer.cc.

Referenced by produce().

HGCalTrackCollectionProducer::bField_
edm::ESHandle< MagneticField > bField_
Definition: HGCalTrackCollectionProducer.cc:63
HGCalTrackCollectionProducer::src_
edm::EDGetTokenT< edm::View< reco::PFRecTrack > > src_
Definition: HGCalTrackCollectionProducer.cc:51
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
TkRotation< float >
PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
mps_fire.i
i
Definition: mps_fire.py:355
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
HGCalTrackCollectionProducer::diskOuterRadius_
float diskOuterRadius_
Definition: HGCalTrackCollectionProducer.cc:71
TrajectoryStateOnSurface::globalPosition
GlobalPoint globalPosition() const
Definition: TrajectoryStateOnSurface.h:65
HGCalTrackCollectionProducer::diskInnerRadius_
float diskInnerRadius_
Definition: HGCalTrackCollectionProducer.cc:72
HLT_2018_cff.distance
distance
Definition: HLT_2018_cff.py:6417
HGCalTrackCollectionProducer::useIterTracking_
const bool useIterTracking_
Definition: HGCalTrackCollectionProducer.cc:59
ReferenceCountingPointer< BoundDisk >
HGCalTrackCollectionProducer::tkGeom_
edm::ESHandle< TrackerGeometry > tkGeom_
Definition: HGCalTrackCollectionProducer.cc:64
edm::ParameterSet::existsAs
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:160
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
edm::Handle
Definition: AssociativeIterator.h:50
HGCalTrackCollectionProducer::DPtovPtCut_
const std::vector< double > DPtovPtCut_
Definition: HGCalTrackCollectionProducer.cc:57
HGCalDDDConstants
Definition: HGCalDDDConstants.h:25
trajectoryStateTransform::outerStateOnSurface
TrajectoryStateOnSurface outerStateOnSurface(const reco::Track &tk, const TrackingGeometry &geom, const MagneticField *field, bool withErr=true)
Definition: TrajectoryStateTransform.cc:118
HGCalTrackCollectionProducer::hgc_names_
std::array< std::string, 1 > hgc_names_
Definition: HGCalTrackCollectionProducer.cc:65
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
IdealMagneticFieldRecord
Definition: IdealMagneticFieldRecord.h:11
SimpleDiskBounds
Definition: SimpleDiskBounds.h:11
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
PropagatorWithMaterial
Definition: PropagatorWithMaterial.h:25
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
TrackerDigiGeometryRecord
Definition: TrackerDigiGeometryRecord.h:15
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
HGCalTrackCollectionProducer::mat_prop_
std::unique_ptr< PropagatorWithMaterial > mat_prop_
Definition: HGCalTrackCollectionProducer.cc:69
HGCalTrackCollectionProducer::NHitCut_
const std::vector< unsigned > NHitCut_
Definition: HGCalTrackCollectionProducer.cc:58
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
Point3DBase< float, GlobalTag >
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::View
Definition: CaloClusterFwd.h:14
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
edm::ParameterSet
Definition: ParameterSet.h:36
DOFs::Z
Definition: AlignPCLThresholdsWriter.cc:37
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:132
HGCalDDDConstants::getTrForms
std::vector< HGCalParameters::hgtrform > getTrForms() const
Definition: HGCalDDDConstants.cc:420
HGCalTrackCollectionProducer::minusSurface_
std::array< std::vector< ReferenceCountingPointer< BoundDisk > >, 1 > minusSurface_
Definition: HGCalTrackCollectionProducer.cc:67
get
#define get
PFTrackAlgoTools::goodPtResolution
bool goodPtResolution(const reco::TrackRef &, const std::vector< double > &DPtovPtCut, const std::vector< unsigned > &NHitCut, bool useIterTracking, const reco::TrackBase::TrackQuality trackQuality)
Definition: PFTrackAlgoTools.cc:236
HGCalTrackCollectionProducer::trackQuality_
const reco::TrackBase::TrackQuality trackQuality_
Definition: HGCalTrackCollectionProducer.cc:56
HGCalTrackCollectionProducer::hgcGeometries_
std::array< edm::ESHandle< HGCalGeometry >, 1 > hgcGeometries_
Definition: HGCalTrackCollectionProducer.cc:66
reco::TrackBase::qualityByName
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:126
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
HGCalTrackCollectionProducer::plusSurface_
std::array< std::vector< ReferenceCountingPointer< BoundDisk > >, 1 > plusSurface_
Definition: HGCalTrackCollectionProducer.cc:67
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
BoundDisk
Disk BoundDisk
Definition: BoundDisk.h:54
edm::InputTag
Definition: InputTag.h:15
alongMomentum
Definition: PropagationDirection.h:4
IdealGeometryRecord
Definition: IdealGeometryRecord.h:27
edm::ParameterSet::getParameterSet
ParameterSet const & getParameterSet(std::string const &) const
Definition: ParameterSet.cc:2121
TrajectoryStateOnSurface::isValid
bool isValid() const
Definition: TrajectoryStateOnSurface.h:54
reco::TrackBase::highPurity
Definition: TrackBase.h:154