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::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 ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

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
 
typedef WorkerT< EDProducerWorkerType
 
- 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::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

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, and m_ZDCTransport.

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:85
int eventsAnalysed
just to count events that have been analysed
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
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().