ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/OSUT3Analysis/AnaTools/src/OSUObjects.cc
Revision: 1.1
Committed: Mon Aug 27 18:20:54 2012 UTC (12 years, 8 months ago) by ahart
Content type: text/plain
Branch: MAIN
Log Message:
First commit of OSUObjects.cc.

File Contents

# User Rev Content
1 ahart 1.1 #include "OSUT3Analysis/AnaTools/interface/OSUObjects.h"
2    
3     GoodMuonCollection::GoodMuonCollection (const edm::ParameterSet &cfg, const edm::Handle<BNmuonCollection> &muons, CutFlow *cuts) :
4     leadP4_ (TLorentzVector (0.0, 0.0, 0.0, 0.0)),
5     nextToLeadP4_ (TLorentzVector (0.0, 0.0, 0.0, 0.0)),
6     goodSize_ (0)
7     {
8     this->reserve (muons->size ());
9     leadMuon_ = this->end ();
10     nextToLeadMuon_ = this->end ();
11     for (BNmuonCollection::const_iterator muon = muons->begin (); muon != muons->end (); muon++)
12     {
13     this->push_back (GoodMuon (cfg, *muon, cuts));
14     if (this->back ().pass ())
15     {
16     goodSize_++;
17     if (this->back ().pt > this->leadP4 ().Pt ())
18     {
19     leadMuon_ = this->end () - 1;
20     leadP4_.SetPxPyPzE (this->back ().px, this->back ().py, this->back ().pz, this->back ().energy);
21     }
22     else if (this->back ().pt > this->nextToLeadP4 ().Pt ())
23     {
24     nextToLeadMuon_ = this->end () - 1;
25     nextToLeadP4_.SetPxPyPzE (this->back ().px, this->back ().py, this->back ().pz, this->back ().energy);
26     }
27     }
28     }
29     }
30    
31     GoodMuonCollection::~GoodMuonCollection ()
32     {
33     }
34    
35     GoodMuon::GoodMuon (const edm::ParameterSet &cfg, const BNmuon &muon, CutFlow *cuts) :
36     BNmuon (muon),
37     maxEta_ (cfg.getParameter<double> ("maxEta")),
38     minPt_ (cfg.getParameter<double> ("minPt")),
39     p4_ (TLorentzVector (muon.px, muon.py, muon.pz, muon.energy))
40     {
41     cuts_["maxEta"] = cuts->at ("maxEta") = fabs (muon.eta) < maxEta_;
42     cuts_["minPt"] = cuts->at ("minPt") = muon.pt > minPt_;
43     cuts->fillCutFlow ();
44     }
45    
46     GoodMuon::~GoodMuon ()
47     {
48     }
49    
50     const bool
51     GoodMuon::pass () const
52     {
53     for (map<string, bool>::const_iterator cut = cuts_.begin (); cut != cuts_.end (); cut++)
54     {
55     if (!cut->second)
56     return false;
57     }
58     return true;
59     }