CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
TICLCandidateFromTrackstersProducer Class Reference
Inheritance diagram for TICLCandidateFromTrackstersProducer:
edm::stream::EDProducer<>

Public Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 
 TICLCandidateFromTrackstersProducer (const edm::ParameterSet &)
 
 ~TICLCandidateFromTrackstersProducer () override
 
- 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 Attributes

float min_particle_prob_
 
std::unique_ptr< TracksterMomentumPluginBasemomentum_algo_
 
std::unique_ptr< TracksterTrackPluginBasetrack_algo_
 
std::vector< edm::EDGetTokenT< std::vector< Trackster > > > trackster_tokens_
 

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 24 of file TICLCandidateFromTrackstersProducer.cc.

Constructor & Destructor Documentation

◆ TICLCandidateFromTrackstersProducer()

TICLCandidateFromTrackstersProducer::TICLCandidateFromTrackstersProducer ( const edm::ParameterSet ps)

Definition at line 63 of file TICLCandidateFromTrackstersProducer.cc.

64  : min_particle_prob_(ps.getParameter<double>("minParticleProbability")) {
66  edm::vector_transform(ps.getParameter<std::vector<edm::InputTag>>("tracksterCollections"),
67  [this](edm::InputTag const& tag) { return consumes<std::vector<Trackster>>(tag); });
68  produces<std::vector<TICLCandidate>>();
69  auto pset_momentum = ps.getParameter<edm::ParameterSet>("momentumPlugin");
71  pset_momentum.getParameter<std::string>("plugin"), pset_momentum, consumesCollector());
72 
73  auto pset_track = ps.getParameter<edm::ParameterSet>("trackPlugin");
75  pset_track.getParameter<std::string>("plugin"), pset_track, consumesCollector());
76 }

References get, edm::ParameterSet::getParameter(), momentum_algo_, AlCaHLTBitMon_QueryRunRegistry::string, makeGlobalPositionRcd_cfg::tag, track_algo_, trackster_tokens_, and edm::vector_transform().

◆ ~TICLCandidateFromTrackstersProducer()

TICLCandidateFromTrackstersProducer::~TICLCandidateFromTrackstersProducer ( )
inlineoverride

Definition at line 27 of file TICLCandidateFromTrackstersProducer.cc.

27 {}

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 78 of file TICLCandidateFromTrackstersProducer.cc.

78  {
80 
81  std::vector<edm::InputTag> source_vector{edm::InputTag("trackstersTrk"),
82  edm::InputTag("trackstersMIP"),
83  edm::InputTag("trackstersEM"),
84  edm::InputTag("trackstersHAD")};
85  desc.add<std::vector<edm::InputTag>>("tracksterCollections", source_vector);
86  desc.add<double>("minParticleProbability", 0.);
87 
88  edm::ParameterSetDescription desc_momentum;
89  desc_momentum.add<std::string>("plugin", "TracksterP4FromEnergySum");
90  desc_momentum.add<bool>("energyFromRegression", false);
91  desc_momentum.add<edm::InputTag>("vertices", edm::InputTag("offlinePrimaryVertices"));
92  desc_momentum.add<edm::InputTag>("layerClusters", edm::InputTag("hgcalLayerClusters"));
93  desc_momentum.add<edm::InputTag>("tracks", edm::InputTag("generalTracks"));
94  desc.add<edm::ParameterSetDescription>("momentumPlugin", desc_momentum);
95 
97  desc_track.add<std::string>("plugin", "TracksterRecoTrackPlugin");
98  desc.add<edm::ParameterSetDescription>("trackPlugin", desc_track);
99 
100  descriptions.add("ticlCandidateFromTrackstersProducer", desc);
101 }

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), submitPVResolutionJobs::desc, HLT_FULL_cff::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ produce()

void TICLCandidateFromTrackstersProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
override

Definition at line 103 of file TICLCandidateFromTrackstersProducer.cc.

103  {
104  auto result = std::make_unique<std::vector<TICLCandidate>>();
105 
106  std::vector<const Trackster*> trackster_ptrs;
107 
108  // adds one TICLCandidate for each trackster that has a minimum particle probability
109  for (auto& trackster_token : trackster_tokens_) {
111  evt.getByToken(trackster_token, trackster_h);
112  for (size_t i_trackster = 0; i_trackster < trackster_h->size(); ++i_trackster) {
113  auto const& trackster = trackster_h->at(i_trackster);
114  auto id_prob_begin = std::begin(trackster.id_probabilities());
115  auto max_id_prob_it = std::max_element(id_prob_begin, std::end(trackster.id_probabilities()));
116  float max_id_prob = *max_id_prob_it;
117  if (max_id_prob < min_particle_prob_)
118  continue;
119 
120  trackster_ptrs.push_back(&trackster);
121  auto& ticl_cand = result->emplace_back(edm::Ptr<ticl::Trackster>(trackster_h, i_trackster));
122  auto max_index = std::distance(id_prob_begin, max_id_prob_it);
123  auto pdg_id = pdg_id_from_particle_type(static_cast<ticl::Trackster::ParticleType>(max_index));
124  ticl_cand.setPdgId(pdg_id);
125  }
126  }
127 
128  momentum_algo_->setP4(trackster_ptrs, *result, evt);
129  track_algo_->setTrack(trackster_ptrs, *result, evt);
130 
131  // charge assignment
132  for (size_t i = 0; i < result->size(); ++i) {
133  auto& ticl_cand = result->at(i);
134  auto pdg_id = ticl_cand.pdgId();
135  if (pdg_id == -11 || pdg_id == -13 || pdg_id == 211) {
136  if (ticl_cand.trackPtr().isNonnull()) {
137  auto charge = ticl_cand.trackPtr()->charge();
138  ticl_cand.setCharge(charge);
139  ticl_cand.setPdgId(pdg_id * charge);
140  // If this is a special 0 energy trackster that has been injected
141  // starting from a seed that has not been linked to any shower,
142  // re-assign the energy and momentum to be the ones of the track linked
143  // to the original seeding region.
144  if (ticl_cand.rawEnergy() == 0.) {
145  auto const& three_mom = ticl_cand.trackPtr()->momentum();
146  constexpr double mpion2 = 0.13957 * 0.13957;
147  double energy = std::sqrt(three_mom.mag2() + mpion2);
148  math::XYZTLorentzVector trk_p4(three_mom.x(), three_mom.y(), three_mom.z(), energy);
149  ticl_cand.setP4(trk_p4);
150  ticl_cand.setRawEnergy(energy);
151  }
152  } else {
153  // Demote them to be neutral, since there's not track associated.
154  ticl_cand.setCharge(0);
155  if (pdg_id == -11) {
156  ticl_cand.setPdgId(22);
157  } else {
158  ticl_cand.setPdgId(130);
159  }
160  }
161  }
162  }
163 
164  evt.put(std::move(result));
165 }

References ALCARECOTkAlJpsiMuMu_cff::charge, HLT_FULL_cff::distance, mps_fire::end, HCALHighEnergyHPDFilter_cfi::energy, edm::Event::getByToken(), mps_fire::i, hgcal_clustering::max_index(), min_particle_prob_, momentum_algo_, eostools::move(), HiggsValidation_cfi::pdg_id, edm::Event::put(), mps_fire::result, mathSSE::sqrt(), track_algo_, and trackster_tokens_.

Member Data Documentation

◆ min_particle_prob_

float TICLCandidateFromTrackstersProducer::min_particle_prob_
private

Definition at line 36 of file TICLCandidateFromTrackstersProducer.cc.

Referenced by produce().

◆ momentum_algo_

std::unique_ptr<TracksterMomentumPluginBase> TICLCandidateFromTrackstersProducer::momentum_algo_
private

◆ track_algo_

std::unique_ptr<TracksterTrackPluginBase> TICLCandidateFromTrackstersProducer::track_algo_
private

◆ trackster_tokens_

std::vector<edm::EDGetTokenT<std::vector<Trackster> > > TICLCandidateFromTrackstersProducer::trackster_tokens_
private
HiggsValidation_cfi.pdg_id
pdg_id
Definition: HiggsValidation_cfi.py:6
mps_fire.i
i
Definition: mps_fire.py:428
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
TICLCandidateFromTrackstersProducer::track_algo_
std::unique_ptr< TracksterTrackPluginBase > track_algo_
Definition: TICLCandidateFromTrackstersProducer.cc:35
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::Handle
Definition: AssociativeIterator.h:50
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
mps_fire.end
end
Definition: mps_fire.py:242
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
edm::vector_transform
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
Definition: transform.h:11
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
edm::ParameterSet
Definition: ParameterSet.h:47
makeGlobalPositionRcd_cfg.tag
tag
Definition: makeGlobalPositionRcd_cfg.py:6
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
get
#define get
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::Ptr
Definition: AssociationVector.h:31
hgcal_clustering::max_index
size_t max_index(const std::vector< T > &v)
Definition: HGCalClusteringAlgoBase.h:31
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
TICLCandidateFromTrackstersProducer::trackster_tokens_
std::vector< edm::EDGetTokenT< std::vector< Trackster > > > trackster_tokens_
Definition: TICLCandidateFromTrackstersProducer.cc:33
math::XYZTLorentzVector
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
TICLCandidateFromTrackstersProducer::min_particle_prob_
float min_particle_prob_
Definition: TICLCandidateFromTrackstersProducer.cc:36
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
mps_fire.result
result
Definition: mps_fire.py:311
HLT_FULL_cff.distance
distance
Definition: HLT_FULL_cff.py:7746
TICLCandidateFromTrackstersProducer::momentum_algo_
std::unique_ptr< TracksterMomentumPluginBase > momentum_algo_
Definition: TICLCandidateFromTrackstersProducer.cc:34
edm::InputTag
Definition: InputTag.h:15