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>
47 template<TrackerType pixel_or_strip>
54 template<TrackerType pixel_or_strip>
58 auto id =
DetId(ModuleID);
59 switch (
id.subdetId()) {
67 layer = tTopo->
pxfDisk(
id) * ( tTopo->
pxfSide(ModuleID)==1 ? -1 : +1);
91 return std::make_pair(subdet, layer);
95 template<TrackerType pixel_or_strip>
108 double d_residual_xmin =
Parameters.getParameter<
double>(
"xmin");
109 double d_residual_xmax =
Parameters.getParameter<
double>(
"xmax");
111 int32_t i_normres_Nbins = Parameters.
getParameter<int32_t>(
"Nbinx");
112 double d_normres_xmin = Parameters.getParameter<
double>(
"xmin");
113 double d_normres_xmax = Parameters.getParameter<
double>(
"xmax");
127 auto ModuleID =
id.rawId();
128 auto isPixel =
id.subdetId() == 1 ||
id.subdetId() == 2;
133 switch (
id.subdetId()) {
134 case 1: pixel_organizer.setModuleFolder(ibooker, ModuleID, 0);
break;
135 case 2: pixel_organizer.setModuleFolder(ibooker, ModuleID, 0);
break;
140 std::string hid = hidmanager.createHistoId(
"HitResidualsX",
"det",ModuleID);
141 std::string normhid = hidmanager.createHistoId(
"NormalizedHitResidualsX",
"det",ModuleID);
143 histos.x.base = ibooker.
book1D(hid, hid, i_residuals_Nbins,d_residual_xmin,d_residual_xmax);
144 histos.x.base->setAxisTitle(
"(x_{pred} - x_{rec})' [cm]");
145 histos.x.normed = ibooker.
book1D(normhid, normhid, i_normres_Nbins,d_normres_xmin,d_normres_xmax);
146 histos.x.normed->setAxisTitle(
"(x_{pred} - x_{rec})'/#sigma");
148 std::string hid = hidmanager.createHistoId(
"HitResidualsY",
"det",ModuleID);
149 std::string normhid = hidmanager.createHistoId(
"NormalizedHitResidualsY",
"det",ModuleID);
151 histos.y.base = ibooker.
book1D(hid, hid, i_residuals_Nbins,d_residual_xmin,d_residual_xmax);
152 histos.y.base->setAxisTitle(
"(y_{pred} - y_{rec})' [cm]");
153 histos.y.normed = ibooker.
book1D(normhid, normhid, i_normres_Nbins,d_normres_xmin,d_normres_xmax);
154 histos.y.normed->setAxisTitle(
"(y_{pred} - y_{rec})'/#sigma");
162 switch (
id.subdetId()) {
168 default: strip_organizer.
setLayerFolder(ModuleID,tTopo,subdetandlayer.second);
171 auto isBarrel = subdetandlayer.first.find(
"B") != std::string::npos;
173 auto xy = std::vector<std::pair<HistoPair&, const char*> >
174 { std::make_pair(std::ref(
histos.x),
"X"),
175 std::make_pair(std::ref(
histos.y),
"Y") };
176 for (
auto& histopair :
xy) {
180 if (!
isPixel && histopair.second[0] ==
'Y')
continue;
183 Form(
"HitResiduals%s_%s%d",
185 isBarrel ?
"L" : (subdetandlayer.second > 0 ?
"Dp" :
"Dm"),
187 : (Form(
"HitResiduals_%s__%s__%d",
188 subdetandlayer.first.c_str(),
192 std::string histotitle = Form(
"HitResiduals %s on %s%s full %s %d",
194 subdetandlayer.first.c_str(),
195 isBarrel ?
"" : (subdetandlayer.second > 0 ?
"+" :
"-"),
200 std::string normhistoname = Form(
"Normalized%s", histoname.c_str());
201 std::string normhistotitle = Form(
"Normalized%s", histotitle.c_str());
205 histopair.first.base =
206 ibooker.
book1D(histoname.c_str(),histotitle.c_str(),
207 i_residuals_Nbins,d_residual_xmin,d_residual_xmax);
208 histopair.first.base->
setAxisTitle(
"(x_{pred} - x_{rec})' [cm]");
210 histopair.first.normed =
211 ibooker.
book1D(normhistoname.c_str(),normhistotitle.c_str(),
212 i_normres_Nbins,d_normres_xmin,d_normres_xmax);
213 histopair.first.normed->
setAxisTitle(
"(x_{pred} - x_{rec})'/#sigma");
219 template<TrackerType pixel_or_strip>
222 auto vtracks = std::vector<TrackerValidationVariables::AVTrackStruct>();
228 if (!vertices.
isValid() || vertices->size() == 0)
return;
239 return track.
pt() > 0.75
243 for (
auto& track : vtracks) {
244 for (
auto& it : track.hits) {
245 uint RawId = it.rawDetId;
247 auto id =
DetId(RawId);
248 auto isPixel =
id.subdetId() == 1 ||
id.subdetId() == 2;
254 mod_histos.x.base->Fill(it.resXprime);
255 mod_histos.x.normed->Fill(it.resXprime/it.resXprimeErr);
256 mod_histos.y.base->Fill(it.resYprime);
257 mod_histos.y.normed->Fill(it.resYprime/it.resYprimeErr);
263 if(it.resXprimeErr != 0 &&
histos.x.base) {
264 histos.x.base->Fill(it.resXprime);
265 histos.x.normed->Fill(it.resXprime/it.resXprimeErr);
268 if(it.resYprimeErr != 0 &&
histos.y.base) {
269 histos.y.base->Fill(it.resYprime);
270 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
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
void fillTrackQuantities(const edm::Event &, const edm::EventSetup &, std::vector< AVTrackStruct > &v_avtrackout)
void setCurrentFolder(const std::string &fullpath)
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
~MonitorTrackResidualsBase()
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...
virtual 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