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 &)
 
 ZToMuMuSelector (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
virtual ~EDFilter ()
 
- Public Member Functions inherited from edm::ProducerBase
 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
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

double etaCut_
 
edm::InputTag isoTag_
 
edm::InputTag isoTrackerTag_
 
double massZMax_
 
double massZMin_
 
int minTrackerHits_
 
edm::InputTag muonTag_
 
bool onlyGlobalMuons_
 
double ptCut_
 
edm::InputTag trackerTag_
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
typedef WorkerT< EDFilterWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- 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::EDFilter
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 9 of file ZToMuMuSelector.cc.

Constructor & Destructor Documentation

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

Definition at line 39 of file ZToMuMuSelector.cc.

39  :
40  muonTag_(cfg.getParameter<edm::InputTag> ("MuonTag")),
41  isoTag_(cfg.getParameter<edm::InputTag> ("IsolationTag")),
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  trackerTag_(cfg.getUntrackedParameter<edm::InputTag> ("TrackerTag",edm::InputTag("ctfWithMaterialTracks"))),
49  isoTrackerTag_(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::InputTag isoTag_
edm::InputTag trackerTag_
edm::InputTag muonTag_
edm::InputTag isoTrackerTag_

Member Function Documentation

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

Implements edm::EDFilter.

Definition at line 54 of file ZToMuMuSelector.cc.

References eta(), etaCut_, edm::Event::getByLabel(), i, isoTag_, isoTrackerTag_, edm::HandleBase::isValid(), j, LogTrace, massZMax_, massZMin_, minTrackerHits_, RPCpg::mu, muonTag_, onlyGlobalMuons_, ptCut_, mathSSE::sqrt(), and trackerTag_.

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  // Note: try/catch sequences should disappear in the future
57  // GetByLabel will return a false bool value
58  // if the collection is not present
59 
60  Handle<TrackCollection> muonCollection;
61 
62  ev.getByLabel(muonTag_, muonCollection);
63  if (!muonCollection.isValid()) {
64  LogTrace("") << ">>> Muon collection does not exist !!!";
65  return false;
66  }
67 
69  ev.getByLabel(isoTag_, isoMap);
70  if (!isoMap.isValid()) {
71  LogTrace("") << ">>> ISO Muon collection does not exist !!!";
72  return false;
73  }
74 
75  Handle<TrackCollection> trackerCollection;
76  Handle<edm::ValueMap<bool> > isoTrackerMap;
77  if (!onlyGlobalMuons_) {
78  ev.getByLabel(trackerTag_, trackerCollection);
79  if (!trackerCollection.isValid()) {
80  LogTrace("") << ">>> Tracker collection does not exist !!!";
81  return false;
82  }
83 
84  ev.getByLabel(isoTrackerTag_, isoTrackerMap);
85  if (!isoTrackerMap.isValid()) {
86  LogTrace("") << ">>> ISO Tracker collection does not exist !!!";
87  return false;
88  }
89  }
90 
91  unsigned int npairs = 0;
92  bool globalCombinationFound = false;
93  for (unsigned int i=0; i<muonCollection->size(); i++) {
94  TrackRef mu(muonCollection,i);
95  LogTrace("") << "> Processing muon number " << i << "...";
96  double pt = mu->pt();
97  LogTrace("") << "\t... pt= " << pt << " GeV";
98  if (pt<ptCut_) continue;
99  double eta = mu->eta();
100  LogTrace("") << "\t... eta= " << eta;
101  if (fabs(eta)>etaCut_) continue;
102  bool iso = (*isoMap)[mu];
103  LogTrace("") << "\t... isolated? " << iso;
104  if (!iso) continue;
105 
106  for (unsigned int j=i+1; j<muonCollection->size(); j++) {
107  TrackRef mu2(muonCollection,j);
108  LogTrace("") << "> Processing second muon number " << j << "...";
109  double pt2 = mu2->pt();
110  LogTrace("") << "\t... pt2= " << pt2 << " GeV";
111  if (pt2<ptCut_) continue;
112  double eta2 = mu2->eta();
113  LogTrace("") << "\t... eta2= " << eta2;
114  if (fabs(eta2)>etaCut_) continue;
115  bool iso2 = (*isoMap)[mu2];
116  LogTrace("") << "\t... isolated2? " << iso2;
117  if (!iso2) continue;
118 
119  double z_en = mu->p() + mu2->p();
120  double z_px = mu->px() + mu2->px();
121  double z_py = mu->py() + mu2->py();
122  double z_pz = mu->pz() + mu2->pz();
123  double massZ = z_en*z_en - z_px*z_px - z_py*z_py - z_pz*z_pz;
124  massZ = (massZ>0) ? sqrt(massZ) : 0;
125  LogTrace("") << "\t... Z_en, Z_px, Z_py, Z_pz= " << z_en << ", " << z_px << ", " << z_py << ", " << z_pz << " GeV";
126  LogTrace("") << "\t... (GM-GM) Invariant reconstructed mass= " << massZ << " GeV";
127  if (massZ<massZMin_) continue;
128  if (massZ>massZMax_) continue;
129  globalCombinationFound = true;
130  npairs++;
131  }
132 
133  if (onlyGlobalMuons_ || globalCombinationFound) continue;
134 
135  for (unsigned int j=0; j<trackerCollection->size(); j++) {
136  TrackRef mu2(trackerCollection,j);
137  LogTrace("") << "> Processing track number " << j << "...";
138  double pt2 = mu2->pt();
139  LogTrace("") << "\t... pt3= " << pt2 << " GeV";
140  if (pt2<ptCut_) continue;
141  double eta2 = mu2->eta();
142  LogTrace("") << "\t... eta3= " << eta2;
143  if (fabs(eta2)>etaCut_) continue;
144  int nhits2 = mu2->numberOfValidHits();
145  LogTrace("") << "\t... nhits3= " << nhits2;
146  if (nhits2<minTrackerHits_) continue;
147  bool iso2 = (*isoTrackerMap)[mu2];
148  LogTrace("") << "\t... isolated3? " << iso2;
149  if (!iso2) continue;
150 
151  double z_en = mu->p() + mu2->p();
152  double z_px = mu->px() + mu2->px();
153  double z_py = mu->py() + mu2->py();
154  double z_pz = mu->pz() + mu2->pz();
155  double massZ = z_en*z_en - z_px*z_px - z_py*z_py - z_pz*z_pz;
156  massZ = (massZ>0) ? sqrt(massZ) : 0;
157  LogTrace("") << "\t... Z_en, Z_px, Z_py, Z_pz= " << z_en << ", " << z_px << ", " << z_py << ", " << z_pz << " GeV";
158  LogTrace("") << "\t... (GM-TK) Invariant reconstructed mass= " << massZ << " GeV";
159  if (massZ<massZMin_) continue;
160  if (massZ>massZMax_) continue;
161  npairs++;
162  }
163  }
164 
165  LogTrace("") << "> Number of Z pairs found= " << npairs;
166  if (npairs<1) {
167  LogTrace("") << ">>>> Event REJECTED";
168  return false;
169  }
170  LogTrace("") << ">>>> Event SELECTED!!!";
171 
172  return true;
173 
174 }
int i
Definition: DBlmapReader.cc:9
T eta() const
edm::InputTag isoTag_
T sqrt(T t)
Definition: SSEVec.h:48
int j
Definition: DBlmapReader.cc:9
const int mu
Definition: Constants.h:23
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
#define LogTrace(id)
edm::InputTag trackerTag_
edm::InputTag muonTag_
edm::InputTag isoTrackerTag_

Member Data Documentation

double ZToMuMuSelector::etaCut_
private

Definition at line 17 of file ZToMuMuSelector.cc.

Referenced by filter().

edm::InputTag ZToMuMuSelector::isoTag_
private

Definition at line 15 of file ZToMuMuSelector.cc.

Referenced by filter().

edm::InputTag ZToMuMuSelector::isoTrackerTag_
private

Definition at line 23 of file ZToMuMuSelector.cc.

Referenced by filter().

double ZToMuMuSelector::massZMax_
private

Definition at line 19 of file ZToMuMuSelector.cc.

Referenced by filter().

double ZToMuMuSelector::massZMin_
private

Definition at line 18 of file ZToMuMuSelector.cc.

Referenced by filter().

int ZToMuMuSelector::minTrackerHits_
private

Definition at line 24 of file ZToMuMuSelector.cc.

Referenced by filter().

edm::InputTag ZToMuMuSelector::muonTag_
private

Definition at line 14 of file ZToMuMuSelector.cc.

Referenced by filter().

bool ZToMuMuSelector::onlyGlobalMuons_
private

Definition at line 21 of file ZToMuMuSelector.cc.

Referenced by filter().

double ZToMuMuSelector::ptCut_
private

Definition at line 16 of file ZToMuMuSelector.cc.

Referenced by filter().

edm::InputTag ZToMuMuSelector::trackerTag_
private

Definition at line 22 of file ZToMuMuSelector.cc.

Referenced by filter().