Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:08:10

0001 /** Implementation of the ME0 Geometry Builder from DDD stored in CondDB
0002  *
0003  *  \author M. Maggi - INFN Bari
0004  */
0005 #include "Geometry/GEMGeometryBuilder/src/ME0GeometryBuilderFromCondDB.h"
0006 #include "Geometry/GEMGeometry/interface/ME0Geometry.h"
0007 #include "Geometry/GEMGeometry/interface/ME0EtaPartitionSpecs.h"
0008 
0009 #include <DetectorDescription/Core/interface/DDFilter.h>
0010 #include <DetectorDescription/Core/interface/DDFilteredView.h>
0011 #include <DetectorDescription/Core/interface/DDSolid.h>
0012 
0013 #include "Geometry/MuonNumbering/interface/MuonGeometryNumbering.h"
0014 #include "Geometry/MuonNumbering/interface/MuonBaseNumber.h"
0015 #include "Geometry/MuonNumbering/interface/ME0NumberingScheme.h"
0016 
0017 #include "DataFormats/GeometrySurface/interface/RectangularPlaneBounds.h"
0018 #include "DataFormats/GeometrySurface/interface/TrapezoidalPlaneBounds.h"
0019 
0020 #include "DataFormats/GeometryVector/interface/Basic3DVector.h"
0021 
0022 #include "DataFormats/Math/interface/GeantUnits.h"
0023 
0024 #include <iostream>
0025 #include <algorithm>
0026 
0027 using namespace geant_units::operators;
0028 
0029 ME0GeometryBuilderFromCondDB::ME0GeometryBuilderFromCondDB() {}
0030 
0031 ME0GeometryBuilderFromCondDB::~ME0GeometryBuilderFromCondDB() {}
0032 
0033 ME0Geometry* ME0GeometryBuilderFromCondDB::build(const RecoIdealGeometry& rgeo) {
0034   const std::vector<DetId>& detids(rgeo.detIds());
0035   ME0Geometry* geometry = new ME0Geometry();
0036 
0037   std::string name;
0038   std::vector<double>::const_iterator tranStart;
0039   std::vector<double>::const_iterator shapeStart;
0040   std::vector<double>::const_iterator rotStart;
0041   std::vector<std::string>::const_iterator strStart;
0042 
0043   for (unsigned int id = 0; id < detids.size(); ++id) {
0044     ME0DetId me0id(detids[id]);
0045 
0046     tranStart = rgeo.tranStart(id);
0047     shapeStart = rgeo.shapeStart(id);
0048     rotStart = rgeo.rotStart(id);
0049     strStart = rgeo.strStart(id);
0050     name = *(strStart);
0051 
0052     Surface::PositionType pos(
0053         convertMmToCm(*(tranStart)), convertMmToCm(*(tranStart + 1)), convertMmToCm(*(tranStart + 2)));
0054     Surface::RotationType rot(*(rotStart + 0),
0055                               *(rotStart + 1),
0056                               *(rotStart + 2),
0057                               *(rotStart + 3),
0058                               *(rotStart + 4),
0059                               *(rotStart + 5),
0060                               *(rotStart + 6),
0061                               *(rotStart + 7),
0062                               *(rotStart + 8));
0063 
0064     Bounds* bounds = nullptr;
0065     float be = convertMmToCm(*(shapeStart + 0));
0066     float te = convertMmToCm(*(shapeStart + 1));
0067     float ap = convertMmToCm(*(shapeStart + 2));
0068     float ti = convertMmToCm(*(shapeStart + 3));
0069     float nstrip = *(shapeStart + 4);
0070     float npad = *(shapeStart + 5);
0071     //  TrapezoidalPlaneBounds*
0072     bounds = new TrapezoidalPlaneBounds(be, te, ap, ti);
0073 
0074     std::vector<float> pars;
0075     pars.emplace_back(be);  //b/2;
0076     pars.emplace_back(te);  //B/2;
0077     pars.emplace_back(ap);  //h/2;
0078     pars.emplace_back(nstrip);
0079     pars.emplace_back(npad);
0080 
0081     ME0EtaPartitionSpecs* e_p_specs = new ME0EtaPartitionSpecs(GeomDetEnumerators::ME0, name, pars);
0082 
0083     //Change of axes for the forward
0084     Basic3DVector<float> newX(1., 0., 0.);
0085     Basic3DVector<float> newY(0., 0., 1.);
0086     //      if (tran[2] > 0. )
0087     newY *= -1;
0088     Basic3DVector<float> newZ(0., 1., 0.);
0089     rot.rotateAxes(newX, newY, newZ);
0090 
0091     BoundPlane* bp = new BoundPlane(pos, rot, bounds);
0092     ReferenceCountingPointer<BoundPlane> surf(bp);
0093     ME0EtaPartition* mep = new ME0EtaPartition(me0id, surf, e_p_specs);
0094     geometry->add(mep);
0095   }
0096   return geometry;
0097 }