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
cms::PileupVertexAccumulator Class Reference

#include <PileupVertexAccumulator.h>

Inheritance diagram for cms::PileupVertexAccumulator:
DigiAccumulatorMixMod

Public Member Functions

virtual void accumulate (edm::Event const &e, edm::EventSetup const &c) override
 
virtual void accumulate (PileUpEventPrincipal const &e, edm::EventSetup const &c, edm::StreamID const &) override
 
virtual void beginJob ()
 
virtual void finalizeEvent (edm::Event &e, edm::EventSetup const &c) override
 
virtual void initializeEvent (edm::Event const &e, edm::EventSetup const &c) override
 
 PileupVertexAccumulator (const edm::ParameterSet &conf, edm::stream::EDProducerBase &mixMod, edm::ConsumesCollector &iC)
 
virtual ~PileupVertexAccumulator ()
 
- 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_
 
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::stream::EDProducerBase mixMod,
edm::ConsumesCollector iC 
)
explicit

Definition at line 70 of file PileupVertexAccumulator.cc.

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

70  :
71  Mtag_(iConfig.getParameter<edm::InputTag>("vtxTag")),
72  fallbackMtag_(iConfig.getParameter<edm::InputTag>("vtxFallbackTag"))
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  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
PileupVertexAccumulator::~PileupVertexAccumulator ( )
virtual

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 101 of file PileupVertexAccumulator.cc.

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

Implements DigiAccumulatorMixMod.

Definition at line 106 of file PileupVertexAccumulator.cc.

References fallbackMtag_, PileUpEventPrincipal::getByLabel(), Mtag_, pT_Hats_, findQualityFiles::v, vbegin, vend, edm::HandleBase::whyFailed(), and z_posns_.

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

Definition at line 53 of file PileupVertexAccumulator.h.

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

Implements DigiAccumulatorMixMod.

Definition at line 142 of file PileupVertexAccumulator.cc.

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

142  {
143 
144  std::auto_ptr<PileupVertexContent> PUVtxC(new PileupVertexContent(pT_Hats_, z_posns_));
145 
146  // write output to event
147  iEvent.put(PUVtxC);
148  }
int iEvent
Definition: GenABIO.cc:230
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_, 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  }

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 56 of file PileupVertexAccumulator.h.

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

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

Definition at line 57 of file PileupVertexAccumulator.h.

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