From cdaa6774b13acab11fbc2d1a17cea747fb873258 Mon Sep 17 00:00:00 2001 From: Frank Gaede <frank.gaede@desy.de> Date: Tue, 6 Aug 2013 11:12:53 +0000 Subject: [PATCH] - fixed ILD example TPC: - added gaseous volumes to force creation of hits on the meassurement surfaces --- DDExamples/ILDExDet/compact/ILDEx.xml | 19 +++++---- DDExamples/ILDExDet/compact/geant4.xml | 2 +- .../ILDExDet/src/compact/ILDExTPC_geo.cpp | 42 ++++++++++++++++--- 3 files changed, 48 insertions(+), 15 deletions(-) diff --git a/DDExamples/ILDExDet/compact/ILDEx.xml b/DDExamples/ILDExDet/compact/ILDEx.xml index 95ec14c4b..be8ca7377 100644 --- a/DDExamples/ILDExDet/compact/ILDEx.xml +++ b/DDExamples/ILDExDet/compact/ILDEx.xml @@ -155,29 +155,29 @@ </detector> - <detector name="TPC" type="XXX_ILDExTPC" vis="TPCVis" id="3" limits="TPC_limits" readout="TPCCollection" insideTrackingVolume="true"> + <detector name="TPC" type="ILDExTPC" vis="TPCVis" id="3" limits="TPC_limits" readout="TPCCollection" insideTrackingVolume="true"> <tubs rmin="TPC_inner_radius" rmax="TPC_outer_radius" zhalf="TPC_zhalf"/> + <!-- GEAR Data--> <driftlength value="TPC_zhalf*0.9"/> <!-- End of GEAR Data--> - - <material name="Air"/> + <material name="Air"/> - <detector name="TPC_InnerWall" type="TubeSegment" reflect="true" vis="TPCSupportVis" id="0"> + <detector name="TPC_InnerWall" type="TubeSegment" reflect="true" vis="TPCSupportVis" id="2"> <material name="Carbon"/> <tubs rmin="TPC_inner_radius" rmax="TPC_inner_radius+TPC_inner_thickness" zhalf="TPC_zhalf"/> <position x="0" y="0" z="0"/> <rotation x="0" y="0" z="0"/> </detector> - <detector name="TPC_OuterWall" type="TubeSegment" reflect="true" vis="TPCSupportVis" id="1"> + <detector name="TPC_OuterWall" type="TubeSegment" reflect="true" vis="TPCSupportVis" id="3"> <material name="Carbon" /> <tubs rmin="TPC_outer_radius - TPC_outer_thickness" rmax="TPC_outer_radius" zhalf="TPC_zhalf"/> <position x="0" y="0" z="0"/> <rotation x="0" y="0" z="0"/> </detector> - <detector name="TPC_EndPlate" type="TubeSegment" reflect="true" vis="TPCSupportVis" id="2"> + <detector name="TPC_EndPlate" type="TubeSegment" reflect="true" vis="TPCSupportVis" id="0"> <material name="Carbon" /> <tubs rmin="TPC_inner_radius+TPC_inner_thickness" rmax="TPC_outer_radius-TPC_outer_thickness" zhalf="0.5*TPC_endcap_thickness"/> <position x="0" y="0" z="TPC_zhalf-0.5*TPC_endcap_thickness"/> @@ -185,16 +185,17 @@ </detector> - <detector name="TPC_GasVolume" type="TubeSegment" reflect="true" vis="TPCGasVis" id="5"> + <detector name="TPC_GasVolume" type="TubeSegment" reflect="true" vis="TPCGasVis" id="4"> <material name="Argon"/> <tubs rmin="TPC_inner_radius+TPC_inner_thickness" rmax="TPC_outer_radius-TPC_outer_thickness" zhalf="TPC_zhalf-TPC_endcap_thickness"/> + <layer number="220" ecut="0.0"/> <position x="0" y="0" z="0"/> <rotation x="0" y="0" z="0"/> </detector> </detector> <comment>Calorimeters</comment> - <detector id="7" name="HcalBarrel" type="XXXAhcalBarrelCalorimeter" readout="HcalBarrelHits" vis="HcalBarrelVis" calorimeterType="HAD_BARREL" gap="10.*mm"> + <detector id="7" name="HcalBarrel" type="AhcalBarrelCalorimeter" readout="HcalBarrelHits" vis="HcalBarrelVis" calorimeterType="HAD_BARREL" gap="10.*mm"> <comment>Hadron Calorimeter Barrel</comment> <material name="Steel235"/> @@ -207,7 +208,7 @@ <slice material = "Air" thickness = "2.7*mm" vis="HcalBarrelAirVis" /> </layer> </detector> - <detector id="8" name="HcalEndcap" type="XXXAhcalEndcapCalorimeter" readout="HcalEndcapHits" calorimeterType="HAD_ENDCAP" gap="15.*mm"> + <detector id="8" name="HcalEndcap" type="AhcalEndcapCalorimeter" readout="HcalEndcapHits" calorimeterType="HAD_ENDCAP" gap="15.*mm"> <comment>Hadron Calorimeter Endcap</comment> <material name="Steel235"/> diff --git a/DDExamples/ILDExDet/compact/geant4.xml b/DDExamples/ILDExDet/compact/geant4.xml index 2bed7296d..fb21f8807 100644 --- a/DDExamples/ILDExDet/compact/geant4.xml +++ b/DDExamples/ILDExDet/compact/geant4.xml @@ -15,7 +15,7 @@ </sd> <sd name="TPC" type="Geant4Tracker" - ecut="0.5*keV" + ecut="0.01*keV" verbose="true" hit_aggregation="position"> </sd> diff --git a/DDExamples/ILDExDet/src/compact/ILDExTPC_geo.cpp b/DDExamples/ILDExDet/src/compact/ILDExTPC_geo.cpp index 66c6a503a..409b769f6 100644 --- a/DDExamples/ILDExDet/src/compact/ILDExTPC_geo.cpp +++ b/DDExamples/ILDExDet/src/compact/ILDExTPC_geo.cpp @@ -34,26 +34,30 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { Readout readout(sens.readout()); for(xml_coll_t c(e,_U(detector)); c; ++c) { + xml_comp_t px_det (c); xml_comp_t px_tube (px_det.child(_U(tubs))); xml_dim_t px_pos (px_det.child(_U(position))); xml_dim_t px_rot (px_det.child(_U(rotation))); xml_comp_t px_mat (px_det.child(_U(material))); string part_nam(px_det.nameStr()); + Material part_mat(lcdd.material(px_mat.nameStr())); DetElement part_det(part_nam,px_det.typeStr(),px_det.id()); + Tube part_tub(px_tube.rmin(),px_tube.rmax(),px_tube.zhalf()); Volume part_vol(part_nam,part_tub,part_mat); + Position part_pos(px_pos.x(),px_pos.y(),px_pos.z()); Rotation part_rot(px_rot.x(),px_rot.y(),px_rot.z()); bool reflect = px_det.reflect(); sens.setType("tracker"); - part_vol.setSensitiveDetector(sens); + part_vol.setVisAttributes(lcdd,px_det.visStr()); //cache the important volumes in TPCData for later use without having to know their name switch(part_det.id()) - { + { case 2: tpcData->innerWall=part_det; break; @@ -61,12 +65,40 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { tpcData->outerWall=part_det; break; case 4: - tpcData->gasVolume=part_det; - break; + { + xml_comp_t px_lay(px_det.child(_U(layer))); + int nTPClayer( px_lay.attr<int>("number") ) ; + + // double ecutTPC( px_lay.attr<double>("ecut") ) ; + // sens.setEnergyCutoff( 0.0 ) ;//ecutTPC ); + + double r0 = px_tube.rmin() +1.e-3 ; + double r1 = px_tube.rmax() -1e-3 ; + double zh = px_tube.zhalf() - 1e-3 ; + double dR = ( r1 - r0 ) / ( 2.* nTPClayer ) ; + + + for(int i=0 ; i < nTPClayer ; ++i){ + + Tube gas_tubL( r0 + (2*i) * dR , r0 + (2*i+1) * dR , zh ); + Volume gas_volL( _toString( i, "tpc_row_lower_%2d") , gas_tubL, part_mat); + part_vol.placeVolume( gas_volL, Rotation(0,0,0) ); + + Tube gas_tubU( r0 + (2*i+1) * dR , r0 + (2*i+2) * dR , zh ); + Volume gas_volU( _toString( i, "tpc_row_upper_%2d") , gas_tubU, part_mat); + + gas_volU.setSensitiveDetector( sens ); + part_vol.placeVolume( gas_volU, Rotation(0,0,0) ).addPhysVolID("layer",i) ; + } + + + tpcData->gasVolume=part_det; + break; + } case 5: tpcData->cathode=part_det; break; - } + } //Endplate if(part_det.id()== 0){ tpcData->endplate=part_det; -- GitLab