18 , conf_(iConfig), m_cacheID_(0)
20 , avalidator_(iConfig, consumesCollector()) {
50 auto id =
DetId(ModuleID);
51 switch (
id.subdetId()) {
59 layer = tTopo->
pxfDisk(
id) * ( tTopo->
pxfSide(ModuleID)==1 ? -1 : +1);
83 return std::make_pair(subdet, layer);
99 double d_residual_xmin =
Parameters.getParameter<
double>(
"xmin");
100 double d_residual_xmax =
Parameters.getParameter<
double>(
"xmax");
102 int32_t i_normres_Nbins = Parameters.
getParameter<int32_t>(
"Nbinx");
103 double d_normres_xmin = Parameters.getParameter<
double>(
"xmin");
104 double d_normres_xmax = Parameters.getParameter<
double>(
"xmax");
114 std::vector<uint32_t> activeDets;
115 auto ids = TG->detIds();
116 for (
DetId id : ids) {
117 activeDets.push_back(
id.rawId());
121 for(
auto ModuleID : activeDets)
123 auto id =
DetId(ModuleID);
128 switch (
id.subdetId()) {
129 case 1: pixel_organizer.setModuleFolder(ibooker, ModuleID, 0);
break;
130 case 2: pixel_organizer.setModuleFolder(ibooker, ModuleID, 0);
break;
135 std::string hid = hidmanager.createHistoId(
"HitResidualsX",
"det",ModuleID);
136 std::string normhid = hidmanager.createHistoId(
"NormalizedHitResidualsX",
"det",ModuleID);
138 histos.x.base = ibooker.
book1D(hid, hid, i_residuals_Nbins,d_residual_xmin,d_residual_xmax);
139 histos.x.base->setAxisTitle(
"(x_{pred} - x_{rec})' [cm]");
140 histos.x.normed = ibooker.
book1D(normhid, normhid, i_normres_Nbins,d_normres_xmin,d_normres_xmax);
141 histos.x.normed->setAxisTitle(
"(x_{pred} - x_{rec})'/#sigma");
143 std::string hid = hidmanager.createHistoId(
"HitResidualsY",
"det",ModuleID);
144 std::string normhid = hidmanager.createHistoId(
"NormalizedHitResidualsY",
"det",ModuleID);
146 histos.y.base = ibooker.
book1D(hid, hid, i_residuals_Nbins,d_residual_xmin,d_residual_xmax);
147 histos.y.base->setAxisTitle(
"(y_{pred} - y_{rec})' [cm]");
148 histos.y.normed = ibooker.
book1D(normhid, normhid, i_normres_Nbins,d_normres_xmin,d_normres_xmax);
149 histos.y.normed->setAxisTitle(
"(y_{pred} - y_{rec})'/#sigma");
157 switch (
id.subdetId()) {
159 case 1: pixel_organizer.setModuleFolder(ibooker, ModuleID, 2);
break;
160 case 2: pixel_organizer.setModuleFolder(ibooker, ModuleID, 6);
break;
162 default: strip_organizer.
setLayerFolder(ModuleID,tTopo,subdetandlayer.second);
165 auto xy = std::vector<std::pair<HistoPair&, const char*> >
166 { std::make_pair(std::ref(
histos.x),
"X"),
167 std::make_pair(std::ref(
histos.y),
"Y") };
168 for (
auto& histopair :
xy) {
170 auto isBarrel = subdetandlayer.first.find(
"B") != std::string::npos;
171 auto isPixel = subdetandlayer.first.find(
"X") != std::string::npos;
174 std::string histoname = Form(
"HitResiduals_%s__%s__%d%s",
175 subdetandlayer.first.c_str(),
178 histopair.second[0] ==
'X' ?
"" :
"_Y");
179 std::string histotitle = Form(
"HitResiduals %s on %s%s full %s %d",
181 subdetandlayer.first.c_str(),
182 isBarrel ?
"" : (subdetandlayer.second > 0 ?
"+" :
"-"),
187 std::string normhistoname = Form(
"Normalized%s", histoname.c_str());
188 std::string normhistotitle = Form(
"Normalized%s", histotitle.c_str());
192 histopair.first.base =
193 ibooker.
book1D(histoname.c_str(),histotitle.c_str(),
194 i_residuals_Nbins,d_residual_xmin,d_residual_xmax);
195 histopair.first.base->
setAxisTitle(
"(x_{pred} - x_{rec})' [cm]");
197 histopair.first.normed =
198 ibooker.
book1D(normhistoname.c_str(),normhistotitle.c_str(),
199 i_normres_Nbins,d_normres_xmin,d_normres_xmax);
200 histopair.first.normed->
setAxisTitle(
"(x_{pred} - x_{rec})'/#sigma");
216 if(outputMEsInRootFile){
232 std::vector<TrackerValidationVariables::AVHitStruct> v_hitstruct;
234 for (
auto it : v_hitstruct) {
235 uint RawId = it.rawDetId;
239 mod_histos.x.base->Fill(it.resXprime);
240 mod_histos.x.normed->Fill(it.resXprime/it.resXprimeErr);
241 mod_histos.y.base->Fill(it.resYprime);
242 mod_histos.y.normed->Fill(it.resYprime/it.resYprimeErr);
247 if(it.resXprimeErr != 0 &&
histos.x.base) {
248 histos.x.base->Fill(it.resXprime);
249 histos.x.normed->Fill(it.resXprime/it.resXprimeErr);
251 if(it.resYprimeErr != 0 &&
histos.y.base) {
252 histos.y.base->Fill(it.resYprime);
253 histos.y.normed->Fill(it.resYprime/it.resYprimeErr);
T getParameter(std::string const &) const
virtual void analyze(const edm::Event &, const edm::EventSetup &)
unsigned int tibLayer(const DetId &id) const
void dqmBeginRun(const edm::Run &, const edm::EventSetup &)
unsigned long long m_cacheID_
#define DEFINE_FWK_MODULE(type)
unsigned int pxfDisk(const DetId &id) const
std::pair< std::string, int32_t > findSubdetAndLayer(uint32_t ModuleID, const TrackerTopology *tTopo)
bool isBarrel(GeomDetEnumerators::SubDetector m)
unsigned int tidWheel(const DetId &id) const
void fillHitQuantities(const Trajectory *trajectory, std::vector< AVHitStruct > &v_avhitout)
Provides a code based selection for trigger and DCS information in order to have no failing filters i...
void createMEs(DQMStore::IBooker &, const edm::EventSetup &)
void setDetectorFolder(uint32_t rawdetid, const TrackerTopology *tTopo)
TrackerValidationVariables avalidator_
vector< ParameterSet > Parameters
bool accept(const edm::Event &event, const edm::EventSetup &setup)
To be called from analyze/filter() methods.
MonitorElement * book1D(Args &&...args)
Abs< T >::type abs(const T &t)
virtual void endRun(const edm::Run &, const edm::EventSetup &)
virtual void beginJob(void)
unsigned int pxbLayer(const DetId &id) const
HistoSet m_SubdetLayerResiduals
void setLayerFolder(uint32_t rawdetid, const TrackerTopology *tTopo, int32_t layer=0, bool ring_flag=0)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
HistoSet m_ModuleResiduals
T const * product() const
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, const uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE", const bool resetMEsAfterWriting=false)
GenericTriggerEventFlag * genTriggerEventFlag_
bool isPixel(HitType hitType)
MonitorTrackResiduals(const edm::ParameterSet &)
unsigned int pxfSide(const DetId &id) const
virtual void endJob(void)
void initRun(const edm::Run &run, const edm::EventSetup &setup)
To be called from beginRun() methods.
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)
unsigned int tobLayer(const DetId &id) const
unsigned int tecSide(const DetId &id) const