Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:29:48

0001 // -*- C++ -*-
0002 //
0003 // Package:     HelpfulWatchers
0004 // Class  :     BeginOfTrackCounter
0005 //
0006 // Implementation:
0007 //     <Notes on implementation>
0008 //
0009 // Original Author:
0010 //         Created:  Tue Nov 29 12:26:42 EST 2005
0011 //
0012 
0013 // system include files
0014 
0015 // user include files
0016 #include "SimG4Core/HelpfulWatchers/src/BeginOfTrackCounter.h"
0017 
0018 #include "FWCore/Framework/interface/Event.h"
0019 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0020 
0021 //
0022 // constants, enums and typedefs
0023 //
0024 using namespace simwatcher;
0025 //
0026 // static data member definitions
0027 //
0028 
0029 //
0030 // constructors and destructor
0031 //
0032 BeginOfTrackCounter::BeginOfTrackCounter(const edm::ParameterSet &iPSet)
0033     : m_count(0), m_label(iPSet.getUntrackedParameter<std::string>("instanceLabel", "nBeginOfTracks")) {
0034   produces<int>(m_label);
0035 }
0036 
0037 //
0038 // member functions
0039 //
0040 
0041 void BeginOfTrackCounter::produce(edm::Event &e, const edm::EventSetup &) {
0042   std::unique_ptr<int> product(new int(m_count));
0043   e.put(std::move(product), m_label);
0044   m_count = 0;
0045 }
0046 
0047 void BeginOfTrackCounter::update(const BeginOfTrack *) { ++m_count; }