29 labelPlayback_(ps_mix.getParameter<std::string>(
"LabelPlayback")),
30 mixProdStep2_(ps_mix.getParameter<bool>(
"mixProdStep2")),
31 mixProdStep1_(ps_mix.getParameter<bool>(
"mixProdStep1"))
34 if (
mixProdStep1_)
LogInfo(
"MixingModule") <<
" The MixingModule was run in the Step1 mode. It produces a mixed secondary source.";
35 if (
mixProdStep2_)
LogInfo(
"MixingModule") <<
" The MixingModule was run in the Step2 mode. It uses a mixed secondary source.";
38 if (ps_mix.
exists(
"useCurrentProcessOnly")) {
51 for (std::vector<string>::iterator it=names.begin();it!= names.end();++it)
54 if (!pset.
exists(
"type"))
continue;
55 std::string
object = pset.
getParameter<std::string>(
"type");
56 std::vector<InputTag>
tags=pset.
getParameter<std::vector<InputTag> >(
"input");
60 if (
object==
"SimTrackPCrossingFrame") {
62 if (tags.size()>0) tag=tags[0];
66 LogInfo(
"MixingModule") <<
"Will mix "<<
object<<
"s with InputTag= "<<tag.
encode()<<
", label will be "<<
label;
70 if (
find(names.begin(), names.end(),
"mixTracks") != names.end())
73 if (!psin.
exists(
"type"))
continue;
74 std::string
object = psin.
getParameter<std::string>(
"type");
75 std::vector<InputTag> tags=psin.
getParameter<std::vector<InputTag> >(
"input");
78 if (tags.size()>0) tagCF=tags[0];
84 produces<CrossingFrame<SimTrack> >(labelCF);
88 }
else if (
object==
"SimVertexPCrossingFrame") {
90 if (tags.size()>0) tag=tags[0];
94 LogInfo(
"MixingModule") <<
"Will mix "<<
object<<
"s with InputTag "<<tag.
encode()<<
", label will be "<<
label;
98 if (
find(names.begin(), names.end(),
"mixVertices") != names.end())
101 if (!psin.
exists(
"type"))
continue;
102 std::string
object = psin.
getParameter<std::string>(
"type");
103 std::vector<InputTag> tags=psin.
getParameter<std::vector<InputTag> >(
"input");
106 if (tags.size()>0) tagCF=tags[0];
109 branchesActivate(
TypeID(
typeid(std::vector<SimVertex>)).friendlyClassName(),std::string(
""),tagCF,labelCF);
112 produces<CrossingFrame<SimVertex> >(labelCF);
117 else if (
object==
"HepMCProductPCrossingFrame") {
119 if (tags.size()>0) tag=tags[0];
123 LogInfo(
"MixingModule") <<
"Will mix "<<
object<<
"s with InputTag= "<<tag.
encode()<<
", label will be "<<
label;
127 if (
find(names.begin(), names.end(),
"mixHepMC") != names.end())
130 if (!psin.
exists(
"type"))
continue;
131 std::string
object = psin.
getParameter<std::string>(
"type");
132 std::vector<InputTag> tags=psin.
getParameter<std::vector<InputTag> >(
"input");
135 if (tags.size()>0) tagCF=tags[0];
141 produces<CrossingFrame<HepMCProduct> >(labelCF);
144 }
else if (
object==
"PCaloHitPCrossingFrame") {
146 for (
unsigned int ii=0;ii<subdets.size();ii++) {
148 if (tags.size()==1) tag=tags[0];
149 else if(tags.size()>1) tag=tags[ii];
153 LogInfo(
"MixingModule") <<
"Will mix "<<
object<<
"s with InputTag= "<<tag.
encode()<<
", label will be "<<
label;
157 if (
find(names.begin(), names.end(),
"mixCH") != names.end())
160 if (!psin.
exists(
"type"))
continue;
161 std::string
object = psin.
getParameter<std::string>(
"type");
162 std::vector<InputTag> tags=psin.
getParameter<std::vector<InputTag> >(
"input");
165 if (tags.size()==1) tagCF=tags[0];
166 else if(tags.size()>1) tagCF=tags[ii];
172 produces<CrossingFrame<PCaloHit> > (labelCF);
177 }
else if (
object==
"PSimHitPCrossingFrame") {
179 for (
unsigned int ii=0;ii<subdets.size();ii++) {
181 if (tags.size()==1) tag=tags[0];
182 else if(tags.size()>1) tag=tags[ii];
186 LogInfo(
"MixingModule") <<
"Will mix "<<
object<<
"s with InputTag= "<<tag.
encode()<<
", label will be "<<
label;
191 if (
find(names.begin(), names.end(),
"mixSH") != names.end())
194 if (!psin.
exists(
"type"))
continue;
195 std::string
object = psin.
getParameter<std::string>(
"type");
196 std::vector<InputTag> tags=psin.
getParameter<std::vector<InputTag> >(
"input");
199 if (tags.size()==1) tagCF=tags[0];
200 else if(tags.size()>1) tagCF=tags[ii];
205 produces<CrossingFrame<PSimHit> > (labelCF);
217 std::string labelCF =
" ";
220 if (
object==
"SimTrack") {
222 if (tags.size()>0) tag=tags[0];
228 produces<CrossingFrame<SimTrack> >(
label);
229 LogInfo(
"MixingModule") <<
"Will mix "<<
object<<
"s with InputTag= "<<tag.
encode()<<
", label will be "<<
label;
232 }
else if (
object==
"SimVertex") {
234 if (tags.size()>0) tag=tags[0];
240 produces<CrossingFrame<SimVertex> >(
label);
241 LogInfo(
"MixingModule") <<
"Will mix "<<
object<<
"s with InputTag "<<tag.
encode()<<
", label will be "<<
label;
243 }
else if (
object==
"HepMCProduct") {
245 if (tags.size()>0) tag=tags[0];
251 produces<CrossingFrame<HepMCProduct> >(
label);
252 LogInfo(
"MixingModule") <<
"Will mix "<<
object<<
"s with InputTag= "<<tag.
encode()<<
", label will be "<<
label;
255 }
else if (
object==
"PCaloHit") {
257 for (
unsigned int ii=0;ii<subdets.size();ii++) {
259 if (tags.size()==1) tag=tags[0];
260 else if(tags.size()>1) tag=tags[ii];
266 produces<CrossingFrame<PCaloHit> > (
label);
267 LogInfo(
"MixingModule") <<
"Will mix "<<
object<<
"s with InputTag= "<<tag.
encode()<<
", label will be "<<
label;
271 }
else if (
object==
"PSimHit") {
273 for (
unsigned int ii=0;ii<subdets.size();ii++) {
275 if (tags.size()==1) tag=tags[0];
276 else if(tags.size()>1) tag=tags[ii];
282 produces<CrossingFrame<PSimHit> > (
label);
283 LogInfo(
"MixingModule") <<
"Will mix "<<
object<<
"s with InputTag= "<<tag.
encode()<<
", label will be "<<
label;
286 else 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!";
295 produces<PileupMixingContent>();
297 produces<CrossingFramePlaybackInfoExtended>();
333 for (
unsigned int ii=0;ii<
workers_.size();ii++){
349 LogDebug(
"MixingModule")<<
"===============> adding signals for "<<e.
id();
350 for (
unsigned int ii=0;ii<
workers_.size();ii++){
359 for (
unsigned int ii=0;ii<
workers_.size();ii++) {
364 for (
unsigned int isource=0;isource<
maxNbSources_;++isource) {
365 workers_[ii]->setSourceOffset(isource);
366 if (
doit_[isource]) {
373 std::auto_ptr< PileupMixingContent > PileupMixing_;
375 std::vector<int> bunchCrossingList;
376 std::vector<int> numInteractionList;
380 bunchCrossingList.push_back(bunchCrossing);
382 numInteractionList.push_back(0);
390 PileupMixing_ = std::auto_ptr< PileupMixingContent >(
new PileupMixingContent( bunchCrossingList,
391 numInteractionList));
393 e.
put(PileupMixing_);
397 for (
unsigned int ii=0;ii<
workers_.size();ii++) {
408 LogDebug(
"MixingModule") <<
"\n===============> adding objects from event "<<ep->
id()<<
" for bunchcrossing "<<bcr;
420 std::auto_ptr<CrossingFramePlaybackInfoExtended> pOut(
playbackInfo_);
429 bool got=e.
get((*
sel_), playbackInfo_H);
433 throw cms::Exception(
"MixingProductNotFound") <<
" No CrossingFramePlaybackInfoExtended on the input file, but playback option set!!!!! Please change the input file if you really want playback!!!!!!" << endl;
T getParameter(std::string const &) const
void setEventStartInfo(std::vector< std::vector< edm::EventID > > &id, const unsigned int s)
virtual void createnewEDProduct()
std::vector< EventPrincipalVector > pileup_[4]
virtual void setEventStartInfo(const unsigned int s)
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
std::vector< std::vector< edm::EventID > > vectorEventIDs_
void merge(const int bcr, const EventPrincipalVector &vec, unsigned int worker, const edm::EventSetup &c)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::string labelPlayback_
virtual void put(edm::Event &e, const edm::EventSetup &es)
virtual void getEventStartInfo(edm::Event &e, const unsigned int s)
virtual void addPileups(const int bcr, EventPrincipal *, unsigned int EventId, unsigned int worker, const edm::EventSetup &e)
virtual void checkSignal(const edm::Event &e)
std::string friendlyName(std::string const &iFullName)
static std::string subdets[11]
std::vector< MixingWorkerBase * > workers_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
bool get(ProductID const &oid, Handle< PROD > &result) const
static const unsigned int maxNbSources_
std::vector< MixingWorkerBase * > workersObjects_
std::vector< std::string > getParameterNames() const
bool useCurrentProcessOnly_
virtual void branchesActivate(const std::string &friendlyName, const std::string &subdet, InputTag &tag, std::string &label)
void sort_all(RandomAccessSequence &s)
wrappers for std::sort
std::vector< std::string > wantedBranches_
CrossingFramePlaybackInfoExtended * playbackInfo_
void dropUnwantedBranches(std::vector< std::string > const &wantedBranches)
static const HistoName names[]
tuple size
Write out results.
virtual void doPileUp(edm::Event &e, const edm::EventSetup &es)