diff --git a/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.cc b/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.cc index 854b4e8a3b119..4dcea2fdb13e9 100644 --- a/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.cc +++ b/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.cc @@ -35,11 +35,8 @@ #include "CondFormats/AlignmentRecord/interface/GlobalPositionRcd.h" #include "CondFormats/Alignment/interface/DetectorGlobalPosition.h" #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" +#include "DetectorDescription/DDCMS/interface/DDCompactView.h" -//#include "Alignment/OfflineValidation/interface/ComparisonUtilities.h" -//#include "Alignment/CommonAlignment/interface/AlignTools.h" - -//#include "Alignment/OfflineValidation/plugins/TrackerGeometryCompare.h" #include "TrackerGeometryCompare.h" #include "TFile.h" #include "CLHEP/Vector/ThreeVector.h" @@ -48,7 +45,6 @@ #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "CommonTools/UtilAlgos/interface/TFileService.h" -//#include "Geometry/Records/interface/PGeometricDetRcd.h" #include "DataFormats/TrackerCommon/interface/TrackerTopology.h" #include "Geometry/Records/interface/TrackerTopologyRcd.h" @@ -66,57 +62,58 @@ TrackerGeometryCompare::TrackerGeometryCompare(const edm::ParameterSet& cfg) theSurveyIndex(0), theSurveyValues(nullptr), theSurveyErrors(nullptr), - _levelStrings(cfg.getUntrackedParameter >("levels")), - _writeToDB(cfg.getUntrackedParameter("writeToDB")), - _commonTrackerLevel(align::invalid), - _moduleListFile(nullptr), - _moduleList(0), - _inputRootFile1(nullptr), - _inputRootFile2(nullptr), - _inputTree01(nullptr), - _inputTree02(nullptr), - _inputTree11(nullptr), - _inputTree12(nullptr), - m_nBins(10000), - m_rangeLow(-.1), - m_rangeHigh(.1), + levelStrings_(cfg.getUntrackedParameter >("levels")), + fromDD4hep_(cfg.getUntrackedParameter("fromDD4hep")), + writeToDB_(cfg.getUntrackedParameter("writeToDB")), + commonTrackerLevel_(align::invalid), + moduleListFile_(nullptr), + moduleList_(0), + inputRootFile1_(nullptr), + inputRootFile2_(nullptr), + inputTree01_(nullptr), + inputTree02_(nullptr), + inputTree11_(nullptr), + inputTree12_(nullptr), + m_nBins_(10000), + m_rangeLow_(-.1), + m_rangeHigh_(.1), firstEvent_(true), - m_vtkmap(13) { - _moduleListName = cfg.getUntrackedParameter("moduleList"); + m_vtkmap_(13) { + moduleListName_ = cfg.getUntrackedParameter("moduleList"); //input is ROOT - _inputFilename1 = cfg.getUntrackedParameter("inputROOTFile1"); - _inputFilename2 = cfg.getUntrackedParameter("inputROOTFile2"); - _inputTreenameAlign = cfg.getUntrackedParameter("treeNameAlign"); - _inputTreenameDeform = cfg.getUntrackedParameter("treeNameDeform"); + inputFilename1_ = cfg.getUntrackedParameter("inputROOTFile1"); + inputFilename2_ = cfg.getUntrackedParameter("inputROOTFile2"); + inputTreenameAlign_ = cfg.getUntrackedParameter("treeNameAlign"); + inputTreenameDeform_ = cfg.getUntrackedParameter("treeNameDeform"); //output file - _filename = cfg.getUntrackedParameter("outputFile"); + filename_ = cfg.getUntrackedParameter("outputFile"); - _weightBy = cfg.getUntrackedParameter("weightBy"); - _setCommonTrackerSystem = cfg.getUntrackedParameter("setCommonTrackerSystem"); - _detIdFlag = cfg.getUntrackedParameter("detIdFlag"); - _detIdFlagFile = cfg.getUntrackedParameter("detIdFlagFile"); - _weightById = cfg.getUntrackedParameter("weightById"); - _weightByIdFile = cfg.getUntrackedParameter("weightByIdFile"); + weightBy_ = cfg.getUntrackedParameter("weightBy"); + setCommonTrackerSystem_ = cfg.getUntrackedParameter("setCommonTrackerSystem"); + detIdFlag_ = cfg.getUntrackedParameter("detIdFlag"); + detIdFlagFile_ = cfg.getUntrackedParameter("detIdFlagFile"); + weightById_ = cfg.getUntrackedParameter("weightById"); + weightByIdFile_ = cfg.getUntrackedParameter("weightByIdFile"); // if want to use, make id cut list - if (_detIdFlag) { + if (detIdFlag_) { std::ifstream fin; - fin.open(_detIdFlagFile.c_str()); + fin.open(detIdFlagFile_.c_str()); while (!fin.eof() && fin.good()) { uint32_t id; fin >> id; - _detIdFlagVector.push_back(id); + detIdFlagVector_.push_back(id); } fin.close(); } // turn weightByIdFile into weightByIdVector - if (_weightById) { + if (weightById_) { std::ifstream inFile; - inFile.open(_weightByIdFile.c_str()); + inFile.open(weightByIdFile_.c_str()); int ctr = 0; while (!inFile.eof()) { ctr++; @@ -124,55 +121,55 @@ TrackerGeometryCompare::TrackerGeometryCompare(const edm::ParameterSet& cfg) inFile >> listId; inFile.ignore(256, '\n'); - _weightByIdVector.push_back(listId); + weightByIdVector_.push_back(listId); } inFile.close(); } //root configuration - _theFile = new TFile(_filename.c_str(), "RECREATE"); - _alignTree = new TTree("alignTree", + theFile_ = new TFile(filename_.c_str(), "RECREATE"); + alignTree_ = new TTree("alignTree", "alignTree"); //,"id:level:mid:mlevel:sublevel:x:y:z:r:phi:a:b:c:dx:dy:dz:dr:dphi:da:db:dc"); - _alignTree->Branch("id", &_id, "id/I"); - _alignTree->Branch("badModuleQuality", &_badModuleQuality, "badModuleQuality/I"); - _alignTree->Branch("inModuleList", &_inModuleList, "inModuleList/I"); - _alignTree->Branch("level", &_level, "level/I"); - _alignTree->Branch("mid", &_mid, "mid/I"); - _alignTree->Branch("mlevel", &_mlevel, "mlevel/I"); - _alignTree->Branch("sublevel", &_sublevel, "sublevel/I"); - _alignTree->Branch("x", &_xVal, "x/F"); - _alignTree->Branch("y", &_yVal, "y/F"); - _alignTree->Branch("z", &_zVal, "z/F"); - _alignTree->Branch("r", &_rVal, "r/F"); - _alignTree->Branch("phi", &_phiVal, "phi/F"); - _alignTree->Branch("eta", &_etaVal, "eta/F"); - _alignTree->Branch("alpha", &_alphaVal, "alpha/F"); - _alignTree->Branch("beta", &_betaVal, "beta/F"); - _alignTree->Branch("gamma", &_gammaVal, "gamma/F"); - _alignTree->Branch("dx", &_dxVal, "dx/F"); - _alignTree->Branch("dy", &_dyVal, "dy/F"); - _alignTree->Branch("dz", &_dzVal, "dz/F"); - _alignTree->Branch("dr", &_drVal, "dr/F"); - _alignTree->Branch("dphi", &_dphiVal, "dphi/F"); - _alignTree->Branch("dalpha", &_dalphaVal, "dalpha/F"); - _alignTree->Branch("dbeta", &_dbetaVal, "dbeta/F"); - _alignTree->Branch("dgamma", &_dgammaVal, "dgamma/F"); - _alignTree->Branch("du", &_duVal, "du/F"); - _alignTree->Branch("dv", &_dvVal, "dv/F"); - _alignTree->Branch("dw", &_dwVal, "dw/F"); - _alignTree->Branch("da", &_daVal, "da/F"); - _alignTree->Branch("db", &_dbVal, "db/F"); - _alignTree->Branch("dg", &_dgVal, "dg/F"); - _alignTree->Branch("useDetId", &_useDetId, "useDetId/I"); - _alignTree->Branch("detDim", &_detDim, "detDim/I"); - _alignTree->Branch("surW", &_surWidth, "surW/F"); - _alignTree->Branch("surL", &_surLength, "surL/F"); - _alignTree->Branch("surRot", &_surRot, "surRot[9]/D"); - _alignTree->Branch("identifiers", &_identifiers, "identifiers[6]/I"); - _alignTree->Branch("type", &_type, "type/I"); - _alignTree->Branch("surfDeform", &_surfDeform, "surfDeform[13]/D"); - - for (std::vector::iterator it = m_vtkmap.begin(); it != m_vtkmap.end(); ++it) { + alignTree_->Branch("id", &id_, "id/I"); + alignTree_->Branch("badModuleQuality", &badModuleQuality_, "badModuleQuality/I"); + alignTree_->Branch("inModuleList", &inModuleList_, "inModuleList/I"); + alignTree_->Branch("level", &level_, "level/I"); + alignTree_->Branch("mid", &mid_, "mid/I"); + alignTree_->Branch("mlevel", &mlevel_, "mlevel/I"); + alignTree_->Branch("sublevel", &sublevel_, "sublevel/I"); + alignTree_->Branch("x", &xVal_, "x/F"); + alignTree_->Branch("y", &yVal_, "y/F"); + alignTree_->Branch("z", &zVal_, "z/F"); + alignTree_->Branch("r", &rVal_, "r/F"); + alignTree_->Branch("phi", &phiVal_, "phi/F"); + alignTree_->Branch("eta", &etaVal_, "eta/F"); + alignTree_->Branch("alpha", &alphaVal_, "alpha/F"); + alignTree_->Branch("beta", &betaVal_, "beta/F"); + alignTree_->Branch("gamma", &gammaVal_, "gamma/F"); + alignTree_->Branch("dx", &dxVal_, "dx/F"); + alignTree_->Branch("dy", &dyVal_, "dy/F"); + alignTree_->Branch("dz", &dzVal_, "dz/F"); + alignTree_->Branch("dr", &drVal_, "dr/F"); + alignTree_->Branch("dphi", &dphiVal_, "dphi/F"); + alignTree_->Branch("dalpha", &dalphaVal_, "dalpha/F"); + alignTree_->Branch("dbeta", &dbetaVal_, "dbeta/F"); + alignTree_->Branch("dgamma", &dgammaVal_, "dgamma/F"); + alignTree_->Branch("du", &duVal_, "du/F"); + alignTree_->Branch("dv", &dvVal_, "dv/F"); + alignTree_->Branch("dw", &dwVal_, "dw/F"); + alignTree_->Branch("da", &daVal_, "da/F"); + alignTree_->Branch("db", &dbVal_, "db/F"); + alignTree_->Branch("dg", &dgVal_, "dg/F"); + alignTree_->Branch("useDetId", &useDetId_, "useDetId/I"); + alignTree_->Branch("detDim", &detDim_, "detDim/I"); + alignTree_->Branch("surW", &surWidth_, "surW/F"); + alignTree_->Branch("surL", &surLength_, "surL/F"); + alignTree_->Branch("surRot", &surRot_, "surRot[9]/D"); + alignTree_->Branch("identifiers", &identifiers_, "identifiers[6]/I"); + alignTree_->Branch("type", &type_, "type/I"); + alignTree_->Branch("surfDeform", &surfDeform_, "surfDeform[13]/D"); + + for (std::vector::iterator it = m_vtkmap_.begin(); it != m_vtkmap_.end(); ++it) { it->setPalette(1); it->addPixel(true); } @@ -184,18 +181,18 @@ TrackerGeometryCompare::TrackerGeometryCompare(const edm::ParameterSet& cfg) for (int ii = 0; ii < 13; ++ii) { std::stringstream histname0; histname0 << "SurfDeform_Par_" << ii; - m_h1[histname0.str()] = - subDir_All.make((histname0.str()).c_str(), (histname0.str()).c_str(), m_nBins, m_rangeLow, m_rangeHigh); + m_h1_[histname0.str()] = subDir_All.make( + (histname0.str()).c_str(), (histname0.str()).c_str(), m_nBins_, m_rangeLow_, m_rangeHigh_); std::stringstream histname1; histname1 << "SurfDeform_PixelBarrel_Par_" << ii; - m_h1[histname1.str()] = - subDir_PXB.make((histname1.str()).c_str(), (histname1.str()).c_str(), m_nBins, m_rangeLow, m_rangeHigh); + m_h1_[histname1.str()] = subDir_PXB.make( + (histname1.str()).c_str(), (histname1.str()).c_str(), m_nBins_, m_rangeLow_, m_rangeHigh_); std::stringstream histname2; histname2 << "SurfDeform_PixelEndcap_Par_" << ii; - m_h1[histname2.str()] = - subDir_PXF.make((histname2.str()).c_str(), (histname2.str()).c_str(), m_nBins, m_rangeLow, m_rangeHigh); + m_h1_[histname2.str()] = subDir_PXF.make( + (histname2.str()).c_str(), (histname2.str()).c_str(), m_nBins_, m_rangeLow_, m_rangeHigh_); } } @@ -203,7 +200,7 @@ void TrackerGeometryCompare::beginJob() { firstEvent_ = true; } void TrackerGeometryCompare::endJob() { int iname(0); - for (std::vector::iterator it = m_vtkmap.begin(); it != m_vtkmap.end(); ++it) { + for (std::vector::iterator it = m_vtkmap_.begin(); it != m_vtkmap_.end(); ++it) { std::stringstream mapname; mapname << "TkMap_SurfDeform" << iname << ".png"; it->save(true, 0, 0, mapname.str()); @@ -214,9 +211,9 @@ void TrackerGeometryCompare::endJob() { ++iname; } - _theFile->cd(); - _alignTree->Write(); - _theFile->Close(); + theFile_->cd(); + alignTree_->Write(); + theFile_->Close(); } void TrackerGeometryCompare::analyze(const edm::Event&, const edm::EventSetup& iSetup) { @@ -230,8 +227,8 @@ void TrackerGeometryCompare::analyze(const edm::Event&, const edm::EventSetup& i createROOTGeometry(iSetup); //setting the levels being used in the geometry comparator - edm::LogInfo("TrackerGeometryCompare") << "levels: " << _levelStrings.size(); - for (const auto& level : _levelStrings) { + edm::LogInfo("TrackerGeometryCompare") << "levels: " << levelStrings_.size(); + for (const auto& level : levelStrings_) { m_theLevels.push_back(currentTracker->objectIdProvider().stringToId(level)); edm::LogInfo("TrackerGeometryCompare") << "level: " << level; edm::LogInfo("TrackerGeometryCompare") @@ -240,18 +237,18 @@ void TrackerGeometryCompare::analyze(const edm::Event&, const edm::EventSetup& i //set common tracker system first // if setting the tracker common system - if (_setCommonTrackerSystem != "NONE") { + if (setCommonTrackerSystem_ != "NONE") { setCommonTrackerSystem(); } //compare the goemetries compareGeometries(referenceTracker, currentTracker, tTopo, iSetup); - compareSurfaceDeformations(_inputTree11, _inputTree12); + compareSurfaceDeformations(inputTree11_, inputTree12_); //write out ntuple //might be better to do within output module - if (_writeToDB) { + if (writeToDB_) { Alignments* myAlignments = currentTracker->alignments(); AlignmentErrorsExtended* myAlignmentErrorsExtended = currentTracker->alignmentErrors(); @@ -281,12 +278,12 @@ void TrackerGeometryCompare::createROOTGeometry(const edm::EventSetup& iSetup) { const TrackerTopology* const tTopo = tTopoHandle.product(); // Fill module IDs from file into a list - _moduleListFile.open(_moduleListName); - if (_moduleListFile.is_open()) { + moduleListFile_.open(moduleListName_); + if (moduleListFile_.is_open()) { std::string line; - while (!_moduleListFile.eof()) { - std::getline(_moduleListFile, line); - _moduleList.push_back(std::atoi(line.c_str())); + while (!moduleListFile_.eof()) { + std::getline(moduleListFile_, line); + moduleList_.push_back(std::atoi(line.c_str())); } } else { edm::LogInfo("TrackerGeometryCompare") << "Error: Module list not found! Please verify that given list exists!"; @@ -295,21 +292,21 @@ void TrackerGeometryCompare::createROOTGeometry(const edm::EventSetup& iSetup) { //declare alignments Alignments* alignments1 = new Alignments(); AlignmentErrorsExtended* alignmentErrors1 = new AlignmentErrorsExtended(); - if (_inputFilename1 != "IDEAL") { - _inputRootFile1 = new TFile(_inputFilename1.c_str()); - TTree* _inputTree01 = (TTree*)_inputRootFile1->Get(_inputTreenameAlign.c_str()); - _inputTree01->SetBranchAddress("rawid", &inputRawId1); - _inputTree01->SetBranchAddress("x", &inputX1); - _inputTree01->SetBranchAddress("y", &inputY1); - _inputTree01->SetBranchAddress("z", &inputZ1); - _inputTree01->SetBranchAddress("alpha", &inputAlpha1); - _inputTree01->SetBranchAddress("beta", &inputBeta1); - _inputTree01->SetBranchAddress("gamma", &inputGamma1); - - int nEntries1 = _inputTree01->GetEntries(); + if (inputFilename1_ != "IDEAL") { + inputRootFile1_ = new TFile(inputFilename1_.c_str()); + TTree* inputTree01_ = (TTree*)inputRootFile1_->Get(inputTreenameAlign_.c_str()); + inputTree01_->SetBranchAddress("rawid", &inputRawId1); + inputTree01_->SetBranchAddress("x", &inputX1); + inputTree01_->SetBranchAddress("y", &inputY1); + inputTree01_->SetBranchAddress("z", &inputZ1); + inputTree01_->SetBranchAddress("alpha", &inputAlpha1); + inputTree01_->SetBranchAddress("beta", &inputBeta1); + inputTree01_->SetBranchAddress("gamma", &inputGamma1); + + int nEntries1 = inputTree01_->GetEntries(); //fill alignments for (int i = 0; i < nEntries1; ++i) { - _inputTree01->GetEntry(i); + inputTree01_->GetEntry(i); CLHEP::Hep3Vector translation1(inputX1, inputY1, inputZ1); CLHEP::HepEulerAngles eulerangles1(inputAlpha1, inputBeta1, inputGamma1); uint32_t detid1 = inputRawId1; @@ -329,21 +326,21 @@ void TrackerGeometryCompare::createROOTGeometry(const edm::EventSetup& iSetup) { //------------------ Alignments* alignments2 = new Alignments(); AlignmentErrorsExtended* alignmentErrors2 = new AlignmentErrorsExtended(); - if (_inputFilename2 != "IDEAL") { - _inputRootFile2 = new TFile(_inputFilename2.c_str()); - TTree* _inputTree02 = (TTree*)_inputRootFile2->Get(_inputTreenameAlign.c_str()); - _inputTree02->SetBranchAddress("rawid", &inputRawId2); - _inputTree02->SetBranchAddress("x", &inputX2); - _inputTree02->SetBranchAddress("y", &inputY2); - _inputTree02->SetBranchAddress("z", &inputZ2); - _inputTree02->SetBranchAddress("alpha", &inputAlpha2); - _inputTree02->SetBranchAddress("beta", &inputBeta2); - _inputTree02->SetBranchAddress("gamma", &inputGamma2); - - int nEntries2 = _inputTree02->GetEntries(); + if (inputFilename2_ != "IDEAL") { + inputRootFile2_ = new TFile(inputFilename2_.c_str()); + TTree* inputTree02_ = (TTree*)inputRootFile2_->Get(inputTreenameAlign_.c_str()); + inputTree02_->SetBranchAddress("rawid", &inputRawId2); + inputTree02_->SetBranchAddress("x", &inputX2); + inputTree02_->SetBranchAddress("y", &inputY2); + inputTree02_->SetBranchAddress("z", &inputZ2); + inputTree02_->SetBranchAddress("alpha", &inputAlpha2); + inputTree02_->SetBranchAddress("beta", &inputBeta2); + inputTree02_->SetBranchAddress("gamma", &inputGamma2); + + int nEntries2 = inputTree02_->GetEntries(); //fill alignments for (int i = 0; i < nEntries2; ++i) { - _inputTree02->GetEntry(i); + inputTree02_->GetEntry(i); CLHEP::Hep3Vector translation2(inputX2, inputY2, inputZ2); CLHEP::HepEulerAngles eulerangles2(inputAlpha2, inputBeta2, inputGamma2); uint32_t detid2 = inputRawId2; @@ -362,8 +359,13 @@ void TrackerGeometryCompare::createROOTGeometry(const edm::EventSetup& iSetup) { } //accessing the initial geometry - edm::ESTransientHandle cpv; - iSetup.get().get(cpv); + if (!fromDD4hep_) { + edm::ESTransientHandle cpv; + iSetup.get().get(cpv); + } else { + edm::ESTransientHandle cpv; + iSetup.get().get(cpv); + } edm::ESHandle theGeometricDet; iSetup.get().get(theGeometricDet); edm::ESHandle ptp; @@ -372,7 +374,7 @@ void TrackerGeometryCompare::createROOTGeometry(const edm::EventSetup& iSetup) { //reference tracker TrackerGeometry* theRefTracker = trackerBuilder.build(&*theGeometricDet, *ptp, tTopo); - if (_inputFilename1 != "IDEAL") { + if (inputFilename1_ != "IDEAL") { GeometryAligner aligner1; aligner1.applyAlignments( &(*theRefTracker), &(*alignments1), &(*alignmentErrors1), AlignTransform()); @@ -391,16 +393,16 @@ void TrackerGeometryCompare::createROOTGeometry(const edm::EventSetup& iSetup) { const auto& comp1 = referenceTracker->deepComponents(); SurfaceDeformation* surfDef1; - if (_inputFilename1 != "IDEAL") { - TTree* _inputTree11 = (TTree*)_inputRootFile1->Get(_inputTreenameDeform.c_str()); - _inputTree11->SetBranchAddress("irawid", &inputRawid1); - _inputTree11->SetBranchAddress("dtype", &inputDtype1); - _inputTree11->SetBranchAddress("dpar", &p_inputDpar1); + if (inputFilename1_ != "IDEAL") { + TTree* inputTree11_ = (TTree*)inputRootFile1_->Get(inputTreenameDeform_.c_str()); + inputTree11_->SetBranchAddress("irawid", &inputRawid1); + inputTree11_->SetBranchAddress("dtype", &inputDtype1); + inputTree11_->SetBranchAddress("dpar", &p_inputDpar1); - unsigned int nEntries11 = _inputTree11->GetEntries(); + unsigned int nEntries11 = inputTree11_->GetEntries(); edm::LogInfo("TrackerGeometryCompare") << " nentries11 = " << nEntries11; for (unsigned int iEntry = 0; iEntry < nEntries11; ++iEntry) { - _inputTree11->GetEntry(iEntry); + inputTree11_->GetEntry(iEntry); surfDef1 = SurfaceDeformationFactory::create(inputDtype1, inputDpar1); @@ -412,7 +414,7 @@ void TrackerGeometryCompare::createROOTGeometry(const edm::EventSetup& iSetup) { //currernt tracker TrackerGeometry* theCurTracker = trackerBuilder.build(&*theGeometricDet, *ptp, tTopo); - if (_inputFilename2 != "IDEAL") { + if (inputFilename2_ != "IDEAL") { GeometryAligner aligner2; aligner2.applyAlignments( &(*theCurTracker), &(*alignments2), &(*alignmentErrors2), AlignTransform()); @@ -422,16 +424,16 @@ void TrackerGeometryCompare::createROOTGeometry(const edm::EventSetup& iSetup) { const auto& comp2 = currentTracker->deepComponents(); SurfaceDeformation* surfDef2; - if (_inputFilename2 != "IDEAL") { - TTree* _inputTree12 = (TTree*)_inputRootFile2->Get(_inputTreenameDeform.c_str()); - _inputTree12->SetBranchAddress("irawid", &inputRawid2); - _inputTree12->SetBranchAddress("dtype", &inputDtype2); - _inputTree12->SetBranchAddress("dpar", &p_inputDpar2); + if (inputFilename2_ != "IDEAL") { + TTree* inputTree12_ = (TTree*)inputRootFile2_->Get(inputTreenameDeform_.c_str()); + inputTree12_->SetBranchAddress("irawid", &inputRawid2); + inputTree12_->SetBranchAddress("dtype", &inputDtype2); + inputTree12_->SetBranchAddress("dpar", &p_inputDpar2); - unsigned int nEntries12 = _inputTree12->GetEntries(); + unsigned int nEntries12 = inputTree12_->GetEntries(); edm::LogInfo("TrackerGeometryCompare") << " nentries12 = " << nEntries12; for (unsigned int iEntry = 0; iEntry < nEntries12; ++iEntry) { - _inputTree12->GetEntry(iEntry); + inputTree12_->GetEntry(iEntry); surfDef2 = SurfaceDeformationFactory::create(inputDtype2, inputDpar2); @@ -448,7 +450,7 @@ void TrackerGeometryCompare::createROOTGeometry(const edm::EventSetup& iSetup) { } void TrackerGeometryCompare::compareSurfaceDeformations(TTree* refTree, TTree* curTree) { - if (_inputFilename1 != "IDEAL" && _inputFilename2 != "IDEAL") { + if (inputFilename1_ != "IDEAL" && inputFilename2_ != "IDEAL") { int inputRawid1; int inputRawid2; int inputSubdetid1, inputSubdetid2; @@ -458,13 +460,13 @@ void TrackerGeometryCompare::compareSurfaceDeformations(TTree* refTree, TTree* c std::vector* p_inputDpar1 = &inputDpar1; std::vector* p_inputDpar2 = &inputDpar2; - TTree* refTree = (TTree*)_inputRootFile1->Get(_inputTreenameDeform.c_str()); + TTree* refTree = (TTree*)inputRootFile1_->Get(inputTreenameDeform_.c_str()); refTree->SetBranchAddress("irawid", &inputRawid1); refTree->SetBranchAddress("subdetid", &inputSubdetid1); refTree->SetBranchAddress("dtype", &inputDtype1); refTree->SetBranchAddress("dpar", &p_inputDpar1); - TTree* curTree = (TTree*)_inputRootFile2->Get(_inputTreenameDeform.c_str()); + TTree* curTree = (TTree*)inputRootFile2_->Get(inputTreenameDeform_.c_str()); curTree->SetBranchAddress("irawid", &inputRawid2); curTree->SetBranchAddress("subdetid", &inputSubdetid2); curTree->SetBranchAddress("dtype", &inputDtype2); @@ -482,40 +484,40 @@ void TrackerGeometryCompare::compareSurfaceDeformations(TTree* refTree, TTree* c refTree->GetEntry(iEntry); curTree->GetEntry(iEntry); for (int ii = 0; ii < 13; ++ii) { - _surfDeform[ii] = -1.0; + surfDeform_[ii] = -1.0; } for (int npar = 0; npar < int(inputDpar2.size()); ++npar) { if (inputRawid1 == inputRawid2) { - _surfDeform[npar] = inputDpar2.at(npar) - inputDpar1.at(npar); + surfDeform_[npar] = inputDpar2.at(npar) - inputDpar1.at(npar); std::stringstream histname0; histname0 << "SurfDeform_Par_" << npar; - if (TMath::Abs(_surfDeform[npar]) > (m_rangeHigh - m_rangeLow) / (10. * m_nBins)) - m_h1[histname0.str()]->Fill(_surfDeform[npar]); + if (TMath::Abs(surfDeform_[npar]) > (m_rangeHigh_ - m_rangeLow_) / (10. * m_nBins_)) + m_h1_[histname0.str()]->Fill(surfDeform_[npar]); if (inputSubdetid1 == 1 && inputSubdetid2 == 1) { std::stringstream histname1; histname1 << "SurfDeform_PixelBarrel_Par_" << npar; - if (TMath::Abs(_surfDeform[npar]) > (m_rangeHigh - m_rangeLow) / (10. * m_nBins)) - m_h1[histname1.str()]->Fill(_surfDeform[npar]); + if (TMath::Abs(surfDeform_[npar]) > (m_rangeHigh_ - m_rangeLow_) / (10. * m_nBins_)) + m_h1_[histname1.str()]->Fill(surfDeform_[npar]); } if (inputSubdetid1 == 2 && inputSubdetid2 == 2) { std::stringstream histname2; histname2 << "SurfDeform_PixelEndcap_Par_" << npar; - if (TMath::Abs(_surfDeform[npar]) > (m_rangeHigh - m_rangeLow) / (10. * m_nBins)) - m_h1[histname2.str()]->Fill(_surfDeform[npar]); + if (TMath::Abs(surfDeform_[npar]) > (m_rangeHigh_ - m_rangeLow_) / (10. * m_nBins_)) + m_h1_[histname2.str()]->Fill(surfDeform_[npar]); } - (m_vtkmap.at(npar)).fill_current_val(inputRawid1, _surfDeform[npar]); + (m_vtkmap_.at(npar)).fill_current_val(inputRawid1, surfDeform_[npar]); } } } - } else if (_inputFilename1 == "IDEAL" && _inputFilename2 != "IDEAL") { + } else if (inputFilename1_ == "IDEAL" && inputFilename2_ != "IDEAL") { int inputRawid2; int inputSubdetid2; int inputDtype2; std::vector inputDpar2; std::vector* p_inputDpar2 = &inputDpar2; - TTree* curTree = (TTree*)_inputRootFile2->Get(_inputTreenameDeform.c_str()); + TTree* curTree = (TTree*)inputRootFile2_->Get(inputTreenameDeform_.c_str()); curTree->SetBranchAddress("irawid", &inputRawid2); curTree->SetBranchAddress("subdetid", &inputSubdetid2); curTree->SetBranchAddress("dtype", &inputDtype2); @@ -526,38 +528,38 @@ void TrackerGeometryCompare::compareSurfaceDeformations(TTree* refTree, TTree* c for (unsigned int iEntry = 0; iEntry < nEntries12; ++iEntry) { curTree->GetEntry(iEntry); for (int ii = 0; ii < 12; ++ii) { - _surfDeform[ii] = -1.0; + surfDeform_[ii] = -1.0; } for (int npar = 0; npar < int(inputDpar2.size()); ++npar) { - _surfDeform[npar] = inputDpar2.at(npar); + surfDeform_[npar] = inputDpar2.at(npar); std::stringstream histname0; histname0 << "SurfDeform_Par_" << npar; - if (TMath::Abs(_surfDeform[npar]) > (m_rangeHigh - m_rangeLow) / (10. * m_nBins)) - m_h1[histname0.str()]->Fill(_surfDeform[npar]); + if (TMath::Abs(surfDeform_[npar]) > (m_rangeHigh_ - m_rangeLow_) / (10. * m_nBins_)) + m_h1_[histname0.str()]->Fill(surfDeform_[npar]); if (inputSubdetid2 == 1) { std::stringstream histname1; histname1 << "SurfDeform_PixelBarrel_Par_" << npar; - if (TMath::Abs(_surfDeform[npar]) > (m_rangeHigh - m_rangeLow) / (10. * m_nBins)) - m_h1[histname1.str()]->Fill(_surfDeform[npar]); + if (TMath::Abs(surfDeform_[npar]) > (m_rangeHigh_ - m_rangeLow_) / (10. * m_nBins_)) + m_h1_[histname1.str()]->Fill(surfDeform_[npar]); } if (inputSubdetid2 == 2) { std::stringstream histname2; histname2 << "SurfDeform_PixelEndcap_Par_" << npar; - if (TMath::Abs(_surfDeform[npar]) > (m_rangeHigh - m_rangeLow) / (10. * m_nBins)) - m_h1[histname2.str()]->Fill(_surfDeform[npar]); + if (TMath::Abs(surfDeform_[npar]) > (m_rangeHigh_ - m_rangeLow_) / (10. * m_nBins_)) + m_h1_[histname2.str()]->Fill(surfDeform_[npar]); } - (m_vtkmap.at(npar)).fill_current_val(inputRawid2, _surfDeform[npar]); + (m_vtkmap_.at(npar)).fill_current_val(inputRawid2, surfDeform_[npar]); } } - } else if (_inputFilename1 != "IDEAL" && _inputFilename2 == "IDEAL") { + } else if (inputFilename1_ != "IDEAL" && inputFilename2_ == "IDEAL") { int inputRawid1; int inputSubdetid1; int inputDtype1; std::vector inputDpar1; std::vector* p_inputDpar1 = &inputDpar1; - TTree* refTree = (TTree*)_inputRootFile1->Get(_inputTreenameDeform.c_str()); + TTree* refTree = (TTree*)inputRootFile1_->Get(inputTreenameDeform_.c_str()); refTree->SetBranchAddress("irawid", &inputRawid1); refTree->SetBranchAddress("subdetid", &inputSubdetid1); refTree->SetBranchAddress("dtype", &inputDtype1); @@ -568,31 +570,31 @@ void TrackerGeometryCompare::compareSurfaceDeformations(TTree* refTree, TTree* c for (unsigned int iEntry = 0; iEntry < nEntries11; ++iEntry) { refTree->GetEntry(iEntry); for (int ii = 0; ii < 12; ++ii) { - _surfDeform[ii] = -1.0; + surfDeform_[ii] = -1.0; } for (int npar = 0; npar < int(inputDpar1.size()); ++npar) { - _surfDeform[npar] = -inputDpar1.at(npar); + surfDeform_[npar] = -inputDpar1.at(npar); std::stringstream histname0; histname0 << "SurfDeform_Par_" << npar; - if (TMath::Abs(_surfDeform[npar]) > (m_rangeHigh - m_rangeLow) / (10. * m_nBins)) - m_h1[histname0.str()]->Fill(_surfDeform[npar]); + if (TMath::Abs(surfDeform_[npar]) > (m_rangeHigh_ - m_rangeLow_) / (10. * m_nBins_)) + m_h1_[histname0.str()]->Fill(surfDeform_[npar]); if (inputSubdetid1 == 1) { std::stringstream histname1; histname1 << "SurfDeform_PixelBarrel_Par_" << npar; - if (TMath::Abs(_surfDeform[npar]) > (m_rangeHigh - m_rangeLow) / (10. * m_nBins)) - m_h1[histname1.str()]->Fill(_surfDeform[npar]); + if (TMath::Abs(surfDeform_[npar]) > (m_rangeHigh_ - m_rangeLow_) / (10. * m_nBins_)) + m_h1_[histname1.str()]->Fill(surfDeform_[npar]); } if (inputSubdetid1 == 2) { std::stringstream histname2; histname2 << "SurfDeform_PixelEndcap_Par_" << npar; - if (TMath::Abs(_surfDeform[npar]) > (m_rangeHigh - m_rangeLow) / (10. * m_nBins)) - m_h1[histname2.str()]->Fill(_surfDeform[npar]); + if (TMath::Abs(surfDeform_[npar]) > (m_rangeHigh_ - m_rangeLow_) / (10. * m_nBins_)) + m_h1_[histname2.str()]->Fill(surfDeform_[npar]); } - (m_vtkmap.at(npar)).fill_current_val(inputRawid1, _surfDeform[npar]); + (m_vtkmap_.at(npar)).fill_current_val(inputRawid1, surfDeform_[npar]); } } - } else if (_inputFilename1 == "IDEAL" && _inputFilename2 == "IDEAL") { + } else if (inputFilename1_ == "IDEAL" && inputFilename2_ == "IDEAL") { edm::LogInfo("TrackerGeometryCompare") << ">>>> Comparing IDEAL with IDEAL: nothing to do! <<<<\n"; } @@ -636,7 +638,7 @@ void TrackerGeometryCompare::compareGeometries(Alignable* refAli, for (int i = 0; i < 100; i++) { // Get differences between alignments for rotations and translations // both local and global - diff = align::diffAlignables(refAli, curAli, _weightBy, _weightById, _weightByIdVector); + diff = align::diffAlignables(refAli, curAli, weightBy_, weightById_, weightByIdVector_); // 'diffAlignables' returns 'refAli - curAli' for translations and 'curAli - refAli' for rotations. // The plan is to unify this at some point, but a simple change of the sign for one of them was postponed @@ -669,7 +671,7 @@ void TrackerGeometryCompare::compareGeometries(Alignable* refAli, // if true, break the loop align::moveAlignable(curAli, diff); float tolerance = 1e-7; - check = align::diffAlignables(refAli, curAli, _weightBy, _weightById, _weightByIdVector); + check = align::diffAlignables(refAli, curAli, weightBy_, weightById_, weightByIdVector_); align::GlobalVector checkR(check[0], check[1], check[2]); align::GlobalVector checkW(check[3], check[4], check[5]); if ((checkR.mag() < tolerance) && (checkW.mag() < tolerance)) { @@ -716,25 +718,25 @@ void TrackerGeometryCompare::setCommonTrackerSystem() { // DM_534??AlignableObjectId dummy; // DM_534??_commonTrackerLevel = dummy.nameToType(_setCommonTrackerSystem); - _commonTrackerLevel = currentTracker->objectIdProvider().stringToId(_setCommonTrackerSystem); + commonTrackerLevel_ = currentTracker->objectIdProvider().stringToId(setCommonTrackerSystem_); diffCommonTrackerSystem(referenceTracker, currentTracker); align::EulerAngles dOmega(3); - dOmega[0] = _TrackerCommonR.x(); - dOmega[1] = _TrackerCommonR.y(); - dOmega[2] = _TrackerCommonR.z(); + dOmega[0] = TrackerCommonR_.x(); + dOmega[1] = TrackerCommonR_.y(); + dOmega[2] = TrackerCommonR_.z(); align::RotationType rot = align::toMatrix(dOmega); - align::GlobalVector theR = _TrackerCommonT; + align::GlobalVector theR = TrackerCommonT_; edm::LogInfo("TrackerGeometryCompare") << "what we get from overlaying the pixels..." << theR << ", " << rot; //transform to the Tracker System align::PositionType trackerCM = currentTracker->globalPosition(); align::GlobalVector cmDiff( - trackerCM.x() - _TrackerCommonCM.x(), trackerCM.y() - _TrackerCommonCM.y(), trackerCM.z() - _TrackerCommonCM.z()); + trackerCM.x() - TrackerCommonCM_.x(), trackerCM.y() - TrackerCommonCM_.y(), trackerCM.z() - TrackerCommonCM_.z()); - edm::LogInfo("TrackerGeometryCompare") << "Pixel CM: " << _TrackerCommonCM << ", tracker CM: " << trackerCM; + edm::LogInfo("TrackerGeometryCompare") << "Pixel CM: " << TrackerCommonCM_ << ", tracker CM: " << trackerCM; //adjust translational difference factoring in different rotational CM //needed because rotateInGlobalFrame is about CM of alignable, not Tracker @@ -746,9 +748,9 @@ void TrackerGeometryCompare::setCommonTrackerSystem() { TrackerCommonTR(1) = theRprime.x(); TrackerCommonTR(2) = theRprime.y(); TrackerCommonTR(3) = theRprime.z(); - TrackerCommonTR(4) = _TrackerCommonR.x(); - TrackerCommonTR(5) = _TrackerCommonR.y(); - TrackerCommonTR(6) = _TrackerCommonR.z(); + TrackerCommonTR(4) = TrackerCommonR_.x(); + TrackerCommonTR(5) = TrackerCommonR_.y(); + TrackerCommonTR(6) = TrackerCommonR_.z(); edm::LogInfo("TrackerGeometryCompare") << "and after the transformation: " << TrackerCommonTR; @@ -762,7 +764,7 @@ void TrackerGeometryCompare::diffCommonTrackerSystem(Alignable* refAli, Alignabl unsigned int nComp = refComp.size(); //only perform for designate levels bool useLevel = false; - if (refAli->alignableObjectId() == _commonTrackerLevel) + if (refAli->alignableObjectId() == commonTrackerLevel_) useLevel = true; //useLevel = false; @@ -771,7 +773,7 @@ void TrackerGeometryCompare::diffCommonTrackerSystem(Alignable* refAli, Alignabl Rtotal.set(0., 0., 0.); Wtotal.set(0., 0., 0.); - AlgebraicVector diff = align::diffAlignables(refAli, curAli, _weightBy, _weightById, _weightByIdVector); + AlgebraicVector diff = align::diffAlignables(refAli, curAli, weightBy_, weightById_, weightByIdVector_); CLHEP::Hep3Vector dR(diff[0], diff[1], diff[2]); Rtotal += dR; CLHEP::Hep3Vector dW(diff[3], diff[4], diff[5]); @@ -779,32 +781,10 @@ void TrackerGeometryCompare::diffCommonTrackerSystem(Alignable* refAli, Alignabl CLHEP::HepRotation drot(dW.unit(), dW.mag()); rot *= drot; Wtotal.set(rot.axis().x() * rot.delta(), rot.axis().y() * rot.delta(), rot.axis().z() * rot.delta()); - /* - //std::cout << "a"; - //if (refAli->alignableObjectId() == 1) std::cout << "DIFF: " << diff << std::endl; - align::moveAlignable(curAli, diff); - float tolerance = 1e-7; - AlgebraicVector check = align::diffAlignables(refAli,curAli, _weightBy, _weightById, _weightByIdVector); - align::GlobalVector checkR(check[0],check[1],check[2]); - align::GlobalVector checkW(check[3],check[4],check[5]); - DetId detid(refAli->id()); - if ((checkR.mag() > tolerance)||(checkW.mag() > tolerance)){ - edm::LogInfo("TrackerGeometryCompare") << "Tolerance Exceeded!(alObjId: " << refAli->alignableObjectId() - << ", rawId: " << refAli->geomDetId().rawId() - << ", subdetId: "<< detid.subdetId() << "): " << diff; - } - else{ - break; - } - } - */ - - //_TrackerCommonT.set(Rtotal.x(), Rtotal.y(), Rtotal.z()); - _TrackerCommonT = align::GlobalVector(Rtotal.x(), Rtotal.y(), Rtotal.z()); - _TrackerCommonR = align::GlobalVector(Wtotal.x(), Wtotal.y(), Wtotal.z()); - _TrackerCommonCM = curAli->globalPosition(); - //_TrackerCommonTR(1) = Rtotal.x(); _TrackerCommonTR(2) = Rtotal.y(); _TrackerCommonTR(3) = Rtotal.z(); - //_TrackerCommonTR(4) = Wtotal.x(); _TrackerCommonTR(5) = Wtotal.y(); _TrackerCommonTR(6) = Wtotal.z(); + + TrackerCommonT_ = align::GlobalVector(Rtotal.x(), Rtotal.y(), Rtotal.z()); + TrackerCommonR_ = align::GlobalVector(Wtotal.x(), Wtotal.y(), Wtotal.z()); + TrackerCommonCM_ = curAli->globalPosition(); } else { for (unsigned int i = 0; i < nComp; ++i) @@ -822,108 +802,108 @@ void TrackerGeometryCompare::fillTree(Alignable* refAli, edm::ESHandle SiStripModules; iSetup.get().get(SiStripModules); - _id = refAli->id(); + id_ = refAli->id(); - _badModuleQuality = 0; + badModuleQuality_ = 0; //check if module has a bad quality tag - if (SiPixelModules->IsModuleBad(_id)) { - _badModuleQuality = 1; + if (SiPixelModules->IsModuleBad(id_)) { + badModuleQuality_ = 1; } - if (SiStripModules->IsModuleBad(_id)) { - _badModuleQuality = 1; + if (SiStripModules->IsModuleBad(id_)) { + badModuleQuality_ = 1; } //check if module is in a given list of bad/untouched etc. modules - _inModuleList = 0; - for (unsigned int i = 0; i < _moduleList.size(); i++) { - if (_moduleList[i] == _id) { - _inModuleList = 1; + inModuleList_ = 0; + for (unsigned int i = 0; i < moduleList_.size(); i++) { + if (moduleList_[i] == id_) { + inModuleList_ = 1; break; } } - _level = refAli->alignableObjectId(); + level_ = refAli->alignableObjectId(); //need if ali has no mother if (refAli->mother()) { - _mid = refAli->mother()->geomDetId().rawId(); - _mlevel = refAli->mother()->alignableObjectId(); + mid_ = refAli->mother()->geomDetId().rawId(); + mlevel_ = refAli->mother()->alignableObjectId(); } else { - _mid = -1; - _mlevel = -1; + mid_ = -1; + mlevel_ = -1; } - DetId detid(_id); - _sublevel = detid.subdetId(); - fillIdentifiers(_sublevel, _id, tTopo); - _xVal = refAli->globalPosition().x(); - _yVal = refAli->globalPosition().y(); - _zVal = refAli->globalPosition().z(); - align::GlobalVector vec(_xVal, _yVal, _zVal); - _rVal = vec.perp(); - _phiVal = vec.phi(); - _etaVal = vec.eta(); + DetId detid(id_); + sublevel_ = detid.subdetId(); + fillIdentifiers(sublevel_, id_, tTopo); + xVal_ = refAli->globalPosition().x(); + yVal_ = refAli->globalPosition().y(); + zVal_ = refAli->globalPosition().z(); + align::GlobalVector vec(xVal_, yVal_, zVal_); + rVal_ = vec.perp(); + phiVal_ = vec.phi(); + etaVal_ = vec.eta(); align::RotationType rot = refAli->globalRotation(); align::EulerAngles eulerAngles = align::toAngles(rot); - _alphaVal = eulerAngles[0]; - _betaVal = eulerAngles[1]; - _gammaVal = eulerAngles[2]; + alphaVal_ = eulerAngles[0]; + betaVal_ = eulerAngles[1]; + gammaVal_ = eulerAngles[2]; // global - _dxVal = diff[0]; - _dyVal = diff[1]; - _dzVal = diff[2]; + dxVal_ = diff[0]; + dyVal_ = diff[1]; + dzVal_ = diff[2]; // local - _duVal = diff[6]; - _dvVal = diff[7]; - _dwVal = diff[8]; + duVal_ = diff[6]; + dvVal_ = diff[7]; + dwVal_ = diff[8]; //...TODO... - align::GlobalVector g(_dxVal, _dyVal, _dzVal); + align::GlobalVector g(dxVal_, dyVal_, dzVal_); //getting dR and dPhi - align::GlobalVector vRef(_xVal, _yVal, _zVal); - align::GlobalVector vCur(_xVal + _dxVal, _yVal + _dyVal, _zVal + _dzVal); - _drVal = vCur.perp() - vRef.perp(); - _dphiVal = vCur.phi() - vRef.phi(); + align::GlobalVector vRef(xVal_, yVal_, zVal_); + align::GlobalVector vCur(xVal_ + dxVal_, yVal_ + dyVal_, zVal_ + dzVal_); + drVal_ = vCur.perp() - vRef.perp(); + dphiVal_ = vCur.phi() - vRef.phi(); // global - _dalphaVal = diff[3]; - _dbetaVal = diff[4]; - _dgammaVal = diff[5]; + dalphaVal_ = diff[3]; + dbetaVal_ = diff[4]; + dgammaVal_ = diff[5]; // local - _daVal = diff[9]; - _dbVal = diff[10]; - _dgVal = diff[11]; + daVal_ = diff[9]; + dbVal_ = diff[10]; + dgVal_ = diff[11]; //detIdFlag if (refAli->alignableObjectId() == align::AlignableDetUnit) { - if (_detIdFlag) { + if (detIdFlag_) { if ((passIdCut(refAli->id())) || (passIdCut(refAli->mother()->id()))) { - _useDetId = 1; + useDetId_ = 1; } else { - _useDetId = 0; + useDetId_ = 0; } } } // det module dimension if (refAli->alignableObjectId() == align::AlignableDetUnit) { if (refAli->mother()->alignableObjectId() != align::AlignableDet) - _detDim = 1; + detDim_ = 1; else if (refAli->mother()->alignableObjectId() == align::AlignableDet) - _detDim = 2; + detDim_ = 2; } else - _detDim = 0; + detDim_ = 0; - _surWidth = refAli->surface().width(); - _surLength = refAli->surface().length(); + surWidth_ = refAli->surface().width(); + surLength_ = refAli->surface().length(); align::RotationType rt = refAli->globalRotation(); - _surRot[0] = rt.xx(); - _surRot[1] = rt.xy(); - _surRot[2] = rt.xz(); - _surRot[3] = rt.yx(); - _surRot[4] = rt.yy(); - _surRot[5] = rt.yz(); - _surRot[6] = rt.zx(); - _surRot[7] = rt.zy(); - _surRot[8] = rt.zz(); + surRot_[0] = rt.xx(); + surRot_[1] = rt.xy(); + surRot_[2] = rt.xz(); + surRot_[3] = rt.yx(); + surRot_[4] = rt.yy(); + surRot_[5] = rt.yz(); + surRot_[6] = rt.zx(); + surRot_[7] = rt.zy(); + surRot_[8] = rt.zz(); //Fill - _alignTree->Fill(); + alignTree_->Fill(); } void TrackerGeometryCompare::surveyToTracker(AlignableTracker* ali, @@ -1007,10 +987,10 @@ void TrackerGeometryCompare::addSurveyInfo(Alignable* ali) { bool TrackerGeometryCompare::passIdCut(uint32_t id) { bool pass = false; - int nEntries = _detIdFlagVector.size(); + int nEntries = detIdFlagVector_.size(); for (int i = 0; i < nEntries; i++) { - if (_detIdFlagVector[i] == id) + if (detIdFlagVector_[i] == id) pass = true; } @@ -1020,57 +1000,57 @@ bool TrackerGeometryCompare::passIdCut(uint32_t id) { void TrackerGeometryCompare::fillIdentifiers(int subdetlevel, int rawid, const TrackerTopology* tTopo) { switch (subdetlevel) { case 1: { - _identifiers[0] = tTopo->pxbModule(rawid); - _identifiers[1] = tTopo->pxbLadder(rawid); - _identifiers[2] = tTopo->pxbLayer(rawid); - _identifiers[3] = 999; - _identifiers[4] = 999; - _identifiers[5] = 999; + identifiers_[0] = tTopo->pxbModule(rawid); + identifiers_[1] = tTopo->pxbLadder(rawid); + identifiers_[2] = tTopo->pxbLayer(rawid); + identifiers_[3] = 999; + identifiers_[4] = 999; + identifiers_[5] = 999; break; } case 2: { - _identifiers[0] = tTopo->pxfModule(rawid); - _identifiers[1] = tTopo->pxfPanel(rawid); - _identifiers[2] = tTopo->pxfBlade(rawid); - _identifiers[3] = tTopo->pxfDisk(rawid); - _identifiers[4] = tTopo->pxfSide(rawid); - _identifiers[5] = 999; + identifiers_[0] = tTopo->pxfModule(rawid); + identifiers_[1] = tTopo->pxfPanel(rawid); + identifiers_[2] = tTopo->pxfBlade(rawid); + identifiers_[3] = tTopo->pxfDisk(rawid); + identifiers_[4] = tTopo->pxfSide(rawid); + identifiers_[5] = 999; break; } case 3: { - _identifiers[0] = tTopo->tibModule(rawid); - _identifiers[1] = tTopo->tibStringInfo(rawid)[0]; - _identifiers[2] = tTopo->tibStringInfo(rawid)[1]; - _identifiers[3] = tTopo->tibStringInfo(rawid)[2]; - _identifiers[4] = tTopo->tibLayer(rawid); - _identifiers[5] = 999; + identifiers_[0] = tTopo->tibModule(rawid); + identifiers_[1] = tTopo->tibStringInfo(rawid)[0]; + identifiers_[2] = tTopo->tibStringInfo(rawid)[1]; + identifiers_[3] = tTopo->tibStringInfo(rawid)[2]; + identifiers_[4] = tTopo->tibLayer(rawid); + identifiers_[5] = 999; break; } case 4: { - _identifiers[0] = tTopo->tidModuleInfo(rawid)[0]; - _identifiers[1] = tTopo->tidModuleInfo(rawid)[1]; - _identifiers[2] = tTopo->tidRing(rawid); - _identifiers[3] = tTopo->tidWheel(rawid); - _identifiers[4] = tTopo->tidSide(rawid); - _identifiers[5] = 999; + identifiers_[0] = tTopo->tidModuleInfo(rawid)[0]; + identifiers_[1] = tTopo->tidModuleInfo(rawid)[1]; + identifiers_[2] = tTopo->tidRing(rawid); + identifiers_[3] = tTopo->tidWheel(rawid); + identifiers_[4] = tTopo->tidSide(rawid); + identifiers_[5] = 999; break; } case 5: { - _identifiers[0] = tTopo->tobModule(rawid); - _identifiers[1] = tTopo->tobRodInfo(rawid)[0]; - _identifiers[2] = tTopo->tobRodInfo(rawid)[1]; - _identifiers[3] = tTopo->tobLayer(rawid); - _identifiers[4] = 999; - _identifiers[5] = 999; + identifiers_[0] = tTopo->tobModule(rawid); + identifiers_[1] = tTopo->tobRodInfo(rawid)[0]; + identifiers_[2] = tTopo->tobRodInfo(rawid)[1]; + identifiers_[3] = tTopo->tobLayer(rawid); + identifiers_[4] = 999; + identifiers_[5] = 999; break; } case 6: { - _identifiers[0] = tTopo->tecModule(rawid); - _identifiers[1] = tTopo->tecRing(rawid); - _identifiers[2] = tTopo->tecPetalInfo(rawid)[0]; - _identifiers[3] = tTopo->tecPetalInfo(rawid)[1]; - _identifiers[4] = tTopo->tecWheel(rawid); - _identifiers[5] = tTopo->tecSide(rawid); + identifiers_[0] = tTopo->tecModule(rawid); + identifiers_[1] = tTopo->tecRing(rawid); + identifiers_[2] = tTopo->tecPetalInfo(rawid)[0]; + identifiers_[3] = tTopo->tecPetalInfo(rawid)[1]; + identifiers_[4] = tTopo->tecWheel(rawid); + identifiers_[5] = tTopo->tecSide(rawid); break; } default: { diff --git a/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.h b/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.h index 59b94d0b1fa59..14433e85b902f 100644 --- a/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.h +++ b/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.h @@ -100,64 +100,65 @@ class TrackerGeometryCompare : public edm::EDAnalyzer { const SurveyErrors* theSurveyErrors; // configurables - const std::vector _levelStrings; - std::string _moduleListName; - std::string _inputFilename1; - std::string _inputFilename2; - std::string _inputTreenameAlign; - std::string _inputTreenameDeform; - bool _writeToDB; - std::string _weightBy; - std::string _setCommonTrackerSystem; - bool _detIdFlag; - std::string _detIdFlagFile; - bool _weightById; - std::string _weightByIdFile; - std::vector _weightByIdVector; - - std::vector _detIdFlagVector; - align::StructureType _commonTrackerLevel; - align::GlobalVector _TrackerCommonT; - align::GlobalVector _TrackerCommonR; - align::PositionType _TrackerCommonCM; - - std::ifstream _moduleListFile; - std::vector _moduleList; - int _moduleInList; + const std::vector levelStrings_; + std::string moduleListName_; + std::string inputFilename1_; + std::string inputFilename2_; + std::string inputTreenameAlign_; + std::string inputTreenameDeform_; + bool fromDD4hep_; + bool writeToDB_; + std::string weightBy_; + std::string setCommonTrackerSystem_; + bool detIdFlag_; + std::string detIdFlagFile_; + bool weightById_; + std::string weightByIdFile_; + std::vector weightByIdVector_; + + std::vector detIdFlagVector_; + align::StructureType commonTrackerLevel_; + align::GlobalVector TrackerCommonT_; + align::GlobalVector TrackerCommonR_; + align::PositionType TrackerCommonCM_; + + std::ifstream moduleListFile_; + std::vector moduleList_; + int moduleInList_; //root configuration - std::string _filename; - TFile* _theFile; - TTree* _alignTree; - TFile* _inputRootFile1; - TFile* _inputRootFile2; - TTree* _inputTree01; - TTree* _inputTree02; - TTree* _inputTree11; - TTree* _inputTree12; + std::string filename_; + TFile* theFile_; + TTree* alignTree_; + TFile* inputRootFile1_; + TFile* inputRootFile2_; + TTree* inputTree01_; + TTree* inputTree02_; + TTree* inputTree11_; + TTree* inputTree12_; /**\ Tree variables */ - int _id, _badModuleQuality, _inModuleList, _level, _mid, _mlevel, _sublevel, _useDetId, _detDim; - float _xVal, _yVal, _zVal, _rVal, _etaVal, _phiVal, _alphaVal, _betaVal, _gammaVal; + int id_, badModuleQuality_, inModuleList_, level_, mid_, mlevel_, sublevel_, useDetId_, detDim_; + float xVal_, yVal_, zVal_, rVal_, etaVal_, phiVal_, alphaVal_, betaVal_, gammaVal_; // changes in global variables - float _dxVal, _dyVal, _dzVal, _drVal, _dphiVal, _dalphaVal, _dbetaVal, _dgammaVal; + float dxVal_, dyVal_, dzVal_, drVal_, dphiVal_, dalphaVal_, dbetaVal_, dgammaVal_; // changes local variables: u, v, w, alpha, beta, gamma - float _duVal, _dvVal, _dwVal, _daVal, _dbVal, _dgVal; - float _surWidth, _surLength; - uint32_t _identifiers[6]; - double _surRot[9]; - int _type; - double _surfDeform[13]; + float duVal_, dvVal_, dwVal_, daVal_, dbVal_, dgVal_; + float surWidth_, surLength_; + uint32_t identifiers_[6]; + double surRot_[9]; + int type_; + double surfDeform_[13]; - int m_nBins; - double m_rangeLow; - double m_rangeHigh; + int m_nBins_; + double m_rangeLow_; + double m_rangeHigh_; bool firstEvent_; - std::vector m_vtkmap; + std::vector m_vtkmap_; - std::map m_h1; + std::map m_h1_; }; #endif diff --git a/Alignment/OfflineValidation/python/TrackerGeometryCompare_cfi.py b/Alignment/OfflineValidation/python/TrackerGeometryCompare_cfi.py index b5c30e37d048b..0539d033224f2 100644 --- a/Alignment/OfflineValidation/python/TrackerGeometryCompare_cfi.py +++ b/Alignment/OfflineValidation/python/TrackerGeometryCompare_cfi.py @@ -2,6 +2,7 @@ # Full configuration for Tracker Geometry Comparison Tool TrackerGeometryCompare = cms.EDAnalyzer("TrackerGeometryCompare", + fromDD4hep = cms.untracked.bool(False), writeToDB = cms.untracked.bool(False), outputFile = cms.untracked.string('output.root'), setCommonTrackerSystem = cms.untracked.string('NONE'), ##must be "NONE" if you don't want to use this option diff --git a/CondTools/Geometry/plugins/PGeometricDetBuilder.cc b/CondTools/Geometry/plugins/PGeometricDetBuilder.cc index fdd5c2e33e69a..fe69f91a369be 100644 --- a/CondTools/Geometry/plugins/PGeometricDetBuilder.cc +++ b/CondTools/Geometry/plugins/PGeometricDetBuilder.cc @@ -10,14 +10,19 @@ #include "CondFormats/GeometryObjects/interface/PGeometricDet.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" #include "Geometry/TrackerNumberingBuilder/interface/GeometricDet.h" +#include "DetectorDescription/DDCMS/interface/DDCompactView.h" #include "DetectorDescription/Core/interface/DDCompactView.h" #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include +using DD3Vector = ROOT::Math::DisplacementVector3D>; +using Translation = ROOT::Math::DisplacementVector3D>; +using RotationMatrix = ROOT::Math::Rotation3D; + class PGeometricDetBuilder : public edm::one::EDAnalyzer { public: - PGeometricDetBuilder(const edm::ParameterSet&) {} + PGeometricDetBuilder(const edm::ParameterSet&); void beginRun(edm::Run const& iEvent, edm::EventSetup const&) override; void analyze(edm::Event const& iEvent, edm::EventSetup const&) override {} @@ -25,8 +30,13 @@ class PGeometricDetBuilder : public edm::one::EDAnalyzer { private: void putOne(const GeometricDet* gd, PGeometricDet* pgd, int lev); + bool fromDD4hep_; }; +PGeometricDetBuilder::PGeometricDetBuilder(const edm::ParameterSet& iConfig) { + fromDD4hep_ = iConfig.getParameter("fromDD4hep"); +} + void PGeometricDetBuilder::beginRun(const edm::Run&, edm::EventSetup const& es) { PGeometricDet* pgd = new PGeometricDet; edm::Service mydbservice; @@ -34,9 +44,14 @@ void PGeometricDetBuilder::beginRun(const edm::Run&, edm::EventSetup const& es) edm::LogError("PGeometricDetBuilder") << "PoolDBOutputService unavailable"; return; } - edm::ESTransientHandle pDD; + if (!fromDD4hep_) { + edm::ESTransientHandle pDD; + es.get().get(pDD); + } else { + edm::ESTransientHandle pDD; + es.get().get(pDD); + } edm::ESHandle rDD; - es.get().get(pDD); es.get().get(rDD); const GeometricDet* tracker = &(*rDD); @@ -114,8 +129,8 @@ void PGeometricDetBuilder::beginRun(const edm::Run&, edm::EventSetup const& es) void PGeometricDetBuilder::putOne(const GeometricDet* gd, PGeometricDet* pgd, int lev) { PGeometricDet::Item item; - const DDTranslation& tran = gd->translation(); - const DDRotationMatrix& rot = gd->rotation(); + const Translation& tran = gd->translation(); + const RotationMatrix& rot = gd->rotation(); DD3Vector x, y, z; rot.GetComponents(x, y, z); item._name = gd->name(); @@ -135,9 +150,9 @@ void PGeometricDetBuilder::putOne(const GeometricDet* gd, PGeometricDet* pgd, in item._a31 = x.Z(); item._a32 = y.Z(); item._a33 = z.Z(); - item._shape = static_cast(gd->shape()); + item._shape = static_cast(gd->shape_dd4hep()); item._type = gd->type(); - if (gd->shape() == DDSolidShape::ddbox) { + if (gd->shape_dd4hep() == cms::DDSolidShape::ddbox) { item._params0 = gd->params()[0]; item._params1 = gd->params()[1]; item._params2 = gd->params()[2]; @@ -149,7 +164,7 @@ void PGeometricDetBuilder::putOne(const GeometricDet* gd, PGeometricDet* pgd, in item._params8 = 0; item._params9 = 0; item._params10 = 0; - } else if (gd->shape() == DDSolidShape::ddtrap) { + } else if (gd->shape_dd4hep() == cms::DDSolidShape::ddtrap) { item._params0 = gd->params()[0]; item._params1 = gd->params()[1]; item._params2 = gd->params()[2]; diff --git a/CondTools/Geometry/plugins/PGeometricDetExtraBuilder.cc b/CondTools/Geometry/plugins/PGeometricDetExtraBuilder.cc index ad1420b32427d..0d887b7c9f69a 100644 --- a/CondTools/Geometry/plugins/PGeometricDetExtraBuilder.cc +++ b/CondTools/Geometry/plugins/PGeometricDetExtraBuilder.cc @@ -10,6 +10,7 @@ #include "CondFormats/GeometryObjects/interface/PGeometricDetExtra.h" #include "Geometry/Records/interface/PGeometricDetExtraRcd.h" #include "Geometry/TrackerNumberingBuilder/interface/GeometricDetExtra.h" +#include "DetectorDescription/DDCMS/interface/DDCompactView.h" #include "DetectorDescription/Core/interface/DDCompactView.h" #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" @@ -17,7 +18,7 @@ class PGeometricDetExtraBuilder : public edm::one::EDAnalyzer { public: - PGeometricDetExtraBuilder(const edm::ParameterSet&) {} + PGeometricDetExtraBuilder(const edm::ParameterSet&); void beginRun(edm::Run const& iEvent, edm::EventSetup const&) override; void analyze(edm::Event const& iEvent, edm::EventSetup const&) override {} @@ -25,8 +26,13 @@ class PGeometricDetExtraBuilder : public edm::one::EDAnalyzer("fromDD4hep"); +} + void PGeometricDetExtraBuilder::beginRun(const edm::Run&, edm::EventSetup const& es) { PGeometricDetExtra* pgde = new PGeometricDetExtra; edm::Service mydbservice; @@ -34,9 +40,15 @@ void PGeometricDetExtraBuilder::beginRun(const edm::Run&, edm::EventSetup const& edm::LogError("PGeometricDetExtraBuilder") << "PoolDBOutputService unavailable"; return; } - edm::ESTransientHandle cpvH; + + if (!fromDD4hep_) { + edm::ESTransientHandle cpvH; + es.get().get(cpvH); + } else { + edm::ESTransientHandle cpvH; + es.get().get(cpvH); + } edm::ESHandle > gdeH; - es.get().get(cpvH); es.get().get(gdeH); const std::vector& gdes = (*gdeH); diff --git a/CondTools/Geometry/plugins/PTrackerParametersDBBuilder.cc b/CondTools/Geometry/plugins/PTrackerParametersDBBuilder.cc index 288b0ab1a656e..834408e29356c 100644 --- a/CondTools/Geometry/plugins/PTrackerParametersDBBuilder.cc +++ b/CondTools/Geometry/plugins/PTrackerParametersDBBuilder.cc @@ -5,19 +5,27 @@ #include "FWCore/ServiceRegistry/interface/Service.h" #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" #include "CondFormats/GeometryObjects/interface/PTrackerParameters.h" +#include "DetectorDescription/DDCMS/interface/DDCompactView.h" #include "DetectorDescription/Core/interface/DDCompactView.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" #include "Geometry/TrackerGeometryBuilder/interface/TrackerParametersFromDD.h" class PTrackerParametersDBBuilder : public edm::one::EDAnalyzer { public: - PTrackerParametersDBBuilder(const edm::ParameterSet&) {} + PTrackerParametersDBBuilder(const edm::ParameterSet&); void beginRun(edm::Run const& iEvent, edm::EventSetup const&) override; void analyze(edm::Event const& iEvent, edm::EventSetup const&) override {} void endRun(edm::Run const& iEvent, edm::EventSetup const&) override {} + +private: + bool fromDD4hep_; }; +PTrackerParametersDBBuilder::PTrackerParametersDBBuilder(const edm::ParameterSet& iConfig) { + fromDD4hep_ = iConfig.getParameter("fromDD4hep"); +} + void PTrackerParametersDBBuilder::beginRun(const edm::Run&, edm::EventSetup const& es) { PTrackerParameters* ptp = new PTrackerParameters; edm::Service mydbservice; @@ -25,11 +33,18 @@ void PTrackerParametersDBBuilder::beginRun(const edm::Run&, edm::EventSetup cons edm::LogError("PTrackerParametersDBBuilder") << "PoolDBOutputService unavailable"; return; } - edm::ESTransientHandle cpv; - es.get().get(cpv); TrackerParametersFromDD builder; - builder.build(&(*cpv), *ptp); + + if (!fromDD4hep_) { + edm::ESTransientHandle cpv; + es.get().get(cpv); + builder.build(&(*cpv), *ptp); + } else { + edm::ESTransientHandle cpv; + es.get().get(cpv); + builder.build(&(*cpv), *ptp); + } if (mydbservice->isNewTagRequest("PTrackerParametersRcd")) { mydbservice->createNewIOV( diff --git a/CondTools/Geometry/test/geometrywriter.py b/CondTools/Geometry/test/geometrywriter.py index da1ebd24e4242..222a5b143a012 100644 --- a/CondTools/Geometry/test/geometrywriter.py +++ b/CondTools/Geometry/test/geometrywriter.py @@ -21,9 +21,9 @@ fromDDD = cms.bool( True ) ) -process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder") -process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder") -process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder") +process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder",fromDD4hep=cms.bool( False )) +process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder", fromDD4hep=cms.bool( False )) +process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder", fromDD4hep=cms.bool( False )) process.CaloGeometryWriter = cms.EDAnalyzer("PCaloGeometryBuilder") diff --git a/CondTools/Geometry/test/trackergeometrywriter.py b/CondTools/Geometry/test/trackergeometrywriter.py index 5ba6b0bbde520..fd6c6c4804efb 100644 --- a/CondTools/Geometry/test/trackergeometrywriter.py +++ b/CondTools/Geometry/test/trackergeometrywriter.py @@ -15,9 +15,9 @@ fromDDD = cms.bool( True ) ) -process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder") -process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder") -process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder") +process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder", fromDD4hep=cms.bool(False)) +process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder", fromDD4hep=cms.bool(False)) +process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder", fromDD4hep=cms.bool(False)) process.CondDB.timetype = cms.untracked.string('runnumber') process.CondDB.connect = cms.string('sqlite_file:myfile.db') diff --git a/CondTools/Geometry/test/trackergeometrywriterRun2.py b/CondTools/Geometry/test/trackergeometrywriterRun2.py index 941a13fdcc8d7..d5b9ded7417ed 100644 --- a/CondTools/Geometry/test/trackergeometrywriterRun2.py +++ b/CondTools/Geometry/test/trackergeometrywriterRun2.py @@ -15,9 +15,9 @@ fromDDD = cms.bool( True ) ) -process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder") -process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder") -process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder") +process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder",fromDD4hep=cms.bool( False )) +process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder",fromDD4hep=cms.bool( False )) +process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder",fromDD4hep=cms.bool( False )) process.CondDB.timetype = cms.untracked.string('runnumber') process.CondDB.connect = cms.string('sqlite_file:myfilerun2.db') diff --git a/CondTools/Geometry/test/writehelpers/geometryExtended2016_writer.py b/CondTools/Geometry/test/writehelpers/geometryExtended2016_writer.py index fa2872c0888d7..39665b98f0c0e 100644 --- a/CondTools/Geometry/test/writehelpers/geometryExtended2016_writer.py +++ b/CondTools/Geometry/test/writehelpers/geometryExtended2016_writer.py @@ -31,9 +31,9 @@ fromDDD = cms.bool( True ), ) -process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder") -process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder") -process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder") +process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder",fromDD4hep=cms.bool(False)) +process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder",fromDD4hep=cms.bool(False)) +process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder",fromDD4hep=cms.bool(False)) process.CaloGeometryWriter = cms.EDAnalyzer("PCaloGeometryBuilder") diff --git a/CondTools/Geometry/test/writehelpers/geometryExtended2017Plan1_writer.py b/CondTools/Geometry/test/writehelpers/geometryExtended2017Plan1_writer.py index 23b556b574790..2f2b71cce6e52 100644 --- a/CondTools/Geometry/test/writehelpers/geometryExtended2017Plan1_writer.py +++ b/CondTools/Geometry/test/writehelpers/geometryExtended2017Plan1_writer.py @@ -32,9 +32,9 @@ fromDDD = cms.bool( True ), ) -process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder") -process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder") -process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder") +process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder",fromDD4hep=cms.bool(False)) +process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder",fromDD4hep=cms.bool(False)) +process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder",fromDD4hep=cms.bool(False)) process.CaloGeometryWriter = cms.EDAnalyzer("PCaloGeometryBuilder") diff --git a/CondTools/Geometry/test/writehelpers/geometryExtended2017_writer.py b/CondTools/Geometry/test/writehelpers/geometryExtended2017_writer.py index ad9c539c93331..8bce521afd069 100644 --- a/CondTools/Geometry/test/writehelpers/geometryExtended2017_writer.py +++ b/CondTools/Geometry/test/writehelpers/geometryExtended2017_writer.py @@ -32,9 +32,9 @@ fromDDD = cms.bool( True ), ) -process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder") -process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder") -process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder") +process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder",fromDD4hep=cms.bool(False)) +process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder",fromDD4hep=cms.bool(False)) +process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder",fromDD4hep=cms.bool(False)) process.CaloGeometryWriter = cms.EDAnalyzer("PCaloGeometryBuilder") diff --git a/CondTools/Geometry/test/writehelpers/geometryExtended2018_writer.py b/CondTools/Geometry/test/writehelpers/geometryExtended2018_writer.py index 70bce6a2eb557..f33159cafda70 100644 --- a/CondTools/Geometry/test/writehelpers/geometryExtended2018_writer.py +++ b/CondTools/Geometry/test/writehelpers/geometryExtended2018_writer.py @@ -32,9 +32,9 @@ fromDDD = cms.bool( True ), ) -process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder") -process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder") -process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder") +process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder",fromDD4hep=cms.bool(False)) +process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder",fromDD4hep=cms.bool(False)) +process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder",fromDD4hep=cms.bool(False)) process.CaloGeometryWriter = cms.EDAnalyzer("PCaloGeometryBuilder") diff --git a/CondTools/Geometry/test/writehelpers/geometryExtended2019_writer.py b/CondTools/Geometry/test/writehelpers/geometryExtended2019_writer.py index 7ad7fef1e20e1..d0ba0193fc205 100644 --- a/CondTools/Geometry/test/writehelpers/geometryExtended2019_writer.py +++ b/CondTools/Geometry/test/writehelpers/geometryExtended2019_writer.py @@ -32,9 +32,9 @@ fromDDD = cms.bool( True ), ) -process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder") -process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder") -process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder") +process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder",fromDD4hep=cms.bool(False)) +process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder",fromDD4hep=cms.bool(False)) +process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder",fromDD4hep=cms.bool(False)) process.CaloGeometryWriter = cms.EDAnalyzer("PCaloGeometryBuilder") diff --git a/CondTools/Geometry/test/writehelpers/geometryExtended2021_writer.py b/CondTools/Geometry/test/writehelpers/geometryExtended2021_writer.py index 23d548f9208ea..5ff5cc970a3d3 100644 --- a/CondTools/Geometry/test/writehelpers/geometryExtended2021_writer.py +++ b/CondTools/Geometry/test/writehelpers/geometryExtended2021_writer.py @@ -32,9 +32,9 @@ fromDDD = cms.bool( True ), ) -process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder") -process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder") -process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder") +process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder",fromDD4hep=cms.bool(False)) +process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder", fromDD4hep=cms.bool(False)) +process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder",fromDD4hep=cms.bool(False)) process.CaloGeometryWriter = cms.EDAnalyzer("PCaloGeometryBuilder") diff --git a/CondTools/Geometry/test/writehelpers/geometryExtended2026_writer.py b/CondTools/Geometry/test/writehelpers/geometryExtended2026_writer.py index 34783acf0aeec..f29c611058db5 100644 --- a/CondTools/Geometry/test/writehelpers/geometryExtended2026_writer.py +++ b/CondTools/Geometry/test/writehelpers/geometryExtended2026_writer.py @@ -32,9 +32,9 @@ fromDDD = cms.bool( True ), ) -process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder") -process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder") -process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder") +process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder",fromDD4hep=cms.bool(False)) +process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder",fromDD4hep=cms.bool(False)) +process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder",fromDD4hep=cms.bool(False)) process.CaloGeometryWriter = cms.EDAnalyzer("PCaloGeometryBuilder", EcalE = cms.untracked.bool(False), diff --git a/CondTools/Geometry/test/writehelpers/geometryrun2devwriter.py b/CondTools/Geometry/test/writehelpers/geometryrun2devwriter.py index 7ae130c44a7c3..dacce5040dd57 100644 --- a/CondTools/Geometry/test/writehelpers/geometryrun2devwriter.py +++ b/CondTools/Geometry/test/writehelpers/geometryrun2devwriter.py @@ -32,9 +32,9 @@ fromDDD = cms.bool( True ) ) -process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder") -process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder") -process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder") +process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder",fromDD4hep=cms.bool(False)) +process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder",fromDD4hep=cms.bool(False)) +process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder",fromDD4hep=cms.bool(False)) process.CaloGeometryWriter = cms.EDAnalyzer("PCaloGeometryBuilder") diff --git a/CondTools/Geometry/test/writehelpers/geometryrun2writer.py b/CondTools/Geometry/test/writehelpers/geometryrun2writer.py index a8080a7f5df7d..f3c3058fbaea0 100644 --- a/CondTools/Geometry/test/writehelpers/geometryrun2writer.py +++ b/CondTools/Geometry/test/writehelpers/geometryrun2writer.py @@ -32,9 +32,9 @@ fromDDD = cms.bool( True ) ) -process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder") -process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder") -process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder") +process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder",fromDD4hep=cms.bool(False)) +process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder",fromDD4hep=cms.bool(False)) +process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder",fromDD4hep=cms.bool(False)) process.CaloGeometryWriter = cms.EDAnalyzer("PCaloGeometryBuilder") diff --git a/CondTools/Geometry/test/writehelpers/geometrywriter.py b/CondTools/Geometry/test/writehelpers/geometrywriter.py index de90460a677eb..c6b230ad8a76f 100644 --- a/CondTools/Geometry/test/writehelpers/geometrywriter.py +++ b/CondTools/Geometry/test/writehelpers/geometrywriter.py @@ -32,9 +32,9 @@ fromDDD = cms.bool( True ) ) -process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder") -process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder") -process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder") +process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder",fromDD4hep=cms.bool(False)) +process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder",fromDD4hep=cms.bool(False)) +process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder",fromDD4hep=cms.bool(False)) process.CaloGeometryWriter = cms.EDAnalyzer("PCaloGeometryBuilder") diff --git a/DetectorDescription/DDCMS/interface/DDSolidShapes.h b/DetectorDescription/DDCMS/interface/DDSolidShapes.h index 06dc5b4be33f7..b101c795e7ab4 100644 --- a/DetectorDescription/DDCMS/interface/DDSolidShapes.h +++ b/DetectorDescription/DDCMS/interface/DDSolidShapes.h @@ -57,6 +57,17 @@ namespace cms { } return std::begin(a)->value; } + + template + typename Mapping::value_type::name_type name_from_value(Mapping a, V value) { + auto pos = std::find_if( + std::begin(a), std::end(a), [&value](const typename Mapping::value_type& t) { return (t.value == value); }); + if (pos != std::end(a)) { + return pos->name; + } + return std::begin(a)->name; + } + }; // namespace dd enum class DDSolidShape { @@ -67,18 +78,20 @@ namespace cms { ddcons = 4, ddpolycone = 5, ddpolyhedra = 6, - ddtorus = 7, - ddunion = 8, - ddsubtraction = 9, - ddintersection = 10, - ddshapeless = 11, - ddpseudotrap = 12, - ddtrunctubs = 13, - ddsphere = 14, - ddellipticaltube = 15, - ddcuttubs = 16, - ddextrudedpolygon = 17, - ddtrd1 = 18, + ddunsupported1 = 7, + ddunsupported2 = 8, + ddtorus = 9, + ddunion = 10, + ddsubtraction = 11, + ddintersection = 12, + ddshapeless = 13, + ddpseudotrap = 14, + ddtrunctubs = 15, + ddsphere = 16, + ddellipticaltube = 17, + ddcuttubs = 18, + ddextrudedpolygon = 19, + ddtrd1 = 20, }; const std::array, 19> DDSolidShapeMap{ diff --git a/DetectorDescription/DDCMS/test/DDSolidLegacyShapes.cppunit.cc b/DetectorDescription/DDCMS/test/DDSolidLegacyShapes.cppunit.cc index 01b059d6c882c..636f8e462d39b 100644 --- a/DetectorDescription/DDCMS/test/DDSolidLegacyShapes.cppunit.cc +++ b/DetectorDescription/DDCMS/test/DDSolidLegacyShapes.cppunit.cc @@ -96,8 +96,8 @@ void testDDSolidLegacyShapes::checkDDSolidLegacyShapes() { cms::dd::value(cms::LegacySolidShapeMap, cms::DDSolidShape::ddextrudedpolygon); CPPUNIT_ASSERT(legacyExtrudedpolygon == LegacySolidShape::ddextrudedpolygon); - int ids[] = {0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 7, 5, 6, 6, 8, 6, 9, 7, - 10, 8, 11, 9, 12, 10, 13, 11, 14, 12, 15, 13, 16, 14, 17, 15, 18, 16, 19, 17}; + int ids[] = {0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 7, 5, 6, 6, 8, 6, 9, 9, + 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19}; int i = 0; for (const auto it : LegacySolidShapeMap) { CPPUNIT_ASSERT(static_cast(it.value) == ids[i++]); diff --git a/Geometry/MTDNumberingBuilder/src/GeometricTimingDet.cc b/Geometry/MTDNumberingBuilder/src/GeometricTimingDet.cc index 11a9464bf0adf..1f10b358d647a 100644 --- a/Geometry/MTDNumberingBuilder/src/GeometricTimingDet.cc +++ b/Geometry/MTDNumberingBuilder/src/GeometricTimingDet.cc @@ -257,5 +257,6 @@ GeometricTimingDet::Rotation GeometricTimingDet::rotationBounds() const { std::unique_ptr GeometricTimingDet::bounds() const { const std::vector& par = params_; TrackerShapeToBounds shapeToBounds; - return std::unique_ptr(shapeToBounds.buildBounds(shape_, par)); + return std::unique_ptr( + shapeToBounds.buildBounds(cms::dd::name_from_value(cms::LegacySolidShapeMap, shape_), par)); } diff --git a/Geometry/TrackerNumberingBuilder/bin/BuildFile.xml b/Geometry/TrackerNumberingBuilder/bin/BuildFile.xml deleted file mode 100644 index 94bb6b2091378..0000000000000 --- a/Geometry/TrackerNumberingBuilder/bin/BuildFile.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/Geometry/TrackerNumberingBuilder/bin/stubs/GeometricDetLoader.cc b/Geometry/TrackerNumberingBuilder/bin/stubs/GeometricDetLoader.cc deleted file mode 100644 index 98ee932cf3118..0000000000000 --- a/Geometry/TrackerNumberingBuilder/bin/stubs/GeometricDetLoader.cc +++ /dev/null @@ -1,212 +0,0 @@ -#include "GeometricDetLoader.h" - -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/Event.h" -#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "CondFormats/GeometryObjects/interface/PGeometricDet.h" - -#include "Geometry/Records/interface/IdealGeometryRecord.h" -#include "Geometry/TrackerNumberingBuilder/interface/GeometricDet.h" -#include -#include - -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" - -#include -#include -#include - -// just a reminder to self... beware errors caused by levels. Look -// at how tracker is built and how GeometricSearchTracker.h is built -// up from the hierarchy. - -GeometricDetLoader::GeometricDetLoader(const edm::ParameterSet& iConfig) { - std::cout << "GeometricDetLoader::GeometricDetLoader" << std::endl; -} - -GeometricDetLoader::~GeometricDetLoader() { std::cout << "GeometricDetLoader::~GeometricDetLoader" << std::endl; } - -void GeometricDetLoader::beginRun(edm::Run const& /* iEvent */, edm::EventSetup const& es) { - std::cout << "GeometricDetLoader::beginJob" << std::endl; - PGeometricDet* pgd = new PGeometricDet; - edm::Service mydbservice; - if (!mydbservice.isAvailable()) { - std::cout << "PoolDBOutputService unavailable" << std::endl; - return; - } - edm::ESHandle pDD; - edm::ESHandle rDD; - es.get().get(pDD); - es.get().get(rDD); - const GeometricDet* tracker = &(*rDD); - - // so now I have the tracker itself. loop over all its components to store them. - putOne(tracker, pgd, 0); - std::vector tc = tracker->components(); - std::cout << "Tracker has " << tc.size() << " components." << std::endl; //, lets go through them." << std::endl; - std::vector::const_iterator git = tc.begin(); - std::vector::const_iterator egit = tc.end(); - int count = 0; - int lev = 1; - for (; git != egit; ++git) { // one level below "tracker" - putOne(*git, pgd, lev); - std::vector inone = (*git)->components(); - // << ctste.name((*git)->type()) - // std::cout << lev << " type " << (*git)->type() << " " << int((*git)->geographicalId()) << std::endl; // << " has " << inone.size() << " components." << std::endl; - if (inone.empty()) - ++count; - std::vector::const_iterator git2 = inone.begin(); - std::vector::const_iterator egit2 = inone.end(); - ++lev; - for (; git2 != egit2; ++git2) { // level 2 - putOne(*git2, pgd, lev); - std::vector intwo = (*git2)->components(); - // std::cout << lev << "\ttype " << (*git2)->type() << " " << int((*git2)->geographicalId()) << std::endl; // << " has " << intwo.size() << " components." << std::endl; - if (intwo.empty()) - ++count; - std::vector::const_iterator git3 = intwo.begin(); - std::vector::const_iterator egit3 = intwo.end(); - ++lev; - for (; git3 != egit3; ++git3) { // level 3 - putOne(*git3, pgd, lev); - std::vector inthree = (*git3)->components(); - // std::cout << lev << "\t\ttype " << (*git3)->type() << " " << int((*git3)->geographicalId()) << std::endl; // << " has " << inthree.size() << " components." << std::endl; - if (inthree.empty()) - ++count; - std::vector::const_iterator git4 = inthree.begin(); - std::vector::const_iterator egit4 = inthree.end(); - ++lev; - for (; git4 != egit4; ++git4) { //level 4 - putOne(*git4, pgd, lev); - std::vector infour = (*git4)->components(); - // std::cout << lev << "\t\t\ttype " << (*git4)->type() << " " << int((*git4)->geographicalId()) << std::endl; // << " has " << infour.size() << " components." << std::endl; - if (infour.empty()) - ++count; - std::vector::const_iterator git5 = infour.begin(); - std::vector::const_iterator egit5 = infour.end(); - ++lev; - for (; git5 != egit5; ++git5) { // level 5 - putOne(*git5, pgd, lev); - std::vector infive = (*git5)->components(); - // std::cout << lev << "\t\t\t\ttype " << (*git5)->type() << " " << int((*git5)->geographicalId()) << std::endl; // << " has " << infive.size() << " components." << std::endl; - if (infive.empty()) - ++count; - std::vector::const_iterator git6 = infive.begin(); - std::vector::const_iterator egit6 = infive.end(); - ++lev; - for (; git6 != egit6; ++git6) { //level 6 - putOne(*git6, pgd, lev); - std::vector insix = (*git6)->components(); - // std::cout << lev << "\t\t\t\t\ttype " << (*git6)->type() << " " << int((*git6)->geographicalId()) << std::endl; // << " has " << insix.size() << " components." << std::endl; - if (insix.empty()) - ++count; - } // level 6 - --lev; - } // level 5 - --lev; - } // level 4 - --lev; - } //level 3 - --lev; - } // level 2 - --lev; - } - std::vector modules = tracker->deepComponents(); - std::cout << " No. of Tracker components \"deepComponents\" = " << modules.size() << std::endl; - std::cout << " Counted # of lowest \"leaves\" = " << count << std::endl; - if (mydbservice->isNewTagRequest("PGeometricDetRcd")) { - mydbservice->createNewIOV( - pgd, mydbservice->beginOfTime(), mydbservice->endOfTime(), "PGeometricDetRcd"); - } else { - std::cout << "PGeometricDetRcd Tag is already present." << std::endl; - } -} - -void GeometricDetLoader::putOne(const GeometricDet* gd, PGeometricDet* pgd, int lev) { - // std::cout << "putting name: " << gd->name().name(); - // std::cout << " gid: " << gd->geographicalID(); - // std::cout << " type: " << gd->type() << std::endl; - // std::cout << "shape = " << gd->shape()<<"; name = "<name().name()<<"; parameter number = "<params().size()<translation(); - const DDRotationMatrix& rot = gd->rotation(); - DD3Vector x, y, z; - rot.GetComponents(x, y, z); - item._name = gd->name(); - item._level = lev; - item._x = tran.X(); - item._y = tran.Y(); - item._z = tran.Z(); - item._phi = gd->phi(); - item._rho = gd->rho(); - item._a11 = x.X(); - item._a12 = y.X(); - item._a13 = z.X(); - item._a21 = x.Y(); - item._a22 = y.Y(); - item._a23 = z.Y(); - item._a31 = x.Z(); - item._a32 = y.Z(); - item._a33 = z.Z(); - item._shape = static_cast(gd->shape()); - item._type = gd->type(); - if (gd->shape() == DDSolidShape::ddbox) { - item._params0 = gd->params()[0]; - item._params1 = gd->params()[1]; - item._params2 = gd->params()[2]; - item._params3 = 0; - item._params4 = 0; - item._params5 = 0; - item._params6 = 0; - item._params7 = 0; - item._params8 = 0; - item._params9 = 0; - item._params10 = 0; - } else if (gd->shape() == DDSolidShape::ddtrap) { - item._params0 = gd->params()[0]; - item._params1 = gd->params()[1]; - item._params2 = gd->params()[2]; - item._params3 = gd->params()[3]; - item._params4 = gd->params()[4]; - item._params5 = gd->params()[5]; - item._params6 = gd->params()[6]; - item._params7 = gd->params()[7]; - item._params8 = gd->params()[8]; - item._params9 = gd->params()[9]; - item._params10 = gd->params()[10]; - } else { - item._params0 = 0; - item._params1 = 0; - item._params2 = 0; - item._params3 = 0; - item._params4 = 0; - item._params5 = 0; - item._params6 = 0; - item._params7 = 0; - item._params8 = 0; - item._params9 = 0; - item._params10 = 0; - } - item._geographicalID = gd->geographicalID(); - // FIXME: These are moved to PGeometricDetExtra: - //item._volume = gd->volume(); - //item._density = gd->density(); - //item._weight = gd->weight(); - //item._copy = gd->copyno(); - //item._material = gd->material(); - item._radLength = gd->radLength(); - item._xi = gd->xi(); - item._pixROCRows = gd->pixROCRows(); - item._pixROCCols = gd->pixROCCols(); - item._pixROCx = gd->pixROCx(); - item._pixROCy = gd->pixROCy(); - item._stereo = gd->stereo(); - item._siliconAPVNum = gd->siliconAPVNum(); - pgd->pgeomdets_.push_back(item); -} - -#include "FWCore/Framework/interface/MakerMacros.h" -DEFINE_FWK_MODULE(GeometricDetLoader); diff --git a/Geometry/TrackerNumberingBuilder/bin/stubs/GeometricDetLoader.h b/Geometry/TrackerNumberingBuilder/bin/stubs/GeometricDetLoader.h deleted file mode 100644 index dae6a0905d39f..0000000000000 --- a/Geometry/TrackerNumberingBuilder/bin/stubs/GeometricDetLoader.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef TrackerNumberingBuilder_GeometricDetLoader_h -#define TrackerNumberingBuilder_GeometricDetLoader_h - -#include "FWCore/Framework/interface/one/EDAnalyzer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include - -class GeometricDet; -class PGeometricDet; - -class GeometricDetLoader : public edm::one::EDAnalyzer { -public: - explicit GeometricDetLoader(const edm::ParameterSet& iConfig); - ~GeometricDetLoader() override; - - void beginJob() override {} - void beginRun(edm::Run const& iEvent, edm::EventSetup const&) override; - void analyze(edm::Event const& iEvent, edm::EventSetup const&) override {} - void endRun(edm::Run const& iEvent, edm::EventSetup const&) override {} - void endJob() override {} - -private: - void putOne(const GeometricDet* gd, PGeometricDet* pgd, int lev); -}; - -#endif diff --git a/Geometry/TrackerNumberingBuilder/interface/GeometricDet.h b/Geometry/TrackerNumberingBuilder/interface/GeometricDet.h index 4b1e758e3bcbf..7f0a15d7bdb58 100644 --- a/Geometry/TrackerNumberingBuilder/interface/GeometricDet.h +++ b/Geometry/TrackerNumberingBuilder/interface/GeometricDet.h @@ -2,7 +2,7 @@ #define Geometry_TrackerNumberingBuilder_GeometricDet_H #include "CondFormats/GeometryObjects/interface/PGeometricDet.h" -#include "DetectorDescription/Core/interface/DDSolidShapes.h" +#include "DetectorDescription/DDCMS/interface/DDSolidShapes.h" #include "DataFormats/GeometrySurface/interface/Surface.h" #include "DataFormats/GeometrySurface/interface/Bounds.h" #include "DataFormats/DetId/interface/DetId.h" @@ -118,7 +118,8 @@ class GeometricDet { double phi() const { return _phi; } double rho() const { return _rho; } - DDSolidShape const& shape() const { return _shape; } + LegacySolidShape shape() const { return cms::dd::value(cms::LegacySolidShapeMap, _shape); } + cms::DDSolidShape shape_dd4hep() const { return _shape; } GeometricEnumType type() const { return _type; } std::string const& name() const { return _ddname; } @@ -187,7 +188,7 @@ class GeometricDet { double _phi; double _rho; RotationMatrix _rot; - DDSolidShape _shape; + cms::DDSolidShape _shape; nav_type _ddd; std::string _ddname; GeometricEnumType _type; diff --git a/Geometry/TrackerNumberingBuilder/interface/TrackerShapeToBounds.h b/Geometry/TrackerNumberingBuilder/interface/TrackerShapeToBounds.h index 319f5dabf3aa8..c1beacb8af530 100644 --- a/Geometry/TrackerNumberingBuilder/interface/TrackerShapeToBounds.h +++ b/Geometry/TrackerNumberingBuilder/interface/TrackerShapeToBounds.h @@ -2,7 +2,7 @@ #define Geometry_TrackerNumberingBuilder_TrackerShapeToBounds_H #include "DataFormats/GeometrySurface/interface/Bounds.h" -#include "DetectorDescription/Core/interface/DDSolidShapes.h" +#include "DetectorDescription/DDCMS/interface/DDSolidShapes.h" #include #include /** @@ -13,12 +13,12 @@ class TrackerShapeToBounds { /** *buildBounds() return the Bounds. */ - Bounds* buildBounds(const DDSolidShape&, const std::vector&) const; + Bounds* buildBounds(const cms::DDSolidShape&, const std::vector&) const; private: Bounds* buildBox(const std::vector&) const; Bounds* buildTrap(const std::vector&) const; - Bounds* buildOpen(const std::vector&) const; + Bounds* buildOpen() const; }; #endif diff --git a/Geometry/TrackerNumberingBuilder/src/GeometricDet.cc b/Geometry/TrackerNumberingBuilder/src/GeometricDet.cc index 84fa70c4ef36c..0c0c337d397af 100644 --- a/Geometry/TrackerNumberingBuilder/src/GeometricDet.cc +++ b/Geometry/TrackerNumberingBuilder/src/GeometricDet.cc @@ -73,7 +73,7 @@ GeometricDet::GeometricDet(DDFilteredView* fv, GeometricEnumType type) _phi(_trans.Phi()), _rho(_trans.Rho()), _rot(fv->rotation()), - _shape(fv->shape()), + _shape(cms::dd::name_from_value(cms::LegacySolidShapeMap, fv->shape())), _ddname(fv->name()), _type(type), _params(fv->parameters()), @@ -95,7 +95,7 @@ GeometricDet::GeometricDet(cms::DDFilteredView* fv, GeometricEnumType type) _phi(_trans.Phi()), _rho(_trans.Rho()), _rot(fv->rotation()), - _shape(DDSolidShape(static_cast(fv->shape()))), + _shape(fv->shape()), _ddd(fv->navPos()), _ddname(fv->name()), _type(type), @@ -124,7 +124,7 @@ GeometricDet::GeometricDet(const PGeometricDet::Item& onePGD, GeometricEnumType onePGD._a31, onePGD._a32, onePGD._a33), - _shape(static_cast(onePGD._shape)), + _shape(cms::dd::name_from_value(cms::LegacySolidShapeMap, static_cast(onePGD._shape))), _ddd(), _ddname(onePGD._name), _type(type), diff --git a/Geometry/TrackerNumberingBuilder/src/TrackerShapeToBounds.cc b/Geometry/TrackerNumberingBuilder/src/TrackerShapeToBounds.cc index 2650f05a84920..94dfd4fd38c53 100644 --- a/Geometry/TrackerNumberingBuilder/src/TrackerShapeToBounds.cc +++ b/Geometry/TrackerNumberingBuilder/src/TrackerShapeToBounds.cc @@ -29,25 +29,21 @@ 3. combine the global rotation from DDD with the rotation defined in 2. */ -Bounds* TrackerShapeToBounds::buildBounds(const DDSolidShape& _shape, const std::vector& _par) const { +Bounds* TrackerShapeToBounds::buildBounds(const cms::DDSolidShape& _shape, const std::vector& _par) const { switch (_shape) { - case DDSolidShape::ddbox: + case cms::DDSolidShape::ddbox: return buildBox(_par); break; - case DDSolidShape::ddtrap: + case cms::DDSolidShape::ddtrap: return buildTrap(_par); break; - case DDSolidShape::ddtubs: - return buildOpen(_par); - break; - case DDSolidShape::ddpolycone_rrz: - return buildOpen(_par); - break; - case DDSolidShape::ddsubtraction: - return buildOpen(_par); + case cms::DDSolidShape::ddtubs: + case cms::DDSolidShape::ddpolycone: + case cms::DDSolidShape::ddsubtraction: + return buildOpen(); break; default: - std::cout << "Wrong DDshape to build...." << DDSolidShapesName::name(_shape) << std::endl; + std::cout << "Wrong DDshape to build...." << cms::dd::name(cms::DDSolidShapeMap, _shape) << std::endl; Bounds* bounds = nullptr; return bounds; } @@ -106,7 +102,7 @@ Bounds* TrackerShapeToBounds::buildTrap(const std::vector& paras) const return bounds; } -Bounds* TrackerShapeToBounds::buildOpen(const std::vector& paras) const { +Bounds* TrackerShapeToBounds::buildOpen() const { OpenBounds* bounds = new OpenBounds(); return bounds; }