CMS 3D CMS Logo

Phase2OTValidateTTStub.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
9 //
10 // Original Author:
11 //
12 
13 // system include files
14 #include <memory>
15 #include <numeric>
16 #include <vector>
17 
18 // user include files
29 
35 
41 
44 
46 public:
47  explicit Phase2OTValidateTTStub(const edm::ParameterSet &);
48  ~Phase2OTValidateTTStub() override;
49  void analyze(const edm::Event &, const edm::EventSetup &) override;
50  void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
51  void dqmBeginRun(const edm::Run &iRun, const edm::EventSetup &iSetup) override;
52  static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
53  // TTStub stacks
54  // Global position of the stubs
55  MonitorElement *Stub_RZ = nullptr; // TTStub #rho vs. z
56 
57 private:
63  const TrackerGeometry *tkGeom_ = nullptr;
64  const TrackerTopology *tTopo_ = nullptr;
65 };
66 
67 // constructors and destructor
69  : conf_(iConfig),
71  topoToken_(esConsumes<TrackerTopology, TrackerTopologyRcd, edm::Transition::BeginRun>()) {
72  // now do what ever initialization is needed
73  topFolderName_ = conf_.getParameter<std::string>("TopFolderName");
75  consumes<edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_>>>(conf_.getParameter<edm::InputTag>("TTStubs"));
76 }
77 
79  // do anything here that needs to be done at desctruction time
80  // (e.g. close files, deallocate resources etc.)
81 }
82 
84  tkGeom_ = &(iSetup.getData(geomToken_));
85  tTopo_ = &(iSetup.getData(topoToken_));
86 }
87 // member functions
88 
89 // ------------ method called for each event ------------
93  iEvent.getByToken(tagTTStubsToken_, Phase2TrackerDigiTTStubHandle);
94 
96  typename edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_>>::const_iterator inputIter;
97  typename edmNew::DetSet<TTStub<Ref_Phase2TrackerDigi_>>::const_iterator contentIter;
98  // Adding protection
99  if (!Phase2TrackerDigiTTStubHandle.isValid())
100  return;
101 
102  for (inputIter = Phase2TrackerDigiTTStubHandle->begin(); inputIter != Phase2TrackerDigiTTStubHandle->end();
103  ++inputIter) {
104  for (contentIter = inputIter->begin(); contentIter != inputIter->end(); ++contentIter) {
107  edmNew::makeRefTo(Phase2TrackerDigiTTStubHandle, contentIter);
108 
110  // tempStubRef->getDetId() gives the stackDetId, not rawId
111  DetId detIdStub = tkGeom_->idToDet((tempStubRef->clusterRef(0))->getDetId())->geographicalId();
112 
114  //double rawBend = tempStubRef->rawBend();
115  //double bendOffset = tempStubRef->bendOffset();
116 
118  MeasurementPoint mp = (tempStubRef->clusterRef(0))->findAverageLocalCoordinates();
119  const GeomDet *theGeomDet = tkGeom_->idToDet(detIdStub);
120  Global3DPoint posStub = theGeomDet->surface().toGlobal(theGeomDet->topology().localPosition(mp));
121 
122  Stub_RZ->Fill(posStub.z(), posStub.perp());
123  }
124  }
125 } // end of method
126 
127 // ------------ method called when starting to processes a run ------------
129  edm::Run const &run,
130  edm::EventSetup const &es) {
133  edm::ParameterSet psTTStub_RZ = conf_.getParameter<edm::ParameterSet>("TH2TTStub_RZ");
134  HistoName = "Stub_RZ";
135  Stub_RZ = iBooker.book2D(HistoName,
136  HistoName,
137  psTTStub_RZ.getParameter<int32_t>("Nbinsx"),
138  psTTStub_RZ.getParameter<double>("xmin"),
139  psTTStub_RZ.getParameter<double>("xmax"),
140  psTTStub_RZ.getParameter<int32_t>("Nbinsy"),
141  psTTStub_RZ.getParameter<double>("ymin"),
142  psTTStub_RZ.getParameter<double>("ymax"));
143 }
144 
146  // Phase2OTValidateTTStub
148  {
150  psd0.add<int>("Nbinsx", 900);
151  psd0.add<double>("xmax", 300);
152  psd0.add<double>("xmin", -300);
153  psd0.add<int>("Nbinsy", 900);
154  psd0.add<double>("ymax", 120);
155  psd0.add<double>("ymin", 0);
156  desc.add<edm::ParameterSetDescription>("TH2TTStub_RZ", psd0);
157  }
158  desc.add<std::string>("TopFolderName", "TrackerPhase2OTStubV");
159  desc.add<edm::InputTag>("TTStubs", edm::InputTag("TTStubsFromPhase2TrackerDigis", "StubAccepted"));
160  descriptions.add("Phase2OTValidateTTStub", desc);
161  // or use the following to generate the label from the module's C++ type
162  //descriptions.addWithDefaultLabel(desc);
163 }
edm::Ref< typename HandleT::element_type, typename HandleT::element_type::value_type::value_type > makeRefTo(const HandleT &iHandle, typename HandleT::element_type::value_type::const_iterator itIter)
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
void analyze(const edm::Event &, const edm::EventSetup &) override
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
T perp() const
Definition: PV3DBase.h:69
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
Phase2OTValidateTTStub(const edm::ParameterSet &)
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
const TrackerTopology * tTopo_
T z() const
Definition: PV3DBase.h:61
virtual const Topology & topology() const
Definition: GeomDet.cc:67
const_iterator end(bool update=false) const
void Fill(long long x)
int iEvent
Definition: GenABIO.cc:224
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_
Transition
Definition: Transition.h:12
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Class to store the L1 Track Trigger stubs.
Definition: TTStub.h:22
const TrackerGeomDet * idToDet(DetId) const override
edm::EDGetTokenT< edmNew::DetSetVector< TTStub< Ref_Phase2TrackerDigi_ > > > tagTTStubsToken_
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
Definition: DetId.h:17
const_iterator begin(bool update=false) const
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:221
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::string HistoName
bool isValid() const
Definition: HandleBase.h:70
void dqmBeginRun(const edm::Run &iRun, const edm::EventSetup &iSetup) override
HLT enums.
const TrackerGeometry * tkGeom_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: Run.h:45