Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:08:58

0001 // -*- C++ -*-
0002 //
0003 // Package:    SiOuterTracker
0004 // Class:      SiOuterTracker
0005 //
0006 /**\class SiOuterTracker Phase2OTMonitorTTStub.cc
0007  DQM/SiOuterTracker/plugins/Phase2OTMonitorTTStub.cc
0008 
0009  Description: [one line class summary]
0010 
0011  Implementation:
0012      [Notes on implementation]
0013 */
0014 //
0015 // Original Author:  Isis Marina Van Parijs
0016 //         Created:  Fri, 24 Oct 2014 12:31:31 GMT
0017 //
0018 //
0019 
0020 // system include files
0021 #include <memory>
0022 #include <numeric>
0023 #include <vector>
0024 
0025 // user include files
0026 #include "FWCore/Framework/interface/ESHandle.h"
0027 #include "FWCore/Framework/interface/Event.h"
0028 #include "FWCore/Framework/interface/Frameworkfwd.h"
0029 #include "FWCore/Framework/interface/MakerMacros.h"
0030 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0031 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0032 #include "FWCore/ServiceRegistry/interface/Service.h"
0033 #include "FWCore/Utilities/interface/EDGetToken.h"
0034 
0035 #include "DataFormats/Common/interface/DetSetVectorNew.h"
0036 #include "DataFormats/L1TrackTrigger/interface/TTTypes.h"
0037 #include "DataFormats/L1TrackTrigger/interface/TTStub.h"
0038 #include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
0039 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0040 
0041 #include "Geometry/CommonDetUnit/interface/GeomDet.h"
0042 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
0043 #include "Geometry/Records/interface/TrackerTopologyRcd.h"
0044 #include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h"
0045 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0046 
0047 #include "DQMServices/Core/interface/DQMEDAnalyzer.h"
0048 #include "DQMServices/Core/interface/DQMStore.h"
0049 
0050 class Phase2OTMonitorTTStub : public DQMEDAnalyzer {
0051 public:
0052   explicit Phase2OTMonitorTTStub(const edm::ParameterSet &);
0053   ~Phase2OTMonitorTTStub() override;
0054   void analyze(const edm::Event &, const edm::EventSetup &) override;
0055   void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
0056   void dqmBeginRun(const edm::Run &iRun, const edm::EventSetup &iSetup) override;
0057   static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
0058   // TTStub stacks
0059   // Global position of the stubs
0060   MonitorElement *Stub_Barrel_XY = nullptr;     // TTStub barrel y vs x
0061   MonitorElement *Stub_Endcap_Fw_XY = nullptr;  // TTStub Forward Endcap y vs. x
0062   MonitorElement *Stub_Endcap_Bw_XY = nullptr;  // TTStub Backward Endcap y vs. x
0063   MonitorElement *Stub_RZ = nullptr;            // TTStub #rho vs. z
0064 
0065   // Number of stubs
0066   MonitorElement *Stub_Barrel = nullptr;                                                   // TTStub per layer
0067   MonitorElement *Stub_Endcap_Disc = nullptr;                                              // TTStubs per disc
0068   MonitorElement *Stub_Endcap_Disc_Fw = nullptr;                                           // TTStub per disc
0069   MonitorElement *Stub_Endcap_Disc_Bw = nullptr;                                           // TTStub per disc
0070   MonitorElement *Stub_Endcap_Ring = nullptr;                                              // TTStubs per ring
0071   MonitorElement *Stub_Endcap_Ring_Fw[5] = {nullptr, nullptr, nullptr, nullptr, nullptr};  // TTStubs per EC ring
0072   MonitorElement *Stub_Endcap_Ring_Bw[5] = {nullptr, nullptr, nullptr, nullptr, nullptr};  // TTStub per EC ring
0073 
0074   // Stub distribution
0075   MonitorElement *Stub_Eta = nullptr;     // TTstub eta distribution
0076   MonitorElement *Stub_Phi = nullptr;     // TTstub phi distribution
0077   MonitorElement *Stub_R = nullptr;       // TTstub r distribution
0078   MonitorElement *Stub_bendFE = nullptr;  // TTstub trigger bend
0079   MonitorElement *Stub_bendBE = nullptr;  // TTstub hardware bend
0080   MonitorElement *Stub_isPS = nullptr;    // is this stub a PS module?
0081 
0082   // STUB Displacement - offset
0083   MonitorElement *Stub_Barrel_W = nullptr;       // TTstub Pos-Corr Displacement (layer)
0084   MonitorElement *Stub_Barrel_O = nullptr;       // TTStub Offset (layer)
0085   MonitorElement *Stub_Endcap_Disc_W = nullptr;  // TTstub Pos-Corr Displacement (disc)
0086   MonitorElement *Stub_Endcap_Disc_O = nullptr;  // TTStub Offset (disc)
0087   MonitorElement *Stub_Endcap_Ring_W = nullptr;  // TTstub Pos-Corr Displacement (EC ring)
0088   MonitorElement *Stub_Endcap_Ring_O = nullptr;  // TTStub Offset (EC ring)
0089   MonitorElement *Stub_Endcap_Ring_W_Fw[5] = {
0090       nullptr, nullptr, nullptr, nullptr, nullptr};  // TTstub Pos-Corr Displacement (EC ring)
0091   MonitorElement *Stub_Endcap_Ring_O_Fw[5] = {nullptr, nullptr, nullptr, nullptr, nullptr};  // TTStub Offset (EC ring)
0092   MonitorElement *Stub_Endcap_Ring_W_Bw[5] = {
0093       nullptr, nullptr, nullptr, nullptr, nullptr};  // TTstub Pos-Corr Displacement (EC ring)
0094   MonitorElement *Stub_Endcap_Ring_O_Bw[5] = {nullptr, nullptr, nullptr, nullptr, nullptr};  // TTStub Offset (EC ring)
0095 
0096 private:
0097   edm::ParameterSet conf_;
0098   edm::EDGetTokenT<edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_>>> tagTTStubsToken_;
0099   std::string topFolderName_;
0100   const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> geomToken_;
0101   const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> topoToken_;
0102   const TrackerGeometry *tkGeom_ = nullptr;
0103   const TrackerTopology *tTopo_ = nullptr;
0104 };
0105 
0106 // constructors and destructor
0107 Phase2OTMonitorTTStub::Phase2OTMonitorTTStub(const edm::ParameterSet &iConfig)
0108     : conf_(iConfig),
0109       geomToken_(esConsumes<TrackerGeometry, TrackerDigiGeometryRecord, edm::Transition::BeginRun>()),
0110       topoToken_(esConsumes<TrackerTopology, TrackerTopologyRcd, edm::Transition::BeginRun>()) {
0111   // now do what ever initialization is needed
0112   topFolderName_ = conf_.getParameter<std::string>("TopFolderName");
0113   tagTTStubsToken_ =
0114       consumes<edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_>>>(conf_.getParameter<edm::InputTag>("TTStubs"));
0115 }
0116 
0117 Phase2OTMonitorTTStub::~Phase2OTMonitorTTStub() {
0118   // do anything here that needs to be done at desctruction time
0119   // (e.g. close files, deallocate resources etc.)
0120 }
0121 
0122 void Phase2OTMonitorTTStub::dqmBeginRun(const edm::Run &iRun, const edm::EventSetup &iSetup) {
0123   tkGeom_ = &(iSetup.getData(geomToken_));
0124   tTopo_ = &(iSetup.getData(topoToken_));
0125 }
0126 // member functions
0127 
0128 // ------------ method called for each event  ------------
0129 void Phase2OTMonitorTTStub::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) {
0130   /// Track Trigger Stubs
0131   edm::Handle<edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_>>> Phase2TrackerDigiTTStubHandle;
0132   iEvent.getByToken(tagTTStubsToken_, Phase2TrackerDigiTTStubHandle);
0133 
0134   /// Loop over input Stubs
0135   typename edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_>>::const_iterator inputIter;
0136   typename edmNew::DetSet<TTStub<Ref_Phase2TrackerDigi_>>::const_iterator contentIter;
0137   // Adding protection
0138   if (!Phase2TrackerDigiTTStubHandle.isValid())
0139     return;
0140 
0141   for (inputIter = Phase2TrackerDigiTTStubHandle->begin(); inputIter != Phase2TrackerDigiTTStubHandle->end();
0142        ++inputIter) {
0143     for (contentIter = inputIter->begin(); contentIter != inputIter->end(); ++contentIter) {
0144       /// Make reference stub
0145       edm::Ref<edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_>>, TTStub<Ref_Phase2TrackerDigi_>> tempStubRef =
0146           edmNew::makeRefTo(Phase2TrackerDigiTTStubHandle, contentIter);
0147 
0148       /// Get det ID (place of the stub)
0149       //  tempStubRef->getDetId() gives the stackDetId, not rawId
0150       DetId detIdStub = tkGeom_->idToDet((tempStubRef->clusterRef(0))->getDetId())->geographicalId();
0151 
0152       /// Get trigger displacement/offset
0153       double rawBend = tempStubRef->rawBend();
0154       double bendOffset = tempStubRef->bendOffset();
0155 
0156       /// Define position stub by position inner cluster
0157       MeasurementPoint mp = (tempStubRef->clusterRef(0))->findAverageLocalCoordinates();
0158       const GeomDet *theGeomDet = tkGeom_->idToDet(detIdStub);
0159       Global3DPoint posStub = theGeomDet->surface().toGlobal(theGeomDet->topology().localPosition(mp));
0160 
0161       Stub_Eta->Fill(posStub.eta());
0162       Stub_Phi->Fill(posStub.phi());
0163       Stub_R->Fill(posStub.perp());
0164       Stub_RZ->Fill(posStub.z(), posStub.perp());
0165       Stub_bendFE->Fill(tempStubRef->bendFE());
0166       Stub_bendBE->Fill(tempStubRef->bendBE());
0167       Stub_isPS->Fill(tempStubRef->moduleTypePS());
0168 
0169       if (detIdStub.subdetId() == static_cast<int>(StripSubdetector::TOB)) {  // Phase 2 Outer Tracker Barrel
0170         Stub_Barrel->Fill(tTopo_->layer(detIdStub));
0171         Stub_Barrel_XY->Fill(posStub.x(), posStub.y());
0172         Stub_Barrel_W->Fill(tTopo_->layer(detIdStub), rawBend - bendOffset);
0173         Stub_Barrel_O->Fill(tTopo_->layer(detIdStub), bendOffset);
0174       } else if (detIdStub.subdetId() == static_cast<int>(StripSubdetector::TID)) {  // Phase 2 Outer Tracker Endcap
0175         int disc = tTopo_->layer(detIdStub);                                         // returns wheel
0176         int ring = tTopo_->tidRing(detIdStub);
0177         Stub_Endcap_Disc->Fill(disc);
0178         Stub_Endcap_Ring->Fill(ring);
0179         Stub_Endcap_Disc_W->Fill(disc, rawBend - bendOffset);
0180         Stub_Endcap_Ring_W->Fill(ring, rawBend - bendOffset);
0181         Stub_Endcap_Disc_O->Fill(disc, bendOffset);
0182         Stub_Endcap_Ring_O->Fill(ring, bendOffset);
0183 
0184         if (posStub.z() > 0) {
0185           Stub_Endcap_Fw_XY->Fill(posStub.x(), posStub.y());
0186           Stub_Endcap_Disc_Fw->Fill(disc);
0187           Stub_Endcap_Ring_Fw[disc - 1]->Fill(ring);
0188           Stub_Endcap_Ring_W_Fw[disc - 1]->Fill(ring, rawBend - bendOffset);
0189           Stub_Endcap_Ring_O_Fw[disc - 1]->Fill(ring, bendOffset);
0190         } else {
0191           Stub_Endcap_Bw_XY->Fill(posStub.x(), posStub.y());
0192           Stub_Endcap_Disc_Bw->Fill(disc);
0193           Stub_Endcap_Ring_Bw[disc - 1]->Fill(ring);
0194           Stub_Endcap_Ring_W_Bw[disc - 1]->Fill(ring, rawBend - bendOffset);
0195           Stub_Endcap_Ring_O_Bw[disc - 1]->Fill(ring, bendOffset);
0196         }
0197       }
0198     }
0199   }
0200 }  // end of method
0201 
0202 // ------------ method called when starting to processes a run  ------------
0203 void Phase2OTMonitorTTStub::bookHistograms(DQMStore::IBooker &iBooker, edm::Run const &run, edm::EventSetup const &es) {
0204   std::string HistoName;
0205   const int numDiscs = 5;
0206   iBooker.setCurrentFolder(topFolderName_ + "/Stubs/Position");
0207 
0208   edm::ParameterSet psTTStub_Barrel_XY = conf_.getParameter<edm::ParameterSet>("TH2TTStub_Position");
0209   HistoName = "Stub_Barrel_XY";
0210   Stub_Barrel_XY = iBooker.book2D(HistoName,
0211                                   HistoName,
0212                                   psTTStub_Barrel_XY.getParameter<int32_t>("Nbinsx"),
0213                                   psTTStub_Barrel_XY.getParameter<double>("xmin"),
0214                                   psTTStub_Barrel_XY.getParameter<double>("xmax"),
0215                                   psTTStub_Barrel_XY.getParameter<int32_t>("Nbinsy"),
0216                                   psTTStub_Barrel_XY.getParameter<double>("ymin"),
0217                                   psTTStub_Barrel_XY.getParameter<double>("ymax"));
0218   Stub_Barrel_XY->setAxisTitle("L1 Stub Barrel position x [cm]", 1);
0219   Stub_Barrel_XY->setAxisTitle("L1 Stub Barrel position y [cm]", 2);
0220 
0221   edm::ParameterSet psTTStub_Endcap_Fw_XY = conf_.getParameter<edm::ParameterSet>("TH2TTStub_Position");
0222   HistoName = "Stub_Endcap_Fw_XY";
0223   Stub_Endcap_Fw_XY = iBooker.book2D(HistoName,
0224                                      HistoName,
0225                                      psTTStub_Endcap_Fw_XY.getParameter<int32_t>("Nbinsx"),
0226                                      psTTStub_Endcap_Fw_XY.getParameter<double>("xmin"),
0227                                      psTTStub_Endcap_Fw_XY.getParameter<double>("xmax"),
0228                                      psTTStub_Endcap_Fw_XY.getParameter<int32_t>("Nbinsy"),
0229                                      psTTStub_Endcap_Fw_XY.getParameter<double>("ymin"),
0230                                      psTTStub_Endcap_Fw_XY.getParameter<double>("ymax"));
0231   Stub_Endcap_Fw_XY->setAxisTitle("L1 Stub Endcap position x [cm]", 1);
0232   Stub_Endcap_Fw_XY->setAxisTitle("L1 Stub Endcap position y [cm]", 2);
0233 
0234   edm::ParameterSet psTTStub_Endcap_Bw_XY = conf_.getParameter<edm::ParameterSet>("TH2TTStub_Position");
0235   HistoName = "Stub_Endcap_Bw_XY";
0236   Stub_Endcap_Bw_XY = iBooker.book2D(HistoName,
0237                                      HistoName,
0238                                      psTTStub_Endcap_Bw_XY.getParameter<int32_t>("Nbinsx"),
0239                                      psTTStub_Endcap_Bw_XY.getParameter<double>("xmin"),
0240                                      psTTStub_Endcap_Bw_XY.getParameter<double>("xmax"),
0241                                      psTTStub_Endcap_Bw_XY.getParameter<int32_t>("Nbinsy"),
0242                                      psTTStub_Endcap_Bw_XY.getParameter<double>("ymin"),
0243                                      psTTStub_Endcap_Bw_XY.getParameter<double>("ymax"));
0244   Stub_Endcap_Bw_XY->setAxisTitle("L1 Stub Endcap position x [cm]", 1);
0245   Stub_Endcap_Bw_XY->setAxisTitle("L1 Stub Endcap position y [cm]", 2);
0246 
0247   // TTStub #rho vs. z
0248   edm::ParameterSet psTTStub_RZ = conf_.getParameter<edm::ParameterSet>("TH2TTStub_RZ");
0249   HistoName = "Stub_RZ";
0250   Stub_RZ = iBooker.book2D(HistoName,
0251                            HistoName,
0252                            psTTStub_RZ.getParameter<int32_t>("Nbinsx"),
0253                            psTTStub_RZ.getParameter<double>("xmin"),
0254                            psTTStub_RZ.getParameter<double>("xmax"),
0255                            psTTStub_RZ.getParameter<int32_t>("Nbinsy"),
0256                            psTTStub_RZ.getParameter<double>("ymin"),
0257                            psTTStub_RZ.getParameter<double>("ymax"));
0258   Stub_RZ->setAxisTitle("L1 Stub position z [cm]", 1);
0259   Stub_RZ->setAxisTitle("L1 Stub position #rho [cm]", 2);
0260 
0261   iBooker.setCurrentFolder(topFolderName_ + "/Stubs");
0262   // TTStub eta
0263   edm::ParameterSet psTTStub_Eta = conf_.getParameter<edm::ParameterSet>("TH1TTStub_Eta");
0264   HistoName = "Stub_Eta";
0265   Stub_Eta = iBooker.book1D(HistoName,
0266                             HistoName,
0267                             psTTStub_Eta.getParameter<int32_t>("Nbinsx"),
0268                             psTTStub_Eta.getParameter<double>("xmin"),
0269                             psTTStub_Eta.getParameter<double>("xmax"));
0270   Stub_Eta->setAxisTitle("#eta", 1);
0271   Stub_Eta->setAxisTitle("# L1 Stubs ", 2);
0272 
0273   // TTStub phi
0274   edm::ParameterSet psTTStub_Phi = conf_.getParameter<edm::ParameterSet>("TH1TTStub_Phi");
0275   HistoName = "Stub_Phi";
0276   Stub_Phi = iBooker.book1D(HistoName,
0277                             HistoName,
0278                             psTTStub_Phi.getParameter<int32_t>("Nbinsx"),
0279                             psTTStub_Phi.getParameter<double>("xmin"),
0280                             psTTStub_Phi.getParameter<double>("xmax"));
0281   Stub_Phi->setAxisTitle("#phi", 1);
0282   Stub_Phi->setAxisTitle("# L1 Stubs ", 2);
0283 
0284   // TTStub R
0285   edm::ParameterSet psTTStub_R = conf_.getParameter<edm::ParameterSet>("TH1TTStub_R");
0286   HistoName = "Stub_R";
0287   Stub_R = iBooker.book1D(HistoName,
0288                           HistoName,
0289                           psTTStub_R.getParameter<int32_t>("Nbinsx"),
0290                           psTTStub_R.getParameter<double>("xmin"),
0291                           psTTStub_R.getParameter<double>("xmax"));
0292   Stub_R->setAxisTitle("R", 1);
0293   Stub_R->setAxisTitle("# L1 Stubs ", 2);
0294 
0295   // TTStub trigger bend
0296   edm::ParameterSet psTTStub_bend = conf_.getParameter<edm::ParameterSet>("TH1TTStub_bend");
0297   HistoName = "Stub_bendFE";
0298   Stub_bendFE = iBooker.book1D(HistoName,
0299                                HistoName,
0300                                psTTStub_bend.getParameter<int32_t>("Nbinsx"),
0301                                psTTStub_bend.getParameter<double>("xmin"),
0302                                psTTStub_bend.getParameter<double>("xmax"));
0303   Stub_bendFE->setAxisTitle("Trigger bend", 1);
0304   Stub_bendFE->setAxisTitle("# L1 Stubs ", 2);
0305 
0306   // TTStub hardware bend
0307   HistoName = "Stub_bendBE";
0308   Stub_bendBE = iBooker.book1D(HistoName,
0309                                HistoName,
0310                                psTTStub_bend.getParameter<int32_t>("Nbinsx"),
0311                                psTTStub_bend.getParameter<double>("xmin"),
0312                                psTTStub_bend.getParameter<double>("xmax"));
0313   Stub_bendBE->setAxisTitle("Hardware bend", 1);
0314   Stub_bendBE->setAxisTitle("# L1 Stubs ", 2);
0315 
0316   // TTStub, is PS?
0317   edm::ParameterSet psTTStub_isPS = conf_.getParameter<edm::ParameterSet>("TH1TTStub_isPS");
0318   HistoName = "Stub_isPS";
0319   Stub_isPS = iBooker.book1D(HistoName,
0320                              HistoName,
0321                              psTTStub_isPS.getParameter<int32_t>("Nbinsx"),
0322                              psTTStub_isPS.getParameter<double>("xmin"),
0323                              psTTStub_isPS.getParameter<double>("xmax"));
0324   Stub_isPS->setAxisTitle("Is PS?", 1);
0325   Stub_isPS->setAxisTitle("# L1 Stubs ", 2);
0326 
0327   iBooker.setCurrentFolder(topFolderName_ + "/Stubs/NStubs");
0328   // TTStub barrel stack
0329   edm::ParameterSet psTTStub_Barrel = conf_.getParameter<edm::ParameterSet>("TH1TTStub_Layers");
0330   HistoName = "NStubs_Barrel";
0331   Stub_Barrel = iBooker.book1D(HistoName,
0332                                HistoName,
0333                                psTTStub_Barrel.getParameter<int32_t>("Nbinsx"),
0334                                psTTStub_Barrel.getParameter<double>("xmin"),
0335                                psTTStub_Barrel.getParameter<double>("xmax"));
0336   Stub_Barrel->setAxisTitle("Barrel Layer", 1);
0337   Stub_Barrel->setAxisTitle("# L1 Stubs ", 2);
0338 
0339   // TTStub Endcap stack
0340   edm::ParameterSet psTTStub_ECDisc = conf_.getParameter<edm::ParameterSet>("TH1TTStub_Discs");
0341   HistoName = "NStubs_Endcap_Disc";
0342   Stub_Endcap_Disc = iBooker.book1D(HistoName,
0343                                     HistoName,
0344                                     psTTStub_ECDisc.getParameter<int32_t>("Nbinsx"),
0345                                     psTTStub_ECDisc.getParameter<double>("xmin"),
0346                                     psTTStub_ECDisc.getParameter<double>("xmax"));
0347   Stub_Endcap_Disc->setAxisTitle("Endcap Disc", 1);
0348   Stub_Endcap_Disc->setAxisTitle("# L1 Stubs ", 2);
0349 
0350   // TTStub Endcap stack
0351   HistoName = "NStubs_Endcap_Disc_Fw";
0352   Stub_Endcap_Disc_Fw = iBooker.book1D(HistoName,
0353                                        HistoName,
0354                                        psTTStub_ECDisc.getParameter<int32_t>("Nbinsx"),
0355                                        psTTStub_ECDisc.getParameter<double>("xmin"),
0356                                        psTTStub_ECDisc.getParameter<double>("xmax"));
0357   Stub_Endcap_Disc_Fw->setAxisTitle("Forward Endcap Disc", 1);
0358   Stub_Endcap_Disc_Fw->setAxisTitle("# L1 Stubs ", 2);
0359 
0360   // TTStub Endcap stack
0361   HistoName = "NStubs_Endcap_Disc_Bw";
0362   Stub_Endcap_Disc_Bw = iBooker.book1D(HistoName,
0363                                        HistoName,
0364                                        psTTStub_ECDisc.getParameter<int32_t>("Nbinsx"),
0365                                        psTTStub_ECDisc.getParameter<double>("xmin"),
0366                                        psTTStub_ECDisc.getParameter<double>("xmax"));
0367   Stub_Endcap_Disc_Bw->setAxisTitle("Backward Endcap Disc", 1);
0368   Stub_Endcap_Disc_Bw->setAxisTitle("# L1 Stubs ", 2);
0369 
0370   edm::ParameterSet psTTStub_ECRing = conf_.getParameter<edm::ParameterSet>("TH1TTStub_Rings");
0371   HistoName = "NStubs_Endcap_Ring";
0372   Stub_Endcap_Ring = iBooker.book1D(HistoName,
0373                                     HistoName,
0374                                     psTTStub_ECRing.getParameter<int32_t>("Nbinsx"),
0375                                     psTTStub_ECRing.getParameter<double>("xmin"),
0376                                     psTTStub_ECRing.getParameter<double>("xmax"));
0377   Stub_Endcap_Ring->setAxisTitle("Endcap Ring", 1);
0378   Stub_Endcap_Ring->setAxisTitle("# L1 Stubs ", 2);
0379 
0380   for (int i = 0; i < numDiscs; i++) {
0381     HistoName = "NStubs_Disc+" + std::to_string(i + 1);
0382     // TTStub Endcap stack
0383     Stub_Endcap_Ring_Fw[i] = iBooker.book1D(HistoName,
0384                                             HistoName,
0385                                             psTTStub_ECRing.getParameter<int32_t>("Nbinsx"),
0386                                             psTTStub_ECRing.getParameter<double>("xmin"),
0387                                             psTTStub_ECRing.getParameter<double>("xmax"));
0388     Stub_Endcap_Ring_Fw[i]->setAxisTitle("Endcap Ring", 1);
0389     Stub_Endcap_Ring_Fw[i]->setAxisTitle("# L1 Stubs ", 2);
0390   }
0391 
0392   for (int i = 0; i < numDiscs; i++) {
0393     HistoName = "NStubs_Disc-" + std::to_string(i + 1);
0394     // TTStub Endcap stack
0395     Stub_Endcap_Ring_Bw[i] = iBooker.book1D(HistoName,
0396                                             HistoName,
0397                                             psTTStub_ECRing.getParameter<int32_t>("Nbinsx"),
0398                                             psTTStub_ECRing.getParameter<double>("xmin"),
0399                                             psTTStub_ECRing.getParameter<double>("xmax"));
0400     Stub_Endcap_Ring_Bw[i]->setAxisTitle("Endcap Ring", 1);
0401     Stub_Endcap_Ring_Bw[i]->setAxisTitle("# L1 Stubs ", 2);
0402   }
0403 
0404   // TTStub displ/offset
0405   edm::ParameterSet psTTStub_Barrel_2D = conf_.getParameter<edm::ParameterSet>("TH2TTStub_DisOf_Layer");
0406   edm::ParameterSet psTTStub_ECDisc_2D = conf_.getParameter<edm::ParameterSet>("TH2TTStub_DisOf_Disc");
0407   edm::ParameterSet psTTStub_ECRing_2D = conf_.getParameter<edm::ParameterSet>("TH2TTStub_DisOf_Ring");
0408 
0409   iBooker.setCurrentFolder(topFolderName_ + "/Stubs/Width");
0410   HistoName = "Stub_Width_Barrel";
0411   Stub_Barrel_W = iBooker.book2D(HistoName,
0412                                  HistoName,
0413                                  psTTStub_Barrel_2D.getParameter<int32_t>("Nbinsx"),
0414                                  psTTStub_Barrel_2D.getParameter<double>("xmin"),
0415                                  psTTStub_Barrel_2D.getParameter<double>("xmax"),
0416                                  psTTStub_Barrel_2D.getParameter<int32_t>("Nbinsy"),
0417                                  psTTStub_Barrel_2D.getParameter<double>("ymin"),
0418                                  psTTStub_Barrel_2D.getParameter<double>("ymax"));
0419   Stub_Barrel_W->setAxisTitle("Barrel Layer", 1);
0420   Stub_Barrel_W->setAxisTitle("Displacement - Offset", 2);
0421 
0422   HistoName = "Stub_Width_Endcap_Disc";
0423   Stub_Endcap_Disc_W = iBooker.book2D(HistoName,
0424                                       HistoName,
0425                                       psTTStub_ECDisc_2D.getParameter<int32_t>("Nbinsx"),
0426                                       psTTStub_ECDisc_2D.getParameter<double>("xmin"),
0427                                       psTTStub_ECDisc_2D.getParameter<double>("xmax"),
0428                                       psTTStub_ECDisc_2D.getParameter<int32_t>("Nbinsy"),
0429                                       psTTStub_ECDisc_2D.getParameter<double>("ymin"),
0430                                       psTTStub_ECDisc_2D.getParameter<double>("ymax"));
0431   Stub_Endcap_Disc_W->setAxisTitle("Endcap Disc", 1);
0432   Stub_Endcap_Disc_W->setAxisTitle("Displacement - Offset", 2);
0433 
0434   HistoName = "Stub_Width_Endcap_Ring";
0435   Stub_Endcap_Ring_W = iBooker.book2D(HistoName,
0436                                       HistoName,
0437                                       psTTStub_ECRing_2D.getParameter<int32_t>("Nbinsx"),
0438                                       psTTStub_ECRing_2D.getParameter<double>("xmin"),
0439                                       psTTStub_ECRing_2D.getParameter<double>("xmax"),
0440                                       psTTStub_ECRing_2D.getParameter<int32_t>("Nbinsy"),
0441                                       psTTStub_ECRing_2D.getParameter<double>("ymin"),
0442                                       psTTStub_ECRing_2D.getParameter<double>("ymax"));
0443   Stub_Endcap_Ring_W->setAxisTitle("Endcap Ring", 1);
0444   Stub_Endcap_Ring_W->setAxisTitle("Trigger Offset", 2);
0445 
0446   for (int i = 0; i < numDiscs; i++) {
0447     HistoName = "Stub_Width_Disc+" + std::to_string(i + 1);
0448     Stub_Endcap_Ring_W_Fw[i] = iBooker.book2D(HistoName,
0449                                               HistoName,
0450                                               psTTStub_ECRing_2D.getParameter<int32_t>("Nbinsx"),
0451                                               psTTStub_ECRing_2D.getParameter<double>("xmin"),
0452                                               psTTStub_ECRing_2D.getParameter<double>("xmax"),
0453                                               psTTStub_ECRing_2D.getParameter<int32_t>("Nbinsy"),
0454                                               psTTStub_ECRing_2D.getParameter<double>("ymin"),
0455                                               psTTStub_ECRing_2D.getParameter<double>("ymax"));
0456     Stub_Endcap_Ring_W_Fw[i]->setAxisTitle("Endcap Ring", 1);
0457     Stub_Endcap_Ring_W_Fw[i]->setAxisTitle("Displacement - Offset", 2);
0458   }
0459 
0460   for (int i = 0; i < numDiscs; i++) {
0461     HistoName = "Stub_Width_Disc-" + std::to_string(i + 1);
0462     Stub_Endcap_Ring_W_Bw[i] = iBooker.book2D(HistoName,
0463                                               HistoName,
0464                                               psTTStub_ECRing_2D.getParameter<int32_t>("Nbinsx"),
0465                                               psTTStub_ECRing_2D.getParameter<double>("xmin"),
0466                                               psTTStub_ECRing_2D.getParameter<double>("xmax"),
0467                                               psTTStub_ECRing_2D.getParameter<int32_t>("Nbinsy"),
0468                                               psTTStub_ECRing_2D.getParameter<double>("ymin"),
0469                                               psTTStub_ECRing_2D.getParameter<double>("ymax"));
0470     Stub_Endcap_Ring_W_Bw[i]->setAxisTitle("Endcap Ring", 1);
0471     Stub_Endcap_Ring_W_Bw[i]->setAxisTitle("Displacement - Offset", 2);
0472   }
0473 
0474   iBooker.setCurrentFolder(topFolderName_ + "/Stubs/Offset");
0475   HistoName = "Stub_Offset_Barrel";
0476   Stub_Barrel_O = iBooker.book2D(HistoName,
0477                                  HistoName,
0478                                  psTTStub_Barrel_2D.getParameter<int32_t>("Nbinsx"),
0479                                  psTTStub_Barrel_2D.getParameter<double>("xmin"),
0480                                  psTTStub_Barrel_2D.getParameter<double>("xmax"),
0481                                  psTTStub_Barrel_2D.getParameter<int32_t>("Nbinsy"),
0482                                  psTTStub_Barrel_2D.getParameter<double>("ymin"),
0483                                  psTTStub_Barrel_2D.getParameter<double>("ymax"));
0484   Stub_Barrel_O->setAxisTitle("Barrel Layer", 1);
0485   Stub_Barrel_O->setAxisTitle("Trigger Offset", 2);
0486 
0487   HistoName = "Stub_Offset_Endcap_Disc";
0488   Stub_Endcap_Disc_O = iBooker.book2D(HistoName,
0489                                       HistoName,
0490                                       psTTStub_ECDisc_2D.getParameter<int32_t>("Nbinsx"),
0491                                       psTTStub_ECDisc_2D.getParameter<double>("xmin"),
0492                                       psTTStub_ECDisc_2D.getParameter<double>("xmax"),
0493                                       psTTStub_ECDisc_2D.getParameter<int32_t>("Nbinsy"),
0494                                       psTTStub_ECDisc_2D.getParameter<double>("ymin"),
0495                                       psTTStub_ECDisc_2D.getParameter<double>("ymax"));
0496   Stub_Endcap_Disc_O->setAxisTitle("Endcap Disc", 1);
0497   Stub_Endcap_Disc_O->setAxisTitle("Trigger Offset", 2);
0498 
0499   HistoName = "Stub_Offset_Endcap_Ring";
0500   Stub_Endcap_Ring_O = iBooker.book2D(HistoName,
0501                                       HistoName,
0502                                       psTTStub_ECRing_2D.getParameter<int32_t>("Nbinsx"),
0503                                       psTTStub_ECRing_2D.getParameter<double>("xmin"),
0504                                       psTTStub_ECRing_2D.getParameter<double>("xmax"),
0505                                       psTTStub_ECRing_2D.getParameter<int32_t>("Nbinsy"),
0506                                       psTTStub_ECRing_2D.getParameter<double>("ymin"),
0507                                       psTTStub_ECRing_2D.getParameter<double>("ymax"));
0508   Stub_Endcap_Ring_O->setAxisTitle("Endcap Ring", 1);
0509   Stub_Endcap_Ring_O->setAxisTitle("Trigger Offset", 2);
0510 
0511   for (int i = 0; i < numDiscs; i++) {
0512     HistoName = "Stub_Offset_Disc+" + std::to_string(i + 1);
0513     Stub_Endcap_Ring_O_Fw[i] = iBooker.book2D(HistoName,
0514                                               HistoName,
0515                                               psTTStub_ECRing_2D.getParameter<int32_t>("Nbinsx"),
0516                                               psTTStub_ECRing_2D.getParameter<double>("xmin"),
0517                                               psTTStub_ECRing_2D.getParameter<double>("xmax"),
0518                                               psTTStub_ECRing_2D.getParameter<int32_t>("Nbinsy"),
0519                                               psTTStub_ECRing_2D.getParameter<double>("ymin"),
0520                                               psTTStub_ECRing_2D.getParameter<double>("ymax"));
0521     Stub_Endcap_Ring_O_Fw[i]->setAxisTitle("Endcap Ring", 1);
0522     Stub_Endcap_Ring_O_Fw[i]->setAxisTitle("Trigger Offset", 2);
0523   }
0524 
0525   for (int i = 0; i < numDiscs; i++) {
0526     HistoName = "Stub_Offset_Disc-" + std::to_string(i + 1);
0527     Stub_Endcap_Ring_O_Bw[i] = iBooker.book2D(HistoName,
0528                                               HistoName,
0529                                               psTTStub_ECRing_2D.getParameter<int32_t>("Nbinsx"),
0530                                               psTTStub_ECRing_2D.getParameter<double>("xmin"),
0531                                               psTTStub_ECRing_2D.getParameter<double>("xmax"),
0532                                               psTTStub_ECRing_2D.getParameter<int32_t>("Nbinsy"),
0533                                               psTTStub_ECRing_2D.getParameter<double>("ymin"),
0534                                               psTTStub_ECRing_2D.getParameter<double>("ymax"));
0535     Stub_Endcap_Ring_O_Bw[i]->setAxisTitle("Endcap Ring", 1);
0536     Stub_Endcap_Ring_O_Bw[i]->setAxisTitle("Trigger Offset", 2);
0537   }
0538 }
0539 void Phase2OTMonitorTTStub::fillDescriptions(edm::ConfigurationDescriptions &descriptions) {
0540   // Phase2OTMonitorTTStub
0541   edm::ParameterSetDescription desc;
0542   {
0543     edm::ParameterSetDescription psd0;
0544     psd0.add<int>("Nbinsx", 960);
0545     psd0.add<double>("xmax", 120);
0546     psd0.add<double>("xmin", -120);
0547     psd0.add<int>("Nbinsy", 960);
0548     psd0.add<double>("ymax", 120);
0549     psd0.add<double>("ymin", -120);
0550     desc.add<edm::ParameterSetDescription>("TH2TTStub_Position", psd0);
0551   }
0552   {
0553     edm::ParameterSetDescription psd0;
0554     psd0.add<int>("Nbinsx", 900);
0555     psd0.add<double>("xmax", 300);
0556     psd0.add<double>("xmin", -300);
0557     psd0.add<int>("Nbinsy", 900);
0558     psd0.add<double>("ymax", 120);
0559     psd0.add<double>("ymin", 0);
0560     desc.add<edm::ParameterSetDescription>("TH2TTStub_RZ", psd0);
0561   }
0562   {
0563     edm::ParameterSetDescription psd0;
0564     psd0.add<int>("Nbinsx", 45);
0565     psd0.add<double>("xmin", -5);
0566     psd0.add<double>("xmax", 5);
0567     desc.add<edm::ParameterSetDescription>("TH1TTStub_Eta", psd0);
0568   }
0569   {
0570     edm::ParameterSetDescription psd0;
0571     psd0.add<int>("Nbinsx", 60);
0572     psd0.add<double>("xmin", -3.5);
0573     psd0.add<double>("xmax", 3.5);
0574     desc.add<edm::ParameterSetDescription>("TH1TTStub_Phi", psd0);
0575   }
0576   {
0577     edm::ParameterSetDescription psd0;
0578     psd0.add<int>("Nbinsx", 45);
0579     psd0.add<double>("xmin", 0);
0580     psd0.add<double>("xmax", 120);
0581     desc.add<edm::ParameterSetDescription>("TH1TTStub_R", psd0);
0582   }
0583   {
0584     edm::ParameterSetDescription psd0;
0585     psd0.add<int>("Nbinsx", 69);
0586     psd0.add<double>("xmin", -8.625);
0587     psd0.add<double>("xmax", 8.625);
0588     desc.add<edm::ParameterSetDescription>("TH1TTStub_bend", psd0);
0589   }
0590   {
0591     edm::ParameterSetDescription psd0;
0592     psd0.add<int>("Nbinsx", 2);
0593     psd0.add<double>("xmin", 0.0);
0594     psd0.add<double>("xmax", 2.0);
0595     desc.add<edm::ParameterSetDescription>("TH1TTStub_isPS", psd0);
0596   }
0597   {
0598     edm::ParameterSetDescription psd0;
0599     psd0.add<int>("Nbinsx", 7);
0600     psd0.add<double>("xmin", 0.5);
0601     psd0.add<double>("xmax", 7.5);
0602     desc.add<edm::ParameterSetDescription>("TH1TTStub_Layers", psd0);
0603   }
0604   {
0605     edm::ParameterSetDescription psd0;
0606     psd0.add<int>("Nbinsx", 6);
0607     psd0.add<double>("xmin", 0.5);
0608     psd0.add<double>("xmax", 6.5);
0609     desc.add<edm::ParameterSetDescription>("TH1TTStub_Discs", psd0);
0610   }
0611   {
0612     edm::ParameterSetDescription psd0;
0613     psd0.add<int>("Nbinsx", 16);
0614     psd0.add<double>("xmin", 0.5);
0615     psd0.add<double>("xmax", 16.5);
0616     desc.add<edm::ParameterSetDescription>("TH1TTStub_Rings", psd0);
0617   }
0618   {
0619     edm::ParameterSetDescription psd0;
0620     psd0.add<int>("Nbinsx", 6);
0621     psd0.add<double>("xmax", 6.5);
0622     psd0.add<double>("xmin", 0.5);
0623     psd0.add<int>("Nbinsy", 43);
0624     psd0.add<double>("ymax", 10.75);
0625     psd0.add<double>("ymin", -10.75);
0626     desc.add<edm::ParameterSetDescription>("TH2TTStub_DisOf_Layer", psd0);
0627   }
0628   {
0629     edm::ParameterSetDescription psd0;
0630     psd0.add<int>("Nbinsx", 5);
0631     psd0.add<double>("xmax", 5.5);
0632     psd0.add<double>("xmin", 0.5);
0633     psd0.add<int>("Nbinsy", 43);
0634     psd0.add<double>("ymax", 10.75);
0635     psd0.add<double>("ymin", -10.75);
0636     desc.add<edm::ParameterSetDescription>("TH2TTStub_DisOf_Disc", psd0);
0637   }
0638   {
0639     edm::ParameterSetDescription psd0;
0640     psd0.add<int>("Nbinsx", 16);
0641     psd0.add<double>("xmax", 16.5);
0642     psd0.add<double>("xmin", 0.5);
0643     psd0.add<int>("Nbinsy", 43);
0644     psd0.add<double>("ymax", 10.75);
0645     psd0.add<double>("ymin", -10.75);
0646     desc.add<edm::ParameterSetDescription>("TH2TTStub_DisOf_Ring", psd0);
0647   }
0648   desc.add<std::string>("TopFolderName", "TrackerPhase2OTStub");
0649   desc.add<edm::InputTag>("TTStubs", edm::InputTag("TTStubsFromPhase2TrackerDigis", "StubAccepted"));
0650   descriptions.add("Phase2OTMonitorTTStub", desc);
0651   // or use the following to generate the label from the module's C++ type
0652   //descriptions.addWithDefaultLabel(desc);
0653 }
0654 
0655 DEFINE_FWK_MODULE(Phase2OTMonitorTTStub);