94 std::vector<Handle<std::vector<T> > > handles;
96 for(
size_t itag = 0; itag < tags_.size(); ++itag){
97 LogInfo(
"HiEmbedding")<<
"itag "<<itag;
98 LogInfo(
"HiEmbedding")<<
"label "<<tags_[itag].label();
99 LogInfo(
"HiEmbedding")<<
"instance "<<tags_[itag].instance();
101 handles.push_back(hand);
102 get =
get && e.
getByLabel(tags_[itag],handles[itag]);
103 if(!
get)
LogWarning(
"Product inconsistency")<<
"One of the sub-events is missing the product with type "
106 <<tags_[itag].instance()
107 <<
" whereas the other one is fine.";
112 crFrame->addSignals(handles[0].product(),e.
id());
113 for(
size_t itag = 1; itag < tags_.size(); ++itag){
114 std::vector<T>* product =
const_cast<std::vector<T>*
>(handles[itag].product());
116 for(
auto& item : *product) {
119 crFrame->addPileups(*product);
121 e.
put(crFrame,label_);
129 std::vector<Handle<HepMCProduct> > handles;
131 for(
size_t itag = 0; itag< tags_.size(); ++itag){
133 handles.push_back(hand);
134 get =
get && e.
getByLabel(tags_[itag],handles[itag]);
135 if(!
get)
LogWarning(
"Product inconsistency")<<
"One of the sub-events is missing the product with type "
138 <<tags_[itag].instance()
139 <<
" whereas the other one is fine.";
144 crFrame->addSignals(handles[0].product(),e.
id());
145 for(
size_t itag = 1; itag < tags_.size(); ++itag){
147 crFrame->addPileups(*product);
149 e.
put(crFrame,label_);
161 virtual void endJob()
override ;
186 std::vector<std::string> simtags = pset.
getParameter<std::vector<std::string> >(
"srcSIM");
187 std::vector<std::string> gentags = pset.
getParameter<std::vector<std::string> >(
"srcGEN");
189 if(simtags.size() != gentags.size())
LogError(
"MixingInput")<<
"Generator and Simulation input lists are not matching each other"<<endl;
191 for (std::vector<string>::iterator it=names.begin();it!= names.end();++it){
194 if (!pstag.
exists(
"type"))
continue;
196 std::vector<InputTag>
tags=pstag.
getParameter<std::vector<InputTag> >(
"input");
199 for(
size_t itag = 0; itag < tags.size(); ++itag){
201 std::vector<InputTag>
inputs;
204 if (
object==
"HepMCProduct") signal = gentags[
input];
205 else signal = simtags[
input];
211 if (
object==
"HepMCProduct"){
213 produces<CrossingFrame<HepMCProduct> >(
label);
214 consumes<HepMCProduct>(
tag);
215 }
else if (
object==
"SimTrack"){
217 produces<CrossingFrame<SimTrack> >(
label);
218 consumes<std::vector<SimTrack> >(
tag);
219 }
else if (
object==
"SimVertex"){
221 produces<CrossingFrame<SimVertex> >(
label);
222 consumes<std::vector<SimVertex> >(
tag);
223 }
else if (
object==
"PSimHit"){
225 produces<CrossingFrame<PSimHit> >(
label);
226 consumes<std::vector<PSimHit> >(
tag);
227 }
else if (
object==
"PCaloHit"){
229 produces<CrossingFrame<PCaloHit> >(
label);
230 consumes<std::vector<PCaloHit> >(
tag);
231 }
else LogInfo(
"Error")<<
"What the hell is this object?!";
233 LogInfo(
"HiMixingModule") <<
"Will mix "<<
object<<
"s with InputTag= "<<tag.
encode()<<
", label will be "<<
label;
237 produces<PileupMixingContent>();
241 HiMixingModule::~HiMixingModule()
260 for(
size_t i = 0;
i < workers_.size(); ++
i){
261 (workers_[
i])->addSignals(iEvent);
264 std::auto_ptr< PileupMixingContent > PileupMixing_ = std::auto_ptr< PileupMixingContent >(
new PileupMixingContent());
265 iEvent.
put(PileupMixing_);
277 HiMixingModule::endJob() {
287 if (
object==
"HepMCProduct") lookfor=
"edm::"+
object;
288 else if (
object==
"edm::HepMCProduct") lookfor=
object;
289 else lookfor=
"std::vector<"+
object+
">";
291 for (edm::ProductRegistry::ProductList::const_iterator it = reg->
productList().begin();
308 LogWarning(
"MixingModule")<<
"!!!!!!!!!Could not find in registry requested object: "<<
object<<
" with "<<tag<<
".\nWill NOT be considered for mixing!!!!!!!!!";
T getParameter(std::string const &) const
static const HistoName names[]
HiMixingWorkerBase(std::string &object, std::vector< InputTag > &tags, std::string &label)
#define DEFINE_FWK_MODULE(type)
virtual ~HiMixingWorkerBase()
bool exists(std::string const ¶meterName) const
checks if a parameter exists
static std::string const input
std::string const & className() const
std::string const & moduleLabel() const
void addSignals(edm::Event &e) override
std::string const & productInstanceName() const
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
HiMixingWorker(std::string &object, std::vector< InputTag > &tags, std::string &label)
std::vector< InputTag > tags_
std::vector< std::string > getParameterNames() const
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
std::vector< HiMixingWorkerBase * > workers_
ProductList const & productList() const