61 virtual void endJob()
override ;
73 const static int m_maxMuons = 108;
90 m_currEvt(0), m_rnd(0)
95 produces<RegionalMuonCandBxCollection>(
"BarrelTFMuons");
96 produces<RegionalMuonCandBxCollection>(
"OverlapTFMuons");
97 produces<RegionalMuonCandBxCollection>(
"ForwardTFMuons");
98 produces<MuonCaloSumBxCollection>(
"TriggerTowerSums");
130 std::vector<RegionalMuonCand> bmMuons;
131 std::vector<RegionalMuonCand> omMuons;
132 std::vector<RegionalMuonCand> emMuons;
135 std::vector<int> muIndices;
140 for (
auto it = genParticles->cbegin(); it != genParticles->cend(); ++it) {
142 if(
abs(mcParticle.
pdgId()) == 13 && mcParticle.
status() == 1 ) muIndices.push_back(cntr);
147 LogTrace(
"GlobalMuon") <<
" GenParticleCollection not found." << std::endl;
153 const float phiToInt = 91.67324722093171f;
155 const float etaToInt = 90.9090909090f;
156 const int maxPt = (1 << 9)-1;
161 for (
auto it = muIndices.begin(); it != muIndices.end(); ++it) {
167 double eta = mcMuon.
eta();
168 if (fabs(eta) > 2.45)
continue;
169 int hwPt =
int(mcMuon.
pt() * 2);
170 hwPt = (hwPt < maxPt ? hwPt :
maxPt);
171 int hwEta =
int(eta * etaToInt);
172 double phi = mcMuon.
phi();
173 if (phi < 0) phi +=
twoPi;
174 int hwPhi = (
int(phi * phiToInt))%576;
176 int hwCharge = (mcMuon.
charge() > 0) ? 0 : 1;
177 int hwChargeValid = 1;
184 int globalWedgePhi = (hwPhi+24)%576;
185 int localPhi = globalWedgePhi%48;
186 int processor = globalWedgePhi / 48 + 1;
187 int globalSectorPhi = (hwPhi-24);
188 if (globalSectorPhi < 0) {
189 globalSectorPhi += 576;
193 if (fabs(eta) > 0.8) {
194 if (fabs(eta) < 1.2) {
196 processor = globalSectorPhi / 96 + 1;
197 localPhi = globalSectorPhi%96;
200 processor = globalSectorPhi / 96 + 1;
201 localPhi = globalSectorPhi%96;
212 if (fabs(eta) < 0.8 && bmMuons.size() < 36) {
213 bmMuons.push_back(mu);
215 }
else if (fabs(eta) < 1.2 && omMuons.size() < 36) {
216 omMuons.push_back(mu);
218 }
else if (emMuons.size() < 36) {
219 emMuons.push_back(mu);
228 for (
const auto& mu:bmMuons) {
229 barrelMuons->push_back(0, mu);
232 for (
const auto& mu:omMuons) {
233 overlapMuons->push_back(0, mu);
236 for (
const auto& mu:emMuons) {
237 endcapMuons->push_back(0, mu);
240 for (
int i = 0;
i < 1008; ++
i) {
242 int energy =
int(
m_rnd.Gaus(12, 6));
243 if (energy < 0) energy = 0;
244 if (energy > 31) energy = 31;
246 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
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))