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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) 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
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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::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 18 of file HectorProducer.h.

Constructor & Destructor Documentation

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

default constructor

Definition at line 33 of file HectorProducer.cc.

References edm::hlt::Exception, edm::ParameterSet::getParameter(), hector, edm::Service< T >::isAvailable(), m_FP420Transport, m_InTag, m_verbosity, m_ZDCTransport, and AlCaHLTBitMon_QueryRunRegistry::string.

33  : eventsAnalysed(0) {
34 
35 
36  // TransportHector
37 
38  m_InTag = parameters.getParameter<std::string>("HepMCProductLabel") ;
39  m_verbosity = parameters.getParameter<bool>("Verbosity");
40  m_FP420Transport = parameters.getParameter<bool>("FP420Transport");
41  m_ZDCTransport = parameters.getParameter<bool>("ZDCTransport");
42 
43  produces<edm::HepMCProduct>();
44  produces<edm::LHCTransportLinkContainer>();
45 
46  hector = new Hector(parameters,
47  m_verbosity,
48  m_FP420Transport,
49  m_ZDCTransport);
50 
52  if ( ! rng.isAvailable() ) {
53  throw cms::Exception("Configuration")
54  << "LHCTransport (HectorProducer) requires the RandomNumberGeneratorService\n"
55  "which is not present in the configuration file. You must add the service\n"
56  "in the configuration file or remove the modules that require it.";
57  }
58 }
dictionary parameters
Definition: Parameters.py:2
std::string m_InTag
Definition: Hector.h:40
bool isAvailable() const
Definition: Service.h:46
int eventsAnalysed
just to count events that have been analysed
HectorProducer::~HectorProducer ( )
virtual

default destructor

Definition at line 60 of file HectorProducer.cc.

References eventsAnalysed, LogDebug, and m_verbosity.

60  {
61 
62  if(m_verbosity) {
63  LogDebug("HectorSetup") << "Delete HectorProducer"
64  << "Number of events analysed: " << eventsAnalysed;
65  }
66 
67 }
#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 23 of file HectorProducer.h.

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

Reimplemented from edm::EDProducer.

Definition at line 24 of file HectorProducer.h.

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

this method will do the user analysis

Implements edm::EDProducer.

Definition at line 69 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(), edm::RandomNumberGenerator::getEngine(), hector, i, LogDebug, m_FP420Transport, m_InTag, m_verbosity, m_ZDCTransport, edm::Event::put(), and edm::Event::streamID().

69  {
70 
71  using namespace edm;
72  using namespace std;
73 
75  CLHEP::HepRandomEngine* engine = &rng->getEngine(iEvent.streamID());
76  if ( engine->name() != "TRandom3" ) {
77  throw cms::Exception("Configuration")
78  << "The TRandom3 engine type must be used with HectorProducer, Random Number Generator Service not correctly configured!";
79  }
80  TRandom3* rootEngine = ( (edm::TRandomAdaptor*) engine )->getRootEngine();
81 
83 
84  Handle<HepMCProduct> HepMCEvt;
85  iEvent.getByLabel( m_InTag, HepMCEvt ) ;
86 
87  if ( !HepMCEvt.isValid() )
88  {
89  throw cms::Exception("InvalidReference")
90  << "Invalid reference to HepMCProduct\n";
91  }
92 
93  if ( HepMCEvt.provenance()->moduleLabel() == "LHCTransport" )
94  {
95  throw cms::Exception("LogicError")
96  << "HectorTrasported HepMCProduce already exists\n";
97  }
98 
99  evt_ = new HepMC::GenEvent( *HepMCEvt->GetEvent() );
101  if(m_FP420Transport) {
102  hector->clear();
103  hector->add( evt_ ,es);
104  hector->filterFP420(rootEngine);
105  }
106  if(m_ZDCTransport) {
107  hector->clear();
108  hector->add( evt_ ,es);
109  hector->filterZDC(rootEngine);
110 
111  hector->clear();
112  hector->add( evt_ ,es);
113  hector->filterD1(rootEngine);
114  }
116  if (m_verbosity) {
117  evt_->print();
118  }
119 
120  auto_ptr<HepMCProduct> NewProduct(new HepMCProduct()) ;
121  NewProduct->addHepMCData( evt_ ) ;
122 
123  iEvent.put( NewProduct ) ;
124 
125  auto_ptr<LHCTransportLinkContainer> NewCorrespondenceMap(new edm::LHCTransportLinkContainer() );
127  (*NewCorrespondenceMap).swap(thisLink);
128 
129  if ( m_verbosity ) {
130  for ( unsigned int i = 0; i < (*NewCorrespondenceMap).size(); i++)
131  LogDebug("HectorEventProcessing") << "Hector correspondence table: " << (*NewCorrespondenceMap)[i];
132  }
133 
134  iEvent.put( NewCorrespondenceMap );
135 
136 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
std::string m_InTag
void clear()
Definition: Hector.cc:142
void filterD1(TRandom3 *)
Definition: Hector.cc:386
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:115
void filterFP420(TRandom3 *)
Definition: Hector.cc:231
int eventsAnalysed
just to count events that have been analysed
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:413
void filterZDC(TRandom3 *)
Definition: Hector.cc:315
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &) const =0
Use this engine in event methods.
void add(const HepMC::GenEvent *ev, const edm::EventSetup &es)
Definition: Hector.cc:165
std::vector< LHCTransportLink > & getCorrespondenceMap()
Definition: Hector.h:72
HepMC::GenEvent * addPartToHepMC(HepMC::GenEvent *event)
Definition: Hector.cc:477
StreamID streamID() const
Definition: Event.h:74
std::vector< LHCTransportLink > LHCTransportLinkContainer
HepMC::GenEvent * evt_
void clearApertureFlags()
Definition: Hector.cc:136

Member Data Documentation

int HectorProducer::eventsAnalysed
private

just to count events that have been analysed

Definition at line 27 of file HectorProducer.h.

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

HepMC::GenEvent* HectorProducer::evt_
private

Definition at line 28 of file HectorProducer.h.

Referenced by produce().

Hector* HectorProducer::hector
private

Definition at line 29 of file HectorProducer.h.

Referenced by HectorProducer(), and produce().

bool HectorProducer::m_FP420Transport
private

Definition at line 33 of file HectorProducer.h.

Referenced by HectorProducer(), and produce().

std::string HectorProducer::m_InTag
private

Definition at line 31 of file HectorProducer.h.

Referenced by HectorProducer(), and produce().

bool HectorProducer::m_verbosity
private

Definition at line 32 of file HectorProducer.h.

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

bool HectorProducer::m_ZDCTransport
private

Definition at line 34 of file HectorProducer.h.

Referenced by HectorProducer(), and produce().