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 hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Attributes

HepMC::GenEventevt_
 
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::FamosProducer ( edm::ParameterSet const &  p)
explicit

Definition at line 32 of file FamosProducer.cc.

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

References famosManager_, AlCaHLTBitMon_ParallelJobs::p, simulateMuons, and sourceToken.

◆ ~FamosProducer()

FamosProducer::~FamosProducer ( )
override

Definition at line 54 of file FamosProducer.cc.

54 { delete famosManager_; }

References famosManager_.

Member Function Documentation

◆ beginRun()

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

◆ produce()

void FamosProducer::produce ( edm::Event e,
const edm::EventSetup c 
)
override

Definition at line 60 of file FamosProducer.cc.

60  {
61  using namespace edm;
62 
63  RandomEngineAndDistribution random(iEvent.streamID());
64 
65  //Retrieve tracker topology from geometry
67  es.get<TrackerTopologyRcd>().get(tTopoHand);
68  const TrackerTopology* tTopo = tTopoHand.product();
69 
70  // get the signal event
71  Handle<HepMCProduct> theHepMCProduct;
72  iEvent.getByToken(sourceToken, theHepMCProduct);
73  const HepMC::GenEvent* myGenEvent = theHepMCProduct->GetEvent();
74 
75  // do the simulation
76  famosManager_->reconstruct(myGenEvent, tTopo, &random);
77 
78  // get the hits, simtracks and simvertices and put in the event
81 
82  std::unique_ptr<edm::SimTrackContainer> p1(new edm::SimTrackContainer);
83  std::unique_ptr<edm::SimTrackContainer> m1(new edm::SimTrackContainer);
84  std::unique_ptr<edm::SimVertexContainer> p2(new edm::SimVertexContainer);
85  std::unique_ptr<FSimVertexTypeCollection> v1(new FSimVertexTypeCollection);
86  std::unique_ptr<edm::PSimHitContainer> p3(new edm::PSimHitContainer);
87  std::unique_ptr<edm::PCaloHitContainer> p4(new edm::PCaloHitContainer);
88  std::unique_ptr<edm::PCaloHitContainer> p5(new edm::PCaloHitContainer);
89  std::unique_ptr<edm::PCaloHitContainer> p6(new edm::PCaloHitContainer);
90  std::unique_ptr<edm::PCaloHitContainer> p7(new edm::PCaloHitContainer);
91 
92  FSimEvent* fevt = famosManager_->simEvent();
93  fevt->load(*p1, *m1);
94  fevt->load(*p2);
95  fevt->load(*v1);
96  tracker->loadSimHits(*p3);
97 
98  if (calo) {
99  calo->loadFromEcalBarrel(*p4);
100  calo->loadFromEcalEndcap(*p5);
101  calo->loadFromPreshower(*p6);
102  calo->loadFromHcal(*p7);
103  calo->loadMuonSimTracks(*m1);
104  }
105 
106  if (simulateMuons)
107  iEvent.put(std::move(m1), "MuonSimTracks");
108  iEvent.put(std::move(p1));
109  iEvent.put(std::move(p2));
110  iEvent.put(std::move(p3), "TrackerHits");
111  iEvent.put(std::move(v1), "VertexTypes");
112  iEvent.put(std::move(p4), "EcalHitsEB");
113  iEvent.put(std::move(p5), "EcalHitsEE");
114  iEvent.put(std::move(p6), "EcalHitsES");
115  iEvent.put(std::move(p7), "HcalHits");
116 }

References L1TowerCalibrationProducer_cfi::calo, FamosManager::calorimetryManager(), famosManager_, edm::EventSetup::get(), get, edm::HepMCProduct::GetEvent(), iEvent, FSimEvent::load(), eostools::move(), p1, p2, p3, p4, FamosManager::reconstruct(), FamosManager::simEvent(), simulateMuons, sourceToken, PbPb_ZMuSkimMuonDPG_cff::tracker, and FamosManager::trackerManager().

Member Data Documentation

◆ evt_

HepMC::GenEvent* FamosProducer::evt_
private

Definition at line 26 of file FamosProducer.h.

◆ famosManager_

FamosManager* FamosProducer::famosManager_
private

Definition at line 25 of file FamosProducer.h.

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

◆ simulateMuons

bool FamosProducer::simulateMuons
private

Definition at line 27 of file FamosProducer.h.

Referenced by FamosProducer(), and produce().

◆ sourceToken

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

Definition at line 30 of file FamosProducer.h.

Referenced by FamosProducer(), and produce().

FSimEvent
Definition: FSimEvent.h:29
L1TowerCalibrationProducer_cfi.calo
calo
Definition: L1TowerCalibrationProducer_cfi.py:59
FamosProducer::simulateMuons
bool simulateMuons
Definition: FamosProducer.h:27
edm
HLT enums.
Definition: AlignableModifier.h:19
TrackerTopology
Definition: TrackerTopology.h:16
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
FamosProducer::sourceToken
edm::EDGetTokenT< edm::HepMCProduct > sourceToken
Definition: FamosProducer.h:30
edm::Handle
Definition: AssociativeIterator.h:50
HepMC::GenEvent
Definition: hepmc_rootio.cc:9
FamosManager::trackerManager
TrajectoryManager * trackerManager() const
The tracker.
Definition: FamosManager.h:47
FamosManager::simEvent
FSimEvent * simEvent() const
The simulated event.
Definition: FamosManager.h:41
FamosManager::calorimetryManager
CalorimetryManager * calorimetryManager() const
The calorimeter.
Definition: FamosManager.h:50
edm::ESHandle< TrackerTopology >
p2
double p2[4]
Definition: TauolaWrapper.h:90
PbPb_ZMuSkimMuonDPG_cff.tracker
tracker
Definition: PbPb_ZMuSkimMuonDPG_cff.py:60
CalorimetryManager
Definition: CalorimetryManager.h:45
iEvent
int iEvent
Definition: GenABIO.cc:224
p4
double p4[4]
Definition: TauolaWrapper.h:92
p1
double p1[4]
Definition: TauolaWrapper.h:89
FamosProducer::famosManager_
FamosManager * famosManager_
Definition: FamosProducer.h:25
FamosManager
Definition: FamosManager.h:29
edm::HepMCProduct::GetEvent
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:34
get
#define get
FSimEvent::load
void load(edm::SimTrackContainer &c, edm::SimTrackContainer &m) const
Load containers of tracks (and muons) and vertices for the edm::Event.
Definition: FSimEvent.cc:30
FamosManager::setupGeometryAndField
void setupGeometryAndField(edm::Run const &run, const edm::EventSetup &es)
Get information from the Event Setup.
Definition: FamosManager.cc:81
eostools.move
def move(src, dest)
Definition: eostools.py:511
writedatasetfile.run
run
Definition: writedatasetfile.py:27
edm::SimTrackContainer
std::vector< SimTrack > SimTrackContainer
Definition: SimTrackContainer.h:12
edm::PCaloHitContainer
std::vector< PCaloHit > PCaloHitContainer
Definition: PCaloHitContainer.h:8
p3
double p3[4]
Definition: TauolaWrapper.h:91
FSimVertexTypeCollection
std::vector< FSimVertexType > FSimVertexTypeCollection
collection of FSimVertexType objects
Definition: FSimVertexTypeFwd.h:7
edm::PSimHitContainer
std::vector< PSimHit > PSimHitContainer
Definition: PSimHitContainer.h:11
TrackerTopologyRcd
Definition: TrackerTopologyRcd.h:10
TrajectoryManager
Definition: TrajectoryManager.h:59
FamosManager::reconstruct
void reconstruct(const HepMC::GenEvent *evt, const TrackerTopology *tTopo, RandomEngineAndDistribution const *)
The real thing is done here.
Definition: FamosManager.cc:139
edm::SimVertexContainer
std::vector< SimVertex > SimVertexContainer
Definition: SimVertexContainer.h:12
edm::InputTag
Definition: InputTag.h:15
RandomEngineAndDistribution
Definition: RandomEngineAndDistribution.h:18