CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
MTDClusterProducer Class Reference

EDProducer to cluster FTLRecHits into FTLClusters. More...

Inheritance diagram for MTDClusterProducer:
edm::stream::EDProducer<>

Public Member Functions

 MTDClusterProducer (const edm::ParameterSet &conf)
 Constructor: set the ParameterSet and defer all thinking to setupClusterizer(). More...
 
void produce (edm::Event &e, const edm::EventSetup &c) override
 The "Event" entrypoint: gets called by framework for every event. More...
 
template<typename T >
void run (const T &input, FTLClusterCollection &output)
 Iterate over DetUnits, and invoke the PixelClusterizer on each. More...
 
 ~MTDClusterProducer () override=default
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

const edm::EDGetTokenT< FTLRecHitCollectionbtlHits_
 
std::unique_ptr< MTDClusterizerBaseclusterizer_
 
const std::string clusterMode_
 
const edm::EDGetTokenT< FTLRecHitCollectionetlHits_
 
const std::string ftlbInstance_
 
const std::string ftleInstance_
 
const MTDGeometrygeom_
 
const MTDTopologytopo_
 

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

EDProducer to cluster FTLRecHits into FTLClusters.

Definition at line 39 of file MTDClusterProducer.cc.

Constructor & Destructor Documentation

MTDClusterProducer::MTDClusterProducer ( const edm::ParameterSet conf)
explicit

Constructor: set the ParameterSet and defer all thinking to setupClusterizer().

Definition at line 73 of file MTDClusterProducer.cc.

References clusterizer_, clusterMode_, Exception, ftlbInstance_, and ftleInstance_.

74  :
75  btlHits_(consumes< FTLRecHitCollection >( conf.getParameter<edm::InputTag>("srcBarrel"))),
76  etlHits_(consumes< FTLRecHitCollection >( conf.getParameter<edm::InputTag>("srcEndcap"))),
77  ftlbInstance_(conf.getParameter<std::string>("BarrelClusterName")),
78  ftleInstance_(conf.getParameter<std::string>("EndcapClusterName")),
79  clusterMode_( conf.getParameter<std::string>("ClusterMode") ),
80  clusterizer_(nullptr) // the default, in case we fail to make one
81 {
82 
83  //--- Declare to the EDM what kind of collections we will be making.
84  produces<FTLClusterCollection>(ftlbInstance_);
85  produces<FTLClusterCollection>(ftleInstance_);
86 
87  //--- Make the algorithm(s) according to what the user specified
88  //--- in the ParameterSet.
89  if ( clusterMode_ == "MTDThresholdClusterizer" ) {
90  clusterizer_ = std::make_unique<MTDThresholdClusterizer>(conf);
91  }
92  else {
93  throw cms::Exception("MTDClusterProducer") << "[MTDClusterProducer]:"
94  <<" choice " << clusterMode_ << " is invalid.\n"
95  << "Possible choices:\n"
96  << " MTDThresholdClusterizer";
97  }
98 }
T getParameter(std::string const &) const
std::unique_ptr< MTDClusterizerBase > clusterizer_
const edm::EDGetTokenT< FTLRecHitCollection > btlHits_
const edm::EDGetTokenT< FTLRecHitCollection > etlHits_
const std::string clusterMode_
const std::string ftlbInstance_
const std::string ftleInstance_
MTDClusterProducer::~MTDClusterProducer ( )
overridedefault

Member Function Documentation

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

Definition at line 102 of file MTDClusterProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), MTDThresholdClusterizer::fillDescriptions(), and AlCaHLTBitMon_QueryRunRegistry::string.

102  {
104  desc.add<edm::InputTag>("srcBarrel", edm::InputTag("mtdRecHits:FTLBarrel"));
105  desc.add<edm::InputTag>("srcEndcap", edm::InputTag("mtdRecHits:FTLEndcap"));
106  desc.add<std::string>("BarrelClusterName", "FTLBarrel");
107  desc.add<std::string>("EndcapClusterName", "FTLEndcap");
108  desc.add<std::string>("ClusterMode","MTDThresholdClusterizer");
110  descriptions.add("mtdClusterProducer", desc);
111 }
static void fillDescriptions(edm::ParameterSetDescription &desc)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void MTDClusterProducer::produce ( edm::Event e,
const edm::EventSetup c 
)
override

The "Event" entrypoint: gets called by framework for every event.

Definition at line 116 of file MTDClusterProducer.cc.

References btlHits_, etlHits_, ftlbInstance_, ftleInstance_, relativeConstraints::geom, geom_, edm::EventSetup::get(), edm::Event::getByToken(), eostools::move(), edm::ESHandle< T >::product(), edm::Event::put(), run(), and topo_.

117 {
118  // Step A.1: get input data
121  e.getByToken(btlHits_, inputBarrel);
122  e.getByToken(etlHits_, inputEndcap);
123 
124  // Step A.2: get event setup
126  es.get<MTDDigiGeometryRecord>().get(geom);
127  geom_ = geom.product();
128 
130  es.get<MTDTopologyRcd>().get(mtdTopo);
131  topo_ = mtdTopo.product();
132 
133  // Step B: create the final output collection
134  auto outputBarrel = std::make_unique<FTLClusterCollection>();
135  auto outputEndcap = std::make_unique<FTLClusterCollection>();
136 
137  run(*inputBarrel, *outputBarrel );
138  run(*inputEndcap, *outputEndcap );
139 
140  e.put(std::move(outputBarrel),ftlbInstance_);
141  e.put(std::move(outputEndcap),ftleInstance_);
142 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
const edm::EDGetTokenT< FTLRecHitCollection > btlHits_
const edm::EDGetTokenT< FTLRecHitCollection > etlHits_
const MTDTopology * topo_
void run(const T &input, FTLClusterCollection &output)
Iterate over DetUnits, and invoke the PixelClusterizer on each.
const std::string ftlbInstance_
const std::string ftleInstance_
T const * product() const
Definition: ESHandle.h:86
def move(src, dest)
Definition: eostools.py:511
const MTDGeometry * geom_
template<typename T >
void MTDClusterProducer::run ( const T input,
FTLClusterCollection output 
)

Iterate over DetUnits, and invoke the PixelClusterizer on each.

Definition at line 150 of file MTDClusterProducer.cc.

References clusterizer_, clusterMode_, DEFINE_FWK_MODULE, Exception, geom_, LogDebug, edmNew::DetSetVector< T >::size(), and topo_.

Referenced by produce().

152 {
153  if ( ! clusterizer_ ) {
154  throw cms::Exception("MTDClusterProducer")
155  <<" at least one clusterizer is not ready -- can't run!" ;
156  }
157 
158  clusterizer_->clusterize( input , geom_, topo_, output);
159 
160  LogDebug ("MTDClusterProducer") << " Executing "
161  << clusterMode_ << " resulted in " << output.size()
162  << " MTDClusters for " << input.size() << " Hits.";
163 }
#define LogDebug(id)
std::unique_ptr< MTDClusterizerBase > clusterizer_
static std::string const input
Definition: EdmProvDump.cc:48
const MTDTopology * topo_
const std::string clusterMode_
size_type size() const
const MTDGeometry * geom_

Member Data Documentation

const edm::EDGetTokenT< FTLRecHitCollection > MTDClusterProducer::btlHits_
private

Definition at line 56 of file MTDClusterProducer.cc.

Referenced by produce().

std::unique_ptr<MTDClusterizerBase> MTDClusterProducer::clusterizer_
private

Definition at line 63 of file MTDClusterProducer.cc.

Referenced by MTDClusterProducer(), and run().

const std::string MTDClusterProducer::clusterMode_
private

Definition at line 62 of file MTDClusterProducer.cc.

Referenced by MTDClusterProducer(), and run().

const edm::EDGetTokenT< FTLRecHitCollection > MTDClusterProducer::etlHits_
private

Definition at line 57 of file MTDClusterProducer.cc.

Referenced by produce().

const std::string MTDClusterProducer::ftlbInstance_
private

Definition at line 59 of file MTDClusterProducer.cc.

Referenced by MTDClusterProducer(), and produce().

const std::string MTDClusterProducer::ftleInstance_
private

Definition at line 60 of file MTDClusterProducer.cc.

Referenced by MTDClusterProducer(), and produce().

const MTDGeometry* MTDClusterProducer::geom_
private

Definition at line 65 of file MTDClusterProducer.cc.

Referenced by produce(), and run().

const MTDTopology* MTDClusterProducer::topo_
private

Definition at line 66 of file MTDClusterProducer.cc.

Referenced by produce(), and run().