Skip to content

Commit

Permalink
Replace boost lexical cast with std
Browse files Browse the repository at this point in the history
  • Loading branch information
ianna committed Sep 20, 2017
1 parent d7fc95b commit c822563
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 67 deletions.
41 changes: 9 additions & 32 deletions Geometry/GEMGeometryBuilder/src/ME0GeometryBuilderFromDDD.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/** Implementation of the ME0 Geometry Builder from DDD
*
* \author Port of: MuDDDME0Builder (ORCA)
* \author M. Maggi - INFN Bari
* \edited by D. Nash
*/
Expand All @@ -9,9 +8,9 @@
#include "Geometry/GEMGeometry/interface/ME0Chamber.h"
#include "Geometry/GEMGeometry/interface/ME0EtaPartitionSpecs.h"

#include <DetectorDescription/Core/interface/DDFilter.h>
#include <DetectorDescription/Core/interface/DDFilteredView.h>
#include <DetectorDescription/Core/interface/DDSolid.h>
#include "DetectorDescription/Core/interface/DDFilter.h"
#include "DetectorDescription/Core/interface/DDFilteredView.h"
#include "DetectorDescription/Core/interface/DDSolid.h"

#include "Geometry/MuonNumbering/interface/MuonDDDNumbering.h"
#include "Geometry/MuonNumbering/interface/MuonBaseNumber.h"
Expand All @@ -25,9 +24,9 @@
#include "CLHEP/Units/GlobalSystemOfUnits.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

#include <iostream>
#include <algorithm>
#include <boost/lexical_cast.hpp>
#include <iostream>
#include <string>

ME0GeometryBuilderFromDDD::ME0GeometryBuilderFromDDD()
{
Expand Down Expand Up @@ -58,14 +57,13 @@ ME0Geometry* ME0GeometryBuilderFromDDD::buildGeometry(DDFilteredView& fview, con
<<" First logical part "
<<fview.logicalPart().name().name();


bool doSubDets = fview.firstChild();

LogDebug("ME0GeometryBuilderFromDDD") << "doSubDets = " << doSubDets;

LogDebug("ME0GeometryBuilderFromDDD") <<"start the loop";
LogDebug("ME0GeometryBuilderFromDDD") <<"start the loop";

int nChambers(0);
int nChambers(0);
while (doSubDets)
{
// Get the Base Muon Number
Expand All @@ -82,27 +80,17 @@ ME0Geometry* ME0GeometryBuilderFromDDD::buildGeometry(DDFilteredView& fview, con
// chamber id for this partition. everything is the same; but partition number is 0 and layer number is 0.
LogDebug("ME0GeometryBuilderFromDDD") << "ME0 chamber rawId: " << ME0DetId(rollDetId.chamberId()).rawId() << ", detId: " << ME0DetId(rollDetId.chamberId());

//Commented out, we don't have stations
//const int stationId(rollDetId.station());
//if (stationId > maxStation) maxStation = stationId;

if (rollDetId.roll()==1) ++nChambers;


std::vector<double> dpar=fview.logicalPart().solid().parameters();
std::string name = fview.logicalPart().name().name();
DDTranslation tran = fview.translation();
DDRotationMatrix rota = fview.rotation();
Surface::PositionType pos(tran.x()/cm, tran.y()/cm, tran.z()/cm);
// CLHEP way
// Surface::RotationType rot(rota.xx(),rota.xy(),rota.xz(),
// rota.yx(),rota.yy(),rota.yz(),
// rota.zx(),rota.zy(),rota.zz());

//ROOT::Math way
DD3Vector x, y, z;
rota.GetComponents(x,y,z);
// doesn't this just re-inverse???

Surface::RotationType rot(float(x.X()), float(x.Y()), float(x.Z()),
float(y.X()), float(y.Y()), float(y.Z()),
float(z.X()), float(z.Y()), float(z.Z()));
Expand All @@ -129,10 +117,9 @@ ME0Geometry* ME0GeometryBuilderFromDDD::buildGeometry(DDFilteredView& fview, con

ME0EtaPartitionSpecs* e_p_specs = new ME0EtaPartitionSpecs(GeomDetEnumerators::ME0, name, pars);

//Change of axes for the forward
//Change of axes for the forward
Basic3DVector<float> newX(1.,0.,0.);
Basic3DVector<float> newY(0.,0.,1.);
// if (tran.z() > 0. )
newY *= -1;
Basic3DVector<float> newZ(0.,1.,0.);
rot.rotateAxes (newX, newY, newZ);
Expand All @@ -157,25 +144,16 @@ ME0Geometry* ME0GeometryBuilderFromDDD::buildGeometry(DDFilteredView& fview, con

// go to next layer
doSubDets = fview.nextSibling();


}


auto& partitions(geometry->etaPartitions());
// build the chambers and add them to the geometry
std::vector<ME0DetId> vDetId;
//int oldRollNumber = 1;
int oldLayerNumber = 1;
for (unsigned i=1; i<=partitions.size(); ++i){
ME0DetId detId(partitions.at(i-1)->id());
LogDebug("ME0GeometryBuilderFromDDD") << "Making ME0DetId = " <<detId;

//The GEM methodology depended on rollNumber changing from chamber to chamber, we need to use layer ID
//const int rollNumber(detId.roll());
// new batch of eta partitions --> new chamber
//if (rollNumber < oldRollNumber || i == partitions.size()) {

const int layerNumber(detId.layer());
if (layerNumber < oldLayerNumber || i == partitions.size()) {

Expand Down Expand Up @@ -208,6 +186,5 @@ ME0Geometry* ME0GeometryBuilderFromDDD::buildGeometry(DDFilteredView& fview, con
oldLayerNumber = layerNumber;
}


return geometry;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#include "Geometry/GEMGeometry/interface/ME0Geometry.h"
#include "Geometry/GEMGeometry/interface/ME0EtaPartitionSpecs.h"

#include <DetectorDescription/Core/interface/DDFilter.h>
#include <DetectorDescription/Core/interface/DDFilteredView.h>
#include <DetectorDescription/Core/interface/DDSolid.h>
#include "DetectorDescription/Core/interface/DDFilter.h"
#include "DetectorDescription/Core/interface/DDFilteredView.h"
#include "DetectorDescription/Core/interface/DDSolid.h"

#include "Geometry/MuonNumbering/interface/MuonDDDNumbering.h"
#include "Geometry/MuonNumbering/interface/MuonBaseNumber.h"
Expand All @@ -16,20 +16,20 @@

#include "CLHEP/Units/GlobalSystemOfUnits.h"

#include <iostream>
#include <algorithm>
#include <boost/lexical_cast.hpp>
#include <iostream>
#include <string>

ME0GeometryBuilderFromDDD10EtaPart::ME0GeometryBuilderFromDDD10EtaPart()
{ }

ME0GeometryBuilderFromDDD10EtaPart::~ME0GeometryBuilderFromDDD10EtaPart()
{ }


ME0Geometry* ME0GeometryBuilderFromDDD10EtaPart::build(const DDCompactView* cview, const MuonDDDConstants& muonConstants)
ME0Geometry*
ME0GeometryBuilderFromDDD10EtaPart::build( const DDCompactView* cview,
const MuonDDDConstants& muonConstants )
{

std::string attribute = "MuStructure";
std::string value = "MuonEndCapME0";

Expand All @@ -40,10 +40,10 @@ ME0Geometry* ME0GeometryBuilderFromDDD10EtaPart::build(const DDCompactView* cvie
return this->buildGeometry(fview, muonConstants);
}


ME0Geometry* ME0GeometryBuilderFromDDD10EtaPart::buildGeometry(DDFilteredView& fv, const MuonDDDConstants& muonConstants)
ME0Geometry*
ME0GeometryBuilderFromDDD10EtaPart::buildGeometry( DDFilteredView& fv,
const MuonDDDConstants& muonConstants )
{

ME0Geometry* geometry = new ME0Geometry();

LogTrace("ME0GeometryBuilderFromDDD") <<"Building the geometry service";
Expand Down Expand Up @@ -71,7 +71,10 @@ ME0Geometry* ME0GeometryBuilderFromDDD10EtaPart::buildGeometry(DDFilteredView& f
LogTrace("ME0GeometryBuilderFromDDD")<<"back to layer "<<fv.parent(); // commented out in case only looping over sensitive volumes
LogTrace("ME0GeometryBuilderFromDDD")<<"back to chamb "<<fv.parent(); // commented out in case only looping over sensitive volumes
// ok lets get started ...
LogTrace("ME0GeometryBuilderFromDDD") << "In DoChambers Loop :: ME0DetId "<<detId<<" = "<<detId.rawId()<<" (which belongs to ME0Chamber "<<detIdCh<<" = "<<detIdCh.rawId()<<")";
LogTrace("ME0GeometryBuilderFromDDD") << "In DoChambers Loop :: ME0DetId "
<< detId << " = " << detId.rawId()
<< " (which belongs to ME0Chamber "
<< detIdCh << " = " << detIdCh.rawId() << ")";
LogTrace("ME0GeometryBuilderFromDDD") << "Second level logical part: " << fv.logicalPart().name().name();
DDBooleanSolid solid2 = (DDBooleanSolid)(fv.logicalPart().solid());
std::vector<double> dpar2 = solid2.parameters();
Expand All @@ -80,27 +83,7 @@ ME0Geometry* ME0GeometryBuilderFromDDD10EtaPart::buildGeometry(DDFilteredView& f
parameters2 << " dpar["<<i<<"]="<< dpar2[i]/10 << "cm ";
}
LogTrace("ME0GeometryBuilderFromDDD") << "Second level parameters: vector with size = "<<dpar2.size()<<" and elements "<<parameters2.str();
// from GEM
// DDBooleanSolid solid = (DDBooleanSolid)(fv.logicalPart().solid());
// std::vector<double> dpar = solid.solidA().parameters();
/*
if(solid2.solidA()) {
std::vector<double> dpar2a = solid2.solidA().parameters();
std::stringstream parameters2a;
for(unsigned int i=0; i<dpar2a.size(); ++i) {
parameters2a << " dpara["<<i<<"]="<< dpar2a[i]/10 << "cm ";
}
LogTrace("ME0GeometryBuilderFromDDD") << "Second level parameters: vector with size = "<<dpar2a.size()<<" and elements "<<parameters2.str();
}
if(solid2.solidB()) {
std::vector<double> dpar2b = solid2.solidB().parameters();
std::stringstream parameters2b;
for(unsigned int i=0; i<dpar2b.size(); ++i) {
parameters2b << " dparb["<<i<<"]="<< dpar2b[i]/10 << "cm ";
}
LogTrace("ME0GeometryBuilderFromDDD") << "Second level parameters: vector with size = "<<dpar2b.size()<<" and elements "<<parameters2.str();
}
*/

bool doLayers = fv.firstChild();
// --------------------------------------------------------------------------------------------------------------------------------------------
LogTrace("ME0GeometryBuilderFromDDD") << "doLayer = fv.firstChild() = " << doLayers;
Expand Down Expand Up @@ -288,9 +271,9 @@ ME0EtaPartition* ME0GeometryBuilderFromDDD10EtaPart::buildEtaPartition(DDFiltere
if (DDfetch( *is, numbOfPads)) nPads = numbOfPads.doubles()[0];
}
LogTrace("ME0GeometryBuilderFromDDD")
<< ((nStrips == 0. ) ? ("No nStrips found!!") : ("Number of strips: " + boost::lexical_cast<std::string>(nStrips)));
<< ((nStrips == 0. ) ? ("No nStrips found!!") : ("Number of strips: " + std::to_string(nStrips)));
LogTrace("ME0GeometryBuilderFromDDD")
<< ((nPads == 0. ) ? ("No nPads found!!") : ("Number of pads: " + boost::lexical_cast<std::string>(nPads)));
<< ((nPads == 0. ) ? ("No nPads found!!") : ("Number of pads: " + std::to_string(nPads)));

// EtaPartition specific parameter (size)
std::vector<double> dpar = fv.logicalPart().solid().parameters();
Expand Down

0 comments on commit c822563

Please sign in to comment.