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 ~MixingModule ()
 
- Public Member Functions inherited from edm::BMixingModule
double averageNumber () const
 
 BMixingModule (const edm::ParameterSet &ps)
 
void merge (const int bcr, const EventPrincipalVector &vec, unsigned int worker, const edm::EventSetup &c)
 
bool poisson () const
 
virtual void produce (edm::Event &e1, const edm::EventSetup &c)
 
virtual void setBcrOffset ()
 
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 addPileups (const int bcr, EventPrincipal *, unsigned int EventId, unsigned int worker, const edm::EventSetup &e)
 
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)
 
virtual void getEventStartInfo (edm::Event &e, const unsigned int s)
 
virtual void put (edm::Event &e, const edm::EventSetup &es)
 
virtual void setEventStartInfo (const unsigned int s)
 

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::BMixingModule
typedef
PileUp::EventPrincipalVector 
EventPrincipalVector
 
- 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)
 
- Protected Member Functions inherited from edm::BMixingModule
void dropUnwantedBranches (std::vector< std::string > const &wantedBranches)
 
virtual void endJob ()
 
- 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]
 
std::vector< edm::EventIDeventIDs_
 
std::vector< int > fileSeqNrs_
 
int const maxBunch_
 
int const minBunch_
 
bool const mixProdStep1_
 
bool const mixProdStep2_
 
std::vector< unsigned int > nrEvents_
 
std::vector< EventPrincipalVectorpileup_ [4]
 
bool playback_
 
std::vector< std::vector
< edm::EventID > > 
vectorEventIDs_
 
- 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(), label, labelPlayback_, LogDebug, edm::BMixingModule::maxBunch_, edm::BMixingModule::maxNbSources_, edm::BMixingModule::minBunch_, mixProdStep1_, mixProdStep2_, h::names, CrabTask::pset, 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 
68  //---------------------------------
69  // set an appropriate label for the CrossingFrame
70  if (find(names.begin(), names.end(), "mixTracks") != names.end())
71  {
72  edm::ParameterSet psin=ps.getParameter<edm::ParameterSet>("mixTracks");
73  if (!psin.exists("type")) continue; //to allow replacement by empty pset
74  std::string object = psin.getParameter<std::string>("type");
75  std::vector<InputTag> tags=psin.getParameter<std::vector<InputTag> >("input");
76 
77  InputTag tagCF;
78  if (tags.size()>0) tagCF=tags[0];
79  std::string labelCF;
80 
81  branchesActivate(TypeID(typeid(std::vector<SimTrack>)).friendlyClassName(),std::string(""),tagCF,labelCF);
82  workersObjects_.push_back(new MixingWorker<SimTrack>(minBunch_,maxBunch_,bunchSpace_,std::string(""),label,labelCF,maxNbSources_,tag,tagCF,mixProdStep2_));
83 
84  produces<CrossingFrame<SimTrack> >(labelCF);
85  }
86  //--------------------------------
87 
88  }else if (object=="SimVertexPCrossingFrame") {
89  InputTag tag;
90  if (tags.size()>0) tag=tags[0];
91  std::string label;
92  branchesActivate(TypeID(typeid(PCrossingFrame<SimVertex>)).friendlyClassName(),std::string(""),tag,label);
93 
94  LogInfo("MixingModule") <<"Will mix "<<object<<"s with InputTag "<<tag.encode()<<", label will be "<<label;
95 
96  //---------------------------------
97  // set an appropriate label for the CrossingFrame
98  if (find(names.begin(), names.end(), "mixVertices") != names.end())
99  {
100  edm::ParameterSet psin=ps.getParameter<edm::ParameterSet>("mixVertices");
101  if (!psin.exists("type")) continue; //to allow replacement by empty pset
102  std::string object = psin.getParameter<std::string>("type");
103  std::vector<InputTag> tags=psin.getParameter<std::vector<InputTag> >("input");
104 
105  InputTag tagCF;
106  if (tags.size()>0) tagCF=tags[0];
107  std::string labelCF;
108 
109  branchesActivate(TypeID(typeid(std::vector<SimVertex>)).friendlyClassName(),std::string(""),tagCF,labelCF);
110  workersObjects_.push_back(new MixingWorker<SimVertex>(minBunch_,maxBunch_,bunchSpace_,std::string(""),label,labelCF,maxNbSources_,tag,tagCF,mixProdStep2_));
111 
112  produces<CrossingFrame<SimVertex> >(labelCF);
113  }
114  //---------------------------------
115  }
116 
117  else if (object=="HepMCProductPCrossingFrame") {
118  InputTag tag;
119  if (tags.size()>0) tag=tags[0];
120  std::string label;
121  branchesActivate(TypeID(typeid(PCrossingFrame<HepMCProduct>)).friendlyClassName(),std::string(""),tag,label);
122 
123  LogInfo("MixingModule") <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label;
124 
125  //---------------------------------
126  // set an appropriate label for the CrossingFrame
127  if (find(names.begin(), names.end(), "mixHepMC") != names.end())
128  {
129  edm::ParameterSet psin=ps.getParameter<edm::ParameterSet>("mixHepMC");
130  if (!psin.exists("type")) continue; //to allow replacement by empty pset
131  std::string object = psin.getParameter<std::string>("type");
132  std::vector<InputTag> tags=psin.getParameter<std::vector<InputTag> >("input");
133 
134  InputTag tagCF;
135  if (tags.size()>0) tagCF=tags[0];
136  std::string labelCF;
137 
138  branchesActivate(TypeID(typeid(HepMCProduct)).friendlyClassName(),std::string(""),tagCF,labelCF);
139  workersObjects_.push_back(new MixingWorker<HepMCProduct>(minBunch_,maxBunch_,bunchSpace_,std::string(""),label,labelCF,maxNbSources_,tag,tagCF,mixProdStep2_));
140 
141  produces<CrossingFrame<HepMCProduct> >(labelCF);
142  }
143  //--------------------------------
144  }else if (object=="PCaloHitPCrossingFrame") {
145  std::vector<std::string> subdets=pset.getParameter<std::vector<std::string> >("subdets");
146  for (unsigned int ii=0;ii<subdets.size();ii++) {
147  InputTag tag;
148  if (tags.size()==1) tag=tags[0];
149  else if(tags.size()>1) tag=tags[ii];
150  std::string label;
151  branchesActivate(TypeID(typeid(PCrossingFrame<PCaloHit>)).friendlyClassName(),subdets[ii],tag,label);
152 
153  LogInfo("MixingModule") <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label;
154 
155  //---------------------------------
156  // set an appropriate label for the product CrossingFrame
157  if (find(names.begin(), names.end(), "mixCH") != names.end())
158  {
159  edm::ParameterSet psin=ps.getParameter<edm::ParameterSet>("mixCH");
160  if (!psin.exists("type")) continue; //to allow replacement by empty pset
161  std::string object = psin.getParameter<std::string>("type");
162  std::vector<InputTag> tags=psin.getParameter<std::vector<InputTag> >("input");
163 
164  InputTag tagCF;
165  if (tags.size()==1) tagCF=tags[0];
166  else if(tags.size()>1) tagCF=tags[ii];
167  std::string labelCF;
168 
169  branchesActivate(TypeID(typeid(std::vector<PCaloHit>)).friendlyClassName(),subdets[ii],tagCF,labelCF);
170  workersObjects_.push_back(new MixingWorker<PCaloHit>(minBunch_,maxBunch_,bunchSpace_,subdets[ii],label,labelCF,maxNbSources_,tag,tagCF,mixProdStep2_));
171 
172  produces<CrossingFrame<PCaloHit> > (labelCF);
173  }
174  //--------------------------------
175  }
176 
177  }else if (object=="PSimHitPCrossingFrame") {
178  std::vector<std::string> subdets=pset.getParameter<std::vector<std::string> >("subdets");
179  for (unsigned int ii=0;ii<subdets.size();ii++) {
180  InputTag tag;
181  if (tags.size()==1) tag=tags[0];
182  else if(tags.size()>1) tag=tags[ii];
183  std::string label;
184  branchesActivate(TypeID(typeid(PCrossingFrame<PSimHit>)).friendlyClassName(),subdets[ii],tag,label);
185 
186  LogInfo("MixingModule") <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label;
187 
188 
189  //---------------------------------
190  // set an appropriate label for the CrossingFrame
191  if (find(names.begin(), names.end(), "mixSH") != names.end())
192  {
193  edm::ParameterSet psin=ps.getParameter<edm::ParameterSet>("mixSH");
194  if (!psin.exists("type")) continue; //to allow replacement by empty pset
195  std::string object = psin.getParameter<std::string>("type");
196  std::vector<InputTag> tags=psin.getParameter<std::vector<InputTag> >("input");
197 
198  InputTag tagCF;
199  if (tags.size()==1) tagCF=tags[0];
200  else if(tags.size()>1) tagCF=tags[ii];
201  std::string labelCF;
202  branchesActivate(TypeID(typeid(std::vector<PSimHit>)).friendlyClassName(),subdets[ii],tagCF,labelCF);
203  workersObjects_.push_back(new MixingWorker<PSimHit>(minBunch_,maxBunch_,bunchSpace_,subdets[ii],label,labelCF,maxNbSources_,tag,tagCF,mixProdStep2_));
204 
205  produces<CrossingFrame<PSimHit> > (labelCF);
206  }
207  //-------------------------------
208  }
209 
210  }
211  }//mixProdStep2
212 
213 
214  if (!mixProdStep2_){
215 
216  InputTag tagCF = InputTag();
217  std::string labelCF = " ";
218 
219  //SimTracks
220  if (object=="SimTrack") {
221  InputTag tag;
222  if (tags.size()>0) tag=tags[0];
223  std::string label;
224 
225  branchesActivate(TypeID(typeid(std::vector<SimTrack>)).friendlyClassName(),std::string(""),tag,label);
226  workersObjects_.push_back(new MixingWorker<SimTrack>(minBunch_,maxBunch_,bunchSpace_,std::string(""),label,labelCF,maxNbSources_,tag,tagCF,mixProdStep2_));
227 
228  produces<CrossingFrame<SimTrack> >(label);
229  LogInfo("MixingModule") <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label;
230 
231 
232  }else if (object=="SimVertex") {
233  InputTag tag;
234  if (tags.size()>0) tag=tags[0];
235  std::string label;
236 
237  branchesActivate(TypeID(typeid(std::vector<SimVertex>)).friendlyClassName(),std::string(""),tag,label);
238 
239  workersObjects_.push_back(new MixingWorker<SimVertex>(minBunch_,maxBunch_,bunchSpace_,std::string(""),label,labelCF,maxNbSources_,tag,tagCF,mixProdStep2_));
240  produces<CrossingFrame<SimVertex> >(label);
241  LogInfo("MixingModule") <<"Will mix "<<object<<"s with InputTag "<<tag.encode()<<", label will be "<<label;
242 
243  }else if (object=="HepMCProduct") {
244  InputTag tag;
245  if (tags.size()>0) tag=tags[0];
246  std::string label;
247 
248  branchesActivate(TypeID(typeid(HepMCProduct)).friendlyClassName(),std::string(""),tag,label);
249  workersObjects_.push_back(new MixingWorker<HepMCProduct>(minBunch_,maxBunch_,bunchSpace_,std::string(""),label,labelCF,maxNbSources_,tag,tagCF,mixProdStep2_));
250 
251  produces<CrossingFrame<HepMCProduct> >(label);
252  LogInfo("MixingModule") <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label;
253 
254 
255  }else if (object=="PCaloHit") {
256  std::vector<std::string> subdets=pset.getParameter<std::vector<std::string> >("subdets");
257  for (unsigned int ii=0;ii<subdets.size();ii++) {
258  InputTag tag;
259  if (tags.size()==1) tag=tags[0];
260  else if(tags.size()>1) tag=tags[ii];
261  std::string label;
262 
263  branchesActivate(TypeID(typeid(std::vector<PCaloHit>)).friendlyClassName(),subdets[ii],tag,label);
264  workersObjects_.push_back(new MixingWorker<PCaloHit>(minBunch_,maxBunch_,bunchSpace_,subdets[ii],label,labelCF,maxNbSources_,tag,tagCF,mixProdStep2_));
265 
266  produces<CrossingFrame<PCaloHit> > (label);
267  LogInfo("MixingModule") <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label;
268 
269  }
270 
271  }else if (object=="PSimHit") {
272  std::vector<std::string> subdets=pset.getParameter<std::vector<std::string> >("subdets");
273  for (unsigned int ii=0;ii<subdets.size();ii++) {
274  InputTag tag;
275  if (tags.size()==1) tag=tags[0];
276  else if(tags.size()>1) tag=tags[ii];
277  std::string label;
278 
279  branchesActivate(TypeID(typeid(std::vector<PSimHit>)).friendlyClassName(),subdets[ii],tag,label);
280  workersObjects_.push_back(new MixingWorker<PSimHit>(minBunch_,maxBunch_,bunchSpace_,subdets[ii],label,labelCF,maxNbSources_,tag,tagCF,mixProdStep2_));
281 
282  produces<CrossingFrame<PSimHit> > (label);
283  LogInfo("MixingModule") <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label;
284  }
285  }
286  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!";
287  }//if for mixProdStep2
288  }//while over the mixObjects parameters
289 
291  for (unsigned int branch=0;branch<wantedBranches_.size();++branch) LogDebug("MixingModule")<<"Will keep branch "<<wantedBranches_[branch]<<" for mixing ";
292 
294 
295  produces<PileupMixingContent>();
296 
297  produces<CrossingFramePlaybackInfoExtended>();
298  }
#define LogDebug(id)
Selector * sel_
Definition: MixingModule.h:72
T getParameter(std::string const &) const
const std::string & label
Definition: MVAComputer.cc:186
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
tuple pset
Definition: CrabTask.py:85
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)
static const HistoName names[]
MixingModule::~MixingModule ( )
virtual

Default destructor

Definition at line 340 of file MixingModule.cc.

References sel_, and workersObjects_.

340  {
341  for (unsigned int ii=0;ii<workersObjects_.size();ii++){
342  delete workersObjects_[ii];}
343  delete sel_;
344  }
Selector * sel_
Definition: MixingModule.h:72
std::vector< MixingWorkerBase * > workersObjects_
Definition: MixingModule.h:75

Member Function Documentation

void MixingModule::addPileups ( const int  bcr,
EventPrincipal ep,
unsigned int  EventId,
unsigned int  worker,
const edm::EventSetup e 
)
privatevirtual

Reimplemented from edm::BMixingModule.

Definition at line 406 of file MixingModule.cc.

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

406  {
407  // fill in pileup part of CrossingFrame
408  LogDebug("MixingModule") <<"\n===============> adding objects from event "<<ep->id()<<" for bunchcrossing "<<bcr;
409 
410  workers_[worker]->addPileups(bcr,ep,eventNr,vertexoffset);
411  }
#define LogDebug(id)
static int vertexoffset
Definition: BMixingModule.h:66
std::vector< MixingWorkerBase * > workers_
Definition: MixingModule.h:74
void MixingModule::addSignals ( const edm::Event e,
const edm::EventSetup es 
)
privatevirtual

Reimplemented from edm::BMixingModule.

Definition at line 346 of file MixingModule.cc.

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

346  {
347  // fill in signal part of CrossingFrame
348 
349  LogDebug("MixingModule")<<"===============> adding signals for "<<e.id();
350  for (unsigned int ii=0;ii<workers_.size();ii++){
351  workers_[ii]->addSignals(e);
352  }
353  }
#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 301 of file MixingModule.cc.

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

Referenced by MixingModule().

301  {
302 
303  label=tag.label()+tag.instance();
304  wantedBranches_.push_back(friendlyName + '_' +
305  tag.label() + '_' +
306  tag.instance());
307 
308  //if useCurrentProcessOnly, we have to change the input tag
310  const std::string processName = edm::Service<edm::service::TriggerNamesService>()->getProcessName();
311  tag = InputTag(tag.label(),tag.instance(),processName);
312  }
313 
314  }
const std::string & label
Definition: MVAComputer.cc:186
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 317 of file MixingModule.cc.

References workers_, and workersObjects_.

317  {
318  if (workers_.size()==0){
319  for (unsigned int ii=0;ii<workersObjects_.size();ii++){
320  if (workersObjects_[ii]->checkSignal(e)){
321  workers_.push_back(workersObjects_[ii]);
322  }
323  }
324  }
325  }
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 328 of file MixingModule.cc.

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

328  {
329  //create playback info
331 
332  //and CrossingFrames
333  for (unsigned int ii=0;ii<workers_.size();ii++){
334  workers_[ii]->createnewEDProduct();
335  }
336  }
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 355 of file MixingModule.cc.

References edm::BMixingModule::doit_, edm::BMixingModule::maxBunch_, edm::BMixingModule::maxNbSources_, edm::BMixingModule::merge(), edm::BMixingModule::minBunch_, mixProdStep2_, edm::BMixingModule::pileup_, edm::Event::put(), findQualityFiles::size, and workers_.

356  { // we first loop over workers
357  // in order not to keep all CrossingFrames in memory simultaneously
358  //
359  for (unsigned int ii=0;ii<workers_.size();ii++) {
360  // we have to loop over bunchcrossings first since added objects are all stored in one vector,
361  // ordered by bunchcrossing
362  for (int bunchCrossing=minBunch_;bunchCrossing<=maxBunch_;++bunchCrossing) {
363  workers_[ii]->setBcrOffset();
364  for (unsigned int isource=0;isource<maxNbSources_;++isource) {
365  workers_[ii]->setSourceOffset(isource);
366  if (doit_[isource]) {
367  merge(bunchCrossing, (pileup_[isource])[bunchCrossing-minBunch_],ii,setup);
368  }
369  }
370  }
371  }
372 
373  std::auto_ptr< PileupMixingContent > PileupMixing_;
374 
375  std::vector<int> bunchCrossingList;
376  std::vector<int> numInteractionList;
377 
378  //Makin' a list:
379  for (int bunchCrossing=minBunch_;bunchCrossing<=maxBunch_;++bunchCrossing) {
380  bunchCrossingList.push_back(bunchCrossing);
381  if(!doit_[0]) {
382  numInteractionList.push_back(0);
383  }
384  else {
385  numInteractionList.push_back(((pileup_[0])[bunchCrossing-minBunch_]).size());
386  }
387  }
388 
389 
390  PileupMixing_ = std::auto_ptr< PileupMixingContent >(new PileupMixingContent( bunchCrossingList,
391  numInteractionList));
392 
393  e.put(PileupMixing_);
394 
395 
396  // we have to do the ToF transformation for PSimHits once all pileup has been added
397  for (unsigned int ii=0;ii<workers_.size();ii++) {
398  //not apply setTof in Step2 mode because it was done in the Step1
399  if (!mixProdStep2_){
400  workers_[ii]->setTof();
401  }
402  workers_[ii]->put(e);
403  }
404  }
std::vector< EventPrincipalVector > pileup_[4]
Definition: BMixingModule.h:81
void merge(const int bcr, const EventPrincipalVector &vec, unsigned int worker, const edm::EventSetup &c)
std::vector< MixingWorkerBase * > workers_
Definition: MixingModule.h:74
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
static const unsigned int maxNbSources_
Definition: BMixingModule.h:79
tuple size
Write out results.
void MixingModule::getEventStartInfo ( edm::Event e,
const unsigned int  s 
)
privatevirtual

Reimplemented from edm::BMixingModule.

Definition at line 425 of file MixingModule.cc.

References edm::hlt::Exception, edm::Event::get(), edm::BMixingModule::playback_, sel_, and edm::BMixingModule::vectorEventIDs_.

425  {
426  if (playback_) {
427 
429  bool got=e.get((*sel_), playbackInfo_H);
430  if (got) {
431  playbackInfo_H->getEventStartInfo(vectorEventIDs_,s);
432  }else{
433  throw cms::Exception("MixingProductNotFound") << " No CrossingFramePlaybackInfoExtended on the input file, but playback option set!!!!! Please change the input file if you really want playback!!!!!!" << endl;
434  }
435  }
436  }
Selector * sel_
Definition: MixingModule.h:72
std::vector< std::vector< edm::EventID > > vectorEventIDs_
Definition: BMixingModule.h:76
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:267
string s
Definition: asciidump.py:422
void MixingModule::put ( edm::Event e,
const edm::EventSetup es 
)
privatevirtual

Reimplemented from edm::BMixingModule.

Definition at line 417 of file MixingModule.cc.

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

417  {
418 
419  if (playbackInfo_) {
420  std::auto_ptr<CrossingFramePlaybackInfoExtended> pOut(playbackInfo_);
421  e.put(pOut);
422  }
423  }
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
CrossingFramePlaybackInfoExtended * playbackInfo_
Definition: MixingModule.h:70
void MixingModule::setEventStartInfo ( const unsigned int  s)
privatevirtual

Reimplemented from edm::BMixingModule.

Definition at line 413 of file MixingModule.cc.

References playbackInfo_, CrossingFramePlaybackInfoExtended::setEventStartInfo(), and edm::BMixingModule::vectorEventIDs_.

413  {
415  }
void setEventStartInfo(std::vector< std::vector< edm::EventID > > &id, const unsigned int s)
std::vector< std::vector< edm::EventID > > vectorEventIDs_
Definition: BMixingModule.h:76
CrossingFramePlaybackInfoExtended * playbackInfo_
Definition: MixingModule.h:70
string s
Definition: asciidump.py:422

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(), put(), and setEventStartInfo().

Selector* edm::MixingModule::sel_
private

Definition at line 72 of file MixingModule.h.

Referenced by getEventStartInfo(), 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 addPileups(), addSignals(), checkSignal(), createnewEDProduct(), and doPileUp().

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

Definition at line 75 of file MixingModule.h.

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