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< edm::GlobalCache< TrackstersCache > >

Public Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 
 TrackstersProducer (const edm::ParameterSet &, const TrackstersCache *)
 
 ~TrackstersProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< TrackstersCache > >
 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)
 
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_
 
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_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< TrackstersCache > >
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 32 of file TrackstersProducer.cc.

Constructor & Destructor Documentation

◆ TrackstersProducer()

TrackstersProducer::TrackstersProducer ( const edm::ParameterSet ps,
const TrackstersCache cache 
)
explicit

Definition at line 81 of file TrackstersProducer.cc.

82  : detector_(ps.getParameter<std::string>("detector")),
83  doNose_(detector_ == "HFNose"),
86  clusters_token_(consumes<std::vector<reco::CaloCluster>>(ps.getParameter<edm::InputTag>("layer_clusters"))),
87  filtered_layerclusters_mask_token_(consumes<std::vector<float>>(ps.getParameter<edm::InputTag>("filtered_mask"))),
88  original_layerclusters_mask_token_(consumes<std::vector<float>>(ps.getParameter<edm::InputTag>("original_mask"))),
90  consumes<edm::ValueMap<std::pair<float, float>>>(ps.getParameter<edm::InputTag>("time_layerclusters"))),
92  consumes<std::vector<TICLSeedingRegion>>(ps.getParameter<edm::InputTag>("seeding_regions"))),
93  itername_(ps.getParameter<std::string>("itername")) {
94  if (doNose_) {
96  consumes<TICLLayerTilesHFNose>(ps.getParameter<edm::InputTag>("layer_clusters_hfnose_tiles"));
97  } else {
98  layer_clusters_tiles_token_ = consumes<TICLLayerTiles>(ps.getParameter<edm::InputTag>("layer_clusters_tiles"));
99  }
100 
101  if (itername_ == "TrkEM")
103  else if (itername_ == "EM")
105  else if (itername_ == "Trk")
107  else if (itername_ == "HAD")
109  else if (itername_ == "MIP")
111 
112  produces<std::vector<Trackster>>();
113  produces<std::vector<float>>(); // Mask to be applied at the next iteration
114 }

References doNose_, ticl::Trackster::EM, edm::ParameterSet::getParameter(), ticl::Trackster::HAD, iterIndex_, itername_, layer_clusters_tiles_hfnose_token_, layer_clusters_tiles_token_, ticl::Trackster::MIP, ticl::Trackster::TRKEM, and ticl::Trackster::TRKHAD.

◆ ~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 116 of file TrackstersProducer.cc.

116  {
117  // hgcalMultiClusters
119  desc.add<std::string>("detector", "HGCAL");
120  desc.add<edm::InputTag>("layer_clusters", edm::InputTag("hgcalLayerClusters"));
121  desc.add<edm::InputTag>("filtered_mask", edm::InputTag("filteredLayerClusters", "iterationLabelGoesHere"));
122  desc.add<edm::InputTag>("original_mask", edm::InputTag("hgcalLayerClusters", "InitialLayerClustersMask"));
123  desc.add<edm::InputTag>("time_layerclusters", edm::InputTag("hgcalLayerClusters", "timeLayerCluster"));
124  desc.add<edm::InputTag>("layer_clusters_tiles", edm::InputTag("ticlLayerTileProducer"));
125  desc.add<edm::InputTag>("layer_clusters_hfnose_tiles", edm::InputTag("ticlLayerTileHFNose"));
126  desc.add<edm::InputTag>("seeding_regions", edm::InputTag("ticlSeedingRegionProducer"));
127  desc.add<std::vector<int>>("filter_on_categories", {0});
128  desc.add<double>("pid_threshold", 0.); // make default such that no filtering is applied
129  desc.add<double>("energy_em_over_total_threshold", -1.); // make default such that no filtering is applied
130  desc.add<double>("max_longitudinal_sigmaPCA", 9999);
131  desc.add<int>("shower_start_max_layer", 9999); // make default such that no filtering is applied
132  desc.add<int>("algo_verbosity", 0);
133  desc.add<double>("min_cos_theta", 0.915);
134  desc.add<double>("root_doublet_max_distance_from_seed_squared", 9999);
135  desc.add<double>("min_cos_pointing", -1.);
136  desc.add<int>("skip_layers", 0);
137  desc.add<int>("max_missing_layers_in_trackster", 9999);
138  desc.add<double>("etaLimitIncreaseWindow", 2.1);
139  desc.add<int>("min_layers_per_trackster", 10);
140  desc.add<double>("max_delta_time", 3.); //nsigma
141  desc.add<bool>("out_in_dfs", true);
142  desc.add<int>("max_out_in_hops", 10);
143  desc.add<bool>("oneTracksterPerTrackSeed", false);
144  desc.add<bool>("promoteEmptyRegionToTrackster", false);
145  desc.add<std::string>("eid_graph_path", "RecoHGCal/TICL/data/tf_models/energy_id_v0.pb");
146  desc.add<std::string>("eid_input_name", "input");
147  desc.add<std::string>("eid_output_name_energy", "output/regressed_energy");
148  desc.add<std::string>("eid_output_name_id", "output/id_probabilities");
149  desc.add<std::string>("itername", "unknown");
150  desc.add<double>("eid_min_cluster_energy", 1.);
151  desc.add<int>("eid_n_layers", 50);
152  desc.add<int>("eid_n_clusters", 10);
153  descriptions.add("trackstersProducer", desc);
154 }

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

◆ globalEndJob()

void TrackstersProducer::globalEndJob ( TrackstersCache cache)
static

Definition at line 76 of file TrackstersProducer.cc.

76  {
77  delete cache->eidGraphDef;
78  cache->eidGraphDef = nullptr;
79 }

References utilities::cache().

◆ initializeGlobalCache()

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

Definition at line 62 of file TrackstersProducer.cc.

62  {
63  // this method is supposed to create, initialize and return a TrackstersCache instance
64  std::unique_ptr<TrackstersCache> cache = std::make_unique<TrackstersCache>(params);
65 
66  // load the graph def and save it
67  std::string graphPath = params.getParameter<std::string>("eid_graph_path");
68  if (!graphPath.empty()) {
69  graphPath = edm::FileInPath(graphPath).fullPath();
70  cache->eidGraphDef = tensorflow::loadGraphDef(graphPath);
71  }
72 
73  return cache;
74 }

References utilities::cache(), edm::FileInPath::fullPath(), tensorflow::loadGraphDef(), CalibrationSummaryClient_cfi::params, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ produce()

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

Definition at line 156 of file TrackstersProducer.cc.

156  {
157  auto result = std::make_unique<std::vector<Trackster>>();
158  auto output_mask = std::make_unique<std::vector<float>>();
159 
160  const std::vector<float>& original_layerclusters_mask = evt.get(original_layerclusters_mask_token_);
161  const auto& layerClusters = evt.get(clusters_token_);
162  const auto& inputClusterMask = evt.get(filtered_layerclusters_mask_token_);
163  const auto& layerClustersTimes = evt.get(clustersTime_token_);
164  const auto& seeding_regions = evt.get(seeding_regions_token_);
165 
166  std::unordered_map<int, std::vector<int>> seedToTrackstersAssociation;
167  // if it's regional iteration and there are seeding regions
168  if (!seeding_regions.empty() and seeding_regions[0].index != -1) {
169  auto numberOfSeedingRegions = seeding_regions.size();
170  for (unsigned int i = 0; i < numberOfSeedingRegions; ++i) {
171  seedToTrackstersAssociation.emplace(seeding_regions[i].index, 0);
172  }
173  }
174 
175  if (doNose_) {
178  evt, es, layerClusters, inputClusterMask, layerClustersTimes, layer_clusters_hfnose_tiles, seeding_regions);
179 
180  myAlgoHFNose_->makeTracksters(inputHFNose, *result, seedToTrackstersAssociation);
181 
182  } else {
185  evt, es, layerClusters, inputClusterMask, layerClustersTimes, layer_clusters_tiles, seeding_regions);
186 
187  myAlgo_->makeTracksters(input, *result, seedToTrackstersAssociation);
188  }
189  // Now update the global mask and put it into the event
190  output_mask->reserve(original_layerclusters_mask.size());
191  // Copy over the previous state
192  std::copy(
193  std::begin(original_layerclusters_mask), std::end(original_layerclusters_mask), std::back_inserter(*output_mask));
194 
195  for (auto& trackster : *result) {
196  trackster.setIteration(iterIndex_);
197  // Mask the used elements, accordingly
198  for (auto const v : trackster.vertices()) {
199  // TODO(rovere): for the moment we mask the layer cluster completely. In
200  // the future, properly compute the fraction of usage.
201  (*output_mask)[v] = 0.;
202  }
203  }
204 
205  evt.put(std::move(result));
206  evt.put(std::move(output_mask));
207 }

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

Member Data Documentation

◆ clusters_token_

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

Definition at line 50 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 53 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 51 of file TrackstersProducer.cc.

Referenced by produce().

◆ iterIndex_

ticl::Trackster::IterationIndex TrackstersProducer::iterIndex_
private

Definition at line 58 of file TrackstersProducer.cc.

Referenced by produce(), and TrackstersProducer().

◆ itername_

const std::string TrackstersProducer::itername_
private

Definition at line 57 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 55 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 54 of file TrackstersProducer.cc.

Referenced by produce(), and TrackstersProducer().

◆ myAlgo_

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

Definition at line 47 of file TrackstersProducer.cc.

Referenced by produce().

◆ myAlgoHFNose_

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

Definition at line 48 of file TrackstersProducer.cc.

Referenced by produce().

◆ original_layerclusters_mask_token_

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

Definition at line 52 of file TrackstersProducer.cc.

Referenced by produce().

◆ seeding_regions_token_

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

Definition at line 56 of file TrackstersProducer.cc.

Referenced by produce().

mps_fire.i
i
Definition: mps_fire.py:428
input
static const std::string input
Definition: EdmProvDump.cc:48
HLTEgPhaseIITestSequence_cff.seeding_regions
seeding_regions
Definition: HLTEgPhaseIITestSequence_cff.py:2218
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
TrackstersProducer::detector_
std::string detector_
Definition: TrackstersProducer.cc:45
TrackstersProducer::myAlgo_
std::unique_ptr< PatternRecognitionAlgoBaseT< TICLLayerTiles > > myAlgo_
Definition: TrackstersProducer.cc:47
ticl::Trackster::TRKEM
Definition: Trackster.h:23
HLTEgPhaseIITestSequence_cff.layer_clusters_tiles
layer_clusters_tiles
Definition: HLTEgPhaseIITestSequence_cff.py:2203
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89285
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
ticl::Trackster::EM
Definition: Trackster.h:23
TrackstersProducer::layer_clusters_tiles_token_
edm::EDGetTokenT< TICLLayerTiles > layer_clusters_tiles_token_
Definition: TrackstersProducer.cc:54
findQualityFiles.v
v
Definition: findQualityFiles.py:179
TrackstersProducer::clustersTime_token_
const edm::EDGetTokenT< edm::ValueMap< std::pair< float, float > > > clustersTime_token_
Definition: TrackstersProducer.cc:53
TrackstersProducer::seeding_regions_token_
const edm::EDGetTokenT< std::vector< TICLSeedingRegion > > seeding_regions_token_
Definition: TrackstersProducer.cc:56
edm::FileInPath
Definition: FileInPath.h:64
ticl::Trackster::HAD
Definition: Trackster.h:23
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
mps_fire.end
end
Definition: mps_fire.py:242
HLTEgPhaseIITestSequence_cff.layerClusters
layerClusters
Definition: HLTEgPhaseIITestSequence_cff.py:2506
utilities.cache
def cache(function)
Definition: utilities.py:3
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ticl::Trackster::MIP
Definition: Trackster.h:23
TrackstersProducer::iterIndex_
ticl::Trackster::IterationIndex iterIndex_
Definition: TrackstersProducer.cc:58
TrackstersProducer::doNose_
bool doNose_
Definition: TrackstersProducer.cc:46
ticl::Trackster::TRKHAD
Definition: Trackster.h:23
TrackstersProducer::clusters_token_
const edm::EDGetTokenT< std::vector< reco::CaloCluster > > clusters_token_
Definition: TrackstersProducer.cc:50
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
TrackstersProducer::itername_
const std::string itername_
Definition: TrackstersProducer.cc:57
TrackstersProducer::filtered_layerclusters_mask_token_
const edm::EDGetTokenT< std::vector< float > > filtered_layerclusters_mask_token_
Definition: TrackstersProducer.cc:51
HLTEgPhaseIITestSequence_cff.layer_clusters_hfnose_tiles
layer_clusters_hfnose_tiles
Definition: HLTEgPhaseIITestSequence_cff.py:2202
ticl::PatternRecognitionAlgoBaseT::Inputs
Definition: PatternRecognitionAlgoBase.h:30
tensorflow::loadGraphDef
GraphDef * loadGraphDef(const std::string &pbFile)
Definition: TensorFlow.cc:68
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
TrackstersProducer::myAlgoHFNose_
std::unique_ptr< PatternRecognitionAlgoBaseT< TICLLayerTilesHFNose > > myAlgoHFNose_
Definition: TrackstersProducer.cc:48
edm::ValueMap
Definition: ValueMap.h:107
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
mps_fire.result
result
Definition: mps_fire.py:311
ticl::PatternRecognitionbyCA
Definition: PatternRecognitionbyCA.h:14
TrackstersProducer::layer_clusters_tiles_hfnose_token_
edm::EDGetTokenT< TICLLayerTilesHFNose > layer_clusters_tiles_hfnose_token_
Definition: TrackstersProducer.cc:55
edm::Event::get
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:342
edm::InputTag
Definition: InputTag.h:15
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:161
TrackstersProducer::original_layerclusters_mask_token_
const edm::EDGetTokenT< std::vector< float > > original_layerclusters_mask_token_
Definition: TrackstersProducer.cc:52