CMS 3D CMS Logo

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

Public Member Functions

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

edm::InputTag associatorLayerClusterCaloParticle_
 
edm::InputTag associatorLayerClusterSimCluster_
 
edm::EDGetTokenT< hgcal::SimToRecoCollectionassociatorMapCaloParticleToReco_token_
 
edm::EDGetTokenT< hgcal::SimToRecoCollectionWithSimClustersassociatorMapSimClusterToReco_token_
 
edm::EDGetTokenT< std::vector< CaloParticle > > caloparticles_token_
 
const edm::EDGetTokenT< std::vector< reco::CaloCluster > > clusters_token_
 
const edm::EDGetTokenT< edm::ValueMap< std::pair< float, float > > > clustersTime_token_
 
std::string detector_
 
const bool doNose_ = false
 
const edm::EDGetTokenT< std::vector< float > > filtered_layerclusters_mask_token_
 
const double fractionCut_
 
edm::ESGetToken< CaloGeometry, CaloGeometryRecordgeom_token_
 
hgcal::RecHitTools rhtools_
 
edm::EDGetTokenT< std::vector< SimCluster > > simclusters_token_
 

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 62 of file TrackstersFromSimClustersProducer.cc.

Constructor & Destructor Documentation

◆ TrackstersFromSimClustersProducer()

TrackstersFromSimClustersProducer::TrackstersFromSimClustersProducer ( const edm::ParameterSet ps)
explicit

Definition at line 90 of file TrackstersFromSimClustersProducer.cc.

91  : detector_(ps.getParameter<std::string>("detector")),
92  doNose_(detector_ == "HFNose"),
93  clusters_token_(consumes<std::vector<reco::CaloCluster>>(ps.getParameter<edm::InputTag>("layer_clusters"))),
95  consumes<edm::ValueMap<std::pair<float, float>>>(ps.getParameter<edm::InputTag>("time_layerclusters"))),
96  filtered_layerclusters_mask_token_(consumes<std::vector<float>>(ps.getParameter<edm::InputTag>("filtered_mask"))),
97  simclusters_token_(consumes<std::vector<SimCluster>>(ps.getParameter<edm::InputTag>("simclusters"))),
98  caloparticles_token_(consumes<std::vector<CaloParticle>>(ps.getParameter<edm::InputTag>("caloparticles"))),
99  associatorLayerClusterSimCluster_(ps.getUntrackedParameter<edm::InputTag>("layerClusterSimClusterAssociator")),
101  consumes<hgcal::SimToRecoCollectionWithSimClusters>(associatorLayerClusterSimCluster_)),
103  ps.getUntrackedParameter<edm::InputTag>("layerClusterCaloParticleAssociator")),
106  fractionCut_(ps.getParameter<double>("fractionCut")) {
107  produces<std::vector<Trackster>>();
108  produces<std::vector<float>>();
109 }

◆ ~TrackstersFromSimClustersProducer()

TrackstersFromSimClustersProducer::~TrackstersFromSimClustersProducer ( )
inlineoverride

Definition at line 65 of file TrackstersFromSimClustersProducer.cc.

65 {}

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 111 of file TrackstersFromSimClustersProducer.cc.

111  {
112  // hgcalMultiClusters
114  desc.add<std::string>("detector", "HGCAL");
115  desc.add<edm::InputTag>("layer_clusters", edm::InputTag("hgcalLayerClusters"));
116  desc.add<edm::InputTag>("time_layerclusters", edm::InputTag("hgcalLayerClusters", "timeLayerCluster"));
117  desc.add<edm::InputTag>("filtered_mask", edm::InputTag("filteredLayerClustersSimTracksters", "ticlSimTracksters"));
118  desc.add<edm::InputTag>("simclusters", edm::InputTag("mix", "MergedCaloTruth"));
119  desc.add<edm::InputTag>("caloparticles", edm::InputTag("mix", "MergedCaloTruth"));
120  desc.addUntracked<edm::InputTag>("layerClusterSimClusterAssociator",
121  edm::InputTag("layerClusterSimClusterAssociationProducer"));
122  desc.addUntracked<edm::InputTag>("layerClusterCaloParticleAssociator",
123  edm::InputTag("layerClusterCaloParticleAssociationProducer"));
124  desc.add<double>("fractionCut", 0.);
125 
126  descriptions.add("trackstersFromSimClustersProducer", desc);
127 }

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

◆ produce()

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

Definition at line 129 of file TrackstersFromSimClustersProducer.cc.

129  {
130  auto result = std::make_unique<std::vector<Trackster>>();
131  auto output_mask = std::make_unique<std::vector<float>>();
132  const auto& layerClusters = evt.get(clusters_token_);
133  const auto& layerClustersTimes = evt.get(clustersTime_token_);
134  const auto& inputClusterMask = evt.get(filtered_layerclusters_mask_token_);
135  output_mask->resize(layerClusters.size(), 1.f);
136 
137  const auto& simclusters = evt.get(simclusters_token_);
138  const auto& caloparticles = evt.get(caloparticles_token_);
139 
140  const auto& simClustersToRecoColl = evt.get(associatorMapSimClusterToReco_token_);
141  const auto& caloParticlesToRecoColl = evt.get(associatorMapCaloParticleToReco_token_);
142 
143  const auto& geom = es.getData(geom_token_);
145  auto num_simclusters = simclusters.size();
146  result->reserve(num_simclusters);
147 
148  for (const auto& [key, values] : caloParticlesToRecoColl) {
149  auto const& cp = *(key);
150  auto cpIndex = &cp - &caloparticles[0];
151  if (cp.g4Tracks()[0].crossedBoundary()) {
152  if (values.empty())
153  continue;
154  Trackster tmpTrackster;
155  tmpTrackster.zeroProbabilities();
156  tmpTrackster.vertices().reserve(values.size());
157  tmpTrackster.vertex_multiplicity().reserve(values.size());
158  for (auto const& [lc, energyScorePair] : values) {
159  if (inputClusterMask[lc.index()] > 0) {
160  double fraction = energyScorePair.first / lc->energy();
161  if (fraction < fractionCut_)
162  continue;
163  tmpTrackster.vertices().push_back(lc.index());
164  (*output_mask)[lc.index()] -= fraction;
165  tmpTrackster.vertex_multiplicity().push_back(1. / fraction);
166  }
167  }
168  tmpTrackster.setIdProbability(tracksterParticleTypeFromPdgId(cp.pdgId(), cp.charge()), 1.f);
169  float energyAtBoundary = cp.g4Tracks()[0].getMomentumAtBoundary().energy();
170  tmpTrackster.setRegressedEnergy(energyAtBoundary);
171  tmpTrackster.setSeed(key.id(), cpIndex);
172  result->emplace_back(tmpTrackster);
173  } else {
174  for (const auto& scRef : cp.simClusters()) {
175  const auto& it = simClustersToRecoColl.find(scRef);
176  if (it == simClustersToRecoColl.end())
177  continue;
178  const auto& lcVec = it->val;
179  if (lcVec.empty())
180  continue;
181  auto const& sc = *(scRef);
182  auto simClusterIndex = &sc - &simclusters[0];
183  Trackster tmpTrackster;
184 
185  tmpTrackster.zeroProbabilities();
186  tmpTrackster.vertices().reserve(lcVec.size());
187  tmpTrackster.vertex_multiplicity().reserve(lcVec.size());
188 
189  for (auto const& [lc, energyScorePair] : lcVec) {
190  if (inputClusterMask[lc.index()] > 0) {
191  double fraction = energyScorePair.first / lc->energy();
192  if (fraction < fractionCut_)
193  continue;
194  tmpTrackster.vertices().push_back(lc.index());
195  (*output_mask)[lc.index()] -= fraction;
196  tmpTrackster.vertex_multiplicity().push_back(1. / fraction);
197  }
198  }
199  tmpTrackster.setIdProbability(tracksterParticleTypeFromPdgId(sc.pdgId(), sc.charge()), 1.f);
200  float energyAtBoundary = sc.g4Tracks()[0].getMomentumAtBoundary().energy();
201  tmpTrackster.setRegressedEnergy(energyAtBoundary);
202  tmpTrackster.setSeed(scRef.id(), simClusterIndex);
203  result->emplace_back(tmpTrackster);
204  }
205  }
206  }
207 
210  result->shrink_to_fit();
211 
212  evt.put(std::move(result));
213  evt.put(std::move(output_mask));
214 }

References ticl::assignPCAtoTracksters(), associatorMapCaloParticleToReco_token_, associatorMapSimClusterToReco_token_, SimTracksters_cff::caloparticles, caloparticles_token_, clusters_token_, clustersTime_token_, doNose_, f, filtered_layerclusters_mask_token_, HLT_FULL_cff::fraction, fractionCut_, relativeConstraints::geom, geom_token_, edm::Event::get(), edm::EventSetup::getData(), hgcal::RecHitTools::getPositionLayer(), crabWrapper::key, hgcal::RecHitTools::lastLayerEE(), HLTEgPhaseIITestSequence_cff::layerClusters, eostools::move(), edm::Event::put(), mps_fire::result, rhtools_, hgcal::RecHitTools::setGeometry(), ticl::Trackster::setIdProbability(), ticl::Trackster::setRegressedEnergy(), ticl::Trackster::setSeed(), SimTracksters_cff::simclusters, simclusters_token_, contentValuesCheck::values, ticl::Trackster::vertex_multiplicity(), ticl::Trackster::vertices(), z, and ticl::Trackster::zeroProbabilities().

Member Data Documentation

◆ associatorLayerClusterCaloParticle_

edm::InputTag TrackstersFromSimClustersProducer::associatorLayerClusterCaloParticle_
private

Definition at line 82 of file TrackstersFromSimClustersProducer.cc.

◆ associatorLayerClusterSimCluster_

edm::InputTag TrackstersFromSimClustersProducer::associatorLayerClusterSimCluster_
private

Definition at line 80 of file TrackstersFromSimClustersProducer.cc.

◆ associatorMapCaloParticleToReco_token_

edm::EDGetTokenT<hgcal::SimToRecoCollection> TrackstersFromSimClustersProducer::associatorMapCaloParticleToReco_token_
private

Definition at line 83 of file TrackstersFromSimClustersProducer.cc.

Referenced by produce().

◆ associatorMapSimClusterToReco_token_

edm::EDGetTokenT<hgcal::SimToRecoCollectionWithSimClusters> TrackstersFromSimClustersProducer::associatorMapSimClusterToReco_token_
private

Definition at line 81 of file TrackstersFromSimClustersProducer.cc.

Referenced by produce().

◆ caloparticles_token_

edm::EDGetTokenT<std::vector<CaloParticle> > TrackstersFromSimClustersProducer::caloparticles_token_
private

Definition at line 78 of file TrackstersFromSimClustersProducer.cc.

Referenced by produce().

◆ clusters_token_

const edm::EDGetTokenT<std::vector<reco::CaloCluster> > TrackstersFromSimClustersProducer::clusters_token_
private

Definition at line 73 of file TrackstersFromSimClustersProducer.cc.

Referenced by produce().

◆ clustersTime_token_

const edm::EDGetTokenT<edm::ValueMap<std::pair<float, float> > > TrackstersFromSimClustersProducer::clustersTime_token_
private

Definition at line 74 of file TrackstersFromSimClustersProducer.cc.

Referenced by produce().

◆ detector_

std::string TrackstersFromSimClustersProducer::detector_
private

Definition at line 71 of file TrackstersFromSimClustersProducer.cc.

◆ doNose_

const bool TrackstersFromSimClustersProducer::doNose_ = false
private

Definition at line 72 of file TrackstersFromSimClustersProducer.cc.

Referenced by produce().

◆ filtered_layerclusters_mask_token_

const edm::EDGetTokenT<std::vector<float> > TrackstersFromSimClustersProducer::filtered_layerclusters_mask_token_
private

Definition at line 75 of file TrackstersFromSimClustersProducer.cc.

Referenced by produce().

◆ fractionCut_

const double TrackstersFromSimClustersProducer::fractionCut_
private

Definition at line 86 of file TrackstersFromSimClustersProducer.cc.

Referenced by produce().

◆ geom_token_

edm::ESGetToken<CaloGeometry, CaloGeometryRecord> TrackstersFromSimClustersProducer::geom_token_
private

Definition at line 84 of file TrackstersFromSimClustersProducer.cc.

Referenced by produce().

◆ rhtools_

hgcal::RecHitTools TrackstersFromSimClustersProducer::rhtools_
private

Definition at line 85 of file TrackstersFromSimClustersProducer.cc.

Referenced by produce().

◆ simclusters_token_

edm::EDGetTokenT<std::vector<SimCluster> > TrackstersFromSimClustersProducer::simclusters_token_
private

Definition at line 77 of file TrackstersFromSimClustersProducer.cc.

Referenced by produce().

TrackstersFromSimClustersProducer::filtered_layerclusters_mask_token_
const edm::EDGetTokenT< std::vector< float > > filtered_layerclusters_mask_token_
Definition: TrackstersFromSimClustersProducer.cc:75
TrackstersFromSimClustersProducer::associatorMapSimClusterToReco_token_
edm::EDGetTokenT< hgcal::SimToRecoCollectionWithSimClusters > associatorMapSimClusterToReco_token_
Definition: TrackstersFromSimClustersProducer.cc:81
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
ticl::Trackster::setSeed
void setSeed(edm::ProductID pid, int index)
Definition: Trackster.h:59
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
TrackstersFromSimClustersProducer::fractionCut_
const double fractionCut_
Definition: TrackstersFromSimClustersProducer.cc:86
TrackstersFromSimClustersProducer::simclusters_token_
edm::EDGetTokenT< std::vector< SimCluster > > simclusters_token_
Definition: TrackstersFromSimClustersProducer.cc:77
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
hgcal_conditions::parameters
Definition: HGCConditions.h:86
TrackstersFromSimClustersProducer::associatorLayerClusterCaloParticle_
edm::InputTag associatorLayerClusterCaloParticle_
Definition: TrackstersFromSimClustersProducer.cc:82
ticl::assignPCAtoTracksters
void assignPCAtoTracksters(std::vector< Trackster > &, const std::vector< reco::CaloCluster > &, const edm::ValueMap< std::pair< float, float >> &, double, bool energyWeight=true)
Definition: TrackstersPCA.cc:12
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
HLT_FULL_cff.fraction
fraction
Definition: HLT_FULL_cff.py:52823
ticl::Trackster::zeroProbabilities
void zeroProbabilities()
Definition: Trackster.h:107
TrackstersFromSimClustersProducer::caloparticles_token_
edm::EDGetTokenT< std::vector< CaloParticle > > caloparticles_token_
Definition: TrackstersFromSimClustersProducer.cc:78
contentValuesCheck.values
values
Definition: contentValuesCheck.py:38
DDAxes::z
TrackstersFromSimClustersProducer::associatorLayerClusterSimCluster_
edm::InputTag associatorLayerClusterSimCluster_
Definition: TrackstersFromSimClustersProducer.cc:80
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
SimTracksters_cff.simclusters
simclusters
Definition: SimTracksters_cff.py:22
HLTEgPhaseIITestSequence_cff.layerClusters
layerClusters
Definition: HLTEgPhaseIITestSequence_cff.py:2506
SimTracksters_cff.caloparticles
caloparticles
Definition: SimTracksters_cff.py:23
TrackstersFromSimClustersProducer::clustersTime_token_
const edm::EDGetTokenT< edm::ValueMap< std::pair< float, float > > > clustersTime_token_
Definition: TrackstersFromSimClustersProducer.cc:74
hgcal::RecHitTools::lastLayerEE
unsigned int lastLayerEE(bool nose=false) const
Definition: RecHitTools.h:67
TrackstersFromSimClustersProducer::geom_token_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geom_token_
Definition: TrackstersFromSimClustersProducer.cc:84
TrackstersFromSimClustersProducer::associatorMapCaloParticleToReco_token_
edm::EDGetTokenT< hgcal::SimToRecoCollection > associatorMapCaloParticleToReco_token_
Definition: TrackstersFromSimClustersProducer.cc:83
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
ticl::Trackster::vertex_multiplicity
std::vector< float > & vertex_multiplicity()
Definition: Trackster.h:57
hgcal::RecHitTools::getPositionLayer
GlobalPoint getPositionLayer(int layer, bool nose=false) const
Definition: RecHitTools.cc:138
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
TrackstersFromSimClustersProducer::clusters_token_
const edm::EDGetTokenT< std::vector< reco::CaloCluster > > clusters_token_
Definition: TrackstersFromSimClustersProducer.cc:73
TrackstersFromSimClustersProducer::doNose_
const bool doNose_
Definition: TrackstersFromSimClustersProducer.cc:72
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
hgcal::RecHitTools::setGeometry
void setGeometry(CaloGeometry const &)
Definition: RecHitTools.cc:68
edm::ValueMap
Definition: ValueMap.h:107
ticl::Trackster::vertices
std::vector< unsigned int > & vertices()
Definition: Trackster.h:56
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TrackstersFromSimClustersProducer::rhtools_
hgcal::RecHitTools rhtools_
Definition: TrackstersFromSimClustersProducer.cc:85
mps_fire.result
result
Definition: mps_fire.py:311
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
crabWrapper.key
key
Definition: crabWrapper.py:19
ticl::Trackster::setRegressedEnergy
void setRegressedEnergy(float value)
Definition: Trackster.h:67
edm::Event::get
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:346
edm::InputTag
Definition: InputTag.h:15
TrackstersFromSimClustersProducer::detector_
std::string detector_
Definition: TrackstersFromSimClustersProducer.cc:71
ticl::Trackster
Definition: Trackster.h:19
ticl::Trackster::setIdProbability
void setIdProbability(ParticleType type, float value)
Definition: Trackster.h:117