diff --git a/CMakeLists.txt b/CMakeLists.txt index 21195b3c27d599e7bc4a9bda6497a4aa89d5e8f9..8b1f398e3601c061ed857884a6e43e73a256894c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake) #---Options------------------------------------------------------------------------- option(DD4HEP_USE_XERCESC "Enable 'Detector Builders' based on XercesC" OFF) option(DD4HEP_USE_PYROOT "Enable 'Detector Builders' based on PyROOT" ON) -option(DD4HEP_WITH_GEANT4 "Enable the simulation part based on Geant4" ON) +option(DD4HEP_WITH_GEANT4 "Enable the simulation part based on Geant4" OFF) find_package(ROOT REQUIRED) if(DD4HEP_USE_XERCESC) diff --git a/DDCore/include/DD4hep/Objects.h b/DDCore/include/DD4hep/Objects.h index 615dba424c1ab1a640539c5dda003d0e39b10f86..60422028be753038690a835bbd448eeadeff7dbb 100644 --- a/DDCore/include/DD4hep/Objects.h +++ b/DDCore/include/DD4hep/Objects.h @@ -106,7 +106,7 @@ namespace DD4hep { /// Initializing constructor Position(double xval, double yval, double zval) : x(xval), y(yval), z(zval) {} /// Is it a identity rotation ? - bool isNull() const { return x==0 && x==0 && x==0; } + bool isNull() const { return x==0 && y==0 && z==0; } }; /** @class IdentityPos Objects.h diff --git a/DDCore/include/ROOT/LinkDef.h b/DDCore/include/ROOT/LinkDef.h index 73837e4639c1b00852d0733753732aba48deba5b..acf47cb145259002a15f78e3f287282a3c554df2 100644 --- a/DDCore/include/ROOT/LinkDef.h +++ b/DDCore/include/ROOT/LinkDef.h @@ -21,6 +21,7 @@ template class DD4hep::Geometry::Handle<TNamed>; #pragma link C++ class DD4hep::Geometry::Volume; #pragma link C++ class DD4hep::Geometry::VisAttr; #pragma link C++ class DD4hep::Geometry::Limit; +#pragma link C++ class DD4hep::Geometry::AlignmentEntry; #pragma link C++ class DD4hep::Geometry::DetElement; #pragma link C++ class DD4hep::Geometry::Box; #pragma link C++ class DD4hep::Geometry::Tube; diff --git a/DDCore/python/lcdd.py b/DDCore/python/lcdd.py index cb417f9e6fb5288317cdd24af76ae65a57f15480..b9147d656c03519b4091c21fc49e7f33e915951c 100644 --- a/DDCore/python/lcdd.py +++ b/DDCore/python/lcdd.py @@ -9,6 +9,7 @@ LCDD = DD4hep.Geometry.LCDD Constant = DD4hep.Geometry.Constant Material = DD4hep.Geometry.Material VisAttr = DD4hep.Geometry.VisAttr +AlignmentEntry = DD4hep.Geometry.AlignmentEntry Limit = DD4hep.Geometry.Limit DetElement = DD4hep.Geometry.DetElement Box = DD4hep.Geometry.Box @@ -40,7 +41,8 @@ def _getFloat(self,*attrib): sval = self.get(attrib[0], None) if not sval and len(attrib) > 1: return attrib[1] else: return float(eval(sval.replace('(int)',''), constants)) -def _getBool(self,attrib): return self.get(attrib).lower() in ('true', 'yes', 'on') +def _getBool(self,attrib): + return self.get(attrib, '').lower() in ('true', 'yes', 'on') xml._ElementInterface.getI = _getInt xml._ElementInterface.getF = _getFloat xml._ElementInterface.getB = _getBool @@ -78,10 +80,13 @@ xml._ElementInterface.rmax = property(lambda self: self.getF('rmax')) def getRotation(rot): - return Rotation(rot.getF('x',0.0),rot.getF('y',0.0), rot.getF('z',0.0)) + if rot is not None : return Rotation(rot.getF('x',0.0),rot.getF('y',0.0), rot.getF('z',0.0)) + else : return Rotation() def getPosition(pos): - return Position(pos.getF('x',0.0),pos.getF('y',0.0), pos.getF('z',0.0)) + if pos is not None : return Position(pos.getF('x',0.0),pos.getF('y',0.0), pos.getF('z',0.0)) + else : return Position() + drivers['getRotation'] = getRotation drivers['getPosition'] = getPosition @@ -141,6 +146,15 @@ def process_includes(lcdd, elem): fname = c.get('ref') if not path.isabs(fname): fname = path.join(path.dirname(current_xmlfile),fname) load_drivers(fname) + for c in elem.findall('alignment'): + print 'Adding Alignment file ...', c.get('ref') + fname = c.get('ref').replace('file:','') + if not path.isabs(fname): fname = path.join(path.dirname(current_xmlfile),fname) + process_xmlfile(lcdd, fname) + +#--------------------------------------------------------------------------------- +def process_info(lcdd, elem): + pass #--------------------------------------------------------------------------------- def process_define(lcdd, elem): @@ -221,10 +235,11 @@ def process_material(lcdd, m): def process_display(lcdd, elem): for v in elem.findall('vis'): #print 'Adding vis ...', v.name - visattr = VisAttr(lcdd,v.name) - r = 'r' in v.keys() and v.getF('r') or 1.0 - g = 'g' in v.keys() and v.getF('g') or 1.0 - b = 'b' in v.keys() and v.getF('b') or 1.0 + visattr = VisAttr(lcdd, v.name) + r,g,b = 1.,1.,1. + if 'r' in v.keys() : r = v.getF('r') + if 'g' in v.keys() : g = v.getF('g') + if 'b' in v.keys() : b = v.getF('b') visattr.setColor(r,g,b) if 'showDaughters' in v.keys() : visattr.setShowDaughters(v.getB('showDaughters')) if 'visible' in v.keys() : visattr.setVisible(v.getB('visible')) @@ -260,3 +275,19 @@ def process_detectors(lcdd, elem): else : print 'Detector type %s not found' % d.get('type') +#----------------------------------------------------------------------------------- +def process_alignments(lcdd, elem): + for a in elem.findall('alignment'): + process_alignment(lcdd, a) + +#----------------------------------------------------------------------------------- +def process_alignment(lcdd, elem): + alignment = AlignmentEntry(lcdd, elem.name) + pos = getPosition(elem.find('position')) + rot = getRotation(elem.find('rotation')) + print pos.isNull(), rot.isNull() + alignment.align(pos,rot) + return alignment + + + diff --git a/DDCore/src/Volumes.cpp b/DDCore/src/Volumes.cpp index 76aed073971246e8b4f57c8987aca08c29e39fc3..46617752343843361dabb0adc4ac0edc56edf9aa 100644 --- a/DDCore/src/Volumes.cpp +++ b/DDCore/src/Volumes.cpp @@ -30,15 +30,15 @@ using namespace std; using namespace DD4hep::Geometry; namespace DD4hep { namespace Geometry { - + template <> struct Value<TGeoNodeMatrix,PlacedVolume::Object> - : public TGeoNodeMatrix, public PlacedVolume::Object + : public TGeoNodeMatrix, public PlacedVolume::Object { Value(const TGeoVolume* v, const TGeoMatrix* m) : TGeoNodeMatrix(v,m), PlacedVolume::Object() { magic = magic_word(); } }; - + template <class T> struct _VolWrap : public T { _VolWrap(const char* name, TGeoShape* s=0, TGeoMedium* m=0); virtual ~_VolWrap() {} @@ -47,41 +47,41 @@ namespace DD4hep { namespace Geometry { if (matrix==0) matrix = gGeoIdentity; else matrix->RegisterYourself(); if (!vol) { - this->T::Error("AddNode", "Volume is NULL"); - return; + this->T::Error("AddNode", "Volume is NULL"); + return; } if (!vol->IsValid()) { - this->T::Error("AddNode", "Won't add node with invalid shape"); - printf("### invalid volume was : %s\n", vol->GetName()); - return; + this->T::Error("AddNode", "Won't add node with invalid shape"); + printf("### invalid volume was : %s\n", vol->GetName()); + return; } if (!this->T::fNodes) this->T::fNodes = new TObjArray(); - + if (this->T::fFinder) { - // volume already divided. - this->T::Error("AddNode", "Cannot add node %s_%i into divided volume %s", vol->GetName(), copy_no, this->T::GetName()); - return; + // volume already divided. + this->T::Error("AddNode", "Cannot add node %s_%i into divided volume %s", vol->GetName(), copy_no, this->T::GetName()); + return; } - + TGeoNodeMatrix *node = new Value<TGeoNodeMatrix,PlacedVolume::Object>(vol, matrix); //node = new TGeoNodeMatrix(vol, matrix); node->SetMotherVolume(this); this->T::fNodes->Add(node); TString name = TString::Format("%s_%d", vol->GetName(), copy_no); if (this->T::fNodes->FindObject(name)) - this->T::Warning("AddNode", "Volume %s : added node %s with same name", this->T::GetName(), name.Data()); + this->T::Warning("AddNode", "Volume %s : added node %s with same name", this->T::GetName(), name.Data()); node->SetName(name); node->SetNumber(copy_no); } }; - + template <> _VolWrap<TGeoVolume>::_VolWrap(const char* name, TGeoShape* s, TGeoMedium* m) - : TGeoVolume(name,s,m) {} + : TGeoVolume(name,s,m) {} template <> _VolWrap<TGeoVolumeAssembly>::_VolWrap(const char* name, TGeoShape* s, TGeoMedium* m) - : TGeoVolumeAssembly(name) {} + : TGeoVolumeAssembly(name) {} template <> struct Value<TGeoVolume,Volume::Object> - : public _VolWrap<TGeoVolume>, public Volume::Object { + : public _VolWrap<TGeoVolume>, public Volume::Object { Value(const char* name, TGeoShape* s=0, TGeoMedium* m=0) : _VolWrap<TGeoVolume>(name,s,m) {magic = magic_word();} virtual ~Value() {} virtual TGeoVolume* MakeCopyVolume(TGeoShape *newshape) { @@ -111,15 +111,15 @@ namespace DD4hep { namespace Geometry { // copy other attributes Int_t nbits = 8*sizeof(UInt_t); for (i=0; i<nbits; i++) - vol->SetAttBit(1<<i, TGeoAtt::TestAttBit(1<<i)); + vol->SetAttBit(1<<i, TGeoAtt::TestAttBit(1<<i)); for (i=14; i<24; i++) - vol->SetBit(1<<i, TestBit(1<<i)); - + vol->SetBit(1<<i, TestBit(1<<i)); + // copy field vol->SetField(fField); // Set bits for (i=0; i<nbits; i++) - vol->SetBit(1<<i, TObject::TestBit(1<<i)); + vol->SetBit(1<<i, TObject::TestBit(1<<i)); vol->SetBit(kVolumeClone); // copy nodes // CloneNodesAndConnect(vol); @@ -129,8 +129,8 @@ namespace DD4hep { namespace Geometry { // copy voxels TGeoVoxelFinder *voxels = 0; if (fVoxels) { - voxels = new TGeoVoxelFinder(vol); - vol->SetVoxelFinder(voxels); + voxels = new TGeoVoxelFinder(vol); + vol->SetVoxelFinder(voxels); } // copy option, uid vol->SetOption(fOption); @@ -141,25 +141,25 @@ namespace DD4hep { namespace Geometry { }; template <> struct Value<TGeoVolumeAssembly,Assembly::Object> - : public _VolWrap<TGeoVolumeAssembly>, public Assembly::Object { + : public _VolWrap<TGeoVolumeAssembly>, public Assembly::Object { Value(const char* name) : _VolWrap<TGeoVolumeAssembly>(name,0,0) { magic = magic_word(); } virtual ~Value() {} - + TGeoVolume *CloneVolume() const { TGeoVolume *vol = new Value<TGeoVolumeAssembly,Assembly::Object>(GetName()); Int_t i; // copy other attributes Int_t nbits = 8*sizeof(UInt_t); for (i=0; i<nbits; i++) - vol->SetAttBit(1<<i, TGeoAtt::TestAttBit(1<<i)); + vol->SetAttBit(1<<i, TGeoAtt::TestAttBit(1<<i)); for (i=14; i<24; i++) - vol->SetBit(1<<i, TestBit(1<<i)); - + vol->SetBit(1<<i, TestBit(1<<i)); + // copy field vol->SetField(fField); // Set bits for (i=0; i<nbits; i++) - vol->SetBit(1<<i, TObject::TestBit(1<<i)); + vol->SetBit(1<<i, TObject::TestBit(1<<i)); vol->SetBit(kVolumeClone); // make copy nodes vol->MakeCopyNodes(this); @@ -167,8 +167,8 @@ namespace DD4hep { namespace Geometry { // copy voxels TGeoVoxelFinder *voxels = 0; if (fVoxels) { - voxels = new TGeoVoxelFinder(vol); - vol->SetVoxelFinder(voxels); + voxels = new TGeoVoxelFinder(vol); + vol->SetVoxelFinder(voxels); } // copy option, uid vol->SetOption(fOption); @@ -292,24 +292,24 @@ void Volume::setVisAttributes(const LCDD& lcdd, const string& name) const { } else { /* - string tag = this->name(); - if ( ::strstr(tag.c_str(),"_slice") ) // Slices turned off by default - setVisAttributes(lcdd.visAttributes("InvisibleNoDaughters")); - else if ( ::strstr(tag.c_str(),"_layer") ) // Layers turned off, but daughters possibly visible - setVisAttributes(lcdd.visAttributes("InvisibleWithDaughters")); - else if ( ::strstr(tag.c_str(),"_module") ) // Tracker modules similar to layers - setVisAttributes(lcdd.visAttributes("InvisibleWithDaughters")); - else if ( ::strstr(tag.c_str(),"_module_component") ) // Tracker modules similar to layers - setVisAttributes(lcdd.visAttributes("InvisibleNoDaughters")); - */ + string tag = this->name(); + if ( ::strstr(tag.c_str(),"_slice") ) // Slices turned off by default + setVisAttributes(lcdd.visAttributes("InvisibleNoDaughters")); + else if ( ::strstr(tag.c_str(),"_layer") ) // Layers turned off, but daughters possibly visible + setVisAttributes(lcdd.visAttributes("InvisibleWithDaughters")); + else if ( ::strstr(tag.c_str(),"_module") ) // Tracker modules similar to layers + setVisAttributes(lcdd.visAttributes("InvisibleWithDaughters")); + else if ( ::strstr(tag.c_str(),"_module_component") ) // Tracker modules similar to layers + setVisAttributes(lcdd.visAttributes("InvisibleNoDaughters")); + */ } } /// Attach attributes to the volume void Volume::setAttributes(const LCDD& lcdd, - const string& region, - const string& limits, - const string& vis) const + const string& region, + const string& limits, + const string& vis) const { if ( !region.empty() ) setRegion(lcdd.region(region)); if ( !limits.empty() ) setLimitSet(lcdd.limitSet(limits)); @@ -393,7 +393,7 @@ string PlacedVolume::toString() const { stringstream s; Object* obj = data<Object>(); s << m_element->GetName() << ": vol='" << m_element->GetVolume()->GetName() - << "' mat:'" << m_element->GetMatrix()->GetName() << "' volID[" << obj->volIDs.size() << "] "; + << "' mat:'" << m_element->GetMatrix()->GetName() << "' volID[" << obj->volIDs.size() << "] "; for(VolIDs::const_iterator i=obj->volIDs.begin(); i!=obj->volIDs.end();++i) s << (*i).first << "=" << (*i).second << " "; s << ends; diff --git a/DDExamples/AlignDet/compact/compact.xml b/DDExamples/AlignDet/compact/compact.xml index 96751ac786be317fb1d9d5a37547f60ad4e4538b..8765829147427b42acff3d12d2461473254cfc44 100644 --- a/DDExamples/AlignDet/compact/compact.xml +++ b/DDExamples/AlignDet/compact/compact.xml @@ -1,72 +1,81 @@ <lccdd xmlns:compact="http://www.lcsim.org/schemas/compact/1.0" - xmlns:xs="http://www.w3.org/2001/XMLSchema" - xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/compact/1.0/compact.xsd"> - - <info name="clic_sid_cdr" - title="CLIC Silicon Detector CDR" - author="Christian Grefe" - url="https://twiki.cern.ch/twiki/bin/view/CLIC/ClicSidCdr" - status="development" - version="$Id: compact.xml,v 1.3 2010/12/02 16:34:00 grefe Exp $"> - <comment>The compact format for the CLIC Silicon Detector used for the conceptual design report</comment> - </info> - - <includes> - <gdmlFile ref="elements.xml"/> - <gdmlFile ref="materials.xml"/> - </includes> + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/compact/1.0/compact.xsd"> + + <info name="clic_sid_cdr" + title="CLIC Silicon Detector CDR" + author="Christian Grefe" + url="https://twiki.cern.ch/twiki/bin/view/CLIC/ClicSidCdr" + status="development" + version="$Id: compact.xml,v 1.3 2010/12/02 16:34:00 grefe Exp $"> + <comment>The compact format for the CLIC Silicon Detector used for the conceptual design report</comment> + </info> + + <includes> + <gdmlFile ref="elements.xml"/> + <gdmlFile ref="materials.xml"/> + <pyBuilder ref="../drivers"/> + </includes> + + <define> + <constant name="world_side" value="30000"/> + <constant name="world_x" value="world_side"/> + <constant name="world_y" value="world_side"/> + <constant name="world_z" value="world_side"/> - <define> - <constant name="world_side" value="30000"/> - <constant name="world_x" value="world_side"/> - <constant name="world_y" value="world_side"/> - <constant name="world_z" value="world_side"/> - - <constant name="tracking_region_radius" value="10000"/> - <constant name="tracking_region_zmax" value="10000"/> - </define> - - <limits> - <limitset name="cal_limits"> - <limit name="step_length_max" particles="*" value="5.0" unit="mm" /> - </limitset> - </limits> - - <display> - <vis name="InvisibleNoDaughters" showDaughters="false" visible="false"/> - <vis name="InvisibleWithDaughters" showDaughters="true" visible="false"/> - <vis name="B1_vis" alpha="1.0" r="1" g="0" b="0" showDaughters="true" visible="true"/> - <vis name="B2_vis" alpha="1.0" r="0" g="1" b="0" showDaughters="true" visible="true"/> - </display> + <constant name="tracking_region_radius" value="10000"/> + <constant name="tracking_region_zmax" value="10000"/> + </define> + + <limits> + <limitset name="cal_limits"> + <limit name="step_length_max" particles="*" value="5.0" unit="mm" /> + </limitset> + </limits> + + <display> + <vis name="InvisibleNoDaughters" showDaughters="false" visible="false"/> + <vis name="InvisibleWithDaughters" showDaughters="true" visible="false"/> + <vis name="B1_vis" alpha="1.0" r="1" g="0" b="0" showDaughters="true" visible="true"/> + <vis name="B2_vis" alpha="1.0" r="0" g="1" b="0" showDaughters="true" visible="true"/> + </display> + + <detectors> + <comment>Boxes</comment> - <detectors> - <comment>Boxes</comment> - <detector id="1" name="B1" type="BoxSegment" vis="B1_vis"> - <comment>Horizontal box</comment> - <material name="Steel235"/> - <box x="20" y="0.1" z="5"/> - <position x="20" y="10" z="10"/> - <rotation x="1" y="0" z="0"/> - </detector> - <detector id="2" name="B2" type="BoxSegment" vis="B2_vis"> - <comment>Vertical box</comment> - <material name="Steel235"/> - <box x="0.1" y="20" z="5"/> - <position x="0" y="30" z="10"/> - <rotation x="0" y="0" z="0"/> - </detector> - </detectors> - - - <alignments> - <alignment name="/world_volume_1/B1_envelope_volume_0" shortcut="Box1"> -<!-- - <position x="0" y="0" z="0"/> - <position x="20" y="10" z="10"/> ---> - <position x="-20" y="-10" z="-5"/> - <rotation x="0" y="0" z="0"/> - </alignment> - </alignments> + <!--detector id="1" name="B1" type="BoxSegment" vis="B1_vis"> + <comment>Horizontal box</comment> + <material name="Steel235"/> + <box x="20" y="0.1" z="5"/> + <position x="20" y="10" z="10"/> + <rotation x="1" y="0" z="0"/> + </detector> + <detector id="2" name="B2" type="BoxSegment" vis="B2_vis"> + <comment>Vertical box</comment> + <material name="Steel235"/> + <box x="0.1" y="20" z="5"/> + <position x="0" y="30" z="10"/> + <rotation x="0" y="0" z="0"/> + </detector--> + + <comment>Library</comment> + <detector id="1" name="S1" type="Shelf" > + <material name="Steel235"/> + <planes number="2" x="11*cm" y="2*cm" dy="50*cm" z="40*cm" vis="B1_vis" /> + <books number="10" x="10*cm" y="15*cm" z="3*cm" dz="0.2*cm" vis="B2_vis"/> + </detector> + </detectors> + + <alignments> + <alignment name="/world_volume_1/S1_0/ensemble_0/book_7" shortcut="Book0.7"> + <position x="0" y="3*cm" z="0"/> + <rotation x="0" y="0" z="10*degree"/> + </alignment> + <alignment name="/world_volume_1/S1_0/ensemble_1/book_2" shortcut="Book0.7"> + <position x="0" y="0" z="0"/> + <rotation x="10*degree" y="0" z="0"/> + </alignment> + </alignments> + </lccdd> diff --git a/DDExamples/AlignDet/drivers/BoxSegment.py b/DDExamples/AlignDet/drivers/BoxSegment.py new file mode 100644 index 0000000000000000000000000000000000000000..2e4e6e6eb1b8153ad87892e5968378fc25df6275 --- /dev/null +++ b/DDExamples/AlignDet/drivers/BoxSegment.py @@ -0,0 +1,15 @@ +def detector_BoxSegment(lcdd, det): + box = det.find('box') + mat = det.find('material') + pos = det.find('position') + rot = det.find('rotation') + mother = lcdd.worldVolume() + de = DetElement(lcdd, det.name, det.type, det.id) + sha = Box(lcdd, det.name+'_envelope', box.x, box.y, box.z) + vol = Volume(lcdd, det.name+'_envelope_volume', sha, lcdd.material(mat.name)) + phv = mother.placeVolume(vol, Position(pos.x, pos.y, pos.z), + Rotation(rot.x, rot.y, rot.z)) + vol.setVisAttributes(lcdd, det.vis) + phv.addPhysVolID('id',det.id) + de.addPlacement(phv) + return de diff --git a/DDExamples/AlignDet/drivers/Shelf.py b/DDExamples/AlignDet/drivers/Shelf.py new file mode 100644 index 0000000000000000000000000000000000000000..d221cc1aa1e24db5f96e3c48aa68d8f4874b2dda --- /dev/null +++ b/DDExamples/AlignDet/drivers/Shelf.py @@ -0,0 +1,39 @@ +def detector_Shelf(lcdd, det): + + plane = det.find('planes') + mat = det.find('material') + #pos = det.find('position') + #rot = det.find('rotation') + book = det.find('books') + + #---Construct the ensamble plane+books volume------------------------------------------------------------- + e_vol = Volume(lcdd, 'ensemble', Box(lcdd,'box', plane.x, plane.y+book.y, plane.z), lcdd.material('Air')) + e_vol.setVisAttributes(lcdd,'InvisibleWithDaughters') + + #---Construct the plane and place it---------------------------------------------------------------------- + p_vol = Volume(lcdd, 'plane', Box(lcdd, 'plane', plane.x, plane.y, plane.z), lcdd.material(mat.name)) + p_vol.setVisAttributes(lcdd, plane.vis) + e_vol.placeVolume(p_vol, Position(0,-book.y,0)) + + #---Construct a book and place it number of times--------------------------------------------------------- + b_vol = Volume(lcdd, 'book',Box(lcdd, 'book', book.x, book.y, book.z), lcdd.material('Carbon')) + b_vol.setVisAttributes(lcdd, book.vis) + x,y,z = plane.x-book.x, plane.y, -plane.z+book.z + for n in range(book.number): + e_vol.placeVolume(b_vol, Position(x,y,z)) + z += 2*book.z + book.getF('dz') + + #--Construct the overal envelope and Detector element----------------------------------------------------- + g_x, g_y, g_z = plane.x, plane.number*plane.getF('dy'), plane.z + g_vol = Volume(lcdd, det.name, Box(lcdd,'box', g_x, g_y, g_z), lcdd.material('Air')) + g_vol.setVisAttributes(lcdd,'InvisibleWithDaughters') + de = DetElement(lcdd, det.name, det.type, det.id) + phv = lcdd.worldVolume().placeVolume(g_vol, Position(g_x,g_y,g_z)) + phv.addPhysVolID('id',det.id) + de.addPlacement(phv) + x,y,z = 0,book.y+plane.y-2*plane.getF('dy'),0 + for n in range(plane.number): + g_vol.placeVolume(e_vol, Position(x,y,z)) + y += plane.getF('dy') + #---Return detector element--------------------------------------------------------------------------------- + return de diff --git a/DDExamples/CLICSiD/drivers/SiTrackerEndcap2.py b/DDExamples/CLICSiD/drivers/SiTrackerEndcap2.py index 5d18d691d23ab6982f0f7ca365b5abb0220882ae..94ee3a22b06ca80e2cd36daec179e47caa62e978 100644 --- a/DDExamples/CLICSiD/drivers/SiTrackerEndcap2.py +++ b/DDExamples/CLICSiD/drivers/SiTrackerEndcap2.py @@ -21,7 +21,7 @@ def detector_SiTrackerEndcap2(lcdd, det): if mod.vis : vol.setVisAttributes(lcdd.visAttributes(mod.vis)) phv = m_volume.placeVolume(vol, Position(0e0, posY + c.thickness/2e0, 0e0)) phv.addPhysVolID('component', c_id) - if c.getB('sentivite'): + if c.getB('sensitive'): if n_sensor > 1 : print 'SiTrackerEndcap2::fromCompact: '+c_name+' Max of 2 modules allowed!' phv.addPhysVolID('sensor',c_id) #vol.setSensitiveDetector(sens)