CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
ZToMuMuSelector Class Reference
Inheritance diagram for ZToMuMuSelector:
edm::EDFilter edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

bool filter (edm::Event &, const edm::EventSetup &) override
 
 ZToMuMuSelector (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDFilter () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

double etaCut_
 
edm::EDGetTokenT< edm::ValueMap< bool > > isoToken_
 
edm::EDGetTokenT< edm::ValueMap< bool > > isoTrackerToken_
 
double massZMax_
 
double massZMin_
 
int minTrackerHits_
 
edm::EDGetTokenT< reco::TrackCollectionmuonToken_
 
bool onlyGlobalMuons_
 
double ptCut_
 
edm::EDGetTokenT< reco::TrackCollectiontrackerToken_
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDFilter
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 12 of file ZToMuMuSelector.cc.

Constructor & Destructor Documentation

◆ ZToMuMuSelector()

ZToMuMuSelector::ZToMuMuSelector ( const edm::ParameterSet cfg)

Definition at line 40 of file ZToMuMuSelector.cc.

41  : muonToken_(consumes<TrackCollection>(cfg.getParameter<edm::InputTag>("MuonTag"))),
42  isoToken_(consumes<edm::ValueMap<bool> >(cfg.getParameter<edm::InputTag>("IsolationTag"))),
43  ptCut_(cfg.getParameter<double>("PtCut")),
44  etaCut_(cfg.getParameter<double>("EtaCut")),
45  massZMin_(cfg.getParameter<double>("MassZMin")),
46  massZMax_(cfg.getParameter<double>("MassZMax")),
47 
48  onlyGlobalMuons_(cfg.getParameter<bool>("OnlyGlobalMuons")),
49  trackerToken_(mayConsume<TrackCollection>(
50  cfg.getUntrackedParameter<edm::InputTag>("TrackerTag", edm::InputTag("ctfWithMaterialTracks")))),
52  cfg.getUntrackedParameter<edm::InputTag>("TrackerIsolationTag", edm::InputTag("zMuMuTrackerIsolations")))),
53  minTrackerHits_(cfg.getUntrackedParameter<int>("MinTrackerHits", 7)) {}

Member Function Documentation

◆ filter()

bool ZToMuMuSelector::filter ( edm::Event ev,
const edm::EventSetup  
)
overridevirtual

Implements edm::EDFilter.

Definition at line 55 of file ZToMuMuSelector.cc.

55  {
57  ev.getByToken(muonToken_, muonCollection);
58  if (!muonCollection.isValid()) {
59  LogTrace("") << ">>> Muon collection does not exist !!!";
60  return false;
61  }
62 
64  ev.getByToken(isoToken_, isoMap);
65  if (!isoMap.isValid()) {
66  LogTrace("") << ">>> ISO Muon collection does not exist !!!";
67  return false;
68  }
69 
70  Handle<TrackCollection> trackerCollection;
71  Handle<edm::ValueMap<bool> > isoTrackerMap;
72  if (!onlyGlobalMuons_) {
73  ev.getByToken(trackerToken_, trackerCollection);
74  if (!trackerCollection.isValid()) {
75  LogTrace("") << ">>> Tracker collection does not exist !!!";
76  return false;
77  }
78 
79  ev.getByToken(isoTrackerToken_, isoTrackerMap);
80  if (!isoTrackerMap.isValid()) {
81  LogTrace("") << ">>> ISO Tracker collection does not exist !!!";
82  return false;
83  }
84  }
85 
86  unsigned int npairs = 0;
87  bool globalCombinationFound = false;
88  for (unsigned int i = 0; i < muonCollection->size(); i++) {
90  LogTrace("") << "> Processing muon number " << i << "...";
91  double pt = mu->pt();
92  LogTrace("") << "\t... pt= " << pt << " GeV";
93  if (pt < ptCut_)
94  continue;
95  double eta = mu->eta();
96  LogTrace("") << "\t... eta= " << eta;
97  if (fabs(eta) > etaCut_)
98  continue;
99  bool iso = (*isoMap)[mu];
100  LogTrace("") << "\t... isolated? " << iso;
101  if (!iso)
102  continue;
103 
104  for (unsigned int j = i + 1; j < muonCollection->size(); j++) {
105  TrackRef mu2(muonCollection, j);
106  LogTrace("") << "> Processing second muon number " << j << "...";
107  double pt2 = mu2->pt();
108  LogTrace("") << "\t... pt2= " << pt2 << " GeV";
109  if (pt2 < ptCut_)
110  continue;
111  double eta2 = mu2->eta();
112  LogTrace("") << "\t... eta2= " << eta2;
113  if (fabs(eta2) > etaCut_)
114  continue;
115  bool iso2 = (*isoMap)[mu2];
116  LogTrace("") << "\t... isolated2? " << iso2;
117  if (!iso2)
118  continue;
119 
120  double z_en = mu->p() + mu2->p();
121  double z_px = mu->px() + mu2->px();
122  double z_py = mu->py() + mu2->py();
123  double z_pz = mu->pz() + mu2->pz();
124  double massZ = z_en * z_en - z_px * z_px - z_py * z_py - z_pz * z_pz;
125  massZ = (massZ > 0) ? sqrt(massZ) : 0;
126  LogTrace("") << "\t... Z_en, Z_px, Z_py, Z_pz= " << z_en << ", " << z_px << ", " << z_py << ", " << z_pz
127  << " GeV";
128  LogTrace("") << "\t... (GM-GM) Invariant reconstructed mass= " << massZ << " GeV";
129  if (massZ < massZMin_)
130  continue;
131  if (massZ > massZMax_)
132  continue;
133  globalCombinationFound = true;
134  npairs++;
135  }
136 
137  if (onlyGlobalMuons_ || globalCombinationFound)
138  continue;
139 
140  for (unsigned int j = 0; j < trackerCollection->size(); j++) {
141  TrackRef mu2(trackerCollection, j);
142  LogTrace("") << "> Processing track number " << j << "...";
143  double pt2 = mu2->pt();
144  LogTrace("") << "\t... pt3= " << pt2 << " GeV";
145  if (pt2 < ptCut_)
146  continue;
147  double eta2 = mu2->eta();
148  LogTrace("") << "\t... eta3= " << eta2;
149  if (fabs(eta2) > etaCut_)
150  continue;
151  int nhits2 = mu2->numberOfValidHits();
152  LogTrace("") << "\t... nhits3= " << nhits2;
153  if (nhits2 < minTrackerHits_)
154  continue;
155  bool iso2 = (*isoTrackerMap)[mu2];
156  LogTrace("") << "\t... isolated3? " << iso2;
157  if (!iso2)
158  continue;
159 
160  double z_en = mu->p() + mu2->p();
161  double z_px = mu->px() + mu2->px();
162  double z_py = mu->py() + mu2->py();
163  double z_pz = mu->pz() + mu2->pz();
164  double massZ = z_en * z_en - z_px * z_px - z_py * z_py - z_pz * z_pz;
165  massZ = (massZ > 0) ? sqrt(massZ) : 0;
166  LogTrace("") << "\t... Z_en, Z_px, Z_py, Z_pz= " << z_en << ", " << z_px << ", " << z_py << ", " << z_pz
167  << " GeV";
168  LogTrace("") << "\t... (GM-TK) Invariant reconstructed mass= " << massZ << " GeV";
169  if (massZ < massZMin_)
170  continue;
171  if (massZ > massZMax_)
172  continue;
173  npairs++;
174  }
175  }
176 
177  LogTrace("") << "> Number of Z pairs found= " << npairs;
178  if (npairs < 1) {
179  LogTrace("") << ">>>> Event REJECTED";
180  return false;
181  }
182  LogTrace("") << ">>>> Event SELECTED!!!";
183 
184  return true;
185 }

References PVValHelper::eta, HLT_FULL_cff::eta2, etaCut_, ev, mps_fire::i, isoToken_, isoTrackerToken_, edm::HandleBase::isValid(), dqmiolumiharvest::j, LogTrace, massZMax_, massZMin_, minTrackerHits_, amptDefaultParameters_cff::mu, pdwgLeptonRecoSkim_cfi::muonCollection, muonToken_, onlyGlobalMuons_, DiDispStaMuonMonitor_cfi::pt, HLT_FULL_cff::pt2, ptCut_, mathSSE::sqrt(), and trackerToken_.

Member Data Documentation

◆ etaCut_

double ZToMuMuSelector::etaCut_
private

Definition at line 21 of file ZToMuMuSelector.cc.

Referenced by filter().

◆ isoToken_

edm::EDGetTokenT<edm::ValueMap<bool> > ZToMuMuSelector::isoToken_
private

Definition at line 19 of file ZToMuMuSelector.cc.

Referenced by filter().

◆ isoTrackerToken_

edm::EDGetTokenT<edm::ValueMap<bool> > ZToMuMuSelector::isoTrackerToken_
private

Definition at line 27 of file ZToMuMuSelector.cc.

Referenced by filter().

◆ massZMax_

double ZToMuMuSelector::massZMax_
private

Definition at line 23 of file ZToMuMuSelector.cc.

Referenced by filter().

◆ massZMin_

double ZToMuMuSelector::massZMin_
private

Definition at line 22 of file ZToMuMuSelector.cc.

Referenced by filter().

◆ minTrackerHits_

int ZToMuMuSelector::minTrackerHits_
private

Definition at line 28 of file ZToMuMuSelector.cc.

Referenced by filter().

◆ muonToken_

edm::EDGetTokenT<reco::TrackCollection> ZToMuMuSelector::muonToken_
private

Definition at line 18 of file ZToMuMuSelector.cc.

Referenced by filter().

◆ onlyGlobalMuons_

bool ZToMuMuSelector::onlyGlobalMuons_
private

Definition at line 25 of file ZToMuMuSelector.cc.

Referenced by filter().

◆ ptCut_

double ZToMuMuSelector::ptCut_
private

◆ trackerToken_

edm::EDGetTokenT<reco::TrackCollection> ZToMuMuSelector::trackerToken_
private

Definition at line 26 of file ZToMuMuSelector.cc.

Referenced by filter().

mps_fire.i
i
Definition: mps_fire.py:428
ZToMuMuSelector::isoTrackerToken_
edm::EDGetTokenT< edm::ValueMap< bool > > isoTrackerToken_
Definition: ZToMuMuSelector.cc:27
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
amptDefaultParameters_cff.mu
mu
Definition: amptDefaultParameters_cff.py:16
ZToMuMuSelector::ptCut_
double ptCut_
Definition: ZToMuMuSelector.cc:20
edm::Handle
Definition: AssociativeIterator.h:50
edm::Ref< TrackCollection >
ZToMuMuSelector::isoToken_
edm::EDGetTokenT< edm::ValueMap< bool > > isoToken_
Definition: ZToMuMuSelector.cc:19
PVValHelper::eta
Definition: PVValidationHelpers.h:69
ZToMuMuSelector::minTrackerHits_
int minTrackerHits_
Definition: ZToMuMuSelector.cc:28
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
HLT_FULL_cff.eta2
eta2
Definition: HLT_FULL_cff.py:9605
edm::EDConsumerBase::mayConsume
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
Definition: EDConsumerBase.h:173
HLT_FULL_cff.pt2
pt2
Definition: HLT_FULL_cff.py:9935
pdwgLeptonRecoSkim_cfi.muonCollection
muonCollection
Definition: pdwgLeptonRecoSkim_cfi.py:7
looper.cfg
cfg
Definition: looper.py:297
ZToMuMuSelector::massZMin_
double massZMin_
Definition: ZToMuMuSelector.cc:22
ZToMuMuSelector::onlyGlobalMuons_
bool onlyGlobalMuons_
Definition: ZToMuMuSelector.cc:25
edm::ValueMap
Definition: ValueMap.h:107
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
ZToMuMuSelector::trackerToken_
edm::EDGetTokenT< reco::TrackCollection > trackerToken_
Definition: ZToMuMuSelector.cc:26
ZToMuMuSelector::etaCut_
double etaCut_
Definition: ZToMuMuSelector.cc:21
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:224
edm::EDConsumerBase::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: EDConsumerBase.h:153
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::InputTag
Definition: InputTag.h:15
ZToMuMuSelector::muonToken_
edm::EDGetTokenT< reco::TrackCollection > muonToken_
Definition: ZToMuMuSelector.cc:18
ZToMuMuSelector::massZMax_
double massZMax_
Definition: ZToMuMuSelector.cc:23