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::ProducerBase &mixMod, 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 39 of file PileupVertexAccumulator.h.

Constructor & Destructor Documentation

PileupVertexAccumulator::PileupVertexAccumulator ( const edm::ParameterSet conf,
edm::ProducerBase mixMod,
edm::ConsumesCollector iC 
)
explicit

Definition at line 69 of file PileupVertexAccumulator.cc.

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

69  :
70  Mtag_(iConfig.getParameter<edm::InputTag>("vtxTag")),
71  fallbackMtag_(iConfig.getParameter<edm::InputTag>("vtxFallbackTag")),
72  saveVtxTimes_(iConfig.getParameter<bool>("saveVtxTimes"))
73  {
74  edm::LogInfo ("PixelDigitizer ") <<"Enter the Pixel Digitizer";
75 
76  const std::string alias ("PileupVertexAccum");
77 
78  mixMod.produces<PileupVertexContent>().setBranchAlias(alias);
79 
82  }
BranchAliasSetterT< ProductType > produces()
declare what type of product will make and with which optional label
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
PileupVertexAccumulator::~PileupVertexAccumulator ( )
override

Definition at line 84 of file PileupVertexAccumulator.cc.

84  {
85  }

Member Function Documentation

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

Implements DigiAccumulatorMixMod.

Definition at line 102 of file PileupVertexAccumulator.cc.

102  {
103  // don't do anything for hard-scatter signal events
104  }
void PileupVertexAccumulator::accumulate ( PileUpEventPrincipal const &  e,
edm::EventSetup const &  c,
edm::StreamID const &  streamID 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 107 of file PileupVertexAccumulator.cc.

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

107  {
108 
110  iEvent.getByLabel(Mtag_, MCevt);
111  if(MCevt.whyFailed()) {
112  iEvent.getByLabel(fallbackMtag_, MCevt);
113  }
114 
115  const HepMC::GenEvent *myGenEvent = MCevt->GetEvent();
116 
117  double pthat = myGenEvent->event_scale();
118  float pt_hat = float(pthat);
119 
120  pT_Hats_.push_back(pt_hat);
121 
122  HepMC::GenEvent::vertex_const_iterator viter;
123  HepMC::GenEvent::vertex_const_iterator vbegin = myGenEvent->vertices_begin();
124  HepMC::GenEvent::vertex_const_iterator vend = myGenEvent->vertices_end();
125 
126  // for production point, pick first vertex
127  viter=vbegin;
128 
129  if(viter!=vend){
130  // The origin vertex (turn it to cm's from GenEvent mm's)
131  HepMC::GenVertex* v = *viter;
132  float zpos = v->position().z()*0.1;
133 
134  z_posns_.push_back(zpos);
135 
136  if (saveVtxTimes_) {
137  float tpos = v->position().t()/299792458e-6; // turn from mm to ns
138  t_posns_.push_back(tpos);
139  }
140  }
141 
142  // delete myGenEvent;
143 
144  }
#define vend()
Definition: vmac.h:43
int iEvent
Definition: GenABIO.cc:230
#define vbegin()
Definition: vmac.h:36
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:38
std::shared_ptr< cms::Exception > whyFailed() const
Definition: HandleBase.h:106
virtual void cms::PileupVertexAccumulator::beginJob ( void  )
inlinevirtual

Definition at line 51 of file PileupVertexAccumulator.h.

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

Implements DigiAccumulatorMixMod.

Definition at line 148 of file PileupVertexAccumulator.cc.

References eostools::move(), pT_Hats_, edm::Event::put(), t_posns_, and z_posns_.

148  {
149 
150  std::unique_ptr<PileupVertexContent> PUVtxC(new PileupVertexContent(pT_Hats_, z_posns_, t_posns_));
151 
152  // write output to event
153  iEvent.put(std::move(PUVtxC));
154  }
int iEvent
Definition: GenABIO.cc:230
def move(src, dest)
Definition: eostools.py:510
void PileupVertexAccumulator::initializeEvent ( edm::Event const &  e,
edm::EventSetup const &  c 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 93 of file PileupVertexAccumulator.cc.

References pT_Hats_, t_posns_, and z_posns_.

93  {
94  // Make sure that the first crossing processed starts indexing the minbias events from zero.
95 
96  pT_Hats_.clear();
97  z_posns_.clear();
98  t_posns_.clear();
99  }

Member Data Documentation

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

Definition at line 58 of file PileupVertexAccumulator.h.

Referenced by accumulate(), and PileupVertexAccumulator().

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

Definition at line 57 of file PileupVertexAccumulator.h.

Referenced by accumulate(), and PileupVertexAccumulator().

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

Definition at line 54 of file PileupVertexAccumulator.h.

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

bool cms::PileupVertexAccumulator::saveVtxTimes_
private

Definition at line 59 of file PileupVertexAccumulator.h.

Referenced by accumulate().

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

Definition at line 56 of file PileupVertexAccumulator.h.

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

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

Definition at line 55 of file PileupVertexAccumulator.h.

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