CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/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   clusterSize = dbe->book1D("ClusterSize", "Cluster size;Cluster size", 11, -0.5, 10.5);
00023 
00024   // Number of hits
00025   dbe->setCurrentFolder(subDir+"/Occupancy");
00026   nRefHit_W = dbe->book1D("NRefHit_Wheel", "Number of reference Hits;Wheel", 5, -2.5, 2.5);
00027   nRefHit_D = dbe->book1D("NRefHit_Disk", "Number of reference Hits;Disk", 7, -3.5, 3.5);
00028   nRecHit_W = dbe->book1D("NRecHit_Wheel", "Number of recHits;Wheel", 5, -2.5, 2.5);
00029   nRecHit_D = dbe->book1D("NRecHit_Disk", "Number of recHits;Disk", 7, -3.5, 3.5);
00030 
00031   nRefHit_WvsR = dbe->book2D("NRefHit_WvsR", "Number of reference Hits;Wheel;Station", 5, -2.5, 2.5, 4, 1, 5);
00032   nRecHit_WvsR = dbe->book2D("NRecHit_WvsR", "Number of recHits;Wheel;Station", 5, -2.5, 2.5, 4, 1, 5);
00033   nRefHit_DvsR = dbe->book2D("NRefHit_DvsR", "Number of reference Hits;Disk;Ring", 7, -3.5, 3.5, 4, 1, 5);
00034   nRecHit_DvsR = dbe->book2D("NRecHit_DvsR", "Number of recHits;Disk;Ring", 7, -3.5, 3.5, 4, 1, 5);
00035 
00036   nMatchedRefHit_W = dbe->book1D("NMatchedRefHit_Wheel", "Number of matched reference Hits;Wheel", 5, -2.5, 2.5);
00037   nMatchedRefHit_D = dbe->book1D("NMatchedRefHit_Disk", "Number of matched reference Hits;Disk", 7, -3.5, 3.5);
00038 
00039   nMatchedRefHit_WvsR = dbe->book2D("NMatchedRefHit_WvsR", "Number of matched reference Hits;Wheel;Station", 5, -2.5, 2.5, 4, 1, 5);
00040   nMatchedRefHit_DvsR = dbe->book2D("NMatchedRefHit_DvsR", "Number of matched reference Hits;Disk;Ring", 7, -3.5, 3.5, 4, 1, 5);
00041 
00042   nUnMatchedRefHit_W = dbe->book1D("NUnMatchedRefHit_Wheel", "Number of un-matched reference Hits;Wheel", 5, -2.5, 2.5);
00043   nUnMatchedRefHit_D = dbe->book1D("NUnMatchedRefHit_Disk", "Number of un-matched reference Hits;Disk", 7, -3.5, 3.5);
00044   nUnMatchedRecHit_W = dbe->book1D("NUnMatchedRecHit_Wheel", "Number of un-matched recHits;Wheel", 5, -2.5, 2.5);
00045   nUnMatchedRecHit_D = dbe->book1D("NUnMatchedRecHit_Disk", "Number of un-matched recHits;Disk", 7, -3.5, 3.5);
00046 
00047   nUnMatchedRefHit_WvsR = dbe->book2D("NUnMatchedRefHit_WvsR", "Number of un-matched reference Hits;Wheel;Station", 5, -2.5, 2.5, 4, 1, 5);
00048   nUnMatchedRecHit_WvsR = dbe->book2D("NUnMatchedRecHit_WvsR", "Number of un-matched recHits;Wheel;Station", 5, -2.5, 2.5, 4, 1, 5);
00049   nUnMatchedRefHit_DvsR = dbe->book2D("NUnMatchedRefHit_DvsR", "Number of un-matched reference Hits;Disk;Ring", 7, -3.5, 3.5, 4, 1, 5);
00050   nUnMatchedRecHit_DvsR = dbe->book2D("NUnMatchedRecHit_DvsR", "Number of un-matched recHits;Disk;Ring", 7, -3.5, 3.5, 4, 1, 5);
00051 
00052   // Residuals
00053   dbe->setCurrentFolder(subDir+"/Residual");
00054   res_W = dbe->book1D("Res_W", "Global Residuals for Wheel;Residual [cm]", 100, -8, 8);
00055   res_D = dbe->book1D("Res_D", "Global Residuals for Disk;Residual [cm]", 100, -8, 8);
00056 
00057   res2_W = dbe->book2D("Res2_W", "Residuals for Wheel;Wheel;Residual [cm]", 5, -2.5, 2.5, 50, -8, 8);
00058   res2_D = dbe->book2D("Res2_D", "Residuals for Disk;Disk;Residual [cm]", 7, -3.5, 3.5, 50, -8, 8);
00059 
00060   res2_WR = dbe->book2D("Res2_WR", "Redisuals for Wheel;Station;Residual [cm]", 4, 0, 4, 50, -8, 8);
00061   res2_DR = dbe->book2D("Res2_DR", "Redisuals for Disk;Ring;Residual [cm]", 4, 1, 5, 50, -8, 8);
00062 
00063   // Pulls
00064   pull_W = dbe->book1D("Pull_W", "Pull for Wheel;Pull", 100, -3, 3);
00065   pull_D = dbe->book1D("Pull_D", "Pull for Disk;Pull", 100, -3, 3);
00066 
00067   pull2_W = dbe->book2D("Pull2_W", "Pull for Wheel;Wheel;Pull", 5, -2.5, 2.5, 50, -3, 3);
00068   pull2_D = dbe->book2D("Pull2_D", "Pull for Disk;Disk;Pull", 7, -3.5, 3.5, 50, -3, 3);
00069 
00070   pull2_WR = dbe->book2D("Pull2_WR", "Pull for Wheel;Station;Pull", 4, 0, 4, 50, -3, 3);
00071   pull2_DR = dbe->book2D("Pull2_DR", "Pull for Disk;Ring;Pull", 4, 1, 5, 50, -3, 3);
00072 
00073   // Set bin labels
00074   for ( int i=1; i<=5; ++i )
00075   {
00076     TString binLabel = Form("Wheel %d", i-3);
00077 
00078     nRefHit_W->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
00079     nRecHit_W->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
00080     nRefHit_WvsR->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
00081     nRecHit_WvsR->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
00082     nMatchedRefHit_W->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
00083     nMatchedRefHit_WvsR->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
00084     nUnMatchedRefHit_W->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
00085     nUnMatchedRecHit_W->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
00086     nUnMatchedRefHit_WvsR->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
00087     nUnMatchedRecHit_WvsR->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
00088 
00089     res2_W->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
00090     pull2_W->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
00091   }
00092 
00093   for ( int i=1; i<=7; ++i )
00094   {
00095     TString binLabel = Form("Disk %d", i-4);
00096 
00097     nRefHit_D->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
00098     nRecHit_D->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
00099     nRefHit_DvsR->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
00100     nRecHit_DvsR->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
00101     nMatchedRefHit_D->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
00102     nMatchedRefHit_DvsR->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
00103     nUnMatchedRefHit_D->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
00104     nUnMatchedRecHit_D->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
00105     nUnMatchedRefHit_DvsR->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
00106     nUnMatchedRecHit_DvsR->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
00107 
00108     res2_D->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
00109     pull2_D->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
00110   }
00111 
00112   for ( int i=1; i<=4; ++i )
00113   {
00114     TString binLabel = Form("Station %d", i);
00115 
00116     nRefHit_WvsR->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
00117     nRecHit_WvsR->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
00118     nMatchedRefHit_WvsR->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
00119     nUnMatchedRefHit_WvsR->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
00120     nUnMatchedRecHit_WvsR->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
00121   }
00122 
00123   for ( int i=1; i<=4; ++i )
00124   {
00125     TString binLabel = Form("Ring %d", i);
00126 
00127     nRefHit_DvsR->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
00128     nRecHit_DvsR->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
00129     nMatchedRefHit_DvsR->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
00130     nUnMatchedRefHit_DvsR->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
00131     nUnMatchedRecHit_DvsR->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
00132   }
00133 
00134   dbe->setCurrentFolder(pwd);
00135   booked_ = true;
00136 }
00137