diff --git a/Detector/DetDriftChamber/compact/det.xml b/Detector/DetDriftChamber/compact/det.xml index 545045195b7bfd20bc4b49062ec5648ef7cedda0..a56f0f12b9127f659d0951f69274aba73739101e 100644 --- a/Detector/DetDriftChamber/compact/det.xml +++ b/Detector/DetDriftChamber/compact/det.xml @@ -40,6 +40,11 @@ <constant name="SDT_chamber_layer_width" value="10*mm"/> <constant name="Epsilon" value="0*deg"/> + <constant name="SDT_inner_wall_radius_min" value="234.8*mm"/> + <constant name="SDT_inner_wall_radius_max" value="235*mm"/> + <constant name="SDT_outer_wall_radius_min" value="1715*mm"/> + <constant name="SDT_outer_wall_radius_max" value="1717.8*mm"/> + </define> <display> @@ -64,9 +69,6 @@ </shape> </envelope> - <barrel name="inner_wall" type="Tube" rmin="234.8*mm" rmax="235*mm" material="Air" vis="VisibleGreen"/> - <model name="outer_wall" type="Tube" rmin="1715*mm" rmax="1717.8*mm" material="Air" vis="VisibleGreen"/> - <module id="0" name="SignalWire" type="Tube" rmin="0*mm" rmax="0.01*mm" vis="VisibleRed"> <tubs name="W" type="Tube" rmin="0*mm" rmax="0.007*mm" material="Tungsten"/> <tubs name="Au" type="Tube" rmin="0.007*mm" rmax="0.01*mm" material="Gold"/> diff --git a/Detector/DetDriftChamber/src/driftchamber/DriftChamber.cpp b/Detector/DetDriftChamber/src/driftchamber/DriftChamber.cpp index bdbb6427ad06066a8abf1f5d42dab3abd3d86a05..bac0d1a9b69540210ddd33a2cb3fc52dc1f518d6 100644 --- a/Detector/DetDriftChamber/src/driftchamber/DriftChamber.cpp +++ b/Detector/DetDriftChamber/src/driftchamber/DriftChamber.cpp @@ -16,9 +16,6 @@ #include "DDSegmentation/Segmentation.h" #include "DetSegmentation/GridDriftChamber.h" -#include "TFile.h" -#include "TTree.h" - using namespace dd4hep; using namespace dd4hep::detail; using namespace dd4hep::rec ; @@ -96,26 +93,20 @@ static dd4hep::Ref_t create_detector(dd4hep::Detector& theDetector, dd4hep::Volume det_outer_chamber_vol(det_name+"_outer_chamber_vol", det_outer_chamber_solid, det_mat); // - inner wall - xml_coll_t c(x_det,_U(barrel)); - xml_comp_t x_barrel = c; - double inner_wall_rmin = x_barrel.rmin(); - double inner_wall_rmax = x_barrel.rmax(); - std::string inner_wall_name = x_barrel.nameStr(); - dd4hep::Material inner_wall_mat = theDetector.material(x_barrel.materialStr()); + double inner_wall_rmin = theDetector.constant<double>("SDT_inner_wall_radius_min"); + double inner_wall_rmax = theDetector.constant<double>("SDT_inner_wall_radius_max"); + dd4hep::Material inner_wall_mat(theDetector.material("Air")); dd4hep::Tube inner_wall_solid(inner_wall_rmin,inner_wall_rmax,chamber_length*0.5); - dd4hep::Volume inner_wall_vol(inner_wall_name,inner_wall_solid,inner_wall_mat); - inner_wall_vol.setVisAttributes(theDetector.visAttributes(x_barrel.visStr())); + dd4hep::Volume inner_wall_vol(det_name+"_inner_wall",inner_wall_solid,inner_wall_mat); + inner_wall_vol.setVisAttributes(theDetector,"VisibleGreen"); // - outer wall - xml_coll_t l(x_det,_U(model)); - xml_comp_t x_model = l; - double outer_wall_rmin = x_model.rmin(); - double outer_wall_rmax = x_model.rmax(); - std::string outer_wall_name = x_model.nameStr(); - dd4hep::Material outer_wall_mat = theDetector.material(x_model.materialStr()); + double outer_wall_rmin = theDetector.constant<double>("SDT_outer_wall_radius_min"); + double outer_wall_rmax = theDetector.constant<double>("SDT_outer_wall_radius_max"); + dd4hep::Material outer_wall_mat(theDetector.material("Air")); dd4hep::Tube outer_wall_solid(outer_wall_rmin,outer_wall_rmax,chamber_length*0.5); - dd4hep::Volume outer_wall_vol(outer_wall_name,outer_wall_solid,outer_wall_mat); - outer_wall_vol.setVisAttributes(theDetector.visAttributes(x_model.visStr())); + dd4hep::Volume outer_wall_vol(det_name+"_outer_wall",outer_wall_solid,outer_wall_mat); + outer_wall_vol.setVisAttributes(theDetector,"VisibleGreen"); // - wire dd4hep::Volume module_vol; @@ -203,7 +194,7 @@ static dd4hep::Ref_t create_detector(dd4hep::Detector& theDetector, // | S F2| // | | // | F0 F1| - // -------------------- + // --------------------- // if(layer_id == 1) { for(int icell=0; icell< numWire; icell++) { double wire_phi = (icell+0.5)*layer_Phi + offset; @@ -217,11 +208,11 @@ static dd4hep::Ref_t create_detector(dd4hep::Detector& theDetector, dd4hep::Transform3D transform_Module_0(dd4hep::Rotation3D(),tr3D_0); Module_phy = layer_vol.placeVolume(Module_vol,transform_Module_0); // - Field wire 1 - dd4hep::Position tr3D_1 = Position((rmid-chamber_layer_width*0.5)*std::cos(wire_phi+layer_Phi*0.5),(rmid-chamber_layer_width*0.5)*std::sin(wire_phi+layer_Phi*0.5),0.); + dd4hep::Position tr3D_1 = Position((rmid-chamber_layer_width*0.5)*std::cos(wire_phi-layer_Phi*0.5),(rmid-chamber_layer_width*0.5)*std::sin(wire_phi-layer_Phi*0.5),0.); dd4hep::Transform3D transform_Module_1(dd4hep::Rotation3D(),tr3D_1); Module_phy = layer_vol.placeVolume(Module_vol,transform_Module_1); // - Field wire 2 - dd4hep::Position tr3D_2 = Position(rmid*std::cos(wire_phi+layer_Phi*0.5),rmid*std::sin(wire_phi+layer_Phi*0.5),0.); + dd4hep::Position tr3D_2 = Position(rmid*std::cos(wire_phi-layer_Phi*0.5),rmid*std::sin(wire_phi-layer_Phi*0.5),0.); dd4hep::Transform3D transform_Module_2(dd4hep::Rotation3D(),tr3D_2); Module_phy = layer_vol.placeVolume(Module_vol,transform_Module_2); // - Field wire 3 @@ -229,7 +220,7 @@ static dd4hep::Ref_t create_detector(dd4hep::Detector& theDetector, dd4hep::Transform3D transform_Module_3(dd4hep::Rotation3D(),tr3D_3); Module_phy = layer_vol.placeVolume(Module_vol,transform_Module_3); // - Field wire 4 - dd4hep::Position tr3D_4 = Position((rmid+chamber_layer_width*0.5)*std::cos(wire_phi+layer_Phi*0.5),(rmid+chamber_layer_width*0.5)*std::sin(wire_phi+layer_Phi*0.5),0.); + dd4hep::Position tr3D_4 = Position((rmid+chamber_layer_width*0.5)*std::cos(wire_phi-layer_Phi*0.5),(rmid+chamber_layer_width*0.5)*std::sin(wire_phi-layer_Phi*0.5),0.); dd4hep::Transform3D transform_Module_4(dd4hep::Rotation3D(),tr3D_4); Module_phy = layer_vol.placeVolume(Module_vol,transform_Module_4); } @@ -266,7 +257,7 @@ static dd4hep::Ref_t create_detector(dd4hep::Detector& theDetector, // - place in world dd4hep::Transform3D transform(dd4hep::Rotation3D(), dd4hep::Position(0,0,0)); - dd4hep::PlacedVolume phv = envelope.placeVolume(det_vol,transform); + dd4hep::PlacedVolume phv = envelope.placeVolume(det_vol,transform); dd4hep::PlacedVolume inner_wall_phy = envelope.placeVolume(inner_wall_vol,transform);