diff --git a/DDDetectors/shipdetectors/Caloprototype.xml b/DDDetectors/shipdetectors/Caloprototype.xml
new file mode 100644
index 00000000..a967b489
--- /dev/null
+++ b/DDDetectors/shipdetectors/Caloprototype.xml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Calorimeters
+
+
+
+
+
diff --git a/DDDetectors/shipdetectors/Detectors/ECAL/SplitCal.xml b/DDDetectors/shipdetectors/Detectors/PID/ECAL/SplitCal.xml
similarity index 100%
rename from DDDetectors/shipdetectors/Detectors/ECAL/SplitCal.xml
rename to DDDetectors/shipdetectors/Detectors/PID/ECAL/SplitCal.xml
diff --git a/DDDetectors/shipdetectors/Detectors/ECAL/SplitCalBars.xml b/DDDetectors/shipdetectors/Detectors/PID/ECAL/SplitCalBars.xml
similarity index 93%
rename from DDDetectors/shipdetectors/Detectors/ECAL/SplitCalBars.xml
rename to DDDetectors/shipdetectors/Detectors/PID/ECAL/SplitCalBars.xml
index 67326a67..0c9d56f1 100644
--- a/DDDetectors/shipdetectors/Detectors/ECAL/SplitCalBars.xml
+++ b/DDDetectors/shipdetectors/Detectors/PID/ECAL/SplitCalBars.xml
@@ -12,11 +12,11 @@
SplitCal test
-
+
-
+
@@ -49,11 +49,11 @@
SplitCal test
-
+
-
+
diff --git a/DDDetectors/shipdetectors/Detectors/ECAL/SplitCalBars_bu.xml b/DDDetectors/shipdetectors/Detectors/PID/ECAL/SplitCalBars_bu.xml
similarity index 100%
rename from DDDetectors/shipdetectors/Detectors/ECAL/SplitCalBars_bu.xml
rename to DDDetectors/shipdetectors/Detectors/PID/ECAL/SplitCalBars_bu.xml
diff --git a/DDDetectors/shipdetectors/Detectors/ECAL/SplitCalTest.xml b/DDDetectors/shipdetectors/Detectors/PID/ECAL/SplitCalTest.xml
similarity index 100%
rename from DDDetectors/shipdetectors/Detectors/ECAL/SplitCalTest.xml
rename to DDDetectors/shipdetectors/Detectors/PID/ECAL/SplitCalTest.xml
diff --git a/DDDetectors/shipdetectors/Detectors/ECAL/SplitCal_old.xml b/DDDetectors/shipdetectors/Detectors/PID/ECAL/SplitCal_old.xml
similarity index 100%
rename from DDDetectors/shipdetectors/Detectors/ECAL/SplitCal_old.xml
rename to DDDetectors/shipdetectors/Detectors/PID/ECAL/SplitCal_old.xml
diff --git a/DDDetectors/shipdetectors/Detectors/HCAL/HCAL.xml b/DDDetectors/shipdetectors/Detectors/PID/HCAL/HCAL.xml
similarity index 100%
rename from DDDetectors/shipdetectors/Detectors/HCAL/HCAL.xml
rename to DDDetectors/shipdetectors/Detectors/PID/HCAL/HCAL.xml
diff --git a/DDDetectors/shipdetectors/Detectors/HCAL/HCALBars.xml b/DDDetectors/shipdetectors/Detectors/PID/HCAL/HCALBars.xml
similarity index 96%
rename from DDDetectors/shipdetectors/Detectors/HCAL/HCALBars.xml
rename to DDDetectors/shipdetectors/Detectors/PID/HCAL/HCALBars.xml
index 78de19f4..7d0cdb73 100644
--- a/DDDetectors/shipdetectors/Detectors/HCAL/HCALBars.xml
+++ b/DDDetectors/shipdetectors/Detectors/PID/HCAL/HCALBars.xml
@@ -20,7 +20,7 @@
-
+
diff --git a/DDDetectors/shipdetectors/Detectors/PID/Prototypes/ProtoECAL.xml b/DDDetectors/shipdetectors/Detectors/PID/Prototypes/ProtoECAL.xml
new file mode 100644
index 00000000..c04bc018
--- /dev/null
+++ b/DDDetectors/shipdetectors/Detectors/PID/Prototypes/ProtoECAL.xml
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ system:8,splitcal_bar:6,splitcal_layer:6,x:22,y:22
+
+
+
+ system:8,splitcal_bar:8,splitcal_layer:8,x:20,y:20
+
+
+
+ system:8,splitcal_layer:4,splitcal_hpl_layer:4,splitcal_hplfibre:12,x:16,y:16
+
+
+
+
+
+
+
diff --git a/DDDetectors/shipdetectors/Detectors/PID/Prototypes/ProtoECALBars.xml b/DDDetectors/shipdetectors/Detectors/PID/Prototypes/ProtoECALBars.xml
new file mode 100644
index 00000000..2ebf3e22
--- /dev/null
+++ b/DDDetectors/shipdetectors/Detectors/PID/Prototypes/ProtoECALBars.xml
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+
+
+
+
+
+ SplitCal test
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ SplitCal test
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/DDDetectors/shipdetectors/Detectors/PID/Prototypes/ProtoHCAL.xml b/DDDetectors/shipdetectors/Detectors/PID/Prototypes/ProtoHCAL.xml
new file mode 100644
index 00000000..e225823f
--- /dev/null
+++ b/DDDetectors/shipdetectors/Detectors/PID/Prototypes/ProtoHCAL.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ system:8,hcal_layer:4,widebar:10,hcal_passivelayer:1,x:16,y:16
+
+
+
+
+
+
+
diff --git a/DDDetectors/shipdetectors/Detectors/PID/Prototypes/ProtoHCALBars.xml b/DDDetectors/shipdetectors/Detectors/PID/Prototypes/ProtoHCALBars.xml
new file mode 100644
index 00000000..875f7ab1
--- /dev/null
+++ b/DDDetectors/shipdetectors/Detectors/PID/Prototypes/ProtoHCALBars.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+ HCAL test
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/DDDetectors/shipdetectors/SHiPCalo.xml b/DDDetectors/shipdetectors/SHiPCalo.xml
index c64ef114..c58fba2e 100644
--- a/DDDetectors/shipdetectors/SHiPCalo.xml
+++ b/DDDetectors/shipdetectors/SHiPCalo.xml
@@ -45,7 +45,7 @@
Calorimeters
-
+
diff --git a/DDDetectors/shipdetectors/materials.xml b/DDDetectors/shipdetectors/materials.xml
index d92c4b6e..8c866b7a 100644
--- a/DDDetectors/shipdetectors/materials.xml
+++ b/DDDetectors/shipdetectors/materials.xml
@@ -11,6 +11,13 @@
+
+
+
+
+
+
+
diff --git a/DDDetectors/shipdetectors/scripts/dumb_digitisation.C b/DDDetectors/shipdetectors/scripts/dumb_digitisation.C
new file mode 100644
index 00000000..592f4b4e
--- /dev/null
+++ b/DDDetectors/shipdetectors/scripts/dumb_digitisation.C
@@ -0,0 +1,174 @@
+#include
+#include
+#include // For setting output precision
+
+// ROOT includes
+#include "TSystem.h"
+#include "TFile.h"
+#include "TTree.h"
+#include "TInterpreter.h"
+
+// DD4hep includes
+#include "DD4hep/Objects.h"
+#include "DDG4/Geant4Data.h"
+
+void Reset_nhits(int *arr){
+
+ for(int i=0;i<5;i++){
+ arr[i] = 0;
+ }
+
+}
+
+double vec_sum(const std::vector v){
+ double sum = 0;
+ for(auto a:v){
+ sum += a;
+ }
+ return sum;
+}
+
+double vec_av(const std::vector v){
+ return vec_sum(v)/static_cast(v.size());
+}
+
+double vec_rms(const std::vector& data) {
+ if (data.empty()) {
+ return 0.0;
+ }
+ double sum_of_squares = 0.0;
+ for (double value : data) {
+ sum_of_squares += value * value;
+ }
+ double mean_of_squares = sum_of_squares / data.size();
+ return TMath::Sqrt(mean_of_squares);
+}
+
+
+int DecodeLayer(double z){
+ int layer = -9999;
+ if(z > 0 && z < 100) layer = 0;
+ if(z > 100 && z < 300) layer = 1;
+ if(z > 300 && z < 400) layer = 2;
+ if(z > 400 && z < 600) layer = 3;
+ if(z > 600 && z < 800) layer = 4;
+ return layer;
+}
+
+
+
+void setup_data_csv(std::string inparticle, int energy, int runid) {
+ // ============================================================
+ // 1. LOAD LIBRARIES AND GENERATE DICTIONARY
+ // ============================================================
+
+ // Load DD4hep libraries (required for I/O and class definitions)
+ if (gSystem->Load("libDDCore") < 0 && gSystem->Load("libDD4hep") < 0) {
+ std::cerr << "Error: Could not load DD4hep core library." << std::endl;
+ return;
+ }
+ gSystem->Load("libDDG4");
+ gSystem->Load("libDDG4IO"); // Crucial for StreamerInfo/Dictionaries
+
+ // Generate Dictionary for the hits vector (required for TTree::SetBranchAddress)
+ gInterpreter->GenerateDictionary("vector",
+ "vector;DD4hep/Objects.h;DDG4/Geant4Data.h");
+
+ // ============================================================
+ // 2. OPEN FILE AND GET TREE
+ // ============================================================
+
+ TString instr = "/eos/user/m/mclimesc/SPLITCAL/SplitCalPhysics/DD4HEP_PID/PID_NoSplitCal/"+inparticle+"_sample_%dGeV_%d.root";
+ cout << Form(instr,energy) << endl;
+ TFile* file = new TFile(Form(instr,energy,runid), "READ");
+ if (!file || file->IsZombie()) {
+ std::cerr << "Error: Could not open file 'testSHiPCalo.root'!" << std::endl;
+ return;
+ }
+
+ TTree* tree = (TTree*)file->Get("EVENT");
+ if (!tree) {
+ std::cerr << "Error: TTree 'EVENT' not found!" << std::endl;
+ file->Close();
+ return;
+ }
+
+ // ============================================================
+ // 3. SETUP BRANCH ADDRESS
+ // ============================================================
+ // Define the pointer to the vector of hits. Initialize to nullptr.
+ std::vector* Hhits = nullptr;
+
+ tree->SetBranchAddress("SHiPHCALHits", &Hhits);
+
+ // ============================================================
+ // 4. LOOP OVER EVENTS AND HITS
+ // ============================================================
+ int nEvents = tree->GetEntries();
+ std::cout << "--- Starting analysis of " << nEvents << " events ---" << std::endl;
+ std::cout << std::fixed << std::setprecision(5); // Set precision for coordinates/energy
+
+ std::stringstream filename;
+ filename << "/eos/user/m/mclimesc/SPLITCAL/SplitCalPhysics/DD4HEP_PID/PID_NoSplitCal/" << inparticle << "_sample_" << energy << "GeV_"<< runid <<".csv";
+
+ ofstream outfile;
+ outfile.open(filename.str());
+
+ outfile << "event,";
+
+ for(int hcallayer=0;hcallayer<5;hcallayer++){
+
+ outfile << "avx_" << hcallayer << ",";
+ outfile << "avy_" << hcallayer << ",";
+ outfile << "rmsx_" << hcallayer << ",";
+ outfile << "rmsy_" << hcallayer << ",";
+ outfile << "nhits_" << hcallayer << ",";
+ outfile << "sumenergydep_" << hcallayer << ",";
+ outfile << "rmsenergydep_" << hcallayer << ",";
+
+ }
+
+ outfile << endl;
+
+ std::array,5> v_energydep;
+ std::array,5> v_x;
+ std::array,5> v_y;
+
+ int nhits_layers[5] = {0,0,0,0,0};
+
+ for (int ev = 0;ev < nEvents; ev++) {
+ tree->GetEntry(ev);
+
+
+ int nHHits = Hhits->size();
+
+ for (size_t j = 0; j < Hhits->size(); ++j) {
+ dd4hep::sim::Geant4Calorimeter::Hit* hit = Hhits->at(j);
+ double energy = hit->energyDeposit;
+ double x = hit->position.x();
+ double y = hit->position.y();
+ double z = hit->position.z();
+
+
+ int layer = DecodeLayer(z);
+
+ v_x[layer].push_back(x);
+ v_y[layer].push_back(y);
+ v_energydep[layer].push_back(energy);
+ nhits_layers[layer]++;
+
+
+ }
+
+ outfile << ev << ",";
+
+ for(int layerid = 0;layerid<5;layerid++){
+ outfile << vec_av(v_x[layerid]) << "," << vec_av(v_y[layerid]) <<"," << vec_rms(v_x[layerid]) << "," << vec_rms(v_y[layerid]) << "," << nhits_layers[layerid] << vec_sum(v_energydep[layerid]) << "," << vec_rms(v_energydep[layerid]);
+
+ }
+ outfile << endl;
+ }
+
+outfile.close();
+// file->Close();
+}
diff --git a/DDDetectors/shipdetectors/scripts/setup_data_csv.C b/DDDetectors/shipdetectors/scripts/setup_data_csv.C
new file mode 100644
index 00000000..592f4b4e
--- /dev/null
+++ b/DDDetectors/shipdetectors/scripts/setup_data_csv.C
@@ -0,0 +1,174 @@
+#include
+#include
+#include // For setting output precision
+
+// ROOT includes
+#include "TSystem.h"
+#include "TFile.h"
+#include "TTree.h"
+#include "TInterpreter.h"
+
+// DD4hep includes
+#include "DD4hep/Objects.h"
+#include "DDG4/Geant4Data.h"
+
+void Reset_nhits(int *arr){
+
+ for(int i=0;i<5;i++){
+ arr[i] = 0;
+ }
+
+}
+
+double vec_sum(const std::vector v){
+ double sum = 0;
+ for(auto a:v){
+ sum += a;
+ }
+ return sum;
+}
+
+double vec_av(const std::vector v){
+ return vec_sum(v)/static_cast(v.size());
+}
+
+double vec_rms(const std::vector& data) {
+ if (data.empty()) {
+ return 0.0;
+ }
+ double sum_of_squares = 0.0;
+ for (double value : data) {
+ sum_of_squares += value * value;
+ }
+ double mean_of_squares = sum_of_squares / data.size();
+ return TMath::Sqrt(mean_of_squares);
+}
+
+
+int DecodeLayer(double z){
+ int layer = -9999;
+ if(z > 0 && z < 100) layer = 0;
+ if(z > 100 && z < 300) layer = 1;
+ if(z > 300 && z < 400) layer = 2;
+ if(z > 400 && z < 600) layer = 3;
+ if(z > 600 && z < 800) layer = 4;
+ return layer;
+}
+
+
+
+void setup_data_csv(std::string inparticle, int energy, int runid) {
+ // ============================================================
+ // 1. LOAD LIBRARIES AND GENERATE DICTIONARY
+ // ============================================================
+
+ // Load DD4hep libraries (required for I/O and class definitions)
+ if (gSystem->Load("libDDCore") < 0 && gSystem->Load("libDD4hep") < 0) {
+ std::cerr << "Error: Could not load DD4hep core library." << std::endl;
+ return;
+ }
+ gSystem->Load("libDDG4");
+ gSystem->Load("libDDG4IO"); // Crucial for StreamerInfo/Dictionaries
+
+ // Generate Dictionary for the hits vector (required for TTree::SetBranchAddress)
+ gInterpreter->GenerateDictionary("vector",
+ "vector;DD4hep/Objects.h;DDG4/Geant4Data.h");
+
+ // ============================================================
+ // 2. OPEN FILE AND GET TREE
+ // ============================================================
+
+ TString instr = "/eos/user/m/mclimesc/SPLITCAL/SplitCalPhysics/DD4HEP_PID/PID_NoSplitCal/"+inparticle+"_sample_%dGeV_%d.root";
+ cout << Form(instr,energy) << endl;
+ TFile* file = new TFile(Form(instr,energy,runid), "READ");
+ if (!file || file->IsZombie()) {
+ std::cerr << "Error: Could not open file 'testSHiPCalo.root'!" << std::endl;
+ return;
+ }
+
+ TTree* tree = (TTree*)file->Get("EVENT");
+ if (!tree) {
+ std::cerr << "Error: TTree 'EVENT' not found!" << std::endl;
+ file->Close();
+ return;
+ }
+
+ // ============================================================
+ // 3. SETUP BRANCH ADDRESS
+ // ============================================================
+ // Define the pointer to the vector of hits. Initialize to nullptr.
+ std::vector* Hhits = nullptr;
+
+ tree->SetBranchAddress("SHiPHCALHits", &Hhits);
+
+ // ============================================================
+ // 4. LOOP OVER EVENTS AND HITS
+ // ============================================================
+ int nEvents = tree->GetEntries();
+ std::cout << "--- Starting analysis of " << nEvents << " events ---" << std::endl;
+ std::cout << std::fixed << std::setprecision(5); // Set precision for coordinates/energy
+
+ std::stringstream filename;
+ filename << "/eos/user/m/mclimesc/SPLITCAL/SplitCalPhysics/DD4HEP_PID/PID_NoSplitCal/" << inparticle << "_sample_" << energy << "GeV_"<< runid <<".csv";
+
+ ofstream outfile;
+ outfile.open(filename.str());
+
+ outfile << "event,";
+
+ for(int hcallayer=0;hcallayer<5;hcallayer++){
+
+ outfile << "avx_" << hcallayer << ",";
+ outfile << "avy_" << hcallayer << ",";
+ outfile << "rmsx_" << hcallayer << ",";
+ outfile << "rmsy_" << hcallayer << ",";
+ outfile << "nhits_" << hcallayer << ",";
+ outfile << "sumenergydep_" << hcallayer << ",";
+ outfile << "rmsenergydep_" << hcallayer << ",";
+
+ }
+
+ outfile << endl;
+
+ std::array,5> v_energydep;
+ std::array,5> v_x;
+ std::array,5> v_y;
+
+ int nhits_layers[5] = {0,0,0,0,0};
+
+ for (int ev = 0;ev < nEvents; ev++) {
+ tree->GetEntry(ev);
+
+
+ int nHHits = Hhits->size();
+
+ for (size_t j = 0; j < Hhits->size(); ++j) {
+ dd4hep::sim::Geant4Calorimeter::Hit* hit = Hhits->at(j);
+ double energy = hit->energyDeposit;
+ double x = hit->position.x();
+ double y = hit->position.y();
+ double z = hit->position.z();
+
+
+ int layer = DecodeLayer(z);
+
+ v_x[layer].push_back(x);
+ v_y[layer].push_back(y);
+ v_energydep[layer].push_back(energy);
+ nhits_layers[layer]++;
+
+
+ }
+
+ outfile << ev << ",";
+
+ for(int layerid = 0;layerid<5;layerid++){
+ outfile << vec_av(v_x[layerid]) << "," << vec_av(v_y[layerid]) <<"," << vec_rms(v_x[layerid]) << "," << vec_rms(v_y[layerid]) << "," << nhits_layers[layerid] << vec_sum(v_energydep[layerid]) << "," << vec_rms(v_energydep[layerid]);
+
+ }
+ outfile << endl;
+ }
+
+outfile.close();
+// file->Close();
+}
diff --git a/DDDetectors/src/Calo_HCAL_geo.cpp b/DDDetectors/src/Calo_HCAL_geo.cpp
index 1e124720..824d4131 100644
--- a/DDDetectors/src/Calo_HCAL_geo.cpp
+++ b/DDDetectors/src/Calo_HCAL_geo.cpp
@@ -54,8 +54,8 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
// box_vol.setVisAttributes(description.visAttributes(""));
- Box det_wide_layerbox(x_detbox.x()+tol, x_detbox.y()+tol, x_widebar.z()+tol);
- Volume det_wide_layerbox_vol("ecal_det_wide_layerbox", det_wide_layerbox, description.air());
+ Box det_wide_layerbox((x_detbox.x()+tol)/2., (x_detbox.y()+tol)/2., (x_widebar.z()+tol)/2.);
+ Volume det_wide_layerbox_vol("hcal_det_wide_layerbox", det_wide_layerbox, description.air());
det_wide_layerbox_vol.setAttributes(description, x_detbox.regionStr(), x_detbox.limitsStr(), x_detbox.visStr());
det_wide_layerbox_vol.setVisAttributes(description.visAttributes(x_detbox.visStr()));
@@ -63,7 +63,6 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
// Rotation3D rot(RotationZYX(0e0, 0e0, M_PI/2e0));
Rotation3D rot(RotationZYX(0e0, 0e0, 0e0));
- //if( x_widebar.hasChild(_U(sensitive)) ) {
// sens.setType("calorimeter");
widebar_vol.setSensitiveDetector(sens);
//}
@@ -78,8 +77,9 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
//int DetectorCode = 9 * 1e8;
//int HCALCode = 2 * 1e7;
-
- double xpos = -x_detbox.x()/2.;
+ double wideboxwidth = x_widebar.x()*static_cast(widebar_num_x);
+ double xpos = -(wideboxwidth+tol)/2.;
+
for( int ix=0; ix < widebar_num_x; ++ix ) {
xpos += x_widebar.x()/2.;
PlacedVolume pv = det_wide_layerbox_vol.placeVolume(widebar_vol, Transform3D(rot,Position(xpos, 0e0, 0e0)));
@@ -90,7 +90,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
//Loop for z-wide placement -> build the calorimeter sandwich
- double z_layer =0.;
+ double z_layer = -x_detbox.z()/2.;
Rotation3D rot_layers;
diff --git a/DDDetectors/src/SplitCal_ThinBars_geo.cpp b/DDDetectors/src/SplitCal_ThinBars_geo.cpp
index 37e44c38..da5533cb 100644
--- a/DDDetectors/src/SplitCal_ThinBars_geo.cpp
+++ b/DDDetectors/src/SplitCal_ThinBars_geo.cpp
@@ -30,12 +30,12 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
std::string nam = x_det.nameStr();
//vertical bars by default
// const double splitlayer = x_det.attr("splitlayer");
- const double widebar_x_spacing = x_widebar.attr("x_extra_spacing");
const double thinbar_x_spacing = x_thinbar.attr("x_extra_spacing");
+ const double x_offset = x_thinbar.attr("x_offset");
+ const double y_offset = x_thinbar.attr("y_offset");
const double extrazgap = x_widebar.attr("extrazgap");
const std::string calo_layer_codes = x_det.attr("layer_codes");
const int num_z = static_cast(calo_layer_codes.size());
- const int widebar_num_x = x_widebar.attr("num_x");
const int thinbar_num_x = x_thinbar.attr("num_x");
//HPL fibre feature extraction
@@ -53,9 +53,6 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
passive_layer_vol.setAttributes(description, x_passive_layer.regionStr(), x_passive_layer.limitsStr(), x_passive_layer.visStr());
split_vol.setAttributes(description, x_split.regionStr(), x_split.limitsStr(), x_split.visStr());
- //HPL definition
-
-
sens.setType("calorimeter");
@@ -65,8 +62,10 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
detbox_vol.setAttributes(description, x_detbox.regionStr(), x_detbox.limitsStr(), x_detbox.visStr());
// box_vol.setVisAttributes(description.visAttributes(""));
+
+ double thinlayerwidth = x_thinbar.x() * static_cast(thinbar_num_x);
- Box det_thin_layerbox((x_detbox.x()+tol)/2., (x_detbox.y()+tol)/2., (x_widebar.z()+tol)/2.);
+ Box det_thin_layerbox((thinlayerwidth+tol)/2., (x_thinbar.y()+tol)/2., (x_thinbar.z()+tol)/2.);
Volume det_thin_layerbox_vol("det_thin_layerbox", det_thin_layerbox, description.air());
det_thin_layerbox_vol.setAttributes(description, x_detbox.regionStr(), x_detbox.limitsStr(), x_detbox.visStr());
det_thin_layerbox_vol.setVisAttributes(description.visAttributes(x_detbox.visStr()));
@@ -94,7 +93,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
//Thin bar layers
int volumecode = 0;
- double xpos = -x_detbox.x()/2.;
+ double xpos = -(thinlayerwidth+tol)/2.;
for( int ix=0; ix < thinbar_num_x; ++ix ) {
xpos += x_thinbar.x()/2.;
PlacedVolume pv = det_thin_layerbox_vol.placeVolume(thinbar_vol, Transform3D(rot,Position(xpos, 0e0, 0e0)));
@@ -137,7 +136,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
//Place thin layer vertically
z_layer += x_thinbar.z()/2.;
rot_layers = RotationZYX(M_PI/2e0,0e0,0e0);
- PlacedVolume pv_det = detbox_vol.placeVolume(det_thin_layerbox_vol, Transform3D(rot_layers,Position(0.,0. , z_layer)));
+ PlacedVolume pv_det = detbox_vol.placeVolume(det_thin_layerbox_vol, Transform3D(rot_layers,Position(x_offset,y_offset , z_layer)));
pv_det.addPhysVolID("splitcal_layer", iz);
z_layer += x_thinbar.z()/2.;
//z_layer += x_thinbar.z()+x_passive_layer.z();
@@ -147,7 +146,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
//Place thin layer horizontally
z_layer += x_thinbar.z()/2.;
rot_layers = RotationZYX(0e0, 0e0, 0e0);
- PlacedVolume pv_det = detbox_vol.placeVolume(det_thin_layerbox_vol, Transform3D(rot_layers,Position(0.,0. , z_layer)));
+ PlacedVolume pv_det = detbox_vol.placeVolume(det_thin_layerbox_vol, Transform3D(rot_layers,Position(y_offset,x_offset, z_layer)));
pv_det.addPhysVolID("splitcal_layer", iz);
z_layer += x_thinbar.z()/2.;
//z_layer += x_thinbar.z()+x_passive_layer.z();
diff --git a/DDDetectors/src/SplitCal_WideBars_basis_geo.cpp b/DDDetectors/src/SplitCal_WideBars_basis_geo.cpp
index 0339b3d1..42c559a1 100644
--- a/DDDetectors/src/SplitCal_WideBars_basis_geo.cpp
+++ b/DDDetectors/src/SplitCal_WideBars_basis_geo.cpp
@@ -30,24 +30,17 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
std::string nam = x_det.nameStr();
//vertical bars by default
// const double splitlayer = x_det.attr("splitlayer");
+ const double x_offset = x_widebar.attr("x_offset");
+ const double y_offset = x_widebar.attr("y_offset");
const double widebar_x_spacing = x_widebar.attr("x_extra_spacing");
- const double thinbar_x_spacing = x_thinbar.attr("x_extra_spacing");
const double extrazgap = x_widebar.attr("extrazgap");
const std::string calo_layer_codes = x_det.attr("layer_codes");
const int num_z = static_cast(calo_layer_codes.size());
const int widebar_num_x = x_widebar.attr("num_x");
- const int thinbar_num_x = x_thinbar.attr("num_x");
//HPL fibre feature extraction
xml_dim_t x_hplbox = x_det.child(_Unicode(hplbox));
- xml_det_t x_hplfibre = x_det.child(_Unicode(hplfibre));
- xml_det_t x_hplcore = x_det.child(_Unicode(hplcore));
- const double hpl_fibrethick = x_hplfibre.thickness();
- const double hpldelta = 2e0*x_hplfibre.rmax();
- const int hplnum_x = int(x_hplbox.x() / hpldelta);
- const int hplnum_x_small = hplnum_x - 1;
// const int num_z = int(2e0*x_box.z() / (delta+2*tol));
- const double hplnum_z = x_det.attr("hpln_fibre_layers");
//Bar definition
@@ -72,8 +65,9 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
detbox_vol.setAttributes(description, x_detbox.regionStr(), x_detbox.limitsStr(), x_detbox.visStr());
// box_vol.setVisAttributes(description.visAttributes(""));
-
- Box det_wide_layerbox((x_detbox.x()+tol)/2., (x_detbox.y()+tol)/2., (x_widebar.z()+tol)/2.);
+
+ double wideboxwidth = x_widebar.x()*static_cast(widebar_num_x);
+ Box det_wide_layerbox((wideboxwidth+tol)/2., (x_widebar.y()+tol)/2., (x_widebar.z()+tol)/2.);
Volume det_wide_layerbox_vol("det_wide_layerbox", det_wide_layerbox, description.air());
det_wide_layerbox_vol.setAttributes(description, x_detbox.regionStr(), x_detbox.limitsStr(), x_detbox.visStr());
det_wide_layerbox_vol.setVisAttributes(description.visAttributes(x_detbox.visStr()));
@@ -88,7 +82,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
//}
//Build Wide bar layers
- double xpos = -x_detbox.x()/2.;
+ double xpos = -(wideboxwidth+tol)/2.;
int volumecode = 0;
for( int ix=0; ix < widebar_num_x; ++ix ) {
@@ -116,14 +110,15 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
// leave 'tol' space between the layers
- std::cout << static_cast(calo_layer_codes[iz]) - '0' << std::endl;
+ //std::cout << static_cast(calo_layer_codes[iz]) - '0' << std::endl;
switch(static_cast(calo_layer_codes[iz]) - '0'){
case 1:{
//Place wide layer vertically
z_layer += x_widebar.z()/2.;
rot_layers = RotationZYX(M_PI/2e0,0e0,0e0);
- PlacedVolume pv_det = detbox_vol.placeVolume(det_wide_layerbox_vol, Transform3D(rot_layers,Position(0.,0. , z_layer)));
+ //Order of offets To be tested
+ PlacedVolume pv_det = detbox_vol.placeVolume(det_wide_layerbox_vol, Transform3D(rot_layers,Position(x_offset,y_offset,z_layer)));
pv_det.addPhysVolID("splitcal_layer", iz);
//z_layer += x_widebar.z()+x_passive_layer.z();
z_layer += x_widebar.z()/2.;
@@ -133,7 +128,8 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
//Place wide layer horizontally
z_layer += x_widebar.z()/2.;
rot_layers = RotationZYX(0e0, 0e0, 0e0);
- PlacedVolume pv_det = detbox_vol.placeVolume(det_wide_layerbox_vol, Transform3D(rot_layers,Position(0.,0., z_layer)));
+ //Order of offets To be tested
+ PlacedVolume pv_det = detbox_vol.placeVolume(det_wide_layerbox_vol, Transform3D(rot_layers,Position(x_offset,y_offset,z_layer)));
pv_det.addPhysVolID("splitcal_layer", iz);
//z_layer += x_widebar.z()+x_passive_layer.z();
z_layer += x_widebar.z()/2.;