CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
PixelBaryCentreAnalyzer Class Reference
Inheritance diagram for PixelBaryCentreAnalyzer:
edm::one::EDAnalyzer< edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 PixelBaryCentreAnalyzer (const edm::ParameterSet &)
 
 ~PixelBaryCentreAnalyzer () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::SharedResources >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void endJob () override
 
void initBC ()
 
void initBS ()
 

Private Attributes

std::vector< std::string > bcLabels_
 
std::map< std::string, TTree * > bcTrees_
 
GlobalPoint BPIX_
 
GlobalPoint BPIX_DiffFlippedNonFlipped_
 
GlobalPoint BPIX_Flipped_
 
GlobalPoint BPIX_NonFlipped_
 
GlobalPoint BPIXLayer_ [4]
 
GlobalPoint BPIXLayer_DiffFlippedNonFlipped_ [4]
 
GlobalPoint BPIXLayer_Flipped_ [4]
 
GlobalPoint BPIXLayer_NonFlipped_ [4]
 
GlobalPoint BS_
 
std::vector< std::string > bsLabels_
 
std::map< std::string, edm::ESGetToken< BeamSpotObjects, BeamSpotObjectsRcd > > bsTokens_
 
std::map< std::string, TTree * > bsTrees_
 
GlobalPoint FPIX_
 
GlobalPoint FPIX_minus_
 
GlobalPoint FPIX_plus_
 
GlobalPoint FPIXDisks_minus_ [3]
 
GlobalPoint FPIXDisks_plus_ [3]
 
edm::ESGetToken< Alignments, GlobalPositionRcdgprToken_
 
int ls_
 
int phase_
 
GlobalPoint PIX_
 
int run_
 
edm::ESGetToken< SiPixelQuality, SiPixelQualityFromDbRcdsiPixelQualityToken_
 
edm::Service< TFileServicetFileService
 
std::map< std::string, edm::ESGetToken< Alignments, TrackerAlignmentRcd > > tkAlignTokens_
 
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordtrackerGeometryToken_
 
edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtrackerTopologyToken_
 
bool usePixelQuality_
 
edm::ESWatcher< BeamSpotObjectsRcdwatcherBS_
 
edm::ESWatcher< TrackerAlignmentRcdwatcherTkAlign_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

The analyer works as the following :

Python script plotBaryCentre_VS_BeamSpot.py under script dir is used to plot barycentres from alignment constants used in Prompt-Reco, End-of-Year Rereco and so-called Run-2 (Ultra)Legacy Rereco. Options of the plotting script can be found from the helper in the script.

Date
2021/01/05
Revision
1.0
Author
Tongguang Cheng - Beihang University tongg.nosp@m.uang.nosp@m..chen.nosp@m.g@ce.nosp@m.rn.ch

Definition at line 62 of file PixelBaryCentreAnalyzer.cc.

Constructor & Destructor Documentation

◆ PixelBaryCentreAnalyzer()

PixelBaryCentreAnalyzer::PixelBaryCentreAnalyzer ( const edm::ParameterSet iConfig)
explicit

Definition at line 123 of file PixelBaryCentreAnalyzer.cc.

References bcLabels_, bcTrees_, bsLabels_, bsTokens_, bsTrees_, label, and tkAlignTokens_.

124  : usePixelQuality_(iConfig.getUntrackedParameter<bool>("usePixelQuality")),
125  bcLabels_(iConfig.getUntrackedParameter<std::vector<std::string>>("tkAlignLabels")),
126  bsLabels_(iConfig.getUntrackedParameter<std::vector<std::string>>("beamSpotLabels")),
127  trackerGeometryToken_(esConsumes<TrackerGeometry, TrackerDigiGeometryRecord>()),
128  trackerTopologyToken_(esConsumes<TrackerTopology, TrackerTopologyRcd>()),
129  siPixelQualityToken_(esConsumes<SiPixelQuality, SiPixelQualityFromDbRcd>()),
130  gprToken_(esConsumes<Alignments, GlobalPositionRcd>()) {
131  for (const auto& label : bcLabels_) {
132  bcTrees_[label] = nullptr;
133  tkAlignTokens_[label] = esConsumes<Alignments, TrackerAlignmentRcd>(edm::ESInputTag{"", label});
134  }
135 
136  for (const auto& label : bsLabels_) {
137  bsTrees_[label] = nullptr;
138  bsTokens_[label] = esConsumes<BeamSpotObjects, BeamSpotObjectsRcd>(edm::ESInputTag{"", label});
139  }
140 
141  usesResource("TFileService");
142 }
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeometryToken_
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopologyToken_
T getUntrackedParameter(std::string const &, T const &) const
char const * label
edm::ESGetToken< SiPixelQuality, SiPixelQualityFromDbRcd > siPixelQualityToken_
std::vector< std::string > bsLabels_
std::vector< std::string > bcLabels_
std::map< std::string, TTree * > bsTrees_
edm::ESGetToken< Alignments, GlobalPositionRcd > gprToken_
std::map< std::string, edm::ESGetToken< Alignments, TrackerAlignmentRcd > > tkAlignTokens_
std::map< std::string, TTree * > bcTrees_
std::map< std::string, edm::ESGetToken< BeamSpotObjects, BeamSpotObjectsRcd > > bsTokens_

◆ ~PixelBaryCentreAnalyzer()

PixelBaryCentreAnalyzer::~PixelBaryCentreAnalyzer ( )
override

Definition at line 144 of file PixelBaryCentreAnalyzer.cc.

144  {
145  // do anything here that needs to be done at desctruction time
146  // (e.g. close files, deallocate resources etc.)
147 }

Member Function Documentation

◆ analyze()

void PixelBaryCentreAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 188 of file PixelBaryCentreAnalyzer.cc.

References bcLabels_, bcTrees_, BPIX_, BPIX_DiffFlippedNonFlipped_, BPIX_Flipped_, BPIX_NonFlipped_, BPIXLayer_, BPIXLayer_DiffFlippedNonFlipped_, BPIXLayer_Flipped_, BPIXLayer_NonFlipped_, BS_, bsLabels_, bsTokens_, bsTrees_, edm::ESWatcher< T >::check(), align::DetectorGlobalPosition(), FPIX_, FPIX_minus_, FPIX_plus_, FPIXDisks_minus_, FPIXDisks_plus_, edm::EventSetup::getData(), gprToken_, PixelEndcapName::halfCylinder(), l1ctLayer2EG_cff::id, iEvent, initBC(), initBS(), SiPixelQuality::IsModuleBad(), TrackerGeometry::isThere(), label, PVValHelper::ladder, phase1PixelTopology::layer, ls_, Alignments::m_align, genParticles_cff::map, GeomDetEnumerators::P1PXB, GeomDetEnumerators::P1PXEC, phase_, PIX_, PixelSubdetector::PixelBarrel, GeomDetEnumerators::PixelBarrel, PixelSubdetector::PixelEndcap, GeomDetEnumerators::PixelEndcap, TrackerTopology::pxbLadder(), TrackerTopology::pxbLayer(), TrackerTopology::pxfDisk(), TrackerTopology::pxfModule(), TrackerTopology::pxfPanel(), SiPixelPI::quadrant(), DetId::rawId(), relativeConstraints::ring, PixelEndcapName::ringName(), run_, siPixelQualityToken_, DetId::subdetId(), tkAlignTokens_, DetId::Tracker, trackerGeometryToken_, trackerTopologyToken_, AlignTransform::translation(), usePixelQuality_, watcherBS_, watcherTkAlign_, PV3DBase< T, PVType, FrameType >::x(), BeamSpotObjects::x(), PV3DBase< T, PVType, FrameType >::y(), BeamSpotObjects::y(), PV3DBase< T, PVType, FrameType >::z(), and BeamSpotObjects::z().

188  {
189  bool prepareTkAlign = false;
190  bool prepareBS = false;
191 
192  // ES watcher can noly run once in the same event,
193  // otherwise it will turn false whatsoever because the condition doesn't change in the second time call.
194  if (watcherTkAlign_.check(iSetup))
195  prepareTkAlign = true;
196  if (watcherBS_.check(iSetup))
197  prepareBS = true;
198 
199  if (!prepareTkAlign && !prepareBS)
200  return;
201 
202  run_ = iEvent.id().run();
203  ls_ = iEvent.id().luminosityBlock();
204 
205  if (prepareTkAlign) { // check for new IOV for TKAlign
206 
207  phase_ = -1;
208 
209  const TrackerGeometry* tkGeo = &iSetup.getData(trackerGeometryToken_);
210  const TrackerTopology* tkTopo = &iSetup.getData(trackerTopologyToken_);
211 
213  phase_ = 0;
215  phase_ = 1;
216 
217  // pixel quality
218  const SiPixelQuality* badPixelInfo = &iSetup.getData(siPixelQualityToken_);
219 
220  // Tracker global position
221  const Alignments* globalAlignments = &iSetup.getData(gprToken_);
222  std::unique_ptr<const Alignments> globalPositions = std::make_unique<Alignments>(*globalAlignments);
223  const AlignTransform& globalCoordinates = align::DetectorGlobalPosition(*globalPositions, DetId(DetId::Tracker));
224  GlobalVector globalTkPosition(
225  globalCoordinates.translation().x(), globalCoordinates.translation().y(), globalCoordinates.translation().z());
226 
227  // loop over bclabels
228  for (const auto& label : bcLabels_) {
229  // init tree content
231 
232  // Get TkAlign from EventSetup:
233  const Alignments* alignments = &iSetup.getData(tkAlignTokens_[label]);
234  std::vector<AlignTransform> tkAlignments = alignments->m_align;
235 
236  // PIX
237  GlobalVector barycentre_PIX(0.0, 0.0, 0.0);
238  // BPIX
239  GlobalVector barycentre_BPIX(0.0, 0.0, 0.0);
240  float nmodules_BPIX(0.);
241  // FPIX
242  GlobalVector barycentre_FPIX(0.0, 0.0, 0.0);
243  float nmodules_FPIX(0.);
244 
245  // Per-layer/ladder barycentre for BPIX
246  std::map<int, std::map<int, float>> nmodules_bpix; // layer-ladder
247  std::map<int, std::map<int, GlobalVector>> barycentre_bpix; // layer-ladder
248 
249  // Per-disk/ring barycentre for FPIX
250  std::map<int, std::map<int, float>> nmodules_fpix; // disk-ring
251  std::map<int, std::map<int, GlobalVector>> barycentre_fpix; // disk-ring
252 
253  // Loop over tracker module
254  for (const auto& ali : tkAlignments) {
255  //DetId
256  const DetId& detId = DetId(ali.rawId());
257  // remove bad module
258  if (usePixelQuality_ && badPixelInfo->IsModuleBad(detId))
259  continue;
260 
261  // alignment for a given module
262  GlobalVector ali_translation(ali.translation().x(), ali.translation().y(), ali.translation().z());
263 
264  int subid = DetId(detId).subdetId();
265  // BPIX
266  if (subid == PixelSubdetector::PixelBarrel) {
267  nmodules_BPIX += 1;
268  barycentre_BPIX += ali_translation;
269  barycentre_PIX += ali_translation;
270 
271  int layer = tkTopo->pxbLayer(detId);
272  int ladder = tkTopo->pxbLadder(detId);
273  nmodules_bpix[layer][ladder] += 1;
274  barycentre_bpix[layer][ladder] += ali_translation;
275 
276  } // BPIX
277 
278  // FPIX
279  if (subid == PixelSubdetector::PixelEndcap) {
280  nmodules_FPIX += 1;
281  barycentre_FPIX += ali_translation;
282  barycentre_PIX += ali_translation;
283 
284  int disk = tkTopo->pxfDisk(detId);
285  int quadrant = PixelEndcapName(detId, tkTopo, phase_).halfCylinder();
286  if (quadrant < 3)
287  disk *= -1;
288 
289  int ring = -9999;
290  if (phase_ == 0) {
291  ring = 1 + (tkTopo->pxfPanel(detId) + tkTopo->pxfModule(detId.rawId()) > 3);
292  } else if (phase_ == 1) {
293  ring = PixelEndcapName(detId, tkTopo, phase_).ringName();
294  }
295 
296  nmodules_fpix[disk][ring] += 1;
297  barycentre_fpix[disk][ring] += ali_translation;
298 
299  } // FPIX
300 
301  } // loop over tracker module
302 
303  //PIX
304  float nmodules_PIX = nmodules_BPIX + nmodules_FPIX;
305  barycentre_PIX *= (1.0 / nmodules_PIX);
306  barycentre_PIX += globalTkPosition;
307  PIX_ = GlobalPoint(barycentre_PIX.x(), barycentre_PIX.y(), barycentre_PIX.z());
308 
309  //BPIX
310  barycentre_BPIX *= (1.0 / nmodules_BPIX);
311  barycentre_BPIX += globalTkPosition;
312  BPIX_ = GlobalPoint(barycentre_BPIX.x(), barycentre_BPIX.y(), barycentre_BPIX.z());
313  //FPIX
314  barycentre_FPIX *= (1.0 / nmodules_FPIX);
315  barycentre_FPIX += globalTkPosition;
316  FPIX_ = GlobalPoint(barycentre_FPIX.x(), barycentre_FPIX.y(), barycentre_FPIX.z());
317 
318  // Pixel substructures
319 
320  // BPix barycentre per-layer/per-ladder
321  // assuming each ladder has the same number of modules in the same layer
322  // inner = flipped; outer = non-flipped
323  //
324  // Phase 0: Outer ladders are odd for layer 1,3 and even for layer 2
325  // Phase 1: Outer ladders are odd for layer 4 and even for layer 1,2,3
326  //
327 
328  int nmodules_BPIX_Flipped = 0;
329  int nmodules_BPIX_NonFlipped = 0;
330  GlobalVector BPIX_Flipped(0.0, 0.0, 0.0);
331  GlobalVector BPIX_NonFlipped(0.0, 0.0, 0.0);
332 
333  // loop over layers
334  for (std::map<int, std::map<int, GlobalVector>>::iterator il = barycentre_bpix.begin();
335  il != barycentre_bpix.end();
336  ++il) {
337  int layer = il->first;
338 
339  int nmodulesLayer = 0;
340  int nmodulesLayer_Flipped = 0;
341  int nmodulesLayer_NonFlipped = 0;
342  GlobalVector BPIXLayer(0.0, 0.0, 0.0);
343  GlobalVector BPIXLayer_Flipped(0.0, 0.0, 0.0);
344  GlobalVector BPIXLayer_NonFlipped(0.0, 0.0, 0.0);
345 
346  // loop over ladder
347  std::map<int, GlobalVector> barycentreLayer = barycentre_bpix[layer];
348  for (std::map<int, GlobalVector>::iterator it = barycentreLayer.begin(); it != barycentreLayer.end(); ++it) {
349  int ladder = it->first;
350  //BPIXLayerLadder_[layer][ladder] = (1.0/nmodules[layer][ladder])*barycentreLayer[ladder] + globalTkPosition;
351 
352  nmodulesLayer += nmodules_bpix[layer][ladder];
353  BPIXLayer += barycentreLayer[ladder];
354 
355  // Phase-1
356  //
357  // Phase 1: Outer ladders are odd for layer 4 and even for layer 1,2,3
358  if (phase_ == 1) {
359  if (layer != 4) { // layer 1-3
360 
361  if (ladder % 2 != 0) { // odd ladder = inner = flipped
362  nmodulesLayer_Flipped += nmodules_bpix[layer][ladder];
363  BPIXLayer_Flipped += barycentreLayer[ladder];
364  } else {
365  nmodulesLayer_NonFlipped += nmodules_bpix[layer][ladder];
366  BPIXLayer_NonFlipped += barycentreLayer[ladder];
367  }
368  } else { // layer-4
369 
370  if (ladder % 2 == 0) { // even ladder = inner = flipped
371  nmodulesLayer_Flipped += nmodules_bpix[layer][ladder];
372  BPIXLayer_Flipped += barycentreLayer[ladder];
373  } else { // odd ladder = outer = non-flipped
374  nmodulesLayer_NonFlipped += nmodules_bpix[layer][ladder];
375  BPIXLayer_NonFlipped += barycentreLayer[ladder];
376  }
377  }
378 
379  } // phase-1
380 
381  // Phase-0
382  //
383  // Phase 0: Outer ladders are odd for layer 1,3 and even for layer 2
384  if (phase_ == 0) {
385  if (layer == 2) { // layer-2
386 
387  if (ladder % 2 != 0) { // odd ladder = inner = flipped
388  nmodulesLayer_Flipped += nmodules_bpix[layer][ladder];
389  BPIXLayer_Flipped += barycentreLayer[ladder];
390  } else {
391  nmodulesLayer_NonFlipped += nmodules_bpix[layer][ladder];
392  BPIXLayer_NonFlipped += barycentreLayer[ladder];
393  }
394  } else { // layer-1,3
395 
396  if (ladder % 2 == 0) { // even ladder = inner = flipped
397  nmodulesLayer_Flipped += nmodules_bpix[layer][ladder];
398  BPIXLayer_Flipped += barycentreLayer[ladder];
399  } else { // odd ladder = outer = non-flipped
400  nmodulesLayer_NonFlipped += nmodules_bpix[layer][ladder];
401  BPIXLayer_NonFlipped += barycentreLayer[ladder];
402  }
403  }
404 
405  } // phase-0
406 
407  } //loop over ladders
408 
409  // total BPIX flipped/non-flipped
410  BPIX_Flipped += BPIXLayer_Flipped;
411  BPIX_NonFlipped += BPIXLayer_NonFlipped;
412  nmodules_BPIX_Flipped += nmodulesLayer_Flipped;
413  nmodules_BPIX_NonFlipped += nmodulesLayer_NonFlipped;
414 
415  //BPIX per-layer
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;
422 
423  BPIXLayer_[layer - 1] = GlobalPoint(BPIXLayer.x(), BPIXLayer.y(), BPIXLayer.z());
425  GlobalPoint(BPIXLayer_Flipped.x(), BPIXLayer_Flipped.y(), BPIXLayer_Flipped.z());
427  GlobalPoint(BPIXLayer_NonFlipped.x(), BPIXLayer_NonFlipped.y(), BPIXLayer_NonFlipped.z());
428 
429  BPIXLayer_DiffFlippedNonFlipped_[layer - 1] = GlobalPoint(BPIXLayer_Flipped.x() - BPIXLayer_NonFlipped.x(),
430  BPIXLayer_Flipped.y() - BPIXLayer_NonFlipped.y(),
431  BPIXLayer_Flipped.z() - BPIXLayer_NonFlipped.z());
432 
433  } // loop over layers
434 
435  BPIX_Flipped *= (1.0 / nmodules_BPIX_Flipped);
436  BPIX_Flipped += globalTkPosition;
437  BPIX_Flipped_ = GlobalPoint(BPIX_Flipped.x(), BPIX_Flipped.y(), BPIX_Flipped.z());
438  BPIX_NonFlipped *= (1.0 / nmodules_BPIX_NonFlipped);
439  BPIX_NonFlipped += globalTkPosition;
440  BPIX_NonFlipped_ = GlobalPoint(BPIX_NonFlipped.x(), BPIX_NonFlipped.y(), BPIX_NonFlipped.z());
441  BPIX_DiffFlippedNonFlipped_ = GlobalPoint(BPIX_Flipped.x() - BPIX_NonFlipped.x(),
442  BPIX_Flipped.y() - BPIX_NonFlipped.y(),
443  BPIX_Flipped.z() - BPIX_NonFlipped.z());
444 
445  // FPIX substructures per-(signed)disk/per-ring
446  int nmodules_FPIX_plus = 0;
447  int nmodules_FPIX_minus = 0;
448  GlobalVector FPIX_plus(0.0, 0.0, 0.0);
449  GlobalVector FPIX_minus(0.0, 0.0, 0.0);
450  // loop over disks
451  for (std::map<int, std::map<int, GlobalVector>>::iterator id = barycentre_fpix.begin();
452  id != barycentre_fpix.end();
453  ++id) {
454  int disk = id->first;
455 
456  int nmodulesDisk = 0;
457  GlobalVector FPIXDisk(0.0, 0.0, 0.0);
458 
459  std::map<int, GlobalVector> baryCentreDisk = id->second;
460  for (std::map<int, GlobalVector>::iterator ir = baryCentreDisk.begin(); ir != baryCentreDisk.end();
461  ++ir) { // loop over rings
462  int ring = ir->first;
463  nmodulesDisk += nmodules_fpix[disk][ring];
464  FPIXDisk += ir->second;
465  if (disk > 0) {
466  nmodules_FPIX_plus += nmodules_fpix[disk][ring];
467  FPIX_plus += ir->second;
468  }
469  if (disk < 0) {
470  nmodules_FPIX_minus += nmodules_fpix[disk][ring];
471  FPIX_minus += ir->second;
472  }
473 
474  } // loop over rings
475 
476  FPIXDisk *= (1.0 / nmodulesDisk);
477  FPIXDisk += globalTkPosition;
478 
479  if (disk > 0)
480  FPIXDisks_plus_[disk - 1] = GlobalPoint(FPIXDisk.x(), FPIXDisk.y(), FPIXDisk.z());
481  if (disk < 0)
482  FPIXDisks_minus_[-disk - 1] = GlobalPoint(FPIXDisk.x(), FPIXDisk.y(), FPIXDisk.z());
483  } // loop over disks
484 
485  FPIX_plus *= (1.0 / nmodules_FPIX_plus);
486  FPIX_plus += globalTkPosition;
487  FPIX_plus_ = GlobalPoint(FPIX_plus.x(), FPIX_plus.y(), FPIX_plus.z());
488  FPIX_minus *= (1.0 / nmodules_FPIX_minus);
489  FPIX_minus += globalTkPosition;
490  FPIX_minus_ = GlobalPoint(FPIX_minus.x(), FPIX_minus.y(), FPIX_minus.z());
491 
492  bcTrees_[label]->Fill();
493 
494  } // bcLabels_
495 
496  } // check for new IOV for TKAlign
497 
498  // beamspot
499  if (prepareBS) {
500  // loop over bsLabels_
501  for (const auto& label : bsLabels_) {
502  // init bstree content
504 
505  // Get BeamSpot from EventSetup
506  const BeamSpotObjects* mybeamspot = &iSetup.getData(bsTokens_[label]);
507 
508  BS_ = GlobalPoint(mybeamspot->x(), mybeamspot->y(), mybeamspot->z());
509 
510  bsTrees_[label]->Fill();
511  } // bsLabels_
512 
513  } // check for new IOV for BS
514 }
unsigned int pxbLayer(const DetId &id) const
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeometryToken_
double z() const
get Z beam position
int ringName() const
ring Id
edm::ESWatcher< BeamSpotObjectsRcd > watcherBS_
T z() const
Definition: PV3DBase.h:61
unsigned int pxfModule(const DetId &id) const
int quadrant(const DetId &detid, const TrackerTopology *tTopo_, bool phase_)
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
const Translation & translation() const
bool IsModuleBad(const uint32_t &detid) const
unsigned int pxbLadder(const DetId &id) const
std::vector< AlignTransform > m_align
Definition: Alignments.h:19
constexpr std::array< uint8_t, layerIndexSize > layer
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopologyToken_
char const * label
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
int iEvent
Definition: GenABIO.cc:224
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&#39;s numbering enum) ...
Definition: DetId.h:48
bool getData(T &iHolder) const
Definition: EventSetup.h:122
edm::ESGetToken< SiPixelQuality, SiPixelQualityFromDbRcd > siPixelQualityToken_
std::vector< std::string > bsLabels_
unsigned int pxfPanel(const DetId &id) const
double y() const
get Y beam position
Definition: DetId.h:17
std::vector< std::string > bcLabels_
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
std::map< std::string, TTree * > bsTrees_
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
const AlignTransform & DetectorGlobalPosition(const Alignments &allGlobals, const DetId &id)
GlobalPoint BPIXLayer_DiffFlippedNonFlipped_[4]
edm::ESGetToken< Alignments, GlobalPositionRcd > gprToken_
std::map< std::string, edm::ESGetToken< Alignments, TrackerAlignmentRcd > > tkAlignTokens_
std::map< std::string, TTree * > bcTrees_
std::map< std::string, edm::ESGetToken< BeamSpotObjects, BeamSpotObjectsRcd > > bsTokens_

◆ beginJob()

void PixelBaryCentreAnalyzer::beginJob ( )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 517 of file PixelBaryCentreAnalyzer.cc.

References bcLabels_, bcTrees_, BPIX_, BPIX_DiffFlippedNonFlipped_, BPIX_Flipped_, BPIX_NonFlipped_, BPIXLayer_, BPIXLayer_DiffFlippedNonFlipped_, BPIXLayer_Flipped_, BPIXLayer_NonFlipped_, BS_, bsLabels_, bsTrees_, FPIX_, FPIX_minus_, FPIX_plus_, FPIXDisks_minus_, FPIXDisks_plus_, mps_fire::i, label, phase1PixelTopology::layer, ls_, TFileService::make(), PIX_, run_, AlCaHLTBitMon_QueryRunRegistry::string, and tFileService.

517  {
518  // init bc bs trees
519  for (const auto& label : bsLabels_) {
520  std::string treeName = "BeamSpot";
521  if (!label.empty())
522  treeName = "BeamSpot_";
523  treeName += label;
524 
525  bsTrees_[label] = tFileService->make<TTree>(TString(treeName), "PixelBarycentre analyzer ntuple");
526 
527  bsTrees_[label]->Branch("run", &run_, "run/I");
528  bsTrees_[label]->Branch("ls", &ls_, "ls/I");
529 
530  bsTrees_[label]->Branch("BS", &BS_);
531 
532  } // bsLabels_
533 
534  for (const auto& label : bcLabels_) {
535  std::string treeName = "PixelBarycentre";
536  if (!label.empty())
537  treeName = "PixelBarycentre_";
538  treeName += label;
539  bcTrees_[label] = tFileService->make<TTree>(TString(treeName), "PixelBarycentre analyzer ntuple");
540 
541  bcTrees_[label]->Branch("run", &run_, "run/I");
542  bcTrees_[label]->Branch("ls", &ls_, "ls/I");
543 
544  bcTrees_[label]->Branch("PIX", &PIX_);
545 
546  bcTrees_[label]->Branch("BPIX", &BPIX_);
547  bcTrees_[label]->Branch("BPIX_Flipped", &BPIX_Flipped_);
548  bcTrees_[label]->Branch("BPIX_NonFlipped", &BPIX_NonFlipped_);
549  bcTrees_[label]->Branch("BPIX_DiffFlippedNonFlipped", &BPIX_DiffFlippedNonFlipped_);
550 
551  bcTrees_[label]->Branch("FPIX", &FPIX_);
552  bcTrees_[label]->Branch("FPIX_plus", &FPIX_plus_);
553  bcTrees_[label]->Branch("FPIX_minus", &FPIX_minus_);
554 
555  //per-layer
556  for (unsigned int i = 0; i < 4; i++) {
557  TString structure = "BPIXLYR";
558  int layer = i + 1;
559  structure += layer;
560 
561  bcTrees_[label]->Branch(structure, &BPIXLayer_[i]);
562  bcTrees_[label]->Branch(structure + "_Flipped", &BPIXLayer_Flipped_[i]);
563  bcTrees_[label]->Branch(structure + "_NonFlipped", &BPIXLayer_NonFlipped_[i]);
564  bcTrees_[label]->Branch(structure + "_DiffFlippedNonFlipped", &BPIXLayer_DiffFlippedNonFlipped_[i]);
565  }
566 
567  //per-disk/ring
568  for (unsigned int i = 0; i < 3; i++) {
569  TString structure = "FPIXDisk+";
570  int disk = i + 1;
571  structure += disk;
572  bcTrees_[label]->Branch(structure, &FPIXDisks_plus_[i]);
573 
574  structure = "FPIXDisk-";
575  structure += disk;
576  bcTrees_[label]->Branch(structure, &FPIXDisks_minus_[i]);
577  }
578 
579  } // bcLabels_
580 }
edm::Service< TFileService > tFileService
constexpr std::array< uint8_t, layerIndexSize > layer
char const * label
std::vector< std::string > bsLabels_
std::vector< std::string > bcLabels_
std::map< std::string, TTree * > bsTrees_
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
GlobalPoint BPIXLayer_DiffFlippedNonFlipped_[4]
std::map< std::string, TTree * > bcTrees_

◆ endJob()

void PixelBaryCentreAnalyzer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 583 of file PixelBaryCentreAnalyzer.cc.

References bcLabels_, bcTrees_, bsLabels_, and bsTrees_.

Referenced by o2olib.O2ORunMgr::executeJob().

583  {
584  bcLabels_.clear();
585  bsLabels_.clear();
586 
587  bcTrees_.clear();
588  bsTrees_.clear();
589 }
std::vector< std::string > bsLabels_
std::vector< std::string > bcLabels_
std::map< std::string, TTree * > bsTrees_
std::map< std::string, TTree * > bcTrees_

◆ fillDescriptions()

void PixelBaryCentreAnalyzer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 592 of file PixelBaryCentreAnalyzer.cc.

References edm::ConfigurationDescriptions::addDefault(), and submitPVResolutionJobs::desc.

592  {
593  //The following says we do not know what parameters are allowed so do no validation
594  // Please change this to state exactly what you do use, even if it is no parameters
596  desc.setUnknown();
597  descriptions.addDefault(desc);
598 }
void addDefault(ParameterSetDescription const &psetDescription)

◆ initBC()

void PixelBaryCentreAnalyzer::initBC ( )
private

Definition at line 159 of file PixelBaryCentreAnalyzer.cc.

References BPIX_, BPIX_DiffFlippedNonFlipped_, BPIX_Flipped_, BPIX_NonFlipped_, BPIXLayer_, BPIXLayer_DiffFlippedNonFlipped_, BPIXLayer_Flipped_, BPIXLayer_NonFlipped_, FPIX_, FPIX_minus_, FPIX_plus_, FPIXDisks_minus_, FPIXDisks_plus_, mps_fire::i, and PIX_.

Referenced by analyze().

159  {
160  // init to large number (unreasonable number) not zero
161  double dummy_float = 999999.0;
162 
163  PIX_ = GlobalPoint(dummy_float, dummy_float, dummy_float);
164  BPIX_ = GlobalPoint(dummy_float, dummy_float, dummy_float);
165  FPIX_ = GlobalPoint(dummy_float, dummy_float, dummy_float);
166 
167  BPIX_Flipped_ = GlobalPoint(dummy_float, dummy_float, dummy_float);
168  BPIX_NonFlipped_ = GlobalPoint(dummy_float, dummy_float, dummy_float);
169  BPIX_DiffFlippedNonFlipped_ = GlobalPoint(dummy_float, dummy_float, dummy_float);
170 
171  FPIX_plus_ = GlobalPoint(dummy_float, dummy_float, dummy_float);
172  FPIX_minus_ = GlobalPoint(dummy_float, dummy_float, dummy_float);
173 
174  for (unsigned int i = 0; i < 4; i++) {
175  BPIXLayer_[i] = GlobalPoint(dummy_float, dummy_float, dummy_float);
176  BPIXLayer_Flipped_[i] = GlobalPoint(dummy_float, dummy_float, dummy_float);
177  BPIXLayer_NonFlipped_[i] = GlobalPoint(dummy_float, dummy_float, dummy_float);
178  BPIXLayer_DiffFlippedNonFlipped_[i] = GlobalPoint(dummy_float, dummy_float, dummy_float);
179  }
180 
181  for (unsigned int i = 0; i < 3; i++) {
182  FPIXDisks_plus_[i] = GlobalPoint(dummy_float, dummy_float, dummy_float);
183  FPIXDisks_minus_[i] = GlobalPoint(dummy_float, dummy_float, dummy_float);
184  }
185 }
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
GlobalPoint BPIXLayer_DiffFlippedNonFlipped_[4]

◆ initBS()

void PixelBaryCentreAnalyzer::initBS ( )
private

Definition at line 153 of file PixelBaryCentreAnalyzer.cc.

References BS_.

Referenced by analyze().

153  {
154  double dummy_float = 999999.0;
155 
156  BS_ = GlobalPoint(dummy_float, dummy_float, dummy_float);
157 }
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10

Member Data Documentation

◆ bcLabels_

std::vector<std::string> PixelBaryCentreAnalyzer::bcLabels_
private

Definition at line 85 of file PixelBaryCentreAnalyzer.cc.

Referenced by analyze(), beginJob(), endJob(), and PixelBaryCentreAnalyzer().

◆ bcTrees_

std::map<std::string, TTree*> PixelBaryCentreAnalyzer::bcTrees_
private

Definition at line 116 of file PixelBaryCentreAnalyzer.cc.

Referenced by analyze(), beginJob(), endJob(), and PixelBaryCentreAnalyzer().

◆ BPIX_

GlobalPoint PixelBaryCentreAnalyzer::BPIX_
private

Definition at line 103 of file PixelBaryCentreAnalyzer.cc.

Referenced by analyze(), beginJob(), and initBC().

◆ BPIX_DiffFlippedNonFlipped_

GlobalPoint PixelBaryCentreAnalyzer::BPIX_DiffFlippedNonFlipped_
private

Definition at line 104 of file PixelBaryCentreAnalyzer.cc.

Referenced by analyze(), beginJob(), and initBC().

◆ BPIX_Flipped_

GlobalPoint PixelBaryCentreAnalyzer::BPIX_Flipped_
private

Definition at line 104 of file PixelBaryCentreAnalyzer.cc.

Referenced by analyze(), beginJob(), and initBC().

◆ BPIX_NonFlipped_

GlobalPoint PixelBaryCentreAnalyzer::BPIX_NonFlipped_
private

Definition at line 104 of file PixelBaryCentreAnalyzer.cc.

Referenced by analyze(), beginJob(), and initBC().

◆ BPIXLayer_

GlobalPoint PixelBaryCentreAnalyzer::BPIXLayer_[4]
private

Definition at line 106 of file PixelBaryCentreAnalyzer.cc.

Referenced by analyze(), beginJob(), and initBC().

◆ BPIXLayer_DiffFlippedNonFlipped_

GlobalPoint PixelBaryCentreAnalyzer::BPIXLayer_DiffFlippedNonFlipped_[4]
private

Definition at line 109 of file PixelBaryCentreAnalyzer.cc.

Referenced by analyze(), beginJob(), and initBC().

◆ BPIXLayer_Flipped_

GlobalPoint PixelBaryCentreAnalyzer::BPIXLayer_Flipped_[4]
private

Definition at line 107 of file PixelBaryCentreAnalyzer.cc.

Referenced by analyze(), beginJob(), and initBC().

◆ BPIXLayer_NonFlipped_

GlobalPoint PixelBaryCentreAnalyzer::BPIXLayer_NonFlipped_[4]
private

Definition at line 108 of file PixelBaryCentreAnalyzer.cc.

Referenced by analyze(), beginJob(), and initBC().

◆ BS_

GlobalPoint PixelBaryCentreAnalyzer::BS_
private

Definition at line 101 of file PixelBaryCentreAnalyzer.cc.

Referenced by analyze(), beginJob(), and initBS().

◆ bsLabels_

std::vector<std::string> PixelBaryCentreAnalyzer::bsLabels_
private

Definition at line 87 of file PixelBaryCentreAnalyzer.cc.

Referenced by analyze(), beginJob(), endJob(), and PixelBaryCentreAnalyzer().

◆ bsTokens_

std::map<std::string, edm::ESGetToken<BeamSpotObjects, BeamSpotObjectsRcd> > PixelBaryCentreAnalyzer::bsTokens_
private

Definition at line 95 of file PixelBaryCentreAnalyzer.cc.

Referenced by analyze(), and PixelBaryCentreAnalyzer().

◆ bsTrees_

std::map<std::string, TTree*> PixelBaryCentreAnalyzer::bsTrees_
private

Definition at line 117 of file PixelBaryCentreAnalyzer.cc.

Referenced by analyze(), beginJob(), endJob(), and PixelBaryCentreAnalyzer().

◆ FPIX_

GlobalPoint PixelBaryCentreAnalyzer::FPIX_
private

Definition at line 103 of file PixelBaryCentreAnalyzer.cc.

Referenced by analyze(), beginJob(), and initBC().

◆ FPIX_minus_

GlobalPoint PixelBaryCentreAnalyzer::FPIX_minus_
private

Definition at line 111 of file PixelBaryCentreAnalyzer.cc.

Referenced by analyze(), beginJob(), and initBC().

◆ FPIX_plus_

GlobalPoint PixelBaryCentreAnalyzer::FPIX_plus_
private

Definition at line 111 of file PixelBaryCentreAnalyzer.cc.

Referenced by analyze(), beginJob(), and initBC().

◆ FPIXDisks_minus_

GlobalPoint PixelBaryCentreAnalyzer::FPIXDisks_minus_[3]
private

Definition at line 113 of file PixelBaryCentreAnalyzer.cc.

Referenced by analyze(), beginJob(), and initBC().

◆ FPIXDisks_plus_

GlobalPoint PixelBaryCentreAnalyzer::FPIXDisks_plus_[3]
private

Definition at line 112 of file PixelBaryCentreAnalyzer.cc.

Referenced by analyze(), beginJob(), and initBC().

◆ gprToken_

edm::ESGetToken<Alignments, GlobalPositionRcd> PixelBaryCentreAnalyzer::gprToken_
private

Definition at line 93 of file PixelBaryCentreAnalyzer.cc.

Referenced by analyze().

◆ ls_

int PixelBaryCentreAnalyzer::ls_
private

Definition at line 99 of file PixelBaryCentreAnalyzer.cc.

Referenced by analyze(), and beginJob().

◆ phase_

int PixelBaryCentreAnalyzer::phase_
private

Definition at line 78 of file PixelBaryCentreAnalyzer.cc.

Referenced by analyze().

◆ PIX_

GlobalPoint PixelBaryCentreAnalyzer::PIX_
private

Definition at line 103 of file PixelBaryCentreAnalyzer.cc.

Referenced by analyze(), beginJob(), and initBC().

◆ run_

int PixelBaryCentreAnalyzer::run_
private

Definition at line 98 of file PixelBaryCentreAnalyzer.cc.

Referenced by analyze(), and beginJob().

◆ siPixelQualityToken_

edm::ESGetToken<SiPixelQuality, SiPixelQualityFromDbRcd> PixelBaryCentreAnalyzer::siPixelQualityToken_
private

Definition at line 91 of file PixelBaryCentreAnalyzer.cc.

Referenced by analyze().

◆ tFileService

edm::Service<TFileService> PixelBaryCentreAnalyzer::tFileService
private

Definition at line 115 of file PixelBaryCentreAnalyzer.cc.

Referenced by beginJob().

◆ tkAlignTokens_

std::map<std::string, edm::ESGetToken<Alignments, TrackerAlignmentRcd> > PixelBaryCentreAnalyzer::tkAlignTokens_
private

Definition at line 94 of file PixelBaryCentreAnalyzer.cc.

Referenced by analyze(), and PixelBaryCentreAnalyzer().

◆ trackerGeometryToken_

edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> PixelBaryCentreAnalyzer::trackerGeometryToken_
private

Definition at line 89 of file PixelBaryCentreAnalyzer.cc.

Referenced by analyze().

◆ trackerTopologyToken_

edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> PixelBaryCentreAnalyzer::trackerTopologyToken_
private

Definition at line 90 of file PixelBaryCentreAnalyzer.cc.

Referenced by analyze().

◆ usePixelQuality_

bool PixelBaryCentreAnalyzer::usePixelQuality_
private

Definition at line 77 of file PixelBaryCentreAnalyzer.cc.

Referenced by analyze().

◆ watcherBS_

edm::ESWatcher<BeamSpotObjectsRcd> PixelBaryCentreAnalyzer::watcherBS_
private

Definition at line 81 of file PixelBaryCentreAnalyzer.cc.

Referenced by analyze().

◆ watcherTkAlign_

edm::ESWatcher<TrackerAlignmentRcd> PixelBaryCentreAnalyzer::watcherTkAlign_
private

Definition at line 82 of file PixelBaryCentreAnalyzer.cc.

Referenced by analyze().