92 produces<L1MuonCollection> (
"ParamL1Muons");
93 produces<L1ExtraCollection> (
"ParamL1Muons");
95 if (
doL3_) produces<reco::MuonCollection>(
"ParamL3Muons");
96 if (
doGL_) produces<reco::MuonCollection>(
"ParamGlobalMuons");
100 if ( ! rng.isAvailable() ) {
102 "ParamMuonProducer requires the RandomGeneratorService \n"
103 "which is not present in the configuration file. \n"
104 "You must add the service in the configuration file\n"
105 "or remove the module that requires it.";
138 unsigned nmuons = simMuons->size();
146 std::vector<SimTrack> trackOriginalMuons;
150 ntrks = theTracks->size();
151 reco::TrackCollection::const_iterator trk=theTracks->begin();
152 reco::TrackCollection::const_iterator trkEnd=theTracks->end();
158 for ( ; trk!=trkEnd; ++trk) {
161 std::vector<unsigned> SimTrackIds(
fullPattern_ ? trk->recHitsSize() : 0,
162 static_cast<unsigned>(0));
181 for (
unsigned ih=0; it!=rechitsEnd; ++it,++ih ) {
182 if ((*it)->isValid()) {
184 if ( rechit ) SimTrackIds[ih] = rechit->
simtrackId();
191 for(
size_t j=0;
j<SimTrackIds.size();
j++){
192 int n =
std::count(SimTrackIds.begin(), SimTrackIds.end(), SimTrackIds[
j]);
195 idmax = SimTrackIds[
j];
199 for(
unsigned fsimi=0; fsimi < nmuons; ++fsimi) {
200 const SimTrack& simTrack = (*simMuons)[fsimi];
201 if( (
int) simTrack.
trackId() == idmax) {
203 trackOriginalMuons.push_back(simTrack);
214 std::cout <<
" *** ParamMuonProducer::reconstruct() -> entering " << std::endl;
215 std::cout <<
" *** Event with " << nmuons <<
" simulated muons and "
216 << ntrks <<
" tracker tracks" << std::endl;
234 for(
unsigned fsimi=0; fsimi < nmuons; ++fsimi) {
236 const SimTrack& mySimTrack = (*simMuons)[fsimi];
241 const SimTrack& mySimMuon = fabs(pid)==13 ? (*simMuons)[fsimi] : (*simMuons)[++fsimi];
253 std::cout <<
" ===> ParamMuonProducer::reconstruct() - pid = "
254 << mySimTrack.
type() ;
256 <<
", eta = " << mySimP4.Eta()
257 <<
", phi = " << mySimP4.Phi() << std::endl;
275 if (!status2) {
std::cout <<
"Pt smearing of L1 muon went wrong!!" << std::endl; }
277 mySimpleL1MuonCandsTemp.push_back(thisL1MuonCand);
280 FML1Muons::const_iterator l1st;
281 for(l1st=mySimpleL1MuonCandsTemp.begin();(*l1st)!=thisL1MuonCand;++l1st) {
282 if ((*l1st)->ptValue()>=
pt) {
283 unsigned int newrank = (*l1st)->rank()+1;
284 (*l1st)->setRank(newrank);
292 delete thisL1MuonCand;
302 std::vector<SimTrack>::const_iterator genmu;
304 for (genmu=trackOriginalMuons.begin();
305 genmu!=trackOriginalMuons.end();genmu++) {
306 if(mySimTrack.
trackId() == (*genmu).trackId()) {
308 myTrackerTrack = (*trkmu);
317 if (hasL1 && hasTK) {
320 int myL3Charge = myTrackerTrack->charge();
328 mySimpleL3MuonCandsTemp.push_back((*thisL3MuonCand));
336 if (
doGL_ && hasL3 && hasTK) {
339 else if (
doGL_ && hasTK) {
346 int myGLCharge = myTrackerTrack->charge();
362 std::cout <<
" Muon " << nMu <<
" reconstructed with: " ;
376 unsigned int rankmax = mySimpleL1MuonCandsTemp.size();
377 FML1Muons::const_iterator l1mu;
378 reco::MuonCollection::const_iterator l3mu;
380 for (l3mu=mySimpleL3MuonCandsTemp.begin(); l3mu!=mySimpleL3MuonCandsTemp.end(); ++l3mu) {
381 unsigned int rank = (*l1mu)->rank();
385 std::cout <<
" Killed L3 muon candidate of rank " << rank
386 <<
" when rankmax is " << rankmax << std::endl;
390 for (l1mu=mySimpleL1MuonCandsTemp.begin(); l1mu!=mySimpleL1MuonCandsTemp.end(); ++l1mu) {
391 unsigned int rank = (*l1mu)->rank();
392 if (rank+4>rankmax) {
395 double pt = (*l1mu)->ptValue() + 1.e-6 ;
396 double eta = (*l1mu)->etaValue();
397 double phi = (*l1mu)->phiValue();
405 std::cout <<
" Killed L1 muon candidate of rank " << rank
406 <<
" when rankmax is " << rankmax << std::endl;
427 <<
" : pT = " << (*l1mu)->ptValue()
428 <<
", eta = " << (*l1mu)->etaValue()
429 <<
", phi = " << (*l1mu)->phiValue()
430 <<
", rank = " << (*l1mu)->rank()
434 L1ExtraCollection::const_iterator l1ex;
438 <<
" : pT = " << (*l1ex).pt()
439 <<
", eta = " << (*l1ex).eta()
440 <<
", phi = " << (*l1ex).phi()
448 <<
" : pT = " << (*l3mu).pt()
449 <<
", eta = " << (*l3mu).eta()
450 <<
", phi = " << (*l3mu).phi()
456 <<
" : pT = " << (*l3mu).track()->pt()
457 <<
", eta = " << (*l3mu).track()->eta()
458 <<
", phi = " << (*l3mu).track()->phi()
465 reco::MuonCollection::const_iterator glmu;
469 <<
" : pT = " << (*glmu).pt()
470 <<
", eta = " << (*glmu).eta()
471 <<
", phi = " << (*glmu).phi()
477 <<
" : pT = " << (*glmu).track()->pt()
478 <<
", eta = " << (*glmu).track()->eta()
479 <<
", phi = " << (*glmu).track()->phi()
486 std::cout <<
" ===> Number of generator -> L1 / L3 / Global muons in the event : "
487 << nMu <<
" -> " << nL1 <<
" / " << nL3 <<
" / " << nGL << std::endl;
496 iEvent.
put(l1Out,
"ParamL1Muons");
497 iEvent.
put(l1ExtraOut,
"ParamL1Muons");
502 iEvent.
put(l3Out,
"ParamL3Muons");
507 iEvent.
put(glOut,
"ParamGlobalMuons");
516 FML1Muons::const_iterator l1mu;
517 L1ExtraCollection::const_iterator l1ex;
520 c.push_back(*(*l1mu));
530 reco::MuonCollection::const_iterator l3mu;
539 reco::MuonCollection::const_iterator glmu;
579 std::cout <<
" ===> ParamL3MuonProducer , final report." << std::endl;
580 std::cout <<
" ===> Number of total -> L1 / L3 / GL muons in the whole run : "
597 if (minEta_ > maxEta_) {
606 std::cout <<
" Parameterized MUONS: FastSimulation parameters " << std::endl;
607 std::cout <<
" ============================================== " << std::endl;
608 std::cout <<
" Parameterized muons reconstructed in the pseudorapidity range : "
609 << minEta_ <<
" -> " << maxEta_ << std::endl;
611 std::cout <<
" The FULL pattern recognition option is turned ON" << std::endl;
613 std::cout <<
" The FAST tracking option is turned ON" << std::endl;
621 for ( ; aHit!=lastHit; ++aHit ) {
622 if ( !aHit->get()->isValid() )
continue;
std::string theSimModuleLabel_
FML3PtSmearer * myL3PtSmearer
static double muonMassGeV_
T getParameter(std::string const &) const
void setRank(unsigned int rank)
set rank
FML3PtSmearer * myGLPtSmearer
T getUntrackedParameter(std::string const &, T const &) const
bool kill(const SimTrack &)
std::string theTrkModuleLabel_
#define DEFINE_FWK_MODULE(type)
std::vector< l1extra::L1MuonParticle > L1ExtraCollection
virtual void setInnerTrack(const TrackRef &t)
set reference to Track
FML1EfficiencyHandler * myL1EfficiencyHandler
bool smear(SimpleL1MuGMTCand *)
smear the transverse momentum of a SimplL1MuGMTCand
bool getByType(Handle< PROD > &result) const
std::vector< L1MuGMTCand > L1MuonCollection
std::vector< Muon > MuonCollection
collection of Muon objects
FML1Muons mySimpleL3MuonSeeds
const int & simtrackId() const
reco::MuonCollection mySimpleL3MuonCands
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.
std::string theSimModuleProcess_
bool kill(const SimTrack &)
void loadGLMuons(reco::MuonCollection &c) const
virtual void beginRun(edm::Run &, edm::EventSetup const &)
FMGLfromL3EfficiencyHandler * myGLfromL3EfficiencyHandler
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
FML1PtSmearer * myL1PtSmearer
const RandomEngine * random
math::XYZTLorentzVector smear(math::XYZTLorentzVector simP4, math::XYZVector recP3) const
smear the transverse momentum of a reco::Muon
L1ExtraCollection mySimpleL1MuonExtraCands
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
virtual void produce(edm::Event &, const edm::EventSetup &)
unsigned int trackId() const
bool kill(const SimTrack &)
XYZPointD XYZPoint
point in space with cartesian internal representation
int findId(const reco::Track &aTrack) const
std::vector< L1MuGMTCand > L1MuonCollection
int type() const
particle type (HEP PDT convension)
ParamL3MuonProducer(const edm::ParameterSet &)
const math::XYZTLorentzVectorD & momentum() const
particle info...
FML1Muons mySimpleL1MuonCands
void loadL3Muons(reco::MuonCollection &c) const
FMGLfromTKEfficiencyHandler * myGLfromTKEfficiencyHandler
FMGLfromL3TKEfficiencyHandler * myGLfromL3TKEfficiencyHandler
void readParameters(const edm::ParameterSet &, const edm::ParameterSet &)
FML3EfficiencyHandler * myL3EfficiencyHandler
void loadL1Muons(L1MuonCollection &c, L1ExtraCollection &d) const
std::vector< SimpleL1MuGMTCand * > FML1Muons
reco::MuonCollection mySimpleGLMuonCands
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.