27 return (muon1->
pt() > muon2->
pt());
33 std::vector<reco::CandidateBaseRef> selMuons;
36 if ( evt.
getByLabel(srcSelMuons, combCandidatesHandle) ) {
37 if ( combCandidatesHandle->size() >= 1 ) {
47 <<
"Collection 'selectedMuons' = " << srcSelMuons.
label() <<
" of CompositeCandidates does not refer to daughters of valid type !!\n";
48 selMuons.push_back(selMuon);
54 if ( evt.
getByLabel(srcSelMuons, selMuonsHandle) ) {
55 for (
size_t idx = 0;
idx < selMuonsHandle->size(); ++
idx ) {
60 <<
"Invalid input collection 'selectedMuons' = " << srcSelMuons.
label() <<
" !!\n";
65 std::sort(selMuons.begin(), selMuons.end(), higherPt);
77 for ( std::vector<reco::CandidateBaseRef>::const_iterator selMuon = selMuons.begin();
78 selMuon != selMuons.end(); ++selMuon ) {
79 if ( (*selMuon)->charge() > +0.5 )
return (*selMuon);
93 for ( std::vector<reco::CandidateBaseRef>::const_iterator selMuon = selMuons.begin();
94 selMuon != selMuons.end(); ++selMuon ) {
95 if ( (*selMuon)->charge() < -0.5 )
return (*selMuon);
109 trackDetMatchInfo = trackAssociator.
associate(evt, es, *recoMuon->
globalTrack(), trackAssociatorParameters);
113 trackDetMatchInfo = trackAssociator.
associate(evt, es, muonP3, muonVtx, muon->
charge(), trackAssociatorParameters);
115 return trackDetMatchInfo;
120 DetId detId(rawDetId);
121 std::cout <<
"detId = " << rawDetId << std::endl;
126 <<
" endcap = " << cscDetId.
endcap() <<
","
127 <<
" station = " << cscDetId.
station() <<
","
128 <<
" ring = " << cscDetId.
ring() <<
","
129 <<
" chamber = " << cscDetId.
chamber() <<
","
130 <<
" layer = " << cscDetId.
layer() << std::endl;
133 geo = cscGeometry->idToDet(detId);
137 <<
" region = " << rpcDetId.
region() <<
","
138 <<
" ring = " << rpcDetId.
ring() <<
","
139 <<
" station = " << rpcDetId.
station() <<
","
140 <<
" sector = " << rpcDetId.
sector() <<
","
141 <<
" layer = " << rpcDetId.
layer() <<
","
142 <<
" subsector = " << rpcDetId.
subsector() <<
","
143 <<
" roll = " << rpcDetId.
roll() << std::endl;
146 geo = rpcGeometry->idToDet(detId);
150 <<
" wheel = " << dtDetId.
wheel() <<
","
151 <<
" station = " << dtDetId.
station() <<
","
152 <<
" sector = " << dtDetId.
sector() << std::endl;
155 geo = dtGeometry->idToDet(detId);
157 std::cout <<
" WARNING: detId refers to unknown detector !!" << std::endl;
166 DetId detId1(rawDetId1);
167 DetId detId2(rawDetId2);
174 cscDetId1.
ring() == cscDetId2.
ring() &&
181 rpcDetId1.
ring() == rpcDetId2.
ring() &&
201 const std::vector<HepMC::GenVertex*> vertices(genEvt->vertices_begin(), genEvt->vertices_end());
202 const std::vector<HepMC::GenParticle*> particles(genEvt->particles_begin(), genEvt->particles_end());
204 int next_genVtx_barcode = 1;
205 for(std::vector<HepMC::GenVertex*>::const_iterator
iter = vertices.begin();
iter != vertices.end(); ++
iter, ++next_genVtx_barcode)
206 while(!(*iter)->suggest_barcode(-next_genVtx_barcode))
207 ++next_genVtx_barcode;
209 int next_genParticle_barcode = 1;
210 for(std::vector<HepMC::GenParticle*>::const_iterator
iter = particles.begin();
iter != particles.end(); ++
iter, ++next_genParticle_barcode)
211 while(!(*iter)->suggest_barcode(next_genParticle_barcode))
212 ++next_genParticle_barcode;
217 const std::vector<int>* pdgIds,
bool pdgIdStrict)
224 bool bestMatchMatchesPdgId =
false;
227 for ( reco::GenParticleCollection::const_iterator genParticle = genParticles.begin();
228 genParticle != genParticles.end(); ++genParticle ) {
229 bool matchesPdgId =
false;
231 for ( std::vector<int>::const_iterator
pdgId = pdgIds->begin();
pdgId != pdgIds->end(); ++
pdgId ) {
232 if ( genParticle->pdgId() == (*pdgId) ) {
240 if ( pdgIds && !matchesPdgId && pdgIdStrict )
continue;
243 bool statusMatch = (status == -1 || genParticle->status() ==
status);
244 if ( !statusMatch )
continue;
247 if ( dR > dRmax )
continue;
250 bool higherEnergyThanBestMatch = (bestMatch) ?
251 (genParticle->energy() > bestMatch->
energy()) :
true;
254 if ( bestMatchMatchesPdgId ) {
257 if ( matchesPdgId && higherEnergyThanBestMatch ) bestMatch = &(*genParticle);
261 if ( higherEnergyThanBestMatch || matchesPdgId ) {
262 bestMatch = &(*genParticle);
263 if ( matchesPdgId ) bestMatchMatchesPdgId =
true;
274 for (
unsigned iDaughter = 0; iDaughter < numDaughters; ++iDaughter ) {
280 if (
abs(mother->
pdgId()) == absPdgId ) {
281 if ( mother->
energy() < particleP4_afterRad.energy() ) particleP4_afterRad = mother->
p4();
305 for ( ParticleCollection::const_iterator
muon = muons->begin();
308 if (
muon->charge() > +0.5 ) {
309 genMuonPlusP4 =
muon->p4();
310 genMuonPlus_found =
true;
312 if (
muon->charge() < -0.5 ) {
313 genMuonMinusP4 =
muon->p4();
314 genMuonMinus_found =
true;
322 static TGraph* dedxGraphPbWO4 =
NULL;
324 static const double E[] = { 1.0, 1.40, 2.0, 3.0, 4.0, 8.0, 10.0,
325 14.0, 20.0, 30.0, 40.0, 80.0, 100.0,
326 140.0, 169.0, 200.0, 300.0, 400.0, 800.0, 1000.0,
327 1400.0, 2000.0, 3000.0, 4000.0, 8000.0 };
328 static const double DEDX[] = { 1.385, 1.440, 1.500, 1.569, 1.618, 1.743, 1.788,
329 1.862, 1.957, 2.101, 2.239, 2.778, 3.052,
330 3.603, 4.018, 4.456, 5.876, 7.333, 13.283, 16.320,
331 22.382, 31.625, 47.007, 62.559, 125.149 };
332 static const unsigned int N_ENTRIES =
sizeof(E)/
sizeof(E[0]);
334 if ( !dedxGraphPbWO4 ) dedxGraphPbWO4 =
new TGraph(N_ENTRIES, E, DEDX);
336 return dedxGraphPbWO4->Eval(p)*1.e-3;
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
virtual double energy() const GCC11_FINAL
energy
reco::CandidateBaseRef getTheMuMinus(const std::vector< reco::CandidateBaseRef > &)
daughters::value_type daughterRef(size_type i) const
reference to daughter at given position
bool matchMuonDetId(uint32_t, uint32_t)
virtual const LorentzVector & p4() const GCC11_FINAL
four-momentum Lorentz vector
virtual int pdgId() const GCC11_FINAL
PDG identifier.
virtual double pz() const =0
z coordinate of momentum vector
Geom::Phi< T > phi() const
bool isNull() const
Checks for null.
TrackDetMatchInfo getTrackDetMatchInfo(const edm::Event &, const edm::EventSetup &, TrackDetectorAssociator &, const TrackAssociatorParameters &, const reco::Candidate *)
void compGenTauP4afterRad(const reco::GenParticle *, reco::Candidate::LorentzVector &)
void compGenParticleP4afterRad(const reco::GenParticle *mother, reco::Candidate::LorentzVector &particleP4_afterRad, int absPdgId)
virtual size_type numberOfDaughters() const
number of daughters
edm::View< reco::Candidate > CandidateView
bool isNonnull() const
Checks for non-null.
virtual bool hasMasterClone() const =0
virtual float pt() const =0
transverse momentum
const Surface::PositionType & position() const
The position (origin of the R.F.)
double getDeDxForPbWO4(double)
virtual size_t numberOfDaughters() const
number of daughters
Abs< T >::type abs(const T &t)
auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
virtual const Point & vertex() const =0
vertex position
const reco::GenParticle * findGenParticleForMCEmbedding(const reco::Candidate::LorentzVector &, const reco::GenParticleCollection &, double, int, const std::vector< int > *, bool)
virtual int charge() const =0
electric charge
virtual double py() const =0
y coordinate of momentum vector
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
void compGenMuonP4afterRad(const reco::GenParticle *, reco::Candidate::LorentzVector &)
virtual double px() const =0
x coordinate of momentum vector
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
virtual const Candidate * daughter(size_type) const
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
math::XYZTLorentzVector LorentzVector
Lorentz vector.
void repairBarcodes(HepMC::GenEvent *)
edm::RefToBase< Candidate > CandidateBaseRef
persistent reference to an object in a collection of Candidate objects
int subsector() const
SubSector id : some sectors are divided along the phi direction in subsectors (from 1 to 4 in Barrel...
void printMuonDetId(const edm::EventSetup &, uint32_t)
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)
T get() const
get a component
void findMuons(const edm::Event &, const edm::InputTag &, reco::Candidate::LorentzVector &, bool &, reco::Candidate::LorentzVector &, bool &)
std::vector< reco::CandidateBaseRef > getSelMuons(const edm::Event &, const edm::InputTag &)
int station() const
Return the station number.
reco::CandidateBaseRef getTheMuPlus(const std::vector< reco::CandidateBaseRef > &)
Detector det() const
get the detector field from this detid
int wheel() const
Return the wheel number.
virtual TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector
std::vector< reco::Particle > ParticleCollection
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
virtual const CandidateBaseRef & masterClone() const =0