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 811 of file AlignmentPayloadInspectorHelper.h.

Constructor & Destructor Documentation

◆ ~TkAlBarycenters()

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

Definition at line 864 of file AlignmentPayloadInspectorHelper.h.

864 {}

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 875 of file AlignmentPayloadInspectorHelper.h.

References cms::cuda::assert(), AlignmentPI::BPIX, COUT, AlignmentPI::FPIXm, AlignmentPI::FPIXp, 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.

879  {
880  // zero in the n. modules per partition...
881  for (const auto& p : PARTITIONS) {
882  nmodules[p] = 0.;
883  }
884 
885  for (const auto& ali : input) {
886  if (DetId(ali.rawId()).det() != DetId::Tracker) {
887  edm::LogWarning("TkAlBarycenters::computeBarycenters")
888  << "Encountered invalid Tracker DetId:" << ali.rawId() << " " << DetId(ali.rawId()).det()
889  << " is different from " << DetId::Tracker << " - terminating ";
890  assert(DetId(ali.rawId()).det() != DetId::Tracker);
891  }
892 
893  int subid = DetId(ali.rawId()).subdetId();
894  switch (subid) {
896  Xbarycenters[PARTITION::BPIX] += (ali.translation().x());
897  Ybarycenters[PARTITION::BPIX] += (ali.translation().y());
898  Zbarycenters[PARTITION::BPIX] += (ali.translation().z());
900  break;
902 
903  // minus side
904  if (tTopo.pxfSide(DetId(ali.rawId())) == 1) {
905  Xbarycenters[PARTITION::FPIXm] += (ali.translation().x());
906  Ybarycenters[PARTITION::FPIXm] += (ali.translation().y());
907  Zbarycenters[PARTITION::FPIXm] += (ali.translation().z());
909  } // plus side
910  else {
911  Xbarycenters[PARTITION::FPIXp] += (ali.translation().x());
912  Ybarycenters[PARTITION::FPIXp] += (ali.translation().y());
913  Zbarycenters[PARTITION::FPIXp] += (ali.translation().z());
915  }
916  break;
918  Xbarycenters[PARTITION::TIB] += (ali.translation().x());
919  Ybarycenters[PARTITION::TIB] += (ali.translation().y());
920  Zbarycenters[PARTITION::TIB] += (ali.translation().z());
922  break;
924  // minus side
925  if (tTopo.tidSide(DetId(ali.rawId())) == 1) {
926  Xbarycenters[PARTITION::TIDm] += (ali.translation().x());
927  Ybarycenters[PARTITION::TIDm] += (ali.translation().y());
928  Zbarycenters[PARTITION::TIDm] += (ali.translation().z());
930  } // plus side
931  else {
932  Xbarycenters[PARTITION::TIDp] += (ali.translation().x());
933  Ybarycenters[PARTITION::TIDp] += (ali.translation().y());
934  Zbarycenters[PARTITION::TIDp] += (ali.translation().z());
936  }
937  break;
939  Xbarycenters[PARTITION::TOB] += (ali.translation().x());
940  Ybarycenters[PARTITION::TOB] += (ali.translation().y());
941  Zbarycenters[PARTITION::TOB] += (ali.translation().z());
943  break;
945  // minus side
946  if (tTopo.tecSide(DetId(ali.rawId())) == 1) {
947  Xbarycenters[PARTITION::TECm] += (ali.translation().x());
948  Ybarycenters[PARTITION::TECm] += (ali.translation().y());
949  Zbarycenters[PARTITION::TECm] += (ali.translation().z());
951  } // plus side
952  else {
953  Xbarycenters[PARTITION::TECp] += (ali.translation().x());
954  Ybarycenters[PARTITION::TECp] += (ali.translation().y());
955  Zbarycenters[PARTITION::TECp] += (ali.translation().z());
957  }
958  break;
959  default:
960  edm::LogError("TrackerAlignment_PayloadInspector") << "Unrecognized partition " << subid << std::endl;
961  break;
962  }
963  }
964 
965  for (const auto& p : PARTITIONS) {
966  // take the arithmetic mean
967  Xbarycenters[p] /= nmodules[p];
968  Ybarycenters[p] /= nmodules[p];
969  Zbarycenters[p] /= nmodules[p];
970 
971  // add the Tracker Global Position Record
972  Xbarycenters[p] += GPR.at(AlignmentPI::t_x);
973  Ybarycenters[p] += GPR.at(AlignmentPI::t_y);
974  Zbarycenters[p] += GPR.at(AlignmentPI::t_z);
975 
976  COUT << "Partition: " << p << " n. modules: " << nmodules[p] << "|"
977  << " X: " << std::right << std::setw(12) << Xbarycenters[p] << " Y: " << std::right << std::setw(12)
978  << Ybarycenters[p] << " Z: " << std::right << std::setw(12) << Zbarycenters[p] << std::endl;
979  }
980  }
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 823 of file AlignmentPayloadInspectorHelper.h.

References nmodules, and AlCaHLTBitMon_ParallelJobs::p.

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

◆ getPartitionAvg()

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

Definition at line 868 of file AlignmentPayloadInspectorHelper.h.

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

870  {
872  }
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 ( )

Member Data Documentation

◆ nmodules

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

Definition at line 815 of file AlignmentPayloadInspectorHelper.h.

Referenced by computeBarycenters(), and getNModules().

◆ Xbarycenters

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

Definition at line 812 of file AlignmentPayloadInspectorHelper.h.

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

◆ Ybarycenters

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

Definition at line 813 of file AlignmentPayloadInspectorHelper.h.

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

◆ Zbarycenters

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

Definition at line 814 of file AlignmentPayloadInspectorHelper.h.

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