CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 ()
 
 DigiAccumulatorMixMod (DigiAccumulatorMixMod const &)=delete
 
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)
 
DigiAccumulatorMixMod const & operator= (DigiAccumulatorMixMod const &)=delete
 
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 ( const edm::ParameterSet conf,
edm::ProducesCollector  producesCollector,
edm::ConsumesCollector iC 
)
explicit

Definition at line 63 of file PileupVertexAccumulator.cc.

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

66  : Mtag_(iConfig.getParameter<edm::InputTag>("vtxTag")),
67  fallbackMtag_(iConfig.getParameter<edm::InputTag>("vtxFallbackTag")),
68  saveVtxTimes_(iConfig.getParameter<bool>("saveVtxTimes")) {
69  edm::LogInfo("PixelDigitizer ") << "Enter the Pixel Digitizer";
70 
71  const std::string alias("PileupVertexAccum");
72 
73  producesCollector.produces<PileupVertexContent>().setBranchAlias(alias);
74 
77  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
ProductRegistryHelper::BranchAliasSetterT< ProductType > produces()
Log< level::Info, false > LogInfo
PileupVertexAccumulator::~PileupVertexAccumulator ( )
override

Definition at line 79 of file PileupVertexAccumulator.cc.

79 {}

Member Function Documentation

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

Implements DigiAccumulatorMixMod.

Definition at line 93 of file PileupVertexAccumulator.cc.

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

Implements DigiAccumulatorMixMod.

Definition at line 97 of file PileupVertexAccumulator.cc.

References alignCSCRings::e, fallbackMtag_, PileUpEventPrincipal::getByLabel(), Mtag_, pT_Hats_, saveVtxTimes_, t_posns_, findQualityFiles::v, edm::HandleBase::whyFailed(), and z_posns_.

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

Definition at line 52 of file PileupVertexAccumulator.h.

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

Implements DigiAccumulatorMixMod.

Definition at line 137 of file PileupVertexAccumulator.cc.

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

137  {
138  std::unique_ptr<PileupVertexContent> PUVtxC(new PileupVertexContent(pT_Hats_, z_posns_, t_posns_));
139 
140  // write output to event
141  iEvent.put(std::move(PUVtxC));
142  }
int iEvent
Definition: GenABIO.cc:224
def move
Definition: eostools.py:511
void PileupVertexAccumulator::initializeEvent ( edm::Event const &  e,
edm::EventSetup const &  c 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 85 of file PileupVertexAccumulator.cc.

References pT_Hats_, t_posns_, and z_posns_.

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

Member Data Documentation

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

Definition at line 59 of file PileupVertexAccumulator.h.

Referenced by accumulate(), and PileupVertexAccumulator().

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

Definition at line 58 of file PileupVertexAccumulator.h.

Referenced by accumulate(), and PileupVertexAccumulator().

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

Definition at line 55 of file PileupVertexAccumulator.h.

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

bool cms::PileupVertexAccumulator::saveVtxTimes_
private

Definition at line 60 of file PileupVertexAccumulator.h.

Referenced by accumulate().

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

Definition at line 57 of file PileupVertexAccumulator.h.

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

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

Definition at line 56 of file PileupVertexAccumulator.h.

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