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>();
276 for (
auto const& digiName : digiNames) {
281 std::unique_ptr<DigiAccumulatorMixMod>
accumulator = std::unique_ptr<DigiAccumulatorMixMod>(
355 delete digiAccumulator;
364 LogDebug(
"MixingModule") <<
"===============> adding signals for " <<
e.id();
386 adjuster->doOffset(
bunchSpace_, bunchCrossing, eventPrincipal, &moduleCallingContext, eventId, vertexOffset);
392 for (
auto const& worker :
workers_) {
393 LogDebug(
"MixingModule") <<
" merging Event: id " << eventPrincipal.
id();
396 worker->addPileups(eventPrincipal, &moduleCallingContext, eventId);
403 using namespace std::placeholders;
406 std::vector<edm::SecondaryEventIDAndFileInfo> recordEventID;
407 std::vector<size_t> sizes;
409 size_t playbackCounter = 0
U;
412 bool oldFormatPlayback =
false;
420 "CrossingFramePlaybackInfoNew on the input file, but playback "
421 "option set!!!!! Please change the input file if you really want "
425 oldFormatPlayback =
true;
431 std::vector<int> PileupList;
437 if ((source0 && source0->doPileUp(0)) && !
playback_) {
448 std::vector<int> numInteractionList;
450 std::vector<float> TrueInteractionList;
451 std::vector<edm::EventID> eventInfoList;
458 numInteractionList.push_back(0);
459 TrueInteractionList.push_back(0);
461 numInteractionList.push_back(PileupList[bunchCrossing -
minBunch_]);
468 for (
size_t readSrcIdx = 0; readSrcIdx <
maxNbSources_; ++readSrcIdx) {
469 if (oldFormatPlayback) {
470 std::vector<edm::EventID>
const& playEventID =
472 size_t numberOfEvents = playEventID.size();
473 if (readSrcIdx == 0) {
474 PileupList.push_back(numberOfEvents);
476 numInteractionList.push_back(numberOfEvents);
477 TrueInteractionList.push_back(numberOfEvents);
481 if (readSrcIdx == 0) {
482 PileupList.push_back(numberOfEvents);
484 numInteractionList.push_back(numberOfEvents);
485 TrueInteractionList.push_back(numberOfEvents);
495 (*accItr)->StorePileupInformation(
504 for (
size_t setBcrIdx = 0; setBcrIdx <
workers_.size(); ++setBcrIdx) {
505 workers_[setBcrIdx]->setBcrOffset();
510 (*accItr)->initializeBunchCrossing(
e,
setup, bunchIdx);
513 for (
size_t readSrcIdx = 0; readSrcIdx <
maxNbSources_; ++readSrcIdx) {
518 for (
size_t setSrcIdx = 0; setSrcIdx <
workers_.size(); ++setSrcIdx) {
519 workers_[setSrcIdx]->setSourceOffset(readSrcIdx);
531 int vertexOffset = 0;
536 int numberOfEvents = (readSrcIdx == 0 ? PileupList[bunchIdx -
minBunch_] : 1);
537 sizes.push_back(numberOfEvents);
551 }
else if (oldFormatPlayback) {
552 std::vector<edm::EventID>
const& playEventID = oldFormatPlaybackInfo_H->
getStartEventId(readSrcIdx, bunchIdx);
553 size_t numberOfEvents = playEventID.size();
554 if (readSrcIdx == 0) {
555 PileupList.push_back(numberOfEvents);
558 sizes.push_back(numberOfEvents);
559 std::vector<EventID>::const_iterator begin = playEventID.begin();
560 std::vector<EventID>::const_iterator
end = playEventID.end();
575 if (readSrcIdx == 0) {
576 PileupList.push_back(numberOfEvents);
579 sizes.push_back(numberOfEvents);
580 std::vector<SecondaryEventIDAndFileInfo>::const_iterator begin = playbackInfo_H->
getEventId(playbackCounter);
581 playbackCounter += numberOfEvents;
582 std::vector<SecondaryEventIDAndFileInfo>::const_iterator
end = playbackInfo_H->
getEventId(playbackCounter);
600 (*accItr)->finalizeBunchCrossing(
e,
setup, bunchIdx);
605 for (
auto const item : recordEventID) {
606 eventInfoList.emplace_back(
item.eventID());
614 std::unique_ptr<PileupMixingContent> PileupMixing_;
616 PileupMixing_ = std::make_unique<PileupMixingContent>(
657 (*accItr)->beginLuminosityBlock(
lumi,
setup);
666 (*accItr)->endLuminosityBlock(
lumi,
setup);
693 (*accItr)->accumulate(
event,
setup, streamID);