CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PileupVertexAccumulator.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: PileupVertexAccumulator
4 // Class: PileupVertexAccumulator
5 //
13 //
14 // Original Author: Mike Hildreth - Notre Dame
15 // Created: Wed Jan 21 05:14:48 CET 2015
16 //
17 //
18 
19 
20 // system include files
21 #include <memory>
22 #include <set>
23 
24 // user include files
26 
34 
39 
40 // user include files
43 
46 
49 
52 
53 
54 //
55 // constants, enums and typedefs
56 //
57 
58 //
59 // static data member definitions
60 //
61 
62 //
63 // constructors and destructor
64 //
65 //using namespace std;
66 
67 
68 namespace cms
69 {
71  {
72  edm::LogInfo ("PixelDigitizer ") <<"Enter the Pixel Digitizer";
73 
74  const std::string alias ("PileupVertexAccum");
75 
76  mixMod.produces<PileupVertexContent>().setBranchAlias(alias);
77 
78  Mtag_=edm::InputTag("generator");
80  }
81 
83  }
84 
85 
86  //
87  // member functions
88  //
89 
90  void
92  // Make sure that the first crossing processed starts indexing the minbias events from zero.
93 
94  pT_Hats_.clear();
95  z_posns_.clear();
96  }
97 
98  void
100  // don't do anything for hard-scatter signal events
101  }
102 
103  void
105 
107  iEvent.getByLabel(Mtag_, MCevt);
108 
109  const HepMC::GenEvent *myGenEvent = MCevt->GetEvent();
110 
111  double pthat = myGenEvent->event_scale();
112  float pt_hat = float(pthat);
113 
114  pT_Hats_.push_back(pt_hat);
115 
116  HepMC::GenEvent::vertex_const_iterator viter;
117  HepMC::GenEvent::vertex_const_iterator vbegin = myGenEvent->vertices_begin();
118  HepMC::GenEvent::vertex_const_iterator vend = myGenEvent->vertices_end();
119 
120  // for production point, pick first vertex
121  viter=vbegin;
122 
123  if(viter!=vend){
124  // The origin vertex (turn it to cm's from GenEvent mm's)
125  HepMC::GenVertex* v = *viter;
126  float zpos = v->position().z()*0.1;
127 
128  z_posns_.push_back(zpos);
129  }
130 
131  // delete myGenEvent;
132 
133  }
134 
135  // ------------ method called to produce write the data ------------
136  void
138 
139  std::auto_ptr<PileupVertexContent> PUVtxC(new PileupVertexContent(pT_Hats_, z_posns_));
140 
141  // write output to event
142  iEvent.put(PUVtxC);
143  }
144 
145 
146 }// end namespace cms::
147 
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
PileupVertexAccumulator(const edm::ParameterSet &conf, edm::one::EDProducerBase &mixMod, edm::ConsumesCollector &iC)
virtual void finalizeEvent(edm::Event &e, edm::EventSetup const &c) override
virtual void accumulate(edm::Event const &e, edm::EventSetup const &c) override
#define vend()
Definition: vmac.h:41
int iEvent
Definition: GenABIO.cc:230
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
#define vbegin()
Definition: vmac.h:34
bool getByLabel(edm::InputTag const &tag, edm::Handle< T > &result) const
virtual void initializeEvent(edm::Event const &e, edm::EventSetup const &c) override