CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
cms::PileupVertexAccumulator Class Reference

#include <PileupVertexAccumulator.h>

Inheritance diagram for cms::PileupVertexAccumulator:
DigiAccumulatorMixMod

Public Member Functions

void accumulate (edm::Event const &e, edm::EventSetup const &c) override
 
void accumulate (PileUpEventPrincipal const &e, edm::EventSetup const &c, edm::StreamID const &) override
 
virtual void beginJob ()
 
void finalizeEvent (edm::Event &e, edm::EventSetup const &c) override
 
void initializeEvent (edm::Event const &e, edm::EventSetup const &c) override
 
 PileupVertexAccumulator (const edm::ParameterSet &conf, edm::ProducesCollector, edm::ConsumesCollector &iC)
 
 ~PileupVertexAccumulator () override
 
- Public Member Functions inherited from DigiAccumulatorMixMod
virtual void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup)
 
virtual void beginRun (edm::Run const &run, edm::EventSetup const &setup)
 
 DigiAccumulatorMixMod ()
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup)
 
virtual void endRun (edm::Run const &run, edm::EventSetup const &setup)
 
virtual void finalizeBunchCrossing (edm::Event &event, edm::EventSetup const &setup, int bunchCrossing)
 
virtual PileupMixingContentgetEventPileupInfo ()
 
virtual void initializeBunchCrossing (edm::Event const &event, edm::EventSetup const &setup, int bunchCrossing)
 
virtual void StorePileupInformation (std::vector< int > &numInteractionList, std::vector< int > &bunchCrossingList, std::vector< float > &TrueInteractionList, std::vector< edm::EventID > &eventList, int bunchSpace)
 
virtual ~DigiAccumulatorMixMod ()
 

Private Attributes

edm::InputTag fallbackMtag_
 
edm::InputTag Mtag_
 
std::vector< float > pT_Hats_
 
bool saveVtxTimes_
 
std::vector< float > t_posns_
 
std::vector< float > z_posns_
 

Detailed Description

Definition at line 41 of file PileupVertexAccumulator.h.

Constructor & Destructor Documentation

◆ PileupVertexAccumulator()

PileupVertexAccumulator::PileupVertexAccumulator ( const edm::ParameterSet conf,
edm::ProducesCollector  producesCollector,
edm::ConsumesCollector iC 
)
explicit

Definition at line 65 of file PileupVertexAccumulator.cc.

68  : Mtag_(iConfig.getParameter<edm::InputTag>("vtxTag")),
69  fallbackMtag_(iConfig.getParameter<edm::InputTag>("vtxFallbackTag")),
70  saveVtxTimes_(iConfig.getParameter<bool>("saveVtxTimes")) {
71  edm::LogInfo("PixelDigitizer ") << "Enter the Pixel Digitizer";
72 
73  const std::string alias("PileupVertexAccum");
74 
75  producesCollector.produces<PileupVertexContent>().setBranchAlias(alias);
76 
79  }

References SiStripOfflineCRack_cfg::alias, edm::ConsumesCollector::consumes(), fallbackMtag_, edm::ConsumesCollector::mayConsume(), Mtag_, edm::ProducesCollector::produces(), and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~PileupVertexAccumulator()

PileupVertexAccumulator::~PileupVertexAccumulator ( )
override

Definition at line 81 of file PileupVertexAccumulator.cc.

81 {}

Member Function Documentation

◆ accumulate() [1/2]

void PileupVertexAccumulator::accumulate ( edm::Event const &  e,
edm::EventSetup const &  c 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 95 of file PileupVertexAccumulator.cc.

95  {
96  // don't do anything for hard-scatter signal events
97  }

◆ accumulate() [2/2]

void PileupVertexAccumulator::accumulate ( PileUpEventPrincipal const &  e,
edm::EventSetup const &  c,
edm::StreamID const &  streamID 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 99 of file PileupVertexAccumulator.cc.

101  {
103  iEvent.getByLabel(Mtag_, MCevt);
104  if (MCevt.whyFailed()) {
105  iEvent.getByLabel(fallbackMtag_, MCevt);
106  }
107 
108  const HepMC::GenEvent* myGenEvent = MCevt->GetEvent();
109 
110  double pthat = myGenEvent->event_scale();
111  float pt_hat = float(pthat);
112 
113  pT_Hats_.push_back(pt_hat);
114 
115  HepMC::GenEvent::vertex_const_iterator viter;
116  HepMC::GenEvent::vertex_const_iterator vbegin = myGenEvent->vertices_begin();
117  HepMC::GenEvent::vertex_const_iterator vend = myGenEvent->vertices_end();
118 
119  // for production point, pick first vertex
120  viter = vbegin;
121 
122  if (viter != vend) {
123  // The origin vertex (turn it to cm's from GenEvent mm's)
124  HepMC::GenVertex* v = *viter;
125  float zpos = v->position().z() * 0.1;
126 
127  z_posns_.push_back(zpos);
128 
129  if (saveVtxTimes_) {
130  float tpos = v->position().t() / 299792458e-6; // turn from mm to ns
131  t_posns_.push_back(tpos);
132  }
133  }
134 
135  // delete myGenEvent;
136  }

References MillePedeFileConverter_cfg::e, fallbackMtag_, dqmMemoryStats::float, edm::HepMCProduct::GetEvent(), iEvent, Mtag_, pT_Hats_, saveVtxTimes_, t_posns_, findQualityFiles::v, vbegin, vend, edm::HandleBase::whyFailed(), and z_posns_.

◆ beginJob()

virtual void cms::PileupVertexAccumulator::beginJob ( void  )
inlinevirtual

Definition at line 52 of file PileupVertexAccumulator.h.

52 {}

◆ finalizeEvent()

void PileupVertexAccumulator::finalizeEvent ( edm::Event e,
edm::EventSetup const &  c 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 139 of file PileupVertexAccumulator.cc.

139  {
140  std::unique_ptr<PileupVertexContent> PUVtxC(new PileupVertexContent(pT_Hats_, z_posns_, t_posns_));
141 
142  // write output to event
143  iEvent.put(std::move(PUVtxC));
144  }

References iEvent, eostools::move(), pT_Hats_, t_posns_, and z_posns_.

◆ initializeEvent()

void PileupVertexAccumulator::initializeEvent ( edm::Event const &  e,
edm::EventSetup const &  c 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 87 of file PileupVertexAccumulator.cc.

87  {
88  // Make sure that the first crossing processed starts indexing the minbias events from zero.
89 
90  pT_Hats_.clear();
91  z_posns_.clear();
92  t_posns_.clear();
93  }

References pT_Hats_, t_posns_, and z_posns_.

Member Data Documentation

◆ fallbackMtag_

edm::InputTag cms::PileupVertexAccumulator::fallbackMtag_
private

Definition at line 59 of file PileupVertexAccumulator.h.

Referenced by accumulate(), and PileupVertexAccumulator().

◆ Mtag_

edm::InputTag cms::PileupVertexAccumulator::Mtag_
private

Definition at line 58 of file PileupVertexAccumulator.h.

Referenced by accumulate(), and PileupVertexAccumulator().

◆ pT_Hats_

std::vector<float> cms::PileupVertexAccumulator::pT_Hats_
private

Definition at line 55 of file PileupVertexAccumulator.h.

Referenced by accumulate(), finalizeEvent(), and initializeEvent().

◆ saveVtxTimes_

bool cms::PileupVertexAccumulator::saveVtxTimes_
private

Definition at line 60 of file PileupVertexAccumulator.h.

Referenced by accumulate().

◆ t_posns_

std::vector<float> cms::PileupVertexAccumulator::t_posns_
private

Definition at line 57 of file PileupVertexAccumulator.h.

Referenced by accumulate(), finalizeEvent(), and initializeEvent().

◆ z_posns_

std::vector<float> cms::PileupVertexAccumulator::z_posns_
private

Definition at line 56 of file PileupVertexAccumulator.h.

Referenced by accumulate(), finalizeEvent(), and initializeEvent().

PileupVertexContent
Definition: PileupVertexContent.h:24
vend
#define vend()
Definition: vmac.h:43
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
edm::LogInfo
Definition: MessageLogger.h:254
vbegin
#define vbegin()
Definition: vmac.h:36
findQualityFiles.v
v
Definition: findQualityFiles.py:179
edm::Handle< edm::HepMCProduct >
HepMC::GenEvent
Definition: hepmc_rootio.cc:9
cms::PileupVertexAccumulator::fallbackMtag_
edm::InputTag fallbackMtag_
Definition: PileupVertexAccumulator.h:59
cms::PileupVertexAccumulator::pT_Hats_
std::vector< float > pT_Hats_
Definition: PileupVertexAccumulator.h:55
cms::PileupVertexAccumulator::t_posns_
std::vector< float > t_posns_
Definition: PileupVertexAccumulator.h:57
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:49
edm::HandleBase::whyFailed
std::shared_ptr< cms::Exception > whyFailed() const
Definition: HandleBase.h:91
cms::PileupVertexAccumulator::saveVtxTimes_
bool saveVtxTimes_
Definition: PileupVertexAccumulator.h:60
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cms::PileupVertexAccumulator::Mtag_
edm::InputTag Mtag_
Definition: PileupVertexAccumulator.h:58
edm::ConsumesCollector::mayConsume
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
Definition: ConsumesCollector.h:61
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::ProducesCollector::produces
ProductRegistryHelper::BranchAliasSetterT< ProductType > produces()
Definition: ProducesCollector.h:52
edm::HepMCProduct::GetEvent
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:34
eostools.move
def move(src, dest)
Definition: eostools.py:511
SiStripOfflineCRack_cfg.alias
alias
Definition: SiStripOfflineCRack_cfg.py:129
edm::HepMCProduct
Definition: HepMCProduct.h:18
edm::InputTag
Definition: InputTag.h:15
cms::PileupVertexAccumulator::z_posns_
std::vector< float > z_posns_
Definition: PileupVertexAccumulator.h:56
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37