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
FamosProducer Class Reference

#include <FamosProducer.h>

Inheritance diagram for FamosProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginRun (edm::Run const &run, const edm::EventSetup &es) override
 
 FamosProducer (edm::ParameterSet const &p)
 
virtual void produce (edm::Event &e, const edm::EventSetup &c) override
 
virtual ~FamosProducer ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- 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

HepMC::GenEvent * evt_
 
FamosManagerfamosManager_
 
edm::EDGetTokenT
< edm::HepMCProduct
puToken
 
bool simulateMuons
 
edm::EDGetTokenT
< edm::HepMCProduct
sourceToken
 

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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase 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::stream::EDProducerBase
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 17 of file FamosProducer.h.

Constructor & Destructor Documentation

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

Definition at line 31 of file FamosProducer.cc.

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

32 {
33 
34  produces<edm::SimTrackContainer>();
35  produces<edm::SimVertexContainer>();
36  produces<FSimVertexTypeCollection>("VertexTypes");
37  produces<edm::PSimHitContainer>("TrackerHits");
38  produces<edm::PCaloHitContainer>("EcalHitsEB");
39  produces<edm::PCaloHitContainer>("EcalHitsEE");
40  produces<edm::PCaloHitContainer>("EcalHitsES");
41  produces<edm::PCaloHitContainer>("HcalHits");
42  // Temporary facility to allow for the crossing frame to work...
43  simulateMuons = p.getParameter<bool>("SimulateMuons");
44  if ( simulateMuons ) 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  // for gen-mixing
51  edm::InputTag _label = edm::InputTag("famosPileUp","PileUpEvents");
52  puToken = consumes<edm::HepMCProduct>(_label);
53 
54  // famos manager
56 }
FamosManager * famosManager_
Definition: FamosProducer.h:29
edm::EDGetTokenT< edm::HepMCProduct > puToken
Definition: FamosProducer.h:37
edm::EDGetTokenT< edm::HepMCProduct > sourceToken
Definition: FamosProducer.h:35
FamosProducer::~FamosProducer ( )
virtual

Definition at line 58 of file FamosProducer.cc.

References famosManager_.

59 { if ( famosManager_ ) delete famosManager_; }
FamosManager * famosManager_
Definition: FamosProducer.h:29

Member Function Documentation

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

Reimplemented from edm::stream::EDProducerBase.

Definition at line 62 of file FamosProducer.cc.

References famosManager_, and FamosManager::setupGeometryAndField().

62  {
64 }
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:91
void FamosProducer::produce ( edm::Event e,
const edm::EventSetup c 
)
overridevirtual

Implements edm::stream::EDProducerBase.

Definition at line 66 of file FamosProducer.cc.

References FamosManager::calorimetryManager(), famosManager_, edm::EventSetup::get(), edm::Event::getByToken(), FSimEvent::load(), p1, p2, p3, p4, edm::Event::put(), puToken, random, FamosManager::reconstruct(), FamosManager::simEvent(), simulateMuons, sourceToken, edm::Event::streamID(), FBaseSimEvent::theTable(), patCandidatesForDimuonsSequences_cff::tracker, and FamosManager::trackerManager().

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

67 {
69  using namespace edm;
70 
72 
73  //Retrieve tracker topology from geometry
75  es.get<TrackerTopologyRcd>().get(tTopoHand);
76  const TrackerTopology *tTopo=tTopoHand.product();
77 
78  // get the signal event
79  Handle<HepMCProduct> theHepMCProduct;
80  iEvent.getByToken(sourceToken,theHepMCProduct);
81  const HepMC::GenEvent * myGenEvent = theHepMCProduct->GetEvent();
82 
83  // get the pu event (for gen-mixing)
84  Handle<HepMCProduct> thePileUpEvents;
85  bool isPileUp = iEvent.getByToken(puToken,thePileUpEvents);
86  const HepMC::GenEvent * thePUEvents = isPileUp ? thePileUpEvents->GetEvent() : 0;
87 
88  // do the simulation
89  famosManager_->reconstruct(myGenEvent,thePUEvents,tTopo, &random);
90 
91  // get the hits, simtracks and simvertices and put in the event
94 
95  std::auto_ptr<edm::SimTrackContainer> p1(new edm::SimTrackContainer);
96  std::auto_ptr<edm::SimTrackContainer> m1(new edm::SimTrackContainer);
97  std::auto_ptr<edm::SimVertexContainer> p2(new edm::SimVertexContainer);
98  std::auto_ptr<FSimVertexTypeCollection> v1(new FSimVertexTypeCollection);
99  std::auto_ptr<edm::PSimHitContainer> p3(new edm::PSimHitContainer);
100  std::auto_ptr<edm::PCaloHitContainer> p4(new edm::PCaloHitContainer);
101  std::auto_ptr<edm::PCaloHitContainer> p5(new edm::PCaloHitContainer);
102  std::auto_ptr<edm::PCaloHitContainer> p6(new edm::PCaloHitContainer);
103  std::auto_ptr<edm::PCaloHitContainer> p7(new edm::PCaloHitContainer);
104 
105  FSimEvent* fevt = famosManager_->simEvent();
106  fevt->load(*p1,*m1);
107  fevt->load(*p2);
108  fevt->load(*v1);
109  tracker->loadSimHits(*p3);
110 
111 
112  if ( calo ) {
113  calo->loadFromEcalBarrel(*p4);
114  calo->loadFromEcalEndcap(*p5);
115  calo->loadFromPreshower(*p6);
116  calo->loadFromHcal(*p7);
117  calo->loadMuonSimTracks(*m1);
118  }
119 
120  if ( simulateMuons ) iEvent.put(m1,"MuonSimTracks");
121  iEvent.put(p1);
122  iEvent.put(p2);
123  iEvent.put(p3,"TrackerHits");
124  iEvent.put(v1,"VertexTypes");
125  iEvent.put(p4,"EcalHitsEB");
126  iEvent.put(p5,"EcalHitsEE");
127  iEvent.put(p6,"EcalHitsES");
128  iEvent.put(p7,"HcalHits");
129 
130 }
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
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
std::vector< FSimVertexType > FSimVertexTypeCollection
collection of FSimVertexType objects
double p2[4]
Definition: TauolaWrapper.h:90
edm::EDGetTokenT< edm::HepMCProduct > puToken
Definition: FamosProducer.h:37
void reconstruct(const HepMC::GenEvent *evt, const HepMC::GenEvent *pu, const TrackerTopology *tTopo, RandomEngineAndDistribution const *)
The real thing is done here.
CalorimetryManager * calorimetryManager() const
The calorimeter.
Definition: FamosManager.h:57
edm::EDGetTokenT< edm::HepMCProduct > sourceToken
Definition: FamosProducer.h:35
std::vector< SimVertex > SimVertexContainer
double p1[4]
Definition: TauolaWrapper.h:89
std::vector< PSimHit > PSimHitContainer
TrajectoryManager * trackerManager() const
The tracker.
Definition: FamosManager.h:54
FSimEvent * simEvent() const
The simulated event.
Definition: FamosManager.h:45
std::vector< SimTrack > SimTrackContainer
double p3[4]
Definition: TauolaWrapper.h:91

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().

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

Definition at line 37 of file FamosProducer.h.

Referenced by FamosProducer(), and produce().

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().