-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PCL SiPixel Alignment: integration of quality checks on payload and DQM module #13984
Closed
Closed
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
725160e
PCL-DQM-plots: implemented mp-file reader and DQMEDAnalyzer for histo…
DirtyDan88 792a38c
fixed some typos
DirtyDan88 8102699
added config for MillePedeFileReader
DirtyDan88 0beae90
removed unused includes
DirtyDan88 ec2b685
cleanup and go through the mpreader only if writing conditions to DB …
cerminar 41ab7ba
add the parameters for the millepedefilereader
cerminar 31df607
add cff for DQM module
cerminar 8a16f76
add DQM module to the sequence
cerminar 08e1c0f
remove problematic fillDescriptions and remove creation of canvas
cerminar 8824cc0
clone the pset for the millepede file reader
cerminar 7af3c5c
move to DQMEDHarvester interface
cerminar 39c8948
modifiy MillePedeDQMModule to store information in a single histogram
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
286 changes: 286 additions & 0 deletions
286
Alignment/MillePedeAlignmentAlgorithm/interface/MillePedeFileReader.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,286 @@ | ||
#ifndef ALIGNMENT_MILLEPEDEALIGNMENTALGORITHM_INTERFACE_MILLEPEDEFILEREADER_H_ | ||
#define ALIGNMENT_MILLEPEDEALIGNMENTALGORITHM_INTERFACE_MILLEPEDEFILEREADER_H_ | ||
|
||
/*** system includes ***/ | ||
#include <array> | ||
#include <memory> | ||
#include <fstream> | ||
#include <string> | ||
|
||
/*** core framework functionality ***/ | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "FWCore/MessageLogger/interface/MessageLogger.h" | ||
|
||
|
||
|
||
class MillePedeFileReader { | ||
|
||
//========================== PUBLIC METHODS ================================== | ||
public: //==================================================================== | ||
|
||
explicit MillePedeFileReader(const edm::ParameterSet&); | ||
~MillePedeFileReader() {} | ||
|
||
void read(); | ||
bool storeAlignments(); | ||
|
||
std::array<double, 6> const& getXobs() const { return Xobs; } | ||
std::array<double, 6> const& getXobsErr() const { return XobsErr; } | ||
std::array<double, 6> const& getTXobs() const { return tXobs; } | ||
std::array<double, 6> const& getTXobsErr() const { return tXobsErr; } | ||
|
||
std::array<double, 6> const& getYobs() const { return Yobs; } | ||
std::array<double, 6> const& getYobsErr() const { return YobsErr; } | ||
std::array<double, 6> const& getTYobs() const { return tYobs; } | ||
std::array<double, 6> const& getTYobsErr() const { return tYobsErr; } | ||
|
||
std::array<double, 6> const& getZobs() const { return Zobs; } | ||
std::array<double, 6> const& getZobsErr() const { return ZobsErr; } | ||
std::array<double, 6> const& getTZobs() const { return tZobs; } | ||
std::array<double, 6> const& getTZobsErr() const { return tZobsErr; } | ||
|
||
//========================= PRIVATE METHODS ================================== | ||
private: //=================================================================== | ||
|
||
void readMillePedeLogFile(); | ||
void readMillePedeResultFile(); | ||
|
||
//========================== PRIVATE DATA ==================================== | ||
//============================================================================ | ||
|
||
// file-names | ||
std::string millePedeLogFile_; | ||
std::string millePedeResFile_; | ||
|
||
// 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_, maxErrorCut_; | ||
|
||
double Cutoffs[6] = { Xcut_, Ycut_, Zcut_, | ||
tXcut_, tYcut_, tZcut_}; | ||
|
||
bool PedeSuccess = false; | ||
bool Movements = false; | ||
bool Error = false; | ||
bool Significant = false; | ||
bool updateDB = false; | ||
bool HitMax = false; | ||
bool HitErrorMax = false; | ||
|
||
int Nrec = 0; | ||
|
||
|
||
|
||
std::array<double, 6> Xobs = {{0.,0.,0.,0.,0.,0.}}; | ||
std::array<double, 6> XobsErr = {{0.,0.,0.,0.,0.,0.}}; | ||
std::array<double, 6> tXobs = {{0.,0.,0.,0.,0.,0.}}; | ||
std::array<double, 6> tXobsErr = {{0.,0.,0.,0.,0.,0.}}; | ||
|
||
std::array<double, 6> Yobs = {{0.,0.,0.,0.,0.,0.}}; | ||
std::array<double, 6> YobsErr = {{0.,0.,0.,0.,0.,0.}}; | ||
std::array<double, 6> tYobs = {{0.,0.,0.,0.,0.,0.}}; | ||
std::array<double, 6> tYobsErr = {{0.,0.,0.,0.,0.,0.}}; | ||
|
||
std::array<double, 6> Zobs = {{0.,0.,0.,0.,0.,0.}}; | ||
std::array<double, 6> ZobsErr = {{0.,0.,0.,0.,0.,0.}}; | ||
std::array<double, 6> tZobs = {{0.,0.,0.,0.,0.,0.}}; | ||
std::array<double, 6> tZobsErr = {{0.,0.,0.,0.,0.,0.}}; | ||
|
||
}; | ||
|
||
|
||
|
||
//============================================================================= | ||
//=== PUBLIC METHOD IMPLEMENTATION === | ||
//============================================================================= | ||
|
||
MillePedeFileReader | ||
::MillePedeFileReader(const edm::ParameterSet& config) : | ||
millePedeLogFile_(config.getParameter<std::string>("millePedeLogFile")), | ||
millePedeResFile_(config.getParameter<std::string>("millePedeResFile")), | ||
|
||
sigCut_ (config.getParameter<double>("sigCut")), | ||
Xcut_ (config.getParameter<double>("Xcut")), | ||
tXcut_ (config.getParameter<double>("tXcut")), | ||
Ycut_ (config.getParameter<double>("Ycut")), | ||
tYcut_ (config.getParameter<double>("tYcut")), | ||
Zcut_ (config.getParameter<double>("Zcut")), | ||
tZcut_ (config.getParameter<double>("tZcut")), | ||
maxMoveCut_ (config.getParameter<double>("maxMoveCut")), | ||
maxErrorCut_(config.getParameter<double>("maxErrorCut")) | ||
{ | ||
} | ||
|
||
void MillePedeFileReader | ||
::read() { | ||
readMillePedeLogFile(); | ||
readMillePedeResultFile(); | ||
} | ||
|
||
bool MillePedeFileReader | ||
::storeAlignments() { | ||
return updateDB; | ||
} | ||
|
||
|
||
|
||
//============================================================================= | ||
//=== PRIVATE METHOD IMPLEMENTATION === | ||
//============================================================================= | ||
|
||
void MillePedeFileReader | ||
::readMillePedeLogFile() | ||
{ | ||
std::ifstream logFile; | ||
logFile.open(millePedeLogFile_.c_str()); | ||
|
||
if (logFile.is_open()) { | ||
edm::LogInfo("MillePedeFileReader") << "Reading millepede log-file"; | ||
std::string line; | ||
|
||
while (getline(logFile, line)) { | ||
std::string Nrec_string = "NREC ="; | ||
|
||
if (line.find(Nrec_string) != std::string::npos) { | ||
std::istringstream iss(line); | ||
std::string trash; | ||
iss >> trash >> trash >> Nrec; | ||
|
||
if (Nrec < 25000) { | ||
PedeSuccess = false; | ||
Movements = false; | ||
Error = false; | ||
Significant = false; | ||
updateDB = false; | ||
} | ||
} | ||
} | ||
|
||
} else { | ||
edm::LogError("MillePedeFileReader") << "Could not read millepede log-file."; | ||
|
||
PedeSuccess = false; | ||
Movements = false; | ||
Error = false; | ||
Significant = false; | ||
updateDB = false; | ||
Nrec = 0; | ||
} | ||
} | ||
|
||
void MillePedeFileReader | ||
::readMillePedeResultFile() | ||
{ | ||
std::ifstream resFile; | ||
resFile.open(millePedeResFile_.c_str()); | ||
|
||
if (resFile.is_open()) { | ||
edm::LogInfo("MillePedeFileReader") << "Reading millepede result-file"; | ||
double Multiplier[6] = {10000.,10000.,10000.,1000000.,1000000.,1000000.}; | ||
|
||
std::string line; | ||
getline(resFile, line); // drop first line | ||
|
||
while (getline(resFile, line)) { | ||
std::istringstream iss(line); | ||
|
||
std::vector<std::string> tokens; | ||
std::string token; | ||
while (iss >> token) { | ||
tokens.push_back(token); | ||
} | ||
|
||
if (tokens.size() > 4 /*3*/) { | ||
PedeSuccess = true; | ||
|
||
int alignable = std::stoi(tokens[0]); | ||
int alignableIndex = alignable % 10 - 1; | ||
|
||
double ObsMove = std::stof(tokens[3]) * Multiplier[alignableIndex]; | ||
double ObsErr = std::stof(tokens[4]) * Multiplier[alignableIndex]; | ||
|
||
int det = -1; | ||
|
||
if (alignable >= 60 && alignable <= 69) { | ||
det = 2; // TPBHalfBarrel (x+) | ||
} else if (alignable >= 8780 && alignable <= 8789) { | ||
det = 3; // TPBHalfBarrel (x-) | ||
} else if (alignable >= 17520 && alignable <= 17529) { | ||
det = 4; // TPEHalfCylinder (x+,z+) | ||
} else if (alignable >= 22380 && alignable <= 22389) { | ||
det = 5; // TPEHalfCylinder (x-,z+) | ||
} else if (alignable >= 27260 && alignable <= 27269) { | ||
det = 0; // TPEHalfCylinder (x+,z-) | ||
} else if (alignable >= 32120 && alignable <= 32129) { | ||
det = 1; //TPEHalfCylinder (x-,z-) | ||
} else { | ||
continue; | ||
} | ||
|
||
if (alignableIndex == 0 && det >= 0 && det <= 5) { | ||
Xobs[det] = ObsMove; | ||
XobsErr[det] = ObsErr; | ||
} else if (alignableIndex == 1 && det >= 0 && det <= 5) { | ||
Yobs[det] = ObsMove; | ||
YobsErr[det] = ObsErr; | ||
} else if (alignableIndex == 2 && det >= 0 && det <= 5) { | ||
Zobs[det] = ObsMove; | ||
ZobsErr[det] = ObsErr; | ||
} else if (alignableIndex == 3 && det >= 0 && det <= 5) { | ||
tXobs[det] = ObsMove; | ||
tXobsErr[det] = ObsErr; | ||
} else if (alignableIndex == 4 && det >= 0 && det <= 5) { | ||
tYobs[det] = ObsMove; | ||
tYobsErr[det] = ObsErr; | ||
} else if (alignableIndex == 5 && det >= 0 && det <= 5) { | ||
tZobs[det] = ObsMove; | ||
tZobsErr[det] = ObsErr; | ||
} | ||
|
||
if (abs(ObsMove) > maxMoveCut_) { | ||
Movements = false; | ||
Error = false; | ||
Significant = false; | ||
updateDB = false; | ||
HitMax = false; | ||
continue; | ||
|
||
} else if (abs(ObsMove) > Cutoffs[alignableIndex]) { | ||
Movements = true; | ||
|
||
if (abs(ObsErr) > maxErrorCut_) { | ||
Error = false; | ||
Significant = false; | ||
updateDB = false; | ||
HitErrorMax = true; | ||
continue; | ||
} else { | ||
Error = true; | ||
if (abs(ObsMove/ObsErr) > sigCut_) { | ||
Significant = true; | ||
} | ||
} | ||
} | ||
updateDB = true; | ||
} | ||
} | ||
} else { | ||
edm::LogError("MillePedeFileReader") << "Could not read millepede result-file."; | ||
|
||
PedeSuccess = false; | ||
Movements = false; | ||
Error = false; | ||
Significant = false; | ||
updateDB = false; | ||
Nrec = 0; | ||
} | ||
} | ||
|
||
|
||
|
||
#endif /* ALIGNMENT_MILLEPEDEALIGNMENTALGORITHM_INTERFACE_MILLEPEDEFILEREADER_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ghellwig for the sake of curiosity how is the millepede internal labeling going to behave with the phase-I geometry?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mmusich I think, as long as the number of alignables does not exceed 700000 we are fine:
https://github.com/cerminar/cmssw/blob/PCLDQMPlots_80X_v2/Alignment/MillePedeAlignmentAlgorithm/src/PedeLabelerBase.cc#L22
Haven't checked it, though.