CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | 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::EDConsumerBase edm::ProductRegistryHelper

Public Types

typedef std::vector
< DigiAccumulatorMixMod * > 
Accumulators
 
- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 

Public Member Functions

void accumulateEvent (Event const &event, EventSetup const &setup)
 
void accumulateEvent (PileUpEventPrincipal const &event, EventSetup const &setup)
 
virtual void beginJob ()
 
virtual void beginLuminosityBlock (LuminosityBlock const &l1, EventSetup const &c) override
 
virtual void beginRun (Run const &r1, EventSetup const &c) override
 
virtual void endLuminosityBlock (LuminosityBlock const &l1, EventSetup const &c) override
 
virtual void endRun (Run const &r1, EventSetup const &c) override
 
void finalizeEvent (Event &event, EventSetup const &setup)
 
void initializeEvent (Event const &event, EventSetup const &setup)
 
 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
 
 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) override
 
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 &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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)
 
void createDigiAccumulators (const edm::ParameterSet &mixingPSet)
 
virtual void createnewEDProduct ()
 
virtual void doPileUp (edm::Event &e, const edm::EventSetup &es)
 
void pileAllWorkers (EventPrincipal const &ep, int bcr, int id, int &offset, const edm::EventSetup &setup)
 
virtual void put (edm::Event &e, const edm::EventSetup &es)
 

Private Attributes

Accumulators digiAccumulators_
 
InputTag inputTagPlayback_
 
bool mixProdStep1_
 
bool mixProdStep2_
 
CrossingFramePlaybackInfoExtendedplaybackInfo_
 
bool useCurrentProcessOnly_
 
std::vector< std::string > wantedBranches_
 
std::vector< MixingWorkerBase * > workers_
 
std::vector< MixingWorkerBase * > workersObjects_
 

Additional Inherited Members

- 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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
- 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 45 of file MixingModule.h.

Member Typedef Documentation

Definition at line 47 of file MixingModule.h.

Constructor & Destructor Documentation

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

standard constructor

Definition at line 30 of file MixingModule.cc.

References edm::binary_search_all(), branchesActivate(), edm::BMixingModule::bunchSpace_, createDigiAccumulators(), edm::BMixingModule::dropUnwantedBranches(), edm::InputTag::encode(), edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNames(), edm::ParameterSet::getUntrackedParameter(), cuy::ii, inputTagPlayback_, edm::InputTag::instance(), diffTwoXMLs::label, LogDebug, edm::BMixingModule::maxBunch_, edm::BMixingModule::maxNbSources_, edm::BMixingModule::minBunch_, mixProdStep1_, mixProdStep2_, cscdqm::h::names, edm::sort_all(), AlCaHLTBitMon_QueryRunRegistry::string, subdets, GlobalPosition_Frontier_DevDB_cff::tag, o2o::tags, useCurrentProcessOnly_, wantedBranches_, and workersObjects_.

30  :
31  BMixingModule(ps_mix),
33  mixProdStep2_(ps_mix.getParameter<bool>("mixProdStep2")),
34  mixProdStep1_(ps_mix.getParameter<bool>("mixProdStep1")),
36  {
37  if (!mixProdStep1_ && !mixProdStep2_) LogInfo("MixingModule") << " The MixingModule was run in the Standard mode.";
38  if (mixProdStep1_) LogInfo("MixingModule") << " The MixingModule was run in the Step1 mode. It produces a mixed secondary source.";
39  if (mixProdStep2_) LogInfo("MixingModule") << " The MixingModule was run in the Step2 mode. It uses a mixed secondary source.";
40 
42  if (ps_mix.exists("useCurrentProcessOnly")) {
43  useCurrentProcessOnly_=ps_mix.getParameter<bool>("useCurrentProcessOnly");
44  LogInfo("MixingModule") <<" using given Parameter 'useCurrentProcessOnly' ="<<useCurrentProcessOnly_;
45  }
46  std::string labelPlayback;
47  if (ps_mix.exists("LabelPlayback")) {
48  labelPlayback = ps_mix.getParameter<std::string>("LabelPlayback");
49  }
50  if (labelPlayback.empty()) {
51  labelPlayback = ps_mix.getParameter<std::string>("@module_label");
52  }
53  inputTagPlayback_ = InputTag(labelPlayback, "");
54 
55  ParameterSet ps=ps_mix.getParameter<ParameterSet>("mixObjects");
56  std::vector<std::string> names = ps.getParameterNames();
57  for(std::vector<std::string>::iterator it=names.begin();it!= names.end();++it) {
58  ParameterSet pset=ps.getParameter<ParameterSet>((*it));
59  if (!pset.exists("type")) continue; //to allow replacement by empty pset
60  std::string object = pset.getParameter<std::string>("type");
61  std::vector<InputTag> tags=pset.getParameter<std::vector<InputTag> >("input");
62 
63  //if (!mixProdStep2_) {
64 
65  InputTag tagCF = InputTag();
66  std::string labelCF = " ";
67 
68  if (object=="SimTrack") {
69  InputTag tag;
70  if (tags.size()>0) tag=tags[0];
72 
73  branchesActivate(TypeID(typeid(std::vector<SimTrack>)).friendlyClassName(),std::string(""),tag,label);
74  bool makeCrossingFrame = pset.getUntrackedParameter<bool>("makeCrossingFrame", false);
75  if(makeCrossingFrame) {
77  produces<CrossingFrame<SimTrack> >(label);
78  }
79 
80  LogInfo("MixingModule") <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label;
81  // std::cout <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label<<std::endl;
82 
83  } else if (object=="RecoTrack") {
84  InputTag tag;
85  if (tags.size()>0) tag=tags[0];
87 
88  branchesActivate(TypeID(typeid(std::vector<reco::Track>)).friendlyClassName(),std::string(""),tag,label);
89  // note: no crossing frame is foreseen to be used for this object type
90 
91  LogInfo("MixingModule") <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label;
92  //std::cout <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label<<std::endl;
93 
94  } else if (object=="SimVertex") {
95  InputTag tag;
96  if (tags.size()>0) tag=tags[0];
98 
99  branchesActivate(TypeID(typeid(std::vector<SimVertex>)).friendlyClassName(),std::string(""),tag,label);
100  bool makeCrossingFrame = pset.getUntrackedParameter<bool>("makeCrossingFrame", false);
101  if(makeCrossingFrame) {
103  produces<CrossingFrame<SimVertex> >(label);
104  }
105 
106  LogInfo("MixingModule") <<"Will mix "<<object<<"s with InputTag "<<tag.encode()<<", label will be "<<label;
107  // std::cout <<"Will mix "<<object<<"s with InputTag "<<tag.encode()<<", label will be "<<label<<std::endl;
108 
109  } else if (object=="HepMCProduct") {
110  InputTag tag;
111  if (tags.size()>0) tag=tags[0];
113 
114  branchesActivate(TypeID(typeid(HepMCProduct)).friendlyClassName(),std::string(""),tag,label);
115  bool makeCrossingFrame = pset.getUntrackedParameter<bool>("makeCrossingFrame", false);
116  if(makeCrossingFrame) {
118  produces<CrossingFrame<HepMCProduct> >(label);
119  }
120 
121  LogInfo("MixingModule") <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label;
122  // std::cout <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label<<std::endl;
123 
124  } else if (object=="PCaloHit") {
125  std::vector<std::string> subdets=pset.getParameter<std::vector<std::string> >("subdets");
126  std::vector<std::string> crossingFrames=pset.getUntrackedParameter<std::vector<std::string> >("crossingFrames", std::vector<std::string>());
127  sort_all(crossingFrames);
128  for (unsigned int ii=0;ii<subdets.size();++ii) {
129  InputTag tag;
130  if (tags.size()==1) tag=tags[0];
131  else if(tags.size()>1) tag=tags[ii];
133 
134  branchesActivate(TypeID(typeid(std::vector<PCaloHit>)).friendlyClassName(),subdets[ii],tag,label);
135  if(binary_search_all(crossingFrames, tag.instance())) {
137  produces<CrossingFrame<PCaloHit> >(label);
138  }
139 
140  LogInfo("MixingModule") <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label;
141  // std::cout <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label<<std::endl;
142 
143  }
144 
145  } else if (object=="PSimHit") {
146  std::vector<std::string> subdets=pset.getParameter<std::vector<std::string> >("subdets");
147  std::vector<std::string> crossingFrames=pset.getUntrackedParameter<std::vector<std::string> >("crossingFrames", std::vector<std::string>());
148  sort_all(crossingFrames);
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];
154 
155  branchesActivate(TypeID(typeid(std::vector<PSimHit>)).friendlyClassName(),subdets[ii],tag,label);
156  if(binary_search_all(crossingFrames, tag.instance())) {
158  produces<CrossingFrame<PSimHit> >(label);
159  }
160 
161  LogInfo("MixingModule") <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label;
162  // std::cout <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label<<std::endl;
163  }
164  } else {
165  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!";
166  }
167  //} //if for mixProdStep2
168  }//while over the mixObjects parameters
169 
171  for (unsigned int branch=0;branch<wantedBranches_.size();++branch) LogDebug("MixingModule")<<"Will keep branch "<<wantedBranches_[branch]<<" for mixing ";
173 
174  produces<PileupMixingContent>();
175 
176  produces<CrossingFramePlaybackInfoExtended>();
177 
178  // Create and configure digitizers
179  createDigiAccumulators(ps_mix);
180  }
#define LogDebug(id)
T getParameter(std::string const &) const
static const HistoName names[]
BMixingModule(const edm::ParameterSet &ps)
int ii
Definition: cuy.py:588
Accumulators digiAccumulators_
Definition: MixingModule.h:97
static const unsigned int maxNbSources_
Definition: BMixingModule.h:87
std::vector< MixingWorkerBase * > workersObjects_
Definition: MixingModule.h:92
bool useCurrentProcessOnly_
Definition: MixingModule.h:94
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
constexpr char const * subdets[11]
std::vector< std::string > wantedBranches_
Definition: MixingModule.h:93
InputTag inputTagPlayback_
Definition: MixingModule.h:86
bool binary_search_all(ForwardSequence const &s, Datum const &d)
wrappers for std::binary_search
Definition: Algorithms.h:76
void dropUnwantedBranches(std::vector< std::string > const &wantedBranches)
void createDigiAccumulators(const edm::ParameterSet &mixingPSet)
MixingModule::~MixingModule ( )
virtual

Default destructor

Definition at line 243 of file MixingModule.cc.

References digiAccumulators_, cuy::ii, and workersObjects_.

243  {
244  for (unsigned int ii=0;ii<workersObjects_.size();++ii){
245  delete workersObjects_[ii];
246  }
247 
248  std::vector<DigiAccumulatorMixMod*>::const_iterator accItr = digiAccumulators_.begin();
249  std::vector<DigiAccumulatorMixMod*>::const_iterator accEnd = digiAccumulators_.end();
250  for (; accItr != accEnd; ++accItr) {
251  delete *accItr;
252  }
253  }
int ii
Definition: cuy.py:588
Accumulators digiAccumulators_
Definition: MixingModule.h:97
std::vector< MixingWorkerBase * > workersObjects_
Definition: MixingModule.h:92

Member Function Documentation

void MixingModule::accumulateEvent ( edm::Event const &  event,
edm::EventSetup const &  setup 
)

Definition at line 450 of file MixingModule.cc.

References digiAccumulators_.

Referenced by addSignals(), and pileAllWorkers().

450  {
451  for(Accumulators::const_iterator accItr = digiAccumulators_.begin(), accEnd = digiAccumulators_.end(); accItr != accEnd; ++accItr) {
452  (*accItr)->accumulate(event, setup);
453  }
454  }
Accumulators digiAccumulators_
Definition: MixingModule.h:97
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
void MixingModule::accumulateEvent ( PileUpEventPrincipal const &  event,
edm::EventSetup const &  setup 
)

Definition at line 457 of file MixingModule.cc.

References digiAccumulators_.

457  {
458  for(Accumulators::const_iterator accItr = digiAccumulators_.begin(), accEnd = digiAccumulators_.end(); accItr != accEnd; ++accItr) {
459  (*accItr)->accumulate(event, setup);
460  }
461  }
Accumulators digiAccumulators_
Definition: MixingModule.h:97
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
void MixingModule::addSignals ( const edm::Event e,
const edm::EventSetup es 
)
privatevirtual

Reimplemented from edm::BMixingModule.

Definition at line 255 of file MixingModule.cc.

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

255  {
256 
257  LogDebug("MixingModule")<<"===============> adding signals for "<<e.id();
258 
260  // fill in signal part of CrossingFrame
261  for (unsigned int ii=0;ii<workers_.size();++ii) {
262  workers_[ii]->addSignals(e);
263  }
264  }
#define LogDebug(id)
int ii
Definition: cuy.py:588
std::vector< MixingWorkerBase * > workers_
Definition: MixingModule.h:91
edm::EventID id() const
Definition: EventBase.h:56
void accumulateEvent(Event const &event, EventSetup const &setup)
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
virtual void edm::MixingModule::beginJob ( void  )
inlinevirtual

Reimplemented from edm::EDProducer.

Definition at line 55 of file MixingModule.h.

55 {}
void MixingModule::beginLuminosityBlock ( edm::LuminosityBlock const &  lumi,
edm::EventSetup const &  setup 
)
overridevirtual

Reimplemented from edm::BMixingModule.

Definition at line 430 of file MixingModule.cc.

References digiAccumulators_.

430  {
431  for(Accumulators::const_iterator accItr = digiAccumulators_.begin(), accEnd = digiAccumulators_.end(); accItr != accEnd; ++accItr) {
432  (*accItr)->beginLuminosityBlock(lumi, setup);
433  }
434  }
tuple lumi
Definition: fjr2json.py:35
Accumulators digiAccumulators_
Definition: MixingModule.h:97
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
void MixingModule::beginRun ( edm::Run const &  run,
edm::EventSetup const &  setup 
)
overridevirtual

Reimplemented from edm::BMixingModule.

Definition at line 418 of file MixingModule.cc.

References digiAccumulators_.

418  {
419  for(Accumulators::const_iterator accItr = digiAccumulators_.begin(), accEnd = digiAccumulators_.end(); accItr != accEnd; ++accItr) {
420  (*accItr)->beginRun(run, setup);
421  }
422  }
Accumulators digiAccumulators_
Definition: MixingModule.h:97
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
void MixingModule::branchesActivate ( const std::string &  friendlyName,
const std::string &  subdet,
InputTag tag,
std::string &  label 
)
privatevirtual

Definition at line 209 of file MixingModule.cc.

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

Referenced by MixingModule().

209  {
210 
211  label=tag.label()+tag.instance();
212  wantedBranches_.push_back(friendlyName + '_' +
213  tag.label() + '_' +
214  tag.instance());
215 
216  //if useCurrentProcessOnly, we have to change the input tag
219  tag = InputTag(tag.label(),tag.instance(),processName);
220  }
221  }
std::string friendlyName(std::string const &iFullName)
bool useCurrentProcessOnly_
Definition: MixingModule.h:94
std::vector< std::string > wantedBranches_
Definition: MixingModule.h:93
void MixingModule::checkSignal ( const edm::Event e)
privatevirtual

Reimplemented from edm::BMixingModule.

Definition at line 223 of file MixingModule.cc.

References cuy::ii, workers_, and workersObjects_.

223  {
224  if (workers_.empty()){
225  for (unsigned int ii=0;ii<workersObjects_.size();++ii){
226  if (workersObjects_[ii]->checkSignal(e)){
227  workers_.push_back(workersObjects_[ii]);
228  }
229  }
230  }
231  }
int ii
Definition: cuy.py:588
virtual void checkSignal(const edm::Event &e)
std::vector< MixingWorkerBase * > workers_
Definition: MixingModule.h:91
std::vector< MixingWorkerBase * > workersObjects_
Definition: MixingModule.h:92
void MixingModule::createDigiAccumulators ( const edm::ParameterSet mixingPSet)
private

Definition at line 183 of file MixingModule.cc.

References digiAccumulators_, edm::DigiAccumulatorMixModFactory::get(), edm::ParameterSet::getParameterNames(), edm::ParameterSet::getParameterSet(), and edm::DigiAccumulatorMixModFactory::makeDigiAccumulator().

Referenced by MixingModule().

183  {
184  ParameterSet const& digiPSet = mixingPSet.getParameterSet("digitizers");
185  std::vector<std::string> digiNames = digiPSet.getParameterNames();
186  for(auto const& digiName : digiNames) {
187  ParameterSet const& pset = digiPSet.getParameterSet(digiName);
188  std::auto_ptr<DigiAccumulatorMixMod> accumulator = std::auto_ptr<DigiAccumulatorMixMod>(DigiAccumulatorMixModFactory::get()->makeDigiAccumulator(pset, *this));
189  // Create appropriate DigiAccumulator
190  if(accumulator.get() != 0) {
191  digiAccumulators_.push_back(accumulator.release());
192  }
193  }
194  }
Accumulators digiAccumulators_
Definition: MixingModule.h:97
static DigiAccumulatorMixModFactory * get()
ParameterSet const & getParameterSet(std::string const &) const
std::auto_ptr< DigiAccumulatorMixMod > makeDigiAccumulator(ParameterSet const &, EDProducer &) const
void MixingModule::createnewEDProduct ( )
privatevirtual

Reimplemented from edm::BMixingModule.

Definition at line 233 of file MixingModule.cc.

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

233  {
234  //create playback info
236  //and CrossingFrames
237  for (unsigned int ii=0;ii<workers_.size();++ii){
238  workers_[ii]->createnewEDProduct();
239  }
240  }
int ii
Definition: cuy.py:588
std::vector< MixingWorkerBase * > workers_
Definition: MixingModule.h:91
static const unsigned int maxNbSources_
Definition: BMixingModule.h:87
CrossingFramePlaybackInfoExtended * playbackInfo_
Definition: MixingModule.h:89
void MixingModule::doPileUp ( edm::Event e,
const edm::EventSetup es 
)
privatevirtual

Reimplemented from edm::BMixingModule.

Definition at line 281 of file MixingModule.cc.

References digiAccumulators_, edm::hlt::Exception, edm::Event::getByLabel(), edm::EventBase::id(), cuy::ii, edm::BMixingModule::inputSources_, inputTagPlayback_, edm::BMixingModule::maxBunch_, edm::BMixingModule::maxNbSources_, edm::BMixingModule::minBunch_, pileAllWorkers(), edm::BMixingModule::playback_, playbackInfo_, edm::Event::put(), CrossingFramePlaybackInfoExtended::setStartEventId(), LaserTracksInput_cfi::source, edm::BMixingModule::TrueNumInteractions_, and workers_.

281  {
282  // Don't allocate because PileUp will do it for us.
283  std::vector<edm::EventID> recordEventID;
285  if (playback_) {
286  bool got = e.getByLabel(inputTagPlayback_, playbackInfo_H);
287  if (!got) {
288  throw cms::Exception("MixingProductNotFound") << " No "
289  "CrossingFramePlaybackInfoExtended on the input file, but playback "
290  "option set!!!!! Please change the input file if you really want "
291  "playback!!!!!!" << std::endl;
292  }
293  }
294 
295  // source[0] is "real" pileup. Check to see that this is what we are doing.
296 
297  std::vector<int> PileupList;
298  PileupList.clear();
299  TrueNumInteractions_.clear();
300 
301  boost::shared_ptr<PileUp> source0 = inputSources_[0];
302 
303  if((source0 && source0->doPileUp() ) && !playback_) {
304  // if((!inputSources_[0] || !inputSources_[0]->doPileUp()) && !playback_ )
305 
306  // Pre-calculate all pileup distributions before we go fishing for events
307 
308  source0->CalculatePileup(minBunch_, maxBunch_, PileupList, TrueNumInteractions_);
309 
310  }
311 
312  // for (int bunchIdx = minBunch_; bunchIdx <= maxBunch_; ++bunchIdx) {
313  // std::cout << " bunch ID, Pileup, True " << bunchIdx << " " << PileupList[bunchIdx-minBunch_] << " " << TrueNumInteractions_[bunchIdx-minBunch_] << std::endl;
314  //}
315 
316  int KeepTrackOfPileup = 0;
317 
318  for (int bunchIdx = minBunch_; bunchIdx <= maxBunch_; ++bunchIdx) {
319  for (size_t setBcrIdx=0; setBcrIdx<workers_.size(); ++setBcrIdx) {
320  workers_[setBcrIdx]->setBcrOffset();
321  }
322  for(Accumulators::const_iterator accItr = digiAccumulators_.begin(), accEnd = digiAccumulators_.end(); accItr != accEnd; ++accItr) {
323  (*accItr)->initializeBunchCrossing(e, setup, bunchIdx);
324  }
325 
326  for (size_t readSrcIdx=0; readSrcIdx<maxNbSources_; ++readSrcIdx) {
327  boost::shared_ptr<PileUp> source = inputSources_[readSrcIdx]; // this looks like we create
328  // new PileUp objects for each
329  // source for each event?
330  // Why?
331  for (size_t setSrcIdx=0; setSrcIdx<workers_.size(); ++setSrcIdx) {
332  workers_[setSrcIdx]->setSourceOffset(readSrcIdx);
333  }
334 
335  if (!source || !source->doPileUp()) continue;
336 
337  int NumPU_Events = 0;
338 
339  if(readSrcIdx ==0 && !playback_) {
340  NumPU_Events = PileupList[bunchIdx - minBunch_];
341  } else {
342  NumPU_Events = 1;
343  } // non-minbias pileup only gets one event for now. Fix later if desired.
344 
345  // int eventId = 0;
346  int vertexOffset = 0;
347 
348  if (!playback_) {
349  inputSources_[readSrcIdx]->readPileUp(e.id(), recordEventID,
350  boost::bind(&MixingModule::pileAllWorkers, boost::ref(*this), _1, bunchIdx,
351  _2, vertexOffset, boost::ref(setup)), NumPU_Events
352  );
353  playbackInfo_->setStartEventId(recordEventID, readSrcIdx, bunchIdx, KeepTrackOfPileup);
354  KeepTrackOfPileup+=NumPU_Events;
355  } else {
356  int dummyId = 0;
357  const std::vector<edm::EventID>& playEventID =
358  playbackInfo_H->getStartEventId(readSrcIdx, bunchIdx);
359  if(readSrcIdx == 0) {
360  PileupList.push_back(playEventID.size());
361  TrueNumInteractions_.push_back(playEventID.size());
362  }
363  inputSources_[readSrcIdx]->playPileUp(
364  playEventID,
365  boost::bind(&MixingModule::pileAllWorkers, boost::ref(*this), _1, bunchIdx,
366  dummyId, vertexOffset, boost::ref(setup))
367  );
368  }
369  }
370  for(Accumulators::const_iterator accItr = digiAccumulators_.begin(), accEnd = digiAccumulators_.end(); accItr != accEnd; ++accItr) {
371  (*accItr)->finalizeBunchCrossing(e, setup, bunchIdx);
372  }
373  }
374 
375  // Keep track of pileup accounting...
376 
377  std::auto_ptr<PileupMixingContent> PileupMixing_;
378 
379  std::vector<int> numInteractionList;
380  std::vector<int> bunchCrossingList;
381  std::vector<float> TrueInteractionList;
382 
383  //Makin' a list: Basically, we don't care about the "other" sources at this point.
384  for (int bunchCrossing=minBunch_;bunchCrossing<=maxBunch_;++bunchCrossing) {
385  bunchCrossingList.push_back(bunchCrossing);
386  if(!inputSources_[0] || !inputSources_[0]->doPileUp()) {
387  numInteractionList.push_back(0);
388  TrueInteractionList.push_back(0);
389  }
390  else {
391  numInteractionList.push_back(PileupList[bunchCrossing-minBunch_]);
392  TrueInteractionList.push_back((TrueNumInteractions_)[bunchCrossing-minBunch_]);
393  }
394  }
395 
396 
397  PileupMixing_ = std::auto_ptr<PileupMixingContent>(new PileupMixingContent(bunchCrossingList,
398  numInteractionList,
399  TrueInteractionList));
400 
401  e.put(PileupMixing_);
402 
403  // we have to do the ToF transformation for PSimHits once all pileup has been added
404  for (unsigned int ii=0;ii<workers_.size();++ii) {
405  workers_[ii]->setTof();
406  workers_[ii]->put(e);
407  }
408  }
void pileAllWorkers(EventPrincipal const &ep, int bcr, int id, int &offset, const edm::EventSetup &setup)
std::vector< float > TrueNumInteractions_
Definition: BMixingModule.h:90
int ii
Definition: cuy.py:588
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:91
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
Accumulators digiAccumulators_
Definition: MixingModule.h:97
static const unsigned int maxNbSources_
Definition: BMixingModule.h:87
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
InputTag inputTagPlayback_
Definition: MixingModule.h:86
std::vector< boost::shared_ptr< PileUp > > inputSources_
Definition: BMixingModule.h:95
edm::EventID id() const
Definition: EventBase.h:56
CrossingFramePlaybackInfoExtended * playbackInfo_
Definition: MixingModule.h:89
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
virtual void doPileUp(edm::Event &e, const edm::EventSetup &es)
void MixingModule::endLuminosityBlock ( edm::LuminosityBlock const &  lumi,
edm::EventSetup const &  setup 
)
overridevirtual

Reimplemented from edm::BMixingModule.

Definition at line 436 of file MixingModule.cc.

References digiAccumulators_.

436  {
437  for(Accumulators::const_iterator accItr = digiAccumulators_.begin(), accEnd = digiAccumulators_.end(); accItr != accEnd; ++accItr) {
438  (*accItr)->endLuminosityBlock(lumi, setup);
439  }
440  }
tuple lumi
Definition: fjr2json.py:35
Accumulators digiAccumulators_
Definition: MixingModule.h:97
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
void MixingModule::endRun ( edm::Run const &  run,
edm::EventSetup const &  setup 
)
overridevirtual

Reimplemented from edm::BMixingModule.

Definition at line 424 of file MixingModule.cc.

References digiAccumulators_.

424  {
425  for(Accumulators::const_iterator accItr = digiAccumulators_.begin(), accEnd = digiAccumulators_.end(); accItr != accEnd; ++accItr) {
426  (*accItr)->endRun(run, setup);
427  }
428  }
Accumulators digiAccumulators_
Definition: MixingModule.h:97
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
void MixingModule::finalizeEvent ( edm::Event event,
edm::EventSetup const &  setup 
)
virtual

Reimplemented from edm::BMixingModule.

Definition at line 464 of file MixingModule.cc.

References digiAccumulators_.

464  {
465  for(Accumulators::const_iterator accItr = digiAccumulators_.begin(), accEnd = digiAccumulators_.end(); accItr != accEnd; ++accItr) {
466  (*accItr)->finalizeEvent(event, setup);
467  }
468  }
Accumulators digiAccumulators_
Definition: MixingModule.h:97
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
void MixingModule::initializeEvent ( edm::Event const &  event,
edm::EventSetup const &  setup 
)
virtual

Reimplemented from edm::BMixingModule.

Definition at line 443 of file MixingModule.cc.

References digiAccumulators_.

443  {
444  for(Accumulators::const_iterator accItr = digiAccumulators_.begin(), accEnd = digiAccumulators_.end(); accItr != accEnd; ++accItr) {
445  (*accItr)->initializeEvent(event, setup);
446  }
447  }
Accumulators digiAccumulators_
Definition: MixingModule.h:97
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
void MixingModule::pileAllWorkers ( EventPrincipal const &  ep,
int  bcr,
int  id,
int &  offset,
const edm::EventSetup setup 
)
private

Definition at line 266 of file MixingModule.cc.

References accumulateEvent(), edm::BMixingModule::bunchSpace_, edm::EventPrincipal::id(), cuy::ii, LogDebug, edm::BMixingModule::vertexoffset, and workers_.

Referenced by doPileUp().

269  {
270  PileUpEventPrincipal pep(eventPrincipal, bunchCrossing, bunchSpace_, eventId, vertexOffset);
271  accumulateEvent(pep, setup);
272 
273  for (unsigned int ii=0;ii<workers_.size();++ii) {
274  LogDebug("MixingModule") <<" merging Event: id " << eventPrincipal.id();
275  // std::cout <<"PILEALLWORKERS merging Event: id " << eventPrincipal.id() << std::endl;
276 
277  workers_[ii]->addPileups(bunchCrossing,eventPrincipal, eventId, vertexoffset);
278  }
279  }
#define LogDebug(id)
static int vertexoffset
Definition: BMixingModule.h:78
int ii
Definition: cuy.py:588
std::vector< MixingWorkerBase * > workers_
Definition: MixingModule.h:91
void accumulateEvent(Event const &event, EventSetup const &setup)
void MixingModule::put ( edm::Event e,
const edm::EventSetup es 
)
privatevirtual

Reimplemented from edm::BMixingModule.

Definition at line 410 of file MixingModule.cc.

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

410  {
411 
412  if (playbackInfo_) {
413  std::auto_ptr<CrossingFramePlaybackInfoExtended> pOut(playbackInfo_);
414  e.put(pOut);
415  }
416  }
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
CrossingFramePlaybackInfoExtended * playbackInfo_
Definition: MixingModule.h:89
void MixingModule::reload ( const edm::EventSetup setup)
virtual

Reimplemented from edm::BMixingModule.

Definition at line 196 of file MixingModule.cc.

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

196  {
197  //change the basic parameters.
199  setup.get<MixingRcd>().get(config);
200  minBunch_=config->minBunch();
201  maxBunch_=config->maxBunch();
202  bunchSpace_=config->bunchSpace();
203  //propagate to change the workers
204  for (unsigned int ii=0;ii<workersObjects_.size();++ii){
205  workersObjects_[ii]->reload(setup);
206  }
207  }
int ii
Definition: cuy.py:588
std::vector< MixingWorkerBase * > workersObjects_
Definition: MixingModule.h:92
const T & get() const
Definition: EventSetup.h:55

Member Data Documentation

Accumulators edm::MixingModule::digiAccumulators_
private
InputTag edm::MixingModule::inputTagPlayback_
private

Definition at line 86 of file MixingModule.h.

Referenced by doPileUp(), and MixingModule().

bool edm::MixingModule::mixProdStep1_
private

Definition at line 88 of file MixingModule.h.

Referenced by MixingModule().

bool edm::MixingModule::mixProdStep2_
private

Definition at line 87 of file MixingModule.h.

Referenced by MixingModule().

CrossingFramePlaybackInfoExtended* edm::MixingModule::playbackInfo_
private

Definition at line 89 of file MixingModule.h.

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

bool edm::MixingModule::useCurrentProcessOnly_
private

Definition at line 94 of file MixingModule.h.

Referenced by branchesActivate(), and MixingModule().

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

Definition at line 93 of file MixingModule.h.

Referenced by branchesActivate(), and MixingModule().

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

Definition at line 91 of file MixingModule.h.

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

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

Definition at line 92 of file MixingModule.h.

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