CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

virtual bool filter (edm::Event &, const edm::EventSetup &) override
 
 ZToMuMuSelector (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDFilter ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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::TrackCollection
muonToken_
 
bool onlyGlobalMuons_
 
double ptCut_
 
edm::EDGetTokenT
< reco::TrackCollection
trackerToken_
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
- Public Types inherited from edm::ProducerBase
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 &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
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 ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 12 of file ZToMuMuSelector.cc.

Constructor & Destructor Documentation

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

Definition at line 39 of file ZToMuMuSelector.cc.

39  :
40  muonToken_(consumes<TrackCollection>(cfg.getParameter<edm::InputTag> ("MuonTag"))),
42  ptCut_(cfg.getParameter<double>("PtCut")),
43  etaCut_(cfg.getParameter<double>("EtaCut")),
44  massZMin_(cfg.getParameter<double>("MassZMin")),
45  massZMax_(cfg.getParameter<double>("MassZMax")),
46 
47  onlyGlobalMuons_(cfg.getParameter<bool>("OnlyGlobalMuons")),
48  trackerToken_(mayConsume<TrackCollection>(cfg.getUntrackedParameter<edm::InputTag> ("TrackerTag",edm::InputTag("ctfWithMaterialTracks")))),
49  isoTrackerToken_(mayConsume<edm::ValueMap<bool> >(cfg.getUntrackedParameter<edm::InputTag> ("TrackerIsolationTag",edm::InputTag("zMuMuTrackerIsolations")))),
50  minTrackerHits_(cfg.getUntrackedParameter<int>("MinTrackerHits",7))
51 {
52 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< reco::TrackCollection > muonToken_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< reco::TrackCollection > trackerToken_
edm::EDGetTokenT< edm::ValueMap< bool > > isoToken_
edm::EDGetTokenT< edm::ValueMap< bool > > isoTrackerToken_
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)

Member Function Documentation

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

Implements edm::EDFilter.

Definition at line 54 of file ZToMuMuSelector.cc.

References eta, etaCut_, edm::Event::getByToken(), i, isoToken_, isoTrackerToken_, edm::HandleBase::isValid(), j, LogTrace, massZMax_, massZMin_, minTrackerHits_, RPCpg::mu, muonToken_, onlyGlobalMuons_, EnergyCorrector::pt, ptCut_, mathSSE::sqrt(), and trackerToken_.

Referenced by Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::filter(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::setDataAccessor(), and Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::switchCenterView().

54  {
55 
56  Handle<TrackCollection> muonCollection;
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++) {
89  TrackRef mu(muonCollection,i);
90  LogTrace("") << "> Processing muon number " << i << "...";
91  double pt = mu->pt();
92  LogTrace("") << "\t... pt= " << pt << " GeV";
93  if (pt<ptCut_) continue;
94  double eta = mu->eta();
95  LogTrace("") << "\t... eta= " << eta;
96  if (fabs(eta)>etaCut_) continue;
97  bool iso = (*isoMap)[mu];
98  LogTrace("") << "\t... isolated? " << iso;
99  if (!iso) continue;
100 
101  for (unsigned int j=i+1; j<muonCollection->size(); j++) {
102  TrackRef mu2(muonCollection,j);
103  LogTrace("") << "> Processing second muon number " << j << "...";
104  double pt2 = mu2->pt();
105  LogTrace("") << "\t... pt2= " << pt2 << " GeV";
106  if (pt2<ptCut_) continue;
107  double eta2 = mu2->eta();
108  LogTrace("") << "\t... eta2= " << eta2;
109  if (fabs(eta2)>etaCut_) continue;
110  bool iso2 = (*isoMap)[mu2];
111  LogTrace("") << "\t... isolated2? " << iso2;
112  if (!iso2) continue;
113 
114  double z_en = mu->p() + mu2->p();
115  double z_px = mu->px() + mu2->px();
116  double z_py = mu->py() + mu2->py();
117  double z_pz = mu->pz() + mu2->pz();
118  double massZ = z_en*z_en - z_px*z_px - z_py*z_py - z_pz*z_pz;
119  massZ = (massZ>0) ? sqrt(massZ) : 0;
120  LogTrace("") << "\t... Z_en, Z_px, Z_py, Z_pz= " << z_en << ", " << z_px << ", " << z_py << ", " << z_pz << " GeV";
121  LogTrace("") << "\t... (GM-GM) Invariant reconstructed mass= " << massZ << " GeV";
122  if (massZ<massZMin_) continue;
123  if (massZ>massZMax_) continue;
124  globalCombinationFound = true;
125  npairs++;
126  }
127 
128  if (onlyGlobalMuons_ || globalCombinationFound) continue;
129 
130  for (unsigned int j=0; j<trackerCollection->size(); j++) {
131  TrackRef mu2(trackerCollection,j);
132  LogTrace("") << "> Processing track number " << j << "...";
133  double pt2 = mu2->pt();
134  LogTrace("") << "\t... pt3= " << pt2 << " GeV";
135  if (pt2<ptCut_) continue;
136  double eta2 = mu2->eta();
137  LogTrace("") << "\t... eta3= " << eta2;
138  if (fabs(eta2)>etaCut_) continue;
139  int nhits2 = mu2->numberOfValidHits();
140  LogTrace("") << "\t... nhits3= " << nhits2;
141  if (nhits2<minTrackerHits_) continue;
142  bool iso2 = (*isoTrackerMap)[mu2];
143  LogTrace("") << "\t... isolated3? " << iso2;
144  if (!iso2) continue;
145 
146  double z_en = mu->p() + mu2->p();
147  double z_px = mu->px() + mu2->px();
148  double z_py = mu->py() + mu2->py();
149  double z_pz = mu->pz() + mu2->pz();
150  double massZ = z_en*z_en - z_px*z_px - z_py*z_py - z_pz*z_pz;
151  massZ = (massZ>0) ? sqrt(massZ) : 0;
152  LogTrace("") << "\t... Z_en, Z_px, Z_py, Z_pz= " << z_en << ", " << z_px << ", " << z_py << ", " << z_pz << " GeV";
153  LogTrace("") << "\t... (GM-TK) Invariant reconstructed mass= " << massZ << " GeV";
154  if (massZ<massZMin_) continue;
155  if (massZ>massZMax_) continue;
156  npairs++;
157  }
158  }
159 
160  LogTrace("") << "> Number of Z pairs found= " << npairs;
161  if (npairs<1) {
162  LogTrace("") << ">>>> Event REJECTED";
163  return false;
164  }
165  LogTrace("") << ">>>> Event SELECTED!!!";
166 
167  return true;
168 
169 }
int i
Definition: DBlmapReader.cc:9
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
edm::EDGetTokenT< reco::TrackCollection > muonToken_
T sqrt(T t)
Definition: SSEVec.h:48
int j
Definition: DBlmapReader.cc:9
const int mu
Definition: Constants.h:22
bool isValid() const
Definition: HandleBase.h:75
#define LogTrace(id)
edm::EDGetTokenT< reco::TrackCollection > trackerToken_
edm::EDGetTokenT< edm::ValueMap< bool > > isoToken_
edm::EDGetTokenT< edm::ValueMap< bool > > isoTrackerToken_

Member Data Documentation

double ZToMuMuSelector::etaCut_
private

Definition at line 20 of file ZToMuMuSelector.cc.

Referenced by filter().

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

Definition at line 18 of file ZToMuMuSelector.cc.

Referenced by filter().

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

Definition at line 26 of file ZToMuMuSelector.cc.

Referenced by filter().

double ZToMuMuSelector::massZMax_
private

Definition at line 22 of file ZToMuMuSelector.cc.

Referenced by filter().

double ZToMuMuSelector::massZMin_
private

Definition at line 21 of file ZToMuMuSelector.cc.

Referenced by filter().

int ZToMuMuSelector::minTrackerHits_
private

Definition at line 27 of file ZToMuMuSelector.cc.

Referenced by filter().

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

Definition at line 17 of file ZToMuMuSelector.cc.

Referenced by filter().

bool ZToMuMuSelector::onlyGlobalMuons_
private

Definition at line 24 of file ZToMuMuSelector.cc.

Referenced by filter().

double ZToMuMuSelector::ptCut_
private

Definition at line 19 of file ZToMuMuSelector.cc.

Referenced by filter().

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

Definition at line 25 of file ZToMuMuSelector.cc.

Referenced by filter().