23 #include "gearimpl/TPCParametersImpl.h"
24 #include "gearimpl/FixedPadSizeDiskLayout.h"
25 #include "gearimpl/ZPlanarParametersImpl.h"
26 #include "gearimpl/FTDParametersImpl.h"
27 #include "gearimpl/CalorimeterParametersImpl.h"
34 using namespace detail ;
47 static long createGearForCLIC(Detector& description,
int ,
char** ) {
49 std::cout <<
" **** running plugin createGearForCLIC ! " << std::endl ;
55 DetElement vxdDE = description.detector(
"VertexBarrel") ;
60 int vxdType = gear::ZPlanarParameters::CMOS ;
61 gear::ZPlanarParametersImpl* gearVXD =
new gear::ZPlanarParametersImpl( vxdType, vxd->rInnerShell/dd4hep::mm, vxd->rOuterShell/dd4hep::mm,
62 vxd->zHalfShell/dd4hep::mm , vxd->gapShell/dd4hep::mm , 0. ) ;
65 for(
unsigned i=0,n=vxd->layers.size() ; i<n; ++i){
68 const rec::ZPlanarData::LayerLayout& l = vxd->layers[i] ;
71 gearVXD->addLayer( l.ladderNumber, l.phi0,
72 l.distanceSupport/dd4hep::mm, l.offsetSupport/dd4hep::mm, l.thicknessSupport/dd4hep::mm, l.zHalfSupport/dd4hep::mm, l.widthSupport/dd4hep::mm, 0. ,
73 l.distanceSensitive/dd4hep::mm, l.offsetSensitive/dd4hep::mm, l.thicknessSensitive/dd4hep::mm, l.zHalfSensitive/dd4hep::mm, l.widthSensitive/dd4hep::mm, 0. ) ;
77 std::cout<<
"Added layers"<<std::endl;
79 GearHandle*
handle =
new GearHandle( gearVXD,
"VXDParameters" ) ;
82 handle->addMaterial(
"VXDSupportMaterial", 2.075865162e+01, 1.039383117e+01, 2.765900000e+02, 1.014262421e+03, 3.341388059e+03) ;
107 vxdDE.addExtension< GearHandle >(
handle ) ;
109 }
catch( std::runtime_error& e ){
110 std::cerr <<
" >>>> " << e.what() << std::endl ;
117 DetElement sitDE = description.detector(
"InnerTrackerBarrel") ;
122 int sitType = gear::ZPlanarParameters::CCD ;
124 gear::ZPlanarParametersImpl* gearSIT =
new gear::ZPlanarParametersImpl( sitType, sit->rInnerShell/dd4hep::mm, sit->rOuterShell/dd4hep::mm,
125 sit->zHalfShell/dd4hep::mm , sit->gapShell/dd4hep::mm , 0. ) ;
127 std::vector<int> n_sensors_per_ladder ;
129 for(
unsigned i=0,n=sit->layers.size() ; i<n; ++i){
131 const rec::ZPlanarData::LayerLayout& l = sit->layers[i] ;
134 gearSIT->addLayer( l.ladderNumber, l.phi0,
135 l.distanceSupport/dd4hep::mm, l.offsetSupport/dd4hep::mm, l. thicknessSupport/dd4hep::mm, l.zHalfSupport/dd4hep::mm, l.widthSupport/dd4hep::mm, 0. ,
136 l.distanceSensitive/dd4hep::mm, l.offsetSensitive/dd4hep::mm, l. thicknessSensitive/dd4hep::mm, l.zHalfSensitive/dd4hep::mm, l.widthSensitive/dd4hep::mm, 0. ) ;
139 n_sensors_per_ladder.push_back( l.sensorsPerLadder);
142 gearSIT->setDoubleVal(
"strip_width_mm" , sit->widthStrip / dd4hep::mm ) ;
143 gearSIT->setDoubleVal(
"strip_length_mm" , sit->lengthStrip/ dd4hep::mm ) ;
144 gearSIT->setDoubleVal(
"strip_pitch_mm" , sit->pitchStrip / dd4hep::mm ) ;
145 gearSIT->setDoubleVal(
"strip_angle_deg" , sit->angleStrip / dd4hep::deg ) ;
148 gearSIT->setIntVals(
"n_sensors_per_ladder",n_sensors_per_ladder);
150 sitDE.addExtension< GearHandle >(
new GearHandle( gearSIT,
"SITParameters" ) ) ;
152 }
catch( std::runtime_error& e ){
153 std::cerr <<
" >>>> " << e.what() << std::endl ;
160 DetElement setDE = description.detector(
"OuterTrackerBarrel") ;
165 int setType = gear::ZPlanarParameters::CCD ;
166 gear::ZPlanarParametersImpl* gearSET =
new gear::ZPlanarParametersImpl( setType, set->rInnerShell/dd4hep::mm, set->rOuterShell/dd4hep::mm,
167 set->zHalfShell/dd4hep::mm , set->gapShell/dd4hep::mm , 0. ) ;
168 std::vector<int> n_sensors_per_ladder ;
171 for(
unsigned i=0,n=set->layers.size() ; i<n; ++i){
173 const rec::ZPlanarData::LayerLayout& l = set->layers[i] ;
176 gearSET->addLayer( l.ladderNumber, l.phi0,
177 l.distanceSupport/dd4hep::mm, l.offsetSupport/dd4hep::mm, l. thicknessSupport/dd4hep::mm, l.zHalfSupport/dd4hep::mm, l.widthSupport/dd4hep::mm, 0. ,
178 l.distanceSensitive/dd4hep::mm, l.offsetSensitive/dd4hep::mm, l. thicknessSensitive/dd4hep::mm, l.zHalfSensitive/dd4hep::mm, l.widthSensitive/dd4hep::mm, 0. ) ;
181 n_sensors_per_ladder.push_back( l.sensorsPerLadder);
184 gearSET->setDoubleVal(
"strip_width_mm" , set->widthStrip / dd4hep::mm ) ;
185 gearSET->setDoubleVal(
"strip_length_mm" , set->lengthStrip/ dd4hep::mm ) ;
186 gearSET->setDoubleVal(
"strip_pitch_mm" , set->pitchStrip / dd4hep::mm ) ;
187 gearSET->setDoubleVal(
"strip_angle_deg" , set->angleStrip / dd4hep::deg ) ;
190 gearSET->setIntVals(
"n_sensors_per_ladder",n_sensors_per_ladder);
192 setDE.addExtension< GearHandle >(
new GearHandle( gearSET,
"SETParameters" ) ) ;
194 }
catch( std::runtime_error& e ){
195 std::cerr <<
" >>>> " << e.what() << std::endl ;
202 DetElement iteDE = description.detector(
"InnerTrackerEndcap") ;
206 gear::GearParametersImpl* gearFTD =
new gear::GearParametersImpl();
208 std::vector<double> thicknesses;
209 std::vector<double> innerRadii;
210 std::vector<double> outerRadii;
211 std::vector<double> zPositions;
214 for(
unsigned i=0,n=iteData->layers.size() ; i<n; ++i){
216 const rec::ZDiskPetalsData::LayerLayout& l = iteData->layers[i] ;
218 thicknesses.push_back(l.thicknessSupport/ dd4hep::mm);
219 innerRadii.push_back( l.distanceSensitive/ dd4hep::mm);
220 outerRadii.push_back( (l.distanceSensitive + l.lengthSensitive)/ dd4hep::mm);
221 zPositions.push_back( l.zPosition/ dd4hep::mm);
229 DetElement oteDE = description.detector(
"OuterTrackerEndcap") ;
233 for(
unsigned i=0,n=oteData->layers.size() ; i<n; ++i){
235 const rec::ZDiskPetalsData::LayerLayout& l = oteData->layers[i] ;
237 thicknesses.push_back(l.thicknessSupport/ dd4hep::mm);
238 innerRadii.push_back( l.distanceSensitive/ dd4hep::mm);
239 outerRadii.push_back( (l.distanceSensitive + l.lengthSensitive)/ dd4hep::mm);
240 zPositions.push_back( l.zPosition/ dd4hep::mm);
247 gearFTD->setDoubleVals(
"FTDDiskSupportThickness" , thicknesses) ;
248 gearFTD->setDoubleVals(
"FTDInnerRadius" , innerRadii) ;
249 gearFTD->setDoubleVals(
"FTDOuterRadius" , outerRadii ) ;
250 gearFTD->setDoubleVals(
"FTDZCoordinate" ,zPositions) ;
253 iteDE.addExtension< GearHandle >(
new GearHandle( gearFTD,
"FTD" ) ) ;
256 }
catch( std::runtime_error& e ){
257 std::cerr <<
" >>>> " << e.what() << std::endl ;
264 DetElement coilDE = description.detector(
"Solenoid") ;
266 gear::GearParametersImpl* gearCOIL =
new gear::GearParametersImpl();
268 Tube coilTube = Tube( coilDE.volume().solid() ) ;
270 gearCOIL->setDoubleVal(
"Coil_cryostat_inner_radius" , coilTube->GetRmin()/ dd4hep::mm ) ;
271 gearCOIL->setDoubleVal(
"Coil_cryostat_outer_radius" , coilTube->GetRmax()/ dd4hep::mm ) ;
272 gearCOIL->setDoubleVal(
"Coil_cryostat_half_z" , coilTube->GetDZ()/ dd4hep::mm ) ;
274 coilDE.addExtension< GearHandle >(
new GearHandle( gearCOIL,
"CoilParameters" ) ) ;
276 }
catch( std::runtime_error& e ){
277 std::cerr <<
" >>>> " << e.what() << std::endl ;
283 DetElement tubeDE = description.detector(
"Tube") ;
287 gear::GearParametersImpl* gearTUBE =
new gear::GearParametersImpl();
289 tube->isSymmetricInZ = true ;
291 unsigned n = tube->sections.size() ;
293 std::vector<double> rInner(n) ;
294 std::vector<double> rOuter(n) ;
295 std::vector<double> zStart(n) ;
297 for(
unsigned i=0 ; i<n ; ++i){
299 const ConicalSupportData::Section& s = tube->sections[i] ;
301 rInner[i] = s.rInner/ dd4hep::mm ;
302 rOuter[i] = s.rOuter/ dd4hep::mm ;
303 zStart[i] = s.zPos / dd4hep::mm ;
308 gearTUBE->setDoubleVals(
"RInner" , rInner ) ;
309 gearTUBE->setDoubleVals(
"ROuter" , rOuter ) ;
310 gearTUBE->setDoubleVals(
"Z" , zStart ) ;
313 tubeDE.addExtension< GearHandle >(
new GearHandle( gearTUBE,
"Beampipe" ) ) ;
315 }
catch( std::runtime_error& e ){
316 std::cerr <<
" >>>> " << e.what() << std::endl ;
325 std::map< std::string, std::string > caloMap ;
326 caloMap[
"HCalBarrel"] =
"HcalBarrelParameters" ;
327 caloMap[
"ECalBarrel"] =
"EcalBarrelParameters" ;
328 caloMap[
"ECalEndcap"] =
"EcalEndcapParameters" ;
329 caloMap[
"ECalPlug"] =
"EcalPlugParameters" ;
330 caloMap[
"YokeBarrel"] =
"YokeBarrelParameters" ;
331 caloMap[
"YokeEndcap"] =
"YokeEndcapParameters" ;
332 caloMap[
"YokePlug"] =
"YokePlugParameters" ;
333 caloMap[
"HCalBarrel"] =
"HcalBarrelParameters" ;
334 caloMap[
"HCalEndcap"] =
"HcalEndcapParameters" ;
335 caloMap[
"HCalRing"] =
"HcalRingParameters" ;
336 caloMap[
"LumiCal"] =
"LcalParameters" ;
338 caloMap[
"BeamCal"] =
"BeamCalParameters" ;
340 for( std::map< std::string, std::string >::const_iterator it = caloMap.begin() ; it != caloMap.end() ; ++it ){
346 DetElement caloDE = description.detector( it->first ) ;
350 gear::CalorimeterParametersImpl* gearCalo =
351 ( calo->layoutType == LayeredCalorimeterData::BarrelLayout ?
352 new gear::CalorimeterParametersImpl( calo->extent[0]/dd4hep::mm, calo->extent[3]/dd4hep::mm, calo->inner_symmetry, calo->inner_phi0 ) :
354 new
gear::CalorimeterParametersImpl( calo->extent[0]/
dd4hep::mm, calo->extent[1]/
dd4hep::mm, calo->extent[2]/
dd4hep::mm, calo->outer_symmetry, calo->outer_phi0 ) ) ;
357 for(
unsigned i=0, nL = calo->layers.size() ; i <nL ; ++i ){
359 LayeredCalorimeterData::Layer& l = calo->layers[i] ;
367 gearCalo->layerLayout().positionLayer( l.distance/dd4hep::mm, (l.inner_thickness+l.sensitive_thickness/2.)/dd4hep::mm ,
368 l.cellSize0/dd4hep::mm, l.cellSize1/dd4hep::mm, (l.inner_thickness-l.sensitive_thickness/2.)/dd4hep::mm ) ;
369 }
else if ( i == nL -1 ) {
372 gearCalo->layerLayout().addLayer((l.inner_thickness+l.outer_thickness+calo->layers[i-1].outer_thickness-calo->layers[i-1].sensitive_thickness/2.)/dd4hep::mm ,
373 l.cellSize0/dd4hep::mm, l.cellSize1/dd4hep::mm, (l.inner_thickness+l.outer_thickness-l.sensitive_thickness+calo->layers[i-1].outer_thickness-calo->layers[i-1].sensitive_thickness/2.)/dd4hep::mm) ;
376 gearCalo->layerLayout().addLayer((l.inner_thickness+l.sensitive_thickness/2.+calo->layers[i-1].outer_thickness-calo->layers[i-1].sensitive_thickness/2.)/dd4hep::mm ,
377 l.cellSize0/dd4hep::mm, l.cellSize1/dd4hep::mm, (l.inner_thickness-l.sensitive_thickness/2.+calo->layers[i-1].outer_thickness-calo->layers[i-1].sensitive_thickness/2.)/dd4hep::mm) ;
382 if( it->first ==
"HCalBarrel" ){
384 gearCalo->setIntVal(
"Hcal_outer_polygon_order" , calo->outer_symmetry ) ;
385 gearCalo->setDoubleVal(
"Hcal_outer_polygon_phi0" , calo->outer_phi0 ) ;
390 caloDE.addExtension< GearHandle >(
new GearHandle( gearCalo, it->second ) ) ;
392 }
catch( std::runtime_error& e ){
393 std::cerr <<
" >>>> " << e.what() << std::endl ;