15 #include <boost/foreach.hpp> 16 #include <TLorentzVector.h> 26 fHLTObjTag (iConfig.getParameter<
edm::InputTag>(
"TriggerEvent")),
27 fHLTTag (iConfig.getParameter<
edm::InputTag>(
"TriggerResults")),
28 fPVName (iConfig.getUntrackedParameter<
std::
string>(
"edmPVName",
"offlinePrimaryVertices")),
29 fMuonName (iConfig.getUntrackedParameter<
std::
string>(
"edmName",
"muons")),
30 fTrackName (iConfig.getUntrackedParameter<
std::
string>(
"edmTrackName",
"generalTracks")),
33 fElectronName( iConfig.getUntrackedParameter<
std::
string>(
"edmGsfEleName",
"gedGsfElectrons")),
34 fSCName( iConfig.getUntrackedParameter<
std::
string>(
"edmSCName",
"particleFlowEGamma")),
37 fRhoTag( iConfig.getParameter<
edm::InputTag>(
"rhoname") ),
38 fBeamspotTag(iConfig.getParameter<
edm::InputTag>(
"beamspotName") ),
39 fConversionTag( iConfig.getParameter<
edm::InputTag>(
"conversionsName")),
42 ELE_PT_CUT_TAG(iConfig.getUntrackedParameter<double>(
"PtCutEleTag")),
43 ELE_PT_CUT_PROBE(iConfig.getUntrackedParameter<double>(
"PtCutEleProbe")),
44 ELE_ETA_CUT_TAG(iConfig.getUntrackedParameter<double>(
"EtaCutEleTag")),
45 ELE_ETA_CUT_PROBE(iConfig.getUntrackedParameter<double>(
"EtaCutEleProbe")),
47 ELE_MASS_CUT_LOW(iConfig.getUntrackedParameter<double>(
"MassCutEleLow")),
48 ELE_MASS_CUT_HIGH(iConfig.getUntrackedParameter<double>(
"MassCutEleHigh")),
50 ELE_ID_WP( iConfig.getUntrackedParameter<
std::
string>(
"ElectronIDType",
"TIGHT")),
53 edm::LogInfo(
"ZCounting") <<
"Constructor ZCounting::ZCounting " << std::endl;
113 edm::LogInfo(
"ZCounting") <<
"Destructor ZCounting::~ZCounting " << std::endl;
121 edm::LogInfo(
"ZCounting") <<
"ZCounting::beginRun" << std::endl;
132 edm::LogInfo(
"ZCounting") <<
"ZCounting::bookHistograms" << std::endl;
180 edm::LogInfo(
"ZCounting") <<
"ZCounting::beginLuminosityBlock" << std::endl;
190 edm::LogInfo(
"ZCounting") <<
"ZCounting::analyze" << std::endl;
196 edm::LogInfo(
"ZCounting") <<
"ZCounting::analyzeMuons" << std::endl;
202 if(!hVertexProduct.
isValid())
return;
208 for(
auto const & itVtx : *hVertexProduct) {
209 if(itVtx.isFake())
continue;
213 if(itVtx.position().Rho() >
VtxRhoCut_)
continue;
237 bool config_changed =
false;
240 config_changed =
true;
243 initHLT(*hTrgRes, triggerNames);
247 for(
unsigned int irec=0; irec<
fTrigger->fRecords.size(); irec++) {
248 if(
fTrigger->fRecords[irec].hltPathIndex == (
unsigned int)-1)
continue;
250 triggerBits [
fTrigger->fRecords[irec].baconTrigBit] =
true;
263 if(!hMuonProduct.
isValid())
return;
267 if(!hTrackProduct.
isValid())
return;
269 TLorentzVector vTag(0.,0.,0.,0.);
270 TLorentzVector vProbe(0.,0.,0.,0.);
271 TLorentzVector vTrack(0.,0.,0.,0.);
274 for(
auto const & itMu1 : *hMuonProduct) {
276 float pt1 = itMu1.muonBestTrack()->pt();
277 float eta1 = itMu1.muonBestTrack()->eta();
278 float phi1 = itMu1.muonBestTrack()->phi();
279 float q1 = itMu1.muonBestTrack()->charge();
287 vTag.SetPtEtaPhiM(pt1, eta1, phi1,
MUON_MASS);
290 for(
auto const & itMu2 : *hMuonProduct) {
291 if(&itMu2 == &itMu1)
continue;
293 float pt2 = itMu2.muonBestTrack()->pt();
294 float eta2 = itMu2.muonBestTrack()->eta();
295 float phi2 = itMu2.muonBestTrack()->phi();
296 float q2 = itMu2.muonBestTrack()->charge();
301 if(q1 == q2)
continue;
303 vProbe.SetPtEtaPhiM(pt2, eta2, phi2,
MUON_MASS);
306 TLorentzVector vDilep = vTag + vProbe;
307 float dilepMass = vDilep.M();
310 bool isTagCentral =
false;
311 bool isProbeCentral =
false;
312 if(fabs(eta1) <
MUON_BOUND) isTagCentral =
true;
313 if(fabs(eta2) <
MUON_BOUND) isProbeCentral =
true;
319 if(&itMu1>&itMu2)
continue;
367 else if(itMu2.isGlobalMuon()){
379 else if(itMu2.isStandAloneMuon()){
389 else if(itMu2.innerTrack()->hitPattern().trackerLayersWithMeasurement() >= 6 && itMu2.innerTrack()->hitPattern().numberOfValidPixelHits() >= 1){
403 for(
auto const & itTrk : *hTrackProduct) {
407 for(
auto const & itMu : *hMuonProduct) {
408 if(itMu.innerTrack().isNonnull() && itMu.innerTrack().get() == &itTrk) {
415 float pt2 = itTrk.pt();
416 float eta2 = itTrk.eta();
417 float phi2 = itTrk.phi();
418 float q2 = itTrk.charge();
423 if(q1 == q2)
continue;
425 vTrack.SetPtEtaPhiM(pt2, eta2, phi2,
MUON_MASS);
427 TLorentzVector vDilep = vTag + vTrack;
428 float dilepMass = vDilep.M();
431 bool isTrackCentral =
false;
432 if(fabs(eta2) >
MUON_BOUND) isTrackCentral =
true;
434 if(itTrk.hitPattern().trackerLayersWithMeasurement() >= 6 && itTrk.hitPattern().numberOfValidPixelHits() >= 1){
445 edm::LogInfo(
"ZCounting") <<
"ZCounting::analyzeElectrons" << std::endl;
452 if(!hVertexProduct.
isValid())
return;
457 for(
auto const &
vtx : *pvCol) {
458 if(
vtx.isFake())
continue;
482 Bool_t config_changed =
false;
485 config_changed =
true;
488 initHLT(*hTrgRes, triggerNames);
492 for(
unsigned int irec=0; irec<
fTrigger->fRecords.size(); irec++) {
493 if(
fTrigger->fRecords[irec].hltPathIndex == (
unsigned int)-1)
continue;
495 triggerBits [
fTrigger->fRecords[irec].baconTrigBit] =
true;
525 enum { eEleEle2HLT=1, eEleEle1HLT1L1, eEleEle1HLT, eEleEleNoSel, eEleSC };
528 for (
size_t itag = 0; itag < electrons->size(); ++itag){
529 const auto el1 = electrons->ptrAt(itag);
530 if( not
EleID_.
passID(el1,beamspotHandle,conversionsHandle) )
continue;
532 float pt1 = el1->pt();
533 float eta1 = el1->eta();
534 float phi1 = el1->phi();
537 TLorentzVector vTag(0.,0.,0.,0.);
542 double tag_pt = vTag.Pt();
543 double tag_abseta = fabs(vTag.Eta());
548 if( not (tag_is_valid_tag
or tag_is_valid_probe) )
continue;
551 for (
size_t iprobe = 0; iprobe < superclusters->size(); ++iprobe){
553 const auto sc = superclusters->ptrAt(iprobe);
554 if(*
sc == *(el1->superCluster())) {
559 for (
size_t iele = 0; iele < electrons->size(); ++iele){
560 if(iele == itag)
continue;
561 const auto ele = electrons->ptrAt(iele);
562 if(*
sc == *(ele->superCluster())) {
569 TLorentzVector vProbe(0.,0.,0.,0.);
578 double probe_pt = vProbe.Pt();
579 double probe_abseta = fabs(
sc->
eta());
581 if( !probe_is_valid_probe )
continue;
586 TLorentzVector vDilep = vTag + vProbe;
589 if(eleProbe.
isNonnull() and (eleProbe->
charge() != - el1->charge()))
continue;
595 bool probe_pass_id = eleProbe.
isNonnull() and
EleID_.
passID(eleProbe,beamspotHandle,conversionsHandle);
602 if(probe_is_forward and tag_is_forward) {
604 }
else if(!probe_is_forward and !tag_is_forward) {
611 if(!tag_is_valid_tag)
continue;
615 if(probe_is_forward) {
621 if(probe_is_forward) {
629 if(probe_pass_id and probe_pass_trigger) {
630 if(probe_is_forward) {
635 }
else if (probe_pass_id) {
636 if(probe_is_forward) {
664 edm::LogInfo(
"ZCounting") <<
"ZCounting::endLuminosityBlock" << std::endl;
673 for(
unsigned int irec=0; irec<
fTrigger->fRecords.size(); irec++) {
674 fTrigger->fRecords[irec].hltPathName =
"";
675 fTrigger->fRecords[irec].hltPathIndex = (
unsigned int)-1;
679 if(matches.empty()) {
680 edm::LogWarning(
"ZCounting") <<
"requested pattern [" << pattern <<
"] does not match any HLT paths" << std::endl;
682 BOOST_FOREACH(std::vector<std::string>::const_iterator
match, matches) {
691 if(index < result.
size()) {
700 return triggerMenu.
pass(
"HLT_IsoMu27_v*",hltBits);
706 return triggerMenu.
passObj(
"HLT_IsoMu27_v*",
"hltL3crIsoL1sMu22Or25L1f0L2f10QL3f27QL3trkIsoFiltered0p07",hltMatchBits);
716 else if(idType ==
NoneID)
return true;
725 else if(isoType ==
NoneIso)
return true;
732 return triggerMenu.
pass(
"HLT_Ele35_WPTight_Gsf_v*",hltBits);
737 return triggerMenu.
passObj(
"HLT_Ele35_WPTight_Gsf_v*",
"hltEle35noerWPTightGsfTrackIsoFilter",hltMatchBits);
MonitorElement * h_mass_Sta_fail_central
ZCounting(const edm::ParameterSet &ps)
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * h_mass_Sta_pass_central
bool isElectronTrigger(ZCountingTrigger::TTrigger triggerMenu, TriggerBits hltBits)
edm::InputTag fBeamspotTag
MonitorElement * h_mass_SIT_fail_central
double eta() const final
momentum pseudorapidity
float sumPt
sum-pt of tracks
float phi() const
Momentum azimuthal angle. Note this is taken from the first SimTrack only.
bool isMuon(const Candidate &part)
bool isMediumMuon(const reco::Muon &, bool run2016_hip_mitigation=false)
void beginLuminosityBlock(edm::LuminosityBlock const &lumi, edm::EventSetup const &eSetup) override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
bool passObj(const std::string &iName, const std::string &iObjName, const TriggerObjects &iTrigObj) const
#define DEFINE_FWK_MODULE(type)
MonitorElement * h_mass_SIT_pass_forward
bool accept() const
Has at least one path accepted the event?
bool is_glob(std::string const &pattern)
MonitorElement * h_yield_Z
edm::LuminosityBlockNumber_t luminosityBlock() const
double pt() const final
transverse momentum
std::vector< Vertex > VertexCollection
collection of Vertex objects
int charge() const final
electric charge
bool passMuonID(const reco::Muon &muon, const reco::Vertex &vtx, const MuonIDTypes &idType)
edm::EDGetTokenT< edm::View< reco::GsfElectron > > fGsfElectronName_token
bool isElectronTriggerObj(ZCountingTrigger::TTrigger triggerMenu, TriggerObjects hltMatchBits)
edm::InputTag fConversionTag
MonitorElement * h_mass_HLT_pass_forward
float sumPhotonEt
sum pt of PF photons
ElectronIdentifier EleID_
const float ELE_ETA_CRACK_HIGH
const float ELE_ETA_CUT_TAG
MonitorElement * h_ee_mass_HLT_fail_central
Strings const & triggerNames() const
std::bitset< kNTrigObjectBit > TriggerObjects
MonitorElement * h_ee_mass_HLT_pass_forward
bool isLooseMuon(const reco::Muon &)
float sumNeutralHadronEt
sum pt of neutral hadrons
ParameterSetID const & parameterSetID() const
edm::EDGetTokenT< reco::TrackCollection > fTrackName_token
edm::EDGetTokenT< reco::MuonCollection > fMuonName_token
void analyzeMuons(edm::Event const &e, edm::EventSetup const &eSetup)
float sumPUPt
sum pt of charged Particles not from PV (for Pu corrections)
MonitorElement * h_mass_Sta_pass_forward
edm::ParameterSetID fTriggerNamesID
const float ELE_MASS_CUT_HIGH
const std::string ELE_ID_WP
unsigned int triggerIndex(std::string const &name) const
edm::EDGetTokenT< reco::VertexCollection > fPVName_token
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
unsigned int size() const
Get number of paths stored.
MonitorElement * h_yieldEE_Z
std::bitset< kNTrigBit > TriggerBits
const float ELE_PT_CUT_PROBE
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
bool passID(const reco::GsfElectronPtr &ele, edm::Handle< reco::BeamSpot > beamspot, edm::Handle< reco::ConversionCollection > conversions)
bool isMuonTrigger(const ZCountingTrigger::TTrigger &triggerMenu, const TriggerBits &hltBits)
MonitorElement * book1D(Args &&...args)
void initHLT(const edm::TriggerResults &, const edm::TriggerNames &)
float energy() const
Energy. Note this is taken from the first SimTrack only.
MonitorElement * h_ee_yield_Z_eeee
MonitorElement * h_ee_yield_Z_ebee
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * h_ee_mass_HLT_fail_forward
bool ele_tag_selection(double pt, double abseta)
MonitorElement * h_mass_Sta_fail_forward
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
bool isNonnull() const
Checks for non-null.
const float ELE_MASS_CUT_LOW
const float ELE_ETA_CRACK_LOW
edm::EDGetTokenT< trigger::TriggerEvent > fHLTObjTag_token
MonitorElement * h_ee_mass_id_pass_forward
MonitorElement * h_ee_mass_HLT_pass_central
void endLuminosityBlock(edm::LuminosityBlock const &lumi, edm::EventSetup const &eSetup) override
MonitorElement * h_mass_SIT_fail_forward
void setCurrentFolder(const std::string &fullpath)
T const * product() const
MonitorElement * book2D(Args &&...args)
MonitorElement * h_ee_yield_Z_ebeb
bool pass(const std::string &iName, const TriggerBits &iTrig) const
const MuonPFIsolation & pfIsolationR04() const
MonitorElement * h_mass_HLT_pass_central
const float ELE_ETA_CUT_PROBE
edm::EDGetTokenT< reco::ConversionCollection > fConversionToken
edm::EDGetTokenT< edm::TriggerResults > fHLTTag_token
bool ele_probe_selection(double pt, double abseta)
MonitorElement * h_ee_mass_id_pass_central
std::string fElectronName
MonitorElement * h_mass_HLT_fail_forward
std::vector< std::vector< std::string >::const_iterator > regexMatch(std::vector< std::string > const &strings, std::regex const ®exp)
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
bool passMuonIso(const reco::Muon &muon, const MuonIsoTypes &isoType, const float isoCut)
void setID(std::string ID)
MonitorElement * h_ee_mass_id_fail_forward
edm::EDGetTokenT< double > fRhoToken
MonitorElement * h_yieldBB_Z
MonitorElement * h_ee_mass_id_fail_central
void analyzeElectrons(edm::Event const &e, edm::EventSetup const &eSetup)
const float ELECTRON_MASS
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
bool isTightMuon(const reco::Muon &, const reco::Vertex &)
edm::EDGetTokenT< reco::BeamSpot > fBeamspotToken
MonitorElement * h_mass_SIT_pass_central
const float ELE_PT_CUT_TAG
std::unique_ptr< ZCountingTrigger::TTrigger > fTrigger
double phi() const final
momentum azimuthal angle
edm::EDGetTokenT< edm::View< reco::SuperCluster > > fSCName_token
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
Power< A, B >::type pow(const A &a, const B &b)
MonitorElement * h_mass_HLT_fail_central
bool isMuonTriggerObj(const ZCountingTrigger::TTrigger &triggerMenu, const TriggerObjects &hltMatchBits)
const MuonIsolation & isolationR03() const
float eta() const
Momentum pseudorapidity. Note this is taken from the simtrack before the calorimeter.
float sumChargedHadronPt
sum-pt of charged Hadron