CMS 3D CMS Logo

List of all members | Public Member Functions | Static 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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

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

Private Attributes

const MagneticFieldbField_
 
float diskInnerRadius_
 
float diskOuterRadius_
 
const std::vector< double > DPtovPtCut_
 
std::array< std::string, 1 > hgc_names_
 
std::array< const HGCalGeometry *, 1 > hgcGeometries_
 
std::array< edm::ESGetToken< HGCalGeometry, IdealGeometryRecord >, 1 > hgcGeometryTokens_
 
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecordmagneticFieldToken_
 
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_
 
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordtkerGeomToken_
 
const TrackerGeometrytkGeom_
 
const reco::TrackBase::TrackQuality trackQuality_
 
const bool useIterTracking_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 39 of file HGCalTrackCollectionProducer.cc.

Constructor & Destructor Documentation

◆ HGCalTrackCollectionProducer()

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

Definition at line 89 of file HGCalTrackCollectionProducer.cc.

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

90  : src_(consumes<edm::View<reco::PFRecTrack>>(iConfig.getParameter<edm::InputTag>("src"))),
92  DPtovPtCut_(iConfig.getParameter<std::vector<double>>("DPtOverPtCuts_byTrackAlgo")),
93  NHitCut_(iConfig.getParameter<std::vector<unsigned>>("NHitCuts_byTrackAlgo")),
94  useIterTracking_(iConfig.getParameter<bool>("useIterativeTracking")),
95  magneticFieldToken_(esConsumes<edm::Transition::BeginLuminosityBlock>()),
96  tkerGeomToken_(esConsumes<edm::Transition::BeginLuminosityBlock>()) {
97  LogDebug("HGCalTrackCollectionProducer")
98  << " HGCalTrackCollectionProducer::HGCalTrackCollectionProducer " << std::endl;
99 
100  const edm::ParameterSet& geoconf = iConfig.getParameterSet("hgcalGeometryNames");
101  hgc_names_[0] = geoconf.getParameter<std::string>("HGC_ECAL");
102  for (unsigned i = 0; i < hgcGeometryTokens_.size(); i++) {
103  hgcGeometryTokens_[i] = esConsumes<edm::Transition::BeginLuminosityBlock>(edm::ESInputTag("", hgc_names_[i]));
104  }
105 
106  produces<reco::PFRecTrackCollection>("TracksInHGCal");
107  produces<reco::PFRecTrackCollection>("TracksNotInHGCal");
108 }
std::array< edm::ESGetToken< HGCalGeometry, IdealGeometryRecord >, 1 > hgcGeometryTokens_
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::array< std::string, 1 > hgc_names_
ParameterSet const & getParameterSet(std::string const &) const
const std::vector< unsigned > NHitCut_
edm::EDGetTokenT< edm::View< reco::PFRecTrack > > src_
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldToken_
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkerGeomToken_
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:126
const reco::TrackBase::TrackQuality trackQuality_
const std::vector< double > DPtovPtCut_
#define LogDebug(id)

Member Function Documentation

◆ beginLuminosityBlock()

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

Definition at line 112 of file HGCalTrackCollectionProducer.cc.

References funct::abs(), alongMomentum, bField_, ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), diskInnerRadius_, diskOuterRadius_, edm::EventSetup::getData(), HGCalDDDConstants::getTrForms(), hgcGeometries_, hgcGeometryTokens_, mps_fire::i, LogDebug, ph2tkdigialgo::m_pion, magneticFieldToken_, mat_prop_, minusSurface_, plusSurface_, makeMuonMisalignmentScenario::rot, tkerGeomToken_, tkGeom_, and beamSpotPI::Z.

112  {
113  constexpr float m_pion = 0.1396;
114  // get dependencies for setting up propagator
117  // get HGC geometries (assume that layers are ordered in Z!)
118  for (unsigned i = 0; i < hgcGeometries_.size(); ++i) {
120  }
121 
122  // make propagator
123  mat_prop_ = std::make_unique<PropagatorWithMaterial>(alongMomentum, m_pion, bField_);
124  // setup HGC layers for track propagation
125  Surface::RotationType rot; //unit rotation matrix
126  for (unsigned i = 0; i < hgcGeometries_.size(); ++i) {
127  minusSurface_[i].clear();
128  plusSurface_[i].clear();
129  const HGCalDDDConstants& dddCons = hgcGeometries_[i]->topology().dddConstants();
130  std::map<float, float> zrhoCoord;
131  std::map<float, float> innerRadiusCoord;
132  auto theTrForms = dddCons.getTrForms();
133  const auto& firstLayerIt = theTrForms.back();
134  float Z(std::abs(firstLayerIt.h3v.z()));
135  // use hardcoded radii for now (FIX ME)
136  diskInnerRadius_ = 31.5;
137  diskOuterRadius_ = 161.0f;
138  LogDebug("HGCalTrackCollectionProducer") << "O HAI I'm making a bound disk with Outer R=" << diskOuterRadius_
139  << " Inner R=" << diskInnerRadius_ << " and Z=" << Z << std::endl;
144  }
145 }
std::array< edm::ESGetToken< HGCalGeometry, IdealGeometryRecord >, 1 > hgcGeometryTokens_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
std::array< std::vector< ReferenceCountingPointer< BoundDisk > >, 1 > minusSurface_
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldToken_
std::array< const HGCalGeometry *, 1 > hgcGeometries_
std::unique_ptr< PropagatorWithMaterial > mat_prop_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkerGeomToken_
Disk BoundDisk
Definition: BoundDisk.h:54
std::array< std::vector< ReferenceCountingPointer< BoundDisk > >, 1 > plusSurface_
std::vector< HGCalParameters::hgtrform > getTrForms() const
#define LogDebug(id)

◆ fillDescriptions()

void HGCalTrackCollectionProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 76 of file HGCalTrackCollectionProducer.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, muonDTDigis_cfi::pset, and AlCaHLTBitMon_QueryRunRegistry::string.

76  {
78  desc.add<edm::InputTag>("src", {"pfTrack"});
79  desc.add<std::string>("trackQuality", "highPurity");
80  desc.add<bool>("useIterativeTracking", true);
81  desc.add<std::vector<double>>("DPtOverPtCuts_byTrackAlgo", {10.0, 10.0, 10.0, 10.0, 10.0, 5.0});
82  desc.add<std::vector<uint32_t>>("NHitCuts_byTrackAlgo", {3, 3, 3, 3, 3, 3});
84  pset.add<std::string>("HGC_ECAL", "HGCalEESensitive");
85  desc.add<edm::ParameterSetDescription>("hgcalGeometryNames", pset);
86  descriptions.add("hgcalTrackCollection", desc);
87 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

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

Definition at line 147 of file HGCalTrackCollectionProducer.cc.

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

147  {
149  evt.getByToken(src_, trackHandle);
150  const auto& tracks = *trackHandle;
151 
152  auto outputInHGCal = std::make_unique<reco::PFRecTrackCollection>();
153  auto outputNotInHGCal = std::make_unique<reco::PFRecTrackCollection>();
154 
155  for (unsigned int i = 0; i < tracks.size(); i++) {
156  const auto track = tracks.ptrAt(i);
157  bool isGood =
159  LogDebug("HGCalTrackCollectionProducer") << "HGCalTrackCollectionProducer Track number " << i
160  << " has a goodPtResolution result of " << isGood << std::endl;
161  if (!isGood)
162  continue;
163  bool found = false;
164  const TrajectoryStateOnSurface myTSOS =
166  auto detbegin = myTSOS.globalPosition().z() > 0 ? plusSurface_.begin() : minusSurface_.begin();
167  auto detend = myTSOS.globalPosition().z() > 0 ? plusSurface_.end() : minusSurface_.end();
168  for (auto det = detbegin; det != detend; ++det) {
169  LogDebug("HGCalTrackCollectionProducer") << "at HGC detector: " << std::distance(detbegin, det) << std::endl;
170  unsigned layer_count = 1;
171  for (const auto& layer : *det) {
172  LogDebug("HGCalTrackCollectionProducer") << " at DET layer: " << layer_count++ << std::endl;
173  TrajectoryStateOnSurface piStateAtSurface = mat_prop_->propagate(myTSOS, *layer);
174  if (piStateAtSurface.isValid()) {
175  LogDebug("HGCalTrackCollectionProducer") << "Extrapolation is valid!" << std::endl;
176  GlobalPoint pt = piStateAtSurface.globalPosition();
177  if (pt.perp() < diskOuterRadius_) {
178  if (pt.perp() > diskInnerRadius_) {
179  LogDebug("HGCalTrackCollectionProducer")
180  << "(x,y,z,r)=(" << pt.x() << ", " << pt.y() << ", " << pt.z() << ", "
181  << sqrt(pt.x() * pt.x() + pt.y() * pt.y()) << ")" << std::endl;
182  if (std::abs(track->trackRef()->eta()) < 1.47)
183  LogDebug("HGCalTrackCollectionProducer") << " ETA IN BARREL REGION: " << track->trackRef()->eta()
184  << " (PT: " << track->trackRef()->pt() << ")" << std::endl;
185  found = true;
186  } else {
187  LogDebug("HGCalTrackCollectionProducer")
188  << " but r=" << pt.perp() << " < diskInnerRadius=" << diskInnerRadius_ << " so skipping "
189  << std::endl;
190  }
191  } else {
192  LogDebug("HGCalTrackCollectionProducer")
193  << " but r=" << pt.perp() << " > diskOuterRadius=" << diskOuterRadius_ << " so skipping " << std::endl;
194  }
195  } else {
196  LogDebug("HGCalTrackCollectionProducer") << "Extrapolation is NOT valid!" << std::endl;
197  }
198  }
199  }
200  if (found) {
201  LogDebug("HGCalTrackCollectionProducer") << " Track going to outputInHGCal pt eta " << track->trackRef()->pt()
202  << " " << track->trackRef()->eta() << std::endl;
203  outputInHGCal->push_back(*track);
204  } else {
205  outputNotInHGCal->push_back(*track);
206  }
207  } // track loop
208 
209  evt.put(std::move(outputInHGCal), "TracksInHGCal");
210  evt.put(std::move(outputNotInHGCal), "TracksNotInHGCal");
211 }
bool goodPtResolution(const reco::TrackRef &, const std::vector< double > &DPtovPtCut, const std::vector< unsigned > &NHitCut, bool useIterTracking, const reco::TrackBase::TrackQuality trackQuality)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
TrajectoryStateOnSurface outerStateOnSurface(const reco::Track &tk, const TrackingGeometry &geom, const MagneticField *field, bool withErr=true)
T z() const
Definition: PV3DBase.h:61
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:526
std::array< std::vector< ReferenceCountingPointer< BoundDisk > >, 1 > minusSurface_
const std::vector< unsigned > NHitCut_
edm::EDGetTokenT< edm::View< reco::PFRecTrack > > src_
GlobalPoint globalPosition() const
T sqrt(T t)
Definition: SSEVec.h:23
std::unique_ptr< PropagatorWithMaterial > mat_prop_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const reco::TrackBase::TrackQuality trackQuality_
const std::vector< double > DPtovPtCut_
std::array< std::vector< ReferenceCountingPointer< BoundDisk > >, 1 > plusSurface_
def move(src, dest)
Definition: eostools.py:511
#define LogDebug(id)

Member Data Documentation

◆ bField_

const MagneticField* HGCalTrackCollectionProducer::bField_
private

Definition at line 62 of file HGCalTrackCollectionProducer.cc.

Referenced by beginLuminosityBlock(), and produce().

◆ diskInnerRadius_

float HGCalTrackCollectionProducer::diskInnerRadius_
private

Definition at line 73 of file HGCalTrackCollectionProducer.cc.

Referenced by beginLuminosityBlock(), and produce().

◆ diskOuterRadius_

float HGCalTrackCollectionProducer::diskOuterRadius_
private

Definition at line 72 of file HGCalTrackCollectionProducer.cc.

Referenced by beginLuminosityBlock(), and produce().

◆ DPtovPtCut_

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

Definition at line 54 of file HGCalTrackCollectionProducer.cc.

Referenced by produce().

◆ hgc_names_

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

Definition at line 64 of file HGCalTrackCollectionProducer.cc.

Referenced by HGCalTrackCollectionProducer().

◆ hgcGeometries_

std::array<const HGCalGeometry*, 1> HGCalTrackCollectionProducer::hgcGeometries_
private

Definition at line 67 of file HGCalTrackCollectionProducer.cc.

Referenced by beginLuminosityBlock().

◆ hgcGeometryTokens_

std::array<edm::ESGetToken<HGCalGeometry, IdealGeometryRecord>, 1> HGCalTrackCollectionProducer::hgcGeometryTokens_
private

◆ magneticFieldToken_

const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> HGCalTrackCollectionProducer::magneticFieldToken_
private

Definition at line 60 of file HGCalTrackCollectionProducer.cc.

Referenced by beginLuminosityBlock().

◆ mat_prop_

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

Definition at line 70 of file HGCalTrackCollectionProducer.cc.

Referenced by beginLuminosityBlock(), and produce().

◆ minusSurface_

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

Definition at line 68 of file HGCalTrackCollectionProducer.cc.

Referenced by beginLuminosityBlock(), and produce().

◆ NHitCut_

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

Definition at line 55 of file HGCalTrackCollectionProducer.cc.

Referenced by produce().

◆ plusSurface_

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

Definition at line 68 of file HGCalTrackCollectionProducer.cc.

Referenced by beginLuminosityBlock(), and produce().

◆ src_

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

Definition at line 48 of file HGCalTrackCollectionProducer.cc.

Referenced by produce().

◆ tkerGeomToken_

const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> HGCalTrackCollectionProducer::tkerGeomToken_
private

Definition at line 61 of file HGCalTrackCollectionProducer.cc.

Referenced by beginLuminosityBlock().

◆ tkGeom_

const TrackerGeometry* HGCalTrackCollectionProducer::tkGeom_
private

Definition at line 63 of file HGCalTrackCollectionProducer.cc.

Referenced by beginLuminosityBlock(), and produce().

◆ trackQuality_

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

Definition at line 53 of file HGCalTrackCollectionProducer.cc.

Referenced by produce().

◆ useIterTracking_

const bool HGCalTrackCollectionProducer::useIterTracking_
private

Definition at line 56 of file HGCalTrackCollectionProducer.cc.

Referenced by produce().