71 const static int m_maxMuons = 108;
88 m_currEvt(0), m_rnd(0)
93 produces<RegionalMuonCandBxCollection>(
"BarrelTFMuons");
94 produces<RegionalMuonCandBxCollection>(
"OverlapTFMuons");
95 produces<RegionalMuonCandBxCollection>(
"ForwardTFMuons");
96 produces<MuonCaloSumBxCollection>(
"TriggerTowerSums");
128 std::vector<RegionalMuonCand> bmMuons;
129 std::vector<RegionalMuonCand> omMuons;
130 std::vector<RegionalMuonCand> emMuons;
133 std::vector<int> muIndices;
138 for (
auto it = genParticles->cbegin(); it != genParticles->cend(); ++it) {
140 if(
abs(mcParticle.
pdgId()) == 13 && mcParticle.
status() == 1 ) muIndices.push_back(cntr);
145 LogTrace(
"GlobalMuon") <<
" GenParticleCollection not found." << std::endl;
151 const float phiToInt = 91.67324722093171f;
153 const float etaToInt = 90.9090909090f;
154 const int maxPt = (1 << 9)-1;
159 for (
auto it = muIndices.begin(); it != muIndices.end(); ++it) {
165 double eta = mcMuon.
eta();
166 if (fabs(eta) > 2.45)
continue;
167 int hwPt =
int(mcMuon.
pt() * 2);
168 hwPt = (hwPt < maxPt ? hwPt :
maxPt);
169 int hwEta =
int(eta * etaToInt);
170 double phi = mcMuon.
phi();
171 if (phi < 0) phi +=
twoPi;
172 int hwPhi = (
int(phi * phiToInt))%576;
174 int hwCharge = (mcMuon.
charge() > 0) ? 0 : 1;
175 int hwChargeValid = 1;
182 int globalWedgePhi = (hwPhi+24)%576;
183 int localPhi = globalWedgePhi%48;
184 int processor = globalWedgePhi / 48 + 1;
185 int globalSectorPhi = (hwPhi-24);
186 if (globalSectorPhi < 0) {
187 globalSectorPhi += 576;
191 if (fabs(eta) > 0.8) {
192 if (fabs(eta) < 1.2) {
194 processor = globalSectorPhi / 96 + 1;
195 localPhi = globalSectorPhi%96;
198 processor = globalSectorPhi / 96 + 1;
199 localPhi = globalSectorPhi%96;
210 if (fabs(eta) < 0.8 && bmMuons.size() < 36) {
211 bmMuons.push_back(mu);
213 }
else if (fabs(eta) < 1.2 && omMuons.size() < 36) {
214 omMuons.push_back(mu);
216 }
else if (emMuons.size() < 36) {
217 emMuons.push_back(mu);
226 for (
const auto& mu:bmMuons) {
227 barrelMuons->push_back(0, mu);
230 for (
const auto& mu:omMuons) {
231 overlapMuons->push_back(0, mu);
234 for (
const auto& mu:emMuons) {
235 endcapMuons->push_back(0, mu);
238 for (
int i = 0;
i < 1008; ++
i) {
240 int energy =
int(
m_rnd.Gaus(12, 6));
241 if (energy < 0) energy = 0;
242 if (energy > 31) energy = 31;
244 towerSums->push_back(0, sum);
void setHwPhi(int bits)
Set compressed relative phi as transmitted by hardware LSB = 2*pi/576 (8 bits)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
BXVector< RegionalMuonCand > RegionalMuonCandBxCollection
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
BXVector< MuonCaloSum > MuonCaloSumBxCollection
virtual int status() const =0
status word
void addDefault(ParameterSetDescription const &psetDescription)
void setTFIdentifiers(int processor, tftype trackFinder)
Set the processor ID, track-finder type. From these two, the link is set.
virtual int pdgId() const =0
PDG identifier.
Abs< T >::type abs(const T &t)
void setHwQual(int bits)
Set compressed quality code as transmitted by hardware (4 bits)
void setHwPt(int bits)
Set compressed pT as transmitted by hardware LSB = 0.5 (9 bits)
void setHwEta(int bits)
Set compressed eta as transmitted by hardware LSB = 0.010875 (9 bits)
const int processor() const
Get processor ID on which the candidate was found (0..5 for OMTF/EMTF; 0..11 for BMTF) ...
virtual double eta() const =0
momentum pseudorapidity
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
virtual double pt() const =0
transverse momentum
virtual int charge() const =0
electric charge
void setHwSignValid(int bits)
Set whether charge measurement is valid (0 for high pT muons)
virtual double phi() const =0
momentum azimuthal angle
void setHwSign(int bits)
Set charge sign bit (charge = (-1)^(sign))