72 myL1EfficiencyHandler(0),
79 produces<L1MuonCollection> ();
80 produces<L1ExtraCollection> ();
81 produces<L1MuGMTReadoutCollection>();
85 if ( ! rng.isAvailable() ) {
87 "ParamMuonProducer requires the RandomGeneratorService \n"
88 "which is not present in the configuration file. \n"
89 "You must add the service in the configuration file\n"
90 "or remove the module that requires it.";
123 unsigned nmuons = simMuons->size();
143 std::multimap<float,SimpleL1MuGMTCand*> mySimpleL1MuonCandsTemp;
145 for(
unsigned fsimi=0; fsimi < nmuons; ++fsimi) {
147 const SimTrack& mySimTrack = (*simMuons)[fsimi];
150 if ( fabs(pid) != 13 )
continue;
154 bool hasPSimHits =
false;
156 PSimHitContainer::const_iterator simDTHit=muonDTHits->begin();
157 PSimHitContainer::const_iterator endDTHit=muonDTHits->end();
158 for ( ; simDTHit!=endDTHit; ++simDTHit) {
159 if ( simDTHit->trackId() == mySimTrack.
trackId() ) {
160 glbPosition =
dtGeometry->idToDet(simDTHit->detUnitId())->surface().toGlobal(simDTHit->localPosition());
167 PSimHitContainer::const_iterator simCSCHit=muonCSCHits->begin();
168 PSimHitContainer::const_iterator endCSCHit=muonCSCHits->end();
169 for ( ; simCSCHit!=endCSCHit; ++simCSCHit) {
170 if ( simCSCHit->trackId() == mySimTrack.
trackId() ) {
171 glbPosition =
cscGeometry->idToDet(simCSCHit->detUnitId())->surface().toGlobal(simCSCHit->localPosition());
179 PSimHitContainer::const_iterator simRPCHit=muonRPCHits->begin();
180 PSimHitContainer::const_iterator endRPCHit=muonRPCHits->end();
181 for ( ; simRPCHit!=endRPCHit; ++simRPCHit) {
182 if ( simRPCHit->trackId() == mySimTrack.
trackId() ) {
183 glbPosition =
rpcGeometry->idToDet(simRPCHit->detUnitId())->surface().toGlobal(simRPCHit->localPosition());
198 double pT = mySimTrack.
momentum().pt();
199 double eta = glbPosition.
eta();
201 if (eta > 2.4) eta = 2.4-1
e-6;
else if (eta < -2.4) eta = -2.4+1
e-6;
202 double phi = glbPosition.
phi();
203 if ( phi < 0. ) phi = 2*
M_PI +
phi;
216 if ( fabs(etaValue2 - eta) < fabs(etaValue-eta) ) {
217 etaValue = etaValue2;
220 if ( fabs(phiValue2-phi) < fabs(phiValue-phi) ) {
221 phiValue = phiValue2;
224 if ( fabs(pTValue2-pT) < fabs(pTValue-pT) ) {
231 etaIndex, phiIndex, pTIndex,
232 etaValue,phiValue,pTValue);
236 if (!status2) {
std::cout <<
"Pt smearing of L1 muon went wrong!!" << std::endl; }
238 mySimpleL1MuonCandsTemp.insert(
239 std::pair<float,SimpleL1MuGMTCand*>(thisL1MuonCand->
ptValue(),thisL1MuonCand));
242 delete thisL1MuonCand;
251 std::multimap<float,SimpleL1MuGMTCand*>::const_reverse_iterator L1mu = mySimpleL1MuonCandsTemp.rbegin();
252 std::multimap<float,SimpleL1MuGMTCand*>::const_reverse_iterator lastL1mu = mySimpleL1MuonCandsTemp.rend();
256 for ( ; L1mu!=lastL1mu; ++L1mu ) {
261 if (theMuon->
isFwd() ) {
262 if ( rankf < 4 ) addMu =
true;
267 if ( rankb < 4 ) addMu =
true;
303 iEvent.
put(l1ExtraOut);
304 iEvent.
put(l1ReadOut);
306 L1mu = mySimpleL1MuonCandsTemp.rbegin();
307 for ( ; L1mu!=lastL1mu; ++L1mu ) {
318 FML1Muons::const_iterator l1mu;
319 L1ExtraCollection::const_iterator l1ex;
325 c.push_back(*(*l1mu));
344 unsigned typeDTCSC=0;
346 unsigned DTCSCIndex=0;
347 unsigned RPCRegionalEtaIndex=0;
348 unsigned DTCSCRegionalEtaIndex=0;
349 float etaRPCValue=-10.;
350 float etaDTCSCValue=-10.;
352 if ( aMuon.isFwd() ) {
362 if ( fabs(etaDTCSCValue2-etaPilePoil) < fabs(etaDTCSCValue-etaPilePoil) ) {
363 etaDTCSCValue = etaDTCSCValue2;
364 ++DTCSCRegionalEtaIndex;
367 if ( fabs(etaPilePoil) < 2.1 ) {
373 if ( fabs(etaRPCValue2-etaPilePoil) < fabs(etaRPCValue-etaPilePoil) ) {
374 etaRPCValue = etaRPCValue2;
375 ++RPCRegionalEtaIndex;
392 if ( fabs(etaDTCSCValue2-etaPilePoil) < fabs(etaDTCSCValue-etaPilePoil) ) {
393 etaDTCSCValue = etaDTCSCValue2;
394 ++DTCSCRegionalEtaIndex;
403 if ( fabs(etaRPCValue2-etaPilePoil) < fabs(etaRPCValue-etaPilePoil) ) {
404 etaRPCValue = etaRPCValue2;
405 ++RPCRegionalEtaIndex;
417 DTCSCRegionalEtaIndex,
419 (1-aMuon.charge())/2,
420 aMuon.charge_valid(),
426 regionalMuonDTCSC.
setPtValue(aMuon.ptValue());
431 if ( fabs(etaPilePoil) < 2.1 ) {
437 (1-aMuon.charge())/2,
438 aMuon.charge_valid(),
502 std::cout <<
" ===> FastL1MuonProducer , final report." << std::endl;
503 std::cout <<
" ===> Number of total -> L1 muons in the whole job : "
T getParameter(std::string const &) const
edm::ESHandle< RPCGeometry > rpcGeometry
void setRank(unsigned int rank)
set rank
std::vector< L1MuGMTCand > L1MuonCollection
FML1Muons mySimpleL1MuonCands
void loadL1Muons(L1MuonCollection &c, L1ExtraCollection &d, L1MuGMTReadoutCollection &e) const
FML1EfficiencyHandler * myL1EfficiencyHandler
const L1MuScale * getPtScale() const
get the Pt scale
std::vector< l1extra::L1MuonParticle > L1ExtraCollection
void readParameters(const edm::ParameterSet &)
void setGMTBrlCand(int nr, L1MuGMTExtendedCand const &cand)
set GMT barrel candidate
virtual float getLowEdge(unsigned packed) const =0
get the low edge of bin represented by packed
FML1PtSmearer * myL1PtSmearer
Geom::Phi< T > phi() const
static double muonMassGeV_
bool smear(SimpleL1MuGMTCand *)
smear the transverse momentum of a SimplL1MuGMTCand
int charge() const
get charge
void setDTCSCIndex(unsigned int idxdtcsc)
set index of contributing DT/CSC muon
void setGMTFwdCand(int nr, L1MuGMTExtendedCand const &cand)
set GMT forward candidate
void setInputCand(int nr, unsigned data)
set Input muon
edm::ESHandle< CSCGeometry > cscGeometry
void setPtValue(float ptVal)
Set Pt Value.
const RandomEngine * random
FastL1MuonProducer(const edm::ParameterSet &)
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
bool kill(const SimpleL1MuGMTCand *)
reject tracks according to parametrized algorithmic efficiency
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
void setPhiValue(float phiVal)
Set Phi Value.
const L1MuTriggerPtScale * theMuPtScale
edm::ESHandle< DTGeometry > dtGeometry
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
edm::InputTag theSimModule
const L1MuScale * getPhiScale() const
get the phi scale
void setEtaValue(float etaVal)
Set Eta Value (need to set type, first)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
L1ExtraCollection mySimpleL1MuonExtraCands
unsigned int trackId() const
void addRecord(L1MuGMTReadoutRecord const &rec)
void setRPCBit(unsigned int rpcbit)
set RPC bit (1=RPC, 0=DT/CSC or matched)
const L1MuScale * getRegionalEtaScale(int isys) const
get the regioanl muon trigger eta scale, isys = 0(DT), 1(bRPC), 2(CSC), 3(fwdRPC) ...
int type() const
particle type (HEP PDT convension)
virtual void produce(edm::Event &, const edm::EventSetup &)
const L1MuTriggerScales * theMuScales
const math::XYZTLorentzVectorD & momentum() const
particle info...
virtual unsigned getPacked(float value) const =0
pack a value
virtual void beginRun(edm::Run &run, const edm::EventSetup &es)
const L1MuScale * getGMTEtaScale() const
get the GMT eta scale
void setGMTCand(int nr, L1MuGMTExtendedCand const &cand)
set GMT candidate (does not store rank)
bool isFwd() const
get forward bit (true=forward, false=barrel)
void setRPCIndex(unsigned int idxrpc)
set index of contributing RPC muon