Commit 268cf9ef authored by Jihee Kim's avatar Jihee Kim
Browse files

Merge branch 'jihee' into 'master'

CellID fix for simulation

See merge request !2
parents 399a37f3 34d86f76
Pipeline #2633 passed with stage
......@@ -26,6 +26,8 @@
<constant name="CrossingAngle" value="0.020*rad"/>
<constant name="tracker_region_zmax" value="5 * m"/>
<constant name="tracker_region_rmax" value="5 * m"/>
<constant name="tracking_region_radius" value="1269 * mm"/>
<constant name="tracking_region_zmax_orig" value="1684 * mm"/>
<constant name="trackerZScale" value="1"/>
......@@ -121,8 +123,8 @@
<!-- Definition of the readout segmentation/definition -->
<readouts>
<readout name="EcalEndcapHits">
<segmentation type="CartesianGridXY" grid_size_x="3.5" grid_size_y="3.5" />
<id>system:8,barrel:3,module:4,layer:6,slice:5,x:32:-16,y:-16</id>
<segmentation type="CartesianGridXY" grid_size_x="3.5*cm" grid_size_y="3.5*cm" />
<id>system:8,sector:4,module:20,layer:6,x:48:-8,y:-8</id>
</readout>
</readouts>
......
......@@ -35,10 +35,10 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
// Create a tube to represent the calorimeter
Tube tube(rmin, rmax, thickness / 2.0);
Volume Vol("tube_volume", tube, PbWO4);
auto PV = assembly.placeVolume(Vol, Position(0.0, 0.0, 0.0));
PV.addPhysVolID("layer", 0);
sens.setType("calorimeter");
Vol.setSensitiveDetector(sens);
//auto PV = assembly.placeVolume(Vol, Position(0.0, 0.0, 0.0));
//PV.addPhysVolID("layer", 0);
//sens.setType("calorimeter");
//Vol.setSensitiveDetector(sens);
// Tube is filled with box-shaped crystals forming a grid.
Assembly box_assembly("box_assembly");
......@@ -70,6 +70,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
////////////////////////////////////////////////////////////////////////////////////
// Top left
////////////////////////////////////////////////////////////////////////////////////
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;
......@@ -77,21 +78,28 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
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)) > rmin){
pv_box = assembly.placeVolume(vol, Position(pos_x,pos_y,0.0));
else
i_module++;
}
else{
continue;
}
}
else
{
// 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)
{
pv_box = assembly.placeVolume(vol, Position(pos_x,pos_y,0.0));
else
i_module++;
}
else{
continue;
}
}
pv_box.addPhysVolID("layer",0);
pv_box.addPhysVolID("sector",1).addPhysVolID("module",i_module);
sens.setType("calorimeter");
vol.setSensitiveDetector(sens);
}
......@@ -104,6 +112,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
////////////////////////////////////////////////////////////////////////////////////
// Initialize position in Y
pos_y = 0.0;
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;
......@@ -111,21 +120,27 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
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)) > rmin){
pv_box = assembly.placeVolume(vol, Position(pos_x,pos_y,0.0));
else
i_module++;
}
else{
continue;
}
}
else
{
// 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)) < rmax && sqrt((pos_x*pos_x) + (pos_y*pos_y)) > rmin){
pv_box = assembly.placeVolume(vol, Position(pos_x,pos_y,0.0));
else
i_module++;
}
else{
continue;
}
}
pv_box.addPhysVolID("layer",0);
pv_box.addPhysVolID("sector",2).addPhysVolID("module",i_module);
sens.setType("calorimeter");
vol.setSensitiveDetector(sens);
}
......@@ -139,6 +154,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
// It's below the first row of the section of Top left
// That's why ny goes up to ny -2 (the first row of Bottom left starts one row less)
pos_y = -y_spacing;
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;
......@@ -146,21 +162,27 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
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)) > rmin){
pv_box = assembly.placeVolume(vol, Position(pos_x,pos_y,0.0));
else
i_module++;
}
else{
continue;
}
}
else
{
// 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)) < rmax && sqrt((pos_x*pos_x) + (pos_y*pos_y)) > rmin){
pv_box = assembly.placeVolume(vol, Position(pos_x,pos_y,0.0));
else
i_module++;
}
else{
continue;
}
}
pv_box.addPhysVolID("layer",0);
pv_box.addPhysVolID("sector",3).addPhysVolID("module",i_module);
sens.setType("calorimeter");
vol.setSensitiveDetector(sens);
}
......@@ -174,6 +196,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
// Again it's below the first row of the section of Top left
// That's why ny goes up to ny -2 (the first row of Bottom left starts one row less)
pos_y = -y_spacing;
i_module=0;
for(int iy=0; iy<ny-2; iy++){
for(int ix=0; ix<nx; ix++)
{
......@@ -182,21 +205,27 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
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)) > rmin){
pv_box = assembly.placeVolume(vol, Position(pos_x,pos_y,0.0));
else
i_module++;
}
else{
continue;
}
}
else
{
// 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)) < rmax && sqrt((pos_x*pos_x) + (pos_y*pos_y)) > rmin){
pv_box = assembly.placeVolume(vol, Position(pos_x,pos_y,0.0));
else
i_module++;
}
else{
continue;
}
}
pv_box.addPhysVolID("layer",0);
pv_box.addPhysVolID("sector",4).addPhysVolID("module",i_module);
sens.setType("calorimeter");
vol.setSensitiveDetector(sens);
}
......
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