1 #ifndef CONDCORE_ALIGNMENTPLUGINS_ALIGNMENTPAYLOADINSPECTORHELPER_H 2 #define CONDCORE_ALIGNMENTPLUGINS_ALIGNMENTPAYLOADINSPECTORHELPER_H 11 #include "TPaveStats.h" 25 #define COUT std::cout << "MM " 27 #define COUT edm::LogVerbatim("") 40 const double tol = 2.e-7;
338 bool isOuter =
false;
343 isOuter = !odd_ladder;
345 isOuter = odd_ladder;
348 isOuter = !odd_ladder;
350 isOuter = odd_ladder;
415 unsigned int subdetId =
static_cast<unsigned int>(detId.
subdetId());
634 return "x-translation";
636 return "y-translation";
638 return "z-translation";
640 return "#alpha angle rotation";
642 return "#beta angle rotation";
644 return "#gamma angle rotation";
646 return "should never be here!";
668 return "should never be here!";
690 return "should never be here!";
700 return std::make_pair(0, 0);
702 return std::make_pair(0, 1);
704 return std::make_pair(0, 2);
706 return std::make_pair(1, 0);
708 return std::make_pair(1, 1);
710 return std::make_pair(2, 2);
712 return std::make_pair(-1, -1);
720 hist->SetStats(kFALSE);
722 hist->GetXaxis()->SetTitleColor(color);
723 hist->SetLineColor(color);
724 hist->SetTitleSize(0.08);
725 hist->SetLineWidth(2);
726 hist->GetXaxis()->CenterTitle(
true);
727 hist->GetYaxis()->CenterTitle(
true);
728 hist->GetXaxis()->SetTitleFont(42);
729 hist->GetYaxis()->SetTitleFont(42);
730 hist->GetXaxis()->SetNdivisions(505);
731 hist->GetXaxis()->SetTitleSize(0.06);
732 hist->GetYaxis()->SetTitleSize(0.06);
733 hist->GetXaxis()->SetTitleOffset(1.0);
734 hist->GetYaxis()->SetTitleOffset(1.3);
735 hist->GetXaxis()->SetLabelFont(42);
736 hist->GetYaxis()->SetLabelFont(42);
737 hist->GetYaxis()->SetLabelSize(.05);
738 hist->GetXaxis()->SetLabelSize(.05);
746 TPaveText*
stat =
new TPaveText(0.60, 0.75, 0.95, 0.95,
"NDC");
750 sprintf(
buffer,
"Entries : %i\n", (
int)
hist->GetEntries());
754 sprintf(
buffer,
"Mean : %6.2f\n",
hist->GetMean());
756 sprintf(
buffer,
"Mean : %6.2f e-2\n", 100 *
hist->GetMean());
761 sprintf(
buffer,
"RMS : %6.2f\n",
hist->GetRMS());
763 sprintf(
buffer,
"RMS : %6.2f e-2\n", 100 *
hist->GetRMS());
767 stat->SetLineColor(color);
768 stat->SetTextColor(color);
769 stat->SetFillColor(10);
770 stat->SetShadowColor(10);
775 inline std::pair<float, float>
getTheRange(std::map<uint32_t, float>
values,
const float nsigma)
778 float sum = std::accumulate(
787 accum += (
p.second -
m) * (
p.second -
m);
793 return std::make_pair(
m - nsigma *
stdev,
m + nsigma *
stdev);
795 return std::make_pair(
m > 0. ? 0.95 *
m : 1.05 *
m,
m > 0 ? 1.05 *
m : 0.95 *
m);
805 int iw = myPad->GetWw();
806 int ih = myPad->GetWh();
807 double x1p, y1p, x2p, y2p;
808 myPad->GetPadPar(x1p, y1p, x2p, y2p);
809 ix1 = (
int)(iw * x1p);
810 ix2 = (
int)(iw * x2p);
811 double wndc =
std::min(1., (
double)iw / (
double)ih);
812 double rw = wndc / (double)iw;
813 double x1ndc = (double)ix1 * rw;
814 double x2ndc = (double)ix2 * rw;
815 double rx1, ry1, rx2, ry2;
816 myPad->GetRange(rx1, ry1, rx2, ry2);
817 double rx = (x2ndc - x1ndc) / (rx2 - rx1);
819 _sx =
rx * (boundary - rx1) + x1ndc;
820 double _dx = _sx + 0.05;
822 return std::make_pair(_sx, _dx);
839 const std::map<AlignmentPI::coordinate, float>& GPR);
847 const std::array<double, 6>
getX()
859 const std::array<double, 6>
getY()
871 const std::array<double, 6>
getZ()
894 const std::map<AlignmentPI::coordinate, float>& GPR)
902 for (
const auto& ali :
input) {
905 <<
"Encountered invalid Tracker DetId:" << ali.rawId() <<
" " <<
DetId(ali.rawId()).det()
910 int subid =
DetId(ali.rawId()).subdetId();
977 edm::LogError(
"TrackerAlignment_PayloadInspector") <<
"Unrecognized partition " << subid << std::endl;
993 COUT <<
"Partition: " <<
p <<
" n. modules: " <<
nmodules[
p] <<
"|" 994 <<
" X: " << std::right << std::setw(12) <<
Xbarycenters[
p] <<
" Y: " << std::right << std::setw(12)
1001 std::vector<int>& boundaries,
1002 const std::vector<AlignTransform>& ref_ali,
1003 const std::vector<AlignTransform>& target_ali,
1004 std::unique_ptr<TH1F>&
compare)
1009 for (
unsigned int i = 0;
i < ref_ali.size();
i++) {
1010 if (ref_ali[
i].rawId() == target_ali[
i].rawId()) {
1015 if (thePart != currentPart) {
1016 currentPart = thePart;
1017 boundaries.push_back(
counter);
1020 CLHEP::HepRotation target_rot(target_ali[
i].
rotation());
1021 CLHEP::HepRotation ref_rot(ref_ali[
i].
rotation());
1047 const auto& deltaTrans = target_ali[
i].translation() - ref_ali[
i].translation();
1069 edm::LogError(
"TrackerAlignment_PayloadInspector") <<
"Unrecognized coordinate " << coord << std::endl;
1078 const std::vector<AlignTransform>& ref_ali,
1079 const std::vector<AlignTransform>& target_ali,
1087 for (
unsigned int i = 0;
i < ref_ali.size();
i++) {
1088 if (ref_ali[
i].rawId() == target_ali[
i].rawId()) {
1095 if (checkPart > 0 && thePart != checkPart) {
1099 if (thePart != currentPart) {
1100 currentPart = thePart;
1101 boundaries.push_back(
counter);
1104 CLHEP::HepRotation target_rot(target_ali[
i].
rotation());
1105 CLHEP::HepRotation ref_rot(ref_ali[
i].
rotation());
1131 const auto& deltaTrans = target_ali[
i].translation() - ref_ali[
i].translation();
const std::array< double, 6 > getY()
const double getNModules(AlignmentPI::PARTITION p)
static constexpr auto TEC
bool tibIsDoubleSide(const DetId &id) const
bool tecIsDoubleSide(const DetId &id) const
bool tidIsDoubleSide(const DetId &id) const
unsigned int tobLayer(const DetId &id) const
unsigned int pxbLayer(const DetId &id) const
unsigned int tibSide(const DetId &id) const
void fillComparisonHistogram(const AlignmentPI::coordinate &coord, std::vector< int > &boundaries, const std::vector< AlignTransform > &ref_ali, const std::vector< AlignTransform > &target_ali, std::unique_ptr< TH1F > &compare)
unsigned int tobSide(const DetId &id) const
double trim2PIs(const double phi, const double tolerance=1.f)
std::ostream & operator<<(std::ostream &o, PARTITION x)
std::vector< unsigned int > tidModuleInfo(const DetId &id) const
void makeNicePlotStyle(TH1 *hist, int color)
void computeBarycenters(const std::vector< AlignTransform > &input, const TrackerTopology &tTopo, const std::map< AlignmentPI::coordinate, float > &GPR)
ret
prodAgent to be discontinued
unsigned int tidSide(const DetId &id) const
std::vector< unsigned int > tecPetalInfo(const DetId &id) const
unsigned int tidWheel(const DetId &id) const
unsigned int tecWheel(const DetId &id) const
const PARTITION PARTITIONS[(int) PARTITION::LAST+1]
Global3DPoint GlobalPoint
virtual ~TkAlBarycenters()
std::string getStringFromPart(AlignmentPI::partitions i)
bool isBPixOuterLadder(const DetId &detid, const TrackerTopology &tTopo, bool isPhase0)
bool isRPhi(const DetId &id) const
unsigned int pxbLadder(const DetId &id) const
Log< level::Error, false > LogError
unsigned int tecRing(const DetId &id) const
ring id
bool tobIsDoubleSide(const DetId &id) const
static const float cmToUm
static std::string const input
void makeNiceStats(TH1F *hist, AlignmentPI::partitions part, int color)
void fillComparisonHistograms(std::vector< int > &boundaries, const std::vector< AlignTransform > &ref_ali, const std::vector< AlignTransform > &target_ali, std::unordered_map< AlignmentPI::coordinate, std::unique_ptr< TH1F > > &compare, bool diff=false, AlignmentPI::partitions checkPart=AlignmentPI::INVALID)
const std::array< double, 6 > getX()
static const unsigned int phase0size
Container::value_type value_type
unsigned int tecSide(const DetId &id) const
static const float tomRad
void fillGeometryInfo(const DetId &detId, const TrackerTopology &tTopo, bool isPhase0)
unsigned int pxfDisk(const DetId &id) const
Abs< T >::type abs(const T &t)
double returnZeroIfNear2PI(const double phi)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
std::map< AlignmentPI::PARTITION, double > Zbarycenters
EulerAngles toAngles(const RotationType &)
Convert rotation matrix to angles about x-, y-, z-axes (frame rotation).
static constexpr auto TOB
std::pair< int, int > getIndices(AlignmentPI::index i)
constexpr valType roundIfNear0(valType value, double tolerance=1.e-7)
std::pair< float, float > getTheRange(std::map< uint32_t, float > values, const float nsigma)
GlobalPoint getPartitionAvg(AlignmentPI::PARTITION p)
unsigned int pxfSide(const DetId &id) const
static constexpr auto TIB
constexpr uint32_t rawId() const
get the raw id
std::string getStringFromCoordinate(AlignmentPI::coordinate coord)
AlignmentPI::regions filterThePartition()
bool tibIsInternalString(const DetId &id) const
std::string getStringFromIndex(AlignmentPI::index i)
std::map< AlignmentPI::PARTITION, double > Ybarycenters
std::pair< double, double > calculatePosition(TVirtualPad *myPad, int boundary)
std::map< AlignmentPI::PARTITION, double > nmodules
unsigned int tidRing(const DetId &id) const
std::map< AlignmentPI::PARTITION, double > Xbarycenters
unsigned int tibLayer(const DetId &id) const
std::string getStringFromRegionEnum(AlignmentPI::regions e)
unsigned int tobModule(const DetId &id) const
Log< level::Warning, false > LogWarning
const std::array< double, 6 > getZ()
static constexpr auto TID