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

Constructor & Destructor Documentation

◆ ~TkAlBarycenters()

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

Definition at line 882 of file AlignmentPayloadInspectorHelper.h.

882 {}

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

908  {
909  // clear all data members;
910  init();
911 
912  for (const auto& ali : input) {
913  if (DetId(ali.rawId()).det() != DetId::Tracker) {
914  edm::LogWarning("TkAlBarycenters::computeBarycenters")
915  << "Encountered invalid Tracker DetId:" << ali.rawId() << " " << DetId(ali.rawId()).det()
916  << " is different from " << DetId::Tracker << " - terminating ";
917  assert(DetId(ali.rawId()).det() != DetId::Tracker);
918  }
919 
920  int subid = DetId(ali.rawId()).subdetId();
921  switch (subid) {
923  Xbarycenters[PARTITION::BPIX] += (ali.translation().x());
924  Ybarycenters[PARTITION::BPIX] += (ali.translation().y());
925  Zbarycenters[PARTITION::BPIX] += (ali.translation().z());
927  break;
929 
930  // minus side
931  if (tTopo.pxfSide(DetId(ali.rawId())) == 1) {
932  Xbarycenters[PARTITION::FPIXm] += (ali.translation().x());
933  Ybarycenters[PARTITION::FPIXm] += (ali.translation().y());
934  Zbarycenters[PARTITION::FPIXm] += (ali.translation().z());
936  } // plus side
937  else {
938  Xbarycenters[PARTITION::FPIXp] += (ali.translation().x());
939  Ybarycenters[PARTITION::FPIXp] += (ali.translation().y());
940  Zbarycenters[PARTITION::FPIXp] += (ali.translation().z());
942  }
943  break;
945  Xbarycenters[PARTITION::TIB] += (ali.translation().x());
946  Ybarycenters[PARTITION::TIB] += (ali.translation().y());
947  Zbarycenters[PARTITION::TIB] += (ali.translation().z());
949  break;
951  // minus side
952  if (tTopo.tidSide(DetId(ali.rawId())) == 1) {
953  Xbarycenters[PARTITION::TIDm] += (ali.translation().x());
954  Ybarycenters[PARTITION::TIDm] += (ali.translation().y());
955  Zbarycenters[PARTITION::TIDm] += (ali.translation().z());
957  } // plus side
958  else {
959  Xbarycenters[PARTITION::TIDp] += (ali.translation().x());
960  Ybarycenters[PARTITION::TIDp] += (ali.translation().y());
961  Zbarycenters[PARTITION::TIDp] += (ali.translation().z());
963  }
964  break;
966  Xbarycenters[PARTITION::TOB] += (ali.translation().x());
967  Ybarycenters[PARTITION::TOB] += (ali.translation().y());
968  Zbarycenters[PARTITION::TOB] += (ali.translation().z());
970  break;
972  // minus side
973  if (tTopo.tecSide(DetId(ali.rawId())) == 1) {
974  Xbarycenters[PARTITION::TECm] += (ali.translation().x());
975  Ybarycenters[PARTITION::TECm] += (ali.translation().y());
976  Zbarycenters[PARTITION::TECm] += (ali.translation().z());
978  } // plus side
979  else {
980  Xbarycenters[PARTITION::TECp] += (ali.translation().x());
981  Ybarycenters[PARTITION::TECp] += (ali.translation().y());
982  Zbarycenters[PARTITION::TECp] += (ali.translation().z());
984  }
985  break;
986  default:
987  edm::LogError("TrackerAlignment_PayloadInspector") << "Unrecognized partition " << subid << std::endl;
988  break;
989  }
990  }
991 
992  for (const auto& p : PARTITIONS) {
993  // take the arithmetic mean
994  Xbarycenters[p] /= nmodules[p];
995  Ybarycenters[p] /= nmodules[p];
996  Zbarycenters[p] /= nmodules[p];
997 
998  // add the Tracker Global Position Record
999  Xbarycenters[p] += GPR.at(AlignmentPI::t_x);
1000  Ybarycenters[p] += GPR.at(AlignmentPI::t_y);
1001  Zbarycenters[p] += GPR.at(AlignmentPI::t_z);
1002 
1003  COUT << "Partition: " << p << " n. modules: " << nmodules[p] << "|"
1004  << " X: " << std::right << std::setw(12) << Xbarycenters[p] << " Y: " << std::right << std::setw(12)
1005  << Ybarycenters[p] << " Z: " << std::right << std::setw(12) << Zbarycenters[p] << std::endl;
1006  }
1007  }
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 841 of file AlignmentPayloadInspectorHelper.h.

References nmodules, and AlCaHLTBitMon_ParallelJobs::p.

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

◆ getPartitionAvg()

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

Definition at line 897 of file AlignmentPayloadInspectorHelper.h.

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

899  {
901  }
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 886 of file AlignmentPayloadInspectorHelper.h.

References nmodules, Xbarycenters, Ybarycenters, and Zbarycenters.

Referenced by computeBarycenters().

888  {
889  // empty all maps
890  Xbarycenters.clear();
891  Ybarycenters.clear();
892  Zbarycenters.clear();
893  nmodules.clear();
894  }
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 833 of file AlignmentPayloadInspectorHelper.h.

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

◆ Xbarycenters

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

Definition at line 830 of file AlignmentPayloadInspectorHelper.h.

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

◆ Ybarycenters

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

Definition at line 831 of file AlignmentPayloadInspectorHelper.h.

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

◆ Zbarycenters

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

Definition at line 832 of file AlignmentPayloadInspectorHelper.h.

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