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")) {
77 for (std::vector<std::string>::iterator it =
names.begin(); it !=
names.end(); ++it) {
79 if (!
pset.exists(
"type"))
82 std::vector<InputTag>
tags =
pset.getParameter<std::vector<InputTag> >(
"input");
89 if (
object ==
"SimTrack") {
101 produces<CrossingFrame<SimTrack> >(
label);
103 consumes<std::vector<SimTrack> >(
tag);
105 LogInfo(
"MixingModule") <<
"Will mix " <<
object <<
"s with InputTag= " <<
tag.encode() <<
", label will be "
109 }
else if (
object ==
"RecoTrack") {
127 LogInfo(
"MixingModule") <<
"Will mix " <<
object <<
"s with InputTag= " <<
tag.encode() <<
", label will be "
131 }
else if (
object ==
"SimVertex") {
143 produces<CrossingFrame<SimVertex> >(
label);
145 consumes<std::vector<SimVertex> >(
tag);
147 LogInfo(
"MixingModule") <<
"Will mix " <<
object <<
"s with InputTag " <<
tag.encode() <<
", label will be "
151 }
else if (
object ==
"HepMCProduct") {
162 produces<CrossingFrame<HepMCProduct> >(
label);
164 consumes<HepMCProduct>(
tag);
166 LogInfo(
"MixingModule") <<
"Will mix " <<
object <<
"s with InputTag= " <<
tag.encode() <<
", label will be "
169 for (
size_t i = 1;
i <
tags.size(); ++
i) {
174 mayConsume<HepMCProduct>(fallbackTag);
177 }
else if (
object ==
"PCaloHit") {
178 std::vector<std::string>
subdets =
pset.getParameter<std::vector<std::string> >(
"subdets");
180 pset.getUntrackedParameter<std::vector<std::string> >(
"crossingFrames", std::vector<std::string>());
184 if (
tags.size() == 1)
186 else if (
tags.size() > 1)
195 produces<CrossingFrame<PCaloHit> >(
label);
196 consumes<std::vector<PCaloHit> >(
tag);
199 LogInfo(
"MixingModule") <<
"Will mix " <<
object <<
"s with InputTag= " <<
tag.encode() <<
", label will be "
204 }
else if (
object ==
"PSimHit") {
205 std::vector<std::string>
subdets =
pset.getParameter<std::vector<std::string> >(
"subdets");
207 pset.getUntrackedParameter<std::vector<std::string> >(
"crossingFrames", std::vector<std::string>());
210 pset.getUntrackedParameter<std::vector<std::string> >(
"pcrossingFrames", std::vector<std::string>());
214 if (
tags.size() == 1)
216 else if (
tags.size() > 1)
233 makePCrossingFrame));
234 produces<CrossingFrame<PSimHit> >(
label);
235 if (makePCrossingFrame) {
236 produces<PCrossingFrame<PSimHit> >(
label);
238 consumes<std::vector<PSimHit> >(
tag);
241 LogInfo(
"MixingModule") <<
"Will mix " <<
object <<
"s with InputTag= " <<
tag.encode() <<
", label will be "
247 <<
"You have asked to mix an unknown type of object(" <<
object
248 <<
").\n If you want to include it in mixing, please contact the authors of the MixingModule!";
259 produces<PileupMixingContent>();
261 produces<CrossingFramePlaybackInfoNew>();
271 for (
auto const& digiName : digiNames) {
276 std::unique_ptr<DigiAccumulatorMixMod>
accumulator = std::unique_ptr<DigiAccumulatorMixMod>(
315 if (adjuster->checkSignal(
e)) {
322 if (worker->checkSignal(
e)) {
349 delete digiAccumulator;
354 LogDebug(
"MixingModule") <<
"===============> adding signals for " <<
e.id();
376 adjuster->doOffset(
bunchSpace_, bunchCrossing, eventPrincipal, &moduleCallingContext, eventId, vertexOffset);
382 for (
auto const& worker :
workers_) {
383 LogDebug(
"MixingModule") <<
" merging Event: id " << eventPrincipal.
id();
386 worker->addPileups(eventPrincipal, &moduleCallingContext, eventId);
393 using namespace std::placeholders;
396 std::vector<edm::SecondaryEventIDAndFileInfo> recordEventID;
397 std::vector<size_t> sizes;
399 size_t playbackCounter = 0
U;
402 bool oldFormatPlayback =
false;
410 "CrossingFramePlaybackInfoNew on the input file, but playback "
411 "option set!!!!! Please change the input file if you really want "
415 oldFormatPlayback =
true;
421 std::vector<int> PileupList;
427 if ((source0 && source0->doPileUp(0)) && !
playback_) {
438 std::vector<int> numInteractionList;
440 std::vector<float> TrueInteractionList;
441 std::vector<edm::EventID> eventInfoList;
448 numInteractionList.push_back(0);
449 TrueInteractionList.push_back(0);
451 numInteractionList.push_back(PileupList[bunchCrossing -
minBunch_]);
458 for (
size_t readSrcIdx = 0; readSrcIdx <
maxNbSources_; ++readSrcIdx) {
459 if (oldFormatPlayback) {
460 std::vector<edm::EventID>
const& playEventID =
462 size_t numberOfEvents = playEventID.size();
463 if (readSrcIdx == 0) {
464 PileupList.push_back(numberOfEvents);
466 numInteractionList.push_back(numberOfEvents);
467 TrueInteractionList.push_back(numberOfEvents);
471 if (readSrcIdx == 0) {
472 PileupList.push_back(numberOfEvents);
474 numInteractionList.push_back(numberOfEvents);
475 TrueInteractionList.push_back(numberOfEvents);
485 (*accItr)->StorePileupInformation(
494 for (
size_t setBcrIdx = 0; setBcrIdx <
workers_.size(); ++setBcrIdx) {
495 workers_[setBcrIdx]->setBcrOffset();
500 (*accItr)->initializeBunchCrossing(
e,
setup, bunchIdx);
503 for (
size_t readSrcIdx = 0; readSrcIdx <
maxNbSources_; ++readSrcIdx) {
508 for (
size_t setSrcIdx = 0; setSrcIdx <
workers_.size(); ++setSrcIdx) {
509 workers_[setSrcIdx]->setSourceOffset(readSrcIdx);
521 int vertexOffset = 0;
526 int numberOfEvents = (readSrcIdx == 0 ? PileupList[bunchIdx -
minBunch_] : 1);
527 sizes.push_back(numberOfEvents);
541 }
else if (oldFormatPlayback) {
542 std::vector<edm::EventID>
const& playEventID = oldFormatPlaybackInfo_H->
getStartEventId(readSrcIdx, bunchIdx);
543 size_t numberOfEvents = playEventID.size();
544 if (readSrcIdx == 0) {
545 PileupList.push_back(numberOfEvents);
548 sizes.push_back(numberOfEvents);
549 std::vector<EventID>::const_iterator
begin = playEventID.begin();
550 std::vector<EventID>::const_iterator
end = playEventID.end();
565 if (readSrcIdx == 0) {
566 PileupList.push_back(numberOfEvents);
569 sizes.push_back(numberOfEvents);
570 std::vector<SecondaryEventIDAndFileInfo>::const_iterator
begin = playbackInfo_H->
getEventId(playbackCounter);
571 playbackCounter += numberOfEvents;
572 std::vector<SecondaryEventIDAndFileInfo>::const_iterator
end = playbackInfo_H->
getEventId(playbackCounter);
590 (*accItr)->finalizeBunchCrossing(
e,
setup, bunchIdx);
595 for (
auto const item : recordEventID) {
596 eventInfoList.emplace_back(
item.eventID());
604 std::unique_ptr<PileupMixingContent> PileupMixing_;
620 std::unique_ptr<CrossingFramePlaybackInfoNew> pOut(
playbackInfo_);
647 (*accItr)->beginLuminosityBlock(
lumi,
setup);
656 (*accItr)->endLuminosityBlock(
lumi,
setup);
683 (*accItr)->accumulate(
event,
setup, streamID);