CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
AlignmentPI::TkAlBarycenters Struct Reference

#include <AlignmentPayloadInspectorHelper.h>

Public Member Functions

void computeBarycenters (const std::vector< AlignTransform > &input, const TrackerTopology &tTopo, const std::map< AlignmentPI::coordinate, float > &GPR)
 
const double getNModules (AlignmentPI::PARTITION p)
 
GlobalPoint getPartitionAvg (AlignmentPI::PARTITION p)
 
const std::array< double, 6 > getX ()
 
const std::array< double, 6 > getY ()
 
const std::array< double, 6 > getZ ()
 
void init ()
 
virtual ~TkAlBarycenters ()
 

Public Attributes

std::map< AlignmentPI::PARTITION, double > nmodules
 
std::map< AlignmentPI::PARTITION, double > Xbarycenters
 
std::map< AlignmentPI::PARTITION, double > Ybarycenters
 
std::map< AlignmentPI::PARTITION, double > Zbarycenters
 

Detailed Description

Definition at line 849 of file AlignmentPayloadInspectorHelper.h.

Constructor & Destructor Documentation

◆ ~TkAlBarycenters()

virtual AlignmentPI::TkAlBarycenters::~TkAlBarycenters ( )
inlinevirtual

Definition at line 902 of file AlignmentPayloadInspectorHelper.h.

902 {}

Member Function Documentation

◆ computeBarycenters()

void AlignmentPI::TkAlBarycenters::computeBarycenters ( const std::vector< AlignTransform > &  input,
const TrackerTopology tTopo,
const std::map< AlignmentPI::coordinate, float > &  GPR 
)
inline

Definition at line 924 of file AlignmentPayloadInspectorHelper.h.

References cms::cuda::assert(), AlignmentPI::BPIX, COUT, AlignmentPI::FPIXm, AlignmentPI::FPIXp, init(), input, nmodules, AlCaHLTBitMon_ParallelJobs::p, AlignmentPI::PARTITIONS, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, TrackerTopology::pxfSide(), AlignmentPI::t_x, AlignmentPI::t_y, AlignmentPI::t_z, StripSubdetector::TEC, AlignmentPI::TECm, AlignmentPI::TECp, TrackerTopology::tecSide(), StripSubdetector::TIB, AlignmentPI::TIB, StripSubdetector::TID, AlignmentPI::TIDm, AlignmentPI::TIDp, TrackerTopology::tidSide(), StripSubdetector::TOB, AlignmentPI::TOB, DetId::Tracker, Xbarycenters, Ybarycenters, and Zbarycenters.

928  {
929  // clear all data members;
930  init();
931 
932  for (const auto& ali : input) {
933  if (DetId(ali.rawId()).det() != DetId::Tracker) {
934  edm::LogWarning("TkAlBarycenters::computeBarycenters")
935  << "Encountered invalid Tracker DetId:" << ali.rawId() << " " << DetId(ali.rawId()).det()
936  << " is different from " << DetId::Tracker << " - terminating ";
937  assert(DetId(ali.rawId()).det() != DetId::Tracker);
938  }
939 
940  int subid = DetId(ali.rawId()).subdetId();
941  switch (subid) {
943  Xbarycenters[PARTITION::BPIX] += (ali.translation().x());
944  Ybarycenters[PARTITION::BPIX] += (ali.translation().y());
945  Zbarycenters[PARTITION::BPIX] += (ali.translation().z());
947  break;
949 
950  // minus side
951  if (tTopo.pxfSide(DetId(ali.rawId())) == 1) {
952  Xbarycenters[PARTITION::FPIXm] += (ali.translation().x());
953  Ybarycenters[PARTITION::FPIXm] += (ali.translation().y());
954  Zbarycenters[PARTITION::FPIXm] += (ali.translation().z());
956  } // plus side
957  else {
958  Xbarycenters[PARTITION::FPIXp] += (ali.translation().x());
959  Ybarycenters[PARTITION::FPIXp] += (ali.translation().y());
960  Zbarycenters[PARTITION::FPIXp] += (ali.translation().z());
962  }
963  break;
965  Xbarycenters[PARTITION::TIB] += (ali.translation().x());
966  Ybarycenters[PARTITION::TIB] += (ali.translation().y());
967  Zbarycenters[PARTITION::TIB] += (ali.translation().z());
969  break;
971  // minus side
972  if (tTopo.tidSide(DetId(ali.rawId())) == 1) {
973  Xbarycenters[PARTITION::TIDm] += (ali.translation().x());
974  Ybarycenters[PARTITION::TIDm] += (ali.translation().y());
975  Zbarycenters[PARTITION::TIDm] += (ali.translation().z());
977  } // plus side
978  else {
979  Xbarycenters[PARTITION::TIDp] += (ali.translation().x());
980  Ybarycenters[PARTITION::TIDp] += (ali.translation().y());
981  Zbarycenters[PARTITION::TIDp] += (ali.translation().z());
983  }
984  break;
986  Xbarycenters[PARTITION::TOB] += (ali.translation().x());
987  Ybarycenters[PARTITION::TOB] += (ali.translation().y());
988  Zbarycenters[PARTITION::TOB] += (ali.translation().z());
990  break;
992  // minus side
993  if (tTopo.tecSide(DetId(ali.rawId())) == 1) {
994  Xbarycenters[PARTITION::TECm] += (ali.translation().x());
995  Ybarycenters[PARTITION::TECm] += (ali.translation().y());
996  Zbarycenters[PARTITION::TECm] += (ali.translation().z());
998  } // plus side
999  else {
1000  Xbarycenters[PARTITION::TECp] += (ali.translation().x());
1001  Ybarycenters[PARTITION::TECp] += (ali.translation().y());
1002  Zbarycenters[PARTITION::TECp] += (ali.translation().z());
1004  }
1005  break;
1006  default:
1007  edm::LogError("TrackerAlignment_PayloadInspector") << "Unrecognized partition " << subid << std::endl;
1008  break;
1009  }
1010  }
1011 
1012  for (const auto& p : PARTITIONS) {
1013  // take the arithmetic mean
1014  Xbarycenters[p] /= nmodules[p];
1015  Ybarycenters[p] /= nmodules[p];
1016  Zbarycenters[p] /= nmodules[p];
1017 
1018  // add the Tracker Global Position Record
1019  Xbarycenters[p] += GPR.at(AlignmentPI::t_x);
1020  Ybarycenters[p] += GPR.at(AlignmentPI::t_y);
1021  Zbarycenters[p] += GPR.at(AlignmentPI::t_z);
1022 
1023  COUT << "Partition: " << p << " n. modules: " << nmodules[p] << "|"
1024  << " X: " << std::right << std::setw(12) << Xbarycenters[p] << " Y: " << std::right << std::setw(12)
1025  << Ybarycenters[p] << " Z: " << std::right << std::setw(12) << Zbarycenters[p] << std::endl;
1026  }
1027  }
static constexpr auto TEC
unsigned int tidSide(const DetId &id) const
const PARTITION PARTITIONS[(int) PARTITION::LAST+1]
Log< level::Error, false > LogError
assert(be >=bs)
static std::string const input
Definition: EdmProvDump.cc:50
unsigned int tecSide(const DetId &id) const
std::map< AlignmentPI::PARTITION, double > Zbarycenters
static constexpr auto TOB
Definition: DetId.h:17
unsigned int pxfSide(const DetId &id) const
static constexpr auto TIB
std::map< AlignmentPI::PARTITION, double > Ybarycenters
std::map< AlignmentPI::PARTITION, double > nmodules
std::map< AlignmentPI::PARTITION, double > Xbarycenters
Log< level::Warning, false > LogWarning
static constexpr auto TID

◆ getNModules()

const double AlignmentPI::TkAlBarycenters::getNModules ( AlignmentPI::PARTITION  p)
inline

Definition at line 861 of file AlignmentPayloadInspectorHelper.h.

References nmodules, and AlCaHLTBitMon_ParallelJobs::p.

861 { return nmodules[p]; };
std::map< AlignmentPI::PARTITION, double > nmodules

◆ getPartitionAvg()

GlobalPoint AlignmentPI::TkAlBarycenters::getPartitionAvg ( AlignmentPI::PARTITION  p)
inline

Definition at line 917 of file AlignmentPayloadInspectorHelper.h.

References AlCaHLTBitMon_ParallelJobs::p, Xbarycenters, Ybarycenters, and Zbarycenters.

919  {
921  }
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
std::map< AlignmentPI::PARTITION, double > Zbarycenters
std::map< AlignmentPI::PARTITION, double > Ybarycenters
std::map< AlignmentPI::PARTITION, double > Xbarycenters

◆ getX()

const std::array<double, 6> AlignmentPI::TkAlBarycenters::getX ( )
inline

◆ getY()

const std::array<double, 6> AlignmentPI::TkAlBarycenters::getY ( )
inline

◆ getZ()

const std::array<double, 6> AlignmentPI::TkAlBarycenters::getZ ( )
inline

◆ init()

void AlignmentPI::TkAlBarycenters::init ( void  )
inline

Definition at line 906 of file AlignmentPayloadInspectorHelper.h.

References nmodules, Xbarycenters, Ybarycenters, and Zbarycenters.

Referenced by computeBarycenters().

908  {
909  // empty all maps
910  Xbarycenters.clear();
911  Ybarycenters.clear();
912  Zbarycenters.clear();
913  nmodules.clear();
914  }
std::map< AlignmentPI::PARTITION, double > Zbarycenters
std::map< AlignmentPI::PARTITION, double > Ybarycenters
std::map< AlignmentPI::PARTITION, double > nmodules
std::map< AlignmentPI::PARTITION, double > Xbarycenters

Member Data Documentation

◆ nmodules

std::map<AlignmentPI::PARTITION, double> AlignmentPI::TkAlBarycenters::nmodules

Definition at line 853 of file AlignmentPayloadInspectorHelper.h.

Referenced by computeBarycenters(), getNModules(), and init().

◆ Xbarycenters

std::map<AlignmentPI::PARTITION, double> AlignmentPI::TkAlBarycenters::Xbarycenters

Definition at line 850 of file AlignmentPayloadInspectorHelper.h.

Referenced by computeBarycenters(), getPartitionAvg(), getX(), and init().

◆ Ybarycenters

std::map<AlignmentPI::PARTITION, double> AlignmentPI::TkAlBarycenters::Ybarycenters

Definition at line 851 of file AlignmentPayloadInspectorHelper.h.

Referenced by computeBarycenters(), getPartitionAvg(), getY(), and init().

◆ Zbarycenters

std::map<AlignmentPI::PARTITION, double> AlignmentPI::TkAlBarycenters::Zbarycenters

Definition at line 852 of file AlignmentPayloadInspectorHelper.h.

Referenced by computeBarycenters(), getPartitionAvg(), getZ(), and init().