CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Attributes

NtpProducer< C > Class Template Reference

#include <NtpProducer.h>

Inheritance diagram for NtpProducer< C >:
edm::EDProducer edm::EDProducer edm::ProducerBase edm::ProducerBase edm::ProductRegistryHelper edm::ProductRegistryHelper

List of all members.

Public Member Functions

 NtpProducer (const edm::ParameterSet &)
 constructor from parameter set
 NtpProducer (const edm::ParameterSet &)
 constructor from parameter set
 ~NtpProducer ()
 destructor
 ~NtpProducer ()
 destructor

Protected Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &)
 process an event
virtual void produce (edm::Event &, const edm::EventSetup &)
 process an event

Private Attributes

bool eventInfo_
bool lazyParser_
std::string prefix_
edm::InputTag src_
 label of the collection to be read in
std::vector< std::pair
< std::string,
StringObjectFunction< typename
C::value_type > > > 
tags_
 variable tags

Detailed Description

template<typename C>
class NtpProducer< C >

Creates histograms defined in config file

Author:
: Luca Lista, INFN

Template parameters:

Definition at line 20 of file NtpProducer.h.


Constructor & Destructor Documentation

template<typename C >
NtpProducer< C >::NtpProducer ( const edm::ParameterSet par)

constructor from parameter set

Definition at line 42 of file NtpProducer.h.

References end, NtpProducer< C >::eventInfo_, NtpProducer< C >::lazyParser_, NtpProducer< C >::prefix_, lumiQueryAPI::q, GlobalPosition_Frontier_DevDB_cff::tag, NtpProducer< C >::tags_, and makeLayoutFileForGui::variables.

                                                        : 
  src_( par.template getParameter<edm::InputTag>( "src" ) ),
  lazyParser_( par.template getUntrackedParameter<bool>( "lazyParser", false ) ),
  prefix_( par.template getUntrackedParameter<std::string>( "prefix","" ) ),
  eventInfo_( par.template getUntrackedParameter<bool>( "eventInfo",true ) ){
  std::vector<edm::ParameterSet> variables = 
                                   par.template getParameter<std::vector<edm::ParameterSet> >("variables");
   std::vector<edm::ParameterSet>::const_iterator 
     q = variables.begin(), end = variables.end();
   if(eventInfo_){
     produces<unsigned int>( prefix_+"EventNumber" ).setBranchAlias( prefix_ + "EventNumber" );
     produces<unsigned int>( prefix_ + "RunNumber" ).setBranchAlias( prefix_ + "RunNumber" );
     produces<unsigned int>( prefix_ + "LumiBlock" ).setBranchAlias( prefix_ + "Lumiblock" );
   }
   for (; q!=end; ++q) {
     std::string tag = prefix_ + q->getUntrackedParameter<std::string>("tag");
     StringObjectFunction<typename C::value_type> quantity(q->getUntrackedParameter<std::string>("quantity"), lazyParser_);
     tags_.push_back(std::make_pair(tag, quantity));
     produces<std::vector<float> >(tag).setBranchAlias(tag);
     
   }   
}
template<typename C >
NtpProducer< C >::~NtpProducer ( )

destructor

Definition at line 66 of file NtpProducer.h.

                             {
}
template<typename C >
NtpProducer< C >::NtpProducer ( const edm::ParameterSet )

constructor from parameter set

template<typename C >
NtpProducer< C >::~NtpProducer ( )

destructor


Member Function Documentation

template<typename C >
void NtpProducer< C >::produce ( edm::Event iEvent,
const edm::EventSetup  
) [protected, virtual]

process an event

Implements edm::EDProducer.

Definition at line 70 of file NtpProducer.h.

References coll, python::HTMLExport::elem(), end, edm::EventID::event(), event(), edm::Event::getByLabel(), edm::EventBase::id(), fjr2json::lumi, edm::EventBase::luminosityBlock(), edm::Event::put(), lumiQueryAPI::q, edm::EventID::run(), DTTTrigCorrFirst::run, and x.

                                                                     {
   edm::Handle<C> coll;
   iEvent.getByLabel(src_, coll);
   if(eventInfo_){   
     std::auto_ptr<unsigned int> event( new unsigned int );
     std::auto_ptr<unsigned int> run( new unsigned int );
     std::auto_ptr<unsigned int> lumi( new unsigned int );
     *event = iEvent.id().event();
     *run = iEvent.id().run();
     *lumi = iEvent.luminosityBlock();
     iEvent.put( event, prefix_ + "EventNumber" );
     iEvent.put( run, prefix_ + "RunNumber" );
     iEvent.put( lumi, prefix_ + "LumiBlock" );
   }
   typename std::vector<std::pair<std::string, StringObjectFunction<typename C::value_type> > >::const_iterator 
     q = tags_.begin(), end = tags_.end();
   for(;q!=end; ++q) {
     std::auto_ptr<std::vector<float> > x(new std::vector<float>);
     x->reserve(coll->size());
     for (typename C::const_iterator elem=coll->begin(); elem!=coll->end(); ++elem ) {
       x->push_back(q->second(*elem));
     }
     iEvent.put(x, q->first);
   }
}
template<typename C >
virtual void NtpProducer< C >::produce ( edm::Event ,
const edm::EventSetup  
) [protected, virtual]

process an event

Implements edm::EDProducer.


Member Data Documentation

template<typename C >
bool NtpProducer< C >::eventInfo_ [private]

Definition at line 38 of file NtpProducer.h.

Referenced by NtpProducer< C >::NtpProducer().

template<typename C >
bool NtpProducer< C >::lazyParser_ [private]

Definition at line 36 of file NtpProducer.h.

Referenced by NtpProducer< C >::NtpProducer().

template<typename C >
std::string NtpProducer< C >::prefix_ [private]

Definition at line 37 of file NtpProducer.h.

Referenced by NtpProducer< C >::NtpProducer().

template<typename C >
edm::InputTag NtpProducer< C >::src_ [private]

label of the collection to be read in

Definition at line 33 of file NtpProducer.h.

template<typename C >
std::vector< std::pair< std::string, StringObjectFunction< typename C::value_type > > > NtpProducer< C >::tags_ [private]

variable tags

Definition at line 35 of file NtpProducer.h.

Referenced by NtpProducer< C >::NtpProducer().