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

Phase2 shk23 #4047

Merged
merged 2 commits into from
Jun 3, 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
2 changes: 1 addition & 1 deletion Geometry/HGCalSimData/data/shashliksens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<PartSelector path="//ShashlikActive.*"/>
<Parameter name="SensitiveDetector" value="ShashlikSensitiveDetector" eval="false"/>
<Parameter name="ReadOutName" value="EcalHitsEK" eval="false"/>
<Parameter name="ModuleLength" value="56.75*mm"/>
<Parameter name="ModuleLength" value="113.5*mm"/>
<Parameter name="FiberLength" value="0.75*mm"/>
<Parameter name="FiberLength" value="4.75*mm"/>
<Parameter name="FiberLength" value="8.75*mm"/>
Expand Down
2 changes: 2 additions & 0 deletions SimG4CMS/Calo/interface/ShashlikSD.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ class ShashlikSD : public CaloSD {
virtual double getEnergyDeposit(G4Step*);
virtual uint16_t getDepth(G4Step*);
virtual uint32_t setDetUnitId(G4Step*);
G4double getAttenuation(G4Step* aStep, double birk1,
double birk2, double birk3);

private:

Expand Down
43 changes: 35 additions & 8 deletions SimG4CMS/Calo/src/ShashlikSD.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ ShashlikSD::ShashlikSD(G4String name, const DDCompactView & cpv,

edm::ParameterSet m_EC = p.getParameter<edm::ParameterSet>("ShashlikSD");
useBirk = m_EC.getParameter<bool>("UseBirkLaw");
birk1 = m_EC.getParameter<double>("BirkC1")*(g/(MeV*cm2));
birk1 = m_EC.getParameter<double>("BirkC1");
birk2 = m_EC.getParameter<double>("BirkC2");
birk3 = m_EC.getParameter<double>("BirkC3");
if (useBirk) {
edm::LogInfo("EcalSim") << "ShashlikSD:: Use of Birks law is set to "
<< useBirk << " with three constants kB = "
<< birk1 << ", C1 = " << birk2 << ", C2 = "
edm::LogInfo("EcalSim") << "ShashlikSD:: Use of Birks law is set to "
<< useBirk << " with three constants a = "
<< birk1 << ", b = " << birk2 << ", c = "
<< birk3;
} else {
edm::LogInfo("EcalSim") << "ShashlikSD:: energy deposit is not corrected "
Expand Down Expand Up @@ -125,7 +125,7 @@ bool ShashlikSD::ProcessHits(G4Step * aStep, G4TouchableHistory * ) {
}
if (edepositEM+edepositHAD>0.) {
double edepEM(edepositEM), edepHad(edepositHAD);
int fibMax = (useWeight) ? 5 : 1;
int fibMax = (useWeight) ? 4 : 1;
int roMax = (roType == 0) ? 1 : 2;
int layer = preStepPoint->GetTouchable()->GetReplicaNumber(0);
G4ThreeVector localPoint = setToLocal(preStepPoint->GetPosition(),
Expand All @@ -138,12 +138,13 @@ bool ShashlikSD::ProcessHits(G4Step * aStep, G4TouchableHistory * ) {
uint32_t id0 = setDetUnitId(aStep);
if (id0) { // hit is in Shashlik LYSO tile
for (int fib = 0; fib < fibMax; ++fib) {
double wt1 = (useWeight) ? fiberWt(fib, localPoint) : 1;
int fib0= (useWeight) ? fib+1 : fib;
double wt1 = (useWeight) ? fiberWt(fib0, localPoint) : 1;
for (int rx = 0; rx < roMax; ++rx) {
double wt2 = fiberLoss(layer, rx);
int ro = (roType == 0) ? rx : rx+1;
EKDetId id = EKDetId(id0);
id.setFiber(fib,ro);
id.setFiber(fib0,ro);
uint32_t unitID = (id.rawId());
currentID.setID(unitID, time, primaryID, depth);
edepositEM = edepEM*wt1*wt2;
Expand Down Expand Up @@ -226,6 +227,32 @@ uint32_t ShashlikSD::setDetUnitId(G4Step *aStep) {
return EKDetId(ixy.first,ixy.second,0,0,iz).rawId();
}

G4double ShashlikSD::getAttenuation(G4Step* aStep, double birk1,
double birk2, double birk3) {

double weight = 1.;
double charge = aStep->GetPreStepPoint()->GetCharge();
if (charge != 0. && aStep->GetStepLength() > 0) {
G4Material* mat = aStep->GetPreStepPoint()->GetMaterial();
double density = mat->GetDensity()/(CLHEP::g/CLHEP::cm3);
double dE = aStep->GetTotalEnergyDeposit()/CLHEP::MeV;
double dx = aStep->GetStepLength()/CLHEP::cm;
double dedx = dE/(dx*density);
if (dedx > 0) {
weight = birk1/(1.+birk2*dedx+birk3/dedx);
if (weight > 1.0) weight = 1.0;
}
#ifdef DebugLog
std::cout << "ShashlikSD::getAttenuation in " << mat->GetName()
<< " Charge " << charge << " dE/dx " << dE << ":" << dx << ":"
<< density << ":" << dedx << " Birk Const " << birk1 << ", "
<< birk2 << ", " << birk3 << " Weight = " << weight << std::endl;
#endif
}
return weight;
}


G4double ShashlikSD::fiberWt(G4int k, G4ThreeVector localPoint) {

double wt(0);
Expand Down Expand Up @@ -265,7 +292,7 @@ G4double ShashlikSD::fiberLoss(G4int layer, G4int rx) {
exp(-(moduleL+fiberL[layer-1])/attL));
} else {
double fbl = (rx == 0) ? moduleL-fiberL[layer-1] : fiberL[layer-1];
wt = exp(-fbl/attL);
wt = 0.5*exp(-fbl/attL);
}
} else {
if (roType != 0) wt = 0.5;
Expand Down
6 changes: 3 additions & 3 deletions SimG4Core/Application/python/g4SimHits_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,9 +399,9 @@
),
ShashlikSD = cms.PSet(
UseBirkLaw = cms.bool(False),
BirkC1 = cms.double(0.03333),
BirkC2 = cms.double(0.253694),
BirkC3 = cms.double(0.10),
BirkC1 = cms.double(0.883),
BirkC2 = cms.double(0.0065),
BirkC3 = cms.double(-0.241),
UseWeight = cms.bool(False),
FileName = cms.FileInPath('SimG4CMS/Calo/data/map_absL_100_LYSO_smooth.root'),
ReadOutType = cms.int32(0),
Expand Down