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::one::EDProducer< edm::one::SharedResources, edm::one::WatchRuns, edm::one::WatchLuminosityBlocks > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

typedef std::vector
< DigiAccumulatorMixMod * > 
Accumulators
 
- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- 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::one::EDProducer< edm::one::SharedResources, edm::one::WatchRuns, edm::one::WatchLuminosityBlocks >
 EDProducer ()=default
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- 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 ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) 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, edm::ConsumesCollector &iC)
 
virtual void createnewEDProduct ()
 
virtual void doPileUp (edm::Event &e, const edm::EventSetup &es)
 
void pileAllWorkers (EventPrincipal const &ep, ModuleCallingContext const *, int bcr, int id, int &offset, const edm::EventSetup &setup)
 
virtual void put (edm::Event &e, const edm::EventSetup &es)
 

Private Attributes

std::vector< AdjusterBase * > adjusters_
 
std::vector< AdjusterBase * > adjustersObjects_
 
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::one::EDProducerBase
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 () override
 
void setupPileUpEvent (const edm::EventSetup &setup)
 
void update (edm::EventSetup 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_
 
int vertexOffset_
 
- Static Protected Attributes inherited from edm::BMixingModule
static const unsigned int maxNbSources_ =4
 

Detailed Description

Definition at line 48 of file MixingModule.h.

Member Typedef Documentation

Definition at line 50 of file MixingModule.h.

Constructor & Destructor Documentation

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

standard constructor

Definition at line 36 of file MixingModule.cc.

References adjustersObjects_, edm::binary_search_all(), branchesActivate(), edm::BMixingModule::bunchSpace_, edm::EDConsumerBase::consumesCollector(), 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(), edm::InputTag::kSkipCurrentProcess, diffTwoXMLs::label, LogDebug, edm::BMixingModule::maxBunch_, edm::BMixingModule::maxNbSources_, edm::BMixingModule::minBunch_, mixProdStep1_, mixProdStep2_, cscdqm::h::names, edm::BMixingModule::playback_, edm::sort_all(), AlCaHLTBitMon_QueryRunRegistry::string, subdets, GlobalPosition_Frontier_DevDB_cff::tag, o2o::tags, useCurrentProcessOnly_, wantedBranches_, and workersObjects_.

36  :
37  BMixingModule(ps_mix),
39  mixProdStep2_(ps_mix.getParameter<bool>("mixProdStep2")),
40  mixProdStep1_(ps_mix.getParameter<bool>("mixProdStep1")),
42  {
43  if (!mixProdStep1_ && !mixProdStep2_) LogInfo("MixingModule") << " The MixingModule was run in the Standard mode.";
44  if (mixProdStep1_) LogInfo("MixingModule") << " The MixingModule was run in the Step1 mode. It produces a mixed secondary source.";
45  if (mixProdStep2_) LogInfo("MixingModule") << " The MixingModule was run in the Step2 mode. It uses a mixed secondary source.";
46 
48  if (ps_mix.exists("useCurrentProcessOnly")) {
49  useCurrentProcessOnly_=ps_mix.getParameter<bool>("useCurrentProcessOnly");
50  LogInfo("MixingModule") <<" using given Parameter 'useCurrentProcessOnly' ="<<useCurrentProcessOnly_;
51  }
52  std::string labelPlayback;
53  if (ps_mix.exists("LabelPlayback")) {
54  labelPlayback = ps_mix.getParameter<std::string>("LabelPlayback");
55  }
56  if (labelPlayback.empty()) {
57  labelPlayback = ps_mix.getParameter<std::string>("@module_label");
58  }
59  if (playback_) {
60  inputTagPlayback_ = InputTag(labelPlayback, "", edm::InputTag::kSkipCurrentProcess);
61  consumes<CrossingFramePlaybackInfoExtended>(inputTagPlayback_);
62  }
63 
64  ParameterSet ps=ps_mix.getParameter<ParameterSet>("mixObjects");
65  std::vector<std::string> names = ps.getParameterNames();
66  for(std::vector<std::string>::iterator it=names.begin();it!= names.end();++it) {
67  ParameterSet pset=ps.getParameter<ParameterSet>((*it));
68  if (!pset.exists("type")) continue; //to allow replacement by empty pset
69  std::string object = pset.getParameter<std::string>("type");
70  std::vector<InputTag> tags=pset.getParameter<std::vector<InputTag> >("input");
71 
72  //if (!mixProdStep2_) {
73 
74  InputTag tagCF = InputTag();
75  std::string labelCF = " ";
76 
77  if (object=="SimTrack") {
78  InputTag tag;
79  if (tags.size()>0) tag=tags[0];
81 
82  branchesActivate(TypeID(typeid(std::vector<SimTrack>)).friendlyClassName(),std::string(""),tag,label);
83  adjustersObjects_.push_back(new Adjuster<SimTrack>(tag));
84  bool makeCrossingFrame = pset.getUntrackedParameter<bool>("makeCrossingFrame", false);
85  if(makeCrossingFrame) {
87  produces<CrossingFrame<SimTrack> >(label);
88  consumes<std::vector<SimTrack> >(tag);
89  }
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=="RecoTrack") {
95  InputTag tag;
96  if (tags.size()>0) tag=tags[0];
98 
99  branchesActivate(TypeID(typeid(std::vector<reco::Track>)).friendlyClassName(),std::string(""),tag,label);
100  // note: no crossing frame is foreseen to be used for this object type
101 
102  LogInfo("MixingModule") <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label;
103  //std::cout <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label<<std::endl;
104 
105  } else if (object=="SimVertex") {
106  InputTag tag;
107  if (tags.size()>0) tag=tags[0];
109 
110  branchesActivate(TypeID(typeid(std::vector<SimVertex>)).friendlyClassName(),std::string(""),tag,label);
111  adjustersObjects_.push_back(new Adjuster<SimVertex>(tag));
112  bool makeCrossingFrame = pset.getUntrackedParameter<bool>("makeCrossingFrame", false);
113  if(makeCrossingFrame) {
115  produces<CrossingFrame<SimVertex> >(label);
116  consumes<std::vector<SimVertex> >(tag);
117  }
118 
119  LogInfo("MixingModule") <<"Will mix "<<object<<"s with InputTag "<<tag.encode()<<", label will be "<<label;
120  // std::cout <<"Will mix "<<object<<"s with InputTag "<<tag.encode()<<", label will be "<<label<<std::endl;
121 
122  } else if (object=="HepMCProduct") {
123  InputTag tag;
124  if (tags.size()>0) tag=tags[0];
126 
127  branchesActivate(TypeID(typeid(HepMCProduct)).friendlyClassName(),std::string(""),tag,label);
128  bool makeCrossingFrame = pset.getUntrackedParameter<bool>("makeCrossingFrame", false);
129  if(makeCrossingFrame) {
131  produces<CrossingFrame<HepMCProduct> >(label);
132  consumes<HepMCProduct>(tag);
133  }
134 
135  LogInfo("MixingModule") <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label;
136  // std::cout <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label<<std::endl;
137 
138  } else if (object=="PCaloHit") {
139  std::vector<std::string> subdets=pset.getParameter<std::vector<std::string> >("subdets");
140  std::vector<std::string> crossingFrames=pset.getUntrackedParameter<std::vector<std::string> >("crossingFrames", std::vector<std::string>());
141  sort_all(crossingFrames);
142  for (unsigned int ii=0;ii<subdets.size();++ii) {
143  InputTag tag;
144  if (tags.size()==1) tag=tags[0];
145  else if(tags.size()>1) tag=tags[ii];
147 
148  branchesActivate(TypeID(typeid(std::vector<PCaloHit>)).friendlyClassName(),subdets[ii],tag,label);
149  adjustersObjects_.push_back(new Adjuster<PCaloHit>(tag));
150  if(binary_search_all(crossingFrames, tag.instance())) {
152  produces<CrossingFrame<PCaloHit> >(label);
153  consumes<std::vector<PCaloHit> >(tag);
154  }
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 
161  } else if (object=="PSimHit") {
162  std::vector<std::string> subdets=pset.getParameter<std::vector<std::string> >("subdets");
163  std::vector<std::string> crossingFrames=pset.getUntrackedParameter<std::vector<std::string> >("crossingFrames", std::vector<std::string>());
164  sort_all(crossingFrames);
165  for (unsigned int ii=0;ii<subdets.size();++ii) {
166  InputTag tag;
167  if (tags.size()==1) tag=tags[0];
168  else if(tags.size()>1) tag=tags[ii];
170 
171  branchesActivate(TypeID(typeid(std::vector<PSimHit>)).friendlyClassName(),subdets[ii],tag,label);
172  adjustersObjects_.push_back(new Adjuster<PSimHit>(tag));
173  if(binary_search_all(crossingFrames, tag.instance())) {
175  produces<CrossingFrame<PSimHit> >(label);
176  consumes<std::vector<PSimHit> >(tag);
177  }
178 
179  LogInfo("MixingModule") <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label;
180  // std::cout <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label<<std::endl;
181  }
182  } else {
183  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!";
184  }
185  //} //if for mixProdStep2
186  }//while over the mixObjects parameters
187 
189  for (unsigned int branch=0;branch<wantedBranches_.size();++branch) LogDebug("MixingModule")<<"Will keep branch "<<wantedBranches_[branch]<<" for mixing ";
190 
192 
193  produces<PileupMixingContent>();
194 
195  produces<CrossingFramePlaybackInfoExtended>();
196 
198  // Create and configure digitizers
199  createDigiAccumulators(ps_mix, iC);
200  }
#define LogDebug(id)
T getParameter(std::string const &) const
static const HistoName names[]
void createDigiAccumulators(const edm::ParameterSet &mixingPSet, edm::ConsumesCollector &iC)
BMixingModule(const edm::ParameterSet &ps)
int ii
Definition: cuy.py:588
Accumulators digiAccumulators_
Definition: MixingModule.h:102
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
static const std::string kSkipCurrentProcess
Definition: InputTag.h:56
static const unsigned int maxNbSources_
Definition: BMixingModule.h:89
std::vector< MixingWorkerBase * > workersObjects_
Definition: MixingModule.h:97
bool useCurrentProcessOnly_
Definition: MixingModule.h:99
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:98
std::vector< AdjusterBase * > adjustersObjects_
Definition: MixingModule.h:95
InputTag inputTagPlayback_
Definition: MixingModule.h:89
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)
MixingModule::~MixingModule ( )
virtual

Default destructor

Definition at line 270 of file MixingModule.cc.

References adjustersObjects_, digiAccumulators_, and workersObjects_.

270  {
271  for (auto& worker : workersObjects_) {
272  delete worker;
273  }
274 
275  for (auto& adjuster : adjustersObjects_) {
276  delete adjuster;
277  }
278 
279  for (auto& digiAccumulator : digiAccumulators_) {
280  delete digiAccumulator;
281  }
282  }
Accumulators digiAccumulators_
Definition: MixingModule.h:102
std::vector< MixingWorkerBase * > workersObjects_
Definition: MixingModule.h:97
std::vector< AdjusterBase * > adjustersObjects_
Definition: MixingModule.h:95

Member Function Documentation

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

Definition at line 490 of file MixingModule.cc.

References digiAccumulators_.

Referenced by addSignals(), and pileAllWorkers().

490  {
491  for(Accumulators::const_iterator accItr = digiAccumulators_.begin(), accEnd = digiAccumulators_.end(); accItr != accEnd; ++accItr) {
492  (*accItr)->accumulate(event, setup);
493  }
494  }
Accumulators digiAccumulators_
Definition: MixingModule.h:102
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 497 of file MixingModule.cc.

References digiAccumulators_.

497  {
498  for(Accumulators::const_iterator accItr = digiAccumulators_.begin(), accEnd = digiAccumulators_.end(); accItr != accEnd; ++accItr) {
499  (*accItr)->accumulate(event, setup);
500  }
501  }
Accumulators digiAccumulators_
Definition: MixingModule.h:102
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 284 of file MixingModule.cc.

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

284  {
285 
286  LogDebug("MixingModule")<<"===============> adding signals for "<<e.id();
287 
289  // fill in signal part of CrossingFrame
290  for (unsigned int ii=0;ii<workers_.size();++ii) {
291  workers_[ii]->addSignals(e);
292  }
293  }
#define LogDebug(id)
int ii
Definition: cuy.py:588
std::vector< MixingWorkerBase * > workers_
Definition: MixingModule.h:96
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::BMixingModule.

Definition at line 58 of file MixingModule.h.

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

Reimplemented from edm::BMixingModule.

Definition at line 470 of file MixingModule.cc.

References digiAccumulators_.

470  {
471  for(Accumulators::const_iterator accItr = digiAccumulators_.begin(), accEnd = digiAccumulators_.end(); accItr != accEnd; ++accItr) {
472  (*accItr)->beginLuminosityBlock(lumi, setup);
473  }
474  }
tuple lumi
Definition: fjr2json.py:35
Accumulators digiAccumulators_
Definition: MixingModule.h:102
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 458 of file MixingModule.cc.

References digiAccumulators_.

458  {
459  for(Accumulators::const_iterator accItr = digiAccumulators_.begin(), accEnd = digiAccumulators_.end(); accItr != accEnd; ++accItr) {
460  (*accItr)->beginRun(run, setup);
461  }
462  }
Accumulators digiAccumulators_
Definition: MixingModule.h:102
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 229 of file MixingModule.cc.

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

Referenced by MixingModule().

229  {
230 
231  label=tag.label()+tag.instance();
232  wantedBranches_.push_back(friendlyName + '_' +
233  tag.label() + '_' +
234  tag.instance());
235 
236  //if useCurrentProcessOnly, we have to change the input tag
239  tag = InputTag(tag.label(),tag.instance(),processName);
240  }
241  }
std::string friendlyName(std::string const &iFullName)
bool useCurrentProcessOnly_
Definition: MixingModule.h:99
std::vector< std::string > wantedBranches_
Definition: MixingModule.h:98
void MixingModule::checkSignal ( const edm::Event e)
privatevirtual

Reimplemented from edm::BMixingModule.

Definition at line 243 of file MixingModule.cc.

References adjusters_, adjustersObjects_, workers_, and workersObjects_.

243  {
244  if (adjusters_.empty()){
245  for (auto const& adjuster : adjustersObjects_) {
246  if (adjuster->checkSignal(e)){
247  adjusters_.push_back(adjuster);
248  }
249  }
250  }
251  if (workers_.empty()){
252  for (auto const& worker : workersObjects_) {
253  if (worker->checkSignal(e)){
254  workers_.push_back(worker);
255  }
256  }
257  }
258  }
std::vector< MixingWorkerBase * > workers_
Definition: MixingModule.h:96
std::vector< AdjusterBase * > adjusters_
Definition: MixingModule.h:94
std::vector< MixingWorkerBase * > workersObjects_
Definition: MixingModule.h:97
std::vector< AdjusterBase * > adjustersObjects_
Definition: MixingModule.h:95
void MixingModule::createDigiAccumulators ( const edm::ParameterSet mixingPSet,
edm::ConsumesCollector iC 
)
private

Definition at line 203 of file MixingModule.cc.

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

Referenced by MixingModule().

203  {
204  ParameterSet const& digiPSet = mixingPSet.getParameterSet("digitizers");
205  std::vector<std::string> digiNames = digiPSet.getParameterNames();
206  for(auto const& digiName : digiNames) {
207  ParameterSet const& pset = digiPSet.getParameterSet(digiName);
208  std::auto_ptr<DigiAccumulatorMixMod> accumulator = std::auto_ptr<DigiAccumulatorMixMod>(DigiAccumulatorMixModFactory::get()->makeDigiAccumulator(pset, *this, iC));
209  // Create appropriate DigiAccumulator
210  if(accumulator.get() != 0) {
211  digiAccumulators_.push_back(accumulator.release());
212  }
213  }
214  }
std::auto_ptr< DigiAccumulatorMixMod > makeDigiAccumulator(ParameterSet const &, one::EDProducerBase &, ConsumesCollector &) const
Accumulators digiAccumulators_
Definition: MixingModule.h:102
ParameterSet const & getParameterSet(std::string const &) const
static DigiAccumulatorMixModFactory const * get()
void MixingModule::createnewEDProduct ( )
privatevirtual

Reimplemented from edm::BMixingModule.

Definition at line 260 of file MixingModule.cc.

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

260  {
261  //create playback info
263  //and CrossingFrames
264  for (unsigned int ii=0;ii<workers_.size();++ii){
265  workers_[ii]->createnewEDProduct();
266  }
267  }
int ii
Definition: cuy.py:588
std::vector< MixingWorkerBase * > workers_
Definition: MixingModule.h:96
static const unsigned int maxNbSources_
Definition: BMixingModule.h:89
CrossingFramePlaybackInfoExtended * playbackInfo_
Definition: MixingModule.h:92
void MixingModule::doPileUp ( edm::Event e,
const edm::EventSetup es 
)
privatevirtual

Reimplemented from edm::BMixingModule.

Definition at line 320 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_, edm::Event::moduleCallingContext(), pileAllWorkers(), edm::BMixingModule::playback_, playbackInfo_, edm::Event::put(), CrossingFramePlaybackInfoExtended::setStartEventId(), edm::source(), edm::BMixingModule::TrueNumInteractions_, and workers_.

320  {
321  // Don't allocate because PileUp will do it for us.
322  std::vector<edm::EventID> recordEventID;
324  if (playback_) {
325  bool got = e.getByLabel(inputTagPlayback_, playbackInfo_H);
326  if (!got) {
327  throw cms::Exception("MixingProductNotFound") << " No "
328  "CrossingFramePlaybackInfoExtended on the input file, but playback "
329  "option set!!!!! Please change the input file if you really want "
330  "playback!!!!!!" << std::endl;
331  }
332  }
333 
334  // source[0] is "real" pileup. Check to see that this is what we are doing.
335 
336  std::vector<int> PileupList;
337  PileupList.clear();
338  TrueNumInteractions_.clear();
339 
340  boost::shared_ptr<PileUp> source0 = inputSources_[0];
341 
342  if((source0 && source0->doPileUp() ) && !playback_) {
343  // if((!inputSources_[0] || !inputSources_[0]->doPileUp()) && !playback_ )
344 
345  // Pre-calculate all pileup distributions before we go fishing for events
346 
347  source0->CalculatePileup(minBunch_, maxBunch_, PileupList, TrueNumInteractions_);
348 
349  }
350 
351  // for (int bunchIdx = minBunch_; bunchIdx <= maxBunch_; ++bunchIdx) {
352  // std::cout << " bunch ID, Pileup, True " << bunchIdx << " " << PileupList[bunchIdx-minBunch_] << " " << TrueNumInteractions_[bunchIdx-minBunch_] << std::endl;
353  //}
354 
355  int KeepTrackOfPileup = 0;
356 
357  for (int bunchIdx = minBunch_; bunchIdx <= maxBunch_; ++bunchIdx) {
358  for (size_t setBcrIdx=0; setBcrIdx<workers_.size(); ++setBcrIdx) {
359  workers_[setBcrIdx]->setBcrOffset();
360  }
361  for(Accumulators::const_iterator accItr = digiAccumulators_.begin(), accEnd = digiAccumulators_.end(); accItr != accEnd; ++accItr) {
362  (*accItr)->initializeBunchCrossing(e, setup, bunchIdx);
363  }
364 
365  for (size_t readSrcIdx=0; readSrcIdx<maxNbSources_; ++readSrcIdx) {
366  boost::shared_ptr<PileUp> source = inputSources_[readSrcIdx]; // this looks like we create
367  // new PileUp objects for each
368  // source for each event?
369  // Why?
370  for (size_t setSrcIdx=0; setSrcIdx<workers_.size(); ++setSrcIdx) {
371  workers_[setSrcIdx]->setSourceOffset(readSrcIdx);
372  }
373 
374  if (!source || !source->doPileUp()) continue;
375 
376  int NumPU_Events = 0;
377 
378  if(readSrcIdx ==0 && !playback_) {
379  NumPU_Events = PileupList[bunchIdx - minBunch_];
380  } else {
381  NumPU_Events = 1;
382  } // non-minbias pileup only gets one event for now. Fix later if desired.
383 
384  // int eventId = 0;
385  int vertexOffset = 0;
386 
387  ModuleCallingContext const* mcc = e.moduleCallingContext();
388  if (!playback_) {
389  inputSources_[readSrcIdx]->readPileUp(e.id(), recordEventID,
390  boost::bind(&MixingModule::pileAllWorkers, boost::ref(*this), _1, mcc, bunchIdx,
391  _2, vertexOffset, boost::ref(setup)), NumPU_Events
392  );
393  playbackInfo_->setStartEventId(recordEventID, readSrcIdx, bunchIdx, KeepTrackOfPileup);
394  KeepTrackOfPileup+=NumPU_Events;
395  } else {
396  int dummyId = 0;
397  const std::vector<edm::EventID>& playEventID =
398  playbackInfo_H->getStartEventId(readSrcIdx, bunchIdx);
399  if(readSrcIdx == 0) {
400  PileupList.push_back(playEventID.size());
401  TrueNumInteractions_.push_back(playEventID.size());
402  }
403  inputSources_[readSrcIdx]->playPileUp(
404  playEventID,
405  boost::bind(&MixingModule::pileAllWorkers, boost::ref(*this), _1, mcc, bunchIdx,
406  dummyId, vertexOffset, boost::ref(setup))
407  );
408  }
409  }
410  for(Accumulators::const_iterator accItr = digiAccumulators_.begin(), accEnd = digiAccumulators_.end(); accItr != accEnd; ++accItr) {
411  (*accItr)->finalizeBunchCrossing(e, setup, bunchIdx);
412  }
413  }
414 
415  // Keep track of pileup accounting...
416 
417  std::auto_ptr<PileupMixingContent> PileupMixing_;
418 
419  std::vector<int> numInteractionList;
420  std::vector<int> bunchCrossingList;
421  std::vector<float> TrueInteractionList;
422 
423  //Makin' a list: Basically, we don't care about the "other" sources at this point.
424  for (int bunchCrossing=minBunch_;bunchCrossing<=maxBunch_;++bunchCrossing) {
425  bunchCrossingList.push_back(bunchCrossing);
426  if(!inputSources_[0] || !inputSources_[0]->doPileUp()) {
427  numInteractionList.push_back(0);
428  TrueInteractionList.push_back(0);
429  }
430  else {
431  numInteractionList.push_back(PileupList[bunchCrossing-minBunch_]);
432  TrueInteractionList.push_back((TrueNumInteractions_)[bunchCrossing-minBunch_]);
433  }
434  }
435 
436 
437  PileupMixing_ = std::auto_ptr<PileupMixingContent>(new PileupMixingContent(bunchCrossingList,
438  numInteractionList,
439  TrueInteractionList));
440 
441  e.put(PileupMixing_);
442 
443  // we have to do the ToF transformation for PSimHits once all pileup has been added
444  for (unsigned int ii=0;ii<workers_.size();++ii) {
445  workers_[ii]->setTof();
446  workers_[ii]->put(e);
447  }
448  }
static std::string const source("source")
std::vector< float > TrueNumInteractions_
Definition: BMixingModule.h:92
int ii
Definition: cuy.py:588
void setStartEventId(const std::vector< edm::EventID > &id, const unsigned int s, const int bcr, const int start)
ModuleCallingContext const * moduleCallingContext() const
Definition: Event.h:212
std::vector< MixingWorkerBase * > workers_
Definition: MixingModule.h:96
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
Accumulators digiAccumulators_
Definition: MixingModule.h:102
static const unsigned int maxNbSources_
Definition: BMixingModule.h:89
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
InputTag inputTagPlayback_
Definition: MixingModule.h:89
std::vector< boost::shared_ptr< PileUp > > inputSources_
Definition: BMixingModule.h:97
edm::EventID id() const
Definition: EventBase.h:56
CrossingFramePlaybackInfoExtended * playbackInfo_
Definition: MixingModule.h:92
void pileAllWorkers(EventPrincipal const &ep, ModuleCallingContext const *, int bcr, int id, int &offset, const edm::EventSetup &setup)
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 476 of file MixingModule.cc.

References digiAccumulators_.

476  {
477  for(Accumulators::const_iterator accItr = digiAccumulators_.begin(), accEnd = digiAccumulators_.end(); accItr != accEnd; ++accItr) {
478  (*accItr)->endLuminosityBlock(lumi, setup);
479  }
480  }
tuple lumi
Definition: fjr2json.py:35
Accumulators digiAccumulators_
Definition: MixingModule.h:102
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 464 of file MixingModule.cc.

References digiAccumulators_.

464  {
465  for(Accumulators::const_iterator accItr = digiAccumulators_.begin(), accEnd = digiAccumulators_.end(); accItr != accEnd; ++accItr) {
466  (*accItr)->endRun(run, setup);
467  }
468  }
Accumulators digiAccumulators_
Definition: MixingModule.h:102
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 504 of file MixingModule.cc.

References digiAccumulators_.

504  {
505  for(Accumulators::const_iterator accItr = digiAccumulators_.begin(), accEnd = digiAccumulators_.end(); accItr != accEnd; ++accItr) {
506  (*accItr)->finalizeEvent(event, setup);
507  }
508  }
Accumulators digiAccumulators_
Definition: MixingModule.h:102
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 483 of file MixingModule.cc.

References digiAccumulators_.

483  {
484  for(Accumulators::const_iterator accItr = digiAccumulators_.begin(), accEnd = digiAccumulators_.end(); accItr != accEnd; ++accItr) {
485  (*accItr)->initializeEvent(event, setup);
486  }
487  }
Accumulators digiAccumulators_
Definition: MixingModule.h:102
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,
ModuleCallingContext const *  mcc,
int  bcr,
int  id,
int &  offset,
const edm::EventSetup setup 
)
private

Definition at line 295 of file MixingModule.cc.

References accumulateEvent(), adjusters_, edm::BMixingModule::bunchSpace_, edm::EventPrincipal::id(), LogDebug, edm::one::EDProducerBase::moduleDescription(), and workers_.

Referenced by doPileUp().

299  {
300 
301  InternalContext internalContext(eventPrincipal.id(), mcc);
302  ParentContext parentContext(&internalContext);
303  ModuleCallingContext moduleCallingContext(&moduleDescription());
304  ModuleContextSentry moduleContextSentry(&moduleCallingContext, parentContext);
305 
306  for (auto const& adjuster : adjusters_) {
307  adjuster->doOffset(bunchSpace_, bunchCrossing, eventPrincipal, &moduleCallingContext, eventId, vertexOffset);
308  }
309  PileUpEventPrincipal pep(eventPrincipal, &moduleCallingContext, bunchCrossing);
310  accumulateEvent(pep, setup);
311 
312  for (auto const& worker : workers_) {
313  LogDebug("MixingModule") <<" merging Event: id " << eventPrincipal.id();
314  // std::cout <<"PILEALLWORKERS merging Event: id " << eventPrincipal.id() << std::endl;
315 
316  worker->addPileups(eventPrincipal, &moduleCallingContext, eventId);
317  }
318  }
#define LogDebug(id)
ModuleDescription const & moduleDescription() const
std::vector< MixingWorkerBase * > workers_
Definition: MixingModule.h:96
std::vector< AdjusterBase * > adjusters_
Definition: MixingModule.h:94
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 450 of file MixingModule.cc.

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

450  {
451 
452  if (playbackInfo_) {
453  std::auto_ptr<CrossingFramePlaybackInfoExtended> pOut(playbackInfo_);
454  e.put(pOut);
455  }
456  }
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
CrossingFramePlaybackInfoExtended * playbackInfo_
Definition: MixingModule.h:92
void MixingModule::reload ( const edm::EventSetup setup)
virtual

Reimplemented from edm::BMixingModule.

Definition at line 216 of file MixingModule.cc.

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

216  {
217  //change the basic parameters.
219  setup.get<MixingRcd>().get(config);
220  minBunch_=config->minBunch();
221  maxBunch_=config->maxBunch();
222  bunchSpace_=config->bunchSpace();
223  //propagate to change the workers
224  for (unsigned int ii=0;ii<workersObjects_.size();++ii){
225  workersObjects_[ii]->reload(setup);
226  }
227  }
int ii
Definition: cuy.py:588
std::vector< MixingWorkerBase * > workersObjects_
Definition: MixingModule.h:97
const T & get() const
Definition: EventSetup.h:55

Member Data Documentation

std::vector<AdjusterBase *> edm::MixingModule::adjusters_
private

Definition at line 94 of file MixingModule.h.

Referenced by checkSignal(), and pileAllWorkers().

std::vector<AdjusterBase *> edm::MixingModule::adjustersObjects_
private

Definition at line 95 of file MixingModule.h.

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

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

Definition at line 89 of file MixingModule.h.

Referenced by doPileUp(), and MixingModule().

bool edm::MixingModule::mixProdStep1_
private

Definition at line 91 of file MixingModule.h.

Referenced by MixingModule().

bool edm::MixingModule::mixProdStep2_
private

Definition at line 90 of file MixingModule.h.

Referenced by MixingModule().

CrossingFramePlaybackInfoExtended* edm::MixingModule::playbackInfo_
private

Definition at line 92 of file MixingModule.h.

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

bool edm::MixingModule::useCurrentProcessOnly_
private

Definition at line 99 of file MixingModule.h.

Referenced by branchesActivate(), and MixingModule().

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

Definition at line 98 of file MixingModule.h.

Referenced by branchesActivate(), and MixingModule().

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

Definition at line 96 of file MixingModule.h.

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

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

Definition at line 97 of file MixingModule.h.

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