CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
HectorProducer Class Reference

#include <HectorProducer.h>

Inheritance diagram for HectorProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginJob ()
 
virtual void endJob ()
 
 HectorProducer (edm::ParameterSet const &p)
 default constructor More...
 
void produce (edm::Event &iEvent, const edm::EventSetup &es)
 this method will do the user analysis More...
 
virtual ~HectorProducer ()
 default destructor More...
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

int eventsAnalysed
 just to count events that have been analysed More...
 
HepMC::GenEvent * evt_
 
Hectorhector
 
bool m_FP420Transport
 
std::string m_InTag
 
bool m_verbosity
 
bool m_ZDCTransport
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 20 of file HectorProducer.h.

Constructor & Destructor Documentation

HectorProducer::HectorProducer ( edm::ParameterSet const &  p)

default constructor

Definition at line 24 of file HectorProducer.cc.

References edm::ParameterSet::getParameter(), hector, m_FP420Transport, m_InTag, m_verbosity, m_ZDCTransport, and AlCaHLTBitMon_QueryRunRegistry::string.

24  : eventsAnalysed(0) {
25 
26 
27  // TransportHector
28 
29  m_InTag = parameters.getParameter<std::string>("HepMCProductLabel") ;
30  m_verbosity = parameters.getParameter<bool>("Verbosity");
31  m_FP420Transport = parameters.getParameter<bool>("FP420Transport");
32  m_ZDCTransport = parameters.getParameter<bool>("ZDCTransport");
33 
34  produces<edm::HepMCProduct>();
35  produces<edm::LHCTransportLinkContainer>();
36 
37  hector = new Hector(parameters,
38  m_verbosity,
39  m_FP420Transport,
40  m_ZDCTransport);
41 
42 }
dictionary parameters
Definition: Parameters.py:2
std::string m_InTag
Definition: Hector.h:40
int eventsAnalysed
just to count events that have been analysed
HectorProducer::~HectorProducer ( )
virtual

default destructor

Definition at line 44 of file HectorProducer.cc.

References eventsAnalysed, LogDebug, and m_verbosity.

44  {
45 
46  if(m_verbosity) {
47  LogDebug("HectorSetup") << "Delete HectorProducer"
48  << "Number of events analysed: " << eventsAnalysed;
49  }
50 
51 }
#define LogDebug(id)
int eventsAnalysed
just to count events that have been analysed

Member Function Documentation

virtual void HectorProducer::beginJob ( void  )
inlinevirtual

Reimplemented from edm::EDProducer.

Definition at line 25 of file HectorProducer.h.

25 {}
virtual void HectorProducer::endJob ( void  )
inlinevirtual

Reimplemented from edm::EDProducer.

Definition at line 26 of file HectorProducer.h.

26 {}
void HectorProducer::produce ( edm::Event iEvent,
const edm::EventSetup es 
)
virtual

this method will do the user analysis

Implements edm::EDProducer.

Definition at line 53 of file HectorProducer.cc.

References Hector::add(), Hector::addPartToHepMC(), Hector::clear(), Hector::clearApertureFlags(), eventsAnalysed, evt_, edm::hlt::Exception, Hector::filterD1(), Hector::filterFP420(), Hector::filterZDC(), edm::Event::getByLabel(), Hector::getCorrespondenceMap(), hector, i, LogDebug, m_FP420Transport, m_InTag, m_verbosity, m_ZDCTransport, and edm::Event::put().

53  {
54 
55  using namespace edm;
56  using namespace std;
57 
59 
60  Handle<HepMCProduct> HepMCEvt;
61  iEvent.getByLabel( m_InTag, HepMCEvt ) ;
62 
63  if ( !HepMCEvt.isValid() )
64  {
65  throw cms::Exception("InvalidReference")
66  << "Invalid reference to HepMCProduct\n";
67  }
68 
69  if ( HepMCEvt.provenance()->moduleLabel() == "LHCTransport" )
70  {
71  throw cms::Exception("LogicError")
72  << "HectorTrasported HepMCProduce already exists\n";
73  }
74 
75  evt_ = new HepMC::GenEvent( *HepMCEvt->GetEvent() );
77  if(m_FP420Transport) {
78  hector->clear();
79  hector->add( evt_ ,es);
81  }
82  if(m_ZDCTransport) {
83  hector->clear();
84  hector->add( evt_ ,es);
85  hector->filterZDC();
86 
87  hector->clear();
88  hector->add( evt_ ,es);
89  hector->filterD1();
90  }
92  if (m_verbosity) {
93  evt_->print();
94  }
95 
96  auto_ptr<HepMCProduct> NewProduct(new HepMCProduct()) ;
97  NewProduct->addHepMCData( evt_ ) ;
98 
99  iEvent.put( NewProduct ) ;
100 
101  auto_ptr<LHCTransportLinkContainer> NewCorrespondenceMap(new edm::LHCTransportLinkContainer() );
103  (*NewCorrespondenceMap).swap(thisLink);
104 
105  if ( m_verbosity ) {
106  for ( unsigned int i = 0; i < (*NewCorrespondenceMap).size(); i++)
107  LogDebug("HectorEventProcessing") << "Hector correspondence table: " << (*NewCorrespondenceMap)[i];
108  }
109 
110  iEvent.put( NewCorrespondenceMap );
111 
112 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
std::string m_InTag
void filterFP420()
Definition: Hector.cc:249
void clear()
Definition: Hector.cc:160
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
int eventsAnalysed
just to count events that have been analysed
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
void add(const HepMC::GenEvent *ev, const edm::EventSetup &es)
Definition: Hector.cc:183
std::vector< LHCTransportLink > & getCorrespondenceMap()
Definition: Hector.h:72
HepMC::GenEvent * addPartToHepMC(HepMC::GenEvent *event)
Definition: Hector.cc:495
std::vector< LHCTransportLink > LHCTransportLinkContainer
HepMC::GenEvent * evt_
void filterD1()
Definition: Hector.cc:404
void filterZDC()
Definition: Hector.cc:333
void clearApertureFlags()
Definition: Hector.cc:154

Member Data Documentation

int HectorProducer::eventsAnalysed
private

just to count events that have been analysed

Definition at line 29 of file HectorProducer.h.

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

HepMC::GenEvent* HectorProducer::evt_
private

Definition at line 30 of file HectorProducer.h.

Referenced by produce().

Hector* HectorProducer::hector
private

Definition at line 31 of file HectorProducer.h.

Referenced by HectorProducer(), and produce().

bool HectorProducer::m_FP420Transport
private

Definition at line 35 of file HectorProducer.h.

Referenced by HectorProducer(), and produce().

std::string HectorProducer::m_InTag
private

Definition at line 33 of file HectorProducer.h.

Referenced by HectorProducer(), and produce().

bool HectorProducer::m_verbosity
private

Definition at line 34 of file HectorProducer.h.

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

bool HectorProducer::m_ZDCTransport
private

Definition at line 36 of file HectorProducer.h.

Referenced by HectorProducer(), and produce().