Skip to content

Commit

Permalink
Merge remote-tracking branch 'official-cmssw/master' into BTV_dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Link committed Apr 8, 2021
2 parents 18fa48e + a851ab9 commit 56ef8c1
Show file tree
Hide file tree
Showing 4,846 changed files with 256,542 additions and 451,924 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ __init__.py
.#*
#*#
*~
*.pb
8 changes: 4 additions & 4 deletions Alignment/APEEstimation/plugins/ApeEstimator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2571,14 +2571,14 @@ bool ApeEstimator::isHit2D(const TrackingRecHit& hit) const {
const ProjectedSiStripRecHit2D* pH = static_cast<const ProjectedSiStripRecHit2D*>(&hit);
return (this->isHit2D(pH->originalHit())); // depends on original...
} else {
edm::LogError("UnkownType") << "@SUB=AlignmentTrackSelector::isHit2D"
<< "Tracker hit not in pixel, neither SiStripRecHit[12]D nor "
<< "SiStripMatchedRecHit2D nor ProjectedSiStripRecHit2D.";
edm::LogError("UnknownType") << "@SUB=ApeEstimator::isHit2D"
<< "Tracker hit not in pixel, neither SiStripRecHit[12]D nor "
<< "SiStripMatchedRecHit2D nor ProjectedSiStripRecHit2D.";
return false;
}
}
} else { // not tracker??
edm::LogWarning("DetectorMismatch") << "@SUB=AlignmentTrackSelector::isHit2D"
edm::LogWarning("DetectorMismatch") << "@SUB=ApeEstimator::isHit2D"
<< "Hit not in tracker with 'official' dimension >=2.";
return true; // dimension() >= 2 so accept that...
}
Expand Down
23 changes: 11 additions & 12 deletions Alignment/CocoaApplication/src/CocoaAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "CondCore/DBOutputService/interface/PoolDBOutputService.h"
#include "CondFormats/DataRecord/interface/OpticalAlignmentsRcd.h"
#include "CondFormats/OptAlignObjects/interface/OpticalAlignMeasurementInfo.h"
#include "DataFormats/Math/interface/CMSUnits.h"
#include <DD4hep/DD4hepUnits.h>
#include "DetectorDescription/DDCMS/interface/DDCompactView.h"
#include "DetectorDescription/DDCMS/interface/DDFilteredView.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
Expand Down Expand Up @@ -51,8 +51,6 @@ class CocoaAnalyzer : public edm::one::EDAnalyzer<edm::one::SharedResources> {
std::string theCocoaDaqRootFileName_;
};

using namespace cms_units::operators;

CocoaAnalyzer::CocoaAnalyzer(edm::ParameterSet const& pset) {
theCocoaDaqRootFileName_ = pset.getParameter<std::string>("cocoaDaqRootFile");
int maxEvents = pset.getParameter<int32_t>("maxEvents");
Expand Down Expand Up @@ -180,41 +178,41 @@ void CocoaAnalyzer::readXMLFile(const edm::EventSetup& evts) {
const dd4hep::Direction& transl = myPlacedVolume.position();

if (ALIUtils::debug >= 4) {
edm::LogInfo("Alignment") << "Local translation in cm = " << transl;
edm::LogInfo("Alignment") << "Local translation in dd4hep units = " << transl;
}

// B) READ INFO FROM XMLS
// X
oaInfo.x_.name_ = "X";
oaInfo.x_.dim_type_ = "centre";
oaInfo.x_.value_ = transl.x() / (1._m); // COCOA units are m
oaInfo.x_.value_ = transl.x() / dd4hep::m; // COCOA units are m
oaInfo.x_.error_ = cms::getParameterValueFromSpecParSections<double>(allSpecParSections,
nodePath,
"centre_X_sigma",
0) /
(1._m); // COCOA units are m
dd4hep::m; // COCOA units are m
oaInfo.x_.quality_ = static_cast<int>(
cms::getParameterValueFromSpecParSections<double>(allSpecParSections, nodePath, "centre_X_quality", 0));
// Y
oaInfo.y_.name_ = "Y";
oaInfo.y_.dim_type_ = "centre";
oaInfo.y_.value_ = transl.y() / (1._m); // COCOA units are m
oaInfo.y_.value_ = transl.y() / dd4hep::m; // COCOA units are m
oaInfo.y_.error_ = cms::getParameterValueFromSpecParSections<double>(allSpecParSections,
nodePath,
"centre_Y_sigma",
0) /
(1._m); // COCOA units are m
dd4hep::m; // COCOA units are m
oaInfo.y_.quality_ = static_cast<int>(
cms::getParameterValueFromSpecParSections<double>(allSpecParSections, nodePath, "centre_Y_quality", 0));
// Z
oaInfo.z_.name_ = "Z";
oaInfo.z_.dim_type_ = "centre";
oaInfo.z_.value_ = transl.z() / (1._m); // COCOA units are m
oaInfo.z_.value_ = transl.z() / dd4hep::m; // COCOA units are m
oaInfo.z_.error_ = cms::getParameterValueFromSpecParSections<double>(allSpecParSections,
nodePath,
"centre_Z_sigma",
0) /
(1._m); // COCOA units are m
dd4hep::m; // COCOA units are m
oaInfo.z_.quality_ = static_cast<int>(
cms::getParameterValueFromSpecParSections<double>(allSpecParSections, nodePath, "centre_Z_quality", 0));

Expand Down Expand Up @@ -328,7 +326,8 @@ void CocoaAnalyzer::readXMLFile(const edm::EventSetup& evts) {
double dimFactor = 1.;
const std::string& type = dims[i];
if (type == "centre" || type == "length") {
dimFactor = 1. / (1._m); // was converted to cm with getParameterValueFromSpecPar, COCOA unit is m
dimFactor =
1. / dd4hep::m; // was converted to dd4hep unit with getParameterValueFromSpecPar, COCOA unit is m
} else if (type == "angles" || type == "angle" || type == "nodim") {
dimFactor = 1.;
}
Expand Down Expand Up @@ -546,7 +545,7 @@ void CocoaAnalyzer::correctOpticalAlignmentParameter(OpticalAlignParam& myXMLPar
double dimFactor = 1.;

if (type == "centre" || type == "length") {
dimFactor = 1. / 1._m; // in DB it is in cm
dimFactor = 1. / dd4hep::m; // in DB values are stored in dd4hep unit
} else if (type == "angles" || type == "angle" || type == "nodim") {
dimFactor = 1.;
} else {
Expand Down
1 change: 1 addition & 0 deletions Alignment/CocoaFit/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<use name="DataFormats/GeometryCommonDetAlgo"/>
<use name="FWCore/ServiceRegistry"/>
<use name="Geometry/Records"/>
<use name="dd4hep"/>
<export>
<lib name="1"/>
</export>
35 changes: 18 additions & 17 deletions Alignment/CocoaFit/src/CocoaDBMgr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "CondFormats/Alignment/interface/AlignTransform.h"
#include "CondFormats/Alignment/interface/AlignTransformErrorExtended.h"
#include "DataFormats/GeometryCommonDetAlgo/interface/GlobalError.h"
#include "DataFormats/Math/interface/CMSUnits.h"
#include <DD4hep/DD4hepUnits.h>
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "CondCore/DBOutputService/interface/PoolDBOutputService.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
Expand Down Expand Up @@ -32,8 +32,6 @@

#include "CondCore/CondDB/interface/Serialization.h"

using namespace cms_units::operators;

CocoaDBMgr* CocoaDBMgr::instance = nullptr;

//----------------------------------------------------------------------
Expand Down Expand Up @@ -186,26 +184,26 @@ OpticalAlignInfo CocoaDBMgr::GetOptAlignInfoFromOptO(OpticalObject* opto) {
OpticalAlignParam translationXDataForDB;
translationXDataForDB.name_ = translationX->name();
translationXDataForDB.dim_type_ = translationX->type();
translationXDataForDB.value_ = centreLocal.x() * 1._m; // m in COCOA, cm in DB
translationXDataForDB.error_ = GetEntryError(translationX) * 1._m; // m in COCOA, cm in DB
translationXDataForDB.value_ = centreLocal.x() * dd4hep::m; // m in COCOA, dd4hep unit in DB
translationXDataForDB.error_ = GetEntryError(translationX) * dd4hep::m; // m in COCOA, dd4hep unit in DB
translationXDataForDB.quality_ = translationX->quality();
data.x_ = translationXDataForDB;

const Entry* const translationY = theCoordinateEntryVector.at(1);
OpticalAlignParam translationYDataForDB;
translationYDataForDB.name_ = translationY->name();
translationYDataForDB.dim_type_ = translationY->type();
translationYDataForDB.value_ = centreLocal.y() * 1._m; // m in COCOA, cm in DB
translationYDataForDB.error_ = GetEntryError(translationY) * 1._m; // m in COCOA, cm in DB
translationYDataForDB.value_ = centreLocal.y() * dd4hep::m; // m in COCOA, dd4hep unit in DB
translationYDataForDB.error_ = GetEntryError(translationY) * dd4hep::m; // m in COCOA, dd4hep unit in DB
translationYDataForDB.quality_ = translationY->quality();
data.y_ = translationYDataForDB;

const Entry* const translationZ = theCoordinateEntryVector.at(2);
OpticalAlignParam translationZDataForDB;
translationZDataForDB.name_ = translationZ->name();
translationZDataForDB.dim_type_ = translationZ->type();
translationZDataForDB.value_ = centreLocal.z() * 1._m; // m in COCOA, cm in DB
translationZDataForDB.error_ = GetEntryError(translationZ) * 1._m; // m in COCOA, cm in DB
translationZDataForDB.value_ = centreLocal.z() * dd4hep::m; // m in COCOA, dd4hep unit in DB
translationZDataForDB.error_ = GetEntryError(translationZ) * dd4hep::m; // m in COCOA, dd4hep unit in DB
translationZDataForDB.quality_ = translationZ->quality();
data.z_ = translationZDataForDB;

Expand Down Expand Up @@ -249,8 +247,8 @@ OpticalAlignInfo CocoaDBMgr::GetOptAlignInfoFromOptO(OpticalObject* opto) {
extraEntry.value_ = myDBExtraEntry->value();
extraEntry.error_ = myDBExtraEntry->sigma();
if (extraEntry.dim_type_ == "centre" || extraEntry.dim_type_ == "length") {
extraEntry.value_ *= 1._m; // m in COCOA, cm in DB
extraEntry.error_ *= 1._m; // m in COCOA, cm in DB
extraEntry.value_ *= dd4hep::m; // m in COCOA, dd4hep unit in DB
extraEntry.error_ *= dd4hep::m; // m in COCOA, dd4hep unit in DB
}
extraEntry.quality_ = myDBExtraEntry->quality();
data.extraEntries_.emplace_back(extraEntry);
Expand Down Expand Up @@ -365,12 +363,15 @@ AlignTransformErrorExtended* CocoaDBMgr::GetAlignInfoErrorFromOptO(OpticalObject
CLHEP::HepMatrix errm(3, 3);
const std::vector<Entry*>& theCoordinateEntryVector = opto->CoordinateEntryList();
std::cout << "@@@ CocoaDBMgr::GetAlignInfoFromOptOfill errm " << opto->name() << std::endl;
errm(0, 0) = GetEntryError(theCoordinateEntryVector[0]) * 1._m; // m in COCOA, cm in DB
errm(1, 1) = GetEntryError(theCoordinateEntryVector[1]) * 1._m; // m in COCOA, cm in DB
errm(2, 2) = GetEntryError(theCoordinateEntryVector[2]) * 1._m; // m in COCOA, cm in DB
errm(0, 1) = GetEntryError(theCoordinateEntryVector[0], theCoordinateEntryVector[1]) * 1._m; // m in COCOA, cm in DB
errm(0, 2) = GetEntryError(theCoordinateEntryVector[0], theCoordinateEntryVector[2]) * 1._m; // m in COCOA, cm in DB
errm(1, 2) = GetEntryError(theCoordinateEntryVector[1], theCoordinateEntryVector[2]) * 1._m; // m in COCOA, cm in DB
errm(0, 0) = GetEntryError(theCoordinateEntryVector[0]) * dd4hep::m; // m in COCOA, dd4hep unit in DB
errm(1, 1) = GetEntryError(theCoordinateEntryVector[1]) * dd4hep::m; // m in COCOA, dd4hep unit in DB
errm(2, 2) = GetEntryError(theCoordinateEntryVector[2]) * dd4hep::m; // m in COCOA, dd4hep unit in DB
errm(0, 1) = GetEntryError(theCoordinateEntryVector[0], theCoordinateEntryVector[1]) *
dd4hep::m; // m in COCOA, dd4hep unit in DB
errm(0, 2) = GetEntryError(theCoordinateEntryVector[0], theCoordinateEntryVector[2]) *
dd4hep::m; // m in COCOA, dd4hep unit in DB
errm(1, 2) = GetEntryError(theCoordinateEntryVector[1], theCoordinateEntryVector[2]) *
dd4hep::m; // m in COCOA, dd4hep unit in DB
// errm(1,0) = errm(0,1);
// errm(2,0) = errm(0,2);
// errm(2,1) = errm(1,2);
Expand Down
5 changes: 3 additions & 2 deletions Alignment/CommonAlignment/interface/AlignableObjectId.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
class TrackerGeometry;
class DTGeometry;
class CSCGeometry;
class GEMGeometry;

/// Allows conversion between type and name, and vice-versa
class AlignableObjectId {
Expand All @@ -15,7 +16,7 @@ class AlignableObjectId {
enum class Geometry { RunI, PhaseI, PhaseII, General, Unspecified };

AlignableObjectId(Geometry);
AlignableObjectId(const TrackerGeometry*, const DTGeometry*, const CSCGeometry*);
AlignableObjectId(const TrackerGeometry*, const DTGeometry*, const CSCGeometry*, const GEMGeometry*);
AlignableObjectId(const AlignableObjectId&) = default;
AlignableObjectId& operator=(const AlignableObjectId&) = default;
AlignableObjectId(AlignableObjectId&&) = default;
Expand Down Expand Up @@ -43,7 +44,7 @@ class AlignableObjectId {

private:
static Geometry trackerGeometry(const TrackerGeometry*);
static Geometry muonGeometry(const DTGeometry*, const CSCGeometry*);
static Geometry muonGeometry(const DTGeometry*, const CSCGeometry*, const GEMGeometry*);

const entry* entries_{nullptr};
Geometry geometry_{Geometry::Unspecified};
Expand Down
6 changes: 6 additions & 0 deletions Alignment/CommonAlignment/interface/StructureType.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ namespace align {
AlignableCSCRing,
AlignableCSCChamber,
AlignableCSCLayer, // = 110
AlignableGEMEndcap,
AlignableGEMStation,
AlignableGEMRing,
AlignableGEMSuperChamber,
AlignableGEMChamber,
AlignableGEMEtaPartition,
AlignableMuon,

Detector, // = 112 (what for?)
Expand Down
13 changes: 7 additions & 6 deletions Alignment/CommonAlignment/plugins/APVModeFilter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/stream/EDFilter.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/Exception.h"
Expand Down Expand Up @@ -74,6 +73,9 @@ class APVModeFilter : public edm::stream::EDFilter<> {

// ----------member data ---------------------------

// esConsumes
const edm::ESGetToken<SiStripLatency, SiStripLatencyRcd> latencyToken_;

/// bits of interest for the APV mode
static constexpr std::array<size_t, 2> bits_ = {{1, 3}};
static constexpr BitMask deco_ = BitMask(0); /// deco mode bit mask (0000)
Expand All @@ -96,7 +98,8 @@ constexpr APVModeFilter::BitMask APVModeFilter::multi_;
// constructors and destructor
//
APVModeFilter::APVModeFilter(const edm::ParameterSet& iConfig)
: mode_(convertMode(iConfig.getUntrackedParameter<std::string>("apvMode"))) {
: latencyToken_(esConsumes<edm::Transition::BeginRun>()),
mode_(convertMode(iConfig.getUntrackedParameter<std::string>("apvMode"))) {
edm::LogInfo("Alignment") << "@SUB=APVModeFilter::APVModeFilter"
<< "Selecting events with APV mode '"
<< iConfig.getUntrackedParameter<std::string>("apvMode") << "'.";
Expand All @@ -111,10 +114,8 @@ bool APVModeFilter::filter(edm::Event&, const edm::EventSetup&) { return mode_ =

// ------------ method called when starting to processes a run ------------
void APVModeFilter::beginRun(const edm::Run&, const edm::EventSetup& iSetup) {
edm::ESHandle<SiStripLatency> siStripLatency;
iSetup.get<SiStripLatencyRcd>().get(siStripLatency);
auto product = siStripLatency.product();
modeCurrentRun_ = convertMode(product->singleMode());
const auto& siStripLatency = &iSetup.getData(latencyToken_);
modeCurrentRun_ = convertMode(siStripLatency->singleMode());
}

APVModeFilter::BitMask APVModeFilter::convertMode(const std::string& mode) const {
Expand Down
13 changes: 8 additions & 5 deletions Alignment/CommonAlignment/plugins/MagneticFieldFilter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/stream/EDFilter.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "CondFormats/RunInfo/interface/RunInfo.h"
Expand All @@ -52,6 +51,10 @@ class MagneticFieldFilter : public edm::stream::EDFilter<> {
float currentToField(const float& current) const;

// ----------member data ---------------------------

// esConsumes
const edm::ESGetToken<RunInfo, RunInfoRcd> runInfoToken_;

/// see: https://hypernews.cern.ch/HyperNews/CMS/get/magnetic-field/63/1/1/1.html
static constexpr float linearCoeffCurrentToField_ = 2.084287e-04;
/// see: https://hypernews.cern.ch/HyperNews/CMS/get/magnetic-field/63/1/1/1.html
Expand All @@ -71,7 +74,9 @@ constexpr float MagneticFieldFilter::constantTermCurrentToField_;
// constructor
//
MagneticFieldFilter::MagneticFieldFilter(const edm::ParameterSet& iConfig)
: magneticField_(iConfig.getUntrackedParameter<int>("magneticField")), magneticFieldCurrentRun_(-10000) {}
: runInfoToken_(esConsumes<edm::Transition::BeginRun>()),
magneticField_(iConfig.getUntrackedParameter<int>("magneticField")),
magneticFieldCurrentRun_(-10000) {}

//
// member functions
Expand All @@ -85,9 +90,7 @@ bool MagneticFieldFilter::filter(edm::Event&, const edm::EventSetup&) {
// ------------ method called when starting to processes a run ------------

void MagneticFieldFilter::beginRun(const edm::Run&, const edm::EventSetup& iSetup) {
edm::ESHandle<RunInfo> sum;
iSetup.get<RunInfoRcd>().get(sum);
auto summary = sum.product();
const auto& summary = &iSetup.getData(runInfoToken_);
// convert from Tesla to kGauss (multiply with 10) and
// round off to whole kGauss (add 0.5 and cast to int) as is done in
// 'MagneticField::computeNominalValue()':
Expand Down
2 changes: 1 addition & 1 deletion Alignment/CommonAlignment/src/AlignableCompositeBuilder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ AlignableCompositeBuilder ::AlignableCompositeBuilder(const TrackerTopology* tra
const TrackerGeometry* trackerGeometry,
const AlignableIndexer& alignableIndexer)
: trackerTopology_(trackerTopology),
alignableObjectId_(trackerGeometry, nullptr, nullptr),
alignableObjectId_(trackerGeometry, nullptr, nullptr, nullptr),
alignableIndexer_(alignableIndexer) {}

//_____________________________________________________________________________
Expand Down
Loading

0 comments on commit 56ef8c1

Please sign in to comment.