1 #ifndef CONDCORE_ALIGNMENTPLUGINS_ALIGNMENTPAYLOADINSPECTORHELPER_H 2 #define CONDCORE_ALIGNMENTPLUGINS_ALIGNMENTPAYLOADINSPECTORHELPER_H 11 #include "TPaveStats.h" 23 #define COUT std::cout << "MM " 25 #define COUT edm::LogVerbatim("") 38 const double tol = 2.e-7;
321 bool isOuter =
false;
326 isOuter = !odd_ladder;
328 isOuter = odd_ladder;
331 isOuter = odd_ladder;
333 isOuter = !odd_ladder;
398 unsigned int subdetId =
static_cast<unsigned int>(detId.
subdetId());
617 return "x-translation";
619 return "y-translation";
621 return "z-translation";
623 return "#alpha angle rotation";
625 return "#beta angle rotation";
627 return "#gamma angle rotation";
629 return "should never be here!";
651 return "should never be here!";
673 return "should never be here!";
683 return std::make_pair(0, 0);
685 return std::make_pair(0, 1);
687 return std::make_pair(0, 2);
689 return std::make_pair(1, 0);
691 return std::make_pair(1, 1);
693 return std::make_pair(2, 2);
695 return std::make_pair(-1, -1);
703 hist->SetStats(kFALSE);
705 hist->GetXaxis()->SetTitleColor(color);
706 hist->SetLineColor(color);
707 hist->SetTitleSize(0.08);
708 hist->SetLineWidth(2);
709 hist->GetXaxis()->CenterTitle(
true);
710 hist->GetYaxis()->CenterTitle(
true);
711 hist->GetXaxis()->SetTitleFont(42);
712 hist->GetYaxis()->SetTitleFont(42);
713 hist->GetXaxis()->SetNdivisions(505);
714 hist->GetXaxis()->SetTitleSize(0.06);
715 hist->GetYaxis()->SetTitleSize(0.06);
716 hist->GetXaxis()->SetTitleOffset(1.0);
717 hist->GetYaxis()->SetTitleOffset(1.3);
718 hist->GetXaxis()->SetLabelFont(42);
719 hist->GetYaxis()->SetLabelFont(42);
720 hist->GetYaxis()->SetLabelSize(.05);
721 hist->GetXaxis()->SetLabelSize(.05);
729 TPaveText*
stat =
new TPaveText(0.60, 0.75, 0.95, 0.95,
"NDC");
733 sprintf(
buffer,
"Entries : %i\n", (
int)
hist->GetEntries());
737 sprintf(
buffer,
"Mean : %6.2f\n",
hist->GetMean());
739 sprintf(
buffer,
"Mean : %6.2f e-2\n", 100 *
hist->GetMean());
744 sprintf(
buffer,
"RMS : %6.2f\n",
hist->GetRMS());
746 sprintf(
buffer,
"RMS : %6.2f e-2\n", 100 *
hist->GetRMS());
750 stat->SetLineColor(color);
751 stat->SetTextColor(color);
752 stat->SetFillColor(10);
753 stat->SetShadowColor(10);
758 inline std::pair<float, float>
getTheRange(std::map<uint32_t, float>
values,
const float nsigma)
761 float sum = std::accumulate(
770 accum += (
p.second -
m) * (
p.second -
m);
776 return std::make_pair(
m - nsigma *
stdev,
m + nsigma *
stdev);
778 return std::make_pair(
m > 0. ? 0.95 *
m : 1.05 *
m,
m > 0 ? 1.05 *
m : 0.95 *
m);
788 int iw = myPad->GetWw();
789 int ih = myPad->GetWh();
790 double x1p, y1p, x2p, y2p;
791 myPad->GetPadPar(x1p, y1p, x2p, y2p);
792 ix1 = (
int)(iw * x1p);
793 ix2 = (
int)(iw * x2p);
794 double wndc =
std::min(1., (
double)iw / (
double)ih);
795 double rw = wndc / (double)iw;
796 double x1ndc = (double)ix1 * rw;
797 double x2ndc = (double)ix2 * rw;
798 double rx1, ry1, rx2, ry2;
799 myPad->GetRange(rx1, ry1, rx2, ry2);
800 double rx = (x2ndc - x1ndc) / (rx2 - rx1);
802 _sx =
rx * (boundary - rx1) + x1ndc;
803 double _dx = _sx + 0.05;
805 return std::make_pair(_sx, _dx);
822 const std::map<AlignmentPI::coordinate, float>& GPR);
830 const std::array<double, 6>
getX()
842 const std::array<double, 6>
getY()
854 const std::array<double, 6>
getZ()
877 const std::map<AlignmentPI::coordinate, float>& GPR)
885 for (
const auto& ali :
input) {
888 <<
"Encountered invalid Tracker DetId:" << ali.rawId() <<
" " <<
DetId(ali.rawId()).det()
893 int subid =
DetId(ali.rawId()).subdetId();
960 edm::LogError(
"TrackerAlignment_PayloadInspector") <<
"Unrecognized partition " << subid << std::endl;
976 COUT <<
"Partition: " <<
p <<
" n. modules: " <<
nmodules[
p] <<
"|" 977 <<
" 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
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
unsigned int tobSide(const DetId &id) const
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
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()
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)
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
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
float returnZeroIfNear2PI(const float phi)