Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix heavy ion relval tests #12303

Merged
merged 2 commits into from
Nov 11, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
VtxSmeared = cms.EDProducer("MixBoostEvtVtxGenerator",
useCF = cms.untracked.bool(True),
signalLabel = cms.InputTag("generator","unsmeared"),
mixLabel = cms.InputTag("mix","generatorunsmeared"),
mixLabel = cms.InputTag("mix","generatorSmeared"),
Beta=cms.double(0.434)
)
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
VtxSmeared = cms.EDProducer("MixBoostEvtVtxGenerator",
useCF = cms.untracked.bool(True),
signalLabel = cms.InputTag("generator","unsmeared"),
mixLabel = cms.InputTag("mix","generatorunsmeared"),
mixLabel = cms.InputTag("mix","generatorSmeared"),
Beta=cms.double(-0.434)
)
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
VtxSmeared = cms.EDProducer("MixEvtVtxGenerator",
useCF = cms.untracked.bool(True),
signalLabel = cms.InputTag("generator","unsmeared"),
mixLabel = cms.InputTag("mix","generatorunsmeared")
mixLabel = cms.InputTag("mix","generatorSmeared")
)
2 changes: 1 addition & 1 deletion PhysicsTools/HepMCCandAlgos/plugins/GenParticleProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ GenParticleProducer::GenParticleProducer( const ParameterSet & cfg ) :
produces<vector<int> >().setBranchAlias( alias + "BarCodes" );
}

if(useCF_) mixToken_ = mayConsume<CrossingFrame<HepMCProduct> >(InputTag(cfg.getParameter<std::string>( "mix" ),"generatorunsmeared"));
if(useCF_) mixToken_ = mayConsume<CrossingFrame<HepMCProduct> >(InputTag(cfg.getParameter<std::string>( "mix" ),"generatorSmeared"));
else srcToken_ = mayConsume<HepMCProduct>(cfg.getParameter<InputTag>( "src" ));
}

Expand Down
6 changes: 3 additions & 3 deletions SimGeneral/MixingModule/plugins/MixingModule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,15 @@ namespace edm {
branchesActivate(TypeID(typeid(HepMCProduct)).friendlyClassName(),std::string(""),tag,label);
bool makeCrossingFrame = pset.getUntrackedParameter<bool>("makeCrossingFrame", false);
if(makeCrossingFrame) {
workersObjects_.push_back(new MixingWorker<HepMCProduct>(minBunch_,maxBunch_,bunchSpace_,std::string(""),label,labelCF,maxNbSources_,tag,tagCF));
workersObjects_.push_back(new MixingWorker<HepMCProduct>(minBunch_,maxBunch_,bunchSpace_,std::string(""),label,labelCF,maxNbSources_,tag,tagCF,tags));
produces<CrossingFrame<HepMCProduct> >(label);
}
consumes<HepMCProduct>(tag);

LogInfo("MixingModule") <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label;
// std::cout <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label<<std::endl;
if(tags.size()>1) {
InputTag fallbackTag = tags[1];
for(size_t i = 1; i < tags.size(); ++i) {
InputTag fallbackTag = tags[i];
std::string fallbackLabel;
branchesActivate(TypeID(typeid(HepMCProduct)).friendlyClassName(),std::string(""),fallbackTag,fallbackLabel);
mayConsume<HepMCProduct>(fallbackTag);
Expand Down
56 changes: 28 additions & 28 deletions SimGeneral/MixingModule/plugins/MixingWorker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,48 +11,48 @@ namespace edm {
template <>
void MixingWorker<HepMCProduct>::addPileups(const EventPrincipal& ep, ModuleCallingContext const* mcc, unsigned int eventNr) {
// HepMCProduct does not come as a vector....
std::shared_ptr<Wrapper<HepMCProduct> const> shPtr = getProductByTag<HepMCProduct>(ep, tag_, mcc);
if(!shPtr) {
shPtr = getProductByTag<HepMCProduct>(ep, InputTag("generator"), mcc);
}
if (shPtr) {
LogDebug("MixingModule") <<"HepMC pileup objects added, eventNr "<<eventNr << " Tag " << tag_ << std::endl;
crFrame_->setPileupPtr(shPtr);
crFrame_->addPileups(*shPtr->product());
for(InputTag const& tag : allTags_) {
std::shared_ptr<Wrapper<HepMCProduct> const> shPtr = getProductByTag<HepMCProduct>(ep, tag, mcc);
if(shPtr) {
LogDebug("MixingModule") << "HepMC pileup objects added, eventNr " << eventNr << " Tag " << tag << std::endl;
crFrame_->setPileupPtr(shPtr);
crFrame_->addPileups(*shPtr->product());
break;
}
}
}

template <>
void MixingWorker<HepMCProduct>::addSignals(const Event &e) {
//HepMC - here the interface is different!!!
bool got = false;
Handle<HepMCProduct> result_t;
bool got = e.getByLabel(tag_,result_t);
if (got) {
LogDebug("MixingModule") <<" adding HepMCProduct from signal event with "<<tag_;
crFrame_->addSignals(result_t.product(),e.id());
} else {
LogInfo("MixingModule") <<"!!!!!!! Did not get any signal data for HepMCProduct with "<<tag_;
for(InputTag const& tag : allTags_) {
got = e.getByLabel(tag, result_t);
if (got) {
LogDebug("MixingModule") << "adding HepMCProduct from signal event with " << tag;
crFrame_->addSignals(result_t.product(), e.id());
break;
}
}
if(!got) {
LogInfo("MixingModule") << "!!!!!!! Did not get any signal data for HepMCProduct with " << allTags_[0];
}
}

template <>
bool MixingWorker<HepMCProduct>::checkSignal(const Event &e) {
bool got;
InputTag t;

bool got = false;
Handle<HepMCProduct> result_t;
got = e.getByLabel(tag_,result_t);
t = InputTag(tag_.label(),tag_.instance());
if(!got) {
got = e.getByLabel(InputTag("generator","unsmeared"),result_t);
}

if (got) {
LogInfo("MixingModule") <<" Will create a CrossingFrame for HepMCProduct with "
<< " with InputTag= "<< t.encode();
for(InputTag const& tag : allTags_) {
got = e.getByLabel(tag, result_t);
if(got) {
InputTag t = InputTag(tag.label(), tag.instance());
LogInfo("MixingModule") <<" Will create a CrossingFrame for HepMCProduct with "
<< " with InputTag= "<< t.encode();
break;
}
}

return got;
}

}//namespace edm
39 changes: 34 additions & 5 deletions SimGeneral/MixingModule/plugins/MixingWorker.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,13 @@ namespace edm
subdet_(std::string(" ")),
label_(std::string(" ")),
labelCF_(std::string(" ")),
maxNbSources_(5) {
tag_=InputTag();
tagSignal_=InputTag();
maxNbSources_(5),
tag_(),
tagSignal_(),
allTags_(),
crFrame_(nullptr),
secSourceCF_(nullptr)
{
}

/*Normal constructor*/
Expand All @@ -69,7 +73,32 @@ namespace edm
labelCF_(labelCF),
maxNbSources_(maxNbSources),
tag_(tag),
tagSignal_(tagCF)
tagSignal_(tagCF),
allTags_(),
crFrame_(nullptr),
secSourceCF_(nullptr)
{
}

/*constructor for HepMCproduct case*/
MixingWorker(int minBunch,int maxBunch, int bunchSpace,
std::string subdet,std::string label,
std::string labelCF,int maxNbSources, InputTag& tag,
InputTag& tagCF,
std::vector<InputTag> const& tags) :
MixingWorkerBase(),
minBunch_(minBunch),
maxBunch_(maxBunch),
bunchSpace_(bunchSpace),
subdet_(subdet),
label_(label),
labelCF_(labelCF),
maxNbSources_(maxNbSources),
tag_(tag),
tagSignal_(tagCF),
allTags_(tags),
crFrame_(nullptr),
secSourceCF_(nullptr)
{
}

Expand Down Expand Up @@ -131,7 +160,6 @@ namespace edm
LogDebug("MixingModule") <<" CF was put for type "<<typeid(T).name()<<" with "<<label_;
}


// When using mixed secondary source
// Copy the data from the PCrossingFrame to the CrossingFrame
virtual void copyPCrossingFrame(const PCrossingFrame<T> *PCF);
Expand All @@ -146,6 +174,7 @@ namespace edm
unsigned int const maxNbSources_;
InputTag tag_;
InputTag tagSignal_;
std::vector<InputTag> allTags_; // for HepMCProduct

CrossingFrame<T> * crFrame_;
PCrossingFrame<T> * secSourceCF_;
Expand Down
2 changes: 1 addition & 1 deletion SimGeneral/MixingModule/python/HiEventMixing_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

mixObjects = cms.PSet(
mixHepMC = cms.PSet(
input = cms.VInputTag(cms.InputTag("generator","unsmeared"),cms.InputTag("generator")),
input = cms.VInputTag(cms.InputTag("generatorSmeared","",cms.InputTag.skipCurrentProcess()),cms.InputTag("generator","unsmeared"),cms.InputTag("generator","",cms.InputTag.skipCurrentProcess())),
makeCrossingFrame = cms.untracked.bool(True),
type = cms.string('HepMCProduct')
)
Expand Down
2 changes: 1 addition & 1 deletion SimGeneral/MixingModule/python/HiMixGEN_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

mixObjects = cms.PSet(
mixHepMC = cms.PSet(
input = cms.VInputTag(cms.InputTag("generator","unsmeared"),cms.InputTag("generator")),
input = cms.VInputTag(cms.InputTag("generatorSmeared","",cms.InputTag.skipCurrentProcess()),cms.InputTag("generator","unsmeared"),cms.InputTag("generator","",cms.InputTag.skipCurrentProcess())),
makeCrossingFrame = cms.untracked.bool(True),
type = cms.string('HepMCProduct')
)
Expand Down
2 changes: 1 addition & 1 deletion SimMuon/GEMDigitizer/python/customizeGEMDigi.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
subdets = cms.vstring()
),
mixHepMC = cms.PSet(
input = cms.VInputTag(cms.InputTag("generator")),
input = cms.VInputTag(cms.InputTag("generatorSmeared"),cms.InputTag("generator")),
makeCrossingFrame = cms.untracked.bool(True),
type = cms.string('HepMCProduct')
),
Expand Down