17 iTrack->found() > 11 &&
18 gTrack->chi2()/gTrack->ndof() < 20.0 &&
20 iTrack->chi2()/iTrack->ndof() < 4.0 &&
21 aMuon->
muonID(
"TrackerMuonArbitrated") &&
22 aMuon->
muonID(
"TMLastStationAngTight") &&
24 fabs(iTrack->dxy()) < 3.0 &&
25 fabs(iTrack->dz()) < 15.0
35 iTrack->found() > 11 &&
36 iTrack->chi2()/iTrack->ndof() < 4.0 &&
37 aMuon->
muonID(
"TrackerMuonArbitrated") &&
38 aMuon->
muonID(
"TMLastStationAngTight") &&
40 fabs(iTrack->dxy()) < 3.0 &&
41 fabs(iTrack->dz()) < 15.0
49 std::vector<GenMuonPair> & genPair,
50 std::vector<std::pair<lorentzVector,lorentzVector> > & simPair,
54 try {
event.getByLabel(
"onia2MuMuPatTrkTrk",collAll);}
55 catch (...) {
std::cout <<
"J/psi not present in event!" << std::endl;}
56 std::vector<const pat::Muon*> collMuSel;
61 std::vector<const pat::CompositeCandidate*> collSelGG;
62 std::vector<const pat::CompositeCandidate*> collSelGT;
63 std::vector<const pat::CompositeCandidate*> collSelTT;
66 for(std::vector<pat::CompositeCandidate>::const_iterator it=collAll->begin();
67 it!=collAll->end();++it) {
79 collSelGG.push_back(cand);
86 collSelGT.push_back(cand);
92 collSelGT.push_back(cand);
99 collSelTT.push_back(cand);
106 std::vector<reco::Track>
tracks;
107 if(collSelGG.size()){
109 const pat::Muon* muon1 =
dynamic_cast<const pat::Muon*
>(collSelGG[0]->daughter(
"muon1"));
110 const pat::Muon* muon2 =
dynamic_cast<const pat::Muon*
>(collSelGG[0]->daughter(
"muon2"));
114 collMuSel.push_back(muon1);
115 collMuSel.push_back(muon2);
118 else if(!collSelGG.size() && collSelGT.size()){
120 const pat::Muon* muon1 =
dynamic_cast<const pat::Muon*
>(collSelGT[0]->daughter(
"muon1"));
121 const pat::Muon* muon2 =
dynamic_cast<const pat::Muon*
>(collSelGT[0]->daughter(
"muon2"));
125 collMuSel.push_back(muon1);
126 collMuSel.push_back(muon2);
129 else if(!collSelGG.size() && !collSelGT.size() && collSelTT.size()){
131 const pat::Muon* muon1 =
dynamic_cast<const pat::Muon*
>(collSelTT[0]->daughter(
"muon1"));
132 const pat::Muon* muon2 =
dynamic_cast<const pat::Muon*
>(collSelTT[0]->daughter(
"muon2"));
136 collMuSel.push_back(muon1);
137 collMuSel.push_back(muon2);
140 if (tracks.size() != 2 && tracks.size() != 0){
141 std::cout<<
"ERROR strange number of muons selected by onia cuts!"<<std::endl;
146 else if( (muonType_<4 && muonType_>0) ||
muonType_>=10 ) {
147 std::vector<reco::Track>
tracks;
151 for( std::vector<pat::Muon>::const_iterator
muon = allMuons->begin();
muon != allMuons->end(); ++
muon ) {
165 for( std::vector<reco::Muon>::const_iterator
muon = allMuons->begin();
muon != allMuons->end(); ++
muon ) {
175 std::vector<reco::Track>
tracks;
176 for (std::vector<reco::CaloMuon>::const_iterator
muon = caloMuons->begin();
muon != caloMuons->end(); ++
muon){
177 tracks.push_back(*(
muon->track()));
203 const std::vector<const pat::Muon*> & collMuSel,
204 std::vector<GenMuonPair> & genPair,
210 for(std::vector<pat::CompositeCandidate>::const_iterator it=collAll->begin();
211 it!=collAll->end();++it) {
213 bool isMatched = (genJpsi.
isAvailable() && genJpsi->pdgId() == 443);
215 genPatParticles->push_back(*(const_cast<reco::GenParticle*>(genJpsi.
get())));
219 if(collMuSel.size()==2) {
223 genMu1->pdgId()*genMu2->pdgId() == -169);
225 genPatParticles->push_back(*(const_cast<reco::GenParticle*>(genMu1.
get())));
226 genPatParticles->push_back(*(const_cast<reco::GenParticle*>(genMu2.
get())));
228 unsigned int motherId = 0;
229 if( genMu1->mother() != 0 ) {
230 motherId = genMu1->mother()->pdgId();
232 if(genMu1->pdgId()==13)
233 genPair.push_back(
GenMuonPair(genMu1.
get()->p4(), genMu2.
get()->p4(), motherId));
236 genPair.push_back(
GenMuonPair(genMu2.
get()->p4(), genMu1.
get()->p4(), motherId));
238 plotter->
fillGen1(const_cast <reco::GenParticleCollection*> (genPatParticles),
true);
243 std::cout <<
"No recomuon selected so no access to generated info"<<std::endl;
250 std::cout <<
"No recomuon selected so no access to generated info"<<std::endl;
256 std::cout <<
"genParticles:" << std::endl;
258 std::cout << genPair.back().mu1 <<
" , " << genPair.back().mu2 << std::endl;
263 std::vector<GenMuonPair> & genPair,
264 std::vector<std::pair<lorentzVector,lorentzVector> > & simPair,
274 bool ifGenPart=
false;
284 else if( genParticles.
isValid() ) {
291 std::cout<<
"ERROR "<<
"non generation info and speedup true!!!!!!!!!!!!"<<std::endl;
297 std::cout <<
"genParticles:" << std::endl;
298 std::cout << genPair.back().mu1 <<
" , " << genPair.back().mu2 << std::endl;
305 std::vector<std::pair<lorentzVector,lorentzVector> > & simPair,
309 bool simTracksFound =
false;
315 simTracksFound =
true;
320 std::cout <<
"SimTracks not existent" << std::endl;
322 if( !simTracksFound ) {
329 const HepMC::GenEvent* Evt = evtMC->
GetEvent();
332 for (HepMC::GenEvent::particle_const_iterator
part=Evt->particles_begin();
333 part!=Evt->particles_end();
part++) {
334 if (fabs((*part)->pdg_id())==13 && (*part)->status()==1) {
335 bool fromRes =
false;
336 unsigned int motherPdgId = 0;
337 for (HepMC::GenVertex::particle_iterator mother = (*part)->production_vertex()->particles_begin(HepMC::ancestors);
338 mother != (*part)->production_vertex()->particles_end(HepMC::ancestors); ++mother) {
339 motherPdgId = (*mother)->pdg_id();
344 if( motherPdgId == 13 && (*mother)->status() == 3 ) fromRes =
true;
347 for(
int ires = 0; ires < 6; ++ires ) {
353 if((*part)->pdg_id()==13) {
355 muFromRes.
mu1 = (
lorentzVector((*part)->momentum().px(),(*part)->momentum().py(),
356 (*part)->momentum().pz(),(*part)->momentum().e()));
359 muFromRes.
mu2 = (
lorentzVector((*part)->momentum().px(),(*part)->momentum().py(),
360 (*part)->momentum().pz(),(*part)->momentum().e()));
376 if(
debug_>0 )
std::cout <<
"Starting loop on " << genParticles->size() <<
" genParticles" << std::endl;
377 for( reco::GenParticleCollection::const_iterator
part=genParticles->begin();
part!=genParticles->end(); ++
part ) {
378 if (fabs(
part->pdgId())==13 &&
part->status()==1) {
379 bool fromRes =
false;
380 unsigned int motherPdgId =
part->mother()->pdgId();
382 std::cout <<
"Found a muon with mother: " << motherPdgId << std::endl;
384 for(
int ires = 0; ires < 6; ++ires ) {
388 if(
part->pdgId()==13) {
410 std::pair<lorentzVector, lorentzVector> simMuFromRes;
411 for( edm::SimTrackContainer::const_iterator simTrack=simTracks->begin(); simTrack!=simTracks->end(); ++simTrack ) {
413 if (fabs((*simTrack).type())==13) {
415 if ((*simTrack).genpartIndex()>0) {
416 HepMC::GenParticle* gp = evtMC->GetEvent()->barcode_to_particle ((*simTrack).genpartIndex());
419 for (HepMC::GenVertex::particle_iterator mother = gp->production_vertex()->particles_begin(HepMC::ancestors);
420 mother!=gp->production_vertex()->particles_end(HepMC::ancestors); ++mother) {
422 bool fromRes =
false;
423 unsigned int motherPdgId = (*mother)->pdg_id();
424 for(
int ires = 0; ires < 6; ++ires ) {
428 if(gp->pdg_id() == 13)
429 simMuFromRes.first =
lorentzVector(simTrack->momentum().px(),simTrack->momentum().py(),
430 simTrack->momentum().pz(),simTrack->momentum().e());
432 simMuFromRes.second =
lorentzVector(simTrack->momentum().px(),simTrack->momentum().py(),
433 simTrack->momentum().pz(),simTrack->momentum().e());
Analysis-level particle class.
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
void selectMuons(const edm::Event &event, std::vector< reco::LeafCandidate > &muons, std::vector< GenMuonPair > &genPair, std::vector< std::pair< lorentzVector, lorentzVector > > &simPair, MuScleFitPlotter *plotter)
Main method used to select muons of type specified by muonType_ from the collection specified by muon...
void selectGeneratedMuons(const edm::Handle< pat::CompositeCandidateCollection > &collAll, const std::vector< const pat::Muon * > &collMuSel, std::vector< GenMuonPair > &genPair, MuScleFitPlotter *plotter)
For PATmuons the generator information is read directly from the PAT object.
reco::TrackRef innerTrack() const
reference to Track reconstructed in the tracker only (reimplemented from reco::Muon) ...
std::pair< lorentzVector, lorentzVector > findSimMuFromRes(const edm::Handle< edm::HepMCProduct > &evtMC, const edm::Handle< edm::SimTrackContainer > &simTracks)
const std::string genParticlesName_
bool muonID(const std::string &name) const
int numberOfValidMuonHits() const
void fillGenSim(edm::Handle< edm::HepMCProduct > evtMC, edm::Handle< edm::SimTrackContainer > simTracks)
void fillRec(std::vector< reco::LeafCandidate > &muons)
bool isTrackerMuon() const
bool selTrackerMuon(const pat::Muon *aMuon)
Apply the Onia cuts to select trackerMuons.
bool isGlobalMuon() const
void selectSimulatedMuons(const edm::Event &event, const bool ifHepMC, edm::Handle< edm::HepMCProduct > evtMC, std::vector< std::pair< lorentzVector, lorentzVector > > &simPair, MuScleFitPlotter *plotter)
int pixelLayersWithMeasurement() const
void fillGen1(const reco::GenParticleCollection *genParticles, bool=false)
float userFloat(const std::string &key) const
reco::Particle::LorentzVector lorentzVector
static const unsigned int motherPdgIdArray[6]
const edm::InputTag muonLabel_
void fillSim(edm::Handle< edm::SimTrackContainer > simTracks)
virtual int charge() const
electric charge
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
reco::TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector (reimplemented from reco::Muon) ...
void fillGen2(const edm::HepMCProduct *evtMC, bool shepaFlag_)
const HepMC::GenEvent * GetEvent() const
GenMuonPair findGenMuFromRes(const reco::GenParticleCollection *genParticles)
void selectGenSimMuons(const edm::Event &event, std::vector< GenMuonPair > &genPair, std::vector< std::pair< lorentzVector, lorentzVector > > &simPair, MuScleFitPlotter *plotter)
std::vector< reco::LeafCandidate > fillMuonCollection(const std::vector< T > &tracks)
Template function used to convert the muon collection to a vector of reco::LeafCandidate.
virtual const Candidate * daughter(size_type) const
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
T const * product() const
const edm::InputTag simTracksCollectionName_
bool selGlobalMuon(const pat::Muon *aMuon)
Apply the Onia cuts to select globalMuons.
void takeSelectedMuonType(const T &muon, std::vector< reco::Track > &tracks)
Template function used to extract the selected muon type from the muon collection.
T const * get() const
Returns C++ pointer to the item.
const std::vector< int > resfind_
Analysis-level muon class.