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 Member Functions | Private Attributes
edm::MixingModule Class Reference

#include <MixingModule.h>

Inheritance diagram for edm::MixingModule:
edm::BMixingModule edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginJob ()
 
 MixingModule (const edm::ParameterSet &ps)
 
virtual void reload (const edm::EventSetup &)
 
virtual ~MixingModule ()
 
- Public Member Functions inherited from edm::BMixingModule
virtual void addPileups (const int bcr, EventPrincipal *ep, unsigned int eventId, unsigned int worker, const edm::EventSetup &c)
 
double averageNumber () const
 
virtual void beginLuminosityBlock (edm::LuminosityBlock &, edm::EventSetup const &)
 
virtual void beginRun (edm::Run &r, const edm::EventSetup &setup)
 
 BMixingModule (const edm::ParameterSet &ps)
 
virtual void getEventStartInfo (edm::Event &e, const unsigned int source)
 
bool poisson () const
 
virtual void produce (edm::Event &e1, const edm::EventSetup &c)
 
virtual void setBcrOffset ()
 
virtual void setEventStartInfo (const unsigned int s)
 
virtual void setSourceOffset (const unsigned int s)
 
virtual ~BMixingModule ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Member Functions

virtual void addSignals (const edm::Event &e, const edm::EventSetup &es)
 
virtual void branchesActivate (const std::string &friendlyName, const std::string &subdet, InputTag &tag, std::string &label)
 
virtual void checkSignal (const edm::Event &e)
 
virtual void createnewEDProduct ()
 
virtual void doPileUp (edm::Event &e, const edm::EventSetup &es)
 
void pileAllWorkers (EventPrincipal const &ep, int bcr, int id, int &offset)
 
virtual void put (edm::Event &e, const edm::EventSetup &es)
 

Private Attributes

std::string labelPlayback_
 
bool mixProdStep1_
 
bool mixProdStep2_
 
CrossingFramePlaybackInfoExtendedplaybackInfo_
 
Selectorsel_
 
bool useCurrentProcessOnly_
 
std::vector< std::string > wantedBranches_
 
std::vector< MixingWorkerBase * > workers_
 
std::vector< MixingWorkerBase * > workersObjects_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::BMixingModule
void dropUnwantedBranches (std::vector< std::string > const &wantedBranches)
 
virtual void endJob ()
 
void update (edm::EventSetup const &)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 
- Protected Attributes inherited from edm::BMixingModule
int bunchSpace_
 
bool checktof_
 
bool doit_ [4]
 
unsigned int eventId_
 
std::vector< boost::shared_ptr
< PileUp > > 
inputSources_
 
int maxBunch_
 
int minBunch_
 
bool const mixProdStep1_
 
bool const mixProdStep2_
 
edm::ESWatcher< MixingRcdparameterWatcher_
 
bool playback_
 
bool readDB_
 
std::vector< std::string > sourceNames_
 
std::vector< float > TrueNumInteractions_
 
- Static Protected Attributes inherited from edm::BMixingModule
static const unsigned int maxNbSources_ =4
 
static int vertexoffset = 0
 

Detailed Description

Definition at line 44 of file MixingModule.h.

Constructor & Destructor Documentation

MixingModule::MixingModule ( const edm::ParameterSet ps)
explicit

standard constructor

Definition at line 27 of file MixingModule.cc.

References branchesActivate(), edm::BMixingModule::bunchSpace_, edm::BMixingModule::dropUnwantedBranches(), edm::InputTag::encode(), edm::ParameterSet::exists(), spr::find(), edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNames(), diffTwoXMLs::label, labelPlayback_, LogDebug, edm::BMixingModule::maxBunch_, edm::BMixingModule::maxNbSources_, edm::BMixingModule::minBunch_, mixProdStep1_, mixProdStep2_, cscdqm::h::names, sel_, edm::sort_all(), subdets, GlobalPosition_Frontier_DevDB_cff::tag, o2o::tags, useCurrentProcessOnly_, wantedBranches_, and workersObjects_.

27  :
28  BMixingModule(ps_mix),
29  labelPlayback_(ps_mix.getParameter<std::string>("LabelPlayback")),
30  mixProdStep2_(ps_mix.getParameter<bool>("mixProdStep2")),
31  mixProdStep1_(ps_mix.getParameter<bool>("mixProdStep1"))
32  {
33  if (!mixProdStep1_ && !mixProdStep2_) LogInfo("MixingModule") << " The MixingModule was run in the Standard mode.";
34  if (mixProdStep1_) LogInfo("MixingModule") << " The MixingModule was run in the Step1 mode. It produces a mixed secondary source.";
35  if (mixProdStep2_) LogInfo("MixingModule") << " The MixingModule was run in the Step2 mode. It uses a mixed secondary source.";
36 
38  if (ps_mix.exists("useCurrentProcessOnly")) {
39  useCurrentProcessOnly_=ps_mix.getParameter<bool>("useCurrentProcessOnly");
40  LogInfo("MixingModule") <<" using given Parameter 'useCurrentProcessOnly' ="<<useCurrentProcessOnly_;
41  }
42  if (labelPlayback_.size()>0){
43  sel_=new Selector( ModuleLabelSelector(labelPlayback_));
44  }
45  else {
46  sel_=new Selector( MatchAllSelector());
47  }
48 
49  ParameterSet ps=ps_mix.getParameter<ParameterSet>("mixObjects");
50  std::vector<std::string> names = ps.getParameterNames();
51  for (std::vector<string>::iterator it=names.begin();it!= names.end();++it)
52  {
53  ParameterSet pset=ps.getParameter<ParameterSet>((*it));
54  if (!pset.exists("type")) continue; //to allow replacement by empty pset
55  std::string object = pset.getParameter<std::string>("type");
56  std::vector<InputTag> tags=pset.getParameter<std::vector<InputTag> >("input");
57 
58  if (mixProdStep2_){
59  //SimTracks
60  if (object=="SimTrackPCrossingFrame") {
61  InputTag tag;
62  if (tags.size()>0) tag=tags[0];
63  std::string label;
64  branchesActivate(TypeID(typeid(PCrossingFrame<SimTrack>)).friendlyClassName(),std::string(""),tag,label);
65 
66  LogInfo("MixingModule") <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label;
67  // std::cout <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label << std::endl ;
68 
69  //---------------------------------
70  // set an appropriate label for the CrossingFrame
71  if (find(names.begin(), names.end(), "mixTracks") != names.end())
72  {
73  edm::ParameterSet psin=ps.getParameter<edm::ParameterSet>("mixTracks");
74  if (!psin.exists("type")) continue; //to allow replacement by empty pset
75  std::string object = psin.getParameter<std::string>("type");
76  std::vector<InputTag> tags=psin.getParameter<std::vector<InputTag> >("input");
77 
78  InputTag tagCF;
79  if (tags.size()>0) tagCF=tags[0];
80  std::string labelCF;
81 
82  branchesActivate(TypeID(typeid(std::vector<SimTrack>)).friendlyClassName(),std::string(""),tagCF,labelCF);
83  workersObjects_.push_back(new MixingWorker<SimTrack>(minBunch_,maxBunch_,bunchSpace_,std::string(""),label,labelCF,maxNbSources_,tag,tagCF,mixProdStep2_));
84 
85  produces<CrossingFrame<SimTrack> >(labelCF);
86  }
87  //--------------------------------
88 
89  }else if (object=="SimVertexPCrossingFrame") {
90  InputTag tag;
91  if (tags.size()>0) tag=tags[0];
92  std::string label;
93  branchesActivate(TypeID(typeid(PCrossingFrame<SimVertex>)).friendlyClassName(),std::string(""),tag,label);
94 
95  LogInfo("MixingModule") <<"Will mix "<<object<<"s with InputTag "<<tag.encode()<<", label will be "<<label;
96  // std::cout <<"Will mix "<<object<<"s with InputTag "<<tag.encode()<<", label will be "<<label << std::endl ;
97 
98  //---------------------------------
99  // set an appropriate label for the CrossingFrame
100  if (find(names.begin(), names.end(), "mixVertices") != names.end())
101  {
102  edm::ParameterSet psin=ps.getParameter<edm::ParameterSet>("mixVertices");
103  if (!psin.exists("type")) continue; //to allow replacement by empty pset
104  std::string object = psin.getParameter<std::string>("type");
105  std::vector<InputTag> tags=psin.getParameter<std::vector<InputTag> >("input");
106 
107  InputTag tagCF;
108  if (tags.size()>0) tagCF=tags[0];
109  std::string labelCF;
110 
111  branchesActivate(TypeID(typeid(std::vector<SimVertex>)).friendlyClassName(),std::string(""),tagCF,labelCF);
112  workersObjects_.push_back(new MixingWorker<SimVertex>(minBunch_,maxBunch_,bunchSpace_,std::string(""),label,labelCF,maxNbSources_,tag,tagCF,mixProdStep2_));
113 
114  produces<CrossingFrame<SimVertex> >(labelCF);
115  }
116  //---------------------------------
117  }
118 
119  else if (object=="HepMCProductPCrossingFrame") {
120  InputTag tag;
121  if (tags.size()>0) tag=tags[0];
122  std::string label;
123  branchesActivate(TypeID(typeid(PCrossingFrame<HepMCProduct>)).friendlyClassName(),std::string(""),tag,label);
124 
125  LogInfo("MixingModule") <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label;
126  // std::cout <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label<<std::endl;
127 
128  //---------------------------------
129  // set an appropriate label for the CrossingFrame
130  if (find(names.begin(), names.end(), "mixHepMC") != names.end())
131  {
132  edm::ParameterSet psin=ps.getParameter<edm::ParameterSet>("mixHepMC");
133  if (!psin.exists("type")) continue; //to allow replacement by empty pset
134  std::string object = psin.getParameter<std::string>("type");
135  std::vector<InputTag> tags=psin.getParameter<std::vector<InputTag> >("input");
136 
137  InputTag tagCF;
138  if (tags.size()>0) tagCF=tags[0];
139  std::string labelCF;
140 
141  branchesActivate(TypeID(typeid(HepMCProduct)).friendlyClassName(),std::string(""),tagCF,labelCF);
142  workersObjects_.push_back(new MixingWorker<HepMCProduct>(minBunch_,maxBunch_,bunchSpace_,std::string(""),label,labelCF,maxNbSources_,tag,tagCF,mixProdStep2_));
143 
144  produces<CrossingFrame<HepMCProduct> >(labelCF);
145  }
146  //--------------------------------
147  }else if (object=="PCaloHitPCrossingFrame") {
148  std::vector<std::string> subdets=pset.getParameter<std::vector<std::string> >("subdets");
149  for (unsigned int ii=0;ii<subdets.size();ii++) {
150  InputTag tag;
151  if (tags.size()==1) tag=tags[0];
152  else if(tags.size()>1) tag=tags[ii];
153  std::string label;
154  branchesActivate(TypeID(typeid(PCrossingFrame<PCaloHit>)).friendlyClassName(),subdets[ii],tag,label);
155 
156  LogInfo("MixingModule") <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label;
157  // std::cout <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label<<std::endl;
158 
159  //---------------------------------
160  // set an appropriate label for the product CrossingFrame
161  if (find(names.begin(), names.end(), "mixCH") != names.end())
162  {
163  edm::ParameterSet psin=ps.getParameter<edm::ParameterSet>("mixCH");
164  if (!psin.exists("type")) continue; //to allow replacement by empty pset
165  std::string object = psin.getParameter<std::string>("type");
166  std::vector<InputTag> tags=psin.getParameter<std::vector<InputTag> >("input");
167 
168  InputTag tagCF;
169  if (tags.size()==1) tagCF=tags[0];
170  else if(tags.size()>1) tagCF=tags[ii];
171  std::string labelCF;
172 
173  branchesActivate(TypeID(typeid(std::vector<PCaloHit>)).friendlyClassName(),subdets[ii],tagCF,labelCF);
174  workersObjects_.push_back(new MixingWorker<PCaloHit>(minBunch_,maxBunch_,bunchSpace_,subdets[ii],label,labelCF,maxNbSources_,tag,tagCF,mixProdStep2_));
175 
176  produces<CrossingFrame<PCaloHit> > (labelCF);
177  }
178  //--------------------------------
179  }
180 
181  }else if (object=="PSimHitPCrossingFrame") {
182  std::vector<std::string> subdets=pset.getParameter<std::vector<std::string> >("subdets");
183  for (unsigned int ii=0;ii<subdets.size();ii++) {
184  InputTag tag;
185  if (tags.size()==1) tag=tags[0];
186  else if(tags.size()>1) tag=tags[ii];
187  std::string label;
188  branchesActivate(TypeID(typeid(PCrossingFrame<PSimHit>)).friendlyClassName(),subdets[ii],tag,label);
189 
190  LogInfo("MixingModule") <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label;
191  // std::cout <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label<<std::endl;
192 
193 
194  //---------------------------------
195  // set an appropriate label for the CrossingFrame
196  if (find(names.begin(), names.end(), "mixSH") != names.end())
197  {
198  edm::ParameterSet psin=ps.getParameter<edm::ParameterSet>("mixSH");
199  if (!psin.exists("type")) continue; //to allow replacement by empty pset
200  std::string object = psin.getParameter<std::string>("type");
201  std::vector<InputTag> tags=psin.getParameter<std::vector<InputTag> >("input");
202 
203  InputTag tagCF;
204  if (tags.size()==1) tagCF=tags[0];
205  else if(tags.size()>1) tagCF=tags[ii];
206  std::string labelCF;
207  branchesActivate(TypeID(typeid(std::vector<PSimHit>)).friendlyClassName(),subdets[ii],tagCF,labelCF);
208  workersObjects_.push_back(new MixingWorker<PSimHit>(minBunch_,maxBunch_,bunchSpace_,subdets[ii],label,labelCF,maxNbSources_,tag,tagCF,mixProdStep2_));
209 
210  produces<CrossingFrame<PSimHit> > (labelCF);
211  }
212  //-------------------------------
213  }
214 
215  }
216  }//mixProdStep2
217 
218 
219  if (!mixProdStep2_){
220 
221  InputTag tagCF = InputTag();
222  std::string labelCF = " ";
223 
224  //SimTracks
225  if (object=="SimTrack") {
226  InputTag tag;
227  if (tags.size()>0) tag=tags[0];
228  std::string label;
229 
230  branchesActivate(TypeID(typeid(std::vector<SimTrack>)).friendlyClassName(),std::string(""),tag,label);
231  workersObjects_.push_back(new MixingWorker<SimTrack>(minBunch_,maxBunch_,bunchSpace_,std::string(""),label,labelCF,maxNbSources_,tag,tagCF,mixProdStep2_));
232 
233  produces<CrossingFrame<SimTrack> >(label);
234  LogInfo("MixingModule") <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label;
235  // std::cout <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label<<std::endl;
236 
237 
238  }else if (object=="SimVertex") {
239  InputTag tag;
240  if (tags.size()>0) tag=tags[0];
241  std::string label;
242 
243  branchesActivate(TypeID(typeid(std::vector<SimVertex>)).friendlyClassName(),std::string(""),tag,label);
244 
245  workersObjects_.push_back(new MixingWorker<SimVertex>(minBunch_,maxBunch_,bunchSpace_,std::string(""),label,labelCF,maxNbSources_,tag,tagCF,mixProdStep2_));
246  produces<CrossingFrame<SimVertex> >(label);
247  LogInfo("MixingModule") <<"Will mix "<<object<<"s with InputTag "<<tag.encode()<<", label will be "<<label;
248  // std::cout <<"Will mix "<<object<<"s with InputTag "<<tag.encode()<<", label will be "<<label<<std::endl;
249 
250  }else if (object=="HepMCProduct") {
251  InputTag tag;
252  if (tags.size()>0) tag=tags[0];
253  std::string label;
254 
255  branchesActivate(TypeID(typeid(HepMCProduct)).friendlyClassName(),std::string(""),tag,label);
256  workersObjects_.push_back(new MixingWorker<HepMCProduct>(minBunch_,maxBunch_,bunchSpace_,std::string(""),label,labelCF,maxNbSources_,tag,tagCF,mixProdStep2_));
257 
258  produces<CrossingFrame<HepMCProduct> >(label);
259  LogInfo("MixingModule") <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label;
260  // std::cout <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label<<std::endl;
261 
262 
263  }else if (object=="PCaloHit") {
264  std::vector<std::string> subdets=pset.getParameter<std::vector<std::string> >("subdets");
265  for (unsigned int ii=0;ii<subdets.size();ii++) {
266  InputTag tag;
267  if (tags.size()==1) tag=tags[0];
268  else if(tags.size()>1) tag=tags[ii];
269  std::string label;
270 
271  branchesActivate(TypeID(typeid(std::vector<PCaloHit>)).friendlyClassName(),subdets[ii],tag,label);
272  workersObjects_.push_back(new MixingWorker<PCaloHit>(minBunch_,maxBunch_,bunchSpace_,subdets[ii],label,labelCF,maxNbSources_,tag,tagCF,mixProdStep2_));
273 
274  produces<CrossingFrame<PCaloHit> > (label);
275  LogInfo("MixingModule") <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label;
276  // std::cout <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label<<std::endl;
277 
278  }
279 
280  }else if (object=="PSimHit") {
281  std::vector<std::string> subdets=pset.getParameter<std::vector<std::string> >("subdets");
282  for (unsigned int ii=0;ii<subdets.size();ii++) {
283  InputTag tag;
284  if (tags.size()==1) tag=tags[0];
285  else if(tags.size()>1) tag=tags[ii];
286  std::string label;
287 
288  branchesActivate(TypeID(typeid(std::vector<PSimHit>)).friendlyClassName(),subdets[ii],tag,label);
289  workersObjects_.push_back(new MixingWorker<PSimHit>(minBunch_,maxBunch_,bunchSpace_,subdets[ii],label,labelCF,maxNbSources_,tag,tagCF,mixProdStep2_));
290 
291  produces<CrossingFrame<PSimHit> > (label);
292  LogInfo("MixingModule") <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label;
293  // std::cout <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label<<std::endl;
294  }
295  }
296  else LogWarning("MixingModule") <<"You have asked to mix an unknown type of object("<<object<<").\n If you want to include it in mixing, please contact the authors of the MixingModule!";
297  }//if for mixProdStep2
298  }//while over the mixObjects parameters
299 
301  for (unsigned int branch=0;branch<wantedBranches_.size();++branch) LogDebug("MixingModule")<<"Will keep branch "<<wantedBranches_[branch]<<" for mixing ";
302 
304 
305  produces<PileupMixingContent>();
306 
307  produces<CrossingFramePlaybackInfoExtended>();
308  }
#define LogDebug(id)
Selector * sel_
Definition: MixingModule.h:72
T getParameter(std::string const &) const
static const HistoName names[]
BMixingModule(const edm::ParameterSet &ps)
bool exists(std::string const &parameterName) const
checks if a parameter exists
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
std::string labelPlayback_
Definition: MixingModule.h:67
static std::string subdets[11]
static const unsigned int maxNbSources_
Definition: BMixingModule.h:79
std::vector< MixingWorkerBase * > workersObjects_
Definition: MixingModule.h:75
Functor that operates on &lt;T&gt;
Definition: Selector.h:25
bool useCurrentProcessOnly_
Definition: MixingModule.h:77
virtual void branchesActivate(const std::string &friendlyName, const std::string &subdet, InputTag &tag, std::string &label)
tuple tags
Definition: o2o.py:248
void sort_all(RandomAccessSequence &s)
wrappers for std::sort
Definition: Algorithms.h:120
std::vector< std::string > wantedBranches_
Definition: MixingModule.h:76
void dropUnwantedBranches(std::vector< std::string > const &wantedBranches)
MixingModule::~MixingModule ( )
virtual

Default destructor

Definition at line 363 of file MixingModule.cc.

References sel_, and workersObjects_.

363  {
364  for (unsigned int ii=0;ii<workersObjects_.size();ii++){
365  delete workersObjects_[ii];}
366  delete sel_;
367  }
Selector * sel_
Definition: MixingModule.h:72
std::vector< MixingWorkerBase * > workersObjects_
Definition: MixingModule.h:75

Member Function Documentation

void MixingModule::addSignals ( const edm::Event e,
const edm::EventSetup es 
)
privatevirtual

Reimplemented from edm::BMixingModule.

Definition at line 369 of file MixingModule.cc.

References edm::EventBase::id(), LogDebug, and workers_.

369  {
370  // fill in signal part of CrossingFrame
371 
372  LogDebug("MixingModule")<<"===============> adding signals for "<<e.id();
373  for (unsigned int ii=0;ii<workers_.size();ii++){
374  workers_[ii]->addSignals(e);
375  }
376  }
#define LogDebug(id)
std::vector< MixingWorkerBase * > workers_
Definition: MixingModule.h:74
edm::EventID id() const
Definition: EventBase.h:56
virtual void edm::MixingModule::beginJob ( void  )
inlinevirtual

Reimplemented from edm::EDProducer.

Definition at line 54 of file MixingModule.h.

54 {}
void MixingModule::branchesActivate ( const std::string &  friendlyName,
const std::string &  subdet,
InputTag tag,
std::string &  label 
)
privatevirtual

Definition at line 324 of file MixingModule.cc.

References EgammaHLTValidationUtils::getProcessName(), edm::InputTag::instance(), edm::InputTag::label(), useCurrentProcessOnly_, and wantedBranches_.

Referenced by MixingModule().

324  {
325 
326  label=tag.label()+tag.instance();
327  wantedBranches_.push_back(friendlyName + '_' +
328  tag.label() + '_' +
329  tag.instance());
330 
331  //if useCurrentProcessOnly, we have to change the input tag
333  const std::string processName = edm::Service<edm::service::TriggerNamesService>()->getProcessName();
334  tag = InputTag(tag.label(),tag.instance(),processName);
335  }
336 
337  }
std::string friendlyName(std::string const &iFullName)
bool useCurrentProcessOnly_
Definition: MixingModule.h:77
std::vector< std::string > wantedBranches_
Definition: MixingModule.h:76
void MixingModule::checkSignal ( const edm::Event e)
privatevirtual

Reimplemented from edm::BMixingModule.

Definition at line 340 of file MixingModule.cc.

References workers_, and workersObjects_.

340  {
341  if (workers_.size()==0){
342  for (unsigned int ii=0;ii<workersObjects_.size();ii++){
343  if (workersObjects_[ii]->checkSignal(e)){
344  workers_.push_back(workersObjects_[ii]);
345  }
346  }
347  }
348  }
virtual void checkSignal(const edm::Event &e)
std::vector< MixingWorkerBase * > workers_
Definition: MixingModule.h:74
std::vector< MixingWorkerBase * > workersObjects_
Definition: MixingModule.h:75
void MixingModule::createnewEDProduct ( )
privatevirtual

Reimplemented from edm::BMixingModule.

Definition at line 351 of file MixingModule.cc.

References edm::BMixingModule::maxBunch_, edm::BMixingModule::maxNbSources_, edm::BMixingModule::minBunch_, playbackInfo_, and workers_.

351  {
352  //create playback info
354 
355  //and CrossingFrames
356  for (unsigned int ii=0;ii<workers_.size();ii++){
357  workers_[ii]->createnewEDProduct();
358  }
359  }
std::vector< MixingWorkerBase * > workers_
Definition: MixingModule.h:74
static const unsigned int maxNbSources_
Definition: BMixingModule.h:79
CrossingFramePlaybackInfoExtended * playbackInfo_
Definition: MixingModule.h:70
void MixingModule::doPileUp ( edm::Event e,
const edm::EventSetup es 
)
privatevirtual

Reimplemented from edm::BMixingModule.

Definition at line 395 of file MixingModule.cc.

References edm::hlt::Exception, edm::Event::get(), edm::EventBase::id(), edm::BMixingModule::inputSources_, edm::BMixingModule::maxBunch_, edm::BMixingModule::maxNbSources_, edm::BMixingModule::minBunch_, mixProdStep2_, pileAllWorkers(), edm::BMixingModule::playback_, playbackInfo_, edm::Event::put(), sel_, CrossingFramePlaybackInfoExtended::setStartEventId(), LaserTracksInput_cfi::source, edm::BMixingModule::TrueNumInteractions_, and workers_.

396  {
397  // Don't allocate because PileUp will do it for us.
398  std::vector<edm::EventID> recordEventID;
400  if (playback_) {
401  bool got=e.get((*sel_), playbackInfo_H);
402  if (!got) {
403  throw cms::Exception("MixingProductNotFound") << " No "
404  "CrossingFramePlaybackInfoExtended on the input file, but playback "
405  "option set!!!!! Please change the input file if you really want "
406  "playback!!!!!!" << endl;
407  }
408  }
409 
410  // source[0] is "real" pileup. Check to see that this is what we are doing.
411 
412  std::vector<int> PileupList;
413  PileupList.clear();
414  TrueNumInteractions_.clear();
415 
416  boost::shared_ptr<PileUp> source0 = inputSources_[0];
417 
418  if( (source0 && source0->doPileUp() ) && !playback_ ) {
419  // if( (!inputSources_[0] || !inputSources_[0]->doPileUp()) && !playback_ ) {
420 
421  // Pre-calculate all pileup distributions before we go fishing for events
422 
423  source0->CalculatePileup(minBunch_, maxBunch_, PileupList, TrueNumInteractions_);
424 
425  }
426 
427  // for (int bunchIdx = minBunch_; bunchIdx <= maxBunch_; ++bunchIdx) {
428  // std::cout << " bunch ID, Pileup, True " << bunchIdx << " " << PileupList[bunchIdx-minBunch_] << " " << TrueNumInteractions_[bunchIdx-minBunch_] << std::endl;
429  //}
430 
431  int KeepTrackOfPileup = 0;
432 
433  for (int bunchIdx = minBunch_; bunchIdx <= maxBunch_; ++bunchIdx) {
434  for ( size_t setBcrIdx=0; setBcrIdx<workers_.size(); setBcrIdx++) {
435  workers_[setBcrIdx]->setBcrOffset();
436  }
437 
438  for ( size_t readSrcIdx=0; readSrcIdx<maxNbSources_; readSrcIdx++ ) {
439  boost::shared_ptr<PileUp> source = inputSources_[readSrcIdx]; // this looks like we create
440  // new PileUp objects for each
441  // source for each event?
442  // Why?
443 
444  for ( size_t setSrcIdx=0; setSrcIdx<workers_.size(); setSrcIdx++) {
445  workers_[setSrcIdx]->setSourceOffset(readSrcIdx);
446  }
447  if (!source || !source->doPileUp()) continue;
448 
449  int NumPU_Events = 0;
450 
451  if(readSrcIdx ==0 && !playback_) { NumPU_Events = PileupList[bunchIdx - minBunch_];}
452  else { NumPU_Events = 1;} // non-minbias pileup only gets one event for now. Fix later if desired.
453 
454  // int eventId = 0;
455  int vertexOffset = 0;
456 
457  if (!playback_) {
458  inputSources_[readSrcIdx]->readPileUp(e.id(), recordEventID,
459  boost::bind(&MixingModule::pileAllWorkers, boost::ref(*this), _1, bunchIdx,
460  _2, vertexOffset), NumPU_Events
461  );
462  playbackInfo_->setStartEventId(recordEventID, readSrcIdx, bunchIdx, KeepTrackOfPileup);
463  KeepTrackOfPileup+=NumPU_Events;
464  } else {
465  int dummyId = 0 ;
466  const std::vector<edm::EventID>& playEventID =
467  playbackInfo_H->getStartEventId(readSrcIdx, bunchIdx);
468  if(readSrcIdx == 0) {
469  PileupList.push_back(playEventID.size());
470  TrueNumInteractions_.push_back(playEventID.size());
471  }
472  inputSources_[readSrcIdx]->playPileUp(
473  playEventID,
474  boost::bind(&MixingModule::pileAllWorkers, boost::ref(*this), _1, bunchIdx,
475  dummyId, vertexOffset)
476  );
477  }
478  }
479  }
480 
481  // Keep track of pileup accounting...
482 
483  std::auto_ptr< PileupMixingContent > PileupMixing_;
484 
485  std::vector<int> numInteractionList;
486  std::vector<int> bunchCrossingList;
487  std::vector<float> TrueInteractionList;
488 
489  //Makin' a list: Basically, we don't care about the "other" sources at this point.
490  for (int bunchCrossing=minBunch_;bunchCrossing<=maxBunch_;++bunchCrossing) {
491  bunchCrossingList.push_back(bunchCrossing);
492  if(!inputSources_[0] || !inputSources_[0]->doPileUp()) {
493  numInteractionList.push_back(0);
494  TrueInteractionList.push_back(0);
495  }
496  else {
497  numInteractionList.push_back(PileupList[bunchCrossing-minBunch_]);
498  TrueInteractionList.push_back((TrueNumInteractions_)[bunchCrossing-minBunch_]);
499  }
500  }
501 
502 
503  PileupMixing_ = std::auto_ptr< PileupMixingContent >(new PileupMixingContent( bunchCrossingList,
504  numInteractionList,
505  TrueInteractionList));
506 
507  e.put(PileupMixing_);
508 
509 
510  // we have to do the ToF transformation for PSimHits once all pileup has been added
511  for (unsigned int ii=0;ii<workers_.size();ii++) {
512  //not apply setTof in Step2 mode because it was done in the Step1
513  if (!mixProdStep2_){
514  workers_[ii]->setTof();
515  }
516  workers_[ii]->put(e);
517  }
518  }
Selector * sel_
Definition: MixingModule.h:72
void pileAllWorkers(EventPrincipal const &ep, int bcr, int id, int &offset)
std::vector< float > TrueNumInteractions_
Definition: BMixingModule.h:82
void setStartEventId(const std::vector< edm::EventID > &id, const unsigned int s, const int bcr, const int start)
std::vector< MixingWorkerBase * > workers_
Definition: MixingModule.h:74
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:267
static const unsigned int maxNbSources_
Definition: BMixingModule.h:79
std::vector< boost::shared_ptr< PileUp > > inputSources_
Definition: BMixingModule.h:87
edm::EventID id() const
Definition: EventBase.h:56
CrossingFramePlaybackInfoExtended * playbackInfo_
Definition: MixingModule.h:70
virtual void doPileUp(edm::Event &e, const edm::EventSetup &es)
void MixingModule::pileAllWorkers ( EventPrincipal const &  ep,
int  bcr,
int  id,
int &  offset 
)
private

Definition at line 379 of file MixingModule.cc.

References edm::EventPrincipal::id(), LogDebug, edm::BMixingModule::vertexoffset, and workers_.

Referenced by doPileUp().

383  {
384  for (unsigned int ii=0;ii<workers_.size();ii++) {
385  LogDebug("MixingModule") <<" merging Event: id " << eventPrincipal.id();
386  // std::cout <<"PILEALLWORKERS merging Event: id " << eventPrincipal.id() << std::endl;
387 
388  workers_[ii]->addPileups(bunchCrossing,eventPrincipal,
389  // ++eventId,vertexoffset);
390  eventId,vertexoffset);
391  }
392  }
#define LogDebug(id)
static int vertexoffset
Definition: BMixingModule.h:70
std::vector< MixingWorkerBase * > workers_
Definition: MixingModule.h:74
void MixingModule::put ( edm::Event e,
const edm::EventSetup es 
)
privatevirtual

Reimplemented from edm::BMixingModule.

Definition at line 521 of file MixingModule.cc.

References playbackInfo_, and edm::Event::put().

521  {
522 
523  if (playbackInfo_) {
524  std::auto_ptr<CrossingFramePlaybackInfoExtended> pOut(playbackInfo_);
525  e.put(pOut);
526  }
527  }
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
CrossingFramePlaybackInfoExtended * playbackInfo_
Definition: MixingModule.h:70
void MixingModule::reload ( const edm::EventSetup setup)
virtual

Reimplemented from edm::BMixingModule.

Definition at line 310 of file MixingModule.cc.

References edm::BMixingModule::bunchSpace_, HDQMDatabaseProducer::config, edm::EventSetup::get(), edm::BMixingModule::maxBunch_, edm::BMixingModule::minBunch_, and workersObjects_.

310  {
311  //change the basic parameters.
313  setup.get<MixingRcd>().get(config);
314  minBunch_=config->minBunch();
315  maxBunch_=config->maxBunch();
316  bunchSpace_=config->bunchSpace();
317 
318  //propagate to change the workers
319  for (unsigned int ii=0;ii<workersObjects_.size();ii++){
320  workersObjects_[ii]->reload(setup);
321  }
322  }
std::vector< MixingWorkerBase * > workersObjects_
Definition: MixingModule.h:75
const T & get() const
Definition: EventSetup.h:55

Member Data Documentation

std::string edm::MixingModule::labelPlayback_
private

Definition at line 67 of file MixingModule.h.

Referenced by MixingModule().

bool edm::MixingModule::mixProdStep1_
private

Definition at line 69 of file MixingModule.h.

Referenced by MixingModule().

bool edm::MixingModule::mixProdStep2_
private

Definition at line 68 of file MixingModule.h.

Referenced by doPileUp(), and MixingModule().

CrossingFramePlaybackInfoExtended* edm::MixingModule::playbackInfo_
private

Definition at line 70 of file MixingModule.h.

Referenced by createnewEDProduct(), doPileUp(), and put().

Selector* edm::MixingModule::sel_
private

Definition at line 72 of file MixingModule.h.

Referenced by doPileUp(), MixingModule(), and ~MixingModule().

bool edm::MixingModule::useCurrentProcessOnly_
private

Definition at line 77 of file MixingModule.h.

Referenced by branchesActivate(), and MixingModule().

std::vector<std::string> edm::MixingModule::wantedBranches_
private

Definition at line 76 of file MixingModule.h.

Referenced by branchesActivate(), and MixingModule().

std::vector<MixingWorkerBase *> edm::MixingModule::workers_
private

Definition at line 74 of file MixingModule.h.

Referenced by addSignals(), checkSignal(), createnewEDProduct(), doPileUp(), and pileAllWorkers().

std::vector<MixingWorkerBase *> edm::MixingModule::workersObjects_
private

Definition at line 75 of file MixingModule.h.

Referenced by checkSignal(), MixingModule(), reload(), and ~MixingModule().