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

Constructor & Destructor Documentation

◆ ~TkAlBarycenters()

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

Definition at line 903 of file AlignmentPayloadInspectorHelper.h.

903 {}

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 925 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.

Referenced by BeamSpotOnlineShifter::deltaAlignments().

929  {
930  // clear all data members;
931  init();
932 
933  for (const auto& ali : input) {
934  if (DetId(ali.rawId()).det() != DetId::Tracker) {
935  edm::LogWarning("TkAlBarycenters::computeBarycenters")
936  << "Encountered invalid Tracker DetId:" << ali.rawId() << " " << DetId(ali.rawId()).det()
937  << " is different from " << DetId::Tracker << " - terminating ";
938  assert(DetId(ali.rawId()).det() != DetId::Tracker);
939  }
940 
941  int subid = DetId(ali.rawId()).subdetId();
942  switch (subid) {
944  Xbarycenters[PARTITION::BPIX] += (ali.translation().x());
945  Ybarycenters[PARTITION::BPIX] += (ali.translation().y());
946  Zbarycenters[PARTITION::BPIX] += (ali.translation().z());
948  break;
950 
951  // minus side
952  if (tTopo.pxfSide(DetId(ali.rawId())) == 1) {
953  Xbarycenters[PARTITION::FPIXm] += (ali.translation().x());
954  Ybarycenters[PARTITION::FPIXm] += (ali.translation().y());
955  Zbarycenters[PARTITION::FPIXm] += (ali.translation().z());
957  } // plus side
958  else {
959  Xbarycenters[PARTITION::FPIXp] += (ali.translation().x());
960  Ybarycenters[PARTITION::FPIXp] += (ali.translation().y());
961  Zbarycenters[PARTITION::FPIXp] += (ali.translation().z());
963  }
964  break;
966  Xbarycenters[PARTITION::TIB] += (ali.translation().x());
967  Ybarycenters[PARTITION::TIB] += (ali.translation().y());
968  Zbarycenters[PARTITION::TIB] += (ali.translation().z());
970  break;
972  // minus side
973  if (tTopo.tidSide(DetId(ali.rawId())) == 1) {
974  Xbarycenters[PARTITION::TIDm] += (ali.translation().x());
975  Ybarycenters[PARTITION::TIDm] += (ali.translation().y());
976  Zbarycenters[PARTITION::TIDm] += (ali.translation().z());
978  } // plus side
979  else {
980  Xbarycenters[PARTITION::TIDp] += (ali.translation().x());
981  Ybarycenters[PARTITION::TIDp] += (ali.translation().y());
982  Zbarycenters[PARTITION::TIDp] += (ali.translation().z());
984  }
985  break;
987  Xbarycenters[PARTITION::TOB] += (ali.translation().x());
988  Ybarycenters[PARTITION::TOB] += (ali.translation().y());
989  Zbarycenters[PARTITION::TOB] += (ali.translation().z());
991  break;
993  // minus side
994  if (tTopo.tecSide(DetId(ali.rawId())) == 1) {
995  Xbarycenters[PARTITION::TECm] += (ali.translation().x());
996  Ybarycenters[PARTITION::TECm] += (ali.translation().y());
997  Zbarycenters[PARTITION::TECm] += (ali.translation().z());
999  } // plus side
1000  else {
1001  Xbarycenters[PARTITION::TECp] += (ali.translation().x());
1002  Ybarycenters[PARTITION::TECp] += (ali.translation().y());
1003  Zbarycenters[PARTITION::TECp] += (ali.translation().z());
1005  }
1006  break;
1007  default:
1008  edm::LogError("TrackerAlignment_PayloadInspector") << "Unrecognized partition " << subid << std::endl;
1009  break;
1010  }
1011  }
1012 
1013  for (const auto& p : PARTITIONS) {
1014  // take the arithmetic mean
1015  Xbarycenters[p] /= nmodules[p];
1016  Ybarycenters[p] /= nmodules[p];
1017  Zbarycenters[p] /= nmodules[p];
1018 
1019  // add the Tracker Global Position Record
1020  Xbarycenters[p] += GPR.at(AlignmentPI::t_x);
1021  Ybarycenters[p] += GPR.at(AlignmentPI::t_y);
1022  Zbarycenters[p] += GPR.at(AlignmentPI::t_z);
1023 
1024  COUT << "Partition: " << p << " n. modules: " << nmodules[p] << "|"
1025  << " X: " << std::right << std::setw(12) << Xbarycenters[p] << " Y: " << std::right << std::setw(12)
1026  << Ybarycenters[p] << " Z: " << std::right << std::setw(12) << Zbarycenters[p] << std::endl;
1027  }
1028  }
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

◆ getPartitionAvg()

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

Definition at line 918 of file AlignmentPayloadInspectorHelper.h.

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

Referenced by BeamSpotOnlineShifter::getPixelBarycenter().

920  {
922  }
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 907 of file AlignmentPayloadInspectorHelper.h.

References nmodules, Xbarycenters, Ybarycenters, and Zbarycenters.

Referenced by computeBarycenters().

909  {
910  // empty all maps
911  Xbarycenters.clear();
912  Ybarycenters.clear();
913  Zbarycenters.clear();
914  nmodules.clear();
915  }
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 854 of file AlignmentPayloadInspectorHelper.h.

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

◆ Xbarycenters

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

Definition at line 851 of file AlignmentPayloadInspectorHelper.h.

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

◆ Ybarycenters

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

Definition at line 852 of file AlignmentPayloadInspectorHelper.h.

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

◆ Zbarycenters

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

Definition at line 853 of file AlignmentPayloadInspectorHelper.h.

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