Skip to content

Commit

Permalink
Merge pull request #31484 from forthommel/pps-timing_2021_geom-11_2_X
Browse files Browse the repository at this point in the history
[PPS] 2021 conditions for timing detectors geometry (resubmission after DD4hep)
  • Loading branch information
cmsbuild authored Dec 11, 2020
2 parents 8e64f55 + c0145c7 commit 7170574
Show file tree
Hide file tree
Showing 32 changed files with 860 additions and 155 deletions.
7 changes: 5 additions & 2 deletions CalibPPS/ESProducers/plugins/CTPPSCompositeESSource.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class CTPPSCompositeESSource : public edm::ESProducer, public edm::EventSetupRec
std::string opticsLabel_;
unsigned int generateEveryNEvents_;
unsigned int verbosity_;
const bool isRun2_;

// ES tokens
edm::ESGetToken<DDCompactView, IdealGeometryRecord> tokenCompactViewReal_, tokenCompactViewMisaligned_;
Expand Down Expand Up @@ -126,6 +127,7 @@ CTPPSCompositeESSource::CTPPSCompositeESSource(const edm::ParameterSet &conf)
opticsLabel_(conf.getParameter<std::string>("opticsLabel")),
generateEveryNEvents_(conf.getUntrackedParameter<unsigned int>("generateEveryNEvents")),
verbosity_(conf.getUntrackedParameter<unsigned int>("verbosity")),
isRun2_(conf.getParameter<bool>("isRun2")),
m_engine_(new CLHEP::HepJamesRandom(conf.getParameter<unsigned int>("seed"))) {
double l_int_sum = 0;

Expand Down Expand Up @@ -174,6 +176,7 @@ void CTPPSCompositeESSource::fillDescriptions(edm::ConfigurationDescriptions &de
desc.add<std::string>("lhcInfoLabel", "")->setComment("label of the LHCInfo record");
desc.add<std::string>("opticsLabel", "")->setComment("label of the optics record");
desc.add<unsigned int>("seed", 1)->setComment("random seed");
desc.add<bool>("isRun2", false)->setComment("use diamond's run 2 geometry definition?");
desc.addUntracked<unsigned int>("generateEveryNEvents", 1)->setComment("how often to switch conditions");
desc.addUntracked<unsigned int>("verbosity", 0);

Expand Down Expand Up @@ -259,7 +262,7 @@ void CTPPSCompositeESSource::buildDirectSimuData(const edm::ParameterSet &profil
//----------------------------------------------------------------------------------------------------

void CTPPSCompositeESSource::buildGeometry(const DDCompactView &cpv) {
std::unique_ptr<DetGeomDesc> idealGD = detgeomdescbuilder::buildDetGeomDescFromCompactView(cpv);
std::unique_ptr<DetGeomDesc> idealGD = detgeomdescbuilder::buildDetGeomDescFromCompactView(cpv, isRun2_);

for (auto &pb : profile_bins_) {
auto &p = pb.data;
Expand Down Expand Up @@ -470,4 +473,4 @@ std::unique_ptr<LHCInfo> CTPPSCompositeESSource::produceLhcInfo(const LHCInfoRcd

//----------------------------------------------------------------------------------------------------

DEFINE_FWK_EVENTSETUP_SOURCE(CTPPSCompositeESSource);
DEFINE_FWK_EVENTSETUP_SOURCE(CTPPSCompositeESSource);
6 changes: 4 additions & 2 deletions CondTools/Geometry/plugins/PPSGeometryBuilder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class PPSGeometryBuilder : public edm::one::EDAnalyzer<> {

bool fromDD4hep_;
std::string compactViewTag_;
bool isRun2_;
edm::ESGetToken<DDCompactView, IdealGeometryRecord> ddToken_;
edm::ESGetToken<cms::DDCompactView, IdealGeometryRecord> dd4hepToken_;
edm::ESWatcher<IdealGeometryRecord> watcherIdealGeometry_;
Expand All @@ -46,6 +47,7 @@ class PPSGeometryBuilder : public edm::one::EDAnalyzer<> {
PPSGeometryBuilder::PPSGeometryBuilder(const edm::ParameterSet& iConfig)
: fromDD4hep_(iConfig.getUntrackedParameter<bool>("fromDD4hep", false)),
compactViewTag_(iConfig.getUntrackedParameter<std::string>("compactViewTag", "XMLIdealGeometryESSource_CTPPS")),
isRun2_(iConfig.getUntrackedParameter<bool>("isRun2", false)),
ddToken_(esConsumes(edm::ESInputTag("", compactViewTag_))),
dd4hepToken_(esConsumes(edm::ESInputTag("", compactViewTag_))) {}

Expand All @@ -63,15 +65,15 @@ void PPSGeometryBuilder::analyze(const edm::Event& iEvent, const edm::EventSetup
auto const& myCompactView = iSetup.getData(ddToken_);

// Build geometry
geoInfoRoot = detgeomdescbuilder::buildDetGeomDescFromCompactView(myCompactView);
geoInfoRoot = detgeomdescbuilder::buildDetGeomDescFromCompactView(myCompactView, isRun2_);
}
// DD4hep
else {
// Get CompactView from IdealGeometryRecord
auto const& myCompactView = iSetup.getData(dd4hepToken_);

// Build geometry
geoInfoRoot = detgeomdescbuilder::buildDetGeomDescFromCompactView(myCompactView);
geoInfoRoot = detgeomdescbuilder::buildDetGeomDescFromCompactView(myCompactView, isRun2_);
}
}

Expand Down
3 changes: 2 additions & 1 deletion CondTools/Geometry/test/ppsgeometrywriter_DD4hep.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@
)

# geometry
process.load("Geometry.VeryForwardGeometry.dd4hep.geometryRPFromDD_2018_cfi")
process.load("Geometry.VeryForwardGeometry.dd4hep.geometryRPFromDD_2021_cfi")

# DB writer
process.ppsGeometryBuilder = cms.EDAnalyzer("PPSGeometryBuilder",
fromDD4hep = cms.untracked.bool(True),
isRun2 = cms.untracked.bool(False),
compactViewTag = cms.untracked.string('XMLIdealGeometryESSource_CTPPS')
)

Expand Down
3 changes: 2 additions & 1 deletion CondTools/Geometry/test/ppsgeometrywriter_oldDD.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@
)

# geometry
process.load("Geometry.VeryForwardGeometry.geometryRPFromDD_2018_cfi")
process.load("Geometry.VeryForwardGeometry.geometryRPFromDD_2021_cfi")

# DB writer
process.ppsGeometryBuilder = cms.EDAnalyzer("PPSGeometryBuilder",
isRun2 = cms.untracked.bool(False),
compactViewTag = cms.untracked.string('XMLIdealGeometryESSource_CTPPS')
)

Expand Down
9 changes: 9 additions & 0 deletions DataFormats/CTPPSDetId/interface/CTPPSDetId.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,13 @@ class CTPPSDetId : public DetId {

std::ostream &operator<<(std::ostream &os, const CTPPSDetId &id);

namespace std {
template <>
struct hash<CTPPSDetId> {
typedef CTPPSDetId argument_type;
typedef std::size_t result_type;
result_type operator()(const argument_type &id) const noexcept { return std::hash<uint64_t>()(id.rawId()); }
};
} // namespace std

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0"?>
<DDDefinition xmlns="http://www.cern.ch/cms/DDL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.cern.ch/cms/DDL ../../../DetectorDescription/Schema/DDLSchema.xsd">
<ConstantsSection label="CTPPS_Timing_Stations_Assembly.xml" eval="true">
<!--positions of the stations from the IP5 to the first element of the station-->
<Constant name="CTPPS_Timing_Negative_Station_Position_z_1" value="-215.078*m"/>
<Constant name="CTPPS_Timing_Positive_Station_Position_z_1" value="215.078*m"/>
<Constant name="CTPPS_Timing_Negative_Station_Position_z_2" value="-215.7*m"/>
<Constant name="CTPPS_Timing_Positive_Station_Position_z_2" value="215.7*m"/>
</ConstantsSection>
<PosPartSection label="CTPPS_Timing_Stations_Assembly.xml">
<PosPart copyNumber="22">
<rParent name="cms:CMSE"/>
<rChild name="CTPPS_Timing_Positive_Station:CTPPS_Timing_Positive_Station"/>
<Translation x="0*mm" y="0*mm" z="[CTPPS_Timing_Positive_Station_Position_z_1]"/>
<rRotation name="rotations:000D"/>
</PosPart>
<PosPart copyNumber="16">
<rParent name="cms:CMSE"/>
<rChild name="CTPPS_Timing_Positive_Station:CTPPS_Timing_Positive_Station"/>
<Translation x="0*mm" y="0*mm" z="[CTPPS_Timing_Positive_Station_Position_z_2]"/>
<rRotation name="rotations:000D"/>
</PosPart>
<PosPart copyNumber="122">
<rParent name="cms:CMSE"/>
<rChild name="CTPPS_Timing_Negative_Station:CTPPS_Timing_Negative_Station"/>
<Translation x="0*mm" y="0*mm" z="[CTPPS_Timing_Negative_Station_Position_z_1]"/>
<rRotation name="rotations:180R"/>
</PosPart>
<PosPart copyNumber="116">
<rParent name="cms:CMSE"/>
<rChild name="CTPPS_Timing_Negative_Station:CTPPS_Timing_Negative_Station"/>
<Translation x="0*mm" y="0*mm" z="[CTPPS_Timing_Negative_Station_Position_z_2]"/>
<rRotation name="rotations:180R"/>
</PosPart>
</PosPartSection>
</DDDefinition>
154 changes: 154 additions & 0 deletions Geometry/VeryForwardData/data/2021/v1/RP_220_Left_Station.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
<?xml version="1.0" encoding="UTF-8"?>
<DDDefinition xmlns="http://www.cern.ch/cms/DDL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.cern.ch/cms/DDL ../../DDLSchema/DDLSchema.xsd">
<ConstantsSection label="RP_220_Left_Station.xml" eval="true">
<Constant name="RP_220_Left_Station_Length" value="6588*mm"/>
<!--Positions calculated from the wall closer to IP point-->
<Constant name="RP_220_Left_Prim_Vert_z" value="608*mm"/>
<Constant name="RP_220_Left_Prim_Hor_z" value="1058*mm"/>
<Constant name="RP_220_Left_Sec_Hor_z" value="5530*mm"/>
<Constant name="RP_220_Left_Sec_Vert_z" value="5980*mm"/>
<Constant name="RP_220_Left_Hor_Vac_Length" value="[RP_Device:RP_Device_Envelope_Radius]+[RP_Device:RP_Device_Length_y]/2-[RP_Horizontal_Device:RP_Device_Hor_Closed_Wall_Thick_Int]"/>
</ConstantsSection>
<SolidSection label="RP_220_Left_Station.xml">
<Tube rMin="0*mm" rMax="[RP_Device:RP_Device_Envelope_Radius]*1.1" dz="[RP_220_Left_Station_Length]/2" name="RP_220_Left_Station"/>
<Tube rMin="[RP_Device:RP_Device_Beam_Hole_Diam]/2" rMax="[RP_Device:RP_Device_Beam_Hole_Diam]/2+[RP_Device:RP_Device_Wall_Thickness]" dz="([RP_220_Left_Prim_Vert_z]-[RP_Device:RP_Device_Length_z]/2)/2" name="RP_220_Left_Station_Tube_1"/>
<Tube rMin="[RP_Device:RP_Device_Beam_Hole_Diam]/2" rMax="[RP_Device:RP_Device_Beam_Hole_Diam]/2+[RP_Device:RP_Device_Wall_Thickness]" dz="([RP_220_Left_Prim_Hor_z]-[RP_220_Left_Prim_Vert_z]-[RP_Device:RP_Device_Length_z])/2" name="RP_220_Left_Station_Tube_2"/>
<Tube rMin="[RP_Device:RP_Device_Beam_Hole_Diam]/2" rMax="[RP_Device:RP_Device_Beam_Hole_Diam]/2+[RP_Device:RP_Device_Wall_Thickness]" dz="([RP_220_Left_Sec_Hor_z]-[RP_220_Left_Prim_Hor_z]-[RP_Device:RP_Device_Length_z])/2" name="RP_220_Left_Station_Tube_3"/>
<Tube rMin="[RP_Device:RP_Device_Beam_Hole_Diam]/2" rMax="[RP_Device:RP_Device_Beam_Hole_Diam]/2+[RP_Device:RP_Device_Wall_Thickness]" dz="([RP_220_Left_Sec_Vert_z]-[RP_220_Left_Sec_Hor_z]-[RP_Device:RP_Device_Length_z])/2" name="RP_220_Left_Station_Tube_4"/>
<Tube rMin="[RP_Device:RP_Device_Beam_Hole_Diam]/2" rMax="[RP_Device:RP_Device_Beam_Hole_Diam]/2+[RP_Device:RP_Device_Wall_Thickness]" dz="([RP_220_Left_Station_Length]-[RP_220_Left_Sec_Vert_z]-[RP_Device:RP_Device_Length_z]/2)/2" name="RP_220_Left_Station_Tube_5"/>
<Tube rMin="0*mm" rMax="[RP_Device:RP_Device_Beam_Hole_Diam]/2" dz="[RP_220_Left_Station_Length]/2" name="RP_220_Left_Station_Vacuum_1"/>
<Tube rMin="0*mm" rMax="[RP_Device:RP_Device_RP_Hole_Diam]/2" dz="[RP_Device:RP_Device_Envelope_Radius]" name="RP_220_Left_Station_Vert_Vacuum"/>
<UnionSolid name="RP_220_Left_Station_Vacuum_2">
<rSolid name="RP_220_Left_Station_Vacuum_1"/>
<rSolid name="RP_220_Left_Station_Vert_Vacuum"/>
<rRotation name="RP_Transformations:RP_x_90_rot"/>
<Translation x="0*mm" y="0*mm" z="-(-[RP_220_Left_Station_Length]/2+[RP_220_Left_Prim_Vert_z])"/>
</UnionSolid>
<UnionSolid name="RP_220_Left_Station_Vacuum_3">
<rSolid name="RP_220_Left_Station_Vacuum_2"/>
<rSolid name="RP_220_Left_Station_Vert_Vacuum"/>
<rRotation name="RP_Transformations:RP_x_90_rot"/>
<Translation x="0*mm" y="0*mm" z="-(-[RP_220_Left_Station_Length]/2+[RP_220_Left_Sec_Vert_z])"/>
</UnionSolid>
<Tube rMin="0*mm" rMax="[RP_Device:RP_Device_RP_Hole_Diam]/2" dz="[RP_220_Left_Hor_Vac_Length]/2" name="RP_220_Left_Station_Hor_Vacuum"/>
<UnionSolid name="RP_220_Left_Station_Vacuum_4">
<rSolid name="RP_220_Left_Station_Vacuum_3"/>
<rSolid name="RP_220_Left_Station_Hor_Vacuum"/>
<rRotation name="RP_Transformations:RP_y_90_rot"/>
<Translation x="-(-[RP_220_Left_Hor_Vac_Length]/2+[RP_Device:RP_Device_Length_y]/2-[RP_Horizontal_Device:RP_Device_Hor_Closed_Wall_Thick_Int])" y="0*mm" z="-(-[RP_220_Left_Station_Length]/2+[RP_220_Left_Prim_Hor_z])"/>
</UnionSolid>
<UnionSolid name="RP_220_Left_Station_Vacuum_5">
<rSolid name="RP_220_Left_Station_Vacuum_4"/>
<rSolid name="RP_220_Left_Station_Hor_Vacuum"/>
<rRotation name="RP_Transformations:RP_y_90_rot"/>
<Translation x="-(-[RP_220_Left_Hor_Vac_Length]/2+[RP_Device:RP_Device_Length_y]/2-[RP_Horizontal_Device:RP_Device_Hor_Closed_Wall_Thick_Int])" y="0*mm" z="-(-[RP_220_Left_Station_Length]/2+[RP_220_Left_Sec_Hor_z])"/>
</UnionSolid>
</SolidSection>
<LogicalPartSection label="RP_220_Left_Station.xml">
<LogicalPart name="RP_220_Left_Station">
<rSolid name="RP_220_Left_Station"/>
<rMaterial name="RP_Materials:Air"/>
</LogicalPart>
<LogicalPart name="RP_220_Left_Station_Tube_1">
<rSolid name="RP_220_Left_Station_Tube_1"/>
<rMaterial name="RP_Materials:AISI-316L-Steel"/>
</LogicalPart>
<LogicalPart name="RP_220_Left_Station_Tube_2">
<rSolid name="RP_220_Left_Station_Tube_2"/>
<rMaterial name="RP_Materials:AISI-316L-Steel"/>
</LogicalPart>
<LogicalPart name="RP_220_Left_Station_Tube_3">
<rSolid name="RP_220_Left_Station_Tube_3"/>
<rMaterial name="RP_Materials:AISI-316L-Steel"/>
</LogicalPart>
<LogicalPart name="RP_220_Left_Station_Tube_4">
<rSolid name="RP_220_Left_Station_Tube_4"/>
<rMaterial name="RP_Materials:AISI-316L-Steel"/>
</LogicalPart>
<LogicalPart name="RP_220_Left_Station_Tube_5">
<rSolid name="RP_220_Left_Station_Tube_5"/>
<rMaterial name="RP_Materials:AISI-316L-Steel"/>
</LogicalPart>
<LogicalPart name="RP_220_Left_Station_Vacuum_5">
<rSolid name="RP_220_Left_Station_Vacuum_5"/>
<rMaterial name="RP_Materials:RP_Primary_Vacuum"/>
</LogicalPart>
</LogicalPartSection>
<PosPartSection label="RP_220_Left_Station.xml">
<PosPart copyNumber="1">
<rParent name="RP_220_Left_Station"/>
<rChild name="RP_Vertical_Device:RP_Device_Vert_Corp_3"/>
<Translation x="0*mm" y="0*mm" z="-(-[RP_220_Left_Station_Length]/2+[RP_220_Left_Prim_Vert_z])"/>
</PosPart>
<PosPart copyNumber="2">
<rParent name="RP_220_Left_Station"/>
<rChild name="RP_Vertical_Device:RP_Device_Vert_Corp_3"/>
<Translation x="0*mm" y="0*mm" z="-(-[RP_220_Left_Station_Length]/2+[RP_220_Left_Sec_Vert_z])"/>
</PosPart>
<PosPart copyNumber="1">
<rParent name="RP_220_Left_Station"/>
<rChild name="RP_Horizontal_Device:RP_Device_Hor_Corp_3"/>
<Translation x="0*mm" y="0*mm" z="-(-[RP_220_Left_Station_Length]/2+[RP_220_Left_Prim_Hor_z])"/>
</PosPart>
<PosPart copyNumber="2">
<rParent name="RP_220_Left_Station"/>
<rChild name="RP_Horizontal_Device:RP_Device_Hor_Corp_3"/>
<Translation x="0*mm" y="0*mm" z="-(-[RP_220_Left_Station_Length]/2+[RP_220_Left_Sec_Hor_z])"/>
</PosPart>
<PosPart copyNumber="1">
<rParent name="RP_220_Left_Station"/>
<rChild name="RP_220_Left_Station_Tube_1"/>
<Translation x="0*mm" y="0*mm" z="-(-[RP_220_Left_Station_Length]/2+([RP_220_Left_Prim_Vert_z]-[RP_Device:RP_Device_Length_z]/2)/2)"/>
</PosPart>
<PosPart copyNumber="1">
<rParent name="RP_220_Left_Station"/>
<rChild name="RP_220_Left_Station_Tube_2"/>
<Translation x="0*mm" y="0*mm" z="-(-[RP_220_Left_Station_Length]/2+([RP_220_Left_Prim_Vert_z]+[RP_220_Left_Prim_Hor_z])/2)"/>
</PosPart>
<PosPart copyNumber="1">
<rParent name="RP_220_Left_Station"/>
<rChild name="RP_220_Left_Station_Tube_4"/>
<Translation x="0*mm" y="0*mm" z="-(-[RP_220_Left_Station_Length]/2+([RP_220_Left_Sec_Hor_z]+[RP_220_Left_Sec_Vert_z])/2)"/>
</PosPart>
<PosPart copyNumber="1">
<rParent name="RP_220_Left_Station"/>
<rChild name="RP_220_Left_Station_Tube_5"/>
<Translation x="0*mm" y="0*mm" z="-([RP_220_Left_Station_Length]/2-([RP_220_Left_Station_Length]-[RP_220_Left_Sec_Vert_z]-[RP_Device:RP_Device_Length_z]/2)/2)"/>
</PosPart>
<PosPart copyNumber="1">
<rParent name="RP_220_Left_Station"/>
<rChild name="RP_220_Left_Station_Vacuum_5"/>
</PosPart>
<PosPart copyNumber="20">
<rParent name="RP_220_Left_Station_Vacuum_5"/>
<rChild name="RP_Box_020:RP_box_primary_vacuum"/>
<rRotation name="RP_Transformations:RP_y_180_rot"/>
<Translation x="0*mm" y="[RP_Dist_Beam_Cent:RP_220_Left_Det_Dist_0]+[RP_Box:RP_Box_primary_vacuum_y]/2" z="-([RP_220_Left_Prim_Vert_z]-[RP_220_Left_Station_Length]/2)"/>
</PosPart>
<PosPart copyNumber="21">
<rParent name="RP_220_Left_Station_Vacuum_5"/>
<rChild name="RP_Box_021:RP_box_primary_vacuum"/>
<rRotation name="RP_Transformations:RP_180_z_180_y_rot"/>
<Translation x="0*mm" y="-[RP_Dist_Beam_Cent:RP_220_Left_Det_Dist_1]-[RP_Box:RP_Box_primary_vacuum_y]/2" z="-([RP_220_Left_Prim_Vert_z]-[RP_220_Left_Station_Length]/2)"/>
</PosPart>
<PosPart copyNumber="10023">
<!-- the offset 10^4 indicates pixel RP -->
<rParent name="RP_220_Left_Station_Vacuum_5"/>
<rChild name="RP_Box_023:RP_box_primary_vacuum"/>
<rRotation name="RP_Transformations:RP_90_z_cw_180_y_rot"/>
<Translation x="-(-[RP_Dist_Beam_Cent:RP_220_Left_Det_Dist_3]-[RP_Box:RP_Box_primary_vacuum_y]/2)" y="0*mm" z="-([RP_220_Left_Sec_Hor_z]-[RP_220_Left_Station_Length]/2)"/>
</PosPart>
<PosPart copyNumber="24">
<rParent name="RP_220_Left_Station_Vacuum_5"/>
<rChild name="RP_Box_024:RP_box_primary_vacuum"/>
<rRotation name="RP_Transformations:RP_y_180_rot"/>
<Translation x="0*mm" y="[RP_Dist_Beam_Cent:RP_220_Left_Det_Dist_4]+[RP_Box:RP_Box_primary_vacuum_y]/2" z="-([RP_220_Left_Sec_Vert_z]-[RP_220_Left_Station_Length]/2)"/>
</PosPart>
<PosPart copyNumber="25">
<rParent name="RP_220_Left_Station_Vacuum_5"/>
<rChild name="RP_Box_025:RP_box_primary_vacuum"/>
<rRotation name="RP_Transformations:RP_180_z_180_y_rot"/>
<Translation x="0*mm" y="-[RP_Dist_Beam_Cent:RP_220_Left_Det_Dist_5]-[RP_Box:RP_Box_primary_vacuum_y]/2" z="-([RP_220_Left_Sec_Vert_z]-[RP_220_Left_Station_Length]/2)"/>
</PosPart>
</PosPartSection>
</DDDefinition>
Loading

0 comments on commit 7170574

Please sign in to comment.