36 isHG_(mpReaderConfig_.getParameter<
bool>(
"isHG")) {
37 consumes<AlignmentToken, edm::InProcess>(
config.getParameter<
edm::InputTag>(
"alignmentTokenSrc"));
47 edm::LogInfo(
"MillePedeDQMModule") <<
"Booking histograms";
53 <<
"MillePedeDQMModule is configured as Low Granularity but the outputfolder is for High Granularity";
57 h_xPos = booker.
book1D(
"Xpos",
"Alignment fit #DeltaX;;#mum", 36, 0., 36.);
58 h_xRot = booker.
book1D(
"Xrot",
"Alignment fit #Delta#theta_{X};;#murad", 36, 0., 36.);
59 h_yPos = booker.
book1D(
"Ypos",
"Alignment fit #DeltaY;;#mum", 36, 0., 36.);
60 h_yRot = booker.
book1D(
"Yrot",
"Alignment fit #Delta#theta_{Y};;#murad", 36, 0., 36.);
61 h_zPos = booker.
book1D(
"Zpos",
"Alignment fit #DeltaZ;;#mum", 36, 0., 36.);
62 h_zRot = booker.
book1D(
"Zrot",
"Alignment fit #Delta#theta_{Z};;#murad", 36, 0., 36.);
63 statusResults = booker.
book2D(
"statusResults",
"Status of SiPixelAli PCL workflow;;", 6, 0., 6., 1, 0., 1.);
67 <<
"MillePedeDQMModule is configured as High Granularity but the outputfolder is for Low Granularity";
85 "Alignment fit #DeltaX for " +
layer.first +
";;#mum",
90 "Alignment fit #Delta#theta_{X} for " +
layer.first +
";;#murad",
95 "Alignment fit #DeltaY for " +
layer.first +
";;#mum",
100 "Alignment fit #Delta#theta_{Y} for " +
layer.first +
";;#murad",
105 "Alignment fit #DeltaZ for " +
layer.first +
";;#mum",
110 "Alignment fit #Delta#theta_{Z} for " +
layer.first +
";;#murad",
117 booker.
book2D(
"statusResults",
"Fraction threshold check for SiPixelAliHG PCL;;", 6, 0., 6., 10, 0., 10.);
132 throw cms::Exception(
"LogicError") <<
"@SUB=MillePedeDQMModule::dqmEndJob\n" 133 <<
"Try to read MillePede results before initializing MillePedeFileReader";
143 auto theResults =
mpReader_->getResults();
144 std::string exitCodeStr = theResults.getExitMessage();
148 vetoStr =
"DB Updated!";
150 if (theResults.isHighGranularity()) {
151 if (theResults.getDBVetoed() && theResults.getDBUpdated()) {
152 vetoStr =
"DB Update Vetoed";
157 if (theResults.exceedsCutoffs()) {
158 vetoStr =
"DB Update Vetoed";
187 auto myThresholds = std::make_shared<AlignPCLThresholdsHG>();
188 myThresholds->setAlignPCLThresholds(thresholds_->getNrecords(), thresholds_->getThreshold_Map());
189 myThresholds->setFloatMap(thresholds_->getFloatMap());
193 const auto trackerGeometry = builder.
build(geometricDet, *ptp, tTopo);
194 tracker_ = std::make_unique<AlignableTracker>(trackerGeometry, tTopo);
204 mpReader_ = std::make_unique<MillePedeFileReader>(
209 TH2F* histo_status = statusHisto->
getTH2F();
210 auto theResults =
mpReader_->getResults();
212 histo_status->SetBinContent(1, 1, theResults.getDBUpdated());
213 histo_status->GetXaxis()->SetBinLabel(1,
"DB updated");
214 histo_status->SetBinContent(2, 1, theResults.exceedsCutoffs());
215 histo_status->GetXaxis()->SetBinLabel(2,
"significant movement");
216 histo_status->SetBinContent(3, 1, theResults.getDBVetoed());
217 histo_status->GetXaxis()->SetBinLabel(3,
"DB update vetoed");
218 histo_status->SetBinContent(4, 1, !theResults.exceedsThresholds());
219 histo_status->GetXaxis()->SetBinLabel(4,
"within max movement");
220 histo_status->SetBinContent(5, 1, !theResults.exceedsMaxError());
221 histo_status->GetXaxis()->SetBinLabel(5,
"within max error");
222 histo_status->SetBinContent(6, 1, !theResults.belowSignificance());
223 histo_status->GetXaxis()->SetBinLabel(6,
"above significance");
227 TH2F* histo_status = statusHisto->
getTH2F();
228 auto& theResults =
mpReader_->getResultsHG();
229 histo_status->GetXaxis()->SetBinLabel(1,
"#DeltaX");
230 histo_status->GetXaxis()->SetBinLabel(2,
"#DeltaY");
231 histo_status->GetXaxis()->SetBinLabel(3,
"#DeltaZ");
232 histo_status->GetXaxis()->SetBinLabel(4,
"#Delta#theta_{X}");
233 histo_status->GetXaxis()->SetBinLabel(5,
"#Delta#theta_{Y}");
234 histo_status->GetXaxis()->SetBinLabel(6,
"#Delta#theta_{Z}");
237 for (
const auto&
result : theResults) {
238 histo_status->GetYaxis()->SetBinLabel(
i + 1,
result.first.data());
239 for (std::size_t
j = 0;
j <
result.second.size(); ++
j) {
240 histo_status->SetBinContent(
j + 1,
i + 1,
result.second[
j]);
247 std::array<double, SIZE_INDEX> Xcut_, sigXcut_, maxMoveXcut_, maxErrorXcut_;
248 std::array<double, SIZE_INDEX> tXcut_, sigtXcut_, maxMovetXcut_, maxErrortXcut_;
250 std::array<double, SIZE_INDEX> Ycut_, sigYcut_, maxMoveYcut_, maxErrorYcut_;
251 std::array<double, SIZE_INDEX> tYcut_, sigtYcut_, maxMovetYcut_, maxErrortYcut_;
253 std::array<double, SIZE_INDEX> Zcut_, sigZcut_, maxMoveZcut_, maxErrorZcut_;
254 std::array<double, SIZE_INDEX> tZcut_, sigtZcut_, maxMovetZcut_, maxErrortZcut_;
256 auto myMap =
mpReader_->getThresholdMap();
258 std::vector<std::string> alignablesList;
259 for (
auto it = myMap.begin();
it != myMap.end(); ++
it) {
260 alignablesList.push_back(
it->first);
263 for (
auto& alignable : alignablesList) {
266 Xcut_[detIndex] = myMap[alignable].getXcut();
267 sigXcut_[detIndex] = myMap[alignable].getSigXcut();
268 maxMoveXcut_[detIndex] = myMap[alignable].getMaxMoveXcut();
269 maxErrorXcut_[detIndex] = myMap[alignable].getErrorXcut();
271 Ycut_[detIndex] = myMap[alignable].getYcut();
272 sigYcut_[detIndex] = myMap[alignable].getSigYcut();
273 maxMoveYcut_[detIndex] = myMap[alignable].getMaxMoveYcut();
274 maxErrorYcut_[detIndex] = myMap[alignable].getErrorYcut();
276 Zcut_[detIndex] = myMap[alignable].getZcut();
277 sigZcut_[detIndex] = myMap[alignable].getSigZcut();
278 maxMoveZcut_[detIndex] = myMap[alignable].getMaxMoveZcut();
279 maxErrorZcut_[detIndex] = myMap[alignable].getErrorZcut();
281 tXcut_[detIndex] = myMap[alignable].getThetaXcut();
282 sigtXcut_[detIndex] = myMap[alignable].getSigThetaXcut();
283 maxMovetXcut_[detIndex] = myMap[alignable].getMaxMoveThetaXcut();
284 maxErrortXcut_[detIndex] = myMap[alignable].getErrorThetaXcut();
286 tYcut_[detIndex] = myMap[alignable].getThetaYcut();
287 sigtYcut_[detIndex] = myMap[alignable].getSigThetaYcut();
288 maxMovetYcut_[detIndex] = myMap[alignable].getMaxMoveThetaYcut();
289 maxErrortYcut_[detIndex] = myMap[alignable].getErrorThetaYcut();
291 tZcut_[detIndex] = myMap[alignable].getThetaZcut();
292 sigtZcut_[detIndex] = myMap[alignable].getSigThetaZcut();
293 maxMovetZcut_[detIndex] = myMap[alignable].getMaxMoveThetaZcut();
294 maxErrortZcut_[detIndex] = myMap[alignable].getErrorThetaZcut();
311 const std::array<double, SIZE_INDEX>&
cut,
312 const std::array<double, SIZE_INDEX>&
sigCut,
313 const std::array<double, SIZE_INDEX>& maxMoveCut,
314 const std::array<double, SIZE_INDEX>& maxErrorCut,
315 const std::array<double, SIZE_LG_STRUCTS>& obs,
316 const std::array<double, SIZE_LG_STRUCTS>& obsErr) {
317 TH1F* histo_0 =
histo->getTH1F();
319 double max_ = *std::max_element(maxMoveCut.begin(), maxMoveCut.end());
321 histo_0->SetMinimum(-(max_));
322 histo_0->SetMaximum(max_);
333 for (
size_t i = 0;
i < obs.size(); ++
i) {
335 histo_0->SetBinContent(
i + 1, obs[
i]);
336 histo_0->SetBinError(
i + 1, obsErr[
i]);
340 histo_0->SetBinContent(8 +
i * 5,
cut[
i]);
343 histo_0->SetBinContent(9 +
i * 5,
sigCut[
i]);
346 histo_0->SetBinContent(10 +
i * 5, maxMoveCut[
i]);
349 histo_0->SetBinContent(11 +
i * 5, maxErrorCut[
i]);
354 std::array<double, SIZE_INDEX> Xcut_, sigXcut_, maxMoveXcut_, maxErrorXcut_;
355 std::array<double, SIZE_INDEX> tXcut_, sigtXcut_, maxMovetXcut_, maxErrortXcut_;
357 std::array<double, SIZE_INDEX> Ycut_, sigYcut_, maxMoveYcut_, maxErrorYcut_;
358 std::array<double, SIZE_INDEX> tYcut_, sigtYcut_, maxMovetYcut_, maxErrortYcut_;
360 std::array<double, SIZE_INDEX> Zcut_, sigZcut_, maxMoveZcut_, maxErrorZcut_;
361 std::array<double, SIZE_INDEX> tZcut_, sigtZcut_, maxMovetZcut_, maxErrortZcut_;
363 auto myMap =
mpReader_->getThresholdMap();
365 std::vector<std::string> alignablesList;
366 for (
auto it = myMap.begin();
it != myMap.end(); ++
it) {
367 alignablesList.push_back(
it->first);
370 for (
auto& alignable : alignablesList) {
373 Xcut_[detIndex] = myMap[alignable].getXcut();
374 sigXcut_[detIndex] = myMap[alignable].getSigXcut();
375 maxMoveXcut_[detIndex] = myMap[alignable].getMaxMoveXcut();
376 maxErrorXcut_[detIndex] = myMap[alignable].getErrorXcut();
378 Ycut_[detIndex] = myMap[alignable].getYcut();
379 sigYcut_[detIndex] = myMap[alignable].getSigYcut();
380 maxMoveYcut_[detIndex] = myMap[alignable].getMaxMoveYcut();
381 maxErrorYcut_[detIndex] = myMap[alignable].getErrorYcut();
383 Zcut_[detIndex] = myMap[alignable].getZcut();
384 sigZcut_[detIndex] = myMap[alignable].getSigZcut();
385 maxMoveZcut_[detIndex] = myMap[alignable].getMaxMoveZcut();
386 maxErrorZcut_[detIndex] = myMap[alignable].getErrorZcut();
388 tXcut_[detIndex] = myMap[alignable].getThetaXcut();
389 sigtXcut_[detIndex] = myMap[alignable].getSigThetaXcut();
390 maxMovetXcut_[detIndex] = myMap[alignable].getMaxMoveThetaXcut();
391 maxErrortXcut_[detIndex] = myMap[alignable].getErrorThetaXcut();
393 tYcut_[detIndex] = myMap[alignable].getThetaYcut();
394 sigtYcut_[detIndex] = myMap[alignable].getSigThetaYcut();
395 maxMovetYcut_[detIndex] = myMap[alignable].getMaxMoveThetaYcut();
396 maxErrortYcut_[detIndex] = myMap[alignable].getErrorThetaYcut();
398 tZcut_[detIndex] = myMap[alignable].getThetaZcut();
399 sigtZcut_[detIndex] = myMap[alignable].getSigThetaZcut();
400 maxMovetZcut_[detIndex] = myMap[alignable].getMaxMoveThetaZcut();
401 maxErrortZcut_[detIndex] = myMap[alignable].getErrorThetaZcut();
436 const std::array<double, SIZE_INDEX>&
cut,
437 const std::array<double, SIZE_INDEX>&
sigCut,
438 const std::array<double, SIZE_INDEX>& maxMoveCut,
439 const std::array<double, SIZE_INDEX>& maxErrorCut,
440 const std::array<double, SIZE_HG_STRUCTS>& obs,
441 const std::array<double, SIZE_HG_STRUCTS>& obsErr) {
447 TH1F* histo_0 = histo_map[
layer.first]->getTH1F();
455 histo_0->SetBinContent(
bin, obs[
i]);
456 histo_0->SetBinError(
bin, obsErr[
i]);
464 histo_0->SetBinContent(
bin + 1, 0);
465 histo_0->SetBinError(
bin + 1, 0);
468 if (
layer.first.find(
"Disk") != std::string::npos) {
471 histo_0->GetXaxis()->SetTitle(
"Panel");
475 histo_0->GetXaxis()->SetTitle(
"Ladder");
478 histo_0->SetBinContent(
bin + 2,
cut[detIndex]);
479 histo_0->SetBinError(
bin + 2, 0);
480 histo_0->SetBinContent(
bin + 3,
sigCut[detIndex]);
481 histo_0->SetBinError(
bin + 3, 0);
482 histo_0->SetBinContent(
bin + 4, maxMoveCut[detIndex]);
483 histo_0->SetBinError(
bin + 4, 0);
484 histo_0->SetBinContent(
bin + 5, maxErrorCut[detIndex]);
485 histo_0->SetBinError(
bin + 5, 0);
490 histo_0->SetMinimum(-(max_) * 1.2);
491 histo_0->SetMaximum(max_ * 1.2);
511 if (alignableId ==
"TPBHalfBarrelXminus") {
513 }
else if (alignableId ==
"TPBHalfBarrelXplus") {
515 }
else if (alignableId ==
"TPEHalfCylinderXminusZminus") {
517 }
else if (alignableId ==
"TPEHalfCylinderXplusZminus") {
519 }
else if (alignableId ==
"TPEHalfCylinderXminusZplus") {
521 }
else if (alignableId ==
"TPEHalfCylinderXplusZplus") {
523 }
else if (alignableId.rfind(
"TPBLadder", 0) == 0) {
525 }
else if (alignableId.rfind(
"TPEPanel", 0) == 0) {
528 throw cms::Exception(
"LogicError") <<
"@SUB=MillePedeDQMModule::getIndexFromString\n" 529 <<
"Retrieving conversion for not supported Alignable partition" << alignableId;
void fillExpertHisto(MonitorElement *histo, 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)
const edm::ParameterSet mpReaderConfig_
void fillStatusHisto(MonitorElement *statusHisto)
std::map< std::string, MonitorElement * > h_xRot_HG
std::vector< std::pair< std::string, int > > layerVec
std::map< std::string, MonitorElement * > h_yPos_HG
void fillExpertHistos_HG()
virtual void setCurrentFolder(std::string const &fullpath)
std::vector< ParameterSet > VParameterSet
bool setupChanged(const edm::EventSetup &)
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
DQM Plotter for PCL-Alignment.
TrackerGeometry * build(const GeometricDet *gd, const PTrackerParameters &ptp, const TrackerTopology *tTopo)
const edm::ESGetToken< GeometricDet, IdealGeometryRecord > gDetToken_
std::map< std::string, MonitorElement * > h_zRot_HG
MonitorElement * binariesAvalaible
MonitorElement * bookString(TString const &name, TString const &value, FUNC onbooking=NOOP())
virtual TH2F * getTH2F() const
edm::ESWatcher< IdealGeometryRecord > watchIdealGeometryRcd_
MonitorElement * isVetoed
MillePedeDQMModule(const edm::ParameterSet &)
std::map< std::string, MonitorElement * > h_yRot_HG
void bookHistograms(DQMStore::IBooker &)
Abs< T >::type abs(const T &t)
std::map< std::string, MonitorElement * > h_xPos_HG
void beginRun(const edm::Run &, const edm::EventSetup &) override
Log< level::Info, false > LogInfo
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
std::shared_ptr< PixelTopologyMap > pixelTopologyMap_
void addUntrackedParameter(std::string const &name, T const &value)
const edm::ESGetToken< AlignPCLThresholdsHG, AlignPCLThresholdsHGRcd > aliThrToken_
MonitorElement * statusResults
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
MonitorElement * bookInt(TString const &name, FUNC onbooking=NOOP())
bool check(const edm::EventSetup &iSetup)
edm::ESWatcher< TrackerTopologyRcd > watchTrackerTopologyRcd_
edm::ESWatcher< PTrackerParametersRcd > watchPTrackerParametersRcd_
const edm::ESGetToken< PTrackerParameters, PTrackerParametersRcd > ptpToken_
std::unique_ptr< AlignableTracker > tracker_
std::unique_ptr< MillePedeFileReader > mpReader_
int getIndexFromString(const std::string &alignableId)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
MonitorElement * exitCode
std::map< std::string, MonitorElement * > h_zPos_HG
~MillePedeDQMModule() override
const std::string outputFolder_
void fillStatusHistoHG(MonitorElement *statusHisto)
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
void fillExpertHisto_HG(std::map< std::string, MonitorElement *> &histo_map, 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_HG_STRUCTS > &obs, const std::array< double, SIZE_HG_STRUCTS > &obsErr)