19 template<TrackerType pixel_or_strip>
21 : conf_(iConfig), m_cacheID_(0)
23 , avalidator_(iConfig, consumesCollector()) {
28 template<TrackerType pixel_or_strip>
33 template<TrackerType pixel_or_strip>
46 tkhisto_ResidualsMean = std::make_unique<TkHistoMap>(tkDetMapHandle.
product(), ibooker , topFolderName_ ,
"TkHMap_ResidualsMean", 0.0,
true);
49 template<TrackerType pixel_or_strip>
56 template<TrackerType pixel_or_strip>
60 auto id =
DetId(ModuleID);
61 switch (
id.subdetId()) {
69 layer = tTopo->
pxfDisk(
id) * ( tTopo->
pxfSide(ModuleID)==1 ? -1 : +1);
93 return std::make_pair(subdet, layer);
97 template<TrackerType pixel_or_strip>
110 double d_residual_xmin =
Parameters.getParameter<
double>(
"xmin");
111 double d_residual_xmax =
Parameters.getParameter<
double>(
"xmax");
113 int32_t i_normres_Nbins = Parameters.
getParameter<int32_t>(
"Nbinx");
114 double d_normres_xmin = Parameters.getParameter<
double>(
"xmin");
115 double d_normres_xmax = Parameters.getParameter<
double>(
"xmax");
129 auto ModuleID =
id.rawId();
130 auto isPixel =
id.subdetId() == 1 ||
id.subdetId() == 2;
135 switch (
id.subdetId()) {
136 case 1: pixel_organizer.setModuleFolder(ibooker, ModuleID, 0);
break;
137 case 2: pixel_organizer.setModuleFolder(ibooker, ModuleID, 0);
break;
142 std::string hid = hidmanager.createHistoId(
"HitResidualsX",
"det",ModuleID);
143 std::string normhid = hidmanager.createHistoId(
"NormalizedHitResidualsX",
"det",ModuleID);
145 histos.x.base = ibooker.
book1D(hid, hid, i_residuals_Nbins,d_residual_xmin,d_residual_xmax);
146 histos.x.base->setAxisTitle(
"(x_{pred} - x_{rec})' [cm]");
147 histos.x.normed = ibooker.
book1D(normhid, normhid, i_normres_Nbins,d_normres_xmin,d_normres_xmax);
148 histos.x.normed->setAxisTitle(
"(x_{pred} - x_{rec})'/#sigma");
150 std::string hid = hidmanager.createHistoId(
"HitResidualsY",
"det",ModuleID);
151 std::string normhid = hidmanager.createHistoId(
"NormalizedHitResidualsY",
"det",ModuleID);
153 histos.y.base = ibooker.
book1D(hid, hid, i_residuals_Nbins,d_residual_xmin,d_residual_xmax);
154 histos.y.base->setAxisTitle(
"(y_{pred} - y_{rec})' [cm]");
155 histos.y.normed = ibooker.
book1D(normhid, normhid, i_normres_Nbins,d_normres_xmin,d_normres_xmax);
156 histos.y.normed->setAxisTitle(
"(y_{pred} - y_{rec})'/#sigma");
164 switch (
id.subdetId()) {
170 default: strip_organizer.
setLayerFolder(ModuleID,tTopo,subdetandlayer.second);
173 auto isBarrel = subdetandlayer.first.find(
"B") != std::string::npos;
175 auto xy = std::vector<std::pair<HistoPair&, const char*> >
176 { std::make_pair(std::ref(
histos.x),
"X"),
177 std::make_pair(std::ref(
histos.y),
"Y") };
178 for (
auto& histopair :
xy) {
182 if (!
isPixel && histopair.second[0] ==
'Y')
continue;
185 Form(
"HitResiduals%s_%s%d",
187 isBarrel ?
"L" : (subdetandlayer.second > 0 ?
"Dp" :
"Dm"),
189 : (Form(
"HitResiduals_%s__%s__%d",
190 subdetandlayer.first.c_str(),
194 std::string histotitle = Form(
"HitResiduals %s on %s%s full %s %d",
196 subdetandlayer.first.c_str(),
197 isBarrel ?
"" : (subdetandlayer.second > 0 ?
"+" :
"-"),
202 std::string normhistoname = Form(
"Normalized%s", histoname.c_str());
203 std::string normhistotitle = Form(
"Normalized%s", histotitle.c_str());
207 histopair.first.base =
208 ibooker.
book1D(histoname.c_str(),histotitle.c_str(),
209 i_residuals_Nbins,d_residual_xmin,d_residual_xmax);
210 histopair.first.base->
setAxisTitle(
"(x_{pred} - x_{rec})' [cm]");
212 histopair.first.normed =
213 ibooker.
book1D(normhistoname.c_str(),normhistotitle.c_str(),
214 i_normres_Nbins,d_normres_xmin,d_normres_xmax);
215 histopair.first.normed->
setAxisTitle(
"(x_{pred} - x_{rec})'/#sigma");
221 template<TrackerType pixel_or_strip>
224 auto vtracks = std::vector<TrackerValidationVariables::AVTrackStruct>();
230 if (!vertices.
isValid() || vertices->empty())
return;
241 return track.
pt() > 0.75
245 for (
auto& track : vtracks) {
246 for (
auto& it : track.hits) {
247 uint RawId = it.rawDetId;
249 auto id =
DetId(RawId);
250 auto isPixel =
id.subdetId() == 1 ||
id.subdetId() == 2;
256 mod_histos.x.base->Fill(it.resXprime);
257 mod_histos.x.normed->Fill(it.resXprime/it.resXprimeErr);
258 mod_histos.y.base->Fill(it.resYprime);
259 mod_histos.y.normed->Fill(it.resYprime/it.resYprimeErr);
265 if(it.resXprimeErr != 0 &&
histos.x.base) {
266 histos.x.base->Fill(it.resXprime);
267 histos.x.normed->Fill(it.resXprime/it.resXprimeErr);
270 if(it.resYprimeErr != 0 &&
histos.y.base) {
271 histos.y.base->Fill(it.resYprime);
272 histos.y.normed->Fill(it.resYprime/it.resYprimeErr);
T getParameter(std::string const &) const
void setSiStripFolderName(std::string name)
unsigned int tibLayer(const DetId &id) const
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
double dxyError() const
error on dxy
#define DEFINE_FWK_MODULE(type)
unsigned int pxfDisk(const DetId &id) const
TrackerValidationVariables avalidator_
unsigned int tidWheel(const DetId &id) const
void setLayerFolder(uint32_t rawdetid, const TrackerTopology *tTopo, int32_t layer=0, bool ring_flag=false)
Provides a code based selection for trigger and DCS information in order to have no failing filters i...
edm::EDGetTokenT< reco::VertexCollection > offlinePrimaryVerticesToken_
void setDetectorFolder(uint32_t rawdetid, const TrackerTopology *tTopo)
std::unique_ptr< TkHistoMap > tkhisto_ResidualsMean
unsigned int tidSide(const DetId &id) const
vector< ParameterSet > Parameters
void setCurrentFolder(std::string const &fullpath)
HistoSet m_ModuleResiduals
bool accept(const edm::Event &event, const edm::EventSetup &setup)
To be called from analyze/filter() methods.
HistoSet m_SubdetLayerResiduals
double pt() const
track transverse momentum
MonitorElement * book1D(Args &&...args)
const DetIdContainer & detIds() const override
Returm a vector of all GeomDet DetIds (including those of GeomDetUnits)
Abs< T >::type abs(const T &t)
MonitorTrackResidualsBase(const edm::ParameterSet &)
unsigned int pxbLayer(const DetId &id) const
~MonitorTrackResidualsBase() override
void fillTrackQuantities(const edm::Event &, const edm::EventSetup &, std::vector< AVTrackStruct > &v_avtrackout)
GenericTriggerEventFlag * genTriggerEventFlag_
void createMEs(DQMStore::IBooker &, const edm::EventSetup &)
bool isPixel(HitType hitType)
unsigned long long m_cacheID_
unsigned int pxfSide(const DetId &id) const
void initRun(const edm::Run &run, const edm::EventSetup &setup)
To be called from beginRun() methods.
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
void analyze(const edm::Event &, const edm::EventSetup &) override
std::pair< std::string, int32_t > findSubdetAndLayer(uint32_t ModuleID, const TrackerTopology *tTopo)
unsigned int tecWheel(const DetId &id) const
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
T const * product() const
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
unsigned int tobLayer(const DetId &id) const
unsigned int tecSide(const DetId &id) const