ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/OSUT3Analysis/AnaTools/src/OSUObjects.cc
Revision: 1.2
Committed: Tue Aug 28 13:57:20 2012 UTC (12 years, 8 months ago) by ahart
Content type: text/plain
Branch: MAIN
CVS Tags: V02-03-02, V02-03-01, V02-03-00, V02-02-00, V02-01-01, V02-01-00, V01-01-00, V01-00-01, V01-00-00, V00-01-00, V00-00-01, mytag_0_0_0, V00-00-03, HEAD
Changes since 1.1: +7 -1 lines
Log Message:
Calculate the numbers of objects that pass each cut individually.

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