23 #include "TPaveStats.h" 30 SiStripDetVOff_LV():
cond::payloadInspector::TimeHistoryPlot<
SiStripDetVOff,
int >(
"Nr of mod with LV OFF vs time",
"nLVOff"){
41 SiStripDetVOff_HV() :
cond::payloadInspector::TimeHistoryPlot<
SiStripDetVOff,
int >(
"Nr of mod with HV OFF vs time",
"nHVOff"){
55 SiStripDetVOff_IsModuleVOff_TrackerMap() :
cond::payloadInspector::PlotImage<
SiStripDetVOff>(
"Tracker Map IsModuleVOff" ){
59 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override{
60 auto iov = iovs.front();
61 std::shared_ptr<SiStripDetVOff>
payload = fetchPayload( std::get<1>(iov) );
63 std::unique_ptr<TrackerMap> tmap = std::unique_ptr<TrackerMap>(
new TrackerMap(
"SiStripIsModuleVOff"));
65 std::string titleMap =
"TrackerMap of VOff modules (HV or LV), payload : "+std::get<1>(iov);
66 tmap->setTitle(titleMap);
68 std::vector<uint32_t> detid;
69 payload->getDetIds(detid);
71 for (
const auto &
d : detid) {
72 if(payload->IsModuleVOff(
d)){
89 SiStripDetVOff_IsModuleHVOff_TrackerMap() :
cond::payloadInspector::PlotImage<
SiStripDetVOff>(
"Tracker Map IsModuleHVOff" ){
93 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override{
94 auto iov = iovs.front();
95 std::shared_ptr<SiStripDetVOff> payload = fetchPayload( std::get<1>(iov) );
97 std::unique_ptr<TrackerMap> tmap = std::unique_ptr<TrackerMap>(
new TrackerMap(
"SiStripIsModuleHVOff"));
99 std::string titleMap =
"TrackerMap of HV Off modules, payload : "+std::get<1>(iov);
100 tmap->setTitle(titleMap);
102 std::vector<uint32_t> detid;
103 payload->getDetIds(detid);
105 for (
const auto &
d : detid) {
106 if(payload->IsModuleHVOff(
d)){
112 tmap->save(
true,0.99,1.01,
fileName);
123 SiStripDetVOff_IsModuleLVOff_TrackerMap() :
cond::payloadInspector::PlotImage<
SiStripDetVOff>(
"Tracker Map IsModuleLVOff" ){
124 setSingleIov(
true );
127 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override{
128 auto iov = iovs.front();
129 std::shared_ptr<SiStripDetVOff> payload = fetchPayload( std::get<1>(iov) );
131 std::unique_ptr<TrackerMap> tmap = std::unique_ptr<TrackerMap>(
new TrackerMap(
"SiStripIsModuleLVOff"));
133 std::string titleMap =
"TrackerMap of LV Off modules, payload : "+std::get<1>(iov);
134 tmap->setTitle(titleMap);
136 std::vector<uint32_t> detid;
137 payload->getDetIds(detid);
139 for (
const auto &
d : detid) {
140 if(payload->IsModuleLVOff(
d)){
146 tmap->save(
true,0.99,1.01,
fileName);
159 SiStripDetVOffTest() :
cond::payloadInspector::Histogram1D<
SiStripDetVOff>(
"SiStrip DetVOff test",
160 "SiStrip DetVOff test", 10,0.0,10.0),
163 Base::setSingleIov(
true );
166 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override{
167 for (
auto const & iov: iovs) {
168 std::shared_ptr<SiStripDetVOff> payload = Base::fetchPayload( std::get<1>(iov) );
171 std::vector<uint32_t> detid;
172 payload->getDetIds(detid);
177 for (
const auto &
d : detid) {
178 if(payload->IsModuleLVOff(
d)) summaryLV.
add(
d);
179 if(payload->IsModuleHVOff(
d)) summaryHV.add(
d);
181 std::map<unsigned int, SiStripDetSummary::Values> mapHV = summaryHV.getCounts();
182 std::map<unsigned int, SiStripDetSummary::Values> mapLV = summaryLV.getCounts();
187 std::stringstream ss;
188 ss <<
"Summary of HV off detectors:" << std::endl;
189 summaryHV.print(ss,
true);
191 ss <<
"Summary of LV off detectors:" << std::endl;
192 summaryLV.print(ss,
true);
211 SiStripDetVOffByRegion() :
cond::payloadInspector::PlotImage<
SiStripDetVOff>(
"SiStrip DetVOff By Region" ),
214 setSingleIov(
true );
217 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override{
218 auto iov = iovs.front();
219 std::shared_ptr<SiStripDetVOff> payload = fetchPayload( std::get<1>(iov) );
221 std::vector<uint32_t> detid;
222 payload->getDetIds(detid);
227 for (
const auto &
d : detid) {
228 if(payload->IsModuleLVOff(
d)) summaryLV.
add(
d);
229 if(payload->IsModuleHVOff(
d)) summaryHV.add(
d);
231 std::map<unsigned int, SiStripDetSummary::Values> mapHV = summaryHV.getCounts();
232 std::map<unsigned int, SiStripDetSummary::Values> mapLV = summaryLV.getCounts();
233 std::vector<unsigned int>
keys;
236 std::back_inserter(keys),
241 TCanvas
canvas(
"DetVOff Partion summary",
"SiStripDetVOff region summary",1200,1000);
243 auto h_HV = std::unique_ptr<TH1F>(
new TH1F(
"HVbyRegion",
"SiStrip HV/LV summary by region;; modules with HV off",mapHV.size(),0.,mapHV.size()));
244 auto h_LV = std::unique_ptr<TH1F>(
new TH1F(
"LVbyRegion",
"SiStrip HV/LV summary by region;; modules with LV off",mapLV.size(),0.,mapLV.size()));
246 h_HV->SetStats(
false);
247 h_LV->SetStats(
false);
249 canvas.SetBottomMargin(0.18);
250 canvas.SetLeftMargin(0.10);
251 canvas.SetRightMargin(0.10);
254 std::vector<int> boundaries;
260 for (
const auto &
index : keys){
262 int countHV = mapHV[
index].count;
263 int countLV = mapLV[
index].count;
265 if(currentDetector.empty()) currentDetector=
"TIB";
267 switch ((
index)/1000)
283 h_HV->SetBinContent(iBin,countHV);
285 h_HV->GetXaxis()->LabelsOption(
"v");
287 h_LV->SetBinContent(iBin,countLV);
289 h_LV->GetXaxis()->LabelsOption(
"v");
291 if(detector!=currentDetector) {
292 boundaries.push_back(iBin);
298 h_HV->GetYaxis()->SetRangeUser(extrema.first,extrema.second);
299 h_LV->GetYaxis()->SetRangeUser(extrema.first,extrema.second);
301 h_HV->SetMarkerStyle(20);
302 h_HV->SetMarkerSize(1);
303 h_HV->SetLineColor(kRed);
304 h_HV->SetMarkerColor(kRed);
306 h_HV->Draw(
"TEXT45same");
308 h_LV->SetMarkerStyle(21);
309 h_LV->SetMarkerSize(1);
310 h_LV->SetLineColor(kBlue);
311 h_LV->SetLineStyle(9);
312 h_LV->SetMarkerColor(kBlue);
313 h_LV->Draw(
"HISTsame");
314 h_LV->Draw(
"TEXT45same");
319 TLine
l[boundaries.size()];
321 for (
const auto &
line : boundaries){
322 l[
i] = TLine(h_HV->GetBinLowEdge(
line),
canvas.cd()->GetUymin(),h_HV->GetBinLowEdge(
line),
canvas.cd()->GetUymax());
323 l[
i].SetLineWidth(1);
324 l[
i].SetLineStyle(9);
325 l[
i].SetLineColor(2);
330 TLegend
legend = TLegend(0.45,0.80,0.90,0.9);
331 legend.SetHeader((std::get<1>(iov)).c_str(),
"C");
332 legend.AddEntry(h_HV.get(),(
"HV channels: "+std::to_string(payload->getHVoffCounts())).c_str(),
"PL");
333 legend.AddEntry(h_LV.get(),(
"LV channels: "+std::to_string(payload->getLVoffCounts())).c_str(),
"PL");
334 legend.SetTextSize(0.025);
338 h_HV.get()->GetYaxis()->SetLabelOffset(999);
339 h_HV.get()->GetYaxis()->SetTickLength(0);
340 h_HV.get()->GetYaxis()->SetTitleOffset(999);
342 h_LV.get()->GetYaxis()->SetLabelOffset(999);
343 h_LV.get()->GetYaxis()->SetTickLength(0);
344 h_LV.get()->GetYaxis()->SetTitleOffset(999);
347 auto l_axis = std::unique_ptr<TGaxis>(
new TGaxis(gPad->GetUxmin(),gPad->GetUymin(),gPad->GetUxmin(),gPad->GetUymax(),0,extrema.second,510));
348 l_axis->SetLineColor(kRed);
349 l_axis->SetTextColor(kRed);
350 l_axis->SetLabelColor(kRed);
351 l_axis->SetTitleOffset(1.2);
352 l_axis->SetTitleColor(kRed);
353 l_axis->SetTitle(h_HV.get()->GetYaxis()->GetTitle());
357 auto r_axis = std::unique_ptr<TGaxis>(
new TGaxis(gPad->GetUxmax(),gPad->GetUymin(),gPad->GetUxmax(),gPad->GetUymax(),0,extrema.second,510,
"+L"));
358 r_axis->SetLineColor(kBlue);
359 r_axis->SetTextColor(kBlue);
360 r_axis->SetLabelColor(kBlue);
361 r_axis->SetTitleColor(kBlue);
362 r_axis->SetTitleOffset(1.2);
363 r_axis->SetTitle(h_LV.get()->GetYaxis()->GetTitle());
int getLVoffCounts() const
Returns the total number of modules with LV off.
U second(std::pair< T, U > const &p)
#define PAYLOAD_INSPECTOR_CLASS(CLASS_NAME)
Container::value_type value_type
virtual Y getFromPayload(PayloadType &payload)=0
std::pair< float, float > getExtrema(TH1 *h1, TH1 *h2)
void add(DetId detid, float value)
Used to compute the mean value of the value variable divided by subdetector, layer and mono/stereo...
int getHVoffCounts() const
Returns the total number of modules with HV off.
#define PAYLOAD_INSPECTOR_MODULE(PAYLOAD_TYPENAME)
std::pair< int, const char * > regionType(int index)
TrackerTopology fromTrackerParametersXMLFile(const std::string &xmlFileName)