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>(
354 delete digiAccumulator;
363 LogDebug(
"MixingModule") <<
"===============> adding signals for " <<
e.id();
385 adjuster->doOffset(
bunchSpace_, bunchCrossing, eventPrincipal, &moduleCallingContext, eventId, vertexOffset);
391 for (
auto const& worker :
workers_) {
392 LogDebug(
"MixingModule") <<
" merging Event: id " << eventPrincipal.
id();
395 worker->addPileups(eventPrincipal, &moduleCallingContext, eventId);
402 using namespace std::placeholders;
405 std::vector<edm::SecondaryEventIDAndFileInfo> recordEventID;
406 std::vector<size_t> sizes;
408 size_t playbackCounter = 0
U;
411 bool oldFormatPlayback =
false;
419 "CrossingFramePlaybackInfoNew on the input file, but playback "
420 "option set!!!!! Please change the input file if you really want "
424 oldFormatPlayback =
true;
430 std::vector<int> PileupList;
436 if ((source0 && source0->doPileUp(0)) && !
playback_) {
447 std::vector<int> numInteractionList;
449 std::vector<float> TrueInteractionList;
450 std::vector<edm::EventID> eventInfoList;
457 numInteractionList.push_back(0);
458 TrueInteractionList.push_back(0);
460 numInteractionList.push_back(PileupList[bunchCrossing -
minBunch_]);
467 for (
size_t readSrcIdx = 0; readSrcIdx <
maxNbSources_; ++readSrcIdx) {
468 if (oldFormatPlayback) {
469 std::vector<edm::EventID>
const& playEventID =
471 size_t numberOfEvents = playEventID.size();
472 if (readSrcIdx == 0) {
473 PileupList.push_back(numberOfEvents);
475 numInteractionList.push_back(numberOfEvents);
476 TrueInteractionList.push_back(numberOfEvents);
480 if (readSrcIdx == 0) {
481 PileupList.push_back(numberOfEvents);
483 numInteractionList.push_back(numberOfEvents);
484 TrueInteractionList.push_back(numberOfEvents);
494 (*accItr)->StorePileupInformation(
503 for (
size_t setBcrIdx = 0; setBcrIdx <
workers_.size(); ++setBcrIdx) {
504 workers_[setBcrIdx]->setBcrOffset();
509 (*accItr)->initializeBunchCrossing(
e,
setup, bunchIdx);
512 for (
size_t readSrcIdx = 0; readSrcIdx <
maxNbSources_; ++readSrcIdx) {
517 for (
size_t setSrcIdx = 0; setSrcIdx <
workers_.size(); ++setSrcIdx) {
518 workers_[setSrcIdx]->setSourceOffset(readSrcIdx);
530 int vertexOffset = 0;
535 int numberOfEvents = (readSrcIdx == 0 ? PileupList[bunchIdx -
minBunch_] : 1);
536 sizes.push_back(numberOfEvents);
550 }
else if (oldFormatPlayback) {
551 std::vector<edm::EventID>
const& playEventID = oldFormatPlaybackInfo_H->
getStartEventId(readSrcIdx, bunchIdx);
552 size_t numberOfEvents = playEventID.size();
553 if (readSrcIdx == 0) {
554 PileupList.push_back(numberOfEvents);
557 sizes.push_back(numberOfEvents);
558 std::vector<EventID>::const_iterator begin = playEventID.begin();
559 std::vector<EventID>::const_iterator
end = playEventID.end();
574 if (readSrcIdx == 0) {
575 PileupList.push_back(numberOfEvents);
578 sizes.push_back(numberOfEvents);
579 std::vector<SecondaryEventIDAndFileInfo>::const_iterator begin = playbackInfo_H->
getEventId(playbackCounter);
580 playbackCounter += numberOfEvents;
581 std::vector<SecondaryEventIDAndFileInfo>::const_iterator
end = playbackInfo_H->
getEventId(playbackCounter);
599 (*accItr)->finalizeBunchCrossing(
e,
setup, bunchIdx);
604 for (
auto const item : recordEventID) {
605 eventInfoList.emplace_back(
item.eventID());
613 std::unique_ptr<PileupMixingContent> PileupMixing_;
629 std::unique_ptr<CrossingFramePlaybackInfoNew> pOut(
playbackInfo_);
656 (*accItr)->beginLuminosityBlock(
lumi,
setup);
665 (*accItr)->endLuminosityBlock(
lumi,
setup);
692 (*accItr)->accumulate(
event,
setup, streamID);