229 bool prepareTkAlign =
false;
230 bool prepareBS =
false;
235 prepareTkAlign =
true;
239 if (!prepareTkAlign && !prepareBS)
245 if (prepareTkAlign) {
274 std::vector<AlignTransform> tkAlignments = alignments->
m_align;
280 float nmodules_BPIX(0.);
283 float nmodules_FPIX(0.);
286 std::map<int, std::map<int, float>> nmodules_bpix;
287 std::map<int, std::map<int, GlobalVector>> barycentre_bpix;
290 std::map<int, std::map<int, float>> nmodules_fpix;
291 std::map<int, std::map<int, GlobalVector>> barycentre_fpix;
294 for (
const auto& ali : tkAlignments) {
302 GlobalVector ali_translation(ali.translation().x(), ali.translation().y(), ali.translation().z());
308 barycentre_BPIX += ali_translation;
309 barycentre_PIX += ali_translation;
321 barycentre_FPIX += ali_translation;
322 barycentre_PIX += ali_translation;
336 nmodules_fpix[disk][
ring] += 1;
337 barycentre_fpix[disk][
ring] += ali_translation;
344 float nmodules_PIX = nmodules_BPIX + nmodules_FPIX;
345 barycentre_PIX *= (1.0 / nmodules_PIX);
346 barycentre_PIX += globalTkPosition;
347 PIX_ =
GlobalPoint(barycentre_PIX.x(), barycentre_PIX.y(), barycentre_PIX.z());
351 barycentre_BPIX *= (1.0 / nmodules_BPIX);
352 barycentre_BPIX += globalTkPosition;
353 BPIX_ =
GlobalPoint(barycentre_BPIX.x(), barycentre_BPIX.y(), barycentre_BPIX.z());
356 barycentre_FPIX *= (1.0 / nmodules_FPIX);
357 barycentre_FPIX += globalTkPosition;
358 FPIX_ =
GlobalPoint(barycentre_FPIX.x(), barycentre_FPIX.y(), barycentre_FPIX.z());
370 int nmodules_BPIX_Flipped = 0;
371 int nmodules_BPIX_NonFlipped = 0;
376 for (
const auto& il : barycentre_bpix) {
377 int layer = il.first;
379 int nmodulesLayer = 0;
380 int nmodulesLayer_Flipped = 0;
381 int nmodulesLayer_NonFlipped = 0;
387 std::map<int, GlobalVector> barycentreLayer = barycentre_bpix[
layer];
388 for (
const auto&
it : barycentreLayer) {
393 BPIXLayer += barycentreLayer[
ladder];
402 nmodulesLayer_NonFlipped += nmodules_bpix[
layer][
ladder];
403 BPIXLayer_NonFlipped += barycentreLayer[
ladder];
405 nmodulesLayer_Flipped += nmodules_bpix[
layer][
ladder];
406 BPIXLayer_Flipped += barycentreLayer[
ladder];
411 nmodulesLayer_Flipped += nmodules_bpix[
layer][
ladder];
412 BPIXLayer_Flipped += barycentreLayer[
ladder];
414 nmodulesLayer_NonFlipped += nmodules_bpix[
layer][
ladder];
415 BPIXLayer_NonFlipped += barycentreLayer[
ladder];
428 nmodulesLayer_Flipped += nmodules_bpix[
layer][
ladder];
429 BPIXLayer_Flipped += barycentreLayer[
ladder];
431 nmodulesLayer_NonFlipped += nmodules_bpix[
layer][
ladder];
432 BPIXLayer_NonFlipped += barycentreLayer[
ladder];
437 nmodulesLayer_Flipped += nmodules_bpix[
layer][
ladder];
438 BPIXLayer_Flipped += barycentreLayer[
ladder];
440 nmodulesLayer_NonFlipped += nmodules_bpix[
layer][
ladder];
441 BPIXLayer_NonFlipped += barycentreLayer[
ladder];
450 BPIX_Flipped += BPIXLayer_Flipped;
451 BPIX_NonFlipped += BPIXLayer_NonFlipped;
452 nmodules_BPIX_Flipped += nmodulesLayer_Flipped;
453 nmodules_BPIX_NonFlipped += nmodulesLayer_NonFlipped;
456 BPIXLayer *= (1.0 / nmodulesLayer);
457 BPIXLayer += globalTkPosition;
458 BPIXLayer_Flipped *= (1.0 / nmodulesLayer_Flipped);
459 BPIXLayer_Flipped += globalTkPosition;
460 BPIXLayer_NonFlipped *= (1.0 / nmodulesLayer_NonFlipped);
461 BPIXLayer_NonFlipped += globalTkPosition;
466 GlobalPoint(BPIXLayer_Flipped.x(), BPIXLayer_Flipped.y(), BPIXLayer_Flipped.z());
469 GlobalPoint(BPIXLayer_NonFlipped.x(), BPIXLayer_NonFlipped.y(), BPIXLayer_NonFlipped.z());
472 BPIXLayer_Flipped.y() - BPIXLayer_NonFlipped.y(),
473 BPIXLayer_Flipped.z() - BPIXLayer_NonFlipped.z());
478 BPIX_Flipped *= (1.0 / nmodules_BPIX_Flipped);
479 BPIX_Flipped += globalTkPosition;
482 BPIX_NonFlipped *= (1.0 / nmodules_BPIX_NonFlipped);
483 BPIX_NonFlipped += globalTkPosition;
487 BPIX_Flipped.y() - BPIX_NonFlipped.y(),
488 BPIX_Flipped.z() - BPIX_NonFlipped.z());
492 int nmodules_FPIX_plus = 0;
493 int nmodules_FPIX_minus = 0;
498 for (
const auto&
id : barycentre_fpix) {
501 int nmodulesDisk = 0;
504 std::map<int, GlobalVector> baryCentreDisk =
id.second;
505 for (
const auto& ir : baryCentreDisk) {
507 nmodulesDisk += nmodules_fpix[disk][
ring];
508 FPIXDisk += ir.second;
510 nmodules_FPIX_plus += nmodules_fpix[disk][
ring];
511 FPIX_plus += ir.second;
514 nmodules_FPIX_minus += nmodules_fpix[disk][
ring];
515 FPIX_minus += ir.second;
520 FPIXDisk *= (1.0 / nmodulesDisk);
521 FPIXDisk += globalTkPosition;
533 FPIX_plus *= (1.0 / nmodules_FPIX_plus);
534 FPIX_plus += globalTkPosition;
537 FPIX_minus *= (1.0 / nmodules_FPIX_minus);
538 FPIX_minus += globalTkPosition;
GlobalPoint BPIXLayer_Flipped_[nPixelLayers]
SimplePoint vFPIXDisks_minus_[nPixelDiscs]
unsigned int pxbLayer(const DetId &id) const
double z() const
get Z beam position
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
int ringName() const
ring Id
edm::ESWatcher< BeamSpotObjectsRcd > watcherBS_
SimplePoint vBPIXLayer_NonFlipped_[nPixelLayers]
SimplePoint vBPIXLayer_DiffFlippedNonFlipped_[nPixelLayers]
SimplePoint vBPIX_DiffFlippedNonFlipped_
GlobalPoint BPIXLayer_DiffFlippedNonFlipped_[nPixelLayers]
unsigned int pxfModule(const DetId &id) const
GlobalPoint FPIXDisks_plus_[nPixelDiscs]
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeometryToken_
int quadrant(const DetId &detid, const TrackerTopology *tTopo_, bool phase_)
Global3DPoint GlobalPoint
bool IsModuleBad(const uint32_t &detid) const
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopologyToken_
unsigned int pxbLadder(const DetId &id) const
SimplePoint vBPIX_Flipped_
SimplePoint vBPIXLayer_Flipped_[nPixelLayers]
std::vector< AlignTransform > m_align
GlobalPoint BPIX_NonFlipped_
GlobalPoint BPIXLayer_[nPixelLayers]
GlobalPoint FPIXDisks_minus_[nPixelDiscs]
edm::ESWatcher< TrackerAlignmentRcd > watcherTkAlign_
bool isThere(GeomDetEnumerators::SubDetector subdet) const
HalfCylinder halfCylinder() const
unsigned int pxfDisk(const DetId &id) const
double x() const
get X beam position
const bool usePixelQuality_
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
SimplePoint vFPIXDisks_plus_[nPixelDiscs]
const edm::ESGetToken< Alignments, GlobalPositionRcd > gprToken_
std::vector< std::string > bsLabels_
unsigned int pxfPanel(const DetId &id) const
double y() const
get Y beam position
std::vector< std::string > bcLabels_
SimplePoint vBPIXLayer_[nPixelLayers]
GlobalPoint BPIX_Flipped_
std::map< std::string, TTree * > bsTrees_
bool check(const edm::EventSetup &iSetup)
const AlignTransform & DetectorGlobalPosition(const Alignments &allGlobals, const DetId &id)
SimplePoint vBPIX_NonFlipped_
const edm::ESGetToken< SiPixelQuality, SiPixelQualityFromDbRcd > siPixelQualityToken_
std::map< std::string, edm::ESGetToken< Alignments, TrackerAlignmentRcd > > tkAlignTokens_
std::map< std::string, TTree * > bcTrees_
GlobalPoint BPIXLayer_NonFlipped_[nPixelLayers]
std::map< std::string, edm::ESGetToken< BeamSpotObjects, BeamSpotObjectsRcd > > bsTokens_
GlobalPoint BPIX_DiffFlippedNonFlipped_