CMS 3D CMS Logo

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

Public Member Functions

 MergeClusterProducer (const edm::ParameterSet &)
 Constructor with parameter settings - which can be changed in ...todo. Constructor will set all variables by input param ps. More...
 
void produce (edm::Event &, const edm::EventSetup &) override
 Method will merge the producers and put them back to event. More...
 
 ~MergeClusterProducer () 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)
 Method fill description which will be used in pyhton file. More...
 

Private Member Functions

void addTo (std::vector< std::pair< float, float >> &to, const edm::ValueMap< std::pair< float, float >> &vm)
 copy all values from vm to to More...
 
template<typename T >
void createMerge (edm::Event &evt, const edm::EDGetTokenT< T > &EE_token, const edm::EDGetTokenT< T > &HSi_token, const edm::EDGetTokenT< T > &HSci_token, T &merge)
 get info form event and then call merge More...
 
void mergeTime (edm::Event &evt, size_t size, std::vector< std::pair< float, float >> &times)
 Merge value map of time for all parts of detector together to vector times. More...
 
void mergeTogether (std::vector< reco::CaloCluster > &merge, const std::vector< reco::CaloCluster > &EE, const std::vector< reco::CaloCluster > &HSi, const std::vector< reco::CaloCluster > &HSci)
 method merge three vectors of reco::CaloCluster to one More...
 

Private Attributes

const edm::EDGetTokenT< edm::ValueMap< std::pair< float, float > > > clustersTimeEE_token_
 
const edm::EDGetTokenT< edm::ValueMap< std::pair< float, float > > > clustersTimeHSci_token_
 
const edm::EDGetTokenT< edm::ValueMap< std::pair< float, float > > > clustersTimeHSi_token_
 
edm::EDGetTokenT< std::vector< reco::CaloCluster > > EEclusters_token_
 
edm::EDGetTokenT< std::vector< reco::CaloCluster > > HSciclusters_token_
 
edm::EDGetTokenT< std::vector< reco::CaloCluster > > HSiclusters_token_
 
std::string timeClname_
 

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 15 of file MergeClusterProducer.cc.

Constructor & Destructor Documentation

◆ MergeClusterProducer()

MergeClusterProducer::MergeClusterProducer ( const edm::ParameterSet ps)

Constructor with parameter settings - which can be changed in ...todo. Constructor will set all variables by input param ps.

Parameters
[in]psparametr set to set variables

Definition at line 120 of file MergeClusterProducer.cc.

References EEclusters_token_, edm::ParameterSet::getParameter(), HSciclusters_token_, HSiclusters_token_, and timeClname_.

121  : timeClname_(ps.getParameter<std::string>("timeClname")),
123  consumes<edm::ValueMap<std::pair<float, float>>>(ps.getParameter<edm::InputTag>("time_layerclustersEE"))),
125  consumes<edm::ValueMap<std::pair<float, float>>>(ps.getParameter<edm::InputTag>("time_layerclustersHSi"))),
127  consumes<edm::ValueMap<std::pair<float, float>>>(ps.getParameter<edm::InputTag>("time_layerclustersHSci"))) {
128  EEclusters_token_ = consumes<std::vector<reco::CaloCluster>>(ps.getParameter<edm::InputTag>("layerClustersEE"));
129  HSiclusters_token_ = consumes<std::vector<reco::CaloCluster>>(ps.getParameter<edm::InputTag>("layerClustersHSi"));
130  HSciclusters_token_ = consumes<std::vector<reco::CaloCluster>>(ps.getParameter<edm::InputTag>("layerClustersHSci"));
131 
132  produces<std::vector<float>>("InitialLayerClustersMask");
133  produces<std::vector<reco::BasicCluster>>();
134  produces<std::vector<reco::BasicCluster>>("sharing");
135  //time for layer clusters
136  produces<edm::ValueMap<std::pair<float, float>>>(timeClname_);
137 }
const edm::EDGetTokenT< edm::ValueMap< std::pair< float, float > > > clustersTimeHSi_token_
edm::EDGetTokenT< std::vector< reco::CaloCluster > > HSiclusters_token_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::EDGetTokenT< edm::ValueMap< std::pair< float, float > > > clustersTimeHSci_token_
edm::EDGetTokenT< std::vector< reco::CaloCluster > > EEclusters_token_
edm::EDGetTokenT< std::vector< reco::CaloCluster > > HSciclusters_token_
const edm::EDGetTokenT< edm::ValueMap< std::pair< float, float > > > clustersTimeEE_token_

◆ ~MergeClusterProducer()

MergeClusterProducer::~MergeClusterProducer ( )
inlineoverride

Definition at line 24 of file MergeClusterProducer.cc.

24 {}

Member Function Documentation

◆ addTo()

void MergeClusterProducer::addTo ( std::vector< std::pair< float, float >> &  to,
const edm::ValueMap< std::pair< float, float >> &  vm 
)
inlineprivate

copy all values from vm to to

Parameters
[in]vmValue map with values
[out]tovector to will be copy value map

Definition at line 69 of file MergeClusterProducer.cc.

References mps_fire::i, and findQualityFiles::size.

Referenced by mergeTime().

69  {
70  size_t size = vm.size();
71  for (size_t i = 0; i < size; ++i) {
72  to.push_back(vm.get(i));
73  }
74  }
size
Write out results.
const_reference_type get(ProductID id, size_t idx) const
Definition: ValueMap.h:144
size_t size() const
Definition: ValueMap.h:156

◆ createMerge()

template<typename T >
void MergeClusterProducer::createMerge ( edm::Event evt,
const edm::EDGetTokenT< T > &  EE_token,
const edm::EDGetTokenT< T > &  HSi_token,
const edm::EDGetTokenT< T > &  HSci_token,
T merge 
)
inlineprivate

get info form event and then call merge

it is used for merge and clusters and time

Parameters
[in]evtEvent
[in]EE_tokentoken for Electromagnetic silicon
[in]HSi_tokentoken for Hardon silicon
[in]ESci_tokentoken for hadron scintillator
Returns
merged result

Definition at line 106 of file MergeClusterProducer.cc.

References EE, edm::Event::getByToken(), and mergeTogether().

Referenced by produce().

110  {
111  edm::Handle<T> EE, HSi, HSci;
112  // get values from all three part of detectors
113  evt.getByToken(EE_token, EE);
114  evt.getByToken(HSi_token, HSi);
115  evt.getByToken(HSci_token, HSci);
116  mergeTogether(merge, *EE, *HSi, *HSci);
117  }
Definition: merge.py:1
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:536
void mergeTogether(std::vector< reco::CaloCluster > &merge, const std::vector< reco::CaloCluster > &EE, const std::vector< reco::CaloCluster > &HSi, const std::vector< reco::CaloCluster > &HSci)
method merge three vectors of reco::CaloCluster to one

◆ fillDescriptions()

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

Method fill description which will be used in pyhton file.

Parameters
[out]descriptionto be fill

Definition at line 139 of file MergeClusterProducer.cc.

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

139  {
140  // hgcalMergeLayerClusters
142  //layer clusters
143  desc.add<edm::InputTag>("layerClustersEE", edm::InputTag("hgcalLayerClustersEE"));
144  desc.add<edm::InputTag>("layerClustersHSi", edm::InputTag("hgcalLayerClustersHSi"));
145  desc.add<edm::InputTag>("layerClustersHSci", edm::InputTag("hgcalLayerClustersHSci"));
146 
147  //time
148  desc.add<edm::InputTag>("time_layerclustersEE", edm::InputTag("hgcalLayerClustersEE", "timeLayerCluster"));
149  desc.add<edm::InputTag>("time_layerclustersHSi", edm::InputTag("hgcalLayerClustersHSi", "timeLayerCluster"));
150  desc.add<edm::InputTag>("time_layerclustersHSci", edm::InputTag("hgcalLayerClustersHSci", "timeLayerCluster"));
151 
152  desc.add<std::string>("timeClname", "timeLayerCluster");
153  descriptions.add("hgcalMergeLayerClusters", desc);
154 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ mergeTime()

void MergeClusterProducer::mergeTime ( edm::Event evt,
size_t  size,
std::vector< std::pair< float, float >> &  times 
)
inlineprivate

Merge value map of time for all parts of detector together to vector times.

Parameters
[in]evtEvent to get time value maps
[in]sizeof all 3 value maps
[out]timesvector of merged time vectors

Definition at line 82 of file MergeClusterProducer.cc.

References addTo(), clustersTimeEE_token_, clustersTimeHSci_token_, clustersTimeHSi_token_, EE, edm::Event::getByToken(), and findQualityFiles::size.

Referenced by produce().

82  {
84  // get values from all three part of detectors
88 
89  times.reserve(size);
90  addTo(times, *EE);
91  addTo(times, *HSi);
92  addTo(times, *HSci);
93  }
size
Write out results.
const edm::EDGetTokenT< edm::ValueMap< std::pair< float, float > > > clustersTimeHSi_token_
void addTo(std::vector< std::pair< float, float >> &to, const edm::ValueMap< std::pair< float, float >> &vm)
copy all values from vm to to
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:536
const edm::EDGetTokenT< edm::ValueMap< std::pair< float, float > > > clustersTimeHSci_token_
const edm::EDGetTokenT< edm::ValueMap< std::pair< float, float > > > clustersTimeEE_token_

◆ mergeTogether()

void MergeClusterProducer::mergeTogether ( std::vector< reco::CaloCluster > &  merge,
const std::vector< reco::CaloCluster > &  EE,
const std::vector< reco::CaloCluster > &  HSi,
const std::vector< reco::CaloCluster > &  HSci 
)
private

method merge three vectors of reco::CaloCluster to one

Parameters
[out]mergethe vector into which others vectors will be merge
[in]EEvector for Electromagnetic silicon
[in]HSivector for Hardon silicon
[in]EScivector for hadron scintillator

Definition at line 180 of file MergeClusterProducer.cc.

References nano_mu_local_reco_cff::clusterSize, and EE.

Referenced by createMerge().

183  {
184  auto clusterSize = EE.size() + HSi.size() + HSci.size();
185  merge.reserve(clusterSize);
186 
187  merge.insert(merge.end(), EE.begin(), EE.end());
188  merge.insert(merge.end(), HSi.begin(), HSi.end());
189  merge.insert(merge.end(), HSci.begin(), HSci.end());
190 }
Definition: merge.py:1

◆ produce()

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

Method will merge the producers and put them back to event.

Parameters
[in,out]evtfrom get info and put result
[in]esto get event setup info

Definition at line 156 of file MergeClusterProducer.cc.

References bsc_activity_cfg::clusters, createMerge(), EEclusters_token_, trigObjTnPSource_cfi::filler, HSciclusters_token_, HSiclusters_token_, mergeTime(), eostools::move(), edm::Event::put(), edm::Event::size(), and timeClname_.

156  {
157  //merge clusters
158  std::unique_ptr<std::vector<reco::BasicCluster>> clusters(new std::vector<reco::BasicCluster>);
160  //put new clusters to event
161  auto clusterHandle = evt.put(std::move(clusters));
162 
163  //create layer cluster mask
164  std::unique_ptr<std::vector<float>> layerClustersMask(new std::vector<float>);
165  layerClustersMask->resize(clusterHandle->size(), 1.0);
166  //put it into event
167  evt.put(std::move(layerClustersMask), "InitialLayerClustersMask");
168 
169  //time
170  std::vector<std::pair<float, float>> times;
171  mergeTime(evt, clusterHandle->size(), times);
172 
173  auto timeCl = std::make_unique<edm::ValueMap<std::pair<float, float>>>();
175  filler.insert(clusterHandle, times.begin(), times.end());
176  filler.fill();
177  evt.put(std::move(timeCl), timeClname_);
178 }
edm::EDGetTokenT< std::vector< reco::CaloCluster > > HSiclusters_token_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
edm::EDGetTokenT< std::vector< reco::CaloCluster > > EEclusters_token_
void mergeTime(edm::Event &evt, size_t size, std::vector< std::pair< float, float >> &times)
Merge value map of time for all parts of detector together to vector times.
edm::EDGetTokenT< std::vector< reco::CaloCluster > > HSciclusters_token_
void createMerge(edm::Event &evt, const edm::EDGetTokenT< T > &EE_token, const edm::EDGetTokenT< T > &HSi_token, const edm::EDGetTokenT< T > &HSci_token, T &merge)
get info form event and then call merge
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ clustersTimeEE_token_

const edm::EDGetTokenT<edm::ValueMap<std::pair<float, float> > > MergeClusterProducer::clustersTimeEE_token_
private

Definition at line 46 of file MergeClusterProducer.cc.

Referenced by mergeTime().

◆ clustersTimeHSci_token_

const edm::EDGetTokenT<edm::ValueMap<std::pair<float, float> > > MergeClusterProducer::clustersTimeHSci_token_
private

Definition at line 48 of file MergeClusterProducer.cc.

Referenced by mergeTime().

◆ clustersTimeHSi_token_

const edm::EDGetTokenT<edm::ValueMap<std::pair<float, float> > > MergeClusterProducer::clustersTimeHSi_token_
private

Definition at line 47 of file MergeClusterProducer.cc.

Referenced by mergeTime().

◆ EEclusters_token_

edm::EDGetTokenT<std::vector<reco::CaloCluster> > MergeClusterProducer::EEclusters_token_
private

Definition at line 41 of file MergeClusterProducer.cc.

Referenced by MergeClusterProducer(), and produce().

◆ HSciclusters_token_

edm::EDGetTokenT<std::vector<reco::CaloCluster> > MergeClusterProducer::HSciclusters_token_
private

Definition at line 43 of file MergeClusterProducer.cc.

Referenced by MergeClusterProducer(), and produce().

◆ HSiclusters_token_

edm::EDGetTokenT<std::vector<reco::CaloCluster> > MergeClusterProducer::HSiclusters_token_
private

Definition at line 42 of file MergeClusterProducer.cc.

Referenced by MergeClusterProducer(), and produce().

◆ timeClname_

std::string MergeClusterProducer::timeClname_
private

Definition at line 45 of file MergeClusterProducer.cc.

Referenced by MergeClusterProducer(), and produce().