#include <FastL1MuonProducer.h>
Description: Fast simulation producer for L1 muons. L1MuGMTCand's obtained from a parameterization wich starts from the generated muons in the event
Definition at line 48 of file FastL1MuonProducer.h.
typedef std::vector<SimpleL1MuGMTCand*> FastL1MuonProducer::FML1Muons [private] |
Definition at line 59 of file FastL1MuonProducer.h.
typedef std::vector<l1extra::L1MuonParticle> FastL1MuonProducer::L1ExtraCollection [private] |
Definition at line 61 of file FastL1MuonProducer.h.
typedef std::vector<L1MuGMTCand> FastL1MuonProducer::L1MuonCollection [private] |
Definition at line 60 of file FastL1MuonProducer.h.
FastL1MuonProducer::FastL1MuonProducer | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 71 of file FastL1MuonProducer.cc.
References Exception, edm::ParameterSet::getParameter(), random, and readParameters().
: myL1EfficiencyHandler(0), myL1PtSmearer(0) { readParameters(iConfig.getParameter<edm::ParameterSet>("MUONS")); //register your products produces<L1MuonCollection> (); produces<L1ExtraCollection> (); produces<L1MuGMTReadoutCollection>(); // Initialize the random number generator service edm::Service<edm::RandomNumberGenerator> rng; if ( ! rng.isAvailable() ) { throw cms::Exception("Configuration") << "ParamMuonProducer requires the RandomGeneratorService \n" "which is not present in the configuration file. \n" "You must add the service in the configuration file\n" "or remove the module that requires it."; } random = new RandomEngine(&(*rng)); }
FastL1MuonProducer::~FastL1MuonProducer | ( | ) |
Definition at line 98 of file FastL1MuonProducer.cc.
References random.
void FastL1MuonProducer::beginJob | ( | void | ) | [private, virtual] |
Reimplemented from edm::EDProducer.
Definition at line 459 of file FastL1MuonProducer.cc.
References myL1EfficiencyHandler, myL1PtSmearer, mySimpleL1MuonCands, mySimpleL1MuonExtraCands, nL1MuonTot, nMuonTot, and random.
{ // Initialize nMuonTot = 0; nL1MuonTot = 0; mySimpleL1MuonCands.clear(); mySimpleL1MuonExtraCands.clear(); myL1EfficiencyHandler = new FML1EfficiencyHandler(random); myL1PtSmearer = new FML1PtSmearer(random); }
void FastL1MuonProducer::beginRun | ( | edm::Run & | run, |
const edm::EventSetup & | es | ||
) | [private, virtual] |
Reimplemented from edm::EDProducer.
Definition at line 475 of file FastL1MuonProducer.cc.
References cscGeometry, dtGeometry, edm::EventSetup::get(), rpcGeometry, theMuPtScale, and theMuScales.
{ // Get the DT Geometry es.get<MuonGeometryRecord>().get(dtGeometry); // Get the CSC Geometry es.get<MuonGeometryRecord>().get(cscGeometry); // Get the RPC Geometry es.get<MuonGeometryRecord>().get(rpcGeometry); // Read trigger scales edm::ESHandle< L1MuTriggerScales > muScales ; es.get< L1MuTriggerScalesRcd >().get( muScales ) ; theMuScales = &(*muScales); edm::ESHandle< L1MuTriggerPtScale > muPtScale ; es.get< L1MuTriggerPtScaleRcd >().get( muPtScale ) ; theMuPtScale = &(*muPtScale); }
void FastL1MuonProducer::endJob | ( | void | ) | [private, virtual] |
Reimplemented from edm::EDProducer.
Definition at line 498 of file FastL1MuonProducer.cc.
References gather_cfg::cout, myL1EfficiencyHandler, myL1PtSmearer, nL1MuonTot, and nMuonTot.
{ if (myL1EfficiencyHandler) delete myL1EfficiencyHandler; if ( myL1PtSmearer) delete myL1PtSmearer; std::cout << " ===> FastL1MuonProducer , final report." << std::endl; std::cout << " ===> Number of total -> L1 muons in the whole job : " << nMuonTot << " -> " << nL1MuonTot << std::endl; }
void FastL1MuonProducer::loadL1Muons | ( | L1MuonCollection & | c, |
L1ExtraCollection & | d, | ||
L1MuGMTReadoutCollection & | e | ||
) | const [private] |
Definition at line 313 of file FastL1MuonProducer.cc.
References L1MuGMTReadoutCollection::addRecord(), L1MuScale::getLowEdge(), L1MuScale::getPacked(), L1MuTriggerScales::getRegionalEtaScale(), mySimpleL1MuonCands, mySimpleL1MuonExtraCands, L1MuRegionalCand::setEtaValue(), L1MuGMTReadoutRecord::setGMTBrlCand(), L1MuGMTReadoutRecord::setGMTCand(), L1MuGMTReadoutRecord::setGMTFwdCand(), L1MuGMTReadoutRecord::setInputCand(), L1MuRegionalCand::setPhiValue(), L1MuRegionalCand::setPtValue(), and theMuScales.
Referenced by produce().
{ FML1Muons::const_iterator l1mu; L1ExtraCollection::const_iterator l1ex; L1MuGMTReadoutRecord rc = L1MuGMTReadoutRecord(0); // Add L1 muons: // int nmuons = mySimpleL1MuonCands.size(); for (l1mu=mySimpleL1MuonCands.begin();l1mu!=mySimpleL1MuonCands.end();++l1mu) { c.push_back(*(*l1mu)); } // Add extra particles. int nr = 0; int nrb = 0; int nrf = 0; for (l1ex=mySimpleL1MuonExtraCands.begin();l1ex!=mySimpleL1MuonExtraCands.end();++l1ex) { d.push_back(*l1ex); L1MuGMTExtendedCand aMuon(l1ex->gmtMuonCand()); rc.setGMTCand(nr,aMuon); // Find the regional eta index double etaPilePoil = mySimpleL1MuonCands[nr]->getMomentum().Eta(); nr++; unsigned typeRPC=0; unsigned typeDTCSC=0; unsigned RPCIndex=0; unsigned DTCSCIndex=0; unsigned RPCRegionalEtaIndex=0; unsigned DTCSCRegionalEtaIndex=0; float etaRPCValue=-10.; float etaDTCSCValue=-10.; // Forward muons if ( aMuon.isFwd() ) { rc.setGMTFwdCand(nrf,aMuon); // CSC typeDTCSC = 2; DTCSCIndex = 8+nrf; DTCSCRegionalEtaIndex = theMuScales->getRegionalEtaScale(2)->getPacked(etaPilePoil); etaDTCSCValue = theMuScales->getRegionalEtaScale(2)->getLowEdge(DTCSCRegionalEtaIndex); float etaDTCSCValue2 = theMuScales->getRegionalEtaScale(2)->getLowEdge(DTCSCRegionalEtaIndex+1); if ( fabs(etaDTCSCValue2-etaPilePoil) < fabs(etaDTCSCValue-etaPilePoil) ) { etaDTCSCValue = etaDTCSCValue2; ++DTCSCRegionalEtaIndex; } // RPC (limited to the RPC acceptance) if ( fabs(etaPilePoil) < 2.1 ) { RPCIndex = 12+nrf; typeRPC = 3; RPCRegionalEtaIndex = theMuScales->getRegionalEtaScale(3)->getPacked(etaPilePoil); etaRPCValue = theMuScales->getRegionalEtaScale(3)->getLowEdge(RPCRegionalEtaIndex); float etaRPCValue2 = theMuScales->getRegionalEtaScale(3)->getLowEdge(RPCRegionalEtaIndex+1); if ( fabs(etaRPCValue2-etaPilePoil) < fabs(etaRPCValue-etaPilePoil) ) { etaRPCValue = etaRPCValue2; ++RPCRegionalEtaIndex; } } // Next muon nrf++; // Barrel muons } else { rc.setGMTBrlCand(nrb,aMuon); // DT typeDTCSC = 0; DTCSCIndex = 0+nrb; DTCSCRegionalEtaIndex = theMuScales->getRegionalEtaScale(0)->getPacked(etaPilePoil); etaDTCSCValue = theMuScales->getRegionalEtaScale(0)->getLowEdge(DTCSCRegionalEtaIndex); float etaDTCSCValue2 = theMuScales->getRegionalEtaScale(0)->getLowEdge(DTCSCRegionalEtaIndex+1); if ( fabs(etaDTCSCValue2-etaPilePoil) < fabs(etaDTCSCValue-etaPilePoil) ) { etaDTCSCValue = etaDTCSCValue2; ++DTCSCRegionalEtaIndex; } // RPC typeRPC = 1; RPCIndex = 4+nrb; RPCRegionalEtaIndex = theMuScales->getRegionalEtaScale(1)->getPacked(etaPilePoil); etaRPCValue = theMuScales->getRegionalEtaScale(1)->getLowEdge(RPCRegionalEtaIndex); float etaRPCValue2 = theMuScales->getRegionalEtaScale(1)->getLowEdge(RPCRegionalEtaIndex+1); if ( fabs(etaRPCValue2-etaPilePoil) < fabs(etaRPCValue-etaPilePoil) ) { etaRPCValue = etaRPCValue2; ++RPCRegionalEtaIndex; } // Next muon nrb++; } // Add a muon regional candidate - first DT/CSC L1MuRegionalCand regionalMuonDTCSC = L1MuRegionalCand(typeDTCSC, aMuon.phiIndex(), DTCSCRegionalEtaIndex, aMuon.ptIndex(), (1-aMuon.charge())/2, aMuon.charge_valid(), 1, // FineHalo aMuon.quality(), aMuon.bx()); regionalMuonDTCSC.setPhiValue(aMuon.phiValue()); regionalMuonDTCSC.setEtaValue(etaDTCSCValue); regionalMuonDTCSC.setPtValue(aMuon.ptValue()); rc.setInputCand(DTCSCIndex,regionalMuonDTCSC); // Then RPC (if in RPC acceptance) if ( fabs(etaPilePoil) < 2.1 ) { L1MuRegionalCand regionalMuonRPC = L1MuRegionalCand(typeRPC, aMuon.phiIndex(), RPCRegionalEtaIndex, aMuon.ptIndex(), (1-aMuon.charge())/2, aMuon.charge_valid(), 0, // FineHalo aMuon.quality(), aMuon.bx()); regionalMuonRPC.setPhiValue(aMuon.phiValue()); regionalMuonRPC.setEtaValue(etaRPCValue); regionalMuonRPC.setPtValue(aMuon.ptValue()); rc.setInputCand(RPCIndex,regionalMuonRPC); } } // Update the event e.addRecord(rc); }
void FastL1MuonProducer::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
Implements edm::EDProducer.
Definition at line 117 of file FastL1MuonProducer.cc.
References SimpleL1MuGMTCand::charge(), gather_cfg::cout, cscGeometry, dtGeometry, ExpressReco_HICollisions_FallBack::e, eta(), PV3DBase< T, PVType, FrameType >::eta(), L1MuGMTCand::etaValue(), edm::Event::getByLabel(), L1MuTriggerScales::getGMTEtaScale(), L1MuScale::getLowEdge(), L1MuScale::getPacked(), L1MuTriggerScales::getPhiScale(), L1MuTriggerPtScale::getPtScale(), L1MuGMTExtendedCand::isFwd(), FML1EfficiencyHandler::kill(), loadL1Muons(), M_PI, CoreSimTrack::momentum(), muonMassGeV_, myL1EfficiencyHandler, myL1PtSmearer, mySimpleL1MuonCands, mySimpleL1MuonExtraCands, nL1MuonTot, nMuonTot, PV3DBase< T, PVType, FrameType >::phi(), phi, L1MuGMTCand::phiValue(), evf::utils::pid, ExpressReco_HICollisions_FallBack::pt, L1MuGMTCand::ptValue(), edm::Event::put(), rpcGeometry, L1MuGMTExtendedCand::setDTCSCIndex(), SimpleL1MuGMTCand::setRank(), L1MuGMTExtendedCand::setRPCBit(), L1MuGMTExtendedCand::setRPCIndex(), FML1PtSmearer::smear(), theCSCHits, theDTHits, theMuPtScale, theMuScales, theRPCHits, theSimModule, CoreSimTrack::trackId(), and CoreSimTrack::type().
{ using namespace edm; Handle<std::vector<SimTrack> > simMuons; iEvent.getByLabel(theSimModule,simMuons); unsigned nmuons = simMuons->size(); // Handle<std::vector<SimVertex> > simVertices; // iEvent.getByLabel(theSimModuleLabel_,simVertices); Handle<PSimHitContainer> muonDTHits; iEvent.getByLabel(theDTHits,muonDTHits); Handle<PSimHitContainer> muonCSCHits; iEvent.getByLabel(theCSCHits,muonCSCHits); Handle<PSimHitContainer> muonRPCHits; iEvent.getByLabel(theRPCHits,muonRPCHits); // // Loop over generated muons and reconstruct L1, L3 and Global muons // int nMu = 0; mySimpleL1MuonCands.clear(); mySimpleL1MuonExtraCands.clear(); std::multimap<float,SimpleL1MuGMTCand*> mySimpleL1MuonCandsTemp; for( unsigned fsimi=0; fsimi < nmuons; ++fsimi) { // The sim track can be a muon or a decaying hadron const SimTrack& mySimTrack = (*simMuons)[fsimi]; // Keep only the muons at L1 (either primary or secondary) int pid = mySimTrack.type(); if ( fabs(pid) != 13 ) continue; // Check whether there are hits in DT/CSC/RPC, // and keep for the L1 mu the position of first such hit: bool hasPSimHits = false; GlobalPoint glbPosition; PSimHitContainer::const_iterator simDTHit=muonDTHits->begin(); PSimHitContainer::const_iterator endDTHit=muonDTHits->end(); for ( ; simDTHit!=endDTHit; ++simDTHit) { if ( simDTHit->trackId() == mySimTrack.trackId() ) { glbPosition = dtGeometry->idToDet(simDTHit->detUnitId())->surface().toGlobal(simDTHit->localPosition()); hasPSimHits = true; break; } } if (! hasPSimHits) { PSimHitContainer::const_iterator simCSCHit=muonCSCHits->begin(); PSimHitContainer::const_iterator endCSCHit=muonCSCHits->end(); for ( ; simCSCHit!=endCSCHit; ++simCSCHit) { if ( simCSCHit->trackId() == mySimTrack.trackId() ) { glbPosition = cscGeometry->idToDet(simCSCHit->detUnitId())->surface().toGlobal(simCSCHit->localPosition()); hasPSimHits = true; break; } } } if (! hasPSimHits) { PSimHitContainer::const_iterator simRPCHit=muonRPCHits->begin(); PSimHitContainer::const_iterator endRPCHit=muonRPCHits->end(); for ( ; simRPCHit!=endRPCHit; ++simRPCHit) { if ( simRPCHit->trackId() == mySimTrack.trackId() ) { glbPosition = rpcGeometry->idToDet(simRPCHit->detUnitId())->surface().toGlobal(simRPCHit->localPosition()); hasPSimHits = true; break; } } } // *** Reconstruct parameterized muons starting from undecayed simulated muons if (hasPSimHits) { nMu++; // // Now L1 parametrization // double pT = mySimTrack.momentum().pt(); double eta = glbPosition.eta(); // Avoid L1MuScales complains if |eta|>2.4: if (eta > 2.4) eta = 2.4-1e-6; else if (eta < -2.4) eta = -2.4+1e-6; double phi = glbPosition.phi(); if ( phi < 0. ) phi = 2* M_PI + phi; unsigned etaIndex = theMuScales->getGMTEtaScale()->getPacked(eta); unsigned phiIndex = theMuScales->getPhiScale()->getPacked(phi); unsigned pTIndex = theMuPtScale->getPtScale()->getPacked(pT); float etaValue = theMuScales->getGMTEtaScale()->getLowEdge(etaIndex); float phiValue = theMuScales->getPhiScale()->getLowEdge(phiIndex); float pTValue = theMuPtScale->getPtScale()->getLowEdge(pTIndex) + 1e-6; float etaValue2 = theMuScales->getGMTEtaScale()->getLowEdge(etaIndex+1); float phiValue2 = theMuScales->getPhiScale()->getLowEdge(phiIndex+1); float pTValue2 = theMuPtScale->getPtScale()->getLowEdge(pTIndex+1) + 1e-6; // Choose the closest index. (Not sure it is what is to be done) if ( fabs(etaValue2 - eta) < fabs(etaValue-eta) ) { etaValue = etaValue2; ++etaIndex; } if ( fabs(phiValue2-phi) < fabs(phiValue-phi) ) { phiValue = phiValue2; ++phiIndex; } if ( fabs(pTValue2-pT) < fabs(pTValue-pT) ) { pTValue = pTValue2; ++pTIndex; } SimpleL1MuGMTCand * thisL1MuonCand = new SimpleL1MuGMTCand(&mySimTrack, etaIndex, phiIndex, pTIndex, etaValue,phiValue,pTValue); bool hasL1 = myL1EfficiencyHandler->kill(thisL1MuonCand); if (hasL1) { bool status2 = myL1PtSmearer->smear(thisL1MuonCand); if (!status2) { std::cout << "Pt smearing of L1 muon went wrong!!" << std::endl; } if (status2) { mySimpleL1MuonCandsTemp.insert( std::pair<float,SimpleL1MuGMTCand*>(thisL1MuonCand->ptValue(),thisL1MuonCand)); } else { delete thisL1MuonCand; } } } } // kill low ranked L1 muons, and fill L1extra muons --> std::multimap<float,SimpleL1MuGMTCand*>::const_reverse_iterator L1mu = mySimpleL1MuonCandsTemp.rbegin(); std::multimap<float,SimpleL1MuGMTCand*>::const_reverse_iterator lastL1mu = mySimpleL1MuonCandsTemp.rend(); unsigned rank=0; unsigned rankb=0; unsigned rankf=0; for ( ; L1mu!=lastL1mu; ++L1mu ) { SimpleL1MuGMTCand* theMuon = L1mu->second; theMuon->setRPCBit(0); ++rank; bool addMu = false; if (theMuon->isFwd() ) { if ( rankf < 4 ) addMu = true; theMuon->setRPCIndex(rankf); theMuon->setDTCSCIndex(rankf); rankf++; } else { if ( rankb < 4 ) addMu = true; theMuon->setRPCIndex(rankb); theMuon->setDTCSCIndex(rankb); rankb++; } if ( addMu ) { theMuon->setRank(rank); mySimpleL1MuonCands.push_back(theMuon); double pt = theMuon->ptValue() + 1.e-6 ; double eta = theMuon->etaValue(); double phi = theMuon->phiValue(); math::PtEtaPhiMLorentzVector PtEtaPhiMP4(pt,eta,phi,muonMassGeV_); math::XYZTLorentzVector myL1P4(PtEtaPhiMP4); // math::PtEtaPhiMLorentzVector myL1P4(pt,eta,phi,muonMassGeV_); mySimpleL1MuonExtraCands.push_back( l1extra::L1MuonParticle( theMuon->charge(), myL1P4, *theMuon ) ); } else { theMuon->setRank(0); } } // end killing of low ranked L1 muons --> int nL1 = mySimpleL1MuonCands.size(); nMuonTot += nMu; nL1MuonTot += nL1; std::auto_ptr<L1MuonCollection> l1Out(new L1MuonCollection); std::auto_ptr<L1ExtraCollection> l1ExtraOut(new L1ExtraCollection); std::auto_ptr<L1MuGMTReadoutCollection> l1ReadOut(new L1MuGMTReadoutCollection(1)); loadL1Muons(*l1Out,*l1ExtraOut,*l1ReadOut); iEvent.put(l1Out); iEvent.put(l1ExtraOut); iEvent.put(l1ReadOut); L1mu = mySimpleL1MuonCandsTemp.rbegin(); for ( ; L1mu!=lastL1mu; ++L1mu ) { delete L1mu->second; } }
void FastL1MuonProducer::readParameters | ( | const edm::ParameterSet & | fastMuons | ) | [private] |
Definition at line 508 of file FastL1MuonProducer.cc.
References edm::ParameterSet::getParameter(), theCSCHits, theDTHits, theRPCHits, and theSimModule.
Referenced by FastL1MuonProducer().
{ // Muons theSimModule = fastMuons.getParameter<edm::InputTag>("simModule"); theDTHits = fastMuons.getParameter<edm::InputTag>("dtSimHits"); theCSCHits = fastMuons.getParameter<edm::InputTag>("cscSimHits"); theRPCHits = fastMuons.getParameter<edm::InputTag>("rpcSimHits"); }
void FastL1MuonProducer::reconstruct | ( | ) | [private] |
Definition at line 80 of file FastL1MuonProducer.h.
Referenced by beginRun(), and produce().
Definition at line 79 of file FastL1MuonProducer.h.
Referenced by beginRun(), and produce().
double FastL1MuonProducer::muonMassGeV_ = 0.105658369 [static, private] |
Definition at line 99 of file FastL1MuonProducer.h.
Referenced by produce().
Definition at line 76 of file FastL1MuonProducer.h.
Referenced by beginJob(), endJob(), and produce().
FML1PtSmearer* FastL1MuonProducer::myL1PtSmearer [private] |
Definition at line 77 of file FastL1MuonProducer.h.
Referenced by beginJob(), endJob(), and produce().
Definition at line 74 of file FastL1MuonProducer.h.
Referenced by beginJob(), loadL1Muons(), and produce().
Definition at line 75 of file FastL1MuonProducer.h.
Referenced by beginJob(), loadL1Muons(), and produce().
int FastL1MuonProducer::nL1MuonTot [private] |
Definition at line 97 of file FastL1MuonProducer.h.
Referenced by beginJob(), endJob(), and produce().
int FastL1MuonProducer::nMuonTot [private] |
Definition at line 97 of file FastL1MuonProducer.h.
Referenced by beginJob(), endJob(), and produce().
const RandomEngine* FastL1MuonProducer::random [private] |
Definition at line 57 of file FastL1MuonProducer.h.
Referenced by beginJob(), FastL1MuonProducer(), and ~FastL1MuonProducer().
Definition at line 81 of file FastL1MuonProducer.h.
Referenced by beginRun(), and produce().
edm::InputTag FastL1MuonProducer::theCSCHits [private] |
Definition at line 86 of file FastL1MuonProducer.h.
Referenced by produce(), and readParameters().
edm::InputTag FastL1MuonProducer::theDTHits [private] |
Definition at line 85 of file FastL1MuonProducer.h.
Referenced by produce(), and readParameters().
const L1MuTriggerPtScale* FastL1MuonProducer::theMuPtScale [private] |
Definition at line 94 of file FastL1MuonProducer.h.
Referenced by beginRun(), and produce().
const L1MuTriggerScales* FastL1MuonProducer::theMuScales [private] |
Definition at line 91 of file FastL1MuonProducer.h.
Referenced by beginRun(), loadL1Muons(), and produce().
edm::InputTag FastL1MuonProducer::theRPCHits [private] |
Definition at line 87 of file FastL1MuonProducer.h.
Referenced by produce(), and readParameters().
Definition at line 84 of file FastL1MuonProducer.h.
Referenced by produce(), and readParameters().