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

#include <L1Trigger/L1TGlobalMuon/plugins/L1TMicroGMTCaloInputProducer.cc>

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

Public Member Functions

 L1TMicroGMTCaloInputProducer (const edm::ParameterSet &)
 
 ~L1TMicroGMTCaloInputProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) 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 ()
 
virtual void beginLuminosityBlock (edm::LuminosityBlock &, edm::EventSetup const &)
 
virtual void beginRun (edm::Run &, edm::EventSetup const &)
 
virtual void endJob ()
 
virtual void endLuminosityBlock (edm::LuminosityBlock &, edm::EventSetup const &)
 
virtual void endRun (edm::Run &, edm::EventSetup const &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 

Private Attributes

edm::InputTag m_caloLabel
 
edm::EDGetTokenT
< CaloTowerBxCollection
m_caloTowerToken
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
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

Description: takes generated muons and fills them in the expected collections for the MicroGMT

Implementation: [Notes on implementation]

Definition at line 47 of file L1TMicroGMTCaloInputProducer.cc.

Constructor & Destructor Documentation

L1TMicroGMTCaloInputProducer::L1TMicroGMTCaloInputProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 81 of file L1TMicroGMTCaloInputProducer.cc.

References edm::ParameterSet::getParameter().

81  {
82  //register your inputs:
83  m_caloLabel = iConfig.getParameter<edm::InputTag> ("caloStage2Layer2Label");
84  m_caloTowerToken = consumes <CaloTowerBxCollection> (m_caloLabel);
85  //register your products
86  produces<GMTInputCaloSumBxCollection>("TriggerTowerSums");
87  produces<GMTInputCaloSumBxCollection>("TriggerTower2x2s");
88 }
T getParameter(std::string const &) const
edm::EDGetTokenT< CaloTowerBxCollection > m_caloTowerToken
L1TMicroGMTCaloInputProducer::~L1TMicroGMTCaloInputProducer ( )

Definition at line 91 of file L1TMicroGMTCaloInputProducer.cc.

92 {
93  // do anything here that needs to be done at desctruction time
94  // (e.g. close files, deallocate resources etc.)
95 }

Member Function Documentation

void L1TMicroGMTCaloInputProducer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 185 of file L1TMicroGMTCaloInputProducer.cc.

186 {
187 }
void L1TMicroGMTCaloInputProducer::beginLuminosityBlock ( edm::LuminosityBlock ,
edm::EventSetup const &   
)
privatevirtual

Definition at line 208 of file L1TMicroGMTCaloInputProducer.cc.

209 {
210 }
void L1TMicroGMTCaloInputProducer::beginRun ( edm::Run ,
edm::EventSetup const &   
)
privatevirtual

Definition at line 196 of file L1TMicroGMTCaloInputProducer.cc.

197 {
198 }
void L1TMicroGMTCaloInputProducer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 191 of file L1TMicroGMTCaloInputProducer.cc.

191  {
192 }
void L1TMicroGMTCaloInputProducer::endLuminosityBlock ( edm::LuminosityBlock ,
edm::EventSetup const &   
)
privatevirtual

Definition at line 214 of file L1TMicroGMTCaloInputProducer.cc.

215 {
216 }
void L1TMicroGMTCaloInputProducer::endRun ( edm::Run ,
edm::EventSetup const &   
)
privatevirtual

Definition at line 202 of file L1TMicroGMTCaloInputProducer.cc.

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

Definition at line 220 of file L1TMicroGMTCaloInputProducer.cc.

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

220  {
221  //The following says we do not know what parameters are allowed so do no validation
222  // Please change this to state exactly what you do use, even if it is no parameters
224  desc.setUnknown();
225  descriptions.addDefault(desc);
226 }
void addDefault(ParameterSetDescription const &psetDescription)
void L1TMicroGMTCaloInputProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 105 of file L1TMicroGMTCaloInputProducer.cc.

References funct::abs(), HLT_25ns14e33_v1_cff::caloTowers, l1t::GMTInputCaloSum::etBits(), edm::Event::getByToken(), l1t::L1Candidate::hwEta(), l1t::L1Candidate::hwPhi(), l1t::L1Candidate::hwPt(), edm::Event::put(), and l1t::GMTInputCaloSum::setEtBits().

106 {
107  using namespace edm;
108  std::auto_ptr<GMTInputCaloSumBxCollection> towerSums (new GMTInputCaloSumBxCollection());
109  std::auto_ptr<GMTInputCaloSumBxCollection> tower2x2s (new GMTInputCaloSumBxCollection());
110 
112  // Make sure that you can get genParticles
113  std::map<int, GMTInputCaloSum> sums;
114  std::map<int, GMTInputCaloSum> regs;
115 
116  if (iEvent.getByToken(m_caloTowerToken, caloTowers)) {
117  for (auto it = caloTowers->begin(0); it != caloTowers->end(0); ++it) {
118  const CaloTower& twr = *it;
119  if (std::abs(twr.hwEta()) > 27) {
120  continue;
121  }
122  int ieta2x2 = (twr.hwEta() + 27) / 2;
123  int iphi2x2 = twr.hwPhi() / 2;
124  int muon_idx = iphi2x2 * 28 + ieta2x2;
125  if (regs.count(muon_idx) == 0) {
126  regs[muon_idx] = GMTInputCaloSum(twr.hwPt(), iphi2x2, ieta2x2, muon_idx);
127  } else {
128  regs.at(muon_idx).setEtBits(regs.at(muon_idx).etBits() + twr.hwPt());
129  }
130 
131  // std::cout << "iphi; phi " << twr.hwPhi() << "; " << twr.phi() << " .. ieta; eta" << twr.hwEta() << "; " << twr.eta() << std::endl;
132 
133  for (int ieta = -27; ieta < 28; ++ieta) {
134  for (int iphi = 0; iphi < 72; ++iphi) {
135  int deta = std::abs(ieta - twr.hwEta());
136  int dphi = iphi - twr.hwPhi();
137  if (dphi > 36) {
138  dphi -= 72;
139  }
140  if (dphi < -36) {
141  dphi += 72;
142  }
143  dphi = std::abs(dphi);
144  if (deta <= 4 && dphi <= 4) {
145  int ietamu = (ieta + 27) / 2;
146  int iphimu = iphi / 2;
147  int idxmu = iphimu * 28 + ietamu;
148  if (sums.count(idxmu) == 0) {
149  sums[idxmu] = GMTInputCaloSum(twr.hwPt(), iphimu, ietamu, idxmu);
150  } else {
151  sums.at(idxmu).setEtBits(sums.at(idxmu).etBits() + twr.hwPt());
152  }
153  }
154 
155  }
156  }
157  }
158  } else {
159  LogError("GlobalMuon") << "CaloTowers not found." << std::endl;
160  }
161 
162  for (auto it = sums.begin(); it != sums.end(); ++it) {
163  if (it->second.etBits() > 0) {
164  GMTInputCaloSum sum = GMTInputCaloSum(it->second);
165  // convert Et to correct scale:
166  if (sum.etBits() > 31) {
167  sum.setEtBits(31);
168  }
169  towerSums->push_back(0, sum);
170  }
171  }
172  for (auto it = regs.begin(); it != regs.end(); ++it) {
173  if (it->second.etBits() > 0) {
174  tower2x2s->push_back(0, it->second);
175  }
176  }
177 
178  iEvent.put(towerSums, "TriggerTowerSums");
179  iEvent.put(tower2x2s, "TriggerTower2x2s");
180 
181 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
int hwPhi() const
Definition: L1Candidate.cc:79
void setEtBits(int bits)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int hwEta() const
Definition: L1Candidate.cc:74
BXVector< GMTInputCaloSum > GMTInputCaloSumBxCollection
int hwPt() const
Definition: L1Candidate.cc:69
const int etBits() const
edm::EDGetTokenT< CaloTowerBxCollection > m_caloTowerToken

Member Data Documentation

edm::InputTag L1TMicroGMTCaloInputProducer::m_caloLabel
private

Definition at line 65 of file L1TMicroGMTCaloInputProducer.cc.

edm::EDGetTokenT<CaloTowerBxCollection> L1TMicroGMTCaloInputProducer::m_caloTowerToken
private

Definition at line 64 of file L1TMicroGMTCaloInputProducer.cc.