Skip to content

Commit

Permalink
Add sensitive thickness and absorber thickness. Scale the layerheight…
Browse files Browse the repository at this point in the history
… radially which was along the inclined electrode.
  • Loading branch information
SwathiSasikumar committed Nov 7, 2023
1 parent 16c9bae commit 3e58bdb
Showing 1 changed file with 45 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -576,35 +576,56 @@ static dd4hep::detail::Ref_t createECalBarrelInclined(dd4hep::Detector& aLcdd,
dd4hep::rec::LayeredCalorimeterData::Layer caloLayer;
double nRadiationLengths = 0.;
double nInteractionLengths = 0.;
double thickness_sum = 0.;
double absorberThickness = 0.;

double rad_first = Rmin;
double rad_last = 0;
for (auto il = 0; il < layerHeight.size(); il++){
rad_last = rad_first + layerHeight[il];
dd4hep::rec::Vector3D ivr1 = dd4hep::rec::Vector3D(0.,rad_first,0);
dd4hep::rec::Vector3D ivr2 = dd4hep::rec::Vector3D(0.,rad_last,0);

const dd4hep::rec::MaterialVec& materials = matMgr.materialsBetween(ivr1, ivr2);
auto mat = matMgr.createAveragedMaterial( materials) ;
nRadiationLengths = mat.radiationLength();
nInteractionLengths = mat.interactionLength();
double difference_bet_r1r2 = (ivr1-ivr2).r();
double value_of_x0 = layerHeight[il] / nRadiationLengths;
double value_of_lambda = layerHeight[il] / nInteractionLengths;
double scale_fact = dR / (-Rmin * cos(angle) + sqrt(pow(Rmax, 2) - pow(Rmin * sin(angle), 2)));
// since the layer height is given along the electrode and not along the radius it needs to be scaled to get the values of layer height radially
std::cout << "Scaling factor " << scale_fact << std::endl;
for (auto il = 0; il < layerHeight.size(); il++) {
double thickness_sen = 0.;
double absorberThickness = 0.;

rad_last = rad_first + (layerHeight[il] * scale_fact);
dd4hep::rec::Vector3D ivr1 = dd4hep::rec::Vector3D(0., rad_first, 0); // defining starting vector points of the given layer
dd4hep::rec::Vector3D ivr2 = dd4hep::rec::Vector3D(0., rad_last, 0); // defining end vector points of the given layer

std::cout << "radius first " << rad_first << " radius last " << rad_last << std::endl;
const dd4hep::rec::MaterialVec &materials = matMgr.materialsBetween(ivr1, ivr2); // calling material manager to get material info between two points
auto mat = matMgr.createAveragedMaterial(materials); // creating average of all the material between two points to calculate X0 and lambda of averaged material
const double nRadiationLengths = mat.radiationLength();
const double nInteractionLengths = mat.interactionLength();
const double difference_bet_r1r2 = (ivr1 - ivr2).r();
const double value_of_x0 = layerHeight[il] / nRadiationLengths;
const double value_of_lambda = layerHeight[il] / nInteractionLengths;
std::string str1("LAr");

for (auto imat = 0; imat < materials.size(); imat++) {

std::string str2(materials.at(imat).first.name());
if (str1.compare(str2) == 0){
thickness_sen += materials.at(imat).second;
}
else {
absorberThickness += materials.at(imat).second;
}
}
rad_first = rad_last;
std::cout<<"The radiation length is "<<value_of_x0<<" and the interaction length is "<<value_of_lambda<<std::endl;
std::cout << "The sensitive thickness is " << thickness_sen << std::endl;
std::cout << "The absorber thickness is " << absorberThickness << std::endl;
std::cout << "The radiation length is " << value_of_x0 << " and the interaction length is " << value_of_lambda << std::endl;

caloLayer.distance = rad_first;
caloLayer.sensitive_thickness = 30 ;
caloLayer.inner_nRadiationLengths = value_of_x0/2.0;
caloLayer.inner_nInteractionLengths = value_of_lambda/2.0;
caloLayer.inner_thickness = difference_bet_r1r2/2.0;

caloLayer.outer_nRadiationLengths = value_of_x0/2.0;
caloLayer.outer_nInteractionLengths = value_of_lambda;
caloLayer.outer_thickness = difference_bet_r1r2/2;
caloLayer.absorberThickness = 2;
caloLayer.sensitive_thickness = thickness_sen;
caloLayer.inner_nRadiationLengths = value_of_x0 / 2.0;
caloLayer.inner_nInteractionLengths = value_of_lambda / 2.0;
caloLayer.inner_thickness = difference_bet_r1r2 / 2.0;

caloLayer.outer_nRadiationLengths = value_of_x0 / 2.0;
caloLayer.outer_nInteractionLengths = value_of_lambda / 2.0;
caloLayer.outer_thickness = difference_bet_r1r2 / 2;

caloLayer.absorberThickness = absorberThickness;
caloLayer.cellSize0 = 2;
caloLayer.cellSize1 = 2;

Expand Down

0 comments on commit 3e58bdb

Please sign in to comment.