44 mixProdStep2_(ps_mix.getParameter<
bool>(
"mixProdStep2")),
45 mixProdStep1_(ps_mix.getParameter<
bool>(
"mixProdStep1")),
48 LogInfo(
"MixingModule") <<
" The MixingModule was run in the Standard mode.";
50 LogInfo(
"MixingModule") <<
" The MixingModule was run in the Step1 mode. It produces a mixed secondary source.";
52 LogInfo(
"MixingModule") <<
" The MixingModule was run in the Step2 mode. It uses a mixed secondary source.";
55 if (ps_mix.
exists(
"useCurrentProcessOnly")) {
60 if (ps_mix.
exists(
"LabelPlayback")) {
63 if (labelPlayback.empty()) {
71 if (ps_mix.
exists(
"WrapLongTimes")) {
76 if (ps_mix.
exists(
"skipSignal")) {
82 for (std::vector<std::string>::iterator it =
names.begin(); it !=
names.end(); ++it) {
84 if (!
pset.exists(
"type"))
87 std::vector<InputTag>
tags =
pset.getParameter<std::vector<InputTag> >(
"input");
94 if (
object ==
"SimTrack") {
106 produces<CrossingFrame<SimTrack> >(
label);
108 consumes<std::vector<SimTrack> >(
tag);
110 LogInfo(
"MixingModule") <<
"Will mix " <<
object <<
"s with InputTag= " <<
tag.encode() <<
", label will be " 114 }
else if (
object ==
"RecoTrack") {
132 LogInfo(
"MixingModule") <<
"Will mix " <<
object <<
"s with InputTag= " <<
tag.encode() <<
", label will be " 136 }
else if (
object ==
"SimVertex") {
148 produces<CrossingFrame<SimVertex> >(
label);
150 consumes<std::vector<SimVertex> >(
tag);
152 LogInfo(
"MixingModule") <<
"Will mix " <<
object <<
"s with InputTag " <<
tag.encode() <<
", label will be " 156 }
else if (
object ==
"HepMCProduct") {
167 produces<CrossingFrame<HepMCProduct> >(
label);
169 consumes<HepMCProduct>(
tag);
171 LogInfo(
"MixingModule") <<
"Will mix " <<
object <<
"s with InputTag= " <<
tag.encode() <<
", label will be " 174 for (
size_t i = 1;
i <
tags.size(); ++
i) {
179 mayConsume<HepMCProduct>(fallbackTag);
182 }
else if (
object ==
"PCaloHit") {
183 std::vector<std::string>
subdets =
pset.getParameter<std::vector<std::string> >(
"subdets");
185 pset.getUntrackedParameter<std::vector<std::string> >(
"crossingFrames", std::vector<std::string>());
189 if (
tags.size() == 1)
191 else if (
tags.size() > 1)
200 produces<CrossingFrame<PCaloHit> >(
label);
201 consumes<std::vector<PCaloHit> >(
tag);
204 LogInfo(
"MixingModule") <<
"Will mix " <<
object <<
"s with InputTag= " <<
tag.encode() <<
", label will be " 209 }
else if (
object ==
"PSimHit") {
210 std::vector<std::string>
subdets =
pset.getParameter<std::vector<std::string> >(
"subdets");
212 pset.getUntrackedParameter<std::vector<std::string> >(
"crossingFrames", std::vector<std::string>());
215 pset.getUntrackedParameter<std::vector<std::string> >(
"pcrossingFrames", std::vector<std::string>());
219 if (
tags.size() == 1)
221 else if (
tags.size() > 1)
238 makePCrossingFrame));
239 produces<CrossingFrame<PSimHit> >(
label);
240 if (makePCrossingFrame) {
241 produces<PCrossingFrame<PSimHit> >(
label);
243 consumes<std::vector<PSimHit> >(
tag);
246 LogInfo(
"MixingModule") <<
"Will mix " <<
object <<
"s with InputTag= " <<
tag.encode() <<
", label will be " 252 <<
"You have asked to mix an unknown type of object(" <<
object 253 <<
").\n If you want to include it in mixing, please contact the authors of the MixingModule!";
264 produces<PileupMixingContent>();
266 produces<CrossingFramePlaybackInfoNew>();
270 configToken_ = esConsumes<edm::Transition::BeginLuminosityBlock>();
279 for (
auto const& digiName : digiNames) {
284 std::unique_ptr<DigiAccumulatorMixMod>
accumulator = std::unique_ptr<DigiAccumulatorMixMod>(
356 delete digiAccumulator;
365 LogDebug(
"MixingModule") <<
"===============> adding signals for " <<
e.id();
387 adjuster->doOffset(
bunchSpace_, bunchCrossing, eventPrincipal, &moduleCallingContext, eventId, vertexOffset);
393 for (
auto const& worker :
workers_) {
394 LogDebug(
"MixingModule") <<
" merging Event: id " << eventPrincipal.
id();
397 worker->addPileups(eventPrincipal, &moduleCallingContext, eventId);
407 std::vector<edm::SecondaryEventIDAndFileInfo> recordEventID;
408 std::vector<size_t> sizes;
410 size_t playbackCounter = 0
U;
413 bool oldFormatPlayback =
false;
421 "CrossingFramePlaybackInfoNew on the input file, but playback " 422 "option set!!!!! Please change the input file if you really want " 426 oldFormatPlayback =
true;
432 std::vector<int> PileupList;
438 if ((source0 && source0->doPileUp(0)) && !
playback_) {
449 std::vector<int> numInteractionList;
451 std::vector<float> TrueInteractionList;
452 std::vector<edm::EventID> eventInfoList;
459 numInteractionList.push_back(0);
460 TrueInteractionList.push_back(0);
462 numInteractionList.push_back(PileupList[bunchCrossing -
minBunch_]);
469 for (
size_t readSrcIdx = 0; readSrcIdx <
maxNbSources_; ++readSrcIdx) {
470 if (oldFormatPlayback) {
471 std::vector<edm::EventID>
const& playEventID =
473 size_t numberOfEvents = playEventID.size();
474 if (readSrcIdx == 0) {
475 PileupList.push_back(numberOfEvents);
477 numInteractionList.push_back(numberOfEvents);
478 TrueInteractionList.push_back(numberOfEvents);
482 if (readSrcIdx == 0) {
483 PileupList.push_back(numberOfEvents);
485 numInteractionList.push_back(numberOfEvents);
486 TrueInteractionList.push_back(numberOfEvents);
496 (*accItr)->StorePileupInformation(
505 for (
size_t setBcrIdx = 0; setBcrIdx <
workers_.size(); ++setBcrIdx) {
506 workers_[setBcrIdx]->setBcrOffset();
511 (*accItr)->initializeBunchCrossing(
e,
setup, bunchIdx);
514 for (
size_t readSrcIdx = 0; readSrcIdx <
maxNbSources_; ++readSrcIdx) {
519 for (
size_t setSrcIdx = 0; setSrcIdx <
workers_.size(); ++setSrcIdx) {
520 workers_[setSrcIdx]->setSourceOffset(readSrcIdx);
532 int vertexOffset = 0;
537 int numberOfEvents = (readSrcIdx == 0 ? PileupList[bunchIdx -
minBunch_] : 1);
538 sizes.push_back(numberOfEvents);
552 }
else if (oldFormatPlayback) {
553 std::vector<edm::EventID>
const& playEventID = oldFormatPlaybackInfo_H->
getStartEventId(readSrcIdx, bunchIdx);
554 size_t numberOfEvents = playEventID.size();
555 if (readSrcIdx == 0) {
556 PileupList.push_back(numberOfEvents);
559 sizes.push_back(numberOfEvents);
560 std::vector<EventID>::const_iterator begin = playEventID.begin();
561 std::vector<EventID>::const_iterator
end = playEventID.end();
576 if (readSrcIdx == 0) {
577 PileupList.push_back(numberOfEvents);
580 sizes.push_back(numberOfEvents);
581 std::vector<SecondaryEventIDAndFileInfo>::const_iterator begin = playbackInfo_H->
getEventId(playbackCounter);
582 playbackCounter += numberOfEvents;
583 std::vector<SecondaryEventIDAndFileInfo>::const_iterator
end = playbackInfo_H->
getEventId(playbackCounter);
601 (*accItr)->finalizeBunchCrossing(
e,
setup, bunchIdx);
606 for (
auto const item : recordEventID) {
607 eventInfoList.emplace_back(
item.eventID());
615 std::unique_ptr<PileupMixingContent> PileupMixing_;
617 PileupMixing_ = std::make_unique<PileupMixingContent>(
631 std::unique_ptr<CrossingFramePlaybackInfoNew> pOut(
playbackInfo_);
658 (*accItr)->beginLuminosityBlock(
lumi,
setup);
667 (*accItr)->endLuminosityBlock(
lumi,
setup);
694 (*accItr)->accumulate(
event,
setup, streamID);
void setInfo(std::vector< edm::SecondaryEventIDAndFileInfo > &eventInfo, std::vector< size_t > &sizes)
void beginRun(const edm::Run &r, const edm::EventSetup &setup) override
T getParameter(std::string const &) const
void beginLuminosityBlock(LuminosityBlock const &l1, EventSetup const &c) override
static std::string const source("source")
edm::ESGetToken< MixingModuleConfig, MixingRcd > configToken_
void createDigiAccumulators(const edm::ParameterSet &mixingPSet, edm::ConsumesCollector &iC)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
ParameterSet const & getParameterSet(std::string const &) const
void addSignals(const edm::Event &e, const edm::EventSetup &es) override
std::vector< AdjusterBase * > adjustersObjects_
std::vector< edm::EventID > getStartEventId(const unsigned int s, const int bcr) const
std::vector< AdjusterBase * > adjusters_
const std::string names[nVars_]
void endRun(const edm::Run &r, const edm::EventSetup &setup) override
void put(edm::Event &e, const edm::EventSetup &es) override
std::vector< MixingWorkerBase * > workers_
void reload(const edm::EventSetup &) override
std::string friendlyName(std::string const &iFullName)
void endLuminosityBlock(LuminosityBlock const &l1, EventSetup const &c) override
void checkSignal(const edm::Event &e) override
Accumulators digiAccumulators_
void initializeEvent(Event const &event, EventSetup const &setup) override
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
MixingModule(const edm::ParameterSet &ps, MixingCache::Config const *globalConf)
static const unsigned int maxNbSources_
std::vector< float > TrueNumInteractions_
void beginRun(Run const &r1, EventSetup const &c) override
size_t getNumberOfEvents(int bunchIdx, size_t sourceNumber) const
CrossingFramePlaybackInfoNew * playbackInfo_
def getProcessName(pdgGen, requiredNumberOfGeneratedObjects)
bool useCurrentProcessOnly_
virtual void branchesActivate(const std::string &friendlyName, const std::string &subdet, InputTag &tag, std::string &label)
Log< level::Info, false > LogInfo
std::unique_ptr< DigiAccumulatorMixMod > makeDigiAccumulator(ParameterSet const &, ProducesCollector, ConsumesCollector &) const
bool pileAllWorkers(EventPrincipal const &ep, ModuleCallingContext const *, int bcr, int id, int &offset, const edm::EventSetup &setup, edm::StreamID const &)
std::vector< edm::SecondaryEventIDAndFileInfo >::const_iterator getEventId(size_t offset) const
void sort_all(RandomAccessSequence &s)
wrappers for std::sort
std::vector< std::string > wantedBranches_
InputTag inputTagPlayback_
void accumulateEvent(Event const &event, EventSetup const &setup)
void createnewEDProduct() override
std::vector< std::shared_ptr< PileUp > > inputSources_
std::vector< MixingWorkerBase * > workersObjects_
bool binary_search_all(ForwardSequence const &s, Datum const &d)
wrappers for std::binary_search
void dropUnwantedBranches(std::vector< std::string > const &wantedBranches)
void finalizeEvent(Event &event, EventSetup const &setup) override
Log< level::Warning, false > LogWarning
void beginLuminosityBlock(const edm::LuminosityBlock &l, const edm::EventSetup &setup) override
EventID const & id() const
static const std::string subdets[7]
std::vector< std::string > getParameterNames() const
static DigiAccumulatorMixModFactory const * get()
void endLuminosityBlock(const edm::LuminosityBlock &l, const edm::EventSetup &setup) override
void doPileUp(edm::Event &e, const edm::EventSetup &es) override
void endRun(Run const &r1, EventSetup const &c) override