CMS 3D CMS Logo

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

Public Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 
 TrackstersProducer (const edm::ParameterSet &)
 
 ~TrackstersProducer () 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)
 
static void globalEndJob (TrackstersCache *)
 
static std::unique_ptr< TrackstersCacheinitializeGlobalCache (const edm::ParameterSet &)
 

Private Attributes

const edm::EDGetTokenT< std::vector< reco::CaloCluster > > clusters_token_
 
const edm::EDGetTokenT< edm::ValueMap< std::pair< float, float > > > clustersTime_token_
 
std::string detector_
 
bool doNose_
 
const edm::EDGetTokenT< std::vector< float > > filtered_layerclusters_mask_token_
 
ticl::Trackster::IterationIndex iterIndex_ = ticl::Trackster::IterationIndex(0)
 
const std::string itername_
 
edm::EDGetTokenT< TICLLayerTilesHFNoselayer_clusters_tiles_hfnose_token_
 
edm::EDGetTokenT< TICLLayerTileslayer_clusters_tiles_token_
 
std::unique_ptr< PatternRecognitionAlgoBaseT< TICLLayerTiles > > myAlgo_
 
std::unique_ptr< PatternRecognitionAlgoBaseT< TICLLayerTilesHFNose > > myAlgoHFNose_
 
const edm::EDGetTokenT< std::vector< float > > original_layerclusters_mask_token_
 
const edm::EDGetTokenT< std::vector< TICLSeedingRegion > > seeding_regions_token_
 
const std::string tfDnnLabel_
 
const edm::ESGetToken< TfGraphDefWrapper, TfGraphRecordtfDnnToken_
 
const tensorflow::Session * tfSession_
 

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 32 of file TrackstersProducer.cc.

Constructor & Destructor Documentation

◆ TrackstersProducer()

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

Definition at line 65 of file TrackstersProducer.cc.

References doNose_, ticl::Trackster::EM, get, edm::ParameterSet::getParameter(), ticl::Trackster::HAD, iterIndex_, itername_, layer_clusters_tiles_hfnose_token_, layer_clusters_tiles_token_, ticl::Trackster::MIP, myAlgo_, myAlgoHFNose_, HLT_2024v14_cff::plugin, AlCaHLTBitMon_QueryRunRegistry::string, ticl::Trackster::TRKEM, and ticl::Trackster::TRKHAD.

66  : detector_(ps.getParameter<std::string>("detector")),
67  doNose_(detector_ == "HFNose"),
68  tfDnnLabel_(ps.getParameter<std::string>("tfDnnLabel")),
70  tfSession_(nullptr),
71  clusters_token_(consumes<std::vector<reco::CaloCluster>>(ps.getParameter<edm::InputTag>("layer_clusters"))),
72  filtered_layerclusters_mask_token_(consumes<std::vector<float>>(ps.getParameter<edm::InputTag>("filtered_mask"))),
73  original_layerclusters_mask_token_(consumes<std::vector<float>>(ps.getParameter<edm::InputTag>("original_mask"))),
75  consumes<edm::ValueMap<std::pair<float, float>>>(ps.getParameter<edm::InputTag>("time_layerclusters"))),
77  consumes<std::vector<TICLSeedingRegion>>(ps.getParameter<edm::InputTag>("seeding_regions"))),
78  itername_(ps.getParameter<std::string>("itername")) {
79  auto plugin = ps.getParameter<std::string>("patternRecognitionBy");
80  auto pluginPSet = ps.getParameter<edm::ParameterSet>("pluginPatternRecognitionBy" + plugin);
81  if (doNose_) {
83  ps.getParameter<std::string>("patternRecognitionBy"), pluginPSet, consumesCollector());
85  consumes<TICLLayerTilesHFNose>(ps.getParameter<edm::InputTag>("layer_clusters_hfnose_tiles"));
86  } else {
88  ps.getParameter<std::string>("patternRecognitionBy"), pluginPSet, consumesCollector());
89  layer_clusters_tiles_token_ = consumes<TICLLayerTiles>(ps.getParameter<edm::InputTag>("layer_clusters_tiles"));
90  }
91 
92  if (itername_ == "TrkEM")
94  else if (itername_ == "EM")
96  else if (itername_ == "Trk")
98  else if (itername_ == "HAD")
100  else if (itername_ == "MIP")
102 
103  produces<std::vector<Trackster>>();
104  produces<std::vector<float>>(); // Mask to be applied at the next iteration
105 }
ticl::Trackster::IterationIndex iterIndex_
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetTokenT< TICLLayerTilesHFNose > layer_clusters_tiles_hfnose_token_
const edm::EDGetTokenT< std::vector< reco::CaloCluster > > clusters_token_
const edm::EDGetTokenT< std::vector< float > > original_layerclusters_mask_token_
const std::string tfDnnLabel_
const tensorflow::Session * tfSession_
edm::EDGetTokenT< TICLLayerTiles > layer_clusters_tiles_token_
const std::string itername_
const edm::EDGetTokenT< std::vector< TICLSeedingRegion > > seeding_regions_token_
const edm::EDGetTokenT< edm::ValueMap< std::pair< float, float > > > clustersTime_token_
std::unique_ptr< PatternRecognitionAlgoBaseT< TICLLayerTiles > > myAlgo_
const edm::EDGetTokenT< std::vector< float > > filtered_layerclusters_mask_token_
const edm::ESGetToken< TfGraphDefWrapper, TfGraphRecord > tfDnnToken_
#define get
std::unique_ptr< PatternRecognitionAlgoBaseT< TICLLayerTilesHFNose > > myAlgoHFNose_

◆ ~TrackstersProducer()

TrackstersProducer::~TrackstersProducer ( )
inlineoverride

Definition at line 35 of file TrackstersProducer.cc.

35 {}

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 107 of file TrackstersProducer.cc.

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

107  {
108  // hgcalMultiClusters
110  desc.add<std::string>("detector", "HGCAL");
111  desc.add<edm::InputTag>("layer_clusters", edm::InputTag("hgcalMergeLayerClusters"));
112  desc.add<edm::InputTag>("filtered_mask", edm::InputTag("filteredLayerClusters", "iterationLabelGoesHere"));
113  desc.add<edm::InputTag>("original_mask", edm::InputTag("hgcalMergeLayerClusters", "InitialLayerClustersMask"));
114  desc.add<edm::InputTag>("time_layerclusters", edm::InputTag("hgcalMergeLayerClusters", "timeLayerCluster"));
115  desc.add<edm::InputTag>("layer_clusters_tiles", edm::InputTag("ticlLayerTileProducer"));
116  desc.add<edm::InputTag>("layer_clusters_hfnose_tiles", edm::InputTag("ticlLayerTileHFNose"));
117  desc.add<edm::InputTag>("seeding_regions", edm::InputTag("ticlSeedingRegionProducer"));
118  desc.add<std::string>("patternRecognitionBy", "CA");
119  desc.add<std::string>("itername", "unknown");
120  desc.add<std::string>("tfDnnLabel", "tracksterSelectionTf");
121 
122  // CA Plugin
123  edm::ParameterSetDescription pluginDesc;
124  pluginDesc.addNode(edm::PluginDescription<PatternRecognitionFactory>("type", "CA", true));
125  desc.add<edm::ParameterSetDescription>("pluginPatternRecognitionByCA", pluginDesc);
126  //
127  // CLUE3D Plugin
128  edm::ParameterSetDescription pluginDescClue3D;
129  pluginDescClue3D.addNode(edm::PluginDescription<PatternRecognitionFactory>("type", "CLUE3D", true));
130  desc.add<edm::ParameterSetDescription>("pluginPatternRecognitionByCLUE3D", pluginDescClue3D);
131 
132  // FastJet Plugin
133  edm::ParameterSetDescription pluginDescFastJet;
134  pluginDescFastJet.addNode(edm::PluginDescription<PatternRecognitionFactory>("type", "FastJet", true));
135  desc.add<edm::ParameterSetDescription>("pluginPatternRecognitionByFastJet", pluginDescFastJet);
136 
137  // PassThrough Plugin
138  edm::ParameterSetDescription pluginDescPassThrough;
139  pluginDescPassThrough.addNode(edm::PluginDescription<PatternRecognitionFactory>("type", "Passthrough", true));
140  desc.add<edm::ParameterSetDescription>("pluginPatternRecognitionByPassthrough", pluginDescPassThrough);
141 
142  descriptions.add("trackstersProducer", desc);
143 }
ParameterDescriptionNode * addNode(ParameterDescriptionNode const &node)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ globalEndJob()

static void TrackstersProducer::globalEndJob ( TrackstersCache )
static

◆ initializeGlobalCache()

static std::unique_ptr<TrackstersCache> TrackstersProducer::initializeGlobalCache ( const edm::ParameterSet )
static

◆ produce()

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

Definition at line 145 of file TrackstersProducer.cc.

References clusters_token_, clustersTime_token_, filterCSVwithJSON::copy, doNose_, filtered_layerclusters_mask_token_, edm::Event::get(), edm::EventSetup::getData(), mps_fire::i, input, iterIndex_, hltTiclTrackstersCLUE3DHigh_cfi::layer_clusters_hfnose_tiles, hltTiclTrackstersCLUE3DHigh_cfi::layer_clusters_tiles, layer_clusters_tiles_hfnose_token_, layer_clusters_tiles_token_, hltEgammaHGCALIDVarsL1Seeded_cfi::layerClusters, eostools::move(), myAlgo_, myAlgoHFNose_, original_layerclusters_mask_token_, edm::Event::put(), mps_fire::result, hltTiclTrackstersCLUE3DHigh_cfi::seeding_regions, seeding_regions_token_, tfDnnToken_, tfSession_, and findQualityFiles::v.

145  {
146  auto result = std::make_unique<std::vector<Trackster>>();
147  auto output_mask = std::make_unique<std::vector<float>>();
148 
149  const std::vector<float>& original_layerclusters_mask = evt.get(original_layerclusters_mask_token_);
150  const auto& layerClusters = evt.get(clusters_token_);
151  const auto& inputClusterMask = evt.get(filtered_layerclusters_mask_token_);
152  const auto& layerClustersTimes = evt.get(clustersTime_token_);
153  const auto& seeding_regions = evt.get(seeding_regions_token_);
154 
155  tfSession_ = es.getData(tfDnnToken_).getSession();
156 
157  std::unordered_map<int, std::vector<int>> seedToTrackstersAssociation;
158  // if it's regional iteration and there are seeding regions
159  if (!seeding_regions.empty() and seeding_regions[0].index != -1) {
160  auto numberOfSeedingRegions = seeding_regions.size();
161  for (unsigned int i = 0; i < numberOfSeedingRegions; ++i) {
162  seedToTrackstersAssociation.emplace(seeding_regions[i].index, 0);
163  }
164  }
165 
166  if (doNose_) {
168  const typename PatternRecognitionAlgoBaseT<TICLLayerTilesHFNose>::Inputs inputHFNose(evt,
169  es,
171  inputClusterMask,
172  layerClustersTimes,
175  tfSession_);
176 
177  myAlgoHFNose_->makeTracksters(inputHFNose, *result, seedToTrackstersAssociation);
178 
179  } else {
182  evt, es, layerClusters, inputClusterMask, layerClustersTimes, layer_clusters_tiles, seeding_regions, tfSession_);
183 
184  myAlgo_->makeTracksters(input, *result, seedToTrackstersAssociation);
185  }
186  // Now update the global mask and put it into the event
187  output_mask->reserve(original_layerclusters_mask.size());
188  // Copy over the previous state
189  std::copy(
190  std::begin(original_layerclusters_mask), std::end(original_layerclusters_mask), std::back_inserter(*output_mask));
191 
192  for (auto& trackster : *result) {
193  trackster.setIteration(iterIndex_);
194  // Mask the used elements, accordingly
195  for (auto const v : trackster.vertices()) {
196  // TODO(rovere): for the moment we mask the layer cluster completely. In
197  // the future, properly compute the fraction of usage.
198  (*output_mask)[v] = 0.;
199  }
200  }
201 
202  evt.put(std::move(result));
203  evt.put(std::move(output_mask));
204 }
ticl::Trackster::IterationIndex iterIndex_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
edm::EDGetTokenT< TICLLayerTilesHFNose > layer_clusters_tiles_hfnose_token_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:344
const edm::EDGetTokenT< std::vector< reco::CaloCluster > > clusters_token_
const edm::EDGetTokenT< std::vector< float > > original_layerclusters_mask_token_
static std::string const input
Definition: EdmProvDump.cc:50
const tensorflow::Session * tfSession_
edm::EDGetTokenT< TICLLayerTiles > layer_clusters_tiles_token_
const edm::EDGetTokenT< std::vector< TICLSeedingRegion > > seeding_regions_token_
const edm::EDGetTokenT< edm::ValueMap< std::pair< float, float > > > clustersTime_token_
std::unique_ptr< PatternRecognitionAlgoBaseT< TICLLayerTiles > > myAlgo_
const edm::EDGetTokenT< std::vector< float > > filtered_layerclusters_mask_token_
const edm::ESGetToken< TfGraphDefWrapper, TfGraphRecord > tfDnnToken_
std::unique_ptr< PatternRecognitionAlgoBaseT< TICLLayerTilesHFNose > > myAlgoHFNose_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ clusters_token_

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

Definition at line 53 of file TrackstersProducer.cc.

Referenced by produce().

◆ clustersTime_token_

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

Definition at line 56 of file TrackstersProducer.cc.

Referenced by produce().

◆ detector_

std::string TrackstersProducer::detector_
private

Definition at line 45 of file TrackstersProducer.cc.

◆ doNose_

bool TrackstersProducer::doNose_
private

Definition at line 46 of file TrackstersProducer.cc.

Referenced by produce(), and TrackstersProducer().

◆ filtered_layerclusters_mask_token_

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

Definition at line 54 of file TrackstersProducer.cc.

Referenced by produce().

◆ iterIndex_

ticl::Trackster::IterationIndex TrackstersProducer::iterIndex_ = ticl::Trackster::IterationIndex(0)
private

Definition at line 61 of file TrackstersProducer.cc.

Referenced by produce(), and TrackstersProducer().

◆ itername_

const std::string TrackstersProducer::itername_
private

Definition at line 60 of file TrackstersProducer.cc.

Referenced by TrackstersProducer().

◆ layer_clusters_tiles_hfnose_token_

edm::EDGetTokenT<TICLLayerTilesHFNose> TrackstersProducer::layer_clusters_tiles_hfnose_token_
private

Definition at line 58 of file TrackstersProducer.cc.

Referenced by produce(), and TrackstersProducer().

◆ layer_clusters_tiles_token_

edm::EDGetTokenT<TICLLayerTiles> TrackstersProducer::layer_clusters_tiles_token_
private

Definition at line 57 of file TrackstersProducer.cc.

Referenced by produce(), and TrackstersProducer().

◆ myAlgo_

std::unique_ptr<PatternRecognitionAlgoBaseT<TICLLayerTiles> > TrackstersProducer::myAlgo_
private

Definition at line 50 of file TrackstersProducer.cc.

Referenced by produce(), and TrackstersProducer().

◆ myAlgoHFNose_

std::unique_ptr<PatternRecognitionAlgoBaseT<TICLLayerTilesHFNose> > TrackstersProducer::myAlgoHFNose_
private

Definition at line 51 of file TrackstersProducer.cc.

Referenced by produce(), and TrackstersProducer().

◆ original_layerclusters_mask_token_

const edm::EDGetTokenT<std::vector<float> > TrackstersProducer::original_layerclusters_mask_token_
private

Definition at line 55 of file TrackstersProducer.cc.

Referenced by produce().

◆ seeding_regions_token_

const edm::EDGetTokenT<std::vector<TICLSeedingRegion> > TrackstersProducer::seeding_regions_token_
private

Definition at line 59 of file TrackstersProducer.cc.

Referenced by produce().

◆ tfDnnLabel_

const std::string TrackstersProducer::tfDnnLabel_
private

Definition at line 47 of file TrackstersProducer.cc.

◆ tfDnnToken_

const edm::ESGetToken<TfGraphDefWrapper, TfGraphRecord> TrackstersProducer::tfDnnToken_
private

Definition at line 48 of file TrackstersProducer.cc.

Referenced by produce().

◆ tfSession_

const tensorflow::Session* TrackstersProducer::tfSession_
private

Definition at line 49 of file TrackstersProducer.cc.

Referenced by produce().