CMS 3D CMS Logo

CompositeKit Class Reference

CompositeKit is a plotting kit to plot a collection of CompositeCandidates. More...

#include <PhysicsTools/StarterKit/test/CompositeKit.cc>

Inheritance diagram for CompositeKit:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 CompositeKit (const edm::ParameterSet &)
virtual ~CompositeKit ()

Protected Member Functions

virtual void beginJob (const edm::EventSetup &)
virtual void endJob ()
virtual void produce (edm::Event &, const edm::EventSetup &)

Protected Attributes

edm::Handle< std::vector
< reco::CompositeCandidate > > 
compositeCandHandle_
pat::HistoCompositecompositeCandHist_
std::vector< pat::PhysVarHisto * > compositeNtVars_
std::string description_
edm::Handle< std::vector
< pat::Electron > > 
electronHandle_
pat::PatKitHelper helper_
edm::Handle< std::vector
< pat::Jet > > 
jetHandle_
edm::Handle< std::vector
< pat::MET > > 
METHandle_
edm::Handle< std::vector
< pat::Muon > > 
muonHandle_
edm::Handle< std::vector
< pat::Photon > > 
photonHandle_
edm::InputTag src_
edm::Handle< std::vector
< pat::Tau > > 
tauHandle_
bool verboseLevel_


Detailed Description

CompositeKit is a plotting kit to plot a collection of CompositeCandidates.

Definition at line 45 of file CompositeKit.h.


Constructor & Destructor Documentation

CompositeKit::CompositeKit ( const edm::ParameterSet iConfig  )  [explicit]

Definition at line 11 of file CompositeKit.cc.

References pat::PatKitHelper::bookHistos(), compositeCandHist_, description_, pat::PatKitHelper::getAxisLimits(), helper_, edm::InputTag::label(), PhysicsHistograms::KinAxisLimits::m1, m1, PhysicsHistograms::KinAxisLimits::m2, PhysicsHistograms::KinAxisLimits::pt1, PhysicsHistograms::KinAxisLimits::pt2, src_, and verboseLevel_.

00012   :
00013   src_              ( iConfig.getParameter<edm::InputTag> ("src") ),
00014   description_      ( iConfig.getParameter<std::string>   ("description") ),
00015   helper_           ( iConfig )
00016 {
00017 
00018   verboseLevel_ = 0;
00019 
00020 
00021   // First book standard histograms
00022   helper_.bookHistos(this);
00023 
00024   PhysicsHistograms::KinAxisLimits compositeAxisLimits;
00025 
00026   compositeAxisLimits = helper_.getAxisLimits("compositeAxis");
00027 
00028   double pt1 = compositeAxisLimits.pt1;
00029   double pt2 = compositeAxisLimits.pt2;
00030   double m1  = compositeAxisLimits.m1;
00031   double m2  = compositeAxisLimits.m2;
00032 
00033   // Now book composite histograms
00034   compositeCandHist_ = new pat::HistoComposite(src_.label(), 
00035                                                description_,
00036                                                src_.label(),
00037                                                pt1,pt2,m1,m2 );
00038 
00039 
00040 }

CompositeKit::~CompositeKit (  )  [virtual]

Definition at line 43 of file CompositeKit.cc.

References compositeCandHist_.

00044 {
00045   // clean up
00046   if ( compositeCandHist_ ) delete compositeCandHist_;
00047 }


Member Function Documentation

void CompositeKit::beginJob ( const edm::EventSetup iSetup  )  [protected, virtual]

Reimplemented from edm::EDProducer.

Definition at line 121 of file CompositeKit.cc.

00122 {
00123 }

void CompositeKit::endJob ( void   )  [protected, virtual]

Reimplemented from edm::EDProducer.

Definition at line 129 of file CompositeKit.cc.

00129                      {
00130 }

void CompositeKit::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [protected, virtual]

Implements edm::EDProducer.

Definition at line 55 of file CompositeKit.cc.

References compositeCandHandle_, compositeCandHist_, GenMuonPlsPt100GeV_cfg::cout, electronHandle_, lat::endl(), pat::HistoComposite::fill(), pat::PatKitHelper::fillHistograms(), edm::Event::getByLabel(), pat::PatKitHelper::getHandles(), helper_, i, jetHandle_, METHandle_, muonHandle_, photonHandle_, src_, std, tauHandle_, and verboseLevel_.

00056 {
00057   using namespace edm;
00058   using namespace std;
00059 
00060   // --------------------------------------------------
00061   //    Step 1: Retrieve objects from data stream
00062   // --------------------------------------------------
00063   helper_.getHandles( iEvent,
00064                       muonHandle_,
00065                       electronHandle_,
00066                       tauHandle_,
00067                       jetHandle_,
00068                       METHandle_,
00069                       photonHandle_);
00070 
00071   // --------------------------------------------------
00072   //    Step 2: invoke PhysicsHistograms to deal with all this.
00073   //
00074   //    Note that each handle will dereference into a vector<>,
00075   //    however the fillCollection() method takes a reference,
00076   //    so the collections are not copied...
00077   // --------------------------------------------------
00078 
00079   if ( verboseLevel_ > 10 )
00080     std::cout << "PatAnalyzerKit::analyze: calling fillCollection()." << std::endl;
00081   helper_.fillHistograms( iEvent,
00082                           muonHandle_,
00083                           electronHandle_,
00084                           tauHandle_,
00085                           jetHandle_,
00086                           METHandle_,
00087                           photonHandle_);
00088 
00089 
00090   // BEGIN YOUR CODE HERE
00091 
00092   // --------------------------------------------------
00093   //    Step 3: Plot some composite objects
00094   // --------------------------------------------------
00095 
00096   // Get the composite candidates from upstream
00097   iEvent.getByLabel(src_,   compositeCandHandle_ );
00098 
00099   if ( compositeCandHandle_->size() > 0 ) {
00100 
00101     // Get the vector of masses... when expression histograms come along, this 
00102     // will disappear
00103     vector<double> compositeCandMassVector;
00104 
00105     // Loop over the composite candidates
00106     vector<reco::CompositeCandidate>::const_iterator i = compositeCandHandle_->begin(),
00107       iend = compositeCandHandle_->end();
00108     for ( ; i != iend; ++i ) {
00109       compositeCandHist_->fill( *i );
00110     }
00111     
00112     // Save the ntuple variables... in this case just the mass
00113 //     saveNtuple( compositeNtVars_, iEvent );
00114 
00115   }
00116 }


Member Data Documentation

edm::Handle<std::vector<reco::CompositeCandidate> > CompositeKit::compositeCandHandle_ [protected]

Definition at line 80 of file CompositeKit.h.

Referenced by produce().

pat::HistoComposite* CompositeKit::compositeCandHist_ [protected]

Definition at line 84 of file CompositeKit.h.

Referenced by CompositeKit(), produce(), and ~CompositeKit().

std::vector<pat::PhysVarHisto *> CompositeKit::compositeNtVars_ [protected]

Definition at line 88 of file CompositeKit.h.

std::string CompositeKit::description_ [protected]

Definition at line 64 of file CompositeKit.h.

Referenced by CompositeKit().

edm::Handle<std::vector<pat::Electron> > CompositeKit::electronHandle_ [protected]

Definition at line 73 of file CompositeKit.h.

Referenced by produce().

pat::PatKitHelper CompositeKit::helper_ [protected]

Definition at line 67 of file CompositeKit.h.

Referenced by CompositeKit(), and produce().

edm::Handle<std::vector<pat::Jet> > CompositeKit::jetHandle_ [protected]

Definition at line 75 of file CompositeKit.h.

Referenced by produce().

edm::Handle<std::vector<pat::MET> > CompositeKit::METHandle_ [protected]

Definition at line 76 of file CompositeKit.h.

Referenced by produce().

edm::Handle<std::vector<pat::Muon> > CompositeKit::muonHandle_ [protected]

Definition at line 72 of file CompositeKit.h.

Referenced by produce().

edm::Handle<std::vector<pat::Photon> > CompositeKit::photonHandle_ [protected]

Definition at line 77 of file CompositeKit.h.

Referenced by produce().

edm::InputTag CompositeKit::src_ [protected]

Definition at line 61 of file CompositeKit.h.

Referenced by CompositeKit(), and produce().

edm::Handle<std::vector<pat::Tau> > CompositeKit::tauHandle_ [protected]

Definition at line 74 of file CompositeKit.h.

Referenced by produce().

bool CompositeKit::verboseLevel_ [protected]

Definition at line 58 of file CompositeKit.h.

Referenced by CompositeKit(), and produce().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:16:37 2009 for CMSSW by  doxygen 1.5.4