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
L1TPhysicalEtAdder Class Reference

#include <L1TPhysicalEtAdder.h>

Inheritance diagram for L1TPhysicalEtAdder:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 L1TPhysicalEtAdder (const edm::ParameterSet &ps)
 
 ~L1TPhysicalEtAdder ()
 
- 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 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::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 39 of file L1TPhysicalEtAdder.h.

Constructor & Destructor Documentation

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

Definition at line 29 of file L1TPhysicalEtAdder.cc.

References edm::ParameterSet::getParameter().

29  {
30 
31  produces<EGammaBxCollection>();
32  produces<TauBxCollection>("rlxTaus");
33  produces<TauBxCollection>("isoTaus");
34  produces<JetBxCollection>();
35  produces<JetBxCollection>("preGtJets");
36  produces<EtSumBxCollection>();
37  produces<CaloSpareBxCollection>("HFRingSums");
38  produces<CaloSpareBxCollection>("HFBitCounts");
39 
40  EGammaToken_ = consumes<EGammaBxCollection>(ps.getParameter<edm::InputTag>("InputCollection"));
41  RlxTauToken_ = consumes<TauBxCollection>(ps.getParameter<edm::InputTag>("InputRlxTauCollection"));
42  IsoTauToken_ = consumes<TauBxCollection>(ps.getParameter<edm::InputTag>("InputIsoTauCollection"));
43  JetToken_ = consumes<JetBxCollection>(ps.getParameter<edm::InputTag>("InputCollection"));
44  preGtJetToken_ = consumes<JetBxCollection>(ps.getParameter<edm::InputTag>("InputPreGtJetCollection"));
45  EtSumToken_ = consumes<EtSumBxCollection>(ps.getParameter<edm::InputTag>("InputCollection"));
46  HfSumsToken_ = consumes<CaloSpareBxCollection>(ps.getParameter<edm::InputTag>("InputHFSumsCollection"));
47  HfCountsToken_ = consumes<CaloSpareBxCollection>(ps.getParameter<edm::InputTag>("InputHFCountsCollection"));
48 }
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 ( )

Definition at line 50 of file L1TPhysicalEtAdder.cc.

50  {
51 
52 }

Member Function Documentation

void L1TPhysicalEtAdder::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 283 of file L1TPhysicalEtAdder.cc.

284 {
285 }
void L1TPhysicalEtAdder::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 289 of file L1TPhysicalEtAdder.cc.

289  {
290 }
void L1TPhysicalEtAdder::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 328 of file L1TPhysicalEtAdder.cc.

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

328  {
329  //The following says we do not know what parameters are allowed so do no validation
330  // Please change this to state exactly what you do use, even if it is no parameters
332  desc.setUnknown();
333  descriptions.addDefault(desc);
334 }
void addDefault(ParameterSetDescription const &psetDescription)
void L1TPhysicalEtAdder::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 56 of file L1TPhysicalEtAdder.cc.

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

57 {
58  // store new collections which include physical quantities
59  std::auto_ptr<EGammaBxCollection> new_egammas (new EGammaBxCollection);
60  std::auto_ptr<TauBxCollection> new_rlxtaus (new TauBxCollection);
61  std::auto_ptr<TauBxCollection> new_isotaus (new TauBxCollection);
62  std::auto_ptr<JetBxCollection> new_jets (new JetBxCollection);
63  std::auto_ptr<JetBxCollection> new_preGtJets (new JetBxCollection);
64  std::auto_ptr<EtSumBxCollection> new_etsums (new EtSumBxCollection);
65  std::auto_ptr<CaloSpareBxCollection> new_hfsums (new CaloSpareBxCollection);
66  std::auto_ptr<CaloSpareBxCollection> new_hfcounts (new CaloSpareBxCollection);
67 
69  edm::Handle<TauBxCollection> old_rlxtaus;
70  edm::Handle<TauBxCollection> old_isotaus;
72  edm::Handle<JetBxCollection> old_preGtJets;
76 
77  iEvent.getByToken(EGammaToken_, old_egammas);
78  iEvent.getByToken(RlxTauToken_, old_rlxtaus);
79  iEvent.getByToken(IsoTauToken_, old_isotaus);
80  iEvent.getByToken(JetToken_, old_jets);
81  iEvent.getByToken(preGtJetToken_, old_preGtJets);
82  iEvent.getByToken(EtSumToken_, old_etsums);
83  iEvent.getByToken(HfSumsToken_, old_hfsums);
84  iEvent.getByToken(HfCountsToken_, old_hfcounts);
85 
86  //get the proper scales for conversion to physical et
88  iSetup.get< L1EmEtScaleRcd >().get( emScale ) ;
89 
91  iSetup.get< L1JetEtScaleRcd >().get( jetScale ) ;
92 
93  edm::ESHandle< L1CaloEtScale > htMissScale ;
94  iSetup.get< L1HtMissScaleRcd >().get( htMissScale ) ;
95 
96  int firstBX = old_egammas->getFirstBX();
97  int lastBX = old_egammas->getLastBX();
98 
99  new_egammas->setBXRange(firstBX, lastBX);
100  new_rlxtaus->setBXRange(firstBX, lastBX);
101  new_isotaus->setBXRange(firstBX, lastBX);
102  new_jets->setBXRange(firstBX, lastBX);
103  new_preGtJets->setBXRange(firstBX, lastBX);
104  new_etsums->setBXRange(firstBX, lastBX);
105  new_hfsums->setBXRange(firstBX, lastBX);
106  new_hfcounts->setBXRange(firstBX, lastBX);
107 
108  for(int bx = firstBX; bx <= lastBX; ++bx)
109  {
110  for(EGammaBxCollection::const_iterator itEGamma = old_egammas->begin(bx);
111  itEGamma != old_egammas->end(bx); ++itEGamma)
112  {
113  //const double pt = itEGamma->hwPt() * emScale->linearLsb();
114  const double et = emScale->et( itEGamma->hwPt() );
115  const double eta = getPhysicalEta(itEGamma->hwEta());
116  const double phi = getPhysicalPhi(itEGamma->hwPhi());
117  math::PtEtaPhiMLorentzVector p4(et, eta, phi, 0);
118 
119  EGamma eg(*&p4, itEGamma->hwPt(),
120  itEGamma->hwEta(), itEGamma->hwPhi(),
121  itEGamma->hwQual(), itEGamma->hwIso());
122  new_egammas->push_back(bx, *&eg);
123 
124 
125  }
126 
127  for(TauBxCollection::const_iterator itTau = old_rlxtaus->begin(bx);
128  itTau != old_rlxtaus->end(bx); ++itTau)
129  {
130  // use the full-circle conversion to match l1extra, accounts for linearLsb and max value automatically
131  //const uint16_t rankPt = jetScale->rank((uint16_t)itTau->hwPt());
132  //const double et = jetScale->et( rankPt ) ;
133 
134  // or use the emScale to get finer-grained et
135  //const double et = itTau->hwPt() * emScale->linearLsb();
136 
137  // we are now already in the rankPt
138  const double et = jetScale->et( itTau->hwPt() );
139 
140  const double eta = getPhysicalEta(itTau->hwEta());
141  const double phi = getPhysicalPhi(itTau->hwPhi());
142  math::PtEtaPhiMLorentzVector p4(et, eta, phi, 0);
143 
144  Tau tau(*&p4, itTau->hwPt(),
145  itTau->hwEta(), itTau->hwPhi(),
146  itTau->hwQual(), itTau->hwIso());
147  new_rlxtaus->push_back(bx, *&tau);
148 
149  }
150 
151  for(TauBxCollection::const_iterator itTau = old_isotaus->begin(bx);
152  itTau != old_isotaus->end(bx); ++itTau)
153  {
154  // use the full-circle conversion to match l1extra, accounts for linearLsb and max value automatically
155  //const uint16_t rankPt = jetScale->rank((uint16_t)itTau->hwPt());
156  //const double et = jetScale->et( rankPt ) ;
157 
158  // or use the emScale to get finer-grained et
159  //const double et = itTau->hwPt() * emScale->linearLsb();
160 
161  // we are now already in the rankPt
162  const double et = jetScale->et( itTau->hwPt() );
163 
164  const double eta = getPhysicalEta(itTau->hwEta());
165  const double phi = getPhysicalPhi(itTau->hwPhi());
166  math::PtEtaPhiMLorentzVector p4(et, eta, phi, 0);
167 
168  Tau tau(*&p4, itTau->hwPt(),
169  itTau->hwEta(), itTau->hwPhi(),
170  itTau->hwQual(), itTau->hwIso());
171  new_isotaus->push_back(bx, *&tau);
172 
173  }
174 
175  for(JetBxCollection::const_iterator itJet = old_jets->begin(bx);
176  itJet != old_jets->end(bx); ++itJet)
177  {
178  // use the full-circle conversion to match l1extra, accounts for linearLsb and max value automatically
179  //const uint16_t rankPt = jetScale->rank((uint16_t)itJet->hwPt());
180  //const double et = jetScale->et( rankPt ) ;
181 
182  // or use the emScale to get finer-grained et
183  //const double et = itJet->hwPt() * emScale->linearLsb();
184 
185  // we are now already in the rankPt
186  const double et = jetScale->et( itJet->hwPt() );
187 
188  const bool forward = ((itJet->hwQual() & 0x2) != 0);
189  const double eta = getPhysicalEta(itJet->hwEta(), forward);
190  const double phi = getPhysicalPhi(itJet->hwPhi());
191  math::PtEtaPhiMLorentzVector p4(et, eta, phi, 0);
192 
193  Jet jet(*&p4, itJet->hwPt(),
194  itJet->hwEta(), itJet->hwPhi(),
195  itJet->hwQual());
196  new_jets->push_back(bx, *&jet);
197 
198  }
199 
200  for(JetBxCollection::const_iterator itJet = old_preGtJets->begin(bx);
201  itJet != old_preGtJets->end(bx); ++itJet)
202  {
203  // use the full-circle conversion to match l1extra, accounts for linearLsb and max value automatically
204  //const uint16_t rankPt = jetScale->rank((uint16_t)itJet->hwPt());
205  //const double et = jetScale->et( rankPt ) ;
206 
207  // or use the emScale to get finer-grained et
208  const double et = itJet->hwPt() * emScale->linearLsb();
209 
210  // we are now already in the rankPt
211  //const double et = jetScale->et( itJet->hwPt() );
212 
213  const bool forward = ((itJet->hwQual() & 0x2) != 0);
214  const double eta = getPhysicalEta(itJet->hwEta(), forward);
215  const double phi = getPhysicalPhi(itJet->hwPhi());
216  math::PtEtaPhiMLorentzVector p4(et, eta, phi, 0);
217 
218  Jet jet(*&p4, itJet->hwPt(),
219  itJet->hwEta(), itJet->hwPhi(),
220  itJet->hwQual());
221  new_preGtJets->push_back(bx, *&jet);
222 
223  }
224 
225 
226  for(EtSumBxCollection::const_iterator itEtSum = old_etsums->begin(bx);
227  itEtSum != old_etsums->end(bx); ++itEtSum)
228  {
229  double et = itEtSum->hwPt() * emScale->linearLsb();
230  //hack while we figure out the right scales
231  //double et = emScale->et( itEtSum->hwPt() );
232  const EtSum::EtSumType sumType = itEtSum->getType();
233 
234  const double eta = getPhysicalEta(itEtSum->hwEta());
235  double phi = getPhysicalPhi(itEtSum->hwPhi());
236  if(sumType == EtSum::EtSumType::kMissingHt){
237  et = htMissScale->et( itEtSum->hwPt() );
238  double regionPhiWidth=2. * 3.1415927 / L1CaloRegionDetId::N_PHI;
239  phi=phi+(regionPhiWidth/2.); // add the region half-width to match L1Extra MHT phi
240  }
241 
242 
243  math::PtEtaPhiMLorentzVector p4(et, eta, phi, 0);
244 
245  EtSum eg(*&p4, sumType, itEtSum->hwPt(),
246  itEtSum->hwEta(), itEtSum->hwPhi(),
247  itEtSum->hwQual());
248  new_etsums->push_back(bx, *&eg);
249 
250 
251  }
252 
253  for(CaloSpareBxCollection::const_iterator itCaloSpare = old_hfsums->begin(bx);
254  itCaloSpare != old_hfsums->end(bx); ++itCaloSpare)
255  {
256  //just pass through for now
257  //a different scale is needed depending on the type
258  new_hfsums->push_back(bx, *itCaloSpare);
259  }
260 
261  for(CaloSpareBxCollection::const_iterator itCaloSpare = old_hfcounts->begin(bx);
262  itCaloSpare != old_hfcounts->end(bx); ++itCaloSpare)
263  {
264  //just pass through for now
265  //a different scale is needed depending on the type
266  new_hfcounts->push_back(bx, *itCaloSpare);
267  }
268 
269  }
270 
271  iEvent.put(new_egammas);
272  iEvent.put(new_rlxtaus,"rlxTaus");
273  iEvent.put(new_isotaus,"isoTaus");
274  iEvent.put(new_jets);
275  iEvent.put(new_preGtJets,"preGtJets");
276  iEvent.put(new_etsums);
277  iEvent.put(new_hfsums,"HFRingSums");
278  iEvent.put(new_hfcounts,"HFBitCounts");
279 }
edm::EDGetToken JetToken_
edm::EDGetToken HfSumsToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
edm::EDGetToken HfCountsToken_
Definition: Tau.h:13
edm::EDGetToken EtSumToken_
T eta() const
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
Definition: Jet.h:13
edm::EDGetToken EGammaToken_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
double p4[4]
Definition: TauolaWrapper.h:92
edm::EDGetToken RlxTauToken_
edm::EDGetToken preGtJetToken_
double getPhysicalPhi(int phiIndex)
const T & get() const
Definition: EventSetup.h:55
double getPhysicalEta(int etaIndex, bool forward=false)
edm::EDGetToken IsoTauToken_
static const unsigned N_PHI
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 L1TPhysicalEtAdder::EGammaToken_
private

Definition at line 58 of file L1TPhysicalEtAdder.h.

edm::EDGetToken L1TPhysicalEtAdder::EtSumToken_
private

Definition at line 63 of file L1TPhysicalEtAdder.h.

edm::EDGetToken L1TPhysicalEtAdder::HfCountsToken_
private

Definition at line 65 of file L1TPhysicalEtAdder.h.

edm::EDGetToken L1TPhysicalEtAdder::HfSumsToken_
private

Definition at line 64 of file L1TPhysicalEtAdder.h.

edm::EDGetToken L1TPhysicalEtAdder::IsoTauToken_
private

Definition at line 60 of file L1TPhysicalEtAdder.h.

edm::EDGetToken L1TPhysicalEtAdder::JetToken_
private

Definition at line 61 of file L1TPhysicalEtAdder.h.

edm::EDGetToken L1TPhysicalEtAdder::preGtJetToken_
private

Definition at line 62 of file L1TPhysicalEtAdder.h.

edm::EDGetToken L1TPhysicalEtAdder::RlxTauToken_
private

Definition at line 59 of file L1TPhysicalEtAdder.h.