Commit 733ed173 authored by Jihee Kim's avatar Jihee Kim
Browse files

improved that all blocks are within limits of inner/outer radius and its shape is symmetrical now

parent f5e6fde1
Pipeline #2642 passed with stage
in 40 seconds
......@@ -115,7 +115,7 @@
<!-- Define detector -->
<detectors>
<detector id="1" name="ForwardElectronECAL" type="CrystalEndcapECAL" readout="EcalEndcapHits" vis="RedVis">
<dimensions rmin="15.0*cm" rmax="60.0*cm" zmin="-30.0*cm" zmax="30.0*cm"/>
<dimensions rmin="12.0*cm" rmax="60.0*cm" zmin="-10.0*cm" zmax="10.0*cm"/>
<comment>Electromagnetic Calorimeter Endcaps</comment>
</detector>
</detectors>
......
......@@ -47,10 +47,14 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
// Box-shaped crystal dimension
double box_x_width = 2*cm;
double box_y_width = 2*cm;
double box_z_length = 60.5*cm;
double box_z_length = 20*cm;
// Gap between box-shaped crystals
double offset_x = 1*mm;
double offset_y = 1*mm;
double offset_diagonal = box_x_width*sqrt(2)/2.0 + 0.1*cm;
// Limits
double limit_inner = rmin + offset_diagonal;
double limit_outer = rmax - offset_diagonal;
// Number of crystals in a grid
int nx = floor(rmax/box_x_width);
int ny = floor(rmax/box_y_width);
......@@ -73,12 +77,12 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
int i_module = 0;
for(int iy=0; iy<ny-1; iy++){
for(int ix=0; ix<nx; ix++){
double x_start = box_x_width/2.0;
double x_start = box_x_width/2.0 + offset_x/2.0;
if(ix==0)
{
pos_x = x_start;
if(sqrt((pos_x*pos_x) + (pos_y*pos_y)) > rmin){
if(sqrt((pos_x*pos_x) + (pos_y*pos_y)) > limit_inner){
pv_box = assembly.placeVolume(vol, Position(pos_x,pos_y,0.0));
i_module++;
}
......@@ -90,7 +94,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
{
// Move to +X
pos_x += x_spacing;
if(sqrt((pos_x*pos_x) + (pos_y*pos_y)) < rmax && sqrt((pos_x*pos_x) + (pos_y*pos_y)) > rmin)
if(sqrt((pos_x*pos_x) + (pos_y*pos_y)) < limit_outer && sqrt((pos_x*pos_x) + (pos_y*pos_y)) > limit_inner)
{
pv_box = assembly.placeVolume(vol, Position(pos_x,pos_y,0.0));
i_module++;
......@@ -115,12 +119,12 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
i_module=0;
for(int iy=0; iy<ny-1; iy++){
for(int ix=0; ix<nx; ix++){
double x_start = box_x_width/2.0 + offset_x;
double x_start = box_x_width/2.0 + offset_x/2.0;
if(ix==0)
{
pos_x = - x_start;
if(sqrt((pos_x*pos_x) + (pos_y*pos_y)) > rmin){
if(sqrt((pos_x*pos_x) + (pos_y*pos_y)) > limit_inner){
pv_box = assembly.placeVolume(vol, Position(pos_x,pos_y,0.0));
i_module++;
}
......@@ -132,7 +136,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
{
// Move to -X
pos_x -= x_spacing;
if(sqrt((pos_x*pos_x) + (pos_y*pos_y)) < rmax && sqrt((pos_x*pos_x) + (pos_y*pos_y)) > rmin){
if(sqrt((pos_x*pos_x) + (pos_y*pos_y)) < limit_outer && sqrt((pos_x*pos_x) + (pos_y*pos_y)) > limit_inner){
pv_box = assembly.placeVolume(vol, Position(pos_x,pos_y,0.0));
i_module++;
}
......@@ -157,12 +161,12 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
i_module=0;
for(int iy=0; iy<ny-2; iy++){
for(int ix=0; ix<nx; ix++){
double x_start = box_x_width/2.0;
double x_start = box_x_width/2.0 + offset_x/2.0;
if(ix==0)
{
pos_x = x_start;
if(sqrt((pos_x*pos_x) + (pos_y*pos_y)) > rmin){
if(sqrt((pos_x*pos_x) + (pos_y*pos_y)) > limit_inner){
pv_box = assembly.placeVolume(vol, Position(pos_x,pos_y,0.0));
i_module++;
}
......@@ -174,7 +178,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
{
// Move to +X
pos_x += x_spacing;
if(sqrt((pos_x*pos_x) + (pos_y*pos_y)) < rmax && sqrt((pos_x*pos_x) + (pos_y*pos_y)) > rmin){
if(sqrt((pos_x*pos_x) + (pos_y*pos_y)) < limit_outer && sqrt((pos_x*pos_x) + (pos_y*pos_y)) > limit_inner){
pv_box = assembly.placeVolume(vol, Position(pos_x,pos_y,0.0));
i_module++;
}
......@@ -200,12 +204,12 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
for(int iy=0; iy<ny-2; iy++){
for(int ix=0; ix<nx; ix++)
{
double x_start = box_x_width/2.0 + offset_x;
double x_start = box_x_width/2.0 + offset_x/2.0;
if(ix==0)
{
pos_x = - x_start;
if(sqrt((pos_x*pos_x) + (pos_y*pos_y)) > rmin){
if(sqrt((pos_x*pos_x) + (pos_y*pos_y)) > limit_inner){
pv_box = assembly.placeVolume(vol, Position(pos_x,pos_y,0.0));
i_module++;
}
......@@ -217,7 +221,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
{
// Move to -X
pos_x -= x_spacing;
if(sqrt((pos_x*pos_x) + (pos_y*pos_y)) < rmax && sqrt((pos_x*pos_x) + (pos_y*pos_y)) > rmin){
if(sqrt((pos_x*pos_x) + (pos_y*pos_y)) < limit_outer && sqrt((pos_x*pos_x) + (pos_y*pos_y)) > limit_inner){
pv_box = assembly.placeVolume(vol, Position(pos_x,pos_y,0.0));
i_module++;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment