CMS 3D CMS Logo

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

#include <PFECALSuperClusterProducer.h>

Inheritance diagram for PFECALSuperClusterProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &) override
 
 PFECALSuperClusterProducer (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 
 ~PFECALSuperClusterProducer ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

PFECALSuperClusterAlgo::clustering_type _theclusteringtype
 
PFECALSuperClusterAlgo::energy_weight _theenergyweight
 
bool isOOTCollection_
 
std::string PFBasicClusterCollectionBarrel_
 
std::string PFBasicClusterCollectionEndcap_
 
std::string PFBasicClusterCollectionPreshower_
 
std::string PFClusterAssociationEBEE_
 
std::string PFClusterAssociationES_
 
std::string PFSuperClusterCollectionBarrel_
 
std::string PFSuperClusterCollectionEndcap_
 
std::string PFSuperClusterCollectionEndcapWithPreshower_
 
PFECALSuperClusterAlgo superClusterAlgo_
 clustering algorithm More...
 
std::shared_ptr< PFEnergyCalibrationthePFEnergyCalibration_
 
bool verbose_
 verbose ? More...
 

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
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Author
Nicolas Chanon Additional authors for Mustache: Y. Gershtein, R. Patel, L. Gray
Date
July 2012

Definition at line 43 of file PFECALSuperClusterProducer.h.

Constructor & Destructor Documentation

PFECALSuperClusterProducer::PFECALSuperClusterProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 46 of file PFECALSuperClusterProducer.cc.

References particleFlowSuperClusterECAL_cfi::doSatelliteClusterMerge, Exception, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), PFECALSuperClusterAlgo::kBOX, PFECALSuperClusterAlgo::kCalibratedNoPS, PFECALSuperClusterAlgo::kCalibratedTotal, PFECALSuperClusterAlgo::kMustache, PFECALSuperClusterAlgo::kRaw, particleFlowSuperClusterECAL_cfi::satelliteClusterSeedThreshold, particleFlowSuperClusterECAL_cfi::satelliteMajorityFraction, particleFlowSuperClusterECAL_cfi::seedThresholdIsET, and AlCaHLTBitMon_QueryRunRegistry::string.

47 {
48 
49  verbose_ =
50  iConfig.getUntrackedParameter<bool>("verbose",false);
51 
52  superClusterAlgo_.setUseRegression(iConfig.getParameter<bool>("useRegression"));
53 
54  isOOTCollection_ = iConfig.getParameter<bool>("isOOTCollection");
56 
58 
59  std::string _typename = iConfig.getParameter<std::string>("ClusteringType");
60  if( _typename == ClusterType__BOX ) {
62  } else if ( _typename == ClusterType__Mustache ) {
64  } else {
65  throw cms::Exception("InvalidClusteringType")
66  << "You have not chosen a valid clustering type,"
67  << " please choose from \"Box\" or \"Mustache\"!";
68  }
69 
70  std::string _weightname = iConfig.getParameter<std::string>("EnergyWeight");
71  if( _weightname == EnergyWeight__Raw ) {
73  } else if ( _weightname == EnergyWeight__CalibratedNoPS ) {
75  } else if ( _weightname == EnergyWeight__CalibratedTotal) {
77  } else {
78  throw cms::Exception("InvalidClusteringType")
79  << "You have not chosen a valid energy weighting scheme,"
80  << " please choose from \"Raw\", \"CalibratedNoPS\", or"
81  << " \"CalibratedTotal\"!";
82  }
83 
84 
85  // parameters for clustering
86  bool seedThresholdIsET = iConfig.getParameter<bool>("seedThresholdIsET");
87 
88  bool useDynamicDPhi = iConfig.getParameter<bool>("useDynamicDPhiWindow");
89 
90  double threshPFClusterSeedBarrel = iConfig.getParameter<double>("thresh_PFClusterSeedBarrel");
91  double threshPFClusterBarrel = iConfig.getParameter<double>("thresh_PFClusterBarrel");
92 
93  double threshPFClusterSeedEndcap = iConfig.getParameter<double>("thresh_PFClusterSeedEndcap");
94  double threshPFClusterEndcap = iConfig.getParameter<double>("thresh_PFClusterEndcap");
95 
96  double phiwidthSuperClusterBarrel = iConfig.getParameter<double>("phiwidth_SuperClusterBarrel");
97  double etawidthSuperClusterBarrel = iConfig.getParameter<double>("etawidth_SuperClusterBarrel");
98 
99  double phiwidthSuperClusterEndcap = iConfig.getParameter<double>("phiwidth_SuperClusterEndcap");
100  double etawidthSuperClusterEndcap = iConfig.getParameter<double>("etawidth_SuperClusterEndcap");
101 
102  double threshPFClusterES = iConfig.getParameter<double>("thresh_PFClusterES");
103 
104  //double threshPFClusterMustacheOutBarrel = iConfig.getParameter<double>("thresh_PFClusterMustacheOutBarrel");
105  //double threshPFClusterMustacheOutEndcap = iConfig.getParameter<double>("thresh_PFClusterMustacheOutEndcap");
106 
107  double doSatelliteClusterMerge =
108  iConfig.getParameter<bool>("doSatelliteClusterMerge");
110  iConfig.getParameter<double>("satelliteClusterSeedThreshold");
111  double satelliteMajorityFraction =
112  iConfig.getParameter<double>("satelliteMajorityFraction");
113 
117  superClusterAlgo_.setUseETForSeeding(seedThresholdIsET);
118  superClusterAlgo_.setUseDynamicDPhi(useDynamicDPhi);
119 
120  superClusterAlgo_.setThreshSuperClusterEt( iConfig.getParameter<double>("thresh_SCEt") );
121 
122  superClusterAlgo_.setThreshPFClusterSeedBarrel( threshPFClusterSeedBarrel );
123  superClusterAlgo_.setThreshPFClusterBarrel( threshPFClusterBarrel );
124 
125  superClusterAlgo_.setThreshPFClusterSeedEndcap( threshPFClusterSeedEndcap );
126  superClusterAlgo_.setThreshPFClusterEndcap( threshPFClusterEndcap );
127 
128  superClusterAlgo_.setPhiwidthSuperClusterBarrel( phiwidthSuperClusterBarrel );
129  superClusterAlgo_.setEtawidthSuperClusterBarrel( etawidthSuperClusterBarrel );
130 
131  superClusterAlgo_.setPhiwidthSuperClusterEndcap( phiwidthSuperClusterEndcap );
132  superClusterAlgo_.setEtawidthSuperClusterEndcap( etawidthSuperClusterEndcap );
133 
134  superClusterAlgo_.setThreshPFClusterES( threshPFClusterES );
135 
136  superClusterAlgo_.setSatelliteMerging( doSatelliteClusterMerge );
137  superClusterAlgo_.setSatelliteThreshold( satelliteClusterSeedThreshold );
138  superClusterAlgo_.setMajorityFraction( satelliteMajorityFraction );
139  //superClusterAlgo_.setThreshPFClusterMustacheOutBarrel( threshPFClusterMustacheOutBarrel );
140  //superClusterAlgo_.setThreshPFClusterMustacheOutEndcap( threshPFClusterMustacheOutEndcap );
141 
142  //Load the ECAL energy calibration
144  std::shared_ptr<PFEnergyCalibration>(new PFEnergyCalibration());
146  superClusterAlgo_.setUsePS(iConfig.getParameter<bool>("use_preshower"));
147 
148  bool applyCrackCorrections_ = iConfig.getParameter<bool>("applyCrackCorrections");
149  superClusterAlgo_.setCrackCorrections(applyCrackCorrections_);
150 
151  PFBasicClusterCollectionBarrel_ = iConfig.getParameter<string>("PFBasicClusterCollectionBarrel");
152  PFSuperClusterCollectionBarrel_ = iConfig.getParameter<string>("PFSuperClusterCollectionBarrel");
153 
154  PFBasicClusterCollectionEndcap_ = iConfig.getParameter<string>("PFBasicClusterCollectionEndcap");
155  PFSuperClusterCollectionEndcap_ = iConfig.getParameter<string>("PFSuperClusterCollectionEndcap");
156 
157  PFBasicClusterCollectionPreshower_ = iConfig.getParameter<string>("PFBasicClusterCollectionPreshower");
158  PFSuperClusterCollectionEndcapWithPreshower_ = iConfig.getParameter<string>("PFSuperClusterCollectionEndcapWithPreshower");
159 
160  PFClusterAssociationEBEE_ = "PFClusterAssociationEBEE";
161  PFClusterAssociationES_ = "PFClusterAssociationES";
162 
163  produces<reco::SuperClusterCollection>(PFSuperClusterCollectionBarrel_);
164  produces<reco::SuperClusterCollection>(PFSuperClusterCollectionEndcapWithPreshower_);
165  produces<reco::CaloClusterCollection>(PFBasicClusterCollectionBarrel_);
166  produces<reco::CaloClusterCollection>(PFBasicClusterCollectionEndcap_);
167  produces<reco::CaloClusterCollection>(PFBasicClusterCollectionPreshower_);
168  produces<edm::ValueMap<reco::CaloClusterPtr> >(PFClusterAssociationEBEE_);
169  produces<edm::ValueMap<reco::CaloClusterPtr> >(PFClusterAssociationES_);
170 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
void setMajorityFraction(const double f)
void setSatelliteMerging(const bool doit)
void setThreshPFClusterSeedEndcap(double thresh)
PFECALSuperClusterAlgo::clustering_type _theclusteringtype
void setCrackCorrections(bool applyCrackCorrections)
void setThreshPFClusterBarrel(double thresh)
void setThreshSuperClusterEt(double thresh)
std::shared_ptr< PFEnergyCalibration > thePFEnergyCalibration_
void setEtawidthSuperClusterBarrel(double etawidth)
void setClusteringType(clustering_type thetype)
void setEtawidthSuperClusterEndcap(double etawidth)
void setPhiwidthSuperClusterBarrel(double phiwidth)
void setVerbosityLevel(bool verbose)
void setThreshPFClusterEndcap(double thresh)
void setTokens(const edm::ParameterSet &, edm::ConsumesCollector &&)
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
void setUseETForSeeding(bool useET)
PFECALSuperClusterAlgo superClusterAlgo_
clustering algorithm
void setEnergyWeighting(energy_weight thetype)
void setThreshPFClusterSeedBarrel(double thresh)
PFECALSuperClusterAlgo::energy_weight _theenergyweight
void setUseDynamicDPhi(bool useit)
void setPhiwidthSuperClusterEndcap(double phiwidth)
void setThreshPFClusterES(double thresh)
void setUseRegression(bool useRegression)
void setSatelliteThreshold(const double t)
void setPFClusterCalibration(const std::shared_ptr< PFEnergyCalibration > &)
void setIsOOTCollection(bool isOOTCollection)
PFECALSuperClusterProducer::~PFECALSuperClusterProducer ( )

Definition at line 174 of file PFECALSuperClusterProducer.cc.

References beginLuminosityBlock().

174 {}

Member Function Documentation

void PFECALSuperClusterProducer::beginLuminosityBlock ( const edm::LuminosityBlock ,
const edm::EventSetup  
)
overridevirtual

Definition at line 177 of file PFECALSuperClusterProducer.cc.

Referenced by ~PFECALSuperClusterProducer().

177  {
179 }
void update(const edm::EventSetup &)
PFECALSuperClusterAlgo superClusterAlgo_
clustering algorithm
void PFECALSuperClusterProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 310 of file PFECALSuperClusterProducer.cc.

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

310  {
312  desc.add<std::string>("PFSuperClusterCollectionEndcap","particleFlowSuperClusterECALEndcap");
313  desc.add<bool>("doSatelliteClusterMerge",false);
314  desc.add<double>("thresh_PFClusterBarrel",0.0);
315  desc.add<std::string>("PFBasicClusterCollectionBarrel","particleFlowBasicClusterECALBarrel");
316  desc.add<bool>("useRegression",true);
317  desc.add<double>("satelliteMajorityFraction",0.5);
318  desc.add<double>("thresh_PFClusterEndcap",0.0);
319  desc.add<edm::InputTag>("ESAssociation",edm::InputTag("particleFlowClusterECAL"));
320  desc.add<std::string>("PFBasicClusterCollectionPreshower","particleFlowBasicClusterECALPreshower");
321  desc.add<bool>("use_preshower",true);
322  desc.addUntracked<bool>("verbose",false);
323  desc.add<double>("thresh_SCEt",4.0);
324  desc.add<double>("etawidth_SuperClusterEndcap",0.04);
325  desc.add<double>("phiwidth_SuperClusterEndcap",0.6);
326  desc.add<bool>("useDynamicDPhiWindow",true);
327  desc.add<std::string>("PFSuperClusterCollectionBarrel","particleFlowSuperClusterECALBarrel");
328  {
330  psd0.add<bool>("isHLT", false);
331  psd0.add<edm::InputTag>("ecalRecHitsEE",edm::InputTag("ecalRecHit","EcalRecHitsEE"));
332  psd0.add<edm::InputTag>("ecalRecHitsEB",edm::InputTag("ecalRecHit","EcalRecHitsEB"));
333  psd0.add<std::string>("regressionKeyEB","pfscecal_EBCorrection_offline_v1");
334  psd0.add<std::string>("regressionKeyEE","pfscecal_EECorrection_offline_v1");
335  psd0.add<std::string>("uncertaintyKeyEB","pfscecal_EBUncertainty_offline_v1");
336  psd0.add<std::string>("uncertaintyKeyEE","pfscecal_EEUncertainty_offline_v1");
337  psd0.add<edm::InputTag>("vertexCollection",edm::InputTag("offlinePrimaryVertices"));
338  psd0.add<double>("eRecHitThreshold", 1.);
339  desc.add<edm::ParameterSetDescription>("regressionConfig",psd0);
340  }
341  desc.add<bool>("applyCrackCorrections",false);
342  desc.add<double>("satelliteClusterSeedThreshold",50.0);
343  desc.add<double>("etawidth_SuperClusterBarrel",0.04);
344  desc.add<std::string>("PFBasicClusterCollectionEndcap","particleFlowBasicClusterECALEndcap");
345  desc.add<edm::InputTag>("PFClusters",edm::InputTag("particleFlowClusterECAL"));
346  desc.add<double>("thresh_PFClusterSeedBarrel",1.0);
347  desc.add<std::string>("ClusteringType","Mustache");
348  desc.add<std::string>("EnergyWeight","Raw");
349  desc.add<edm::InputTag>("BeamSpot",edm::InputTag("offlineBeamSpot"));
350  desc.add<double>("thresh_PFClusterSeedEndcap",1.0);
351  desc.add<double>("phiwidth_SuperClusterBarrel",0.6);
352  desc.add<double>("thresh_PFClusterES",0.0);
353  desc.add<bool>("seedThresholdIsET",true);
354  desc.add<bool>("isOOTCollection",false);
355  desc.add<edm::InputTag>("barrelRecHits",edm::InputTag("ecalRecHit","EcalRecHitsEE"));
356  desc.add<edm::InputTag>("endcapRecHits",edm::InputTag("ecalRecHit","EcalRecHitsEB"));
357  desc.add<std::string>("PFSuperClusterCollectionEndcapWithPreshower","particleFlowSuperClusterECALEndcapWithPreshower");
358  descriptions.add("particleFlowSuperClusterECALMustache",desc);
359 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void PFECALSuperClusterProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Definition at line 182 of file PFECALSuperClusterProducer.cc.

References fastPrimaryVertexProducer_cfi::clusters, TauDecayModes::dec, Exception, edm::helper::Filler< Map >::fill(), edm::helper::Filler< Map >::insert(), eostools::move(), edm::PtrVector< T >::push_back(), and edm::Event::put().

183  {
184 
185  // do clustering
188 
189  //build collections of output CaloClusters from the used PFClusters
190  auto caloClustersEB = std::make_unique<reco::CaloClusterCollection>();
191  auto caloClustersEE = std::make_unique<reco::CaloClusterCollection>();
192  auto caloClustersES = std::make_unique<reco::CaloClusterCollection>();
193 
194  std::map<reco::CaloClusterPtr, unsigned int> pfClusterMapEB; //maps of pfclusters to caloclusters
195  std::map<reco::CaloClusterPtr, unsigned int> pfClusterMapEE;
196  std::map<reco::CaloClusterPtr, unsigned int> pfClusterMapES;
197 
198  //fill calocluster collections and maps
199  for( const auto& ebsc : *(superClusterAlgo_.getEBOutputSCCollection()) ) {
200  for (reco::CaloCluster_iterator pfclus = ebsc.clustersBegin(); pfclus!=ebsc.clustersEnd(); ++pfclus) {
201  if (!pfClusterMapEB.count(*pfclus)) {
202  reco::CaloCluster caloclus(**pfclus);
203  caloClustersEB->push_back(caloclus);
204  pfClusterMapEB[*pfclus] = caloClustersEB->size() - 1;
205  }
206  else {
207  throw cms::Exception("PFECALSuperClusterProducer::produce")
208  << "Found an EB pfcluster matched to more than one EB supercluster!"
209  << std::dec << std::endl;
210  }
211  }
212  }
213  for( const auto& eesc : *(superClusterAlgo_.getEEOutputSCCollection()) ) {
214  for (reco::CaloCluster_iterator pfclus = eesc.clustersBegin(); pfclus!=eesc.clustersEnd(); ++pfclus) {
215  if (!pfClusterMapEE.count(*pfclus)) {
216  reco::CaloCluster caloclus(**pfclus);
217  caloClustersEE->push_back(caloclus);
218  pfClusterMapEE[*pfclus] = caloClustersEE->size() - 1;
219  }
220  else {
221  throw cms::Exception("PFECALSuperClusterProducer::produce")
222  << "Found an EE pfcluster matched to more than one EE supercluster!"
223  << std::dec << std::endl;
224  }
225  }
226  for (reco::CaloCluster_iterator pfclus = eesc.preshowerClustersBegin(); pfclus!=eesc.preshowerClustersEnd(); ++pfclus) {
227  if (!pfClusterMapES.count(*pfclus)) {
228  reco::CaloCluster caloclus(**pfclus);
229  caloClustersES->push_back(caloclus);
230  pfClusterMapES[*pfclus] = caloClustersES->size() - 1;
231  }
232  else {
233  throw cms::Exception("PFECALSuperClusterProducer::produce")
234  << "Found an ES pfcluster matched to more than one EE supercluster!"
235  << std::dec << std::endl;
236  }
237  }
238  }
239 
240  //create ValueMaps from output CaloClusters back to original PFClusters
241  auto pfClusterAssociationEBEE = std::make_unique<edm::ValueMap<reco::CaloClusterPtr>>();
242  auto pfClusterAssociationES = std::make_unique<edm::ValueMap<reco::CaloClusterPtr>>();
243 
244  //vectors to fill ValueMaps
245  std::vector<reco::CaloClusterPtr> clusptrsEB(caloClustersEB->size());
246  std::vector<reco::CaloClusterPtr> clusptrsEE(caloClustersEE->size());
247  std::vector<reco::CaloClusterPtr> clusptrsES(caloClustersES->size());
248 
249  //put calocluster output collections in event and get orphan handles to create ptrs
250  const edm::OrphanHandle<reco::CaloClusterCollection> &caloClusHandleEB = iEvent.put(std::move(caloClustersEB),PFBasicClusterCollectionBarrel_);
251  const edm::OrphanHandle<reco::CaloClusterCollection> &caloClusHandleEE = iEvent.put(std::move(caloClustersEE),PFBasicClusterCollectionEndcap_);
253 
254  //relink superclusters to output caloclusters and fill vectors for ValueMaps
255  for( auto& ebsc : *(superClusterAlgo_.getEBOutputSCCollection()) ) {
256  reco::CaloClusterPtr seedptr(caloClusHandleEB,pfClusterMapEB[ebsc.seed()]);
257  ebsc.setSeed(seedptr);
258 
260  for (reco::CaloCluster_iterator pfclus = ebsc.clustersBegin(); pfclus!=ebsc.clustersEnd(); ++pfclus) {
261  int caloclusidx = pfClusterMapEB[*pfclus];
262  reco::CaloClusterPtr clusptr(caloClusHandleEB,caloclusidx);
263  clusters.push_back(clusptr);
264  clusptrsEB[caloclusidx] = *pfclus;
265  }
266  ebsc.setClusters(clusters);
267  }
268  for( auto& eesc : *(superClusterAlgo_.getEEOutputSCCollection()) ) {
269  reco::CaloClusterPtr seedptr(caloClusHandleEE,pfClusterMapEE[eesc.seed()]);
270  eesc.setSeed(seedptr);
271 
273  for (reco::CaloCluster_iterator pfclus = eesc.clustersBegin(); pfclus!=eesc.clustersEnd(); ++pfclus) {
274  int caloclusidx = pfClusterMapEE[*pfclus];
275  reco::CaloClusterPtr clusptr(caloClusHandleEE,caloclusidx);
276  clusters.push_back(clusptr);
277  clusptrsEE[caloclusidx] = *pfclus;
278  }
279  eesc.setClusters(clusters);
280 
281  reco::CaloClusterPtrVector psclusters;
282  for (reco::CaloCluster_iterator pfclus = eesc.preshowerClustersBegin(); pfclus!=eesc.preshowerClustersEnd(); ++pfclus) {
283  int caloclusidx = pfClusterMapES[*pfclus];
284  reco::CaloClusterPtr clusptr(caloClusHandleES,caloclusidx);
285  psclusters.push_back(clusptr);
286  clusptrsES[caloclusidx] = *pfclus;
287  }
288  eesc.setPreshowerClusters(psclusters);
289  }
290 
291  //fill association maps from output CaloClusters back to original PFClusters
292  edm::ValueMap<reco::CaloClusterPtr>::Filler fillerEBEE(*pfClusterAssociationEBEE);
293  fillerEBEE.insert(caloClusHandleEB, clusptrsEB.begin(), clusptrsEB.end());
294  fillerEBEE.insert(caloClusHandleEE, clusptrsEE.begin(), clusptrsEE.end());
295  fillerEBEE.fill();
296 
297  edm::ValueMap<reco::CaloClusterPtr>::Filler fillerES(*pfClusterAssociationES);
298  fillerES.insert(caloClusHandleES, clusptrsES.begin(), clusptrsES.end());
299  fillerES.fill();
300 
301  //store in the event
302  iEvent.put(std::move(pfClusterAssociationEBEE),PFClusterAssociationEBEE_);
303  iEvent.put(std::move(pfClusterAssociationES),PFClusterAssociationES_);
308 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
std::unique_ptr< reco::SuperClusterCollection > & getEEOutputSCCollection()
void push_back(Ptr< T > const &iPtr)
Definition: PtrVector.h:141
void loadAndSortPFClusters(const edm::Event &evt)
PFECALSuperClusterAlgo superClusterAlgo_
clustering algorithm
std::unique_ptr< reco::SuperClusterCollection > & getEBOutputSCCollection()
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

PFECALSuperClusterAlgo::clustering_type PFECALSuperClusterProducer::_theclusteringtype
private

Definition at line 58 of file PFECALSuperClusterProducer.h.

PFECALSuperClusterAlgo::energy_weight PFECALSuperClusterProducer::_theenergyweight
private

Definition at line 59 of file PFECALSuperClusterProducer.h.

bool PFECALSuperClusterProducer::isOOTCollection_
private

Definition at line 76 of file PFECALSuperClusterProducer.h.

std::string PFECALSuperClusterProducer::PFBasicClusterCollectionBarrel_
private

Definition at line 66 of file PFECALSuperClusterProducer.h.

std::string PFECALSuperClusterProducer::PFBasicClusterCollectionEndcap_
private

Definition at line 68 of file PFECALSuperClusterProducer.h.

std::string PFECALSuperClusterProducer::PFBasicClusterCollectionPreshower_
private

Definition at line 70 of file PFECALSuperClusterProducer.h.

std::string PFECALSuperClusterProducer::PFClusterAssociationEBEE_
private

Definition at line 72 of file PFECALSuperClusterProducer.h.

std::string PFECALSuperClusterProducer::PFClusterAssociationES_
private

Definition at line 73 of file PFECALSuperClusterProducer.h.

std::string PFECALSuperClusterProducer::PFSuperClusterCollectionBarrel_
private

Definition at line 67 of file PFECALSuperClusterProducer.h.

std::string PFECALSuperClusterProducer::PFSuperClusterCollectionEndcap_
private

Definition at line 69 of file PFECALSuperClusterProducer.h.

std::string PFECALSuperClusterProducer::PFSuperClusterCollectionEndcapWithPreshower_
private

Definition at line 71 of file PFECALSuperClusterProducer.h.

PFECALSuperClusterAlgo PFECALSuperClusterProducer::superClusterAlgo_
private

clustering algorithm

Definition at line 57 of file PFECALSuperClusterProducer.h.

std::shared_ptr<PFEnergyCalibration> PFECALSuperClusterProducer::thePFEnergyCalibration_
private

Definition at line 61 of file PFECALSuperClusterProducer.h.

bool PFECALSuperClusterProducer::verbose_
private

verbose ?

Definition at line 64 of file PFECALSuperClusterProducer.h.