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 Attributes
EgammaEcalRecHitIsolationProducer Class Reference

#include <EgammaEcalRecHitIsolationProducer.h>

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

Public Member Functions

 EgammaEcalRecHitIsolationProducer (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~EgammaEcalRecHitIsolationProducer ()
 
- 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
 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
 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 (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

edm::ParameterSet conf_
 
edm::InputTag ecalBarrelRecHitCollection_
 
edm::InputTag ecalBarrelRecHitProducer_
 
edm::InputTag ecalEndcapRecHitCollection_
 
edm::InputTag ecalEndcapRecHitProducer_
 
double egIsoConeSizeInBarrel_
 
double egIsoConeSizeInEndcap_
 
double egIsoConeSizeOut_
 
double egIsoEMinBarrel_
 
double egIsoEMinEndcap_
 
double egIsoJurassicWidth_
 
double egIsoPtMinBarrel_
 
double egIsoPtMinEndcap_
 
edm::InputTag emObjectProducer_
 
bool subtract_
 
bool tryBoth_
 
bool useIsolEt_
 
bool useNumCrystals_
 
bool vetoClustered_
 

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
 
- 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::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 34 of file EgammaEcalRecHitIsolationProducer.h.

Constructor & Destructor Documentation

EgammaEcalRecHitIsolationProducer::EgammaEcalRecHitIsolationProducer ( const edm::ParameterSet config)
explicit

Definition at line 31 of file EgammaEcalRecHitIsolationProducer.cc.

References conf_, ecalBarrelRecHitCollection_, ecalBarrelRecHitProducer_, ecalEndcapRecHitCollection_, ecalEndcapRecHitProducer_, egIsoConeSizeInBarrel_, egIsoConeSizeInEndcap_, egIsoConeSizeOut_, egIsoEMinBarrel_, egIsoEMinEndcap_, egIsoJurassicWidth_, egIsoPtMinBarrel_, egIsoPtMinEndcap_, emObjectProducer_, edm::ParameterSet::getParameter(), subtract_, tryBoth_, useIsolEt_, useNumCrystals_, and vetoClustered_.

31  : conf_(config)
32 {
33  // use configuration file to setup input/output collection names
34  //inputs
35  emObjectProducer_ = conf_.getParameter<edm::InputTag>("emObjectProducer");
36  ecalBarrelRecHitProducer_ = conf_.getParameter<edm::InputTag>("ecalBarrelRecHitProducer");
37  ecalBarrelRecHitCollection_ = conf_.getParameter<edm::InputTag>("ecalBarrelRecHitCollection");
38  ecalEndcapRecHitProducer_ = conf_.getParameter<edm::InputTag>("ecalEndcapRecHitProducer");
39  ecalEndcapRecHitCollection_ = conf_.getParameter<edm::InputTag>("ecalEndcapRecHitCollection");
40 
41  //vetos
42  egIsoPtMinBarrel_ = conf_.getParameter<double>("etMinBarrel");
43  egIsoEMinBarrel_ = conf_.getParameter<double>("eMinBarrel");
44  egIsoPtMinEndcap_ = conf_.getParameter<double>("etMinEndcap");
45  egIsoEMinEndcap_ = conf_.getParameter<double>("eMinEndcap");
46  egIsoConeSizeInBarrel_ = conf_.getParameter<double>("intRadiusBarrel");
47  egIsoConeSizeInEndcap_ = conf_.getParameter<double>("intRadiusEndcap");
48  egIsoConeSizeOut_ = conf_.getParameter<double>("extRadius");
49  egIsoJurassicWidth_ = conf_.getParameter<double>("jurassicWidth");
50 
51 
52 
53  // options
54  useIsolEt_ = conf_.getParameter<bool>("useIsolEt");
55  tryBoth_ = conf_.getParameter<bool>("tryBoth");
56  subtract_ = conf_.getParameter<bool>("subtract");
57  useNumCrystals_ = conf_.getParameter<bool>("useNumCrystals");
58  vetoClustered_ = conf_.getParameter<bool>("vetoClustered");
59 
60  //register your products
61  produces < edm::ValueMap<double> >();
62 }
T getParameter(std::string const &) const
EgammaEcalRecHitIsolationProducer::~EgammaEcalRecHitIsolationProducer ( )

Definition at line 65 of file EgammaEcalRecHitIsolationProducer.cc.

65 {}

Member Function Documentation

void EgammaEcalRecHitIsolationProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::stream::EDProducerBase.

Definition at line 74 of file EgammaEcalRecHitIsolationProducer.cc.

References DetId::Ecal, ecalBarrelRecHitCollection_, ecalBarrelRecHitProducer_, ecalEndcapRecHitCollection_, ecalEndcapRecHitProducer_, egIsoConeSizeInBarrel_, egIsoConeSizeInEndcap_, egIsoConeSizeOut_, egIsoEMinBarrel_, egIsoEMinEndcap_, egIsoJurassicWidth_, egIsoPtMinBarrel_, egIsoPtMinEndcap_, emObjectProducer_, create_public_lumi_plots::exp, edm::helper::Filler< Map >::fill(), edm::EventSetup::get(), edm::Ref< C, T, F >::get(), edm::Event::getByLabel(), EgammaRecHitIsolation::getEnergySum(), EgammaRecHitIsolation::getEtSum(), i, edm::helper::Filler< Map >::insert(), edm::InputTag::label(), edm::ESHandle< class >::product(), edm::Event::put(), EgammaRecHitIsolation::setUseNumCrystals(), EgammaRecHitIsolation::setVetoClustered(), funct::sin(), subtract_, tryBoth_, useIsolEt_, useNumCrystals_, and vetoClustered_.

75 {
76 
77 
78  // Get the filtered objects
80  iEvent.getByLabel(emObjectProducer_,emObjectHandle);
81 
82  // Next get Ecal hits barrel
83  edm::Handle<EcalRecHitCollection> ecalBarrelRecHitHandle; //EcalRecHitCollection is a typedef to
85 
86  // Next get Ecal hits endcap
87  edm::Handle<EcalRecHitCollection> ecalEndcapRecHitHandle;
89 
91  iSetup.get<EcalSeverityLevelAlgoRcd>().get(sevlv);
92  const EcalSeverityLevelAlgo* sevLevel = sevlv.product();
93 
94  //Get Calo Geometry
96  iSetup.get<CaloGeometryRecord>().get(pG);
97  const CaloGeometry* caloGeom = pG.product();
98 
99  //reco::CandViewDoubleAssociations* isoMap = new reco::CandViewDoubleAssociations( reco::CandidateBaseRefProd( emObjectHandle ) );
100  std::auto_ptr<edm::ValueMap<double> > isoMap(new edm::ValueMap<double>());
101  edm::ValueMap<double>::Filler filler(*isoMap);
102  std::vector<double> retV(emObjectHandle->size(),0);
103 
105  ecalBarrelIsol.setUseNumCrystals(useNumCrystals_);
106  ecalBarrelIsol.setVetoClustered(vetoClustered_);
107 
109  ecalEndcapIsol.setUseNumCrystals(useNumCrystals_);
110  ecalEndcapIsol.setVetoClustered(vetoClustered_);
111 
112 
113  for( size_t i = 0 ; i < emObjectHandle->size(); ++i) {
114 
115  //i need to know if its in the barrel/endcap so I get the supercluster handle to find out the detector eta
116  //this might not be the best way, are we guaranteed that eta<1.5 is barrel
117  //this can be safely replaced by another method which determines where the emobject is
118  //then we either get the isolation Et or isolation Energy depending on user selection
119  double isoValue =0.;
120 
121  reco::SuperClusterRef superClus = emObjectHandle->at(i).get<reco::SuperClusterRef>();
122 
123  if(tryBoth_){ //barrel + endcap
124  if(useIsolEt_) isoValue = ecalBarrelIsol.getEtSum(&(emObjectHandle->at(i))) + ecalEndcapIsol.getEtSum(&(emObjectHandle->at(i)));
125  else isoValue = ecalBarrelIsol.getEnergySum(&(emObjectHandle->at(i))) + ecalEndcapIsol.getEnergySum(&(emObjectHandle->at(i)));
126  }
127  else if( fabs(superClus->eta())<1.479) { //barrel
128  if(useIsolEt_) isoValue = ecalBarrelIsol.getEtSum(&(emObjectHandle->at(i)));
129  else isoValue = ecalBarrelIsol.getEnergySum(&(emObjectHandle->at(i)));
130  }
131  else{ //endcap
132  if(useIsolEt_) isoValue = ecalEndcapIsol.getEtSum(&(emObjectHandle->at(i)));
133  else isoValue = ecalEndcapIsol.getEnergySum(&(emObjectHandle->at(i)));
134  }
135 
136  //we subtract off the electron energy here as well
137  double subtractVal=0;
138 
139  if(useIsolEt_) subtractVal = superClus.get()->rawEnergy()*sin(2*atan(exp(-superClus.get()->eta())));
140  else subtractVal = superClus.get()->rawEnergy();
141 
142  if(subtract_) isoValue-= subtractVal;
143 
144  retV[i]=isoValue;
145  //all done, isolation is now in the map
146 
147  }//end of loop over em objects
148 
149  filler.insert(emObjectHandle,retV.begin(),retV.end());
150  filler.fill();
151 
152  //std::auto_ptr<reco::CandViewDoubleAssociations> isolMap(isoMap);
153  iEvent.put(isoMap);
154 
155 }
int i
Definition: DBlmapReader.cc:9
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:242
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:402
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86
std::string const & label() const
Definition: InputTag.h:42

Member Data Documentation

edm::ParameterSet EgammaEcalRecHitIsolationProducer::conf_
private
edm::InputTag EgammaEcalRecHitIsolationProducer::ecalBarrelRecHitCollection_
private
edm::InputTag EgammaEcalRecHitIsolationProducer::ecalBarrelRecHitProducer_
private
edm::InputTag EgammaEcalRecHitIsolationProducer::ecalEndcapRecHitCollection_
private
edm::InputTag EgammaEcalRecHitIsolationProducer::ecalEndcapRecHitProducer_
private
double EgammaEcalRecHitIsolationProducer::egIsoConeSizeInBarrel_
private
double EgammaEcalRecHitIsolationProducer::egIsoConeSizeInEndcap_
private
double EgammaEcalRecHitIsolationProducer::egIsoConeSizeOut_
private
double EgammaEcalRecHitIsolationProducer::egIsoEMinBarrel_
private
double EgammaEcalRecHitIsolationProducer::egIsoEMinEndcap_
private
double EgammaEcalRecHitIsolationProducer::egIsoJurassicWidth_
private
double EgammaEcalRecHitIsolationProducer::egIsoPtMinBarrel_
private
double EgammaEcalRecHitIsolationProducer::egIsoPtMinEndcap_
private
edm::InputTag EgammaEcalRecHitIsolationProducer::emObjectProducer_
private
bool EgammaEcalRecHitIsolationProducer::subtract_
private
bool EgammaEcalRecHitIsolationProducer::tryBoth_
private
bool EgammaEcalRecHitIsolationProducer::useIsolEt_
private
bool EgammaEcalRecHitIsolationProducer::useNumCrystals_
private
bool EgammaEcalRecHitIsolationProducer::vetoClustered_
private