1 #ifndef CONDCORE_ALIGNMENTPLUGINS_ALIGNMENTPAYLOADINSPECTORHELPER_H
2 #define CONDCORE_ALIGNMENTPLUGINS_ALIGNMENTPAYLOADINSPECTORHELPER_H
11 #include "TPaveStats.h"
22 #define COUT std::cout << "MM "
24 #define COUT edm::LogVerbatim("")
27 namespace AlignmentPI {
308 bool isOuter =
false;
313 isOuter = !odd_ladder;
315 isOuter = odd_ladder;
318 isOuter = odd_ladder;
320 isOuter = !odd_ladder;
385 unsigned int subdetId =
static_cast<unsigned int>(detId.
subdetId());
604 return "x-translation";
606 return "y-translation";
608 return "z-translation";
610 return "#alpha angle rotation";
612 return "#beta angle rotation";
614 return "#gamma angle rotation";
616 return "should never be here!";
638 return "should never be here!";
660 return "should never be here!";
670 return std::make_pair(0, 0);
672 return std::make_pair(0, 1);
674 return std::make_pair(0, 2);
676 return std::make_pair(1, 0);
678 return std::make_pair(1, 1);
680 return std::make_pair(2, 2);
682 return std::make_pair(-1, -1);
690 hist->SetStats(kFALSE);
692 hist->GetXaxis()->SetTitleColor(color);
693 hist->SetLineColor(color);
694 hist->SetTitleSize(0.08);
695 hist->SetLineWidth(2);
696 hist->GetXaxis()->CenterTitle(
true);
697 hist->GetYaxis()->CenterTitle(
true);
698 hist->GetXaxis()->SetTitleFont(42);
699 hist->GetYaxis()->SetTitleFont(42);
700 hist->GetXaxis()->SetNdivisions(505);
701 hist->GetXaxis()->SetTitleSize(0.06);
702 hist->GetYaxis()->SetTitleSize(0.06);
703 hist->GetXaxis()->SetTitleOffset(1.0);
704 hist->GetYaxis()->SetTitleOffset(1.3);
705 hist->GetXaxis()->SetLabelFont(42);
706 hist->GetYaxis()->SetLabelFont(42);
707 hist->GetYaxis()->SetLabelSize(.05);
708 hist->GetXaxis()->SetLabelSize(.05);
716 TPaveText*
stat =
new TPaveText(0.60, 0.75, 0.95, 0.95,
"NDC");
718 stat->AddText(buffer);
720 sprintf(buffer,
"Entries : %i\n", (
int)hist->GetEntries());
721 stat->AddText(buffer);
723 if (
std::abs(hist->GetMean()) > 0.01) {
724 sprintf(buffer,
"Mean : %6.2f\n", hist->GetMean());
726 sprintf(buffer,
"Mean : %6.2f e-2\n", 100 * hist->GetMean());
728 stat->AddText(buffer);
730 if (
std::abs(hist->GetRMS()) > 0.01) {
731 sprintf(buffer,
"RMS : %6.2f\n", hist->GetRMS());
733 sprintf(buffer,
"RMS : %6.2f e-2\n", 100 * hist->GetRMS());
735 stat->AddText(buffer);
737 stat->SetLineColor(color);
738 stat->SetTextColor(color);
739 stat->SetFillColor(10);
740 stat->SetShadowColor(10);
745 inline std::pair<float, float>
getTheRange(std::map<uint32_t, float>
values,
const float nsigma)
748 float sum = std::accumulate(
750 return value + p.second;
753 float m = sum / values.size();
757 accum += (p.second -
m) * (p.second - m);
760 float stdev =
sqrt(accum / (values.size() - 1));
763 return std::make_pair(m - nsigma * stdev, m + nsigma * stdev);
765 return std::make_pair(m > 0. ? 0.95 * m : 1.05 * m, m > 0 ? 1.05 * m : 0.95 * m);
775 int iw = myPad->GetWw();
776 int ih = myPad->GetWh();
777 double x1p, y1p, x2p, y2p;
778 myPad->GetPadPar(x1p, y1p, x2p, y2p);
779 ix1 = (int)(iw * x1p);
780 ix2 = (int)(iw * x2p);
781 double wndc =
std::min(1., (
double)iw / (
double)ih);
782 double rw = wndc / (double)iw;
783 double x1ndc = (double)ix1 * rw;
784 double x2ndc = (double)ix2 * rw;
785 double rx1, ry1, rx2, ry2;
786 myPad->GetRange(rx1, ry1, rx2, ry2);
787 double rx = (x2ndc - x1ndc) / (rx2 - rx1);
789 _sx = rx * (boundary - rx1) + x1ndc;
790 double _dx = _sx + 0.05;
792 return std::make_pair(_sx, _dx);
809 const std::map<AlignmentPI::coordinate, float>& GPR);
817 const std::array<double, 6>
getX()
829 const std::array<double, 6>
getY()
841 const std::array<double, 6>
getZ()
864 const std::map<AlignmentPI::coordinate, float>& GPR)
867 for (
const auto& ali : input) {
870 <<
"Encountered invalid Tracker DetId:" << ali.rawId() <<
" " <<
DetId(ali.rawId()).det()
875 int subid =
DetId(ali.rawId()).subdetId();
942 edm::LogError(
"TrackerAlignment_PayloadInspector") <<
"Unrecognized partition " << subid << std::endl;
957 <<
" X: " << std::right << std::setw(12) <<
Xbarycenters[
p] <<
" Y: " << std::right << std::setw(12)
const std::array< double, 6 > getY()
const double getNModules(AlignmentPI::PARTITION p)
static constexpr auto TEC
tuple ret
prodAgent to be discontinued
bool tecIsDoubleSide(const DetId &id) const
bool tobIsDoubleSide(const DetId &id) const
bool tibIsDoubleSide(const DetId &id) const
unsigned int tibLayer(const DetId &id) const
std::ostream & operator<<(std::ostream &o, PARTITION x)
unsigned int tidRing(const DetId &id) const
void makeNicePlotStyle(TH1 *hist, int color)
std::vector< unsigned int > tidModuleInfo(const DetId &id) const
void computeBarycenters(const std::vector< AlignTransform > &input, const TrackerTopology &tTopo, const std::map< AlignmentPI::coordinate, float > &GPR)
unsigned int pxfDisk(const DetId &id) const
unsigned int tecRing(const DetId &id) const
ring id
unsigned int pxbLadder(const DetId &id) const
const PARTITION PARTITIONS[(int) PARTITION::LAST+1]
Global3DPoint GlobalPoint
constexpr uint32_t rawId() const
get the raw id
virtual ~TkAlBarycenters()
std::string getStringFromPart(AlignmentPI::partitions i)
unsigned int tidWheel(const DetId &id) const
bool isBPixOuterLadder(const DetId &detid, const TrackerTopology &tTopo, bool isPhase0)
Log< level::Error, false > LogError
static const float cmToUm
constexpr std::array< uint8_t, layerIndexSize > layer
static std::string const input
void makeNiceStats(TH1F *hist, AlignmentPI::partitions part, int color)
const std::array< double, 6 > getX()
unsigned int tibSide(const DetId &id) const
static const unsigned int phase0size
std::vector< unsigned int > tecPetalInfo(const DetId &id) const
Container::value_type value_type
unsigned int tidSide(const DetId &id) const
unsigned int tobSide(const DetId &id) const
void fillGeometryInfo(const DetId &detId, const TrackerTopology &tTopo, bool isPhase0)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
Abs< T >::type abs(const T &t)
std::map< AlignmentPI::PARTITION, double > Zbarycenters
static constexpr auto TOB
std::pair< int, int > getIndices(AlignmentPI::index i)
unsigned int pxbLayer(const DetId &id) const
std::pair< float, float > getTheRange(std::map< uint32_t, float > values, const float nsigma)
GlobalPoint getPartitionAvg(AlignmentPI::PARTITION p)
static constexpr auto TIB
std::string getStringFromCoordinate(AlignmentPI::coordinate coord)
AlignmentPI::regions filterThePartition()
bool tidIsDoubleSide(const DetId &id) const
std::string getStringFromIndex(AlignmentPI::index i)
unsigned int tobModule(const DetId &id) const
std::map< AlignmentPI::PARTITION, double > Ybarycenters
std::pair< double, double > calculatePosition(TVirtualPad *myPad, int boundary)
std::map< AlignmentPI::PARTITION, double > nmodules
unsigned int pxfSide(const DetId &id) const
std::map< AlignmentPI::PARTITION, double > Xbarycenters
std::string getStringFromRegionEnum(AlignmentPI::regions e)
Log< level::Warning, false > LogWarning
bool isRPhi(const DetId &id) const
const std::array< double, 6 > getZ()
bool tibIsInternalString(const DetId &id) const
unsigned int tecWheel(const DetId &id) const
static constexpr auto TID
unsigned int tobLayer(const DetId &id) const
unsigned int tecSide(const DetId &id) const