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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

edm::InputTag associatorLayerClusterSimCluster_
 
edm::EDGetTokenT< hgcal::SimToRecoCollectionWithSimClustersassociatorMapSimToReco_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_
 
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<>
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 59 of file TrackstersFromSimClustersProducer.cc.

Constructor & Destructor Documentation

◆ TrackstersFromSimClustersProducer()

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

Definition at line 83 of file TrackstersFromSimClustersProducer.cc.

84  : detector_(ps.getParameter<std::string>("detector")),
85  doNose_(detector_ == "HFNose"),
86  clusters_token_(consumes<std::vector<reco::CaloCluster>>(ps.getParameter<edm::InputTag>("layer_clusters"))),
88  consumes<edm::ValueMap<std::pair<float, float>>>(ps.getParameter<edm::InputTag>("time_layerclusters"))),
89  filtered_layerclusters_mask_token_(consumes<std::vector<float>>(ps.getParameter<edm::InputTag>("filtered_mask"))),
90  simclusters_token_(consumes<std::vector<SimCluster>>(ps.getParameter<edm::InputTag>("simclusters"))),
91  associatorLayerClusterSimCluster_(ps.getUntrackedParameter<edm::InputTag>("layerClusterSimClusterAssociator")),
93  consumes<hgcal::SimToRecoCollectionWithSimClusters>(associatorLayerClusterSimCluster_)),
95  produces<std::vector<Trackster>>();
96  produces<std::vector<float>>();
97 }

◆ ~TrackstersFromSimClustersProducer()

TrackstersFromSimClustersProducer::~TrackstersFromSimClustersProducer ( )
inlineoverride

Definition at line 62 of file TrackstersFromSimClustersProducer.cc.

62 {}

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 99 of file TrackstersFromSimClustersProducer.cc.

99  {
100  // hgcalMultiClusters
102  desc.add<std::string>("detector", "HGCAL");
103  desc.add<edm::InputTag>("layer_clusters", edm::InputTag("hgcalLayerClusters"));
104  desc.add<edm::InputTag>("time_layerclusters", edm::InputTag("hgcalLayerClusters", "timeLayerCluster"));
105  desc.add<edm::InputTag>("filtered_mask", edm::InputTag("filteredLayerClustersSimTracksters", "ticlSimTracksters"));
106  desc.add<edm::InputTag>("simclusters", edm::InputTag("mix", "MergedCaloTruth"));
107  desc.addUntracked<edm::InputTag>("layerClusterSimClusterAssociator",
108  edm::InputTag("layerClusterSimClusterAssociationProducer"));
109  descriptions.add("trackstersFromSimClustersProducer", desc);
110 }

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

112  {
113  auto result = std::make_unique<std::vector<Trackster>>();
114  auto output_mask = std::make_unique<std::vector<float>>();
115  const auto& layerClusters = evt.get(clusters_token_);
116  const auto& layerClustersTimes = evt.get(clustersTime_token_);
117  const auto& inputClusterMask = evt.get(filtered_layerclusters_mask_token_);
118  output_mask->resize(layerClusters.size(), 1.f);
119 
120  const auto& simclusters = evt.get(simclusters_token_);
121  const auto& simToRecoColl = evt.get(associatorMapSimToReco_token_);
122 
123  const auto& geom = es.getData(geom_token_);
125  auto num_simclusters = simclusters.size();
126  result->reserve(num_simclusters);
127  for (const auto& [key, values] : simToRecoColl) {
128  auto const& sc = *(key);
129  auto simClusterIndex = &sc - &simclusters[0];
130  Trackster tmpTrackster;
131  tmpTrackster.zeroProbabilities();
132  tmpTrackster.vertices().reserve(values.size());
133  tmpTrackster.vertex_multiplicity().reserve(values.size());
134 
135  for (auto const& [lc, energyScorePair] : values) {
136  if (inputClusterMask[lc.index()] > 0) {
137  tmpTrackster.vertices().push_back(lc.index());
138  double fraction = energyScorePair.first / lc->energy();
139  (*output_mask)[lc.index()] -= fraction;
140  tmpTrackster.vertex_multiplicity().push_back(static_cast<uint8_t>(std::clamp(1. / fraction, 0., 255.)));
141  }
142  }
143  tmpTrackster.setIdProbability(tracksterParticleTypeFromPdgId(sc.pdgId(), sc.charge()), 1.f);
144  tmpTrackster.setSeed(key.id(), simClusterIndex);
145  result->emplace_back(tmpTrackster);
146  }
149  evt.put(std::move(result));
150  evt.put(std::move(output_mask));
151 }

References ticl::assignPCAtoTracksters(), associatorMapSimToReco_token_, clusters_token_, clustersTime_token_, doNose_, f, filtered_layerclusters_mask_token_, HLT_FULL_cff::fraction, 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::setSeed(), SimTracksters_cff::simclusters, simclusters_token_, contentValuesCheck::values, ticl::Trackster::vertex_multiplicity(), ticl::Trackster::vertices(), z, and ticl::Trackster::zeroProbabilities().

Member Data Documentation

◆ associatorLayerClusterSimCluster_

edm::InputTag TrackstersFromSimClustersProducer::associatorLayerClusterSimCluster_
private

Definition at line 76 of file TrackstersFromSimClustersProducer.cc.

◆ associatorMapSimToReco_token_

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

Definition at line 77 of file TrackstersFromSimClustersProducer.cc.

Referenced by produce().

◆ clusters_token_

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

Definition at line 70 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 71 of file TrackstersFromSimClustersProducer.cc.

Referenced by produce().

◆ detector_

std::string TrackstersFromSimClustersProducer::detector_
private

Definition at line 68 of file TrackstersFromSimClustersProducer.cc.

◆ doNose_

const bool TrackstersFromSimClustersProducer::doNose_ = false
private

Definition at line 69 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 72 of file TrackstersFromSimClustersProducer.cc.

Referenced by produce().

◆ geom_token_

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

Definition at line 78 of file TrackstersFromSimClustersProducer.cc.

Referenced by produce().

◆ rhtools_

hgcal::RecHitTools TrackstersFromSimClustersProducer::rhtools_
private

Definition at line 79 of file TrackstersFromSimClustersProducer.cc.

Referenced by produce().

◆ simclusters_token_

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

Definition at line 74 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:72
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89281
ticl::Trackster::setSeed
void setSeed(edm::ProductID pid, int index)
Definition: Trackster.h:59
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
TrackstersFromSimClustersProducer::simclusters_token_
edm::EDGetTokenT< std::vector< SimCluster > > simclusters_token_
Definition: TrackstersFromSimClustersProducer.cc:74
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
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:52802
ticl::Trackster::zeroProbabilities
void zeroProbabilities()
Definition: Trackster.h:107
contentValuesCheck.values
values
Definition: contentValuesCheck.py:38
ticl::Trackster::vertex_multiplicity
std::vector< uint8_t > & vertex_multiplicity()
Definition: Trackster.h:57
DDAxes::z
TrackstersFromSimClustersProducer::associatorLayerClusterSimCluster_
edm::InputTag associatorLayerClusterSimCluster_
Definition: TrackstersFromSimClustersProducer.cc:76
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
SimTracksters_cff.simclusters
simclusters
Definition: SimTracksters_cff.py:23
HLTEgPhaseIITestSequence_cff.layerClusters
layerClusters
Definition: HLTEgPhaseIITestSequence_cff.py:2506
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TrackstersFromSimClustersProducer::clustersTime_token_
const edm::EDGetTokenT< edm::ValueMap< std::pair< float, float > > > clustersTime_token_
Definition: TrackstersFromSimClustersProducer.cc:71
hgcal::RecHitTools::lastLayerEE
unsigned int lastLayerEE(bool nose=false) const
Definition: RecHitTools.h:64
TrackstersFromSimClustersProducer::geom_token_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geom_token_
Definition: TrackstersFromSimClustersProducer.cc:78
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
hgcal::RecHitTools::getPositionLayer
GlobalPoint getPositionLayer(int layer, bool nose=false) const
Definition: RecHitTools.cc:138
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:70
TrackstersFromSimClustersProducer::doNose_
const bool doNose_
Definition: TrackstersFromSimClustersProducer.cc:69
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
TrackstersFromSimClustersProducer::associatorMapSimToReco_token_
edm::EDGetTokenT< hgcal::SimToRecoCollectionWithSimClusters > associatorMapSimToReco_token_
Definition: TrackstersFromSimClustersProducer.cc:77
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:79
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
edm::Event::get
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:342
edm::InputTag
Definition: InputTag.h:15
TrackstersFromSimClustersProducer::detector_
std::string detector_
Definition: TrackstersFromSimClustersProducer.cc:68
ticl::Trackster
Definition: Trackster.h:19
ticl::Trackster::setIdProbability
void setIdProbability(ParticleType type, float value)
Definition: Trackster.h:117