CMS 3D CMS Logo

SiPixelBarycenter.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: SiPixelPhase1Summary
4 // Class: SiPixelBarycenter
5 //
13 //
14 // Original Author: Danilo Meuser
15 // Created: 26th May 2021
16 //
17 //
21 
22 #include <string>
23 #include <iostream>
24 
25 using namespace std;
26 using namespace edm;
27 
29  : DQMEDHarvester(iConfig),
30  alignmentToken_(esConsumes<edm::Transition::EndLuminosityBlock>()),
32  trackerTopologyToken_(esConsumes<edm::Transition::EndLuminosityBlock>()) {
33  LogInfo("PixelDQM") << "SiPixelBarycenter::SiPixelBarycenter: Got DQM BackEnd interface" << endl;
34 }
35 
37  // do anything here that needs to be done at desctruction time
38  // (e.g. close files, deallocate resources etc.)
39  LogInfo("PixelDQM") << "SiPixelBarycenter::~SiPixelBarycenter: Destructor" << endl;
40 }
41 
43 
45 
47  DQMStore::IGetter& iGetter,
48  const edm::LuminosityBlock& lumiSeg,
49  edm::EventSetup const& c) {
50  bookBarycenterHistograms(iBooker);
51 
52  const Alignments* alignments = &c.getData(alignmentToken_);
53  const Alignments* gpr = &c.getData(gprToken_);
54  const TrackerTopology* tTopo = &c.getData(trackerTopologyToken_);
55 
56  fillBarycenterHistograms(iBooker, iGetter, alignments->m_align, gpr->m_align, *tTopo);
57 }
58 //------------------------------------------------------------------
59 // Used to book the barycenter histograms
60 //------------------------------------------------------------------
62  iBooker.cd();
63 
64  iBooker.setCurrentFolder("PixelPhase1/Barycenter");
65  //Book one histogram for each subdetector
67  {"BPIX", "FPIX_zm", "FPIX_zp", "BPIX_xp", "BPIX_xm", "FPIX_zp_xp", "FPIX_zm_xp", "FPIX_zp_xm", "FPIX_zm_xm"}) {
69  iBooker.book1D("barycenters_" + subdetector,
70  "Position of the barycenter for " + subdetector + ";Coordinate;Position [mm]",
71  3,
72  0.5,
73  3.5);
74  barycenters_[subdetector]->setBinLabel(1, "x");
75  barycenters_[subdetector]->setBinLabel(2, "y");
76  barycenters_[subdetector]->setBinLabel(3, "z");
77  }
78 
79  //Reset the iBooker
80  iBooker.setCurrentFolder("PixelPhase1/");
81 }
82 
83 //------------------------------------------------------------------
84 // Fill the Barycenter histograms
85 //------------------------------------------------------------------
87  DQMStore::IGetter& iGetter,
88  const std::vector<AlignTransform>& input,
89  const std::vector<AlignTransform>& GPR,
90  const TrackerTopology& tTopo) {
91  const auto GPR_translation_pixel = GPR[0].translation();
92  const std::map<DQMBarycenter::coordinate, float> GPR_pixel = {{DQMBarycenter::t_x, GPR_translation_pixel.x()},
93  {DQMBarycenter::t_y, GPR_translation_pixel.y()},
94  {DQMBarycenter::t_z, GPR_translation_pixel.z()}};
95 
97  barycenters.computeBarycenters(input, tTopo, GPR_pixel);
98 
99  auto Xbarycenters = barycenters.getX();
100  auto Ybarycenters = barycenters.getY();
101  auto Zbarycenters = barycenters.getZ();
102 
103  //Fill histogram for each subdetector
104  std::vector<std::string> subdetectors = {
105  "BPIX", "FPIX_zm", "FPIX_zp", "BPIX_xp", "BPIX_xm", "FPIX_zp_xp", "FPIX_zm_xp", "FPIX_zp_xm", "FPIX_zm_xm"};
106  for (std::size_t i = 0; i < subdetectors.size(); ++i) {
107  barycenters_[subdetectors[i]]->setBinContent(1, Xbarycenters[i]);
108  barycenters_[subdetectors[i]]->setBinContent(2, Ybarycenters[i]);
109  barycenters_[subdetectors[i]]->setBinContent(3, Zbarycenters[i]);
110  }
111 }
112 
113 //define this as a plug-in
DQMBarycenter::TkAlBarycenters::getX
const std::array< double, 9 > getX()
Definition: SiPixelBarycenterHelper.h:72
SiPixelBarycenter::bookBarycenterHistograms
void bookBarycenterHistograms(DQMStore::IBooker &iBooker)
Definition: SiPixelBarycenter.cc:61
mps_fire.i
i
Definition: mps_fire.py:428
input
static const std::string input
Definition: EdmProvDump.cc:48
MessageLogger.h
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
edm::Run
Definition: Run.h:45
edm
HLT enums.
Definition: AlignableModifier.h:19
TrackerTopology
Definition: TrackerTopology.h:16
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
DQMBarycenter::t_x
Definition: SiPixelBarycenterHelper.h:16
DQMBarycenter::TkAlBarycenters::getY
const std::array< double, 9 > getY()
Definition: SiPixelBarycenterHelper.h:87
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
SiPixelBarycenter::fillBarycenterHistograms
void fillBarycenterHistograms(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter, const std::vector< AlignTransform > &input, const std::vector< AlignTransform > &GPR, const TrackerTopology &tTopo)
Definition: SiPixelBarycenter.cc:86
SiPixelBarycenter.h
SiPixelBarycenter::dqmEndJob
void dqmEndJob(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter) override
Definition: SiPixelBarycenter.cc:44
TrackingMonitor_cfi.subdetectors
subdetectors
Definition: TrackingMonitor_cfi.py:181
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
dqm::implementation::NavigatorBase::cd
virtual void cd()
Definition: DQMStore.cc:29
SiPixelBarycenter::SiPixelBarycenter
SiPixelBarycenter(const edm::ParameterSet &conf)
Definition: SiPixelBarycenter.cc:28
SiPixelBarycenter::trackerTopologyToken_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopologyToken_
Definition: SiPixelBarycenter.h:54
DQMBarycenter::t_y
Definition: SiPixelBarycenterHelper.h:17
edm::ParameterSet
Definition: ParameterSet.h:47
edm::Transition
Transition
Definition: Transition.h:12
DQMBarycenter::TkAlBarycenters::getZ
const std::array< double, 9 > getZ()
Definition: SiPixelBarycenterHelper.h:102
SiPixelBarycenter
Definition: SiPixelBarycenter.h:37
DQMBarycenter::t_z
Definition: SiPixelBarycenterHelper.h:18
edm::EventSetup
Definition: EventSetup.h:58
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DQMBarycenter::TkAlBarycenters
Definition: SiPixelBarycenterHelper.h:62
SiPixelBarycenter::dqmEndLuminosityBlock
void dqmEndLuminosityBlock(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter, edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c) override
Definition: SiPixelBarycenter.cc:46
DQMBarycenter::TkAlBarycenters::computeBarycenters
void computeBarycenters(const std::vector< AlignTransform > &input, const TrackerTopology &tTopo, const std::map< DQMBarycenter::coordinate, float > &GPR)
Definition: SiPixelBarycenterHelper.h:118
DQMEDHarvester
Definition: DQMEDHarvester.py:1
SiPixelBarycenter::alignmentToken_
const edm::ESGetToken< Alignments, TrackerAlignmentRcd > alignmentToken_
Definition: SiPixelBarycenter.h:52
edm::Transition::EndLuminosityBlock
std
Definition: JetResolutionObject.h:76
writedatasetfile.run
run
Definition: writedatasetfile.py:27
dqm::implementation::IGetter
Definition: DQMStore.h:484
SiPixelBarycenter::barycenters_
std::map< std::string, MonitorElement * > barycenters_
Definition: SiPixelBarycenter.h:56
dqm::implementation::IBooker
Definition: DQMStore.h:43
Alignments::m_align
std::vector< AlignTransform > m_align
Definition: Alignments.h:19
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
SiPixelBarycenterHelper.h
Alignments
Definition: Alignments.h:10
SiPixelBarycenter::beginRun
void beginRun(edm::Run const &run, edm::EventSetup const &eSetup) override
Definition: SiPixelBarycenter.cc:42
SiPixelBarycenter::~SiPixelBarycenter
~SiPixelBarycenter() override
Definition: SiPixelBarycenter.cc:36
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
SiPixelBarycenter::gprToken_
const edm::ESGetToken< Alignments, GlobalPositionRcd > gprToken_
Definition: SiPixelBarycenter.h:53
subdetector
TString subdetector
Definition: trackSplitPlot.h:54