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 hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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
 
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)
 
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::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 38 of file L1TPhysicalEtAdder.h.

Constructor & Destructor Documentation

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

Definition at line 89 of file L1TPhysicalEtAdder.cc.

References edm::ParameterSet::getParameter().

89  {
90 
91  produces<EGammaBxCollection>();
92  produces<TauBxCollection>("rlxTaus");
93  produces<TauBxCollection>("isoTaus");
94  produces<JetBxCollection>();
95  produces<JetBxCollection>("preGtJets");
96  produces<EtSumBxCollection>();
97  produces<CaloSpareBxCollection>("HFRingSums");
98  produces<CaloSpareBxCollection>("HFBitCounts");
99 
100  EGammaToken_ = consumes<EGammaBxCollection>(ps.getParameter<edm::InputTag>("InputCollection"));
101  RlxTauToken_ = consumes<TauBxCollection>(ps.getParameter<edm::InputTag>("InputRlxTauCollection"));
102  IsoTauToken_ = consumes<TauBxCollection>(ps.getParameter<edm::InputTag>("InputIsoTauCollection"));
103  JetToken_ = consumes<JetBxCollection>(ps.getParameter<edm::InputTag>("InputCollection"));
104  preGtJetToken_ = consumes<JetBxCollection>(ps.getParameter<edm::InputTag>("InputPreGtJetCollection"));
105  EtSumToken_ = consumes<EtSumBxCollection>(ps.getParameter<edm::InputTag>("InputCollection"));
106  HfSumsToken_ = consumes<CaloSpareBxCollection>(ps.getParameter<edm::InputTag>("InputHFSumsCollection"));
107  HfCountsToken_ = consumes<CaloSpareBxCollection>(ps.getParameter<edm::InputTag>("InputHFCountsCollection"));
108 }
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 110 of file L1TPhysicalEtAdder.cc.

110  {
111 
112 }

Member Function Documentation

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

Definition at line 343 of file L1TPhysicalEtAdder.cc.

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

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

Definition at line 116 of file L1TPhysicalEtAdder.cc.

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

117 {
118  // store new collections which include physical quantities
119  std::unique_ptr<EGammaBxCollection> new_egammas (new EGammaBxCollection);
120  std::unique_ptr<TauBxCollection> new_rlxtaus (new TauBxCollection);
121  std::unique_ptr<TauBxCollection> new_isotaus (new TauBxCollection);
122  std::unique_ptr<JetBxCollection> new_jets (new JetBxCollection);
123  std::unique_ptr<JetBxCollection> new_preGtJets (new JetBxCollection);
124  std::unique_ptr<EtSumBxCollection> new_etsums (new EtSumBxCollection);
125  std::unique_ptr<CaloSpareBxCollection> new_hfsums (new CaloSpareBxCollection);
126  std::unique_ptr<CaloSpareBxCollection> new_hfcounts (new CaloSpareBxCollection);
127 
129  edm::Handle<TauBxCollection> old_rlxtaus;
130  edm::Handle<TauBxCollection> old_isotaus;
132  edm::Handle<JetBxCollection> old_preGtJets;
136 
137  iEvent.getByToken(EGammaToken_, old_egammas);
138  iEvent.getByToken(RlxTauToken_, old_rlxtaus);
139  iEvent.getByToken(IsoTauToken_, old_isotaus);
140  iEvent.getByToken(JetToken_, old_jets);
141  iEvent.getByToken(preGtJetToken_, old_preGtJets);
142  iEvent.getByToken(EtSumToken_, old_etsums);
143  iEvent.getByToken(HfSumsToken_, old_hfsums);
144  iEvent.getByToken(HfCountsToken_, old_hfcounts);
145 
146  //get the proper scales for conversion to physical et
148  iSetup.get< L1EmEtScaleRcd >().get( emScale ) ;
149 
151  iSetup.get< L1JetEtScaleRcd >().get( jetScale ) ;
152 
153  edm::ESHandle< L1CaloEtScale > htMissScale ;
154  iSetup.get< L1HtMissScaleRcd >().get( htMissScale ) ;
155 
156  int firstBX = old_egammas->getFirstBX();
157  int lastBX = old_egammas->getLastBX();
158 
159  new_egammas->setBXRange(firstBX, lastBX);
160  new_rlxtaus->setBXRange(firstBX, lastBX);
161  new_isotaus->setBXRange(firstBX, lastBX);
162  new_jets->setBXRange(firstBX, lastBX);
163  new_preGtJets->setBXRange(firstBX, lastBX);
164  new_etsums->setBXRange(firstBX, lastBX);
165  new_hfsums->setBXRange(firstBX, lastBX);
166  new_hfcounts->setBXRange(firstBX, lastBX);
167 
168  for(int bx = firstBX; bx <= lastBX; ++bx)
169  {
170  for(EGammaBxCollection::const_iterator itEGamma = old_egammas->begin(bx);
171  itEGamma != old_egammas->end(bx); ++itEGamma)
172  {
173  //const double pt = itEGamma->hwPt() * emScale->linearLsb();
174  const double et = emScale->et( itEGamma->hwPt() );
175  const double eta = getPhysicalEta(itEGamma->hwEta());
176  const double phi = getPhysicalPhi(itEGamma->hwPhi());
177  math::PtEtaPhiMLorentzVector p4(et, eta, phi, 0);
178 
179  EGamma eg(*&p4, itEGamma->hwPt(),
180  itEGamma->hwEta(), itEGamma->hwPhi(),
181  itEGamma->hwQual(), itEGamma->hwIso());
182  new_egammas->push_back(bx, *&eg);
183 
184 
185  }
186 
187  for(TauBxCollection::const_iterator itTau = old_rlxtaus->begin(bx);
188  itTau != old_rlxtaus->end(bx); ++itTau)
189  {
190  // use the full-circle conversion to match l1extra, accounts for linearLsb and max value automatically
191  //const uint16_t rankPt = jetScale->rank((uint16_t)itTau->hwPt());
192  //const double et = jetScale->et( rankPt ) ;
193 
194  // or use the emScale to get finer-grained et
195  //const double et = itTau->hwPt() * emScale->linearLsb();
196 
197  // we are now already in the rankPt
198  const double et = jetScale->et( itTau->hwPt() );
199 
200  const double eta = getPhysicalEta(itTau->hwEta());
201  const double phi = getPhysicalPhi(itTau->hwPhi());
202  math::PtEtaPhiMLorentzVector p4(et, eta, phi, 0);
203 
204  Tau tau(*&p4, itTau->hwPt(),
205  itTau->hwEta(), itTau->hwPhi(),
206  itTau->hwQual(), itTau->hwIso());
207  new_rlxtaus->push_back(bx, *&tau);
208 
209  }
210 
211  for(TauBxCollection::const_iterator itTau = old_isotaus->begin(bx);
212  itTau != old_isotaus->end(bx); ++itTau)
213  {
214  // use the full-circle conversion to match l1extra, accounts for linearLsb and max value automatically
215  //const uint16_t rankPt = jetScale->rank((uint16_t)itTau->hwPt());
216  //const double et = jetScale->et( rankPt ) ;
217 
218  // or use the emScale to get finer-grained et
219  //const double et = itTau->hwPt() * emScale->linearLsb();
220 
221  // we are now already in the rankPt
222  const double et = jetScale->et( itTau->hwPt() );
223 
224  const double eta = getPhysicalEta(itTau->hwEta());
225  const double phi = getPhysicalPhi(itTau->hwPhi());
226  math::PtEtaPhiMLorentzVector p4(et, eta, phi, 0);
227 
228  Tau tau(*&p4, itTau->hwPt(),
229  itTau->hwEta(), itTau->hwPhi(),
230  itTau->hwQual(), itTau->hwIso());
231  new_isotaus->push_back(bx, *&tau);
232 
233  }
234 
235  for(JetBxCollection::const_iterator itJet = old_jets->begin(bx);
236  itJet != old_jets->end(bx); ++itJet)
237  {
238  // use the full-circle conversion to match l1extra, accounts for linearLsb and max value automatically
239  //const uint16_t rankPt = jetScale->rank((uint16_t)itJet->hwPt());
240  //const double et = jetScale->et( rankPt ) ;
241 
242  // or use the emScale to get finer-grained et
243  //const double et = itJet->hwPt() * emScale->linearLsb();
244 
245  // we are now already in the rankPt
246  const double et = jetScale->et( itJet->hwPt() );
247 
248  const bool forward = ((itJet->hwQual() & 0x2) != 0);
249  const double eta = getPhysicalEta(itJet->hwEta(), forward);
250  const double phi = getPhysicalPhi(itJet->hwPhi());
251  math::PtEtaPhiMLorentzVector p4(et, eta, phi, 0);
252 
253  Jet jet(*&p4, itJet->hwPt(),
254  itJet->hwEta(), itJet->hwPhi(),
255  itJet->hwQual());
256  new_jets->push_back(bx, *&jet);
257 
258  }
259 
260  for(JetBxCollection::const_iterator itJet = old_preGtJets->begin(bx);
261  itJet != old_preGtJets->end(bx); ++itJet)
262  {
263  // use the full-circle conversion to match l1extra, accounts for linearLsb and max value automatically
264  //const uint16_t rankPt = jetScale->rank((uint16_t)itJet->hwPt());
265  //const double et = jetScale->et( rankPt ) ;
266 
267  // or use the emScale to get finer-grained et
268  const double et = itJet->hwPt() * emScale->linearLsb();
269 
270  // we are now already in the rankPt
271  //const double et = jetScale->et( itJet->hwPt() );
272 
273  const bool forward = ((itJet->hwQual() & 0x2) != 0);
274  const double eta = getPhysicalEta(itJet->hwEta(), forward);
275  const double phi = getPhysicalPhi(itJet->hwPhi());
276  math::PtEtaPhiMLorentzVector p4(et, eta, phi, 0);
277 
278  Jet jet(*&p4, itJet->hwPt(),
279  itJet->hwEta(), itJet->hwPhi(),
280  itJet->hwQual());
281  new_preGtJets->push_back(bx, *&jet);
282 
283  }
284 
285 
286  for(EtSumBxCollection::const_iterator itEtSum = old_etsums->begin(bx);
287  itEtSum != old_etsums->end(bx); ++itEtSum)
288  {
289  double et = itEtSum->hwPt() * emScale->linearLsb();
290  //hack while we figure out the right scales
291  //double et = emScale->et( itEtSum->hwPt() );
292  const EtSum::EtSumType sumType = itEtSum->getType();
293 
294  const double eta = getPhysicalEta(itEtSum->hwEta());
295  double phi = getPhysicalPhi(itEtSum->hwPhi());
296  if(sumType == EtSum::EtSumType::kMissingHt){
297  et = htMissScale->et( itEtSum->hwPt() );
298  double regionPhiWidth=2. * 3.1415927 / L1CaloRegionDetId::N_PHI;
299  phi=phi+(regionPhiWidth/2.); // add the region half-width to match L1Extra MHT phi
300  }
301 
302 
303  math::PtEtaPhiMLorentzVector p4(et, eta, phi, 0);
304 
305  EtSum eg(*&p4, sumType, itEtSum->hwPt(),
306  itEtSum->hwEta(), itEtSum->hwPhi(),
307  itEtSum->hwQual());
308  new_etsums->push_back(bx, *&eg);
309 
310 
311  }
312 
313  for(CaloSpareBxCollection::const_iterator itCaloSpare = old_hfsums->begin(bx);
314  itCaloSpare != old_hfsums->end(bx); ++itCaloSpare)
315  {
316  //just pass through for now
317  //a different scale is needed depending on the type
318  new_hfsums->push_back(bx, *itCaloSpare);
319  }
320 
321  for(CaloSpareBxCollection::const_iterator itCaloSpare = old_hfcounts->begin(bx);
322  itCaloSpare != old_hfcounts->end(bx); ++itCaloSpare)
323  {
324  //just pass through for now
325  //a different scale is needed depending on the type
326  new_hfcounts->push_back(bx, *itCaloSpare);
327  }
328 
329  }
330 
331  iEvent.put(std::move(new_egammas));
332  iEvent.put(std::move(new_rlxtaus),"rlxTaus");
333  iEvent.put(std::move(new_isotaus),"isoTaus");
334  iEvent.put(std::move(new_jets));
335  iEvent.put(std::move(new_preGtJets),"preGtJets");
336  iEvent.put(std::move(new_etsums));
337  iEvent.put(std::move(new_hfsums),"HFRingSums");
338  iEvent.put(std::move(new_hfcounts),"HFBitCounts");
339 }
edm::EDGetToken JetToken_
const_iterator end(int bx) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
edm::EDGetToken HfSumsToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
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:53
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
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
et
define resolution functions of each parameter
T get() const
Definition: EventSetup.h:63
int getLastBX() const
edm::EDGetToken IsoTauToken_
static const unsigned N_PHI
const_iterator begin(int bx) const
EtSumType
Definition: EtSum.h:25
def move(src, dest)
Definition: eostools.py:510
std::vector< EGamma >::const_iterator const_iterator
Definition: BXVector.h:20

Member Data Documentation

edm::EDGetToken L1TPhysicalEtAdder::EGammaToken_
private

Definition at line 50 of file L1TPhysicalEtAdder.h.

edm::EDGetToken L1TPhysicalEtAdder::EtSumToken_
private

Definition at line 55 of file L1TPhysicalEtAdder.h.

edm::EDGetToken L1TPhysicalEtAdder::HfCountsToken_
private

Definition at line 57 of file L1TPhysicalEtAdder.h.

edm::EDGetToken L1TPhysicalEtAdder::HfSumsToken_
private

Definition at line 56 of file L1TPhysicalEtAdder.h.

edm::EDGetToken L1TPhysicalEtAdder::IsoTauToken_
private

Definition at line 52 of file L1TPhysicalEtAdder.h.

edm::EDGetToken L1TPhysicalEtAdder::JetToken_
private

Definition at line 53 of file L1TPhysicalEtAdder.h.

edm::EDGetToken L1TPhysicalEtAdder::preGtJetToken_
private

Definition at line 54 of file L1TPhysicalEtAdder.h.

edm::EDGetToken L1TPhysicalEtAdder::RlxTauToken_
private

Definition at line 51 of file L1TPhysicalEtAdder.h.