CMS 3D CMS Logo

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

#include <OscarProducer.h>

Inheritance diagram for OscarProducer:
edm::one::EDProducer< edm::one::SharedResources, edm::one::WatchRuns > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

typedef std::vector
< boost::shared_ptr
< SimProducer > > 
Producers
 
- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 

Public Member Functions

virtual void beginRun (const edm::Run &r, const edm::EventSetup &c) override
 
virtual void endRun (const edm::Run &r, const edm::EventSetup &c) override
 
 OscarProducer (edm::ParameterSet const &p)
 
virtual void produce (edm::Event &e, const edm::EventSetup &c) override
 
virtual ~OscarProducer ()
 
- Public Member Functions inherited from edm::one::EDProducer< edm::one::SharedResources, edm::one::WatchRuns >
 EDProducer ()=default
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- 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

Producers m_producers
 
std::unique_ptr< RunManagerm_runManager
 
std::unique_ptr< CustomUIsessionm_UIsession
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::one::EDProducerBase
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 17 of file OscarProducer.h.

Member Typedef Documentation

typedef std::vector<boost::shared_ptr<SimProducer> > OscarProducer::Producers

Definition at line 20 of file OscarProducer.h.

Constructor & Destructor Documentation

OscarProducer::OscarProducer ( edm::ParameterSet const &  p)
explicit

Definition at line 55 of file OscarProducer.cc.

References edm::SharedResourceNames::kCLHEPRandomEngine, edm::SharedResourceNames::kGEANT, m_producers, m_runManager, m_UIsession, and random.

56 {
57  // Random number generation not allowed here
58  StaticRandomEngineSetUnset random(nullptr);
59 
62 
63  produces<edm::SimTrackContainer>().setBranchAlias("SimTracks");
64  produces<edm::SimVertexContainer>().setBranchAlias("SimVertices");
65  produces<edm::PSimHitContainer>("TrackerHitsPixelBarrelLowTof");
66  produces<edm::PSimHitContainer>("TrackerHitsPixelBarrelHighTof");
67  produces<edm::PSimHitContainer>("TrackerHitsTIBLowTof");
68  produces<edm::PSimHitContainer>("TrackerHitsTIBHighTof");
69  produces<edm::PSimHitContainer>("TrackerHitsTIDLowTof");
70  produces<edm::PSimHitContainer>("TrackerHitsTIDHighTof");
71  produces<edm::PSimHitContainer>("TrackerHitsPixelEndcapLowTof");
72  produces<edm::PSimHitContainer>("TrackerHitsPixelEndcapHighTof");
73  produces<edm::PSimHitContainer>("TrackerHitsTOBLowTof");
74  produces<edm::PSimHitContainer>("TrackerHitsTOBHighTof");
75  produces<edm::PSimHitContainer>("TrackerHitsTECLowTof");
76  produces<edm::PSimHitContainer>("TrackerHitsTECHighTof");
77 
78  produces<edm::PSimHitContainer>("TotemHitsT1");
79  produces<edm::PSimHitContainer>("TotemHitsT2Gem");
80  produces<edm::PSimHitContainer>("TotemHitsRP");
81  produces<edm::PSimHitContainer>("FP420SI");
82  produces<edm::PSimHitContainer>("BSCHits");
83  produces<edm::PSimHitContainer>("PLTHits");
84 
85  produces<edm::PCaloHitContainer>("EcalHitsEB");
86  produces<edm::PCaloHitContainer>("EcalHitsEE");
87  produces<edm::PCaloHitContainer>("EcalHitsES");
88  produces<edm::PCaloHitContainer>("HcalHits");
89  produces<edm::PCaloHitContainer>("CaloHitsTk");
90  produces<edm::PSimHitContainer>("MuonDTHits");
91  produces<edm::PSimHitContainer>("MuonCSCHits");
92  produces<edm::PSimHitContainer>("MuonRPCHits");
93  produces<edm::PSimHitContainer>("MuonGEMHits");
94  produces<edm::PCaloHitContainer>("CastorPL");
95  produces<edm::PCaloHitContainer>("CastorFI");
96  produces<edm::PCaloHitContainer>("CastorBU");
97  produces<edm::PCaloHitContainer>("CastorTU");
98  produces<edm::PCaloHitContainer>("EcalTBH4BeamHits");
99  produces<edm::PCaloHitContainer>("HcalTB06BeamHits");
100  produces<edm::PCaloHitContainer>("ZDCHITS");
101  produces<edm::PCaloHitContainer>("ChamberHits");
102  produces<edm::PCaloHitContainer>("FibreHits");
103  produces<edm::PCaloHitContainer>("WedgeHits");
104 
105  //m_runManager = RunManager::init(p);
106  m_runManager.reset(new RunManager(p));
107 
108  //register any products
109  m_producers= m_runManager->producers();
110 
111  for(Producers::iterator itProd = m_producers.begin();
112  itProd != m_producers.end();
113  ++itProd) {
114  (*itProd)->registerProducts(*this);
115  }
116 
117  //UIsession manager for message handling
118  m_UIsession.reset(new CustomUIsession());
119 
120 }
Producers m_producers
Definition: OscarProducer.h:29
std::unique_ptr< RunManager > m_runManager
Definition: OscarProducer.h:28
TRandom random
Definition: MVATrainer.cc:138
static const std::string kGEANT
static const std::string kCLHEPRandomEngine
std::unique_ptr< CustomUIsession > m_UIsession
Definition: OscarProducer.h:30
OscarProducer::~OscarProducer ( )
virtual

Definition at line 122 of file OscarProducer.cc.

123 { }

Member Function Documentation

void OscarProducer::beginRun ( const edm::Run r,
const edm::EventSetup c 
)
overridevirtual

Definition at line 125 of file OscarProducer.cc.

References m_runManager, and random.

126 {
127  // Random number generation not allowed here
128  StaticRandomEngineSetUnset random(nullptr);
129  m_runManager->initG4(es);
130 }
std::unique_ptr< RunManager > m_runManager
Definition: OscarProducer.h:28
TRandom random
Definition: MVATrainer.cc:138
virtual void OscarProducer::endRun ( const edm::Run r,
const edm::EventSetup c 
)
inlineoverridevirtual

Definition at line 25 of file OscarProducer.h.

25 { }
void OscarProducer::produce ( edm::Event e,
const edm::EventSetup c 
)
overridevirtual

Implements edm::one::EDProducerBase.

Definition at line 132 of file OscarProducer.cc.

References edm::errors::EventCorruption, edm::hlt::Exception, recoMuon::in, G4SimEvent::load(), m_producers, m_runManager, p1, p2, edm::Event::put(), random, edm::Event::streamID(), findQualityFiles::v, and SimG4Exception::what().

133 {
134  StaticRandomEngineSetUnset random(e.streamID());
135 
136  std::vector<SensitiveTkDetector*>& sTk = m_runManager->sensTkDetectors();
137  std::vector<SensitiveCaloDetector*>& sCalo = m_runManager->sensCaloDetectors();
138 
139  try
140  {
141  m_runManager->produce(e,es);
142 
143  std::auto_ptr<edm::SimTrackContainer> p1(new edm::SimTrackContainer);
144  std::auto_ptr<edm::SimVertexContainer> p2(new edm::SimVertexContainer);
145  G4SimEvent * evt = m_runManager->simEvent();
146  evt->load(*p1);
147  evt->load(*p2);
148 
149  e.put(p1);
150  e.put(p2);
151 
152  for (std::vector<SensitiveTkDetector*>::iterator it = sTk.begin(); it != sTk.end(); it++)
153  {
154  std::vector<std::string> v = (*it)->getNames();
155  for (std::vector<std::string>::iterator in = v.begin(); in!= v.end(); in++)
156  {
157  std::auto_ptr<edm::PSimHitContainer> product(new edm::PSimHitContainer);
158  (*it)->fillHits(*product,*in);
159  e.put(product,*in);
160  }
161  }
162  for (std::vector<SensitiveCaloDetector*>::iterator it = sCalo.begin(); it != sCalo.end(); it++)
163  {
164  std::vector<std::string> v = (*it)->getNames();
165  for (std::vector<std::string>::iterator in = v.begin(); in!= v.end(); in++)
166  {
167  std::auto_ptr<edm::PCaloHitContainer> product(new edm::PCaloHitContainer);
168  (*it)->fillHits(*product,*in);
169  e.put(product,*in);
170  }
171  }
172 
173  for(Producers::iterator itProd = m_producers.begin();
174  itProd != m_producers.end();
175  ++itProd) {
176  (*itProd)->produce(e,es);
177  }
178  }
179  catch ( const SimG4Exception& simg4ex )
180  {
181 
182  edm::LogInfo("SimG4CoreApplication") << " SimG4Exception caght !" << simg4ex.what() << std::endl ;
183 
184  m_runManager->abortEvent() ;
186  }
187 }
Producers m_producers
Definition: OscarProducer.h:29
std::unique_ptr< RunManager > m_runManager
Definition: OscarProducer.h:28
std::vector< PCaloHit > PCaloHitContainer
TRandom random
Definition: MVATrainer.cc:138
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
virtual const char * what() const
double p2[4]
Definition: TauolaWrapper.h:90
void load(edm::SimTrackContainer &c) const
Definition: G4SimEvent.cc:55
std::vector< SimVertex > SimVertexContainer
double p1[4]
Definition: TauolaWrapper.h:89
StreamID streamID() const
Definition: Event.h:75
std::vector< PSimHit > PSimHitContainer
std::vector< SimTrack > SimTrackContainer

Member Data Documentation

Producers OscarProducer::m_producers
private

Definition at line 29 of file OscarProducer.h.

Referenced by OscarProducer(), and produce().

std::unique_ptr<RunManager> OscarProducer::m_runManager
private

Definition at line 28 of file OscarProducer.h.

Referenced by beginRun(), OscarProducer(), and produce().

std::unique_ptr<CustomUIsession> OscarProducer::m_UIsession
private

Definition at line 30 of file OscarProducer.h.

Referenced by OscarProducer().