CMS 3D CMS Logo

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

#include <L1TPhysicalEtAdder.h>

Inheritance diagram for L1TPhysicalEtAdder:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 L1TPhysicalEtAdder (const edm::ParameterSet &ps)
 
 ~L1TPhysicalEtAdder () override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- 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 ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
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, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
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
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

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

Private Member Functions

void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 

Private Attributes

edm::EDGetToken EGammaToken_
 
edm::EDGetToken EtSumToken_
 
edm::EDGetToken HfCountsToken_
 
edm::EDGetToken HfSumsToken_
 
edm::EDGetToken IsoTauToken_
 
edm::EDGetToken JetToken_
 
edm::EDGetToken preGtJetToken_
 
edm::EDGetToken RlxTauToken_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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 36 of file L1TPhysicalEtAdder.h.

Constructor & Destructor Documentation

L1TPhysicalEtAdder::L1TPhysicalEtAdder ( const edm::ParameterSet ps)
explicit

Definition at line 82 of file L1TPhysicalEtAdder.cc.

References edm::ParameterSet::getParameter().

82  {
83  produces<EGammaBxCollection>();
84  produces<TauBxCollection>("rlxTaus");
85  produces<TauBxCollection>("isoTaus");
86  produces<JetBxCollection>();
87  produces<JetBxCollection>("preGtJets");
88  produces<EtSumBxCollection>();
89  produces<CaloSpareBxCollection>("HFRingSums");
90  produces<CaloSpareBxCollection>("HFBitCounts");
91 
92  EGammaToken_ = consumes<EGammaBxCollection>(ps.getParameter<edm::InputTag>("InputCollection"));
93  RlxTauToken_ = consumes<TauBxCollection>(ps.getParameter<edm::InputTag>("InputRlxTauCollection"));
94  IsoTauToken_ = consumes<TauBxCollection>(ps.getParameter<edm::InputTag>("InputIsoTauCollection"));
95  JetToken_ = consumes<JetBxCollection>(ps.getParameter<edm::InputTag>("InputCollection"));
96  preGtJetToken_ = consumes<JetBxCollection>(ps.getParameter<edm::InputTag>("InputPreGtJetCollection"));
97  EtSumToken_ = consumes<EtSumBxCollection>(ps.getParameter<edm::InputTag>("InputCollection"));
98  HfSumsToken_ = consumes<CaloSpareBxCollection>(ps.getParameter<edm::InputTag>("InputHFSumsCollection"));
99  HfCountsToken_ = consumes<CaloSpareBxCollection>(ps.getParameter<edm::InputTag>("InputHFCountsCollection"));
100 }
edm::EDGetToken JetToken_
T getParameter(std::string const &) const
edm::EDGetToken HfSumsToken_
edm::EDGetToken HfCountsToken_
edm::EDGetToken EtSumToken_
edm::EDGetToken EGammaToken_
edm::EDGetToken RlxTauToken_
edm::EDGetToken preGtJetToken_
edm::EDGetToken IsoTauToken_
L1TPhysicalEtAdder::~L1TPhysicalEtAdder ( )
override

Definition at line 102 of file L1TPhysicalEtAdder.cc.

102 {}

Member Function Documentation

void L1TPhysicalEtAdder::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 294 of file L1TPhysicalEtAdder.cc.

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

294  {
295  //The following says we do not know what parameters are allowed so do no validation
296  // Please change this to state exactly what you do use, even if it is no parameters
298  desc.setUnknown();
299  descriptions.addDefault(desc);
300 }
void addDefault(ParameterSetDescription const &psetDescription)
void L1TPhysicalEtAdder::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivate

Definition at line 105 of file L1TPhysicalEtAdder.cc.

References BXVector< T >::begin(), l1GtPatternGenerator_cfi::bx, BXVector< T >::end(), EgHLTOffHistBins_cfi::et, L1CaloEtScale::et(), PVValHelper::eta, RPCBxOrConfig_cff::firstBX, edm::EventSetup::get(), edm::Event::getByToken(), BXVector< T >::getFirstBX(), BXVector< T >::getLastBX(), metsig::jet, wplusjetsAnalysis_cfi::jetScale, L1Analysis::kMissingHt, RPCBxOrConfig_cff::lastBX, L1CaloEtScale::linearLsb(), eostools::move(), L1CaloRegionDetId::N_PHI, p4, edm::Event::put(), and metsig::tau.

105  {
106  // store new collections which include physical quantities
107  std::unique_ptr<EGammaBxCollection> new_egammas(new EGammaBxCollection);
108  std::unique_ptr<TauBxCollection> new_rlxtaus(new TauBxCollection);
109  std::unique_ptr<TauBxCollection> new_isotaus(new TauBxCollection);
110  std::unique_ptr<JetBxCollection> new_jets(new JetBxCollection);
111  std::unique_ptr<JetBxCollection> new_preGtJets(new JetBxCollection);
112  std::unique_ptr<EtSumBxCollection> new_etsums(new EtSumBxCollection);
113  std::unique_ptr<CaloSpareBxCollection> new_hfsums(new CaloSpareBxCollection);
114  std::unique_ptr<CaloSpareBxCollection> new_hfcounts(new CaloSpareBxCollection);
115 
117  edm::Handle<TauBxCollection> old_rlxtaus;
118  edm::Handle<TauBxCollection> old_isotaus;
120  edm::Handle<JetBxCollection> old_preGtJets;
124 
125  iEvent.getByToken(EGammaToken_, old_egammas);
126  iEvent.getByToken(RlxTauToken_, old_rlxtaus);
127  iEvent.getByToken(IsoTauToken_, old_isotaus);
128  iEvent.getByToken(JetToken_, old_jets);
129  iEvent.getByToken(preGtJetToken_, old_preGtJets);
130  iEvent.getByToken(EtSumToken_, old_etsums);
131  iEvent.getByToken(HfSumsToken_, old_hfsums);
132  iEvent.getByToken(HfCountsToken_, old_hfcounts);
133 
134  //get the proper scales for conversion to physical et
136  iSetup.get<L1EmEtScaleRcd>().get(emScale);
137 
139  iSetup.get<L1JetEtScaleRcd>().get(jetScale);
140 
141  edm::ESHandle<L1CaloEtScale> htMissScale;
142  iSetup.get<L1HtMissScaleRcd>().get(htMissScale);
143 
144  int firstBX = old_egammas->getFirstBX();
145  int lastBX = old_egammas->getLastBX();
146 
147  new_egammas->setBXRange(firstBX, lastBX);
148  new_rlxtaus->setBXRange(firstBX, lastBX);
149  new_isotaus->setBXRange(firstBX, lastBX);
150  new_jets->setBXRange(firstBX, lastBX);
151  new_preGtJets->setBXRange(firstBX, lastBX);
152  new_etsums->setBXRange(firstBX, lastBX);
153  new_hfsums->setBXRange(firstBX, lastBX);
154  new_hfcounts->setBXRange(firstBX, lastBX);
155 
156  for (int bx = firstBX; bx <= lastBX; ++bx) {
157  for (EGammaBxCollection::const_iterator itEGamma = old_egammas->begin(bx); itEGamma != old_egammas->end(bx);
158  ++itEGamma) {
159  //const double pt = itEGamma->hwPt() * emScale->linearLsb();
160  const double et = emScale->et(itEGamma->hwPt());
161  const double eta = getPhysicalEta(itEGamma->hwEta());
162  const double phi = getPhysicalPhi(itEGamma->hwPhi());
163  math::PtEtaPhiMLorentzVector p4(et, eta, phi, 0);
164 
165  EGamma eg(*&p4, itEGamma->hwPt(), itEGamma->hwEta(), itEGamma->hwPhi(), itEGamma->hwQual(), itEGamma->hwIso());
166  new_egammas->push_back(bx, *&eg);
167  }
168 
169  for (TauBxCollection::const_iterator itTau = old_rlxtaus->begin(bx); itTau != old_rlxtaus->end(bx); ++itTau) {
170  // use the full-circle conversion to match l1extra, accounts for linearLsb and max value automatically
171  //const uint16_t rankPt = jetScale->rank((uint16_t)itTau->hwPt());
172  //const double et = jetScale->et( rankPt ) ;
173 
174  // or use the emScale to get finer-grained et
175  //const double et = itTau->hwPt() * emScale->linearLsb();
176 
177  // we are now already in the rankPt
178  const double et = jetScale->et(itTau->hwPt());
179 
180  const double eta = getPhysicalEta(itTau->hwEta());
181  const double phi = getPhysicalPhi(itTau->hwPhi());
182  math::PtEtaPhiMLorentzVector p4(et, eta, phi, 0);
183 
184  Tau tau(*&p4, itTau->hwPt(), itTau->hwEta(), itTau->hwPhi(), itTau->hwQual(), itTau->hwIso());
185  new_rlxtaus->push_back(bx, *&tau);
186  }
187 
188  for (TauBxCollection::const_iterator itTau = old_isotaus->begin(bx); itTau != old_isotaus->end(bx); ++itTau) {
189  // use the full-circle conversion to match l1extra, accounts for linearLsb and max value automatically
190  //const uint16_t rankPt = jetScale->rank((uint16_t)itTau->hwPt());
191  //const double et = jetScale->et( rankPt ) ;
192 
193  // or use the emScale to get finer-grained et
194  //const double et = itTau->hwPt() * emScale->linearLsb();
195 
196  // we are now already in the rankPt
197  const double et = jetScale->et(itTau->hwPt());
198 
199  const double eta = getPhysicalEta(itTau->hwEta());
200  const double phi = getPhysicalPhi(itTau->hwPhi());
201  math::PtEtaPhiMLorentzVector p4(et, eta, phi, 0);
202 
203  Tau tau(*&p4, itTau->hwPt(), itTau->hwEta(), itTau->hwPhi(), itTau->hwQual(), itTau->hwIso());
204  new_isotaus->push_back(bx, *&tau);
205  }
206 
207  for (JetBxCollection::const_iterator itJet = old_jets->begin(bx); itJet != old_jets->end(bx); ++itJet) {
208  // use the full-circle conversion to match l1extra, accounts for linearLsb and max value automatically
209  //const uint16_t rankPt = jetScale->rank((uint16_t)itJet->hwPt());
210  //const double et = jetScale->et( rankPt ) ;
211 
212  // or use the emScale to get finer-grained et
213  //const double et = itJet->hwPt() * emScale->linearLsb();
214 
215  // we are now already in the rankPt
216  const double et = jetScale->et(itJet->hwPt());
217 
218  const bool forward = ((itJet->hwQual() & 0x2) != 0);
219  const double eta = getPhysicalEta(itJet->hwEta(), forward);
220  const double phi = getPhysicalPhi(itJet->hwPhi());
221  math::PtEtaPhiMLorentzVector p4(et, eta, phi, 0);
222 
223  Jet jet(*&p4, itJet->hwPt(), itJet->hwEta(), itJet->hwPhi(), itJet->hwQual());
224  new_jets->push_back(bx, *&jet);
225  }
226 
227  for (JetBxCollection::const_iterator itJet = old_preGtJets->begin(bx); itJet != old_preGtJets->end(bx); ++itJet) {
228  // use the full-circle conversion to match l1extra, accounts for linearLsb and max value automatically
229  //const uint16_t rankPt = jetScale->rank((uint16_t)itJet->hwPt());
230  //const double et = jetScale->et( rankPt ) ;
231 
232  // or use the emScale to get finer-grained et
233  const double et = itJet->hwPt() * emScale->linearLsb();
234 
235  // we are now already in the rankPt
236  //const double et = jetScale->et( itJet->hwPt() );
237 
238  const bool forward = ((itJet->hwQual() & 0x2) != 0);
239  const double eta = getPhysicalEta(itJet->hwEta(), forward);
240  const double phi = getPhysicalPhi(itJet->hwPhi());
241  math::PtEtaPhiMLorentzVector p4(et, eta, phi, 0);
242 
243  Jet jet(*&p4, itJet->hwPt(), itJet->hwEta(), itJet->hwPhi(), itJet->hwQual());
244  new_preGtJets->push_back(bx, *&jet);
245  }
246 
247  for (EtSumBxCollection::const_iterator itEtSum = old_etsums->begin(bx); itEtSum != old_etsums->end(bx); ++itEtSum) {
248  double et = itEtSum->hwPt() * emScale->linearLsb();
249  //hack while we figure out the right scales
250  //double et = emScale->et( itEtSum->hwPt() );
251  const EtSum::EtSumType sumType = itEtSum->getType();
252 
253  const double eta = getPhysicalEta(itEtSum->hwEta());
254  double phi = getPhysicalPhi(itEtSum->hwPhi());
255  if (sumType == EtSum::EtSumType::kMissingHt) {
256  et = htMissScale->et(itEtSum->hwPt());
257  double regionPhiWidth = 2. * 3.1415927 / L1CaloRegionDetId::N_PHI;
258  phi = phi + (regionPhiWidth / 2.); // add the region half-width to match L1Extra MHT phi
259  }
260 
261  math::PtEtaPhiMLorentzVector p4(et, eta, phi, 0);
262 
263  EtSum eg(*&p4, sumType, itEtSum->hwPt(), itEtSum->hwEta(), itEtSum->hwPhi(), itEtSum->hwQual());
264  new_etsums->push_back(bx, *&eg);
265  }
266 
267  for (CaloSpareBxCollection::const_iterator itCaloSpare = old_hfsums->begin(bx); itCaloSpare != old_hfsums->end(bx);
268  ++itCaloSpare) {
269  //just pass through for now
270  //a different scale is needed depending on the type
271  new_hfsums->push_back(bx, *itCaloSpare);
272  }
273 
274  for (CaloSpareBxCollection::const_iterator itCaloSpare = old_hfcounts->begin(bx);
275  itCaloSpare != old_hfcounts->end(bx);
276  ++itCaloSpare) {
277  //just pass through for now
278  //a different scale is needed depending on the type
279  new_hfcounts->push_back(bx, *itCaloSpare);
280  }
281  }
282 
283  iEvent.put(std::move(new_egammas));
284  iEvent.put(std::move(new_rlxtaus), "rlxTaus");
285  iEvent.put(std::move(new_isotaus), "isoTaus");
286  iEvent.put(std::move(new_jets));
287  iEvent.put(std::move(new_preGtJets), "preGtJets");
288  iEvent.put(std::move(new_etsums));
289  iEvent.put(std::move(new_hfsums), "HFRingSums");
290  iEvent.put(std::move(new_hfcounts), "HFBitCounts");
291 }
edm::EDGetToken JetToken_
const_iterator end(int bx) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
edm::EDGetToken HfSumsToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
edm::EDGetToken HfCountsToken_
edm::EDGetToken EtSumToken_
double et(const uint16_t rank) const
convert from rank to physically meaningful quantity
double linearLsb() const
get LSB of linear input scale
Definition: L1CaloEtScale.h:54
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
std::vector< T >::const_iterator const_iterator
Definition: BXVector.h:18
edm::EDGetToken EGammaToken_
Definition: Jet.py:1
double p4[4]
Definition: TauolaWrapper.h:92
edm::EDGetToken RlxTauToken_
Definition: Tau.py:1
edm::EDGetToken preGtJetToken_
int getFirstBX() const
T get() const
Definition: EventSetup.h:73
int getLastBX() const
edm::EDGetToken IsoTauToken_
static const unsigned N_PHI
const_iterator begin(int bx) const
EtSumType
Definition: EtSum.h:22
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

edm::EDGetToken L1TPhysicalEtAdder::EGammaToken_
private

Definition at line 48 of file L1TPhysicalEtAdder.h.

edm::EDGetToken L1TPhysicalEtAdder::EtSumToken_
private

Definition at line 53 of file L1TPhysicalEtAdder.h.

edm::EDGetToken L1TPhysicalEtAdder::HfCountsToken_
private

Definition at line 55 of file L1TPhysicalEtAdder.h.

edm::EDGetToken L1TPhysicalEtAdder::HfSumsToken_
private

Definition at line 54 of file L1TPhysicalEtAdder.h.

edm::EDGetToken L1TPhysicalEtAdder::IsoTauToken_
private

Definition at line 50 of file L1TPhysicalEtAdder.h.

edm::EDGetToken L1TPhysicalEtAdder::JetToken_
private

Definition at line 51 of file L1TPhysicalEtAdder.h.

edm::EDGetToken L1TPhysicalEtAdder::preGtJetToken_
private

Definition at line 52 of file L1TPhysicalEtAdder.h.

edm::EDGetToken L1TPhysicalEtAdder::RlxTauToken_
private

Definition at line 49 of file L1TPhysicalEtAdder.h.