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::EDProducer 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::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- 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 ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) 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::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- 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::EDProducer.

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  //create the meta hit collections inorder that we can pass them into the isolation objects
94 
95  EcalRecHitMetaCollection ecalBarrelHits(*ecalBarrelRecHitHandle);
96  EcalRecHitMetaCollection ecalEndcapHits(*ecalEndcapRecHitHandle);
97 
98  //Get Calo Geometry
100  iSetup.get<CaloGeometryRecord>().get(pG);
101  const CaloGeometry* caloGeom = pG.product();
102 
103  //reco::CandViewDoubleAssociations* isoMap = new reco::CandViewDoubleAssociations( reco::CandidateBaseRefProd( emObjectHandle ) );
104  std::auto_ptr<edm::ValueMap<double> > isoMap(new edm::ValueMap<double>());
105  edm::ValueMap<double>::Filler filler(*isoMap);
106  std::vector<double> retV(emObjectHandle->size(),0);
107 
109  ecalBarrelIsol.setUseNumCrystals(useNumCrystals_);
110  ecalBarrelIsol.setVetoClustered(vetoClustered_);
111 
113  ecalEndcapIsol.setUseNumCrystals(useNumCrystals_);
114  ecalEndcapIsol.setVetoClustered(vetoClustered_);
115 
116 
117  for( size_t i = 0 ; i < emObjectHandle->size(); ++i) {
118 
119  //i need to know if its in the barrel/endcap so I get the supercluster handle to find out the detector eta
120  //this might not be the best way, are we guaranteed that eta<1.5 is barrel
121  //this can be safely replaced by another method which determines where the emobject is
122  //then we either get the isolation Et or isolation Energy depending on user selection
123  double isoValue =0.;
124 
125  reco::SuperClusterRef superClus = emObjectHandle->at(i).get<reco::SuperClusterRef>();
126 
127  if(tryBoth_){ //barrel + endcap
128  if(useIsolEt_) isoValue = ecalBarrelIsol.getEtSum(&(emObjectHandle->at(i))) + ecalEndcapIsol.getEtSum(&(emObjectHandle->at(i)));
129  else isoValue = ecalBarrelIsol.getEnergySum(&(emObjectHandle->at(i))) + ecalEndcapIsol.getEnergySum(&(emObjectHandle->at(i)));
130  }
131  else if( fabs(superClus->eta())<1.479) { //barrel
132  if(useIsolEt_) isoValue = ecalBarrelIsol.getEtSum(&(emObjectHandle->at(i)));
133  else isoValue = ecalBarrelIsol.getEnergySum(&(emObjectHandle->at(i)));
134  }
135  else{ //endcap
136  if(useIsolEt_) isoValue = ecalEndcapIsol.getEtSum(&(emObjectHandle->at(i)));
137  else isoValue = ecalEndcapIsol.getEnergySum(&(emObjectHandle->at(i)));
138  }
139 
140  //we subtract off the electron energy here as well
141  double subtractVal=0;
142 
143  if(useIsolEt_) subtractVal = superClus.get()->rawEnergy()*sin(2*atan(exp(-superClus.get()->eta())));
144  else subtractVal = superClus.get()->rawEnergy();
145 
146  if(subtract_) isoValue-= subtractVal;
147 
148  retV[i]=isoValue;
149  //all done, isolation is now in the map
150 
151  }//end of loop over em objects
152 
153  filler.insert(emObjectHandle,retV.begin(),retV.end());
154  filler.fill();
155 
156  //std::auto_ptr<reco::CandViewDoubleAssociations> isolMap(isoMap);
157  iEvent.put(isoMap);
158 
159 }
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:94
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
std::string const & label() const
Definition: InputTag.h:42
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:242

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