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

Hgc detidfix #4311

Merged
merged 3 commits into from
Jun 23, 2014
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
1 change: 1 addition & 0 deletions DataFormats/ForwardDetId/src/HGCEEDetId.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ HGCEEDetId::HGCEEDetId(ForwardSubdetector subdet, int zp, int lay, int sec, int

id_ |= ((cell & 0xfff) << 0 );
id_ |= ((sec & 0x3f) << 12);
if(subsec<0) subsec=0;
id_ |= ((subsec & 0x1) << 18);
id_ |= ((lay & 0x1f) << 19);
if (zp>0) id_ |= ((zp & 0x1) << 24);
Expand Down
1 change: 1 addition & 0 deletions DataFormats/ForwardDetId/src/HGCHEDetId.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ HGCHEDetId::HGCHEDetId(ForwardSubdetector subdet, int zp, int lay, int sec, int

id_ |= ((cell & 0xfff) << 0 );
id_ |= ((sec & 0x3f) << 12);
if(subsec<0) subsec=0;
id_ |= ((subsec & 0x1) << 18);
id_ |= ((lay & 0x1f) << 19);
if(zp>0) id_ |= ((zp & 0x1) << 24);
Expand Down
1 change: 1 addition & 0 deletions DataFormats/ForwardDetId/src/HGCalDetId.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ HGCalDetId::HGCalDetId(ForwardSubdetector subdet, int zp, int lay, int sec, int
uint32_t rawid=0;
rawid |= ((cell & 0xffff) << 0 );
rawid |= ((sec & 0x7f) << 16);
if(subsec<0) subsec=0;
rawid |= ((subsec & 0x1) << 23);
rawid |= ((lay & 0x7f) << 24);
if (zp>0) rawid |= ((zp & 0x1) << 31);
Expand Down
3 changes: 3 additions & 0 deletions SimCalorimetry/HGCSimProducers/interface/HGCDigitizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ class HGCDigitizer

private :

//used for initialization
bool checkValidDetIds_;

//input/output names
std::string hitCollection_,digiCollection_;

Expand Down
3 changes: 0 additions & 3 deletions SimCalorimetry/HGCSimProducers/interface/HGCDigitizerBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ class HGCDigitizerBase {
it!=simData.end();
it++)
{

//convert total energy GeV->keV->ADC counts
double totalEn(0);
for(size_t i=0; i<it->second.size(); i++) totalEn+= (it->second)[i];
Expand All @@ -76,8 +75,6 @@ class HGCDigitizerBase {

if(singleSample.adc()==0) continue;

//std::cout << totalEn << " -> Gain:" << singleSample.gain() << " #ADC:" << singleSample.adc() << std::endl;

//no time information
D newDataFrame( it->first );
newDataFrame.setSample(0, singleSample);
Expand Down
19 changes: 18 additions & 1 deletion SimCalorimetry/HGCSimProducers/src/HGCDigitizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

//
HGCDigitizer::HGCDigitizer(const edm::ParameterSet& ps) :
checkValidDetIds_(true),
theHGCEEDigitizer_(ps),
theHGCHEbackDigitizer_(ps),
theHGCHEfrontDigitizer_(ps),
Expand Down Expand Up @@ -45,7 +46,7 @@ HGCDigitizer::HGCDigitizer(const edm::ParameterSet& ps) :
}

//
void HGCDigitizer::initializeEvent(edm::Event const& e, edm::EventSetup const& es)
void HGCDigitizer::initializeEvent(edm::Event const& e, edm::EventSetup const& es)
{
resetSimHitDataAccumulator();
}
Expand Down Expand Up @@ -165,6 +166,22 @@ void HGCDigitizer::accumulate(edm::Handle<edm::PCaloHitContainer> const &hits, i
if(itime<0 || itime>(int)simHitIt->second.size()) continue;
(simHitIt->second)[itime] += ien;
}

//add base data for noise simulation
if(!checkValidDetIds_) return;
if(!geom.isValid()) return;
HGCSimHitData baseData(10,0);
const std::vector<DetId> &validIds=geom->getValidDetIds();
int nadded(0);
for(std::vector<DetId>::const_iterator it=validIds.begin(); it!=validIds.end(); it++)
{
uint32_t id(it->rawId());
if(simHitAccumulator_.find(id)!=simHitAccumulator_.end()) continue;
simHitAccumulator_[id]=baseData;
nadded++;
}
std::cout << "Added " << nadded << " detIds without " << hitCollection_ << " in first event processed" << std::endl;
checkValidDetIds_=false;
}

//
Expand Down
6 changes: 3 additions & 3 deletions SimGeneral/MixingModule/python/hgcalDigitizer_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
hgchebackDigitizer = hgceeDigitizer.clone()
hgchebackDigitizer.hitCollection = cms.untracked.string("HGCHitsHEback")
hgchebackDigitizer.digiCollection = cms.untracked.string("HGCDigisHEback")
hgchefrontDigitizer.digiCfg.mipInKeV = cms.untracked.double(1498.4)
hgchefrontDigitizer.digiCfg.lsbInMIP = cms.untracked.double(0.25)
hgchefrontDigitizer.digiCfg.mip2noise = cms.untracked.double(5.0)
hgchebackDigitizer.digiCfg.mipInKeV = cms.untracked.double(1498.4)
hgchebackDigitizer.digiCfg.lsbInMIP = cms.untracked.double(0.25)
hgchebackDigitizer.digiCfg.mip2noise = cms.untracked.double(5.0)



Expand Down