Skip to content

Commit

Permalink
Port CTPPS to DD4hep (#31240)
Browse files Browse the repository at this point in the history
* Printouts old DD translations / rotations

* Preview of PPS DD4Hep producer and related files

* Use ROOT versions of DDTranslation and DDRotationMatrix

* Debug printouts, test effect of port of PPSGeometryBuilder to DD4hep.

* Port PPSGeometryBuilder to DD4hep, still several points to debug

* Debug printouts

* Fixes

* DD -> DD4hep: Fixed issue in number of nodes

* Move computeDetId to DetGeomDesc + Fixes in DetGeomDesc constructor from cms::DDFilteredView + Remove duplicated code from CondTools/Geometry/plugins/PPSGeometryBuilder.cc, create PDetGeomDesc directly from DetGeomDesc instead + Add constructor in PDetGeomDesc from DetGeomDesc.

* const DetGeomDesc

* DD -> DD4hep: do not store first volumes in PDetGeomDesc, as was for old DD

* Fixes in PDetGeomDesc and DetGeomDesc

* Add support for more shapes.

* Used SpecPar section to define 2x2RPixWafer, it works :)

* Cleaning: buildDetGeomDescFromCompactView

* Now params work for all shapes :)

* minor fix

* minor fix

* Fixed major issue in XMLs as read by DD4hep: [constant]*mm will divide by 10 the constant, even if the constant is alreday expressed in mm!!. This lead to many regressions.

* Fixed another major regression in XMLs with DD4hep (also issue of *mm of a constant in XMLs)

* better printout

* Another issue in XMLs

* Other XML fixes

* fix merge conflict remainer

* Test files

* Add more specpars, so taht it works for 2018 scenartio as well

* debug RPDisplacementGenerator

* remove

* Cleaned PPSGeometryBuilder and add geader for PPSGeometryESProducer

* ceamed headers

* More cleaning

* moved dd4hep xml files

* remove debug in filtered view

* minor xmls lines removal

* useless to have pointers here

* Cleaned DetGeomDesc

* cleaned RPDisplacementGenerator

* cleaned PPSGeometryESProducer

* No need to constrct from PGeomDet

* cosmetics and added few comments

* Cleaned PPSGeometryESProducer headers

* Cleaned headers + Move static function outside of class + Add comments.

* Added isABoolean() to cms::DDFilteredView + Added erorr message.

* Code for PPS migration to DD4hep

* Removed printouts.

* DiamonDimensions: better to use a struct.

* Remove unnecessary template in DDFilteredView.h

* Reordering and cleaning in DetGeomDesc.

* Remove Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule (replaced by Geometry/VeryForwardGeometryBuilder/plugins/PPSGeometryESProducer) and dependency to old DD. + Port remaining scenarios.

* Fixed typo in XMLs + Fixed cfi files so that all calling cfg files now work as expected. Only 1 exception: Geometry/VeryForwardGeometry/test/test_geom_cfg.py needs to be updated as it relies on an old DD producer.

* Fixes in XML for additional scnearios.

* Remove duplicated file.

* Removed old DD Producer from test_geom_cfg

* Fixed geometryRPFromDB loading from DB

* Put empty XML when fromDB==true, to avoid confusion. Would need to change DDDetectorESProducer, which should not ask for any XML when info is from DB.

* IMPORTANT: Fix issue in scenarios from DB: there is a namespace in geo built from DB, leading to string casting issues. Fix name computation + Id computation + Sensor type computation. Also adds printouts to be able to check with pre-DD4hep migration branch. To be cleaned.

* Cleaning

* Print DetGeomDesc info when verbosity == 2.

* Add comments on units. NB: Was decided to use mm as default, to avoid any regression when interacting with XMLs / Geant4 values, which are in mm. Only exception are the shape parameters, stored directly in cm from DD4hep, as conversion / order of shape parameters were significantly different anyway, and they are unused anyway. Only parameters used are the box parameters, converted to mm.

* Renamed description

* Added debug comments

* Added comments

* Add empty XML file

* Use geant units conversion functions instead of 1 / 1_mm, same but more readable.

* Add default instead of empty body + remove useless empty constructor

* scram build code-format

* Forgot to add MessageLogger header

* Clean old code from official CondTools/Geometry/plugins/PPSGeometryBuilder.cc

* Remove ideal scenarios geometryIdealPPSFromDD_2016, 2017, and 2018, as they were duplicate from geometryRPFromDD_2017 and geometryRPFromDD_2018.

* fixes in namespace + plugin header + in old legacy code (not addressing fixes in memory management in legacy code though, should be done in independent PR).

* Fix style in reco package.

Co-authored-by: Wagner Carvalho <wcarvalh@cern.ch>
  • Loading branch information
ghugo83 and wpcarvalho committed Sep 2, 2020
1 parent 798edb2 commit 499518f
Show file tree
Hide file tree
Showing 44 changed files with 1,495 additions and 1,914 deletions.
1 change: 1 addition & 0 deletions CondFormats/GeometryObjects/BuildFile.xml
@@ -1,6 +1,7 @@
<use name="DataFormats/DetId"/>
<use name="CondFormats/Serialization"/>
<use name="boost_serialization"/>
<use name="dd4hep"/>
<export>
<lib name="1"/>
</export>
30 changes: 23 additions & 7 deletions CondFormats/GeometryObjects/interface/PDetGeomDesc.h
Expand Up @@ -2,25 +2,41 @@
#define CondFormats_PDetGeomDesc_h

#include "CondFormats/Serialization/interface/Serializable.h"
#include "Geometry/VeryForwardGeometryBuilder/interface/DetGeomDesc.h"
#include "DetectorDescription/DDCMS/interface/DDTranslation.h"
#include "DetectorDescription/DDCMS/interface/DDRotationMatrix.h"

#include <vector>
#include <string>

class PDetGeomDesc {
public:
PDetGeomDesc(){};
~PDetGeomDesc(){};

struct Item {
Item() = default;
Item(const DetGeomDesc* const geoInfo) {
dx_ = geoInfo->translation().X();
dy_ = geoInfo->translation().Y();
dz_ = geoInfo->translation().Z();

const DDRotationMatrix& rot = geoInfo->rotation();
rot.GetComponents(axx_, axy_, axz_, ayx_, ayy_, ayz_, azx_, azy_, azz_);
name_ = geoInfo->name();
params_ = geoInfo->params();
copy_ = geoInfo->copyno();
z_ = geoInfo->parentZPosition();
sensorType_ = geoInfo->sensorType();
geographicalID_ = geoInfo->geographicalID();
}

// Translation matrix elements
double dx_, dy_, dz_;
double dx_, dy_, dz_; // in mm
// Rotation matrix elements
double axx_, axy_, axz_, ayx_, ayy_, ayz_, azx_, azy_, azz_;
std::string name_;
std::vector<double> params_;
uint32_t geographicalID_; // to be converted to DetId
std::vector<double> params_; // default unit from DD4hep (cm)
uint32_t geographicalID_; // to be converted to DetId
int copy_;
float z_;
float z_; // in mm
std::string sensorType_;

COND_SERIALIZABLE;
Expand Down
55 changes: 28 additions & 27 deletions CondTools/Geometry/plugins/BuildFile.xml
@@ -1,30 +1,31 @@
<use name="root"/>
<use name="CondCore/DBOutputService"/>
<use name="CondFormats/Common"/>
<use name="CondFormats/GeometryObjects"/>
<use name="DataFormats/CTPPSDetId"/>
<use name="DetectorDescription/Core"/>
<use name="FWCore/Framework"/>
<use name="FWCore/ParameterSet"/>
<use name="FWCore/ServiceRegistry"/>
<use name="Geometry/Records"/>
<use name="Geometry/TrackerGeometryBuilder"/>
<use name="Geometry/TrackerNumberingBuilder"/>
<use name="Geometry/CaloGeometry"/>
<use name="Geometry/EcalAlgo"/>
<use name="Geometry/HcalCommonData"/>
<use name="Geometry/HcalTowerAlgo"/>
<use name="Geometry/ForwardGeometry"/>
<use name="Geometry/CSCGeometryBuilder"/>
<use name="Geometry/DTGeometry"/>
<use name="Geometry/DTGeometryBuilder"/>
<use name="Geometry/RPCGeometry"/>
<use name="Geometry/RPCGeometryBuilder"/>
<use name="Geometry/GEMGeometry"/>
<use name="Geometry/GEMGeometryBuilder"/>
<use name="Geometry/MuonNumbering"/>
<use name="Geometry/HGCalGeometry"/>
<use name="Geometry/VeryForwardGeometryBuilder"/>
<library file="*.cc" name="CondToolsGeometryPlugins">
<use name="root"/>
<use name="dd4hep"/>
<use name="CondCore/DBOutputService"/>
<use name="CondFormats/Common"/>
<use name="CondFormats/GeometryObjects"/>
<use name="DataFormats/CTPPSDetId"/>
<use name="DetectorDescription/DDCMS"/>
<use name="FWCore/Framework"/>
<use name="FWCore/ParameterSet"/>
<use name="FWCore/ServiceRegistry"/>
<use name="Geometry/Records"/>
<use name="Geometry/TrackerGeometryBuilder"/>
<use name="Geometry/TrackerNumberingBuilder"/>
<use name="Geometry/CaloGeometry"/>
<use name="Geometry/EcalAlgo"/>
<use name="Geometry/HcalCommonData"/>
<use name="Geometry/HcalTowerAlgo"/>
<use name="Geometry/ForwardGeometry"/>
<use name="Geometry/CSCGeometryBuilder"/>
<use name="Geometry/DTGeometry"/>
<use name="Geometry/DTGeometryBuilder"/>
<use name="Geometry/RPCGeometry"/>
<use name="Geometry/RPCGeometryBuilder"/>
<use name="Geometry/GEMGeometry"/>
<use name="Geometry/GEMGeometryBuilder"/>
<use name="Geometry/MuonNumbering"/>
<use name="Geometry/HGCalGeometry"/>
<use name="Geometry/VeryForwardGeometryBuilder"/>
<flags EDM_PLUGIN="1"/>
</library>

0 comments on commit 499518f

Please sign in to comment.