CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
FamosProducer Class Reference

#include <FamosProducer.h>

Inheritance diagram for FamosProducer:
edm::stream::EDProducer<>

Public Member Functions

void beginRun (edm::Run const &run, const edm::EventSetup &es) override
 
 FamosProducer (edm::ParameterSet const &p)
 
void produce (edm::Event &e, const edm::EventSetup &c) override
 
 ~FamosProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Private Attributes

HepMC::GenEvent * evt_
 
FamosManagerfamosManager_
 
bool simulateMuons
 
edm::EDGetTokenT< edm::HepMCProductsourceToken
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Definition at line 17 of file FamosProducer.h.

Constructor & Destructor Documentation

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

Definition at line 32 of file FamosProducer.cc.

References famosManager_, edm::ParameterSet::getParameter(), simulateMuons, and sourceToken.

33 {
34 
35  produces<edm::SimTrackContainer>();
36  produces<edm::SimVertexContainer>();
37  produces<FSimVertexTypeCollection>("VertexTypes");
38  produces<edm::PSimHitContainer>("TrackerHits");
39  produces<edm::PCaloHitContainer>("EcalHitsEB");
40  produces<edm::PCaloHitContainer>("EcalHitsEE");
41  produces<edm::PCaloHitContainer>("EcalHitsES");
42  produces<edm::PCaloHitContainer>("HcalHits");
43  // Temporary facility to allow for the crossing frame to work...
44  simulateMuons = p.getParameter<bool>("SimulateMuons");
45  if ( simulateMuons ) produces<edm::SimTrackContainer>("MuonSimTracks");
46 
47  // hepmc event from signal event
48  edm::InputTag sourceLabel = p.getParameter<edm::InputTag>("SourceLabel");
49  sourceToken = consumes<edm::HepMCProduct>(sourceLabel);
50 
51  // famos manager
53 }
FamosManager * famosManager_
Definition: FamosProducer.h:29
edm::EDGetTokenT< edm::HepMCProduct > sourceToken
Definition: FamosProducer.h:35
FamosProducer::~FamosProducer ( )
override

Definition at line 55 of file FamosProducer.cc.

References famosManager_.

56 { delete famosManager_; }
FamosManager * famosManager_
Definition: FamosProducer.h:29

Member Function Documentation

void FamosProducer::beginRun ( edm::Run const &  run,
const edm::EventSetup es 
)
override

Definition at line 59 of file FamosProducer.cc.

References famosManager_, and FamosManager::setupGeometryAndField().

59  {
61 }
FamosManager * famosManager_
Definition: FamosProducer.h:29
void setupGeometryAndField(edm::Run const &run, const edm::EventSetup &es)
Get information from the Event Setup.
Definition: FamosManager.cc:85
void FamosProducer::produce ( edm::Event e,
const edm::EventSetup c 
)
override

Definition at line 63 of file FamosProducer.cc.

References FamosManager::calorimetryManager(), DEFINE_FWK_MODULE, famosManager_, edm::EventSetup::get(), edm::Event::getByToken(), edm::HepMCProduct::GetEvent(), FSimEvent::load(), CalorimetryManager::loadFromEcalBarrel(), CalorimetryManager::loadFromEcalEndcap(), CalorimetryManager::loadFromHcal(), CalorimetryManager::loadFromPreshower(), CalorimetryManager::loadMuonSimTracks(), TrajectoryManager::loadSimHits(), eostools::move(), p1, p2, p3, p4, edm::Event::put(), random, FamosManager::reconstruct(), FamosManager::simEvent(), simulateMuons, sourceToken, edm::Event::streamID(), FBaseSimEvent::theTable(), mixOne_simraw_on_sim_cfi::tracker, and FamosManager::trackerManager().

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

64 {
66  using namespace edm;
67 
69 
70  //Retrieve tracker topology from geometry
72  es.get<TrackerTopologyRcd>().get(tTopoHand);
73  const TrackerTopology *tTopo=tTopoHand.product();
74 
75  // get the signal event
76  Handle<HepMCProduct> theHepMCProduct;
77  iEvent.getByToken(sourceToken,theHepMCProduct);
78  const HepMC::GenEvent * myGenEvent = theHepMCProduct->GetEvent();
79 
80  // do the simulation
81  famosManager_->reconstruct(myGenEvent,tTopo, &random);
82 
83  // get the hits, simtracks and simvertices and put in the event
86 
87  std::unique_ptr<edm::SimTrackContainer> p1(new edm::SimTrackContainer);
88  std::unique_ptr<edm::SimTrackContainer> m1(new edm::SimTrackContainer);
89  std::unique_ptr<edm::SimVertexContainer> p2(new edm::SimVertexContainer);
90  std::unique_ptr<FSimVertexTypeCollection> v1(new FSimVertexTypeCollection);
91  std::unique_ptr<edm::PSimHitContainer> p3(new edm::PSimHitContainer);
92  std::unique_ptr<edm::PCaloHitContainer> p4(new edm::PCaloHitContainer);
93  std::unique_ptr<edm::PCaloHitContainer> p5(new edm::PCaloHitContainer);
94  std::unique_ptr<edm::PCaloHitContainer> p6(new edm::PCaloHitContainer);
95  std::unique_ptr<edm::PCaloHitContainer> p7(new edm::PCaloHitContainer);
96 
97  FSimEvent* fevt = famosManager_->simEvent();
98  fevt->load(*p1,*m1);
99  fevt->load(*p2);
100  fevt->load(*v1);
101  tracker->loadSimHits(*p3);
102 
103 
104  if ( calo ) {
105  calo->loadFromEcalBarrel(*p4);
106  calo->loadFromEcalEndcap(*p5);
107  calo->loadFromPreshower(*p6);
108  calo->loadFromHcal(*p7);
109  calo->loadMuonSimTracks(*m1);
110  }
111 
112  if ( simulateMuons ) iEvent.put(std::move(m1),"MuonSimTracks");
113  iEvent.put(std::move(p1));
114  iEvent.put(std::move(p2));
115  iEvent.put(std::move(p3),"TrackerHits");
116  iEvent.put(std::move(v1),"VertexTypes");
117  iEvent.put(std::move(p4),"EcalHitsEB");
118  iEvent.put(std::move(p5),"EcalHitsEE");
119  iEvent.put(std::move(p6),"EcalHitsES");
120  iEvent.put(std::move(p7),"HcalHits");
121 }
void reconstruct(const HepMC::GenEvent *evt, const TrackerTopology *tTopo, RandomEngineAndDistribution const *)
The real thing is done here.
std::vector< PCaloHit > PCaloHitContainer
void load(edm::SimTrackContainer &c, edm::SimTrackContainer &m) const
Load containers of tracks (and muons) and vertices for the edm::Event.
Definition: FSimEvent.cc:51
const HepPDT::ParticleDataTable * theTable() const
Get the pointer to the particle data table.
Definition: FBaseSimEvent.h:57
void loadFromPreshower(edm::PCaloHitContainer &c) const
TRandom random
Definition: MVATrainer.cc:138
FamosManager * famosManager_
Definition: FamosProducer.h:29
int iEvent
Definition: GenABIO.cc:230
double p4[4]
Definition: TauolaWrapper.h:92
void loadFromEcalEndcap(edm::PCaloHitContainer &c) const
std::vector< FSimVertexType > FSimVertexTypeCollection
collection of FSimVertexType objects
void loadMuonSimTracks(edm::SimTrackContainer &m) const
double p2[4]
Definition: TauolaWrapper.h:90
void loadFromHcal(edm::PCaloHitContainer &c) const
CalorimetryManager * calorimetryManager() const
The calorimeter.
Definition: FamosManager.h:56
edm::EDGetTokenT< edm::HepMCProduct > sourceToken
Definition: FamosProducer.h:35
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:38
void loadSimHits(edm::PSimHitContainer &c) const
std::vector< SimVertex > SimVertexContainer
HLT enums.
double p1[4]
Definition: TauolaWrapper.h:89
std::vector< PSimHit > PSimHitContainer
TrajectoryManager * trackerManager() const
The tracker.
Definition: FamosManager.h:53
FSimEvent * simEvent() const
The simulated event.
Definition: FamosManager.h:45
std::vector< SimTrack > SimTrackContainer
def move(src, dest)
Definition: eostools.py:510
double p3[4]
Definition: TauolaWrapper.h:91
void loadFromEcalBarrel(edm::PCaloHitContainer &c) const

Member Data Documentation

HepMC::GenEvent* FamosProducer::evt_
private

Definition at line 30 of file FamosProducer.h.

FamosManager* FamosProducer::famosManager_
private

Definition at line 29 of file FamosProducer.h.

Referenced by beginRun(), FamosProducer(), produce(), and ~FamosProducer().

bool FamosProducer::simulateMuons
private

Definition at line 31 of file FamosProducer.h.

Referenced by FamosProducer(), and produce().

edm::EDGetTokenT<edm::HepMCProduct> FamosProducer::sourceToken
private

Definition at line 35 of file FamosProducer.h.

Referenced by FamosProducer(), and produce().