33 mixProdStep2_(ps_mix.getParameter<bool>(
"mixProdStep2")),
34 mixProdStep1_(ps_mix.getParameter<bool>(
"mixProdStep1")),
38 if (
mixProdStep1_)
LogInfo(
"MixingModule") <<
" The MixingModule was run in the Step1 mode. It produces a mixed secondary source.";
39 if (
mixProdStep2_)
LogInfo(
"MixingModule") <<
" The MixingModule was run in the Step2 mode. It uses a mixed secondary source.";
42 if (ps_mix.
exists(
"useCurrentProcessOnly")) {
47 if (ps_mix.
exists(
"LabelPlayback")) {
50 if (labelPlayback.empty()) {
57 for(std::vector<std::string>::iterator it=names.begin();it!= names.end();++it) {
59 if (!pset.
exists(
"type"))
continue;
61 std::vector<InputTag>
tags=pset.
getParameter<std::vector<InputTag> >(
"input");
68 if (
object==
"SimTrack") {
70 if (tags.size()>0) tag=tags[0];
75 if(makeCrossingFrame) {
77 produces<CrossingFrame<SimTrack> >(
label);
80 LogInfo(
"MixingModule") <<
"Will mix "<<
object<<
"s with InputTag= "<<tag.
encode()<<
", label will be "<<
label;
83 }
else if (
object==
"RecoTrack") {
85 if (tags.size()>0) tag=tags[0];
91 LogInfo(
"MixingModule") <<
"Will mix "<<
object<<
"s with InputTag= "<<tag.
encode()<<
", label will be "<<
label;
94 }
else if (
object==
"SimVertex") {
96 if (tags.size()>0) tag=tags[0];
101 if(makeCrossingFrame) {
103 produces<CrossingFrame<SimVertex> >(
label);
106 LogInfo(
"MixingModule") <<
"Will mix "<<
object<<
"s with InputTag "<<tag.
encode()<<
", label will be "<<
label;
109 }
else if (
object==
"HepMCProduct") {
111 if (tags.size()>0) tag=tags[0];
116 if(makeCrossingFrame) {
118 produces<CrossingFrame<HepMCProduct> >(
label);
121 LogInfo(
"MixingModule") <<
"Will mix "<<
object<<
"s with InputTag= "<<tag.
encode()<<
", label will be "<<
label;
124 }
else if (
object==
"PCaloHit") {
126 std::vector<std::string> crossingFrames=pset.
getUntrackedParameter<std::vector<std::string> >(
"crossingFrames", std::vector<std::string>());
128 for (
unsigned int ii=0;
ii<subdets.size();++
ii) {
130 if (tags.size()==1) tag=tags[0];
131 else if(tags.size()>1) tag=tags[
ii];
137 produces<CrossingFrame<PCaloHit> >(
label);
140 LogInfo(
"MixingModule") <<
"Will mix "<<
object<<
"s with InputTag= "<<tag.
encode()<<
", label will be "<<
label;
145 }
else if (
object==
"PSimHit") {
147 std::vector<std::string> crossingFrames=pset.
getUntrackedParameter<std::vector<std::string> >(
"crossingFrames", std::vector<std::string>());
149 for (
unsigned int ii=0;
ii<subdets.size();++
ii) {
151 if (tags.size()==1) tag=tags[0];
152 else if(tags.size()>1) tag=tags[
ii];
158 produces<CrossingFrame<PSimHit> >(
label);
161 LogInfo(
"MixingModule") <<
"Will mix "<<
object<<
"s with InputTag= "<<tag.
encode()<<
", label will be "<<
label;
165 LogWarning(
"MixingModule") <<
"You have asked to mix an unknown type of object("<<
object<<
").\n If you want to include it in mixing, please contact the authors of the MixingModule!";
174 produces<PileupMixingContent>();
176 produces<CrossingFramePlaybackInfoExtended>();
186 for(
auto const& digiName : digiNames) {
190 if(accumulator.get() != 0) {
248 std::vector<DigiAccumulatorMixMod*>::const_iterator accItr =
digiAccumulators_.begin();
249 std::vector<DigiAccumulatorMixMod*>::const_iterator accEnd =
digiAccumulators_.end();
250 for (; accItr != accEnd; ++accItr) {
257 LogDebug(
"MixingModule")<<
"===============> adding signals for "<<e.
id();
267 int bunchCrossing,
int eventId,
274 LogDebug(
"MixingModule") <<
" merging Event: id " << eventPrincipal.
id();
283 std::vector<edm::EventID> recordEventID;
289 "CrossingFramePlaybackInfoExtended on the input file, but playback "
290 "option set!!!!! Please change the input file if you really want "
291 "playback!!!!!!" << std::endl;
297 std::vector<int> PileupList;
303 if((source0 && source0->doPileUp() ) && !
playback_) {
316 int KeepTrackOfPileup = 0;
319 for (
size_t setBcrIdx=0; setBcrIdx<
workers_.size(); ++setBcrIdx) {
320 workers_[setBcrIdx]->setBcrOffset();
323 (*accItr)->initializeBunchCrossing(e, setup, bunchIdx);
326 for (
size_t readSrcIdx=0; readSrcIdx<
maxNbSources_; ++readSrcIdx) {
331 for (
size_t setSrcIdx=0; setSrcIdx<
workers_.size(); ++setSrcIdx) {
332 workers_[setSrcIdx]->setSourceOffset(readSrcIdx);
335 if (!source || !source->doPileUp())
continue;
337 int NumPU_Events = 0;
340 NumPU_Events = PileupList[bunchIdx -
minBunch_];
346 int vertexOffset = 0;
351 _2, vertexOffset, boost::ref(setup)), NumPU_Events
354 KeepTrackOfPileup+=NumPU_Events;
357 const std::vector<edm::EventID>& playEventID =
358 playbackInfo_H->getStartEventId(readSrcIdx, bunchIdx);
359 if(readSrcIdx == 0) {
360 PileupList.push_back(playEventID.size());
366 dummyId, vertexOffset, boost::ref(setup))
371 (*accItr)->finalizeBunchCrossing(e, setup, bunchIdx);
377 std::auto_ptr<PileupMixingContent> PileupMixing_;
379 std::vector<int> numInteractionList;
380 std::vector<int> bunchCrossingList;
381 std::vector<float> TrueInteractionList;
385 bunchCrossingList.push_back(bunchCrossing);
387 numInteractionList.push_back(0);
388 TrueInteractionList.push_back(0);
391 numInteractionList.push_back(PileupList[bunchCrossing-
minBunch_]);
397 PileupMixing_ = std::auto_ptr<PileupMixingContent>(
new PileupMixingContent(bunchCrossingList,
399 TrueInteractionList));
401 e.
put(PileupMixing_);
413 std::auto_ptr<CrossingFramePlaybackInfoExtended> pOut(
playbackInfo_);
420 (*accItr)->beginRun(run, setup);
426 (*accItr)->endRun(run, setup);
432 (*accItr)->beginLuminosityBlock(lumi, setup);
438 (*accItr)->endLuminosityBlock(lumi, setup);
445 (*accItr)->initializeEvent(event, setup);
452 (*accItr)->accumulate(event, setup);
459 (*accItr)->accumulate(event, setup);
466 (*accItr)->finalizeEvent(event, setup);
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
void pileAllWorkers(EventPrincipal const &ep, int bcr, int id, int &offset, const edm::EventSetup &setup)
virtual void reload(const edm::EventSetup &)
MixingModule(const edm::ParameterSet &ps)
virtual void beginLuminosityBlock(LuminosityBlock const &l1, EventSetup const &c) override
static const HistoName names[]
virtual void createnewEDProduct()
std::vector< float > TrueNumInteractions_
virtual void addSignals(const edm::Event &e, const edm::EventSetup &es)
EventID const & id() const
bool exists(std::string const ¶meterName) const
checks if a parameter exists
virtual void put(edm::Event &e, const edm::EventSetup &es)
void setStartEventId(const std::vector< edm::EventID > &id, const unsigned int s, const int bcr, const int start)
virtual void checkSignal(const edm::Event &e)
std::string friendlyName(std::string const &iFullName)
virtual void endLuminosityBlock(LuminosityBlock const &l1, EventSetup const &c) override
std::vector< MixingWorkerBase * > workers_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Accumulators digiAccumulators_
static DigiAccumulatorMixModFactory * get()
static const unsigned int maxNbSources_
std::vector< MixingWorkerBase * > workersObjects_
virtual void beginRun(Run const &r1, EventSetup const &c) override
std::vector< std::string > getParameterNames() const
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
bool useCurrentProcessOnly_
virtual void branchesActivate(const std::string &friendlyName, const std::string &subdet, InputTag &tag, std::string &label)
void finalizeEvent(Event &event, EventSetup const &setup)
void sort_all(RandomAccessSequence &s)
wrappers for std::sort
ParameterSet const & getParameterSet(std::string const &) const
constexpr char const * subdets[11]
std::vector< std::string > wantedBranches_
InputTag inputTagPlayback_
std::vector< boost::shared_ptr< PileUp > > inputSources_
std::auto_ptr< DigiAccumulatorMixMod > makeDigiAccumulator(ParameterSet const &, EDProducer &) const
void accumulateEvent(Event const &event, EventSetup const &setup)
bool binary_search_all(ForwardSequence const &s, Datum const &d)
wrappers for std::binary_search
CrossingFramePlaybackInfoExtended * playbackInfo_
void dropUnwantedBranches(std::vector< std::string > const &wantedBranches)
void initializeEvent(Event const &event, EventSetup const &setup)
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
virtual void doPileUp(edm::Event &e, const edm::EventSetup &es)
void createDigiAccumulators(const edm::ParameterSet &mixingPSet)
virtual void endRun(Run const &r1, EventSetup const &c) override