CMS 3D CMS Logo

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

#include <PhysicalEtAdder.h>

Inheritance diagram for l1t::PhysicalEtAdder:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 PhysicalEtAdder (const edm::ParameterSet &ps)
 
 ~PhysicalEtAdder ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
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 ()
 
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 ()
 

Static Public Member Functions

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

Private Member Functions

virtual void beginJob () override
 
virtual void endJob () override
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

edm::EDGetToken CaloSpareToken_
 
edm::EDGetToken EGammaToken_
 
edm::EDGetToken EtSumToken_
 
edm::EDGetToken JetToken_
 
edm::EDGetToken TauToken_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- 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 40 of file PhysicalEtAdder.h.

Constructor & Destructor Documentation

l1t::PhysicalEtAdder::PhysicalEtAdder ( const edm::ParameterSet ps)
explicit

Definition at line 27 of file PhysicalEtAdder.cc.

References CaloSpareToken_, EGammaToken_, EtSumToken_, edm::ParameterSet::getParameter(), JetToken_, and TauToken_.

27  {
28 
29  produces<l1t::EGammaBxCollection>();
30  produces<l1t::TauBxCollection>();
31  produces<l1t::JetBxCollection>();
32  produces<l1t::EtSumBxCollection>();
33  produces<l1t::CaloSpareBxCollection>();
34 
35  EGammaToken_ = consumes<l1t::EGammaBxCollection>(ps.getParameter<edm::InputTag>("InputCollection"));
36  TauToken_ = consumes<l1t::TauBxCollection>(ps.getParameter<edm::InputTag>("InputCollection"));
37  JetToken_ = consumes<l1t::JetBxCollection>(ps.getParameter<edm::InputTag>("InputCollection"));
38  EtSumToken_ = consumes<l1t::EtSumBxCollection>(ps.getParameter<edm::InputTag>("InputCollection"));
39  CaloSpareToken_ = consumes<l1t::CaloSpareBxCollection>(ps.getParameter<edm::InputTag>("InputCollection"));
40 }
T getParameter(std::string const &) const
edm::EDGetToken EtSumToken_
edm::EDGetToken TauToken_
edm::EDGetToken CaloSpareToken_
edm::EDGetToken EGammaToken_
edm::EDGetToken JetToken_
l1t::PhysicalEtAdder::~PhysicalEtAdder ( )

Definition at line 42 of file PhysicalEtAdder.cc.

42  {
43 
44 }

Member Function Documentation

void l1t::PhysicalEtAdder::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 197 of file PhysicalEtAdder.cc.

198 {
199 }
void l1t::PhysicalEtAdder::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 203 of file PhysicalEtAdder.cc.

203  {
204 }
void l1t::PhysicalEtAdder::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 242 of file PhysicalEtAdder.cc.

References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().

242  {
243  //The following says we do not know what parameters are allowed so do no validation
244  // Please change this to state exactly what you do use, even if it is no parameters
246  desc.setUnknown();
247  descriptions.addDefault(desc);
248 }
void addDefault(ParameterSetDescription const &psetDescription)
void l1t::PhysicalEtAdder::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 48 of file PhysicalEtAdder.cc.

References eta(), edm::EventSetup::get(), edm::Event::getByToken(), getPhysicalEta(), getPhysicalPhi(), metsig::jet, p4, phi, edm::Event::put(), and metsig::tau.

49 {
50  // store new collections which include physical quantities
51  std::auto_ptr<l1t::EGammaBxCollection> new_egammas (new l1t::EGammaBxCollection);
52  std::auto_ptr<l1t::TauBxCollection> new_taus (new l1t::TauBxCollection);
53  std::auto_ptr<l1t::JetBxCollection> new_jets (new l1t::JetBxCollection);
54  std::auto_ptr<l1t::EtSumBxCollection> new_etsums (new l1t::EtSumBxCollection);
55  std::auto_ptr<l1t::CaloSpareBxCollection> new_calospares (new l1t::CaloSpareBxCollection);
56 
62 
63  iEvent.getByToken(EGammaToken_, old_egammas);
64  iEvent.getByToken(TauToken_, old_taus);
65  iEvent.getByToken(JetToken_, old_jets);
66  iEvent.getByToken(EtSumToken_, old_etsums);
67  iEvent.getByToken(CaloSpareToken_, old_calospares);
68 
69  //get the proper scales for conversion to physical et
71  iSetup.get< L1EmEtScaleRcd >().get( emScale ) ;
72 
74  iSetup.get< L1JetEtScaleRcd >().get( jetScale ) ;
75 
76  edm::ESHandle< L1CaloEtScale > htMissScale ;
77  iSetup.get< L1HtMissScaleRcd >().get( htMissScale ) ;
78 
79  int firstBX = old_egammas->getFirstBX();
80  int lastBX = old_egammas->getLastBX();
81 
82  new_egammas->setBXRange(firstBX, lastBX);
83  new_taus->setBXRange(firstBX, lastBX);
84  new_jets->setBXRange(firstBX, lastBX);
85  new_taus->setBXRange(firstBX, lastBX);
86  new_calospares->setBXRange(firstBX, lastBX);
87 
88  for(int bx = firstBX; bx <= lastBX; ++bx)
89  {
90  for(l1t::EGammaBxCollection::const_iterator itEGamma = old_egammas->begin(bx);
91  itEGamma != old_egammas->end(bx); ++itEGamma)
92  {
93  //const double pt = itEGamma->hwPt() * emScale->linearLsb();
94  const double et = emScale->et( itEGamma->hwPt() );
95  const double eta = getPhysicalEta(itEGamma->hwEta());
96  const double phi = getPhysicalPhi(itEGamma->hwPhi());
97  math::PtEtaPhiMLorentzVector p4(et, eta, phi, 0);
98 
99  l1t::EGamma eg(*&p4, itEGamma->hwPt(),
100  itEGamma->hwEta(), itEGamma->hwPhi(),
101  itEGamma->hwQual(), itEGamma->hwIso());
102  new_egammas->push_back(bx, *&eg);
103 
104 
105  }
106 
107  for(l1t::TauBxCollection::const_iterator itTau = old_taus->begin(bx);
108  itTau != old_taus->end(bx); ++itTau)
109  {
110  // use the full-circle conversion to match l1extra, accounts for linearLsb and max value automatically
111  //const uint16_t rankPt = jetScale->rank((uint16_t)itTau->hwPt());
112  //const double et = jetScale->et( rankPt ) ;
113 
114  // or use the emScale to get finer-grained et
115  //const double et = itTau->hwPt() * emScale->linearLsb();
116 
117  // we are now already in the rankPt
118  const double et = jetScale->et( itTau->hwPt() );
119 
120  const double eta = getPhysicalEta(itTau->hwEta());
121  const double phi = getPhysicalPhi(itTau->hwPhi());
122  math::PtEtaPhiMLorentzVector p4(et, eta, phi, 0);
123 
124  l1t::Tau tau(*&p4, itTau->hwPt(),
125  itTau->hwEta(), itTau->hwPhi(),
126  itTau->hwQual(), itTau->hwIso());
127  new_taus->push_back(bx, *&tau);
128 
129  }
130 
131  for(l1t::JetBxCollection::const_iterator itJet = old_jets->begin(bx);
132  itJet != old_jets->end(bx); ++itJet)
133  {
134  // use the full-circle conversion to match l1extra, accounts for linearLsb and max value automatically
135  //const uint16_t rankPt = jetScale->rank((uint16_t)itJet->hwPt());
136  //const double et = jetScale->et( rankPt ) ;
137 
138  // or use the emScale to get finer-grained et
139  //const double et = itJet->hwPt() * emScale->linearLsb();
140 
141  // we are now already in the rankPt
142  const double et = jetScale->et( itJet->hwPt() );
143 
144  const bool forward = ((itJet->hwQual() & 0x2) != 0);
145  const double eta = getPhysicalEta(itJet->hwEta(), forward);
146  const double phi = getPhysicalPhi(itJet->hwPhi());
147  math::PtEtaPhiMLorentzVector p4(et, eta, phi, 0);
148 
149  l1t::Jet jet(*&p4, itJet->hwPt(),
150  itJet->hwEta(), itJet->hwPhi(),
151  itJet->hwQual());
152  new_jets->push_back(bx, *&jet);
153 
154  }
155 
156  for(l1t::EtSumBxCollection::const_iterator itEtSum = old_etsums->begin(bx);
157  itEtSum != old_etsums->end(bx); ++itEtSum)
158  {
159  double et = itEtSum->hwPt() * emScale->linearLsb();
160  //hack while we figure out the right scales
161  //double et = emScale->et( itEtSum->hwPt() );
162  const l1t::EtSum::EtSumType sumType = itEtSum->getType();
163  if(sumType == EtSum::EtSumType::kMissingHt)
164  et = htMissScale->et( itEtSum->hwPt() );
165 
166  const double eta = getPhysicalEta(itEtSum->hwEta());
167  const double phi = getPhysicalPhi(itEtSum->hwPhi());
168 
169  math::PtEtaPhiMLorentzVector p4(et, eta, phi, 0);
170 
171  l1t::EtSum eg(*&p4, sumType, itEtSum->hwPt(),
172  itEtSum->hwEta(), itEtSum->hwPhi(),
173  itEtSum->hwQual());
174  new_etsums->push_back(bx, *&eg);
175 
176 
177  }
178 
179  for(l1t::CaloSpareBxCollection::const_iterator itCaloSpare = old_calospares->begin(bx);
180  itCaloSpare != old_calospares->end(bx); ++itCaloSpare)
181  {
182  //just pass through for now
183  //a different scale is needed depending on the type
184  new_calospares->push_back(bx, *itCaloSpare);
185  }
186  }
187 
188  iEvent.put(new_egammas);
189  iEvent.put(new_taus);
190  iEvent.put(new_jets);
191  iEvent.put(new_etsums);
192  iEvent.put(new_calospares);
193 }
edm::EDGetToken EtSumToken_
double getPhysicalEta(int etaIndex, bool forward=false)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
edm::EDGetToken TauToken_
Definition: Tau.h:13
edm::EDGetToken CaloSpareToken_
T eta() const
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
Definition: Jet.h:13
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
double p4[4]
Definition: TauolaWrapper.h:92
double getPhysicalPhi(int phiIndex)
const T & get() const
Definition: EventSetup.h:55
edm::EDGetToken EGammaToken_
edm::EDGetToken JetToken_
EtSumType
Definition: EtSum.h:17
std::vector< EGamma >::const_iterator const_iterator
Definition: BXVector.h:16
Definition: DDAxes.h:10

Member Data Documentation

edm::EDGetToken l1t::PhysicalEtAdder::CaloSpareToken_
private

Definition at line 63 of file PhysicalEtAdder.h.

Referenced by PhysicalEtAdder().

edm::EDGetToken l1t::PhysicalEtAdder::EGammaToken_
private

Definition at line 59 of file PhysicalEtAdder.h.

Referenced by PhysicalEtAdder().

edm::EDGetToken l1t::PhysicalEtAdder::EtSumToken_
private

Definition at line 62 of file PhysicalEtAdder.h.

Referenced by PhysicalEtAdder().

edm::EDGetToken l1t::PhysicalEtAdder::JetToken_
private

Definition at line 61 of file PhysicalEtAdder.h.

Referenced by PhysicalEtAdder().

edm::EDGetToken l1t::PhysicalEtAdder::TauToken_
private

Definition at line 60 of file PhysicalEtAdder.h.

Referenced by PhysicalEtAdder().