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();
389 adjuster->doOffset(
bunchSpace_, bunchCrossing, eventPrincipal, &moduleCallingContext, eventId, vertexOffset);
395 for (
auto const& worker :
workers_) {
396 LogDebug(
"MixingModule") <<
" merging Event: id " << eventPrincipal.
id();
399 worker->addPileups(eventPrincipal, &moduleCallingContext, eventId);
409 std::vector<edm::SecondaryEventIDAndFileInfo> recordEventID;
410 std::vector<size_t> sizes;
412 size_t playbackCounter = 0
U;
415 bool oldFormatPlayback =
false;
423 "CrossingFramePlaybackInfoNew on the input file, but playback " 424 "option set!!!!! Please change the input file if you really want " 428 oldFormatPlayback =
true;
434 std::vector<int> PileupList;
440 if ((source0 && source0->doPileUp(0)) && !
playback_) {
451 std::vector<int> numInteractionList;
453 std::vector<float> TrueInteractionList;
454 std::vector<edm::EventID> eventInfoList;
461 numInteractionList.push_back(0);
462 TrueInteractionList.push_back(0);
464 numInteractionList.push_back(PileupList[bunchCrossing -
minBunch_]);
471 for (
size_t readSrcIdx = 0; readSrcIdx <
maxNbSources_; ++readSrcIdx) {
472 if (oldFormatPlayback) {
473 std::vector<edm::EventID>
const& playEventID =
475 size_t numberOfEvents = playEventID.size();
476 if (readSrcIdx == 0) {
477 PileupList.push_back(numberOfEvents);
479 numInteractionList.push_back(numberOfEvents);
480 TrueInteractionList.push_back(numberOfEvents);
484 if (readSrcIdx == 0) {
485 PileupList.push_back(numberOfEvents);
487 numInteractionList.push_back(numberOfEvents);
488 TrueInteractionList.push_back(numberOfEvents);
498 (*accItr)->StorePileupInformation(
507 for (
size_t setBcrIdx = 0; setBcrIdx <
workers_.size(); ++setBcrIdx) {
508 workers_[setBcrIdx]->setBcrOffset();
513 (*accItr)->initializeBunchCrossing(
e,
setup, bunchIdx);
516 for (
size_t readSrcIdx = 0; readSrcIdx <
maxNbSources_; ++readSrcIdx) {
521 for (
size_t setSrcIdx = 0; setSrcIdx <
workers_.size(); ++setSrcIdx) {
522 workers_[setSrcIdx]->setSourceOffset(readSrcIdx);
534 int vertexOffset = 0;
539 int numberOfEvents = (readSrcIdx == 0 ? PileupList[bunchIdx -
minBunch_] : 1);
540 sizes.push_back(numberOfEvents);
554 }
else if (oldFormatPlayback) {
555 std::vector<edm::EventID>
const& playEventID = oldFormatPlaybackInfo_H->
getStartEventId(readSrcIdx, bunchIdx);
556 size_t numberOfEvents = playEventID.size();
557 if (readSrcIdx == 0) {
558 PileupList.push_back(numberOfEvents);
561 sizes.push_back(numberOfEvents);
562 std::vector<EventID>::const_iterator begin = playEventID.begin();
563 std::vector<EventID>::const_iterator end = playEventID.end();
578 if (readSrcIdx == 0) {
579 PileupList.push_back(numberOfEvents);
582 sizes.push_back(numberOfEvents);
583 std::vector<SecondaryEventIDAndFileInfo>::const_iterator begin = playbackInfo_H->
getEventId(playbackCounter);
584 playbackCounter += numberOfEvents;
585 std::vector<SecondaryEventIDAndFileInfo>::const_iterator end = playbackInfo_H->
getEventId(playbackCounter);
603 (*accItr)->finalizeBunchCrossing(
e,
setup, bunchIdx);
608 for (
auto const item : recordEventID) {
609 eventInfoList.emplace_back(
item.eventID());
617 std::unique_ptr<PileupMixingContent> PileupMixing_;
619 PileupMixing_ = std::make_unique<PileupMixingContent>(
633 std::unique_ptr<CrossingFramePlaybackInfoNew> pOut(
playbackInfo_);
660 (*accItr)->beginLuminosityBlock(
lumi,
setup);
669 (*accItr)->endLuminosityBlock(
lumi,
setup);
696 (*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]
void setupPileUpEvent(const edm::EventSetup &setup)
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