CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/Validation/RPCRecHits/src/RPCValidHistograms.cc

Go to the documentation of this file.
00001 #include "Validation/RPCRecHits/interface/RPCValidHistograms.h"
00002 
00003 #include "TAxis.h"
00004 
00005 void RPCValidHistograms::bookHistograms(DQMStore* dbe, const std::string subDir)
00006 {
00007   if ( !dbe ) 
00008   {
00009     edm::LogError("RPCValidHistograms") << "DBE not initialized\n";
00010     return;
00011   }
00012   if ( booked_ )
00013   {
00014     edm::LogError("RPCValidHistograms") << "Histogram is already booked\n";
00015     return;
00016   }
00017 
00018   const std::string pwd = dbe->pwd();
00019   dbe->setCurrentFolder(subDir);
00020 
00021   // Book histograms
00022   dbe->setCurrentFolder(subDir+"/HitProperty");
00023   clusterSize = dbe->book1D("ClusterSize", "Cluster size;Cluster size", 11, -0.5, 10.5);
00024   clusterSizeBarrel = dbe->book1D("ClusterSizeBarrel", "Cluster size in Barrel;Cluster size", 11, -0.5, 10.5);
00025   clusterSizeEndcap = dbe->book1D("ClusterSizeEndcap", "Cluster size in Endcap;Cluster size", 11, -0.5, 10.5);
00026 
00027   avgClusterSize = dbe->book1D("AverageClusterSize", "Average cluster size;Average clsuter size", 11, -0.5, 10.5);
00028   avgClusterSizeBarrel = dbe->book1D("AverageClusterSizeBarrel", "Average cluster size in Barrel;Average clsuter size", 11, -0.5, 10.5);
00029   avgClusterSizeEndcap = dbe->book1D("AverageClusterSizeEndcap", "Average cluster size in Endcap;Average clsuter size", 11, -0.5, 10.5);
00030 
00031   nRecHitBarrel = dbe->book1D("NRecHitBarrel", "Number of RPC recHits per event in Barrel;Number of RPC hits", 25, 0, 25);
00032   nRecHitEndcap = dbe->book1D("NRecHitEndcap", "Number of RPC recHits per event in Endcap;Number of RPC hits", 25, 0, 25);
00033 
00034   nRefHitBarrel = dbe->book1D("NRefHitBarrel", "Number of reference hits per event in Barrel;Number of RPC hits", 25, 0, 25);
00035   nRefHitEndcap = dbe->book1D("NRefHitEndcap", "Number of reference hits per event in Endcap;Number of RPC hits", 25, 0, 25);
00036 
00037   nMatchHitBarrel = dbe->book1D("nMatchBarrel", "Number of matched reference hits per event in Barrel;Number of RPC hits", 25, 0, 25);
00038   nMatchHitEndcap = dbe->book1D("nMatchEndcap", "Number of matched reference hits per event in Endcap;Number of RPC hits", 25, 0, 25);
00039 
00040   clusterSize->getTH1()->SetMinimum(0);
00041   clusterSizeBarrel->getTH1()->SetMinimum(0);
00042   clusterSizeEndcap->getTH1()->SetMinimum(0);
00043                       
00044   avgClusterSize->getTH1()->SetMinimum(0);
00045   avgClusterSizeBarrel->getTH1()->SetMinimum(0);
00046   avgClusterSizeEndcap->getTH1()->SetMinimum(0);
00047                       
00048   nRecHitBarrel->getTH1()->SetMinimum(0);
00049   nRecHitEndcap->getTH1()->SetMinimum(0);
00050                
00051   nRefHitBarrel->getTH1()->SetMinimum(0);
00052   nRefHitEndcap->getTH1()->SetMinimum(0);
00053                       
00054   nMatchHitBarrel->getTH1()->SetMinimum(0);
00055   nMatchHitEndcap->getTH1()->SetMinimum(0);
00056 
00057   // Occupancy 1D
00058   dbe->setCurrentFolder(subDir+"/Occupancy");
00059   refHitOccupancyBarrel_wheel   = dbe->book1D("RefHitOccupancyBarrel_wheel"  , "Reference Hit occupancy", 5, -2.5, 2.5);
00060   refHitOccupancyEndcap_disk    = dbe->book1D("RefHitOccupancyEndcap_disk"   , "Reference Hit occupancy", 9, -4.5, 4.5);
00061   refHitOccupancyBarrel_station = dbe->book1D("RefHitOccupancyBarrel_station", "Reference Hit occupancy", 4,  0.5, 4.5);
00062 
00063   recHitOccupancyBarrel_wheel   = dbe->book1D("RecHitOccupancyBarrel_wheel"  , "RecHit occupancy", 5, -2.5, 2.5);
00064   recHitOccupancyEndcap_disk    = dbe->book1D("RecHitOccupancyEndcap_disk"   , "RecHit occupancy", 9, -4.5, 4.5);
00065   recHitOccupancyBarrel_station = dbe->book1D("RecHitOccupancyBarrel_station", "RecHit occupancy", 4,  0.5, 4.5);
00066 
00067   matchOccupancyBarrel_wheel   = dbe->book1D("MatchOccupancyBarrel_wheel"  , "Matched hit occupancy", 5, -2.5, 2.5);
00068   matchOccupancyEndcap_disk    = dbe->book1D("MatchOccupancyEndcap_disk"   , "Matched hit occupancy", 9, -4.5, 4.5);
00069   matchOccupancyBarrel_station = dbe->book1D("MatchOccupancyBarrel_station", "Matched hit occupancy", 4,  0.5, 4.5);
00070 
00071   umOccupancyBarrel_wheel   = dbe->book1D("UmOccupancyBarrel_wheel"  , "Un-matched hit occupancy", 5, -2.5, 2.5);
00072   umOccupancyEndcap_disk    = dbe->book1D("UmOccupancyEndcap_disk"   , "Un-matched hit occupancy", 9, -4.5, 4.5);
00073   umOccupancyBarrel_station = dbe->book1D("UmOccupancyBarrel_station", "Un-matched hit occupancy", 4,  0.5, 4.5);
00074 
00075   refHitOccupancyBarrel_wheel  ->getTH1()->SetMinimum(0);
00076   refHitOccupancyEndcap_disk   ->getTH1()->SetMinimum(0);
00077   refHitOccupancyBarrel_station->getTH1()->SetMinimum(0);
00078                                
00079   recHitOccupancyBarrel_wheel  ->getTH1()->SetMinimum(0);
00080   recHitOccupancyEndcap_disk   ->getTH1()->SetMinimum(0);
00081   recHitOccupancyBarrel_station->getTH1()->SetMinimum(0);
00082                                
00083   matchOccupancyBarrel_wheel  ->getTH1()->SetMinimum(0);
00084   matchOccupancyEndcap_disk   ->getTH1()->SetMinimum(0);
00085   matchOccupancyBarrel_station->getTH1()->SetMinimum(0);
00086                                
00087   umOccupancyBarrel_wheel  ->getTH1()->SetMinimum(0);
00088   umOccupancyEndcap_disk   ->getTH1()->SetMinimum(0);
00089   umOccupancyBarrel_station->getTH1()->SetMinimum(0);
00090 
00091   // Occupancy 2D
00092   refHitOccupancyBarrel_wheel_station = dbe->book2D("RefHitOccupancyBarrel_wheel_station", "Reference hit occupancy", 5, -2.5, 2.5, 4, 0.5, 4.5);
00093   refHitOccupancyEndcap_disk_ring     = dbe->book2D("RefHitOccupancyEndcap_disk_ring"    , "Reference hit occupancy", 9, -4.5, 4.5, 4, 0.5, 4.5);
00094 
00095   recHitOccupancyBarrel_wheel_station = dbe->book2D("RecHitOccupancyBarrel_wheel_station", "RecHit occupancy", 5, -2.5, 2.5, 4, 0.5, 4.5);
00096   recHitOccupancyEndcap_disk_ring     = dbe->book2D("RecHitOccupancyEndcap_disk_ring"    , "RecHit occupancy", 9, -4.5, 4.5, 4, 0.5, 4.5);
00097 
00098   matchOccupancyBarrel_wheel_station = dbe->book2D("MatchOccupancyBarrel_wheel_station", "Matched hit occupancy", 5, -2.5, 2.5, 4, 0.5, 4.5);
00099   matchOccupancyEndcap_disk_ring     = dbe->book2D("MatchOccupancyEndcap_disk_ring"    , "Matched hit occupancy", 9, -4.5, 4.5, 4, 0.5, 4.5);
00100 
00101   umOccupancyBarrel_wheel_station = dbe->book2D("UmOccupancyBarrel_wheel_station", "Un-matched hit occupancy", 5, -2.5, 2.5, 4, 0.5, 4.5);
00102   umOccupancyEndcap_disk_ring     = dbe->book2D("UmOccupancyEndcap_disk_ring"    , "Un-matched hit occupancy", 9, -4.5, 4.5, 4, 0.5, 4.5);
00103 
00104   refHitOccupancyBarrel_wheel_station->getTH2F()->SetMinimum(0);
00105   refHitOccupancyEndcap_disk_ring    ->getTH2F()->SetMinimum(0);
00106 
00107   recHitOccupancyBarrel_wheel_station->getTH2F()->SetMinimum(0);
00108   recHitOccupancyEndcap_disk_ring    ->getTH2F()->SetMinimum(0);
00109 
00110   matchOccupancyBarrel_wheel_station->getTH2F()->SetMinimum(0);
00111   matchOccupancyEndcap_disk_ring    ->getTH2F()->SetMinimum(0);
00112 
00113   umOccupancyBarrel_wheel_station->getTH2F()->SetMinimum(0);
00114   umOccupancyEndcap_disk_ring    ->getTH2F()->SetMinimum(0);
00115 
00116   // Residuals
00117   dbe->setCurrentFolder(subDir+"/Residual");
00118   resBarrel = dbe->book1D("ResBarrel", "Global Residuals for Barrel;Residual [cm]"  , 100, -8, 8);
00119   resEndcap = dbe->book1D("ResEndcap", "Global Residuals for Endcap;Residual [cm]"   , 100, -8, 8);
00120 
00121   resBarrel->getTH1()->SetMinimum(0);
00122   resEndcap->getTH1()->SetMinimum(0);
00123 
00124   res_wheel_res   = dbe->book2D("Res_wheel_res"  , "Residuals vs Wheel;;Residual [cm]", 5, -2.5, 2.5, 50, -8, 8);
00125   res_disk_res    = dbe->book2D("Res_disk_res"   , "Residuals vs Disk;;Residual [cm]", 9, -4.5, 4.5, 50, -8, 8);
00126   res_station_res = dbe->book2D("Res_station_res", "Redisuals vs Station;;Residual [cm]", 4, 0.5, 4.5, 50, -8, 8);
00127   res_ring_res    = dbe->book2D("Res_ring_res"   , "Redisuals vs Ring;;Residual [cm]", 4, 0.5, 4.5, 50, -8, 8);
00128 
00129   res_wheel_res  ->getTH2F()->SetMinimum(0);
00130   res_disk_res   ->getTH2F()->SetMinimum(0);
00131   res_station_res->getTH2F()->SetMinimum(0);
00132   res_ring_res   ->getTH2F()->SetMinimum(0);
00133 
00134   // Pulls
00135   pullBarrel = dbe->book1D("PullBarrel", "Global Pull for Barrel;Pull", 100, -3, 3);
00136   pullEndcap = dbe->book1D("PullEndcap", "Global Pull for Endcap;Pull", 100, -3, 3);
00137 
00138   pullBarrel->getTH1()->SetMinimum(0);
00139   pullEndcap->getTH1()->SetMinimum(0);
00140 
00141   pull_wheel_pull   = dbe->book2D("Pull_wheel_pull"  , "Pull vs Wheel;;Pull"  , 5, -2.5, 2.5, 50, -3, 3);
00142   pull_disk_pull    = dbe->book2D("Pull_disk_pull"   , "Pull vs Disk;;Pull"   , 9, -4.5, 4.5, 50, -3, 3);
00143   pull_station_pull = dbe->book2D("Pull_station_pull", "Pull vs Station;;Pull", 4,  0.5, 4.5, 50, -3, 3);
00144   pull_ring_pull    = dbe->book2D("Pull_ring_pull"   , "Pull vs Ring;;Pull"   , 4,  0.5, 4.5, 50, -3, 3);
00145 
00146   pull_wheel_pull  ->getTH2F()->SetMinimum(0);
00147   pull_disk_pull   ->getTH2F()->SetMinimum(0);
00148   pull_station_pull->getTH2F()->SetMinimum(0);
00149   pull_ring_pull   ->getTH2F()->SetMinimum(0);
00150 
00151   // Set plot options
00152   refHitOccupancyBarrel_wheel_station->getTH2F()->SetOption("COLZ");
00153   refHitOccupancyEndcap_disk_ring    ->getTH2F()->SetOption("COLZ");
00154   recHitOccupancyBarrel_wheel_station->getTH2F()->SetOption("COLZ");
00155   recHitOccupancyEndcap_disk_ring    ->getTH2F()->SetOption("COLZ");
00156   matchOccupancyBarrel_wheel_station ->getTH2F()->SetOption("COLZ");
00157   matchOccupancyEndcap_disk_ring     ->getTH2F()->SetOption("COLZ");
00158   umOccupancyBarrel_wheel_station    ->getTH2F()->SetOption("COLZ");
00159   umOccupancyEndcap_disk_ring        ->getTH2F()->SetOption("COLZ");
00160 
00161   res_wheel_res  ->getTH2F()->SetOption("COLZ");
00162   res_disk_res   ->getTH2F()->SetOption("COLZ");
00163   res_station_res->getTH2F()->SetOption("COLZ");
00164   res_ring_res   ->getTH2F()->SetOption("COLZ");
00165 
00166   pull_wheel_pull  ->getTH2F()->SetOption("COLZ");
00167   pull_disk_pull   ->getTH2F()->SetOption("COLZ");
00168   pull_station_pull->getTH2F()->SetOption("COLZ");
00169   pull_ring_pull   ->getTH2F()->SetOption("COLZ");
00170 
00171   refHitOccupancyBarrel_wheel_station->getTH2F()->SetContour(10);
00172   refHitOccupancyEndcap_disk_ring    ->getTH2F()->SetContour(10);
00173   recHitOccupancyBarrel_wheel_station->getTH2F()->SetContour(10);
00174   recHitOccupancyEndcap_disk_ring    ->getTH2F()->SetContour(10);
00175   matchOccupancyBarrel_wheel_station ->getTH2F()->SetContour(10);
00176   matchOccupancyEndcap_disk_ring     ->getTH2F()->SetContour(10);
00177   umOccupancyBarrel_wheel_station    ->getTH2F()->SetContour(10);
00178   umOccupancyEndcap_disk_ring        ->getTH2F()->SetContour(10);
00179 
00180   res_wheel_res  ->getTH2F()->SetContour(10);
00181   res_disk_res   ->getTH2F()->SetContour(10);
00182   res_station_res->getTH2F()->SetContour(10);
00183   res_ring_res   ->getTH2F()->SetContour(10);
00184 
00185   pull_wheel_pull  ->getTH2F()->SetContour(10);
00186   pull_disk_pull   ->getTH2F()->SetContour(10);
00187   pull_station_pull->getTH2F()->SetContour(10);
00188   pull_ring_pull   ->getTH2F()->SetContour(10);
00189  
00190   refHitOccupancyBarrel_wheel_station->getTH2F()->SetStats(0);
00191   refHitOccupancyEndcap_disk_ring    ->getTH2F()->SetStats(0);
00192   recHitOccupancyBarrel_wheel_station->getTH2F()->SetStats(0);
00193   recHitOccupancyEndcap_disk_ring    ->getTH2F()->SetStats(0);
00194   matchOccupancyBarrel_wheel_station ->getTH2F()->SetStats(0);
00195   matchOccupancyEndcap_disk_ring     ->getTH2F()->SetStats(0);
00196   umOccupancyBarrel_wheel_station    ->getTH2F()->SetStats(0);
00197   umOccupancyEndcap_disk_ring        ->getTH2F()->SetStats(0);
00198 
00199   res_wheel_res  ->getTH2F()->SetStats(0);
00200   res_disk_res   ->getTH2F()->SetStats(0);
00201   res_station_res->getTH2F()->SetStats(0);
00202   res_ring_res   ->getTH2F()->SetStats(0);
00203 
00204   pull_wheel_pull  ->getTH2F()->SetStats(0);
00205   pull_disk_pull   ->getTH2F()->SetStats(0);
00206   pull_station_pull->getTH2F()->SetStats(0);
00207   pull_ring_pull   ->getTH2F()->SetStats(0);
00208  
00209   // Set bin labels
00210   for ( int i=1; i<=5; ++i )
00211   {
00212     TString binLabel = Form("Wheel %d", i-3);
00213 
00214     refHitOccupancyBarrel_wheel->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
00215     recHitOccupancyBarrel_wheel->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
00216     matchOccupancyBarrel_wheel ->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
00217     umOccupancyBarrel_wheel    ->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
00218 
00219     refHitOccupancyBarrel_wheel_station->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
00220     recHitOccupancyBarrel_wheel_station->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
00221     matchOccupancyBarrel_wheel_station ->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
00222     umOccupancyBarrel_wheel_station    ->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
00223 
00224     res_wheel_res  ->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
00225     pull_wheel_pull->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
00226   }
00227 
00228   for ( int i=1; i<=9; ++i )
00229   {
00230     TString binLabel = Form("Disk %d", i-5);
00231 
00232     refHitOccupancyEndcap_disk->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
00233     recHitOccupancyEndcap_disk->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
00234     matchOccupancyEndcap_disk ->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
00235     umOccupancyEndcap_disk    ->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
00236 
00237     refHitOccupancyEndcap_disk_ring->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
00238     recHitOccupancyEndcap_disk_ring->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
00239     matchOccupancyEndcap_disk_ring ->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
00240     umOccupancyEndcap_disk_ring    ->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
00241 
00242     res_disk_res  ->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
00243     pull_disk_pull->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
00244   }
00245 
00246   for ( int i=1; i<=4; ++i )
00247   {
00248     TString binLabel = Form("Station %d", i);
00249 
00250     refHitOccupancyBarrel_station->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
00251     recHitOccupancyBarrel_station->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
00252     matchOccupancyBarrel_station ->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
00253     umOccupancyBarrel_station    ->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
00254 
00255     refHitOccupancyBarrel_wheel_station->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
00256     recHitOccupancyBarrel_wheel_station->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
00257     matchOccupancyBarrel_wheel_station ->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
00258     umOccupancyBarrel_wheel_station    ->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
00259 
00260     res_station_res  ->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
00261     pull_station_pull->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
00262   }
00263 
00264   for ( int i=1; i<=4; ++i )
00265   {
00266     TString binLabel = Form("Ring %d", i);
00267 
00268     refHitOccupancyEndcap_disk_ring->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
00269     recHitOccupancyEndcap_disk_ring->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
00270     matchOccupancyEndcap_disk_ring ->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
00271     umOccupancyEndcap_disk_ring    ->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
00272   }
00273 
00274   dbe->setCurrentFolder(pwd);
00275   booked_ = true;
00276 }
00277