229 bool prepareTkAlign =
false;
230 bool prepareBS =
false;
235 prepareTkAlign =
true;
239 if (!prepareTkAlign && !prepareBS)
245 if (prepareTkAlign) {
262 std::unique_ptr<const Alignments> globalPositions = std::make_unique<Alignments>(*globalAlignments);
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;
324 int disk = tkTopo->
pxfDisk(detId);
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 (
std::map<
int, std::map<int, GlobalVector>>::iterator il = barycentre_bpix.begin();
377 il != barycentre_bpix.end();
379 int layer = il->first;
381 int nmodulesLayer = 0;
382 int nmodulesLayer_Flipped = 0;
383 int nmodulesLayer_NonFlipped = 0;
389 std::map<int, GlobalVector> barycentreLayer = barycentre_bpix[
layer];
390 for (std::map<int, GlobalVector>::iterator it = barycentreLayer.begin(); it != barycentreLayer.end(); ++it) {
395 BPIXLayer += barycentreLayer[
ladder];
404 nmodulesLayer_NonFlipped += nmodules_bpix[
layer][
ladder];
405 BPIXLayer_NonFlipped += barycentreLayer[
ladder];
407 nmodulesLayer_Flipped += nmodules_bpix[
layer][
ladder];
408 BPIXLayer_Flipped += barycentreLayer[
ladder];
413 nmodulesLayer_Flipped += nmodules_bpix[
layer][
ladder];
414 BPIXLayer_Flipped += barycentreLayer[
ladder];
416 nmodulesLayer_NonFlipped += nmodules_bpix[
layer][
ladder];
417 BPIXLayer_NonFlipped += barycentreLayer[
ladder];
430 nmodulesLayer_Flipped += nmodules_bpix[
layer][
ladder];
431 BPIXLayer_Flipped += barycentreLayer[
ladder];
433 nmodulesLayer_NonFlipped += nmodules_bpix[
layer][
ladder];
434 BPIXLayer_NonFlipped += barycentreLayer[
ladder];
439 nmodulesLayer_Flipped += nmodules_bpix[
layer][
ladder];
440 BPIXLayer_Flipped += barycentreLayer[
ladder];
442 nmodulesLayer_NonFlipped += nmodules_bpix[
layer][
ladder];
443 BPIXLayer_NonFlipped += barycentreLayer[
ladder];
452 BPIX_Flipped += BPIXLayer_Flipped;
453 BPIX_NonFlipped += BPIXLayer_NonFlipped;
454 nmodules_BPIX_Flipped += nmodulesLayer_Flipped;
455 nmodules_BPIX_NonFlipped += nmodulesLayer_NonFlipped;
458 BPIXLayer *= (1.0 / nmodulesLayer);
459 BPIXLayer += globalTkPosition;
460 BPIXLayer_Flipped *= (1.0 / nmodulesLayer_Flipped);
461 BPIXLayer_Flipped += globalTkPosition;
462 BPIXLayer_NonFlipped *= (1.0 / nmodulesLayer_NonFlipped);
463 BPIXLayer_NonFlipped += globalTkPosition;
468 GlobalPoint(BPIXLayer_Flipped.x(), BPIXLayer_Flipped.y(), BPIXLayer_Flipped.z());
471 GlobalPoint(BPIXLayer_NonFlipped.x(), BPIXLayer_NonFlipped.y(), BPIXLayer_NonFlipped.z());
474 BPIXLayer_Flipped.y() - BPIXLayer_NonFlipped.y(),
475 BPIXLayer_Flipped.z() - BPIXLayer_NonFlipped.z());
480 BPIX_Flipped *= (1.0 / nmodules_BPIX_Flipped);
481 BPIX_Flipped += globalTkPosition;
484 BPIX_NonFlipped *= (1.0 / nmodules_BPIX_NonFlipped);
485 BPIX_NonFlipped += globalTkPosition;
489 BPIX_Flipped.y() - BPIX_NonFlipped.y(),
490 BPIX_Flipped.z() - BPIX_NonFlipped.z());
494 int nmodules_FPIX_plus = 0;
495 int nmodules_FPIX_minus = 0;
499 for (
std::map<
int, std::map<int, GlobalVector>>::iterator
id = barycentre_fpix.begin();
500 id != barycentre_fpix.end();
502 int disk =
id->first;
504 int nmodulesDisk = 0;
507 std::map<int, GlobalVector> baryCentreDisk =
id->second;
508 for (std::map<int, GlobalVector>::iterator ir = baryCentreDisk.begin(); ir != baryCentreDisk.end();
510 int ring = ir->first;
511 nmodulesDisk += nmodules_fpix[disk][
ring];
512 FPIXDisk += ir->second;
514 nmodules_FPIX_plus += nmodules_fpix[disk][
ring];
515 FPIX_plus += ir->second;
518 nmodules_FPIX_minus += nmodules_fpix[disk][
ring];
519 FPIX_minus += ir->second;
524 FPIXDisk *= (1.0 / nmodulesDisk);
525 FPIXDisk += globalTkPosition;
537 FPIX_plus *= (1.0 / nmodules_FPIX_plus);
538 FPIX_plus += globalTkPosition;
541 FPIX_minus *= (1.0 / nmodules_FPIX_minus);
542 FPIX_minus += globalTkPosition;
GlobalPoint BPIXLayer_Flipped_[nPixelLayers]
SimplePoint vFPIXDisks_minus_[nPixelDiscs]
unsigned int pxbLayer(const DetId &id) const
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeometryToken_
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]
int quadrant(const DetId &detid, const TrackerTopology *tTopo_, bool phase_)
Global3DPoint GlobalPoint
bool IsModuleBad(const uint32_t &detid) const
unsigned int pxbLadder(const DetId &id) const
SimplePoint vBPIX_Flipped_
SimplePoint vBPIXLayer_Flipped_[nPixelLayers]
std::vector< AlignTransform > m_align
GlobalPoint BPIX_NonFlipped_
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopologyToken_
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
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
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
SimplePoint vFPIXDisks_plus_[nPixelDiscs]
edm::ESGetToken< SiPixelQuality, SiPixelQualityFromDbRcd > siPixelQualityToken_
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]
constexpr uint32_t rawId() const
get the raw id
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_
edm::ESGetToken< Alignments, GlobalPositionRcd > gprToken_
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_