94 std::map<std::string, edm::ESGetToken<Alignments, TrackerAlignmentRcd>>
tkAlignTokens_;
95 std::map<std::string, edm::ESGetToken<BeamSpotObjects, BeamSpotObjectsRcd>>
bsTokens_;
124 : usePixelQuality_(iConfig.getUntrackedParameter<bool>(
"usePixelQuality")),
125 bcLabels_(iConfig.getUntrackedParameter<std::
vector<std::
string>>(
"tkAlignLabels")),
126 bsLabels_(iConfig.getUntrackedParameter<std::
vector<std::
string>>(
"beamSpotLabels")),
141 usesResource(
"TFileService");
154 double dummy_float = 999999.0;
161 double dummy_float = 999999.0;
174 for (
unsigned int i = 0;
i < 4;
i++) {
181 for (
unsigned int i = 0;
i < 3;
i++) {
189 bool prepareTkAlign =
false;
190 bool prepareBS =
false;
195 prepareTkAlign =
true;
199 if (!prepareTkAlign && !prepareBS)
205 if (prepareTkAlign) {
222 std::unique_ptr<const Alignments> globalPositions = std::make_unique<Alignments>(*globalAlignments);
234 std::vector<AlignTransform> tkAlignments = alignments->
m_align;
240 float nmodules_BPIX(0.);
243 float nmodules_FPIX(0.);
246 std::map<int, std::map<int, float>> nmodules_bpix;
247 std::map<int, std::map<int, GlobalVector>> barycentre_bpix;
250 std::map<int, std::map<int, float>> nmodules_fpix;
251 std::map<int, std::map<int, GlobalVector>> barycentre_fpix;
254 for (
const auto& ali : tkAlignments) {
262 GlobalVector ali_translation(ali.translation().x(), ali.translation().y(), ali.translation().z());
268 barycentre_BPIX += ali_translation;
269 barycentre_PIX += ali_translation;
281 barycentre_FPIX += ali_translation;
282 barycentre_PIX += ali_translation;
284 int disk = tkTopo->
pxfDisk(detId);
296 nmodules_fpix[disk][
ring] += 1;
297 barycentre_fpix[disk][
ring] += ali_translation;
304 float nmodules_PIX = nmodules_BPIX + nmodules_FPIX;
305 barycentre_PIX *= (1.0 / nmodules_PIX);
306 barycentre_PIX += globalTkPosition;
310 barycentre_BPIX *= (1.0 / nmodules_BPIX);
311 barycentre_BPIX += globalTkPosition;
314 barycentre_FPIX *= (1.0 / nmodules_FPIX);
315 barycentre_FPIX += globalTkPosition;
328 int nmodules_BPIX_Flipped = 0;
329 int nmodules_BPIX_NonFlipped = 0;
334 for (std::map<
int, std::map<int, GlobalVector>>::iterator il = barycentre_bpix.begin();
335 il != barycentre_bpix.end();
337 int layer = il->first;
339 int nmodulesLayer = 0;
340 int nmodulesLayer_Flipped = 0;
341 int nmodulesLayer_NonFlipped = 0;
347 std::map<int, GlobalVector> barycentreLayer = barycentre_bpix[
layer];
348 for (std::map<int, GlobalVector>::iterator it = barycentreLayer.begin(); it != barycentreLayer.end(); ++it) {
353 BPIXLayer += barycentreLayer[
ladder];
361 if (ladder % 2 != 0) {
362 nmodulesLayer_Flipped += nmodules_bpix[
layer][
ladder];
363 BPIXLayer_Flipped += barycentreLayer[
ladder];
365 nmodulesLayer_NonFlipped += nmodules_bpix[
layer][
ladder];
366 BPIXLayer_NonFlipped += barycentreLayer[
ladder];
370 if (ladder % 2 == 0) {
371 nmodulesLayer_Flipped += nmodules_bpix[
layer][
ladder];
372 BPIXLayer_Flipped += barycentreLayer[
ladder];
374 nmodulesLayer_NonFlipped += nmodules_bpix[
layer][
ladder];
375 BPIXLayer_NonFlipped += barycentreLayer[
ladder];
387 if (ladder % 2 != 0) {
388 nmodulesLayer_Flipped += nmodules_bpix[
layer][
ladder];
389 BPIXLayer_Flipped += barycentreLayer[
ladder];
391 nmodulesLayer_NonFlipped += nmodules_bpix[
layer][
ladder];
392 BPIXLayer_NonFlipped += barycentreLayer[
ladder];
396 if (ladder % 2 == 0) {
397 nmodulesLayer_Flipped += nmodules_bpix[
layer][
ladder];
398 BPIXLayer_Flipped += barycentreLayer[
ladder];
400 nmodulesLayer_NonFlipped += nmodules_bpix[
layer][
ladder];
401 BPIXLayer_NonFlipped += barycentreLayer[
ladder];
410 BPIX_Flipped += BPIXLayer_Flipped;
411 BPIX_NonFlipped += BPIXLayer_NonFlipped;
412 nmodules_BPIX_Flipped += nmodulesLayer_Flipped;
413 nmodules_BPIX_NonFlipped += nmodulesLayer_NonFlipped;
416 BPIXLayer *= (1.0 / nmodulesLayer);
417 BPIXLayer += globalTkPosition;
418 BPIXLayer_Flipped *= (1.0 / nmodulesLayer_Flipped);
419 BPIXLayer_Flipped += globalTkPosition;
420 BPIXLayer_NonFlipped *= (1.0 / nmodulesLayer_NonFlipped);
421 BPIXLayer_NonFlipped += globalTkPosition;
425 GlobalPoint(BPIXLayer_Flipped.
x(), BPIXLayer_Flipped.
y(), BPIXLayer_Flipped.
z());
427 GlobalPoint(BPIXLayer_NonFlipped.
x(), BPIXLayer_NonFlipped.
y(), BPIXLayer_NonFlipped.
z());
430 BPIXLayer_Flipped.
y() - BPIXLayer_NonFlipped.
y(),
431 BPIXLayer_Flipped.
z() - BPIXLayer_NonFlipped.
z());
435 BPIX_Flipped *= (1.0 / nmodules_BPIX_Flipped);
436 BPIX_Flipped += globalTkPosition;
438 BPIX_NonFlipped *= (1.0 / nmodules_BPIX_NonFlipped);
439 BPIX_NonFlipped += globalTkPosition;
442 BPIX_Flipped.
y() - BPIX_NonFlipped.
y(),
443 BPIX_Flipped.
z() - BPIX_NonFlipped.
z());
446 int nmodules_FPIX_plus = 0;
447 int nmodules_FPIX_minus = 0;
451 for (std::map<
int, std::map<int, GlobalVector>>::iterator
id = barycentre_fpix.begin();
452 id != barycentre_fpix.end();
454 int disk =
id->first;
456 int nmodulesDisk = 0;
459 std::map<int, GlobalVector> baryCentreDisk =
id->second;
460 for (std::map<int, GlobalVector>::iterator ir = baryCentreDisk.begin(); ir != baryCentreDisk.end();
462 int ring = ir->first;
463 nmodulesDisk += nmodules_fpix[disk][
ring];
464 FPIXDisk += ir->second;
466 nmodules_FPIX_plus += nmodules_fpix[disk][
ring];
467 FPIX_plus += ir->second;
470 nmodules_FPIX_minus += nmodules_fpix[disk][
ring];
471 FPIX_minus += ir->second;
476 FPIXDisk *= (1.0 / nmodulesDisk);
477 FPIXDisk += globalTkPosition;
485 FPIX_plus *= (1.0 / nmodules_FPIX_plus);
486 FPIX_plus += globalTkPosition;
488 FPIX_minus *= (1.0 / nmodules_FPIX_minus);
489 FPIX_minus += globalTkPosition;
522 treeName =
"BeamSpot_";
537 treeName =
"PixelBarycentre_";
556 for (
unsigned int i = 0;
i < 4;
i++) {
557 TString structure =
"BPIXLYR";
568 for (
unsigned int i = 0;
i < 3;
i++) {
569 TString structure =
"FPIXDisk+";
574 structure =
"FPIXDisk-";
void analyze(const edm::Event &, const edm::EventSetup &) override
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeometryToken_
double GetY() const
get Y beam position
uint16_t *__restrict__ id
edm::ESWatcher< BeamSpotObjectsRcd > watcherBS_
PixelBaryCentreAnalyzer(const edm::ParameterSet &)
#define DEFINE_FWK_MODULE(type)
unsigned int pxfDisk(const DetId &id) const
GlobalPoint BPIXLayer_Flipped_[4]
int quadrant(const DetId &detid, const TrackerTopology *tTopo_, bool phase_)
unsigned int pxbLadder(const DetId &id) const
Global3DPoint GlobalPoint
constexpr uint32_t rawId() const
get the raw id
T * make(const Args &...args) const
make new ROOT object
LuminosityBlockNumber_t luminosityBlock() const
GlobalPoint FPIXDisks_minus_[3]
edm::Service< TFileService > tFileService
std::vector< AlignTransform > m_align
GlobalPoint BPIX_NonFlipped_
constexpr std::array< uint8_t, layerIndexSize > layer
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopologyToken_
bool isThere(GeomDetEnumerators::SubDetector subdet) const
bool getData(T &iHolder) const
void addDefault(ParameterSetDescription const &psetDescription)
edm::ESWatcher< TrackerAlignmentRcd > watcherTkAlign_
GlobalPoint FPIXDisks_plus_[3]
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
double GetZ() const
get Z beam position
edm::ESGetToken< SiPixelQuality, SiPixelQualityFromDbRcd > siPixelQualityToken_
bool IsModuleBad(const uint32_t &detid) const
unsigned int pxfModule(const DetId &id) const
~PixelBaryCentreAnalyzer() override
std::vector< std::string > bsLabels_
unsigned int pxbLayer(const DetId &id) const
double GetX() const
get X beam position
std::vector< std::string > bcLabels_
GlobalPoint BPIX_Flipped_
std::map< std::string, TTree * > bsTrees_
GlobalPoint BPIXLayer_[4]
trackerTopologyToken_(iC.esConsumes())
bool check(const edm::EventSetup &iSetup)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const AlignTransform & DetectorGlobalPosition(const Alignments &allGlobals, const DetId &id)
trackerGeometryToken_(iC.esConsumes())
GlobalPoint BPIXLayer_DiffFlippedNonFlipped_[4]
int ringName() const
ring Id
HalfCylinder halfCylinder() const
edm::ESGetToken< Alignments, GlobalPositionRcd > gprToken_
GlobalPoint BPIXLayer_NonFlipped_[4]
std::map< std::string, edm::ESGetToken< Alignments, TrackerAlignmentRcd > > tkAlignTokens_
std::map< std::string, TTree * > bcTrees_
unsigned int pxfPanel(const DetId &id) const
std::map< std::string, edm::ESGetToken< BeamSpotObjects, BeamSpotObjectsRcd > > bsTokens_
GlobalPoint BPIX_DiffFlippedNonFlipped_