Skip to content
Snippets Groups Projects
Commit ebe7865f authored by FU Chengdong's avatar FU Chengdong
Browse files

add birks

parent ba691f32
No related branches found
No related tags found
No related merge requests found
......@@ -33,6 +33,7 @@ CaloSensitiveDetector::ProcessHits(G4Step* step, G4TouchableHistory*) {
// std::cout << "CaloSensitiveDetector::ProcessHits" << std::endl;
dd4hep::sim::Geant4StepHandler h(step);
if(m_applyBirksLaw) h.doApplyBirksLaw();
dd4hep::Position pos = 0.5 * (h.prePos() + h.postPos());
HitContribution contrib = dd4hep::sim::Geant4Hit::extractContribution(step);
const std::string& name = GetName();
......@@ -62,9 +63,9 @@ CaloSensitiveDetector::ProcessHits(G4Step* step, G4TouchableHistory*) {
m_hc->insert(hit);
}
hit->truth.push_back(contrib);
hit->energyDeposit += contrib.deposit;
//hit->energyDeposit += contrib.deposit;
hit->energyDeposit += h.totalEnergy();
//std::cout << "Apply Birk law: before = " << contrib.deposit << " after = " << h.totalEnergy() << std::endl;
return true;
}
......
......@@ -42,9 +42,13 @@ CalorimeterSensDetTool::createSD(const std::string& name) {
break;
}
}
G4VSensitiveDetector* sd = new CaloSensitiveDetector(name, *dd4hep_geo, is_merge_enabled);
CaloSensitiveDetector* sd = new CaloSensitiveDetector(name, *dd4hep_geo, is_merge_enabled);
debug() << name << " set to merge true/false = " << is_merge_enabled << endmsg;
auto sens = dd4hep_geo->sensitiveDetector(name);
std::string typ = sens.type();
if(typ=="scintillator"&&m_applyBirksLaw) sd->ApplyBirksLaw();
return sd;
}
......
......@@ -30,6 +30,7 @@ private:
SmartIF<IGeomSvc> m_geosvc;
Gaudi::Property<std::vector<std::string> > m_listCalsMergeDisable{this, "CalNamesMergeDisable", {}};
Gaudi::Property<bool> m_applyBirksLaw{this, "ApplyBirksLaw", true};
};
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment