diff --git a/Alignment/CommonAlignmentProducer/python/ALCARECOPromptCalibProdSiPixelAli_cff.py b/Alignment/CommonAlignmentProducer/python/ALCARECOPromptCalibProdSiPixelAli_cff.py
index 8c461ba03cbfa..27cd9a7b64bef 100644
--- a/Alignment/CommonAlignmentProducer/python/ALCARECOPromptCalibProdSiPixelAli_cff.py
+++ b/Alignment/CommonAlignmentProducer/python/ALCARECOPromptCalibProdSiPixelAli_cff.py
@@ -12,6 +12,17 @@
from Alignment.CommonAlignmentProducer.LSNumberFilter_cfi import *
+# Ugly as hell, but that's life
+from CondCore.CondDB.CondDB_cfi import *
+CondDB.connect = cms.string('frontier://FrontierPrep/CMS_CONDITIONS')
+PoolDBESSource = cms.ESSource("PoolDBESSource",
+ CondDB,
+ toGet = cms.VPSet(cms.PSet(record = cms.string('AlignPCLThresholdsRcd'),
+ tag = cms.string('SiPixelAliThresholds_test_v0')
+ )
+ )
+ )
+
# Ingredient: offlineBeamSpot
from RecoVertex.BeamSpotProducer.BeamSpot_cfi import offlineBeamSpot
diff --git a/Alignment/CommonAlignmentProducer/python/AlcaSiPixelAliHarvester_cff.py b/Alignment/CommonAlignmentProducer/python/AlcaSiPixelAliHarvester_cff.py
index 8527d65e7b845..ccaf2f5fbbd18 100644
--- a/Alignment/CommonAlignmentProducer/python/AlcaSiPixelAliHarvester_cff.py
+++ b/Alignment/CommonAlignmentProducer/python/AlcaSiPixelAliHarvester_cff.py
@@ -9,6 +9,17 @@
# 0000, 0001, 0002,...
outputBinaryFile = cms.string('pedeBinary%04d.dat'))
+# Ugly as hell, but that's life
+from CondCore.CondDB.CondDB_cfi import *
+CondDB.connect = cms.string('frontier://FrontierPrep/CMS_CONDITIONS')
+PoolDBESSource = cms.ESSource("PoolDBESSource",
+ CondDB,
+ toGet = cms.VPSet(cms.PSet(record = cms.string('AlignPCLThresholdsRcd'),
+ tag = cms.string('SiPixelAliThresholds_test_v0')
+ )
+ )
+ )
+
from Alignment.MillePedeAlignmentAlgorithm.MillePedeAlignmentAlgorithm_cfi import *
from Alignment.CommonAlignmentProducer.TrackerAlignmentProducerForPCL_cff import AlignmentProducer
SiPixelAliPedeAlignmentProducer = copy.deepcopy(AlignmentProducer)
@@ -25,7 +36,6 @@
SiPixelAliPedeAlignmentProducer.doMisalignmentScenario = False #True
-
SiPixelAliPedeAlignmentProducer.checkDbAlignmentValidity = False
SiPixelAliPedeAlignmentProducer.applyDbAlignment = True
SiPixelAliPedeAlignmentProducer.tjTkAssociationMapTag = 'TrackRefitter2'
diff --git a/Alignment/MillePedeAlignmentAlgorithm/BuildFile.xml b/Alignment/MillePedeAlignmentAlgorithm/BuildFile.xml
index cb6c3679742f2..b9a340d0a65dc 100644
--- a/Alignment/MillePedeAlignmentAlgorithm/BuildFile.xml
+++ b/Alignment/MillePedeAlignmentAlgorithm/BuildFile.xml
@@ -4,6 +4,7 @@
+
diff --git a/Alignment/MillePedeAlignmentAlgorithm/interface/MillePedeFileReader.h b/Alignment/MillePedeAlignmentAlgorithm/interface/MillePedeFileReader.h
index 4ecfe56473677..f1aa0050408b7 100644
--- a/Alignment/MillePedeAlignmentAlgorithm/interface/MillePedeFileReader.h
+++ b/Alignment/MillePedeAlignmentAlgorithm/interface/MillePedeFileReader.h
@@ -4,13 +4,14 @@
/*** system includes ***/
#include
#include
+#include
/*** core framework functionality ***/
#include "FWCore/ParameterSet/interface/ParameterSet.h"
/*** Alignment ***/
#include "Alignment/MillePedeAlignmentAlgorithm/interface/PedeLabelerBase.h"
-
+#include "CondFormats/PCLConfig/interface/AlignPCLThresholds.h"
class MillePedeFileReader {
@@ -18,7 +19,9 @@ class MillePedeFileReader {
public: //====================================================================
explicit MillePedeFileReader(const edm::ParameterSet&,
- const std::shared_ptr&);
+ const std::shared_ptr&,
+ const std::shared_ptr&);
+
virtual ~MillePedeFileReader() = default;
void read();
@@ -39,6 +42,8 @@ class MillePedeFileReader {
const std::array& getTZobs() const { return tZobs_; }
const std::array& getTZobsErr() const { return tZobsErr_; }
+ const AlignPCLThresholds::threshold_map getThresholdMap() const {return theThresholds_.get()->getThreshold_Map (); }
+
private:
//========================= PRIVATE ENUMS ====================================
//============================================================================
@@ -57,6 +62,7 @@ class MillePedeFileReader {
void readMillePedeLogFile();
void readMillePedeResultFile();
PclHLS getHLS(const Alignable*);
+ std::string getStringFromHLS(PclHLS HLS);
//========================== PRIVATE DATA ====================================
//============================================================================
@@ -64,19 +70,13 @@ class MillePedeFileReader {
// pede labeler plugin
const std::shared_ptr pedeLabeler_;
+ // thresholds from DB
+ const std::shared_ptr theThresholds_;
+
// file-names
const std::string millePedeLogFile_;
const std::string millePedeResFile_;
-
- // signifiance of movement must be above
- const double sigCut_;
- // cutoff in micro-meter & micro-rad
- const double Xcut_, tXcut_;
- const double Ycut_, tYcut_;
- const double Zcut_, tZcut_;
- // maximum movement in micro-meter/rad
- const double maxMoveCut_, maxErrorCut_;
-
+
// conversion factors: cm to um & rad to urad
static constexpr std::array multiplier_ = {{ 10000., // X
10000., // Y
@@ -85,9 +85,6 @@ class MillePedeFileReader {
1000000., // tY
1000000. }}; // tZ
- const std::array cutoffs_ = {{ Xcut_, Ycut_, Zcut_,
- tXcut_, tYcut_, tZcut_}};
-
bool updateDB_{false};
int Nrec_{0};
@@ -105,7 +102,13 @@ class MillePedeFileReader {
std::array ZobsErr_ = {{0.,0.,0.,0.,0.,0.}};
std::array tZobs_ = {{0.,0.,0.,0.,0.,0.}};
std::array tZobsErr_ = {{0.,0.,0.,0.,0.,0.}};
-
+
};
+const std::array 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 < 0) return os << "unrecongnized coordinate";
+ return os << coord_str[c];
+}
+
#endif /* ALIGNMENT_MILLEPEDEALIGNMENTALGORITHM_INTERFACE_MILLEPEDEFILEREADER_H_ */
diff --git a/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeAlignmentAlgorithm.cc b/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeAlignmentAlgorithm.cc
index bccd1cc3f55a2..8237c70c36220 100644
--- a/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeAlignmentAlgorithm.cc
+++ b/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeAlignmentAlgorithm.cc
@@ -60,6 +60,9 @@
#include "Geometry/Records/interface/TrackerTopologyRcd.h"
#include "Geometry/Records/interface/IdealGeometryRecord.h"
+#include "CondFormats/PCLConfig/interface/AlignPCLThresholds.h"
+#include "CondFormats/DataRecord/interface/AlignPCLThresholdsRcd.h"
+
#include "DataFormats/TrackerRecHit2D/interface/ProjectedSiStripRecHit2D.h"
#include
@@ -195,6 +198,15 @@ void MillePedeAlignmentAlgorithm::initialize(const edm::EventSetup &setup,
setup.get().get(tTopoHandle);
const TrackerTopology* const tTopo = tTopoHandle.product();
+ //Retrieve the thresolds cuts from DB for the PCL
+ if (runAtPCL_) {
+ edm::ESHandle thresholdHandle;
+ setup.get().get(thresholdHandle);
+ auto th = thresholdHandle.product();
+ theThresholds = std::make_shared();
+ storeThresholds(th->getNrecords(),th->getThreshold_Map());
+ }
+
theAlignableNavigator = std::make_unique(extras, tracker, muon);
theAlignmentParameterStore = store;
theAlignables = theAlignmentParameterStore->alignables();
@@ -313,6 +325,13 @@ bool MillePedeAlignmentAlgorithm::addCalibrations(const std::vectorsetAlignPCLThresholds(nRecords,thresholdMap);
+ return true;
+}
+
//_____________________________________________________________________________
bool MillePedeAlignmentAlgorithm::processesEvents()
{
@@ -328,8 +347,11 @@ bool MillePedeAlignmentAlgorithm::storeAlignments()
{
if (isMode(myPedeRunBit)) {
if (runAtPCL_) {
+
MillePedeFileReader mpReader(theConfig.getParameter("MillePedeFileReader"),
- thePedeLabels);
+ thePedeLabels,
+ theThresholds
+ );
mpReader.read();
return mpReader.storeAlignments();
} else {
diff --git a/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeAlignmentAlgorithm.h b/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeAlignmentAlgorithm.h
index 88f3282c5e590..ff77c3aa5bec5 100644
--- a/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeAlignmentAlgorithm.h
+++ b/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeAlignmentAlgorithm.h
@@ -20,6 +20,7 @@
#include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h"
#include "Alignment/ReferenceTrajectories/interface/ReferenceTrajectoryBase.h"
+#include "CondFormats/PCLConfig/interface/AlignPCLThresholds.h"
#include
#include
@@ -72,6 +73,8 @@ class MillePedeAlignmentAlgorithm : public AlignmentAlgorithmBase
/// Pass integrated calibrations to Millepede (they are not owned by Millepede!)
virtual bool addCalibrations(const std::vector &iCals) override;
+ virtual bool storeThresholds(const int & nRecords,const AlignPCLThresholds::threshold_map & thresholdMap);
+
/// Called at end of job
virtual void terminate(const edm::EventSetup& iSetup) override;
/// Called at end of job
@@ -262,6 +265,7 @@ class MillePedeAlignmentAlgorithm : public AlignmentAlgorithmBase
std::unique_ptr thePedeSteer;
std::unique_ptr theTrajectoryFactory;
std::vector theCalibrations;
+ std::shared_ptr theThresholds;
unsigned int theMinNumHits;
double theMaximalCor2D; /// maximal correlation allowed for 2D hit in TID/TEC.
/// If larger, the 2D measurement gets diagonalized!!!
diff --git a/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeDQMModule.cc b/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeDQMModule.cc
index 56bf7a63a922b..da682450bde9b 100644
--- a/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeDQMModule.cc
+++ b/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeDQMModule.cc
@@ -28,23 +28,15 @@
#include "Alignment/MillePedeAlignmentAlgorithm/interface/PedeLabelerPluginFactory.h"
#include "Alignment/TrackerAlignment/interface/AlignableTracker.h"
-
+/*** Thresholds from DB ***/
+#include "CondFormats/DataRecord/interface/AlignPCLThresholdsRcd.h"
+
MillePedeDQMModule
::MillePedeDQMModule(const edm::ParameterSet& config) :
mpReaderConfig_(
config.getParameter("MillePedeFileReader")
- ),
-
- sigCut_ (mpReaderConfig_.getParameter("sigCut")),
- Xcut_ (mpReaderConfig_.getParameter("Xcut")),
- tXcut_ (mpReaderConfig_.getParameter("tXcut")),
- Ycut_ (mpReaderConfig_.getParameter("Ycut")),
- tYcut_ (mpReaderConfig_.getParameter("tYcut")),
- Zcut_ (mpReaderConfig_.getParameter("Zcut")),
- tZcut_ (mpReaderConfig_.getParameter("tZcut")),
- maxMoveCut_ (mpReaderConfig_.getParameter("maxMoveCut")),
- maxErrorCut_ (mpReaderConfig_.getParameter("maxErrorCut"))
+ )
{
}
@@ -65,12 +57,12 @@ ::bookHistograms(DQMStore::IBooker& booker)
booker.cd();
booker.setCurrentFolder("AlCaReco/SiPixelAli/");
- h_xPos = booker.book1D("Xpos", "#Delta X;;#mu m", 10, 0, 10.);
- h_xRot = booker.book1D("Xrot", "#Delta #theta_{X};;#mu rad", 10, 0, 10.);
- h_yPos = booker.book1D("Ypos", "#Delta Y;;#mu m", 10, 0., 10.);
- h_yRot = booker.book1D("Yrot", "#Delta #theta_{Y};;#mu rad", 10, 0, 10.);
- h_zPos = booker.book1D("Zpos", "#Delta Z;;#mu m", 10, 0., 10.);
- h_zRot = booker.book1D("Zrot", "#Delta #theta_{Z};;#mu rad", 10, 0, 10.);
+ h_xPos = booker.book1D("Xpos", "Alignment fit #DeltaX;;#mum", 36, 0., 36.);
+ h_xRot = booker.book1D("Xrot", "Alignment fit #Delta#theta_{X};;#murad", 36, 0., 36.);
+ h_yPos = booker.book1D("Ypos", "Alignment fit #DeltaY;;#mum", 36, 0., 36.);
+ h_yRot = booker.book1D("Yrot", "Alignment fit #Delta#theta_{Y};;#murad", 36, 0., 36.);
+ h_zPos = booker.book1D("Zpos", "Alignment fit #DeltaZ;;#mum", 36, 0., 36.);
+ h_zRot = booker.book1D("Zrot", "Alignment fit #Delta#theta_{Z};;#murad", 36, 0., 36.);
booker.cd();
}
@@ -108,6 +100,14 @@ ::beginRun(const edm::Run&, const edm::EventSetup& setup) {
edm::ESHandle ptp;
setup.get().get(ptp);
+ // take the thresholds from DB
+ edm::ESHandle thresholdHandle;
+ setup.get().get(thresholdHandle);
+ auto thresholds_ = thresholdHandle.product();
+
+ auto myThresholds = std::make_shared();
+ myThresholds->setAlignPCLThresholds(thresholds_->getNrecords(),thresholds_->getThreshold_Map());
+
TrackerGeomBuilderFromGeometricDet builder;
const auto trackerGeometry = builder.build(&(*geometricDet), *ptp, &(*tTopo));
@@ -125,43 +125,121 @@ ::beginRun(const edm::Run&, const edm::EventSetup& setup) {
labelerConfig)
};
- mpReader_ = std::make_unique(mpReaderConfig_, pedeLabeler);
+
+ mpReader_ = std::make_unique(mpReaderConfig_, pedeLabeler, std::shared_ptr(myThresholds));
+
}
void MillePedeDQMModule
::fillExpertHistos()
{
+
+ std::array Xcut_, sigXcut_, maxMoveXcut_, maxErrorXcut_;
+ std::array tXcut_, sigtXcut_, maxMovetXcut_, maxErrortXcut_;
+
+ std::array Ycut_, sigYcut_, maxMoveYcut_, maxErrorYcut_;
+ std::array tYcut_, sigtYcut_, maxMovetYcut_, maxErrortYcut_;
+
+ std::array Zcut_, sigZcut_, maxMoveZcut_, maxErrorZcut_;
+ std::array tZcut_, sigtZcut_, maxMovetZcut_, maxErrortZcut_;
+
+ auto myMap = mpReader_->getThresholdMap();
+
+ std::vector alignablesList;
+ for(auto it = myMap.begin(); it != myMap.end() ; ++it){
+ alignablesList.push_back(it->first);
+ }
+
+ for (auto &alignable : alignablesList){
+
+ int detIndex = getIndexFromString(alignable);
+
+ Xcut_[detIndex] = myMap[alignable].getXcut() ;
+ sigXcut_[detIndex] = myMap[alignable].getSigXcut() ;
+ maxMoveXcut_[detIndex] = myMap[alignable].getMaxMoveXcut() ;
+ maxErrorXcut_[detIndex] = myMap[alignable].getErrorXcut() ;
+
+ Ycut_[detIndex] = myMap[alignable].getYcut() ;
+ sigYcut_[detIndex] = myMap[alignable].getSigYcut() ;
+ maxMoveYcut_[detIndex] = myMap[alignable].getMaxMoveYcut() ;
+ maxErrorYcut_[detIndex] = myMap[alignable].getErrorYcut() ;
+
+ Zcut_[detIndex] = myMap[alignable].getZcut() ;
+ sigZcut_[detIndex] = myMap[alignable].getSigZcut() ;
+ maxMoveZcut_[detIndex] = myMap[alignable].getMaxMoveZcut() ;
+ maxErrorZcut_[detIndex] = myMap[alignable].getErrorZcut() ;
+
+ tXcut_[detIndex] = myMap[alignable].getThetaXcut() ;
+ sigtXcut_[detIndex] = myMap[alignable].getSigThetaXcut() ;
+ maxMovetXcut_[detIndex] = myMap[alignable].getMaxMoveThetaXcut() ;
+ maxErrortXcut_[detIndex] = myMap[alignable].getErrorThetaXcut() ;
+
+ tYcut_[detIndex] = myMap[alignable].getThetaYcut() ;
+ sigtYcut_[detIndex] = myMap[alignable].getSigThetaYcut() ;
+ maxMovetYcut_[detIndex] = myMap[alignable].getMaxMoveThetaYcut() ;
+ maxErrortYcut_[detIndex] = myMap[alignable].getErrorThetaYcut() ;
+
+ tZcut_[detIndex] = myMap[alignable].getThetaZcut() ;
+ sigtZcut_[detIndex] = myMap[alignable].getSigThetaYcut() ;
+ maxMovetZcut_[detIndex] = myMap[alignable].getMaxMoveThetaYcut() ;
+ maxErrortZcut_[detIndex] = myMap[alignable].getErrorThetaYcut() ;
+
+ }
- fillExpertHisto(h_xPos, Xcut_, sigCut_, maxMoveCut_, maxErrorCut_, mpReader_->getXobs(), mpReader_->getXobsErr());
- fillExpertHisto(h_xRot, tXcut_, sigCut_, maxMoveCut_, maxErrorCut_, mpReader_->getTXobs(), mpReader_->getTXobsErr());
+ fillExpertHisto(h_xPos, Xcut_, sigXcut_, maxMoveXcut_, maxErrorXcut_, mpReader_->getXobs(), mpReader_->getXobsErr());
+ fillExpertHisto(h_xRot, tXcut_, sigtXcut_, maxMovetXcut_, maxErrortXcut_, mpReader_->getTXobs(), mpReader_->getTXobsErr());
- fillExpertHisto(h_yPos, Ycut_, sigCut_, maxMoveCut_, maxErrorCut_, mpReader_->getYobs(), mpReader_->getYobsErr());
- fillExpertHisto(h_yRot, tYcut_, sigCut_, maxMoveCut_, maxErrorCut_, mpReader_->getTYobs(), mpReader_->getTYobsErr());
+ fillExpertHisto(h_yPos, Ycut_, sigYcut_, maxMoveYcut_, maxErrorYcut_, mpReader_->getYobs(), mpReader_->getYobsErr());
+ fillExpertHisto(h_yRot, tYcut_, sigtYcut_, maxMovetYcut_, maxErrortYcut_, mpReader_->getTYobs(), mpReader_->getTYobsErr());
- fillExpertHisto(h_zPos, Zcut_, sigCut_, maxMoveCut_, maxErrorCut_, mpReader_->getZobs(), mpReader_->getZobsErr());
- fillExpertHisto(h_zRot, tZcut_, sigCut_, maxMoveCut_, maxErrorCut_, mpReader_->getTZobs(), mpReader_->getTZobsErr());
+ fillExpertHisto(h_zPos, Zcut_, sigZcut_, maxMoveZcut_, maxErrorZcut_, mpReader_->getZobs(), mpReader_->getZobsErr());
+ fillExpertHisto(h_zRot, tZcut_, sigtZcut_, maxMovetZcut_, maxErrortZcut_, mpReader_->getTZobs(), mpReader_->getTZobsErr());
}
void MillePedeDQMModule
-::fillExpertHisto(MonitorElement* histo, const double cut, const double sigCut, const double maxMoveCut, const double maxErrorCut,
- std::array obs, std::array obsErr)
+::fillExpertHisto(MonitorElement* histo,
+ const std::array& cut, const std::array& sigCut,
+ const std::array& maxMoveCut,const std::array& maxErrorCut,
+ const std::array& obs,const std::array& obsErr)
{
TH1F* histo_0 = histo->getTH1F();
- histo_0->SetMinimum(-(maxMoveCut_));
- histo_0->SetMaximum( maxMoveCut_);
+ double max_ = *std::max_element(maxMoveCut.begin(),maxMoveCut.end());
+
+ histo_0->SetMinimum(-(max_));
+ histo_0->SetMaximum( max_);
+
+ // Schematics of the bin contents
+ //
+ // XX XX XX XX XX XX OO OO OO OO II II II II
+ // |--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|
+ // | 1| 2| 3| 4| 5| 6| 7| 8| 9|10|11|12|13|14|15|16|17| ...
+ //
+ // |-----------------| |-----------| |-----------|
+ // |observed movement| |thresholds1| |thresholds2|
for (size_t i = 0; i < obs.size(); ++i) {
+
+ // fist obs.size() bins for observed movements
histo_0->SetBinContent(i+1, obs[i]);
- histo_0->SetBinError(i+1, obsErr[i]);
+ histo_0->SetBinError(i+1, obsErr[i]);
+
+ // then at bin 8,8+5,8+10,... for cutoffs
+ // 5 bins is the space allocated for the 4 other thresholds + 1 empty separation bin
+ histo_0->SetBinContent(8+i*5 , cut[i]);
+
+ // then at bin 9,9+5,9+10,... for significances
+ histo_0->SetBinContent(9+i*5 , sigCut[i]);
+
+ // then at bin 10,10+5,10+10,... for maximum movements
+ histo_0->SetBinContent(10+i*5, maxMoveCut[i]);
+
+ // then at bin 11,11+5,11+10,... for maximum errors
+ histo_0->SetBinContent(11+i*5, maxErrorCut[i]);
+
}
- histo_0->SetBinContent(8,cut);
- histo_0->SetBinContent(9,sigCut);
- histo_0->SetBinContent(10,maxMoveCut);
- histo_0->SetBinContent(11,maxErrorCut);
-
}
bool MillePedeDQMModule
@@ -175,3 +253,28 @@ ::setupChanged(const edm::EventSetup& setup)
return changed;
}
+
+
+int MillePedeDQMModule
+::getIndexFromString(const std::string& alignableId)
+{
+
+ if(alignableId == "TPBHalfBarrelXminus"){
+ return 3;
+ } else if(alignableId == "TPBHalfBarrelXplus"){
+ return 2;
+ } else if(alignableId == "TPEHalfCylinderXminusZminus") {
+ return 1;
+ } else if(alignableId == "TPEHalfCylinderXplusZminus") {
+ return 0;
+ } else if(alignableId == "TPEHalfCylinderXminusZplus") {
+ return 5;
+ } else if(alignableId == "TPEHalfCylinderXplusZplus") {
+ return 4;
+ } else{
+ throw cms::Exception("LogicError")
+ << "@SUB=MillePedeDQMModule::getIndexFromString\n"
+ << "Retrieving conversion for not supported Alignable partition"
+ << alignableId;
+ }
+}
diff --git a/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeDQMModule.h b/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeDQMModule.h
index 2ec2d565afbdf..d2d082b478bb8 100644
--- a/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeDQMModule.h
+++ b/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeDQMModule.h
@@ -49,10 +49,6 @@ class MillePedeDQMModule : public DQMEDHarvester {
MillePedeDQMModule(const edm::ParameterSet&);
virtual ~MillePedeDQMModule();
-
-
-
-
virtual void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override;
//========================= PRIVATE METHODS ==================================
@@ -65,17 +61,18 @@ class MillePedeDQMModule : public DQMEDHarvester {
void fillExpertHistos();
void fillExpertHisto(MonitorElement* histo,
- const double cut,
- const double sigCut,
- const double maxMoveCut,
- const double maxErrorCut,
- std::array obs,
- std::array obsErr);
+ const std::array& cut,
+ const std::array& sigCut,
+ const std::array& maxMoveCut,
+ const std::array& maxErrorCut,
+ const std::array& obs,
+ const std::array& obsErr);
bool setupChanged(const edm::EventSetup&);
+ int getIndexFromString(const std::string& alignableId);
- //========================== PRIVATE DATA ====================================
- //============================================================================
+ //========================== PRIVATE DATA ====================================
+ //============================================================================
const edm::ParameterSet mpReaderConfig_;
std::unique_ptr tracker_;
@@ -85,16 +82,6 @@ class MillePedeDQMModule : public DQMEDHarvester {
edm::ESWatcher watchIdealGeometryRcd_;
edm::ESWatcher watchPTrackerParametersRcd_;
- // Signifiance of movement must be above
- double sigCut_;
- // Cutoff in micro-meter & micro-rad
- double Xcut_, tXcut_;
- double Ycut_, tYcut_;
- double Zcut_, tZcut_;
- // maximum movement in micro-meter/rad
- double maxMoveCut_;
- double maxErrorCut_;
-
// Histograms
MonitorElement* h_xPos;
MonitorElement* h_xRot;
diff --git a/Alignment/MillePedeAlignmentAlgorithm/python/MillePedeDQMModule_cff.py b/Alignment/MillePedeAlignmentAlgorithm/python/MillePedeDQMModule_cff.py
index 0f9e16e2c136f..9f10331855fd4 100644
--- a/Alignment/MillePedeAlignmentAlgorithm/python/MillePedeDQMModule_cff.py
+++ b/Alignment/MillePedeAlignmentAlgorithm/python/MillePedeDQMModule_cff.py
@@ -4,4 +4,4 @@
SiPixelAliDQMModule = cms.EDAnalyzer("MillePedeDQMModule",
MillePedeFileReader = cms.PSet(MillePedeFileReader_cfi.MillePedeFileReader.clone())
- )
+ )
diff --git a/Alignment/MillePedeAlignmentAlgorithm/python/MillePedeFileReader_cfi.py b/Alignment/MillePedeAlignmentAlgorithm/python/MillePedeFileReader_cfi.py
index ccc747996eb32..9f05d34ab15a0 100644
--- a/Alignment/MillePedeAlignmentAlgorithm/python/MillePedeFileReader_cfi.py
+++ b/Alignment/MillePedeAlignmentAlgorithm/python/MillePedeFileReader_cfi.py
@@ -3,19 +3,4 @@
MillePedeFileReader = cms.PSet(
millePedeLogFile = cms.string('millepede.log'),
millePedeResFile = cms.string('millepede.res'),
-
- # signifiance of movement must be above
- sigCut = cms.double(2.5),
-
- # cutoff in micro-meter & micro-rad
- Xcut = cms.double( 5.0),
- tXcut = cms.double(30.0), # thetaX
- Ycut = cms.double(10.0),
- tYcut = cms.double(30.0), # thetaY
- Zcut = cms.double(15.0),
- tZcut = cms.double(30.0), # thetaZ
-
- # maximum movement in micro-meter/rad
- maxMoveCut = cms.double(200.0),
- maxErrorCut = cms.double( 10.0)
-)
+ )
diff --git a/Alignment/MillePedeAlignmentAlgorithm/src/MillePedeFileReader.cc b/Alignment/MillePedeAlignmentAlgorithm/src/MillePedeFileReader.cc
index 8987d217bf50f..9f2bb81b03f1f 100644
--- a/Alignment/MillePedeAlignmentAlgorithm/src/MillePedeFileReader.cc
+++ b/Alignment/MillePedeAlignmentAlgorithm/src/MillePedeFileReader.cc
@@ -18,20 +18,12 @@
MillePedeFileReader
::MillePedeFileReader(const edm::ParameterSet& config,
- const std::shared_ptr& pedeLabeler) :
+ const std::shared_ptr& pedeLabeler,
+ const std::shared_ptr& theThresholds) :
pedeLabeler_(pedeLabeler),
+ theThresholds_(theThresholds),
millePedeLogFile_(config.getParameter("millePedeLogFile")),
- millePedeResFile_(config.getParameter("millePedeResFile")),
-
- sigCut_ (config.getParameter("sigCut")),
- Xcut_ (config.getParameter("Xcut")),
- tXcut_ (config.getParameter("tXcut")),
- Ycut_ (config.getParameter("Ycut")),
- tYcut_ (config.getParameter("tYcut")),
- Zcut_ (config.getParameter("Zcut")),
- tZcut_ (config.getParameter("tZcut")),
- maxMoveCut_ (config.getParameter("maxMoveCut")),
- maxErrorCut_(config.getParameter("maxErrorCut"))
+ millePedeResFile_(config.getParameter("millePedeResFile"))
{
}
@@ -70,7 +62,8 @@ ::readMillePedeLogFile()
std::string trash;
iss >> trash >> trash >> Nrec_;
- if (Nrec_ < 25000) {
+ if (Nrec_ < theThresholds_->getNrecords() ) {
+ edm::LogInfo("MillePedeFileReader")<<"Number of records used "<getNrecords()< > cutoffs_;
+ std::map > significances_;
+ std::map > thresholds_;
+ std::map > errors_;
+
+ std::vector alignables_ = theThresholds_->getAlignableList();
+ for (auto &ali : alignables_){
+ cutoffs_[ali] = theThresholds_->getCut(ali);
+ significances_[ali] = theThresholds_->getSigCut(ali);
+ thresholds_[ali] = theThresholds_->getMaxMoveCut(ali);
+ errors_[ali] = theThresholds_->getMaxErrorCut(ali);
+ }
+
updateDB_ = false;
std::ifstream resFile;
resFile.open(millePedeResFile_.c_str());
@@ -116,53 +124,74 @@ ::readMillePedeResultFile()
double ObsErr = std::stof(tokens[4]) * multiplier_[alignableIndex];
auto det = getHLS(alignable);
+ int detIndex = static_cast(det);
+ auto coord = static_cast(alignableIndex);
+ std::string detLabel = getStringFromHLS(det);
if (det != PclHLS::NotInPCL) {
- switch (alignableIndex) {
- case 0:
- Xobs_[static_cast(det)] = ObsMove;
- XobsErr_[static_cast(det)] = ObsErr;
+ switch (coord) {
+ case AlignPCLThresholds::X:
+ Xobs_[detIndex] = ObsMove;
+ XobsErr_[detIndex] = ObsErr;
break;
- case 1:
- Yobs_[static_cast(det)] = ObsMove;
- YobsErr_[static_cast(det)] = ObsErr;
+ case AlignPCLThresholds::Y:
+ Yobs_[detIndex] = ObsMove;
+ YobsErr_[detIndex] = ObsErr;
break;
- case 2:
- Zobs_[static_cast(det)] = ObsMove;
- ZobsErr_[static_cast(det)] = ObsErr;
+ case AlignPCLThresholds::Z:
+ Zobs_[detIndex] = ObsMove;
+ ZobsErr_[detIndex] = ObsErr;
break;
- case 3:
- tXobs_[static_cast(det)] = ObsMove;
- tXobsErr_[static_cast(det)] = ObsErr;
+ case AlignPCLThresholds::theta_X:
+ tXobs_[detIndex] = ObsMove;
+ tXobsErr_[detIndex] = ObsErr;
break;
- case 4:
- tYobs_[static_cast(det)] = ObsMove;
- tYobsErr_[static_cast(det)] = ObsErr;
+ case AlignPCLThresholds::theta_Y:
+ tYobs_[detIndex] = ObsMove;
+ tYobsErr_[detIndex] = ObsErr;
break;
- case 5:
- tZobs_[static_cast(det)] = ObsMove;
- tZobsErr_[static_cast(det)] = ObsErr;
+ case AlignPCLThresholds::theta_Z:
+ tZobs_[detIndex] = ObsMove;
+ tZobsErr_[detIndex] = ObsErr;
break;
+ default:
+ edm::LogError("MillePedeFileReader") << "Currently not able to handle DOF " << coord
+ << std::endl;
+ break;
}
} else {
continue;
}
- if (std::abs(ObsMove) > maxMoveCut_) {
+ edm::LogVerbatim("MillePedeFileReader")<<" alignableLabel: "<< alignableLabel <<" with alignableIndex "< thresholds_[detLabel][alignableIndex]) {
+ edm::LogWarning("MillePedeFileReader")<<"Aborting payload creation."
+ <<" Exceeding maximum thresholds for movement: "< cutoffs_[alignableIndex]) {
+ } else if (std::abs(ObsMove) > cutoffs_[detLabel][alignableIndex]) {
- if (std::abs(ObsErr) > maxErrorCut_) {
+ if (std::abs(ObsErr) > errors_[detLabel][alignableIndex]) {
+ edm::LogWarning("MillePedeFileReader")<<"Aborting payload creation."
+ <<" Exceeding maximum thresholds for error: "< MillePedeFileReader::multiplier_;
+
+
+