CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
GEDPhotonCoreGSCrysFixer Class Reference

#include <GEDPhotonCoreGSCrysFixer.h>

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

Public Member Functions

 GEDPhotonCoreGSCrysFixer (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~GEDPhotonCoreGSCrysFixer ()
 
- 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)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Types

typedef edm::ValueMap
< reco::ConversionRef
ConvRefMap
 
typedef edm::ValueMap
< reco::SuperClusterRef
SCRefMap
 

Private Member Functions

template<typename T >
edm::Handle< TgetHandle (edm::Event const &_event, edm::EDGetTokenT< T > const &token, std::string const &name)
 
template<typename T >
void getToken (edm::EDGetTokenT< T > &token, edm::ParameterSet const &pset, std::string const &label, std::string const &instance="")
 

Private Attributes

edm::EDGetTokenT< ConvRefMapconvMapToken_
 
edm::EDGetTokenT
< reco::ConversionCollection
convsToken_
 
edm::EDGetTokenT< SCRefMapebSCMapToken_
 
edm::EDGetTokenT
< reco::SuperClusterCollection
ebSCsToken_
 
edm::EDGetTokenT< SCRefMapeeSCMapToken_
 
edm::EDGetTokenT
< reco::SuperClusterCollection
eeSCsToken_
 
edm::EDGetTokenT
< reco::PhotonCoreCollection
inputCoresToken_
 
edm::EDGetTokenT< SCRefMaprefinedSCMapToken_
 
edm::EDGetTokenT
< reco::SuperClusterCollection
refinedSCsToken_
 
edm::EDGetTokenT< ConvRefMapsingleLegConvMapToken_
 
edm::EDGetTokenT
< reco::ConversionCollection
singleLegConvsToken_
 

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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
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
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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

Definition at line 15 of file GEDPhotonCoreGSCrysFixer.h.

Member Typedef Documentation

Definition at line 25 of file GEDPhotonCoreGSCrysFixer.h.

Definition at line 24 of file GEDPhotonCoreGSCrysFixer.h.

Constructor & Destructor Documentation

GEDPhotonCoreGSCrysFixer::GEDPhotonCoreGSCrysFixer ( const edm::ParameterSet config)

Definition at line 10 of file GEDPhotonCoreGSCrysFixer.cc.

References convsToken_, ebSCMapToken_, ebSCsToken_, eeSCMapToken_, eeSCsToken_, getToken(), inputCoresToken_, refinedSCMapToken_, refinedSCsToken_, and singleLegConvsToken_.

11 {
12  getToken(inputCoresToken_, config, "photonCores");
13  getToken(refinedSCsToken_, config, "refinedSCs");
14  getToken(refinedSCMapToken_, config, "refinedSCs");
15  getToken(ebSCsToken_, config, "scs", "particleFlowSuperClusterECALBarrel");
16  getToken(ebSCMapToken_, config, "refinedSCs", "parentSCsEB");
17  getToken(eeSCsToken_, config, "scs", "particleFlowSuperClusterECALEndcapWithPreshower");
18  getToken(eeSCMapToken_, config, "refinedSCs", "parentSCsEE");
19  getToken(convsToken_, config, "conversions");
20  getToken(singleLegConvsToken_, config, "singleconversions");
21 
22  produces<reco::PhotonCoreCollection>();
23  produces<SCRefMap>(); // new core to old SC
24 }
edm::EDGetTokenT< reco::PhotonCoreCollection > inputCoresToken_
edm::EDGetTokenT< SCRefMap > refinedSCMapToken_
edm::EDGetTokenT< SCRefMap > ebSCMapToken_
edm::EDGetTokenT< SCRefMap > eeSCMapToken_
edm::EDGetTokenT< reco::SuperClusterCollection > refinedSCsToken_
edm::EDGetTokenT< reco::SuperClusterCollection > ebSCsToken_
edm::EDGetTokenT< reco::ConversionCollection > convsToken_
void getToken(edm::EDGetTokenT< T > &token, edm::ParameterSet const &pset, std::string const &label, std::string const &instance="")
edm::EDGetTokenT< reco::SuperClusterCollection > eeSCsToken_
edm::EDGetTokenT< reco::ConversionCollection > singleLegConvsToken_
GEDPhotonCoreGSCrysFixer::~GEDPhotonCoreGSCrysFixer ( )

Definition at line 26 of file GEDPhotonCoreGSCrysFixer.cc.

27 {
28 }

Member Function Documentation

template<typename T >
edm::Handle<T> GEDPhotonCoreGSCrysFixer::getHandle ( edm::Event const &  _event,
edm::EDGetTokenT< T > const &  token,
std::string const &  name 
)
inlineprivate

Definition at line 39 of file GEDPhotonCoreGSCrysFixer.h.

References edm::Event::getByToken(), patZpeak::handle, and mergeVDriftHistosByStation::name.

Referenced by produce().

40  {
42  if (!_event.getByToken(token, handle))
43  throw cms::Exception("ProductNotFound") << name;
44 
45  return handle;
46  }
tuple handle
Definition: patZpeak.py:22
template<typename T >
void GEDPhotonCoreGSCrysFixer::getToken ( edm::EDGetTokenT< T > &  token,
edm::ParameterSet const &  pset,
std::string const &  label,
std::string const &  instance = "" 
)
inlineprivate

Definition at line 29 of file GEDPhotonCoreGSCrysFixer.h.

References edm::ParameterSet::getParameter(), instance, and GlobalPosition_Frontier_DevDB_cff::tag.

Referenced by GEDPhotonCoreGSCrysFixer().

30  {
31  auto tag(pset.getParameter<edm::InputTag>(label));
32  if (!instance.empty())
33  tag = edm::InputTag(tag.label(), instance, tag.process());
34 
35  token = consumes<T>(tag);
36  }
static PFTauRenderPlugin instance
void GEDPhotonCoreGSCrysFixer::produce ( edm::Event _event,
const edm::EventSetup  
)
overridevirtual

Implements edm::stream::EDProducerBase.

Definition at line 31 of file GEDPhotonCoreGSCrysFixer.cc.

References convsToken_, ebSCMapToken_, ebSCsToken_, EcalBarrel, eeSCMapToken_, eeSCsToken_, edm::helper::Filler< Map >::fill(), GainSwitchTools::findNewRef(), getHandle(), inputCoresToken_, edm::helper::Filler< Map >::insert(), edm::Event::put(), refinedSCMapToken_, refinedSCsToken_, fileCollector::seed, and singleLegConvsToken_.

32 {
33  std::auto_ptr<reco::PhotonCoreCollection> pOutput(new reco::PhotonCoreCollection);
34 
35  auto& inputCores(*getHandle(_event, inputCoresToken_, "photonCores"));
36  auto refinedSCs(getHandle(_event, refinedSCsToken_, "refinedSCs"));
37  auto& refinedSCMap(*getHandle(_event, refinedSCMapToken_, "refinedSCMap"));
38  auto ebSCs(getHandle(_event, ebSCsToken_, "ebSCs"));
39  auto& ebSCMap(*getHandle(_event, ebSCMapToken_, "ebSCMap"));
40  auto eeSCs(getHandle(_event, eeSCsToken_, "eeSCs"));
41  auto& eeSCMap(*getHandle(_event, eeSCMapToken_, "eeSCMap"));
42  auto convs(getHandle(_event, convsToken_, "conversions"));
43  auto singleLegConvs(getHandle(_event, singleLegConvsToken_, "singleLegConversions"));
44 
45  std::vector<reco::SuperClusterRef> oldSCRefs;
46 
47  for (auto& inCore : inputCores) {
48  pOutput->emplace_back();
49  auto& outCore(pOutput->back());
50 
51  // NOTE: These mappings can result in NULL superclusters!
52  auto oldRefinedSC(inCore.superCluster());
53  EBDetId seedId(oldRefinedSC->seed()->seed());
54 
55  outCore.setSuperCluster(GainSwitchTools::findNewRef(oldRefinedSC, refinedSCs, refinedSCMap));
56 
57  oldSCRefs.push_back(oldRefinedSC);
58 
59  auto parentSC(inCore.parentSuperCluster());
60  if (parentSC.isNonnull()) {
61  if (parentSC->seed()->seed().subdetId() == EcalBarrel)
62  outCore.setParentSuperCluster(GainSwitchTools::findNewRef(parentSC, ebSCs, ebSCMap));
63  else
64  outCore.setParentSuperCluster(GainSwitchTools::findNewRef(parentSC, eeSCs, eeSCMap));
65  }
66 
67  outCore.setPFlowPhoton(true);
68  outCore.setStandardPhoton(false);
69 
70  // here we rely on ConversionGSCrysFixer and EGRefinedSCFixer translating conversions in the same order as the input
71  // super ugly and not safe but we don't have a dictionary for ValueMap<ConversionRef>
72 
73  for (auto&& oldPtr : inCore.conversions())
74  outCore.addConversion(reco::ConversionRef(convs, oldPtr.key()));
75 
76  for (auto&& oldPtr : inCore.conversionsOneLeg())
77  outCore.addOneLegConversion(reco::ConversionRef(singleLegConvs, oldPtr.key()));
78 
79  for (auto&& seed : inCore.electronPixelSeeds())
80  outCore.addElectronPixelSeed(seed);
81  }
82 
83  auto newCoresHandle(_event.put(pOutput));
84 
85  std::auto_ptr<SCRefMap> pRefMap(new SCRefMap);
86  SCRefMap::Filler refMapFiller(*pRefMap);
87  refMapFiller.insert(newCoresHandle, oldSCRefs.begin(), oldSCRefs.end());
88  refMapFiller.fill();
89  _event.put(pRefMap);
90 }
edm::EDGetTokenT< reco::PhotonCoreCollection > inputCoresToken_
edm::EDGetTokenT< SCRefMap > refinedSCMapToken_
edm::EDGetTokenT< SCRefMap > ebSCMapToken_
edm::EDGetTokenT< SCRefMap > eeSCMapToken_
edm::EDGetTokenT< reco::SuperClusterCollection > refinedSCsToken_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
edm::EDGetTokenT< reco::SuperClusterCollection > ebSCsToken_
edm::EDGetTokenT< reco::ConversionCollection > convsToken_
edm::ValueMap< reco::SuperClusterRef > SCRefMap
helper::Filler< ValueMap< reco::SuperClusterRef > > Filler
Definition: ValueMap.h:168
edm::Handle< T > getHandle(edm::Event const &_event, edm::EDGetTokenT< T > const &token, std::string const &name)
std::vector< PhotonCore > PhotonCoreCollection
collectin of PhotonCore objects
Definition: PhotonCoreFwd.h:9
edm::EDGetTokenT< reco::SuperClusterCollection > eeSCsToken_
edm::EDGetTokenT< reco::ConversionCollection > singleLegConvsToken_
static edm::Ref< typename H::element_type > findNewRef(R const &, H const &, M const &)

Member Data Documentation

edm::EDGetTokenT<ConvRefMap> GEDPhotonCoreGSCrysFixer::convMapToken_
private

Definition at line 56 of file GEDPhotonCoreGSCrysFixer.h.

edm::EDGetTokenT<reco::ConversionCollection> GEDPhotonCoreGSCrysFixer::convsToken_
private

Definition at line 55 of file GEDPhotonCoreGSCrysFixer.h.

Referenced by GEDPhotonCoreGSCrysFixer(), and produce().

edm::EDGetTokenT<SCRefMap> GEDPhotonCoreGSCrysFixer::ebSCMapToken_
private

Definition at line 52 of file GEDPhotonCoreGSCrysFixer.h.

Referenced by GEDPhotonCoreGSCrysFixer(), and produce().

edm::EDGetTokenT<reco::SuperClusterCollection> GEDPhotonCoreGSCrysFixer::ebSCsToken_
private

Definition at line 51 of file GEDPhotonCoreGSCrysFixer.h.

Referenced by GEDPhotonCoreGSCrysFixer(), and produce().

edm::EDGetTokenT<SCRefMap> GEDPhotonCoreGSCrysFixer::eeSCMapToken_
private

Definition at line 54 of file GEDPhotonCoreGSCrysFixer.h.

Referenced by GEDPhotonCoreGSCrysFixer(), and produce().

edm::EDGetTokenT<reco::SuperClusterCollection> GEDPhotonCoreGSCrysFixer::eeSCsToken_
private

Definition at line 53 of file GEDPhotonCoreGSCrysFixer.h.

Referenced by GEDPhotonCoreGSCrysFixer(), and produce().

edm::EDGetTokenT<reco::PhotonCoreCollection> GEDPhotonCoreGSCrysFixer::inputCoresToken_
private

Definition at line 48 of file GEDPhotonCoreGSCrysFixer.h.

Referenced by GEDPhotonCoreGSCrysFixer(), and produce().

edm::EDGetTokenT<SCRefMap> GEDPhotonCoreGSCrysFixer::refinedSCMapToken_
private

Definition at line 50 of file GEDPhotonCoreGSCrysFixer.h.

Referenced by GEDPhotonCoreGSCrysFixer(), and produce().

edm::EDGetTokenT<reco::SuperClusterCollection> GEDPhotonCoreGSCrysFixer::refinedSCsToken_
private

Definition at line 49 of file GEDPhotonCoreGSCrysFixer.h.

Referenced by GEDPhotonCoreGSCrysFixer(), and produce().

edm::EDGetTokenT<ConvRefMap> GEDPhotonCoreGSCrysFixer::singleLegConvMapToken_
private

Definition at line 58 of file GEDPhotonCoreGSCrysFixer.h.

edm::EDGetTokenT<reco::ConversionCollection> GEDPhotonCoreGSCrysFixer::singleLegConvsToken_
private

Definition at line 57 of file GEDPhotonCoreGSCrysFixer.h.

Referenced by GEDPhotonCoreGSCrysFixer(), and produce().