61 virtual void endJob() ;
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;
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;
204 mu.setHwPhi(localPhi);
205 mu.setTFIdentifiers(processor, tf);
208 mu.setHwSign(hwCharge);
209 mu.setHwSignValid(hwChargeValid);
210 mu.setHwQual(hwQual);
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) {
243 if (energy < 0) energy = 0;
244 if (energy > 31) energy = 31;
246 towerSums->push_back(0, sum);
249 iEvent.
put(barrelMuons,
"BarrelTFMuons");
250 iEvent.
put(overlapMuons,
"OverlapTFMuons");
251 iEvent.
put(endcapMuons,
"ForwardTFMuons");
252 iEvent.
put(towerSums,
"TriggerTowerSums");
BXVector< RegionalMuonCand > RegionalMuonCandBxCollection
bool getByToken(EDGetToken token, Handle< PROD > &result) const
virtual double pt() const =0
transverse momentum
#define DEFINE_FWK_MODULE(type)
BXVector< MuonCaloSum > MuonCaloSumBxCollection
virtual int status() const =0
status word
void addDefault(ParameterSetDescription const &psetDescription)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Abs< T >::type abs(const T &t)
virtual int charge() const =0
electric charge
virtual int pdgId() const =0
PDG identifier.
const int processor() const
Get processor ID on which the candidate was found (0..5 for OMTF/EMTF; 0..11 for BMTF) ...
virtual double phi() const =0
momentum azimuthal angle
virtual double eta() const =0
momentum pseudorapidity