Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

/*** Alignment ***/
#include "Alignment/MillePedeAlignmentAlgorithm/interface/PedeLabelerBase.h"
#include "CondFormats/PCLConfig/interface/AlignPCLThresholds.h"
#include "CondFormats/PCLConfig/interface/AlignPCLThresholdsHG.h"

struct mpPCLresults {
private:
Expand Down Expand Up @@ -59,7 +59,7 @@ class MillePedeFileReader {
public: //====================================================================
explicit MillePedeFileReader(const edm::ParameterSet&,
const std::shared_ptr<const PedeLabelerBase>&,
const std::shared_ptr<const AlignPCLThresholds>&);
const std::shared_ptr<const AlignPCLThresholdsHG>&);

virtual ~MillePedeFileReader() = default;

Expand All @@ -81,7 +81,7 @@ class MillePedeFileReader {
const std::array<double, 6>& getTZobs() const { return tZobs_; }
const std::array<double, 6>& getTZobsErr() const { return tZobsErr_; }

const AlignPCLThresholds::threshold_map getThresholdMap() const { return theThresholds_.get()->getThreshold_Map(); }
const AlignPCLThresholdsHG::threshold_map getThresholdMap() const { return theThresholds_.get()->getThreshold_Map(); }

const int binariesAmount() const { return binariesAmount_; }

Expand Down Expand Up @@ -119,7 +119,7 @@ class MillePedeFileReader {
const std::shared_ptr<const PedeLabelerBase> pedeLabeler_;

// thresholds from DB
const std::shared_ptr<const AlignPCLThresholds> theThresholds_;
const std::shared_ptr<const AlignPCLThresholdsHG> theThresholds_;

// file-names
const std::string millePedeEndFile_;
Expand Down Expand Up @@ -168,8 +168,8 @@ class MillePedeFileReader {
};

const std::array<std::string, 8> coord_str = {{"X", "Y", "Z", "theta_X", "theta_Y", "theta_Z", "extra_DOF", "none"}};
inline std::ostream& operator<<(std::ostream& os, const AlignPCLThresholds::coordType& c) {
if (c >= AlignPCLThresholds::endOfTypes || c < AlignPCLThresholds::X)
inline std::ostream& operator<<(std::ostream& os, const AlignPCLThresholdsHG::coordType& c) {
if (c >= AlignPCLThresholdsHG::endOfTypes || c < AlignPCLThresholdsHG::X)
return os << "unrecongnized coordinate";
return os << coord_str[c];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ using namespace gbl;
MillePedeAlignmentAlgorithm::MillePedeAlignmentAlgorithm(const edm::ParameterSet &cfg, edm::ConsumesCollector &iC)
: AlignmentAlgorithmBase(cfg, iC),
topoToken_(iC.esConsumes<TrackerTopology, TrackerTopologyRcd, edm::Transition::BeginRun>()),
aliThrToken_(iC.esConsumes<AlignPCLThresholds, AlignPCLThresholdsRcd, edm::Transition::BeginRun>()),
aliThrToken_(iC.esConsumes<AlignPCLThresholdsHG, AlignPCLThresholdsHGRcd, edm::Transition::BeginRun>()),
theConfig(cfg),
theMode(this->decodeMode(theConfig.getUntrackedParameter<std::string>("mode"))),
theDir(theConfig.getUntrackedParameter<std::string>("fileDir")),
Expand Down Expand Up @@ -183,7 +183,7 @@ void MillePedeAlignmentAlgorithm::initialize(const edm::EventSetup &setup,
//Retrieve the thresolds cuts from DB for the PCL
if (runAtPCL_) {
const auto &th = &setup.getData(aliThrToken_);
theThresholds = std::make_shared<AlignPCLThresholds>();
theThresholds = std::make_shared<AlignPCLThresholdsHG>();
storeThresholds(th->getNrecords(), th->getThreshold_Map());
}

Expand Down Expand Up @@ -301,7 +301,7 @@ bool MillePedeAlignmentAlgorithm::addCalibrations(const std::vector<IntegratedCa

//____________________________________________________
bool MillePedeAlignmentAlgorithm::storeThresholds(const int &nRecords,
const AlignPCLThresholds::threshold_map &thresholdMap) {
const AlignPCLThresholdsHG::threshold_map &thresholdMap) {
theThresholds->setAlignPCLThresholds(nRecords, thresholdMap);
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
#include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
#include "Geometry/Records/interface/TrackerTopologyRcd.h"

#include "CondFormats/PCLConfig/interface/AlignPCLThresholds.h"
#include "CondFormats/DataRecord/interface/AlignPCLThresholdsRcd.h"
#include "CondFormats/PCLConfig/interface/AlignPCLThresholdsHG.h"
#include "CondFormats/DataRecord/interface/AlignPCLThresholdsHGRcd.h"

#include <vector>
#include <string>
Expand Down Expand Up @@ -76,7 +76,7 @@ class MillePedeAlignmentAlgorithm : public AlignmentAlgorithmBase {
/// Pass integrated calibrations to Millepede (they are not owned by Millepede!)
bool addCalibrations(const std::vector<IntegratedCalibrationBase *> &iCals) override;

virtual bool storeThresholds(const int &nRecords, const AlignPCLThresholds::threshold_map &thresholdMap);
virtual bool storeThresholds(const int &nRecords, const AlignPCLThresholdsHG::threshold_map &thresholdMap);

/// Called at end of job
void terminate(const edm::EventSetup &iSetup) override;
Expand Down Expand Up @@ -271,7 +271,7 @@ class MillePedeAlignmentAlgorithm : public AlignmentAlgorithmBase {
//--------------------------------------------------------

const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> topoToken_;
const edm::ESGetToken<AlignPCLThresholds, AlignPCLThresholdsRcd> aliThrToken_;
const edm::ESGetToken<AlignPCLThresholdsHG, AlignPCLThresholdsHGRcd> aliThrToken_;

enum EModeBit { myMilleBit = 1 << 0, myPedeRunBit = 1 << 1, myPedeSteerBit = 1 << 2, myPedeReadBit = 1 << 3 };
unsigned int decodeMode(const std::string &mode) const;
Expand All @@ -291,7 +291,7 @@ class MillePedeAlignmentAlgorithm : public AlignmentAlgorithmBase {
std::unique_ptr<PedeSteerer> thePedeSteer;
std::unique_ptr<TrajectoryFactoryBase> theTrajectoryFactory;
std::vector<IntegratedCalibrationBase *> theCalibrations;
std::shared_ptr<AlignPCLThresholds> theThresholds;
std::shared_ptr<AlignPCLThresholdsHG> theThresholds;
unsigned int theMinNumHits;
double theMaximalCor2D; /// maximal correlation allowed for 2D hit in TID/TEC.
/// If larger, the 2D measurement gets diagonalized!!!
Expand Down
32 changes: 18 additions & 14 deletions Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeDQMModule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void MillePedeDQMModule ::beginRun(const edm::Run&, const edm::EventSetup& setup
// take the thresholds from DB
const auto& thresholds_ = &setup.getData(aliThrToken_);

auto myThresholds = std::make_shared<AlignPCLThresholds>();
auto myThresholds = std::make_shared<AlignPCLThresholdsHG>();
myThresholds->setAlignPCLThresholds(thresholds_->getNrecords(), thresholds_->getThreshold_Map());

TrackerGeomBuilderFromGeometricDet builder;
Expand All @@ -110,7 +110,7 @@ void MillePedeDQMModule ::beginRun(const edm::Run&, const edm::EventSetup& setup
labelerPlugin, PedeLabelerBase::TopLevelAlignables(tracker_.get(), nullptr, nullptr), labelerConfig)};

mpReader_ = std::make_unique<MillePedeFileReader>(
mpReaderConfig_, pedeLabeler, std::shared_ptr<const AlignPCLThresholds>(myThresholds));
mpReaderConfig_, pedeLabeler, std::shared_ptr<const AlignPCLThresholdsHG>(myThresholds));
}

void MillePedeDQMModule ::fillStatusHisto(MonitorElement* statusHisto) {
Expand All @@ -132,14 +132,14 @@ void MillePedeDQMModule ::fillStatusHisto(MonitorElement* statusHisto) {
}

void MillePedeDQMModule ::fillExpertHistos() {
std::array<double, 6> Xcut_, sigXcut_, maxMoveXcut_, maxErrorXcut_;
std::array<double, 6> tXcut_, sigtXcut_, maxMovetXcut_, maxErrortXcut_;
std::array<double, SIZE_INDEX> Xcut_, sigXcut_, maxMoveXcut_, maxErrorXcut_;
std::array<double, SIZE_INDEX> tXcut_, sigtXcut_, maxMovetXcut_, maxErrortXcut_;

std::array<double, 6> Ycut_, sigYcut_, maxMoveYcut_, maxErrorYcut_;
std::array<double, 6> tYcut_, sigtYcut_, maxMovetYcut_, maxErrortYcut_;
std::array<double, SIZE_INDEX> Ycut_, sigYcut_, maxMoveYcut_, maxErrorYcut_;
std::array<double, SIZE_INDEX> tYcut_, sigtYcut_, maxMovetYcut_, maxErrortYcut_;

std::array<double, 6> Zcut_, sigZcut_, maxMoveZcut_, maxErrorZcut_;
std::array<double, 6> tZcut_, sigtZcut_, maxMovetZcut_, maxErrortZcut_;
std::array<double, SIZE_INDEX> Zcut_, sigZcut_, maxMoveZcut_, maxErrorZcut_;
std::array<double, SIZE_INDEX> tZcut_, sigtZcut_, maxMovetZcut_, maxErrortZcut_;

auto myMap = mpReader_->getThresholdMap();

Expand Down Expand Up @@ -196,12 +196,12 @@ void MillePedeDQMModule ::fillExpertHistos() {
}

void MillePedeDQMModule ::fillExpertHisto(MonitorElement* histo,
const std::array<double, 6>& cut,
const std::array<double, 6>& sigCut,
const std::array<double, 6>& maxMoveCut,
const std::array<double, 6>& maxErrorCut,
const std::array<double, 6>& obs,
const std::array<double, 6>& obsErr) {
const std::array<double, SIZE_INDEX>& cut,
const std::array<double, SIZE_INDEX>& sigCut,
const std::array<double, SIZE_INDEX>& maxMoveCut,
const std::array<double, SIZE_INDEX>& maxErrorCut,
const std::array<double, SIZE_LG_STRUCTS>& obs,
const std::array<double, SIZE_LG_STRUCTS>& obsErr) {
TH1F* histo_0 = histo->getTH1F();

double max_ = *std::max_element(maxMoveCut.begin(), maxMoveCut.end());
Expand Down Expand Up @@ -264,6 +264,10 @@ int MillePedeDQMModule ::getIndexFromString(const std::string& alignableId) {
return 5;
} else if (alignableId == "TPEHalfCylinderXplusZplus") {
return 4;
} else if (alignableId.rfind("TPBLadder", 0) == 0) {
return 6;
} else if (alignableId.rfind("TPEPanel", 0) == 0) {
return 7;
} else {
throw cms::Exception("LogicError") << "@SUB=MillePedeDQMModule::getIndexFromString\n"
<< "Retrieving conversion for not supported Alignable partition" << alignableId;
Expand Down
18 changes: 10 additions & 8 deletions Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeDQMModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeomBuilderFromGeometricDet.h"

/*** Thresholds from DB ***/
#include "CondFormats/DataRecord/interface/AlignPCLThresholdsRcd.h"
#include "CondFormats/DataRecord/interface/AlignPCLThresholdsHGRcd.h"

/*** DQM ***/
#include "DQMServices/Core/interface/DQMEDHarvester.h"
Expand All @@ -53,6 +53,8 @@ class MillePedeDQMModule : public DQMEDHarvester {

void dqmEndJob(DQMStore::IBooker&, DQMStore::IGetter&) override;

enum { SIZE_LG_STRUCTS = 6, SIZE_INDEX = 8 };

//========================= PRIVATE METHODS ==================================
private: //===================================================================
void beginRun(const edm::Run&, const edm::EventSetup&) override;
Expand All @@ -64,12 +66,12 @@ class MillePedeDQMModule : public DQMEDHarvester {
void fillExpertHistos();

void fillExpertHisto(MonitorElement* histo,
const std::array<double, 6>& cut,
const std::array<double, 6>& sigCut,
const std::array<double, 6>& maxMoveCut,
const std::array<double, 6>& maxErrorCut,
const std::array<double, 6>& obs,
const std::array<double, 6>& obsErr);
const std::array<double, SIZE_INDEX>& cut,
const std::array<double, SIZE_INDEX>& sigCut,
const std::array<double, SIZE_INDEX>& maxMoveCut,
const std::array<double, SIZE_INDEX>& maxErrorCut,
const std::array<double, SIZE_LG_STRUCTS>& obs,
const std::array<double, SIZE_LG_STRUCTS>& obsErr);

bool setupChanged(const edm::EventSetup&);
int getIndexFromString(const std::string& alignableId);
Expand All @@ -82,7 +84,7 @@ class MillePedeDQMModule : public DQMEDHarvester {
const edm::ESGetToken<GeometricDet, IdealGeometryRecord> gDetToken_;
const edm::ESGetToken<PTrackerParameters, PTrackerParametersRcd> ptpToken_;
const edm::ESGetToken<PTrackerAdditionalParametersPerDet, PTrackerAdditionalParametersPerDetRcd> ptitpToken_;
const edm::ESGetToken<AlignPCLThresholds, AlignPCLThresholdsRcd> aliThrToken_;
const edm::ESGetToken<AlignPCLThresholdsHG, AlignPCLThresholdsHGRcd> aliThrToken_;

const edm::ParameterSet mpReaderConfig_;
std::unique_ptr<AlignableTracker> tracker_;
Expand Down
16 changes: 8 additions & 8 deletions Alignment/MillePedeAlignmentAlgorithm/src/MillePedeFileReader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

MillePedeFileReader ::MillePedeFileReader(const edm::ParameterSet& config,
const std::shared_ptr<const PedeLabelerBase>& pedeLabeler,
const std::shared_ptr<const AlignPCLThresholds>& theThresholds)
const std::shared_ptr<const AlignPCLThresholdsHG>& theThresholds)
: pedeLabeler_(pedeLabeler),
theThresholds_(theThresholds),
millePedeEndFile_(config.getParameter<std::string>("millePedeEndFile")),
Expand Down Expand Up @@ -142,32 +142,32 @@ void MillePedeFileReader ::readMillePedeResultFile() {

auto det = getHLS(alignable);
int detIndex = static_cast<int>(det);
auto coord = static_cast<AlignPCLThresholds::coordType>(alignableIndex);
auto coord = static_cast<AlignPCLThresholdsHG::coordType>(alignableIndex);
std::string detLabel = getStringFromHLS(det);

if (det != PclHLS::NotInPCL) {
switch (coord) {
case AlignPCLThresholds::X:
case AlignPCLThresholdsHG::X:
Xobs_[detIndex] = ObsMove;
XobsErr_[detIndex] = ObsErr;
break;
case AlignPCLThresholds::Y:
case AlignPCLThresholdsHG::Y:
Yobs_[detIndex] = ObsMove;
YobsErr_[detIndex] = ObsErr;
break;
case AlignPCLThresholds::Z:
case AlignPCLThresholdsHG::Z:
Zobs_[detIndex] = ObsMove;
ZobsErr_[detIndex] = ObsErr;
break;
case AlignPCLThresholds::theta_X:
case AlignPCLThresholdsHG::theta_X:
tXobs_[detIndex] = ObsMove;
tXobsErr_[detIndex] = ObsErr;
break;
case AlignPCLThresholds::theta_Y:
case AlignPCLThresholdsHG::theta_Y:
tYobs_[detIndex] = ObsMove;
tYobsErr_[detIndex] = ObsErr;
break;
case AlignPCLThresholds::theta_Z:
case AlignPCLThresholdsHG::theta_Z:
tZobs_[detIndex] = ObsMove;
tZobsErr_[detIndex] = ObsErr;
break;
Expand Down
3 changes: 3 additions & 0 deletions CondCore/PCLConfigPlugins/src/plugin.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#include "CondCore/ESSources/interface/registration_macros.h"
#include "CondFormats/PCLConfig/interface/AlignPCLThresholds.h"
#include "CondFormats/PCLConfig/interface/AlignPCLThresholdsHG.h"
#include "CondFormats/DataRecord/interface/AlignPCLThresholdsRcd.h"
#include "CondFormats/DataRecord/interface/AlignPCLThresholdsHGRcd.h"

REGISTER_PLUGIN(AlignPCLThresholdsRcd, AlignPCLThresholds);
REGISTER_PLUGIN(AlignPCLThresholdsHGRcd, AlignPCLThresholdsHG);
1 change: 1 addition & 0 deletions CondCore/Utilities/plugins/Module_2XML.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ PAYLOAD_2XML_MODULE(pluginUtilities_payload2xml) {
m.def("boost_version_label", &cond::boost_version_label, "Get boost version for this release");
PAYLOAD_2XML_CLASS(AlCaRecoTriggerBits);
PAYLOAD_2XML_CLASS(AlignPCLThresholds);
PAYLOAD_2XML_CLASS(AlignPCLThresholdsHG);
PAYLOAD_2XML_CLASS(AlignmentErrors);
PAYLOAD_2XML_CLASS(AlignmentErrorsExtended);
PAYLOAD_2XML_CLASS(AlignmentSurfaceDeformations);
Expand Down
1 change: 1 addition & 0 deletions CondCore/Utilities/src/CondDBFetch.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ namespace cond {
FETCH_PAYLOAD_CASE(AlignmentSurfaceDeformations)
FETCH_PAYLOAD_CASE(Alignments)
FETCH_PAYLOAD_CASE(AlignPCLThresholds)
FETCH_PAYLOAD_CASE(AlignPCLThresholdsHG)
FETCH_PAYLOAD_CASE(BeamSpotObjects)
FETCH_PAYLOAD_CASE(BeamSpotOnlineObjects)
FETCH_PAYLOAD_CASE(CSCBadChambers)
Expand Down
1 change: 1 addition & 0 deletions CondCore/Utilities/src/CondDBImport.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ namespace cond {
IMPORT_PAYLOAD_CASE(AlignmentSurfaceDeformations)
IMPORT_PAYLOAD_CASE(Alignments)
IMPORT_PAYLOAD_CASE(AlignPCLThresholds)
IMPORT_PAYLOAD_CASE(AlignPCLThresholdsHG)
IMPORT_PAYLOAD_CASE(BeamSpotObjects)
IMPORT_PAYLOAD_CASE(BeamSpotOnlineObjects)
IMPORT_PAYLOAD_CASE(CSCBadChambers)
Expand Down
1 change: 1 addition & 0 deletions CondCore/Utilities/src/CondFormats.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@
#include "CondFormats/BTauObjects/interface/TrackProbabilityCalibration.h"
#include "CondFormats/MFObjects/interface/MagFieldConfig.h"
#include "CondFormats/PCLConfig/interface/AlignPCLThresholds.h"
#include "CondFormats/PCLConfig/interface/AlignPCLThresholdsHG.h"
#include "CondFormats/SiPhase2TrackerObjects/interface/TrackerDetToDTCELinkCablingMap.h"
#include "CondFormats/SiPhase2TrackerObjects/interface/SiPhase2OuterTrackerLorentzAngle.h"
#include "CondFormats/SiPhase2TrackerObjects/interface/DTCELinkId.h"
Expand Down
8 changes: 8 additions & 0 deletions CondFormats/DataRecord/interface/AlignPCLThresholdsHGRcd.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef AlignPCLThresholdsRcd_AlignPCLThresholdsHGRcd_h
#define AlignPCLThresholdsRcd_AlignPCLThresholdsHGRcd_h

#include "FWCore/Framework/interface/EventSetupRecordImplementation.h"

class AlignPCLThresholdsHGRcd : public edm::eventsetup::EventSetupRecordImplementation<AlignPCLThresholdsHGRcd> {};

#endif
4 changes: 4 additions & 0 deletions CondFormats/DataRecord/src/AlignPCLThresholdsHGRcd.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include "CondFormats/DataRecord/interface/AlignPCLThresholdsHGRcd.h"
#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h"

EVENTSETUP_RECORD_REG(AlignPCLThresholdsHGRcd);
2 changes: 1 addition & 1 deletion CondFormats/PCLConfig/interface/AlignPCLThresholds.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class AlignPCLThresholds {

void printAll() const;

private:
protected:
threshold_map m_thresholds;
int m_nrecords;

Expand Down
52 changes: 52 additions & 0 deletions CondFormats/PCLConfig/interface/AlignPCLThresholdsHG.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#ifndef CondFormats_PCLConfig_AlignPCLThresholdsHG_h
#define CondFormats_PCLConfig_AlignPCLThresholdsHG_h

#include "CondFormats/PCLConfig/interface/AlignPCLThresholds.h"
#include "CondFormats/Serialization/interface/Serializable.h"

#include <map>
#include <string>
#include <vector>

class AlignPCLThresholdsHG : public AlignPCLThresholds {
public:
typedef std::unordered_map<std::string, std::vector<float>> param_map;
AlignPCLThresholdsHG() {}

enum FloatParamIndex {
FRACTION_CUT_X = 0,
FRACTION_CUT_Y = 1,
FRACTION_CUT_Z = 2,
FRACTION_CUT_TX = 3,
FRACTION_CUT_TY = 4,
FRACTION_CUT_TZ = 5,
FSIZE = 6
};

enum IntParamIndex { ISIZE = 0 };
enum StringParamIndex { SSIZE = 0 };

void setFractionCut(const std::string &AlignableId, const coordType &type, const float &cut);

const param_map &getFloatMap() const { return floatMap_; }
const std::vector<float> &getFloatVec(const std::string &AlignableId) const;

float getFractionCut(const std::string &AlignableId, const coordType &type) const;
std::array<float, 6> getFractionCut(const std::string &AlignableId) const;

const int payloadVersion() const;

void printAll() const;

~AlignPCLThresholdsHG() override = default;

private:
param_map floatMap_;
// yet unused, but kept for possible extensions
std::unordered_map<std::string, std::vector<int>> intMap_;
std::unordered_map<std::string, std::vector<std::string>> stringMap_;

COND_SERIALIZABLE;
};

#endif
Loading