Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:34:25

0001 #include "Validation/RPCRecHits/interface/RPCValidHistograms.h"
0002 
0003 #include "TAxis.h"
0004 
0005 void RPCValidHistograms::bookHistograms(DQMStore::IBooker &booker, const std::string &subDir) {
0006   if (booked_) {
0007     edm::LogError("RPCValidHistograms") << "Histogram is already booked\n";
0008     return;
0009   }
0010 
0011   const std::string pwd = booker.pwd();
0012   booker.setCurrentFolder(subDir);
0013 
0014   // Book histograms
0015   booker.setCurrentFolder(subDir + "/HitProperty");
0016   clusterSize = booker.book1D("ClusterSize", "Cluster size;Cluster size", 11, -0.5, 10.5);
0017   clusterSizeBarrel = booker.book1D("ClusterSizeBarrel", "Cluster size in Barrel;Cluster size", 11, -0.5, 10.5);
0018   clusterSizeEndcap = booker.book1D("ClusterSizeEndcap", "Cluster size in Endcap;Cluster size", 11, -0.5, 10.5);
0019 
0020   avgClusterSize = booker.book1D("AverageClusterSize", "Average cluster size;Average clsuter size", 11, -0.5, 10.5);
0021   avgClusterSizeBarrel =
0022       booker.book1D("AverageClusterSizeBarrel", "Average cluster size in Barrel;Average clsuter size", 11, -0.5, 10.5);
0023   avgClusterSizeEndcap =
0024       booker.book1D("AverageClusterSizeEndcap", "Average cluster size in Endcap;Average clsuter size", 11, -0.5, 10.5);
0025 
0026   nRecHitBarrel =
0027       booker.book1D("NRecHitBarrel", "Number of RPC recHits per event in Barrel;Number of RPC hits", 25, 0, 25);
0028   nRecHitEndcap =
0029       booker.book1D("NRecHitEndcap", "Number of RPC recHits per event in Endcap;Number of RPC hits", 25, 0, 25);
0030 
0031   nRefHitBarrel =
0032       booker.book1D("NRefHitBarrel", "Number of reference hits per event in Barrel;Number of RPC hits", 25, 0, 25);
0033   nRefHitEndcap =
0034       booker.book1D("NRefHitEndcap", "Number of reference hits per event in Endcap;Number of RPC hits", 25, 0, 25);
0035 
0036   nMatchHitBarrel = booker.book1D(
0037       "nMatchBarrel", "Number of matched reference hits per event in Barrel;Number of RPC hits", 25, 0, 25);
0038   nMatchHitEndcap = booker.book1D(
0039       "nMatchEndcap", "Number of matched reference hits per event in Endcap;Number of RPC hits", 25, 0, 25);
0040 
0041   timeBarrel = booker.book1D("RecHitTimeBarrel", "RecHit time in Barrel;Time (ns)", 100, -12.5, 12.5);
0042   timeEndcap = booker.book1D("RecHitTimeEndcap", "RecHit time in Endcap;Time (ns)", 100, -12.5, 12.5);
0043   timeIRPC = booker.book1D("RecHitTimeIRPC", "RecHit time of iRPC;Time (ns)", 100, -12.5, 12.5);
0044   timeCRPC = booker.book1D("RecHitTimeCPRC", "RecHit time in current RPC;Time (ns)", 100, -12.5, 12.5);
0045 
0046   clusterSize->getTH1()->SetMinimum(0);
0047   clusterSizeBarrel->getTH1()->SetMinimum(0);
0048   clusterSizeEndcap->getTH1()->SetMinimum(0);
0049 
0050   avgClusterSize->getTH1()->SetMinimum(0);
0051   avgClusterSizeBarrel->getTH1()->SetMinimum(0);
0052   avgClusterSizeEndcap->getTH1()->SetMinimum(0);
0053 
0054   nRecHitBarrel->getTH1()->SetMinimum(0);
0055   nRecHitEndcap->getTH1()->SetMinimum(0);
0056 
0057   nRefHitBarrel->getTH1()->SetMinimum(0);
0058   nRefHitEndcap->getTH1()->SetMinimum(0);
0059 
0060   nMatchHitBarrel->getTH1()->SetMinimum(0);
0061   nMatchHitEndcap->getTH1()->SetMinimum(0);
0062 
0063   // Occupancy 1D
0064   booker.setCurrentFolder(subDir + "/Occupancy");
0065   refHitOccupancyBarrel_wheel = booker.book1D("RefHitOccupancyBarrel_wheel", "Reference Hit occupancy", 5, -2.5, 2.5);
0066   refHitOccupancyEndcap_disk = booker.book1D("RefHitOccupancyEndcap_disk", "Reference Hit occupancy", 9, -4.5, 4.5);
0067   refHitOccupancyBarrel_station =
0068       booker.book1D("RefHitOccupancyBarrel_station", "Reference Hit occupancy", 4, 0.5, 4.5);
0069 
0070   recHitOccupancyBarrel_wheel = booker.book1D("RecHitOccupancyBarrel_wheel", "RecHit occupancy", 5, -2.5, 2.5);
0071   recHitOccupancyEndcap_disk = booker.book1D("RecHitOccupancyEndcap_disk", "RecHit occupancy", 9, -4.5, 4.5);
0072   recHitOccupancyBarrel_station = booker.book1D("RecHitOccupancyBarrel_station", "RecHit occupancy", 4, 0.5, 4.5);
0073 
0074   matchOccupancyBarrel_wheel = booker.book1D("MatchOccupancyBarrel_wheel", "Matched hit occupancy", 5, -2.5, 2.5);
0075   matchOccupancyEndcap_disk = booker.book1D("MatchOccupancyEndcap_disk", "Matched hit occupancy", 9, -4.5, 4.5);
0076   matchOccupancyBarrel_station = booker.book1D("MatchOccupancyBarrel_station", "Matched hit occupancy", 4, 0.5, 4.5);
0077 
0078   refHitOccupancyBarrel_wheel->getTH1()->SetMinimum(0);
0079   refHitOccupancyEndcap_disk->getTH1()->SetMinimum(0);
0080   refHitOccupancyBarrel_station->getTH1()->SetMinimum(0);
0081 
0082   recHitOccupancyBarrel_wheel->getTH1()->SetMinimum(0);
0083   recHitOccupancyEndcap_disk->getTH1()->SetMinimum(0);
0084   recHitOccupancyBarrel_station->getTH1()->SetMinimum(0);
0085 
0086   matchOccupancyBarrel_wheel->getTH1()->SetMinimum(0);
0087   matchOccupancyEndcap_disk->getTH1()->SetMinimum(0);
0088   matchOccupancyBarrel_station->getTH1()->SetMinimum(0);
0089 
0090   // Occupancy 2D
0091   refHitOccupancyBarrel_wheel_station =
0092       booker.book2D("RefHitOccupancyBarrel_wheel_station", "Reference hit occupancy", 5, -2.5, 2.5, 4, 0.5, 4.5);
0093   refHitOccupancyEndcap_disk_ring =
0094       booker.book2D("RefHitOccupancyEndcap_disk_ring", "Reference hit occupancy", 9, -4.5, 4.5, 4, 0.5, 4.5);
0095 
0096   recHitOccupancyBarrel_wheel_station =
0097       booker.book2D("RecHitOccupancyBarrel_wheel_station", "RecHit occupancy", 5, -2.5, 2.5, 4, 0.5, 4.5);
0098   recHitOccupancyEndcap_disk_ring =
0099       booker.book2D("RecHitOccupancyEndcap_disk_ring", "RecHit occupancy", 9, -4.5, 4.5, 4, 0.5, 4.5);
0100 
0101   matchOccupancyBarrel_wheel_station =
0102       booker.book2D("MatchOccupancyBarrel_wheel_station", "Matched hit occupancy", 5, -2.5, 2.5, 4, 0.5, 4.5);
0103   matchOccupancyEndcap_disk_ring =
0104       booker.book2D("MatchOccupancyEndcap_disk_ring", "Matched hit occupancy", 9, -4.5, 4.5, 4, 0.5, 4.5);
0105 
0106   refHitOccupancyBarrel_wheel_station->getTH2F()->SetMinimum(0);
0107   refHitOccupancyEndcap_disk_ring->getTH2F()->SetMinimum(0);
0108 
0109   recHitOccupancyBarrel_wheel_station->getTH2F()->SetMinimum(0);
0110   recHitOccupancyEndcap_disk_ring->getTH2F()->SetMinimum(0);
0111 
0112   matchOccupancyBarrel_wheel_station->getTH2F()->SetMinimum(0);
0113   matchOccupancyEndcap_disk_ring->getTH2F()->SetMinimum(0);
0114 
0115   // Residuals
0116   booker.setCurrentFolder(subDir + "/Residual");
0117   resBarrel = booker.book1D("ResBarrel", "Global Residuals for Barrel;Residual [cm]", 100, -8, 8);
0118   resEndcap = booker.book1D("ResEndcap", "Global Residuals for Endcap;Residual [cm]", 100, -8, 8);
0119 
0120   resBarrel->getTH1()->SetMinimum(0);
0121   resEndcap->getTH1()->SetMinimum(0);
0122 
0123   res_wheel_res = booker.book2D("Res_wheel_res", "Residuals vs Wheel;;Residual [cm]", 5, -2.5, 2.5, 50, -8, 8);
0124   res_disk_res = booker.book2D("Res_disk_res", "Residuals vs Disk;;Residual [cm]", 9, -4.5, 4.5, 50, -8, 8);
0125   res_station_res = booker.book2D("Res_station_res", "Redisuals vs Station;;Residual [cm]", 4, 0.5, 4.5, 50, -8, 8);
0126   res_ring_res = booker.book2D("Res_ring_res", "Redisuals vs Ring;;Residual [cm]", 4, 0.5, 4.5, 50, -8, 8);
0127 
0128   res_wheel_res->getTH2F()->SetMinimum(0);
0129   res_disk_res->getTH2F()->SetMinimum(0);
0130   res_station_res->getTH2F()->SetMinimum(0);
0131   res_ring_res->getTH2F()->SetMinimum(0);
0132 
0133   // Pulls
0134   pullBarrel = booker.book1D("PullBarrel", "Global Pull for Barrel;Pull", 100, -3, 3);
0135   pullEndcap = booker.book1D("PullEndcap", "Global Pull for Endcap;Pull", 100, -3, 3);
0136 
0137   pullBarrel->getTH1()->SetMinimum(0);
0138   pullEndcap->getTH1()->SetMinimum(0);
0139 
0140   pull_wheel_pull = booker.book2D("Pull_wheel_pull", "Pull vs Wheel;;Pull", 5, -2.5, 2.5, 50, -3, 3);
0141   pull_disk_pull = booker.book2D("Pull_disk_pull", "Pull vs Disk;;Pull", 9, -4.5, 4.5, 50, -3, 3);
0142   pull_station_pull = booker.book2D("Pull_station_pull", "Pull vs Station;;Pull", 4, 0.5, 4.5, 50, -3, 3);
0143   pull_ring_pull = booker.book2D("Pull_ring_pull", "Pull vs Ring;;Pull", 4, 0.5, 4.5, 50, -3, 3);
0144 
0145   pull_wheel_pull->getTH2F()->SetMinimum(0);
0146   pull_disk_pull->getTH2F()->SetMinimum(0);
0147   pull_station_pull->getTH2F()->SetMinimum(0);
0148   pull_ring_pull->getTH2F()->SetMinimum(0);
0149 
0150   // Set plot options
0151   refHitOccupancyBarrel_wheel_station->getTH2F()->SetOption("COLZ");
0152   refHitOccupancyEndcap_disk_ring->getTH2F()->SetOption("COLZ");
0153   recHitOccupancyBarrel_wheel_station->getTH2F()->SetOption("COLZ");
0154   recHitOccupancyEndcap_disk_ring->getTH2F()->SetOption("COLZ");
0155   matchOccupancyBarrel_wheel_station->getTH2F()->SetOption("COLZ");
0156   matchOccupancyEndcap_disk_ring->getTH2F()->SetOption("COLZ");
0157 
0158   res_wheel_res->getTH2F()->SetOption("COLZ");
0159   res_disk_res->getTH2F()->SetOption("COLZ");
0160   res_station_res->getTH2F()->SetOption("COLZ");
0161   res_ring_res->getTH2F()->SetOption("COLZ");
0162 
0163   pull_wheel_pull->getTH2F()->SetOption("COLZ");
0164   pull_disk_pull->getTH2F()->SetOption("COLZ");
0165   pull_station_pull->getTH2F()->SetOption("COLZ");
0166   pull_ring_pull->getTH2F()->SetOption("COLZ");
0167 
0168   refHitOccupancyBarrel_wheel_station->getTH2F()->SetContour(10);
0169   refHitOccupancyEndcap_disk_ring->getTH2F()->SetContour(10);
0170   recHitOccupancyBarrel_wheel_station->getTH2F()->SetContour(10);
0171   recHitOccupancyEndcap_disk_ring->getTH2F()->SetContour(10);
0172   matchOccupancyBarrel_wheel_station->getTH2F()->SetContour(10);
0173   matchOccupancyEndcap_disk_ring->getTH2F()->SetContour(10);
0174 
0175   res_wheel_res->getTH2F()->SetContour(10);
0176   res_disk_res->getTH2F()->SetContour(10);
0177   res_station_res->getTH2F()->SetContour(10);
0178   res_ring_res->getTH2F()->SetContour(10);
0179 
0180   pull_wheel_pull->getTH2F()->SetContour(10);
0181   pull_disk_pull->getTH2F()->SetContour(10);
0182   pull_station_pull->getTH2F()->SetContour(10);
0183   pull_ring_pull->getTH2F()->SetContour(10);
0184 
0185   refHitOccupancyBarrel_wheel_station->getTH2F()->SetStats(false);
0186   refHitOccupancyEndcap_disk_ring->getTH2F()->SetStats(false);
0187   recHitOccupancyBarrel_wheel_station->getTH2F()->SetStats(false);
0188   recHitOccupancyEndcap_disk_ring->getTH2F()->SetStats(false);
0189   matchOccupancyBarrel_wheel_station->getTH2F()->SetStats(false);
0190   matchOccupancyEndcap_disk_ring->getTH2F()->SetStats(false);
0191 
0192   res_wheel_res->getTH2F()->SetStats(false);
0193   res_disk_res->getTH2F()->SetStats(false);
0194   res_station_res->getTH2F()->SetStats(false);
0195   res_ring_res->getTH2F()->SetStats(false);
0196 
0197   pull_wheel_pull->getTH2F()->SetStats(false);
0198   pull_disk_pull->getTH2F()->SetStats(false);
0199   pull_station_pull->getTH2F()->SetStats(false);
0200   pull_ring_pull->getTH2F()->SetStats(false);
0201 
0202   // Set bin labels
0203   for (int i = 1; i <= 5; ++i) {
0204     TString binLabel = Form("Wheel %d", i - 3);
0205 
0206     refHitOccupancyBarrel_wheel->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
0207     recHitOccupancyBarrel_wheel->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
0208     matchOccupancyBarrel_wheel->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
0209 
0210     refHitOccupancyBarrel_wheel_station->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
0211     recHitOccupancyBarrel_wheel_station->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
0212     matchOccupancyBarrel_wheel_station->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
0213 
0214     res_wheel_res->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
0215     pull_wheel_pull->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
0216   }
0217 
0218   for (int i = 1; i <= 9; ++i) {
0219     TString binLabel = Form("Disk %d", i - 5);
0220 
0221     refHitOccupancyEndcap_disk->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
0222     recHitOccupancyEndcap_disk->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
0223     matchOccupancyEndcap_disk->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
0224 
0225     refHitOccupancyEndcap_disk_ring->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
0226     recHitOccupancyEndcap_disk_ring->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
0227     matchOccupancyEndcap_disk_ring->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
0228 
0229     res_disk_res->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
0230     pull_disk_pull->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
0231   }
0232 
0233   for (int i = 1; i <= 4; ++i) {
0234     TString binLabel = Form("Station %d", i);
0235 
0236     refHitOccupancyBarrel_station->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
0237     recHitOccupancyBarrel_station->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
0238     matchOccupancyBarrel_station->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
0239 
0240     refHitOccupancyBarrel_wheel_station->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
0241     recHitOccupancyBarrel_wheel_station->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
0242     matchOccupancyBarrel_wheel_station->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
0243 
0244     res_station_res->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
0245     pull_station_pull->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
0246   }
0247 
0248   for (int i = 1; i <= 4; ++i) {
0249     TString binLabel = Form("Ring %d", i);
0250 
0251     refHitOccupancyEndcap_disk_ring->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
0252     recHitOccupancyEndcap_disk_ring->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
0253     matchOccupancyEndcap_disk_ring->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
0254   }
0255 
0256   booked_ = true;
0257 
0258   booker.setCurrentFolder(pwd);
0259 }