1 #ifndef PhysicsTools_PatUtils_interface_MuonVPlusJetsIDSelectionFunctor_h
2 #define PhysicsTools_PatUtils_interface_MuonVPlusJetsIDSelectionFunctor_h
43 if ( versionStr ==
"SUMMER08" ) {
46 else if ( versionStr ==
"FIRSTDATA" ) {
49 else if ( versionStr ==
"SPRING10" ) {
52 else if ( versionStr ==
"FALL10" ) {
54 if (
verbose_)
std::cout <<
"\nMUON SELECTION - you are using FALL10 Selection" << std::endl;
56 else if (versionStr ==
"KITQCD") {
58 if (
verbose_)
std::cout <<
"\nMUON SELECTION - you are using KITQCD Selection" << std::endl;
61 throw cms::Exception(
"InvalidInput") <<
"Expect version to be one of SUMMER08, FIRSTDATA, SPRING10, FALL10" << std::endl;
78 if ( parameters.
exists(
"cutsToIgnore") )
94 int nValidMuonHits = 0,
95 double ecalveto = 4.0,
96 double hcalveto = 6.0,
102 initialize( version, chi2, d0, ed0, sd0,
nhits, nValidMuonHits, ecalveto, hcalveto, reliso,
117 int nValidMuonHits = 0,
118 double ecalveto = 4.0,
119 double hcalveto = 6.0,
120 double reliso = 0.05,
121 double maxLepZ = 1.0,
123 int minNMatches = 1 )
132 push_back(
"NValMuHits", nValidMuonHits );
138 push_back(
"nMatchedStations", minNMatches);
151 set(
"nMatchedStations");
169 set(
"ECalVeto",
false);
170 set(
"HCalVeto",
false);
174 set(
"ECalVeto",
false);
175 set(
"HCalVeto",
false);
177 set(
"nPixelHits",
false);
178 set(
"nMatchedStations",
false);
182 set(
"NValMuHits",
false);
184 set(
"nPixelHits",
false);
185 set(
"nMatchedStations",
false);
188 set(
"NValMuHits",
false);
190 set(
"nPixelHits",
false);
191 set(
"nMatchedStations",
false);
219 <<
"MuonVPlusJetsSelectionFunctor SPRING10 and FALL10 versions needs the event! Call operator()(muon,event,ret)"
239 double corr_d0 = muon.
dB();
245 double hcalIso = muon.
hcalIso();
246 double ecalIso = muon.
ecalIso();
248 double pt = muon.
pt() ;
250 double relIso = (ecalIso + hcalIso + trkIso) / pt;
273 double corr_d0 = muon.
dB();
274 double corr_ed0 = muon.
edB();
275 double corr_sd0 = ( corr_ed0 > 0.000000001 ) ? corr_d0 / corr_ed0 : 999.0;
281 double hcalIso = muon.
hcalIso();
282 double ecalIso = muon.
ecalIso();
284 double pt = muon.
pt() ;
286 double relIso = (ecalIso + hcalIso + trkIso) / pt;
309 double corr_d0 = muon.
dB();
310 double corr_ed0 = muon.
edB();
311 double corr_sd0 = ( corr_ed0 > 0.000000001 ) ? corr_d0 / corr_ed0 : 999.0;
322 if( beamSpotHandle.
isValid() ){
323 beamSpot = *beamSpotHandle;
326 <<
"No beam spot available from EventSetup, not adding high level selection \n";
332 if ( innerTrack.isNonnull() && innerTrack.isAvailable() ) {
333 corr_d0 = -1.0 * innerTrack->dxy( beamPoint );
334 corr_ed0 =
sqrt( innerTrack->d0Error() * innerTrack->d0Error()
337 corr_sd0 = ( corr_ed0 > 0.000000001 ) ? corr_d0 / corr_ed0 : 999.0;
346 int nValidMuonHits =
static_cast<int> (muon.
globalTrack()->hitPattern().numberOfValidMuonHits());
351 double hcalIso = muon.
hcalIso();
352 double ecalIso = muon.
ecalIso();
354 double pt = muon.
pt() ;
356 double relIso = (ecalIso + hcalIso + trkIso) / pt;
383 double corr_d0 = muon.
dB();
384 double corr_ed0 = muon.
edB();
385 double corr_sd0 = ( corr_ed0 > 0.000000001 ) ? corr_d0 / corr_ed0 : 999.0;
389 event.getByLabel(
pvSrc_, pvtxHandle_ );
392 if ( pvtxHandle_->size() > 0 ) {
393 zvtx = pvtxHandle_->at(0).z();
395 throw cms::Exception(
"InvalidInput") <<
" There needs to be at least one primary vertex in the event." << std::endl;
407 if( beamSpotHandle.
isValid() ){
408 beamSpot = *beamSpotHandle;
411 <<
"No beam spot available from EventSetup, not adding high level selection \n";
417 if ( innerTrack.isNonnull() && innerTrack.isAvailable() ) {
418 corr_d0 = -1.0 * innerTrack->dxy( beamPoint );
419 corr_ed0 =
sqrt( innerTrack->d0Error() * innerTrack->d0Error()
422 corr_sd0 = ( corr_ed0 > 0.000000001 ) ? corr_d0 / corr_ed0 : 999.0;
431 int nValidMuonHits =
static_cast<int> (muon.
globalTrack()->hitPattern().numberOfValidMuonHits());
436 double hcalIso = muon.
hcalIso();
437 double ecalIso = muon.
ecalIso();
439 double pt = muon.
pt() ;
441 double relIso = (ecalIso + hcalIso + trkIso) / pt;
444 double z_mu = muon.
vertex().z();
446 int nPixelHits = muon.
innerTrack()->hitPattern().pixelLayersWithMeasurement();
479 double corr_d0 = muon.
dB();
480 double corr_ed0 = muon.
edB();
481 double corr_sd0 = ( corr_ed0 > 0.000000001 ) ? corr_d0 / corr_ed0 : 999.0;
485 event.getByLabel(
pvSrc_, pvtxHandle_ );
488 if ( pvtxHandle_->size() > 0 ) {
489 zvtx = pvtxHandle_->at(0).z();
491 throw cms::Exception(
"InvalidInput") <<
" There needs to be at least one primary vertex in the event." << std::endl;
503 if( beamSpotHandle.
isValid() ){
504 beamSpot = *beamSpotHandle;
507 <<
"No beam spot available from EventSetup, not adding high level selection \n";
513 if ( innerTrack.isNonnull() && innerTrack.isAvailable() ) {
514 corr_d0 = -1.0 * innerTrack->dxy( beamPoint );
515 corr_ed0 =
sqrt( innerTrack->d0Error() * innerTrack->d0Error()
518 corr_sd0 = ( corr_ed0 > 0.000000001 ) ? corr_d0 / corr_ed0 : 999.0;
527 int nValidMuonHits =
static_cast<int> (muon.
globalTrack()->hitPattern().numberOfValidMuonHits());
532 double hcalIso = muon.
hcalIso();
533 double ecalIso = muon.
ecalIso();
535 double pt = muon.
pt() ;
537 double relIso = (ecalIso + hcalIso + trkIso) / pt;
540 double z_mu = muon.
vertex().z();
542 int nPixelHits = muon.
innerTrack()->hitPattern().pixelLayersWithMeasurement();
567 if ( ((relIso > 0.2) && (relIso < 0.75))
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
void set(std::string const &s, bool val=true)
Set a given selection cut, on or off.
double z0() const
z coordinate
bool fall10Cuts(const pat::Muon &muon, edm::EventBase const &event, pat::strbitset &ret)
reco::TrackRef innerTrack() const
reference to Track reconstructed in the tracker only (reimplemented from reco::Muon) ...
edm::EDGetTokenT< std::vector< reco::Vertex > > pvSrcToken_
bool firstDataCuts(const pat::Muon &muon, pat::strbitset &ret)
void initialize(Version_t version, double chi2=10.0, double d0=999.0, double ed0=999.0, double sd0=3.0, int nhits=11, int nValidMuonHits=0, double ecalveto=4.0, double hcalveto=6.0, double reliso=0.05, double maxLepZ=1.0, int minPixelHits=1, int minNMatches=1)
virtual const Point & vertex() const
vertex position (overwritten by PF...)
MuonVPlusJetsIDSelectionFunctor(edm::ParameterSet const ¶meters, edm::ConsumesCollector &iC)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
float hadVetoEt
hcal sum-et in the veto region in r-phi
double dB(IPTYPE type) const
pat::strbitset::index_type index_type
void setIgnored(pat::strbitset &ret)
set ignored bits
pat::strbitset retInternal_
internal ret if users don't care about return bits
bool operator()(const pat::Muon &muon, pat::strbitset &ret)
This provides the interface for base classes to select objects.
virtual double pt() const
transverse momentum
bool summer08Cuts(const pat::Muon &muon, pat::strbitset &ret)
MuonVPlusJetsIDSelectionFunctor()
pat::strbitset bits_
the bitset indexed by strings
void passCut(pat::strbitset &ret, std::string const &s)
Passing cuts.
index_type indexStations_
bool ignoreCut(std::string const &s) const
ignore the cut at index "s"
double BeamWidthX() const
beam width X
virtual void push_back(std::string const &s)
This is the registration of an individual cut string.
index_type indexECalVeto_
math::XYZPoint Point
point in the space
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
Functor that operates on <T>
double edB(IPTYPE type) const
index_type indexNValMuHits_
edm::EDGetTokenT< reco::BeamSpot > beamLineSrcToken_
index_type indexHCalVeto_
reco::TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector (reimplemented from reco::Muon) ...
MuonVPlusJetsIDSelectionFunctor(Version_t version, double chi2=10.0, double d0=0.2, double ed0=999.0, double sd0=999.0, int nhits=11, int nValidMuonHits=0, double ecalveto=4.0, double hcalveto=6.0, double reliso=0.05, double maxLepZ=1.0, int minPixelHits=1, int minNMatches=1)
bool spring10Cuts(const pat::Muon &muon, edm::EventBase const &event, pat::strbitset &ret)
float emVetoEt
ecal sum-et in the veto region in r-phi
strbitset & set(bool val=true)
set method of all bits
double BeamWidthY() const
beam width Y
int numberOfMatches(ArbitrationType type=SegmentAndTrackArbitration) const
get number of chambers with matched segments
pat::strbitset getBitTemplate() const
Get an empty bitset with the proper names.
MuonVPlusJetsIDSelectionFunctor(edm::ParameterSet const ¶meters)
double y0() const
y coordinate
bool operator()(const pat::Muon &muon, edm::EventBase const &event, pat::strbitset &ret)
This provides an alternative signature that includes extra information.
void setIgnoredCuts(std::vector< std::string > const &bitsToIgnore)
set the bits to ignore from a vector
volatile std::atomic< bool > shutdown_flag false
unsigned int numberOfValidHits() const
numberOfValidHits returns the number of valid hits on the global track.
bool kitQCDCuts(const pat::Muon &muon, edm::EventBase const &event, pat::strbitset &ret)
double normChi2() const
Norm chi2 gives the normalized chi2 of the global track.
Analysis-level muon class.
edm::InputTag beamLineSrc_
const MuonIsolation & isolationR03() const
int cut(index_type const &i, int val) const
Access the int cut values at index "s".
double x0() const
x coordinate