101 std::map<std::string, edm::ESGetToken<Alignments, TrackerAlignmentRcd>>
tkAlignTokens_;
102 std::map<std::string, edm::ESGetToken<BeamSpotObjects, BeamSpotObjectsRcd>>
bsTokens_;
145 : usePixelQuality_(iConfig.getUntrackedParameter<
bool>(
"usePixelQuality")),
162 usesResource(
"TFileService");
175 double dummy_float = 999999.0;
183 double dummy_float = 999999.0;
234 bool prepareTkAlign =
false;
235 bool prepareBS =
false;
240 prepareTkAlign =
true;
244 if (!prepareTkAlign && !prepareBS)
250 if (prepareTkAlign) {
267 std::unique_ptr<const Alignments> globalPositions = std::make_unique<Alignments>(*globalAlignments);
279 std::vector<AlignTransform> tkAlignments = alignments->
m_align;
285 float nmodules_BPIX(0.);
288 float nmodules_FPIX(0.);
291 std::map<int, std::map<int, float>> nmodules_bpix;
292 std::map<int, std::map<int, GlobalVector>> barycentre_bpix;
295 std::map<int, std::map<int, float>> nmodules_fpix;
296 std::map<int, std::map<int, GlobalVector>> barycentre_fpix;
299 for (
const auto& ali : tkAlignments) {
307 GlobalVector ali_translation(ali.translation().x(), ali.translation().y(), ali.translation().z());
313 barycentre_BPIX += ali_translation;
314 barycentre_PIX += ali_translation;
326 barycentre_FPIX += ali_translation;
327 barycentre_PIX += ali_translation;
329 int disk = tkTopo->
pxfDisk(detId);
341 nmodules_fpix[disk][
ring] += 1;
342 barycentre_fpix[disk][
ring] += ali_translation;
349 float nmodules_PIX = nmodules_BPIX + nmodules_FPIX;
350 barycentre_PIX *= (1.0 / nmodules_PIX);
351 barycentre_PIX += globalTkPosition;
356 barycentre_BPIX *= (1.0 / nmodules_BPIX);
357 barycentre_BPIX += globalTkPosition;
361 barycentre_FPIX *= (1.0 / nmodules_FPIX);
362 barycentre_FPIX += globalTkPosition;
375 int nmodules_BPIX_Flipped = 0;
376 int nmodules_BPIX_NonFlipped = 0;
381 for (
std::map<
int, std::map<int, GlobalVector>>::iterator il = barycentre_bpix.begin();
382 il != barycentre_bpix.end();
384 int layer = il->first;
386 int nmodulesLayer = 0;
387 int nmodulesLayer_Flipped = 0;
388 int nmodulesLayer_NonFlipped = 0;
394 std::map<int, GlobalVector> barycentreLayer = barycentre_bpix[
layer];
395 for (std::map<int, GlobalVector>::iterator it = barycentreLayer.begin(); it != barycentreLayer.end(); ++it) {
400 BPIXLayer += barycentreLayer[
ladder];
409 nmodulesLayer_Flipped += nmodules_bpix[
layer][
ladder];
410 BPIXLayer_Flipped += barycentreLayer[
ladder];
412 nmodulesLayer_NonFlipped += nmodules_bpix[
layer][
ladder];
413 BPIXLayer_NonFlipped += barycentreLayer[
ladder];
418 nmodulesLayer_Flipped += nmodules_bpix[
layer][
ladder];
419 BPIXLayer_Flipped += barycentreLayer[
ladder];
421 nmodulesLayer_NonFlipped += nmodules_bpix[
layer][
ladder];
422 BPIXLayer_NonFlipped += barycentreLayer[
ladder];
435 nmodulesLayer_Flipped += nmodules_bpix[
layer][
ladder];
436 BPIXLayer_Flipped += barycentreLayer[
ladder];
438 nmodulesLayer_NonFlipped += nmodules_bpix[
layer][
ladder];
439 BPIXLayer_NonFlipped += barycentreLayer[
ladder];
444 nmodulesLayer_Flipped += nmodules_bpix[
layer][
ladder];
445 BPIXLayer_Flipped += barycentreLayer[
ladder];
447 nmodulesLayer_NonFlipped += nmodules_bpix[
layer][
ladder];
448 BPIXLayer_NonFlipped += barycentreLayer[
ladder];
457 BPIX_Flipped += BPIXLayer_Flipped;
458 BPIX_NonFlipped += BPIXLayer_NonFlipped;
459 nmodules_BPIX_Flipped += nmodulesLayer_Flipped;
460 nmodules_BPIX_NonFlipped += nmodulesLayer_NonFlipped;
463 BPIXLayer *= (1.0 / nmodulesLayer);
464 BPIXLayer += globalTkPosition;
465 BPIXLayer_Flipped *= (1.0 / nmodulesLayer_Flipped);
466 BPIXLayer_Flipped += globalTkPosition;
467 BPIXLayer_NonFlipped *= (1.0 / nmodulesLayer_NonFlipped);
468 BPIXLayer_NonFlipped += globalTkPosition;
473 GlobalPoint(BPIXLayer_Flipped.
x(), BPIXLayer_Flipped.
y(), BPIXLayer_Flipped.
z());
476 GlobalPoint(BPIXLayer_NonFlipped.
x(), BPIXLayer_NonFlipped.
y(), BPIXLayer_NonFlipped.
z());
479 BPIXLayer_Flipped.
y() - BPIXLayer_NonFlipped.
y(),
480 BPIXLayer_Flipped.
z() - BPIXLayer_NonFlipped.
z());
485 BPIX_Flipped *= (1.0 / nmodules_BPIX_Flipped);
486 BPIX_Flipped += globalTkPosition;
489 BPIX_NonFlipped *= (1.0 / nmodules_BPIX_NonFlipped);
490 BPIX_NonFlipped += globalTkPosition;
494 BPIX_Flipped.
y() - BPIX_NonFlipped.
y(),
495 BPIX_Flipped.
z() - BPIX_NonFlipped.
z());
499 int nmodules_FPIX_plus = 0;
500 int nmodules_FPIX_minus = 0;
504 for (
std::map<
int, std::map<int, GlobalVector>>::iterator
id = barycentre_fpix.begin();
505 id != barycentre_fpix.end();
507 int disk =
id->first;
509 int nmodulesDisk = 0;
512 std::map<int, GlobalVector> baryCentreDisk =
id->second;
513 for (std::map<int, GlobalVector>::iterator ir = baryCentreDisk.begin(); ir != baryCentreDisk.end();
515 int ring = ir->first;
516 nmodulesDisk += nmodules_fpix[disk][
ring];
517 FPIXDisk += ir->second;
519 nmodules_FPIX_plus += nmodules_fpix[disk][
ring];
520 FPIX_plus += ir->second;
523 nmodules_FPIX_minus += nmodules_fpix[disk][
ring];
524 FPIX_minus += ir->second;
529 FPIXDisk *= (1.0 / nmodulesDisk);
530 FPIXDisk += globalTkPosition;
542 FPIX_plus *= (1.0 / nmodules_FPIX_plus);
543 FPIX_plus += globalTkPosition;
546 FPIX_minus *= (1.0 / nmodules_FPIX_minus);
547 FPIX_minus += globalTkPosition;
582 treeName =
"BeamSpot_";
597 treeName =
"PixelBarycentre_";
617 TString structure =
"BPIXLYR";
630 TString structure =
"FPIXDisk_plus";
635 structure =
"FPIXDisk_minus";
SimplePoint(const GlobalPoint &p)
GlobalPoint BPIXLayer_Flipped_[nPixelLayers]
SimplePoint vFPIXDisks_minus_[nPixelDiscs]
unsigned int pxbLayer(const DetId &id) const
void analyze(const edm::Event &, const edm::EventSetup &) override
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeometryToken_
double z() const
get Z beam position
static const unsigned int nPixelDiscs
int ringName() const
ring Id
edm::ESWatcher< BeamSpotObjectsRcd > watcherBS_
SimplePoint vBPIXLayer_NonFlipped_[nPixelLayers]
PixelBaryCentreAnalyzer(const edm::ParameterSet &)
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]
edm::Service< TFileService > tFileService
std::vector< AlignTransform > m_align
GlobalPoint BPIX_NonFlipped_
constexpr std::array< uint8_t, layerIndexSize > layer
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopologyToken_
GlobalPoint BPIXLayer_[nPixelLayers]
void addDefault(ParameterSetDescription const &psetDescription)
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
#define DEFINE_FWK_MODULE(type)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
bool getData(T &iHolder) const
SimplePoint vFPIXDisks_plus_[nPixelDiscs]
edm::ESGetToken< SiPixelQuality, SiPixelQualityFromDbRcd > siPixelQualityToken_
~PixelBaryCentreAnalyzer() override
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)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
static const unsigned int nPixelLayers
const AlignTransform & DetectorGlobalPosition(const Alignments &allGlobals, const DetId &id)
T * make(const Args &...args) const
make new ROOT object
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_