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 }
else if (
object==
"SimTrack"){
216 produces<CrossingFrame<SimTrack> >(
label);
217 }
else if (
object==
"SimVertex"){
219 produces<CrossingFrame<SimVertex> >(
label);
220 }
else if (
object==
"PSimHit"){
222 produces<CrossingFrame<PSimHit> >(
label);
223 }
else if (
object==
"PCaloHit"){
225 produces<CrossingFrame<PCaloHit> >(
label);
226 }
else LogInfo(
"Error")<<
"What the hell is this object?!";
228 LogInfo(
"HiMixingModule") <<
"Will mix "<<
object<<
"s with InputTag= "<<tag.
encode()<<
", label will be "<<
label;
232 produces<PileupMixingContent>();
236 HiMixingModule::~HiMixingModule()
255 for(
size_t i = 0;
i < workers_.size(); ++
i){
256 (workers_[
i])->addSignals(iEvent);
259 std::auto_ptr< PileupMixingContent > PileupMixing_ = std::auto_ptr< PileupMixingContent >(
new PileupMixingContent());
260 iEvent.
put(PileupMixing_);
272 HiMixingModule::endJob() {
282 if (
object==
"HepMCProduct") lookfor=
"edm::"+
object;
283 else if (
object==
"edm::HepMCProduct") lookfor=
object;
284 else lookfor=
"std::vector<"+
object+
">";
286 for (edm::ProductRegistry::ProductList::const_iterator it = reg->
productList().begin();
303 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