Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:10:03

0001 void xPlotES(Int_t run) {
0002 
0003   gROOT->Reset();
0004 
0005   Char_t fname[200];
0006   sprintf(fname, "DQM_V0001_EcalPreshower_%06d.root", run);
0007 
0008   TFile *f = new TFile(fname);
0009 
0010   TCanvas *c1 = new TCanvas("c1", "c1", 500, 500); 
0011 
0012   Char_t hname[600];
0013   Char_t tname[600];
0014 
0015   // ES Occupancy
0016   c1->Clear();
0017   sprintf(hname, "DQMData/Run %06d/EcalPreshower/Run summary/ESOccupancyTask/ES RecHit 2D Occupancy Z 1 P 1", run);
0018   sprintf(tname, "ES Occupancy ES+F");
0019   draw2dOcc(f, hname, tname, c1);
0020   sprintf(hname, "ES_Occupancy_2D_ESpF_%06d.gif", run);
0021   c1->Print(hname);
0022 
0023   c1->Clear();
0024   sprintf(hname, "DQMData/Run %06d/EcalPreshower/Run summary/ESOccupancyTask/ES RecHit 2D Occupancy Z 1 P 2", run);
0025   sprintf(tname, "ES Occupancy ES+R");
0026   draw2dOcc(f, hname, tname, c1);
0027   sprintf(hname, "ES_Occupancy_2D_ESpR_%06d.gif", run);
0028   c1->Print(hname);
0029 
0030   c1->Clear();
0031   sprintf(hname, "DQMData/Run %06d/EcalPreshower/Run summary/ESOccupancyTask/ES RecHit 2D Occupancy Z -1 P 1", run);
0032   sprintf(tname, "ES Occupancy ES-F");
0033   draw2dOcc(f, hname, tname, c1);
0034   sprintf(hname, "ES_Occupancy_2D_ESmF_%06d.gif", run);
0035   c1->Print(hname);
0036 
0037   c1->Clear();
0038   sprintf(hname, "DQMData/Run %06d/EcalPreshower/Run summary/ESOccupancyTask/ES RecHit 2D Occupancy Z -1 P 2", run);
0039   sprintf(tname, "ES Occupancy ES-R");
0040   draw2dOcc(f, hname, tname, c1);
0041   sprintf(hname, "ES_Occupancy_2D_ESmR_%06d.gif", run);
0042   c1->Print(hname);
0043 
0044   // ES Energy Density
0045   c1->Clear();
0046   sprintf(hname, "DQMData/Run %06d/EcalPreshower/Run summary/ESOccupancyTask/ES Energy Density Z 1 P 1", run);
0047   sprintf(tname, "ES Energy Density ES+F");
0048   draw2dEn(f, hname, tname, c1);
0049   sprintf(hname, "ES_EnergyDensity_2D_ESpF_%06d.gif", run);
0050   c1->Print(hname);
0051 
0052   c1->Clear();
0053   sprintf(hname, "DQMData/Run %06d/EcalPreshower/Run summary/ESOccupancyTask/ES Energy Density Z 1 P 2", run);
0054   sprintf(tname, "ES Energy Density ES+R");
0055   draw2dEn(f, hname, tname, c1);
0056   sprintf(hname, "ES_EnergyDensity_2D_ESpR_%06d.gif", run);
0057   c1->Print(hname);
0058 
0059   c1->Clear();
0060   sprintf(hname, "DQMData/Run %06d/EcalPreshower/Run summary/ESOccupancyTask/ES Energy Density Z -1 P 1", run);
0061   sprintf(tname, "ES Energy Density ES-F");
0062   draw2dEn(f, hname, tname, c1);
0063   sprintf(hname, "ES_EnergyDensity_2D_ESmF_%06d.gif", run);
0064   c1->Print(hname);
0065 
0066   c1->Clear();
0067   sprintf(hname, "DQMData/Run %06d/EcalPreshower/Run summary/ESOccupancyTask/ES Energy Density Z -1 P 2", run);
0068   sprintf(tname, "ES Energy Density ES-R");
0069   draw2dEn(f, hname, tname, c1);
0070   sprintf(hname, "ES_EnergyDensity_2D_ESmR_%06d.gif", run);
0071   c1->Print(hname);
0072 
0073   // ES Occupancy with selected hits
0074   c1->Clear();
0075   sprintf(hname, "DQMData/Run %06d/EcalPreshower/Run summary/ESOccupancyTask/ES Occupancy with selected hits Z 1 P 1", run);
0076   sprintf(tname, "ES Occupancy with selected hits ES+F");
0077   draw2dOcc(f, hname, tname, c1);
0078   sprintf(hname, "ES_Occupancy_SelHits_2D_ESpF_%06d.gif", run);
0079   c1->Print(hname);
0080 
0081   c1->Clear();
0082   sprintf(hname, "DQMData/Run %06d/EcalPreshower/Run summary/ESOccupancyTask/ES Occupancy with selected hits Z 1 P 2", run);
0083   sprintf(tname, "ES Occupancy with selected hits ES+R");
0084   draw2dOcc(f, hname, tname, c1);
0085   sprintf(hname, "ES_Occupancy_SelHits_2D_ESpR_%06d.gif", run);
0086   c1->Print(hname);
0087 
0088   c1->Clear();
0089   sprintf(hname, "DQMData/Run %06d/EcalPreshower/Run summary/ESOccupancyTask/ES Occupancy with selected hits Z -1 P 1", run);
0090   sprintf(tname, "ES Occupancy with selected hits ES-F");
0091   draw2dOcc(f, hname, tname, c1);
0092   sprintf(hname, "ES_Occupancy_SelHits_2D_ESmF_%06d.gif", run);
0093   c1->Print(hname);
0094 
0095   c1->Clear();
0096   sprintf(hname, "DQMData/Run %06d/EcalPreshower/Run summary/ESOccupancyTask/ES Occupancy with selected hits Z -1 P 2", run);
0097   sprintf(tname, "ES Occupancy with selected hits ES-R");
0098   draw2dOcc(f, hname, tname, c1);
0099   sprintf(hname, "ES_Occupancy_SelHits_2D_ESmR_%06d.gif", run);
0100   c1->Print(hname);
0101 
0102   // ES Energy Density
0103   c1->Clear();
0104   sprintf(hname, "DQMData/Run %06d/EcalPreshower/Run summary/ESOccupancyTask/ES Energy Density with selected hits Z 1 P 1", run);
0105   sprintf(tname, "ES Energy Density with selected hits ES+F");
0106   draw2dEn(f, hname, tname, c1);
0107   sprintf(hname, "ES_EnergyDensity_SelHits_2D_ESpF_%06d.gif", run);
0108   c1->Print(hname);
0109 
0110   c1->Clear();
0111   sprintf(hname, "DQMData/Run %06d/EcalPreshower/Run summary/ESOccupancyTask/ES Energy Density with selected hits Z 1 P 2", run);
0112   sprintf(tname, "ES Energy Density with selected hits ES+R");
0113   draw2dEn(f, hname, tname, c1);
0114   sprintf(hname, "ES_EnergyDensity_SelHits_2D_ESpR_%06d.gif", run);
0115   c1->Print(hname);
0116 
0117   c1->Clear();
0118   sprintf(hname, "DQMData/Run %06d/EcalPreshower/Run summary/ESOccupancyTask/ES Energy Density with selected hits Z -1 P 1", run);
0119   sprintf(tname, "ES Energy Density with selected hits ES-F");
0120   draw2dEn(f, hname, tname, c1);
0121   sprintf(hname, "ES_EnergyDensity_SelHits_2D_ESmF_%06d.gif", run);
0122   c1->Print(hname);
0123 
0124   c1->Clear();
0125   sprintf(hname, "DQMData/Run %06d/EcalPreshower/Run summary/ESOccupancyTask/ES Energy Density with selected hits Z -1 P 2", run);
0126   sprintf(tname, "ES Energy Density with selected hits ES-R");
0127   draw2dEn(f, hname, tname, c1);
0128   sprintf(hname, "ES_EnergyDensity_SelHits_2D_ESmR_%06d.gif", run);
0129   c1->Print(hname);
0130 
0131   // ES Occupancy 1D
0132   c1->Clear();
0133   sprintf(hname, "DQMData/Run %06d/EcalPreshower/Run summary/ESOccupancyTask/ES Num of RecHits Z 1 P 1", run);
0134   sprintf(tname, "ES Number of rec hits ES+F");
0135   draw1d(f, hname, tname, c1, 4, 1, 1000);
0136   sprintf(hname, "ES_Occupancy_1D_ESpF_%06d.gif", run);
0137   c1->Print(hname);
0138 
0139   c1->Clear();
0140   sprintf(hname, "DQMData/Run %06d/EcalPreshower/Run summary/ESOccupancyTask/ES Num of RecHits Z 1 P 2", run);
0141   sprintf(tname, "ES Number of rec hits ES+R");
0142   draw1d(f, hname, tname, c1, 4, 1, 1000);
0143   sprintf(hname, "ES_Occupancy_1D_ESpR_%06d.gif", run);
0144   c1->Print(hname);
0145 
0146   c1->Clear();
0147   sprintf(hname, "DQMData/Run %06d/EcalPreshower/Run summary/ESOccupancyTask/ES Num of RecHits Z -1 P 1", run);
0148   sprintf(tname, "ES Number of rec hits ES-F");
0149   draw1d(f, hname, tname, c1, 4, 1, 1000);
0150   sprintf(hname, "ES_Occupancy_1D_ESmF_%06d.gif", run);
0151   c1->Print(hname);
0152 
0153   c1->Clear();
0154   sprintf(hname, "DQMData/Run %06d/EcalPreshower/Run summary/ESOccupancyTask/ES Num of RecHits Z -1 P 2", run);
0155   sprintf(tname, "ES Number of rec hits ES-R");
0156   draw1d(f, hname, tname, c1, 4, 1, 1000);
0157   sprintf(hname, "ES_Occupancy_1D_ESmR_%06d.gif", run);
0158   c1->Print(hname);
0159 
0160   // ES Occupancy 1D with selected hits
0161   c1->Clear();
0162   sprintf(hname, "DQMData/Run %06d/EcalPreshower/Run summary/ESOccupancyTask/ES Num of Good RecHits Z 1 P 1", run);
0163   sprintf(tname, "ES Number of good rec hits ES+F");
0164   draw1d(f, hname, tname, c1, 2, 1, 1000);
0165   sprintf(hname, "ES_Occupancy_SelHits_1D_ESpF_%06d.gif", run);
0166   c1->Print(hname);
0167 
0168   c1->Clear();
0169   sprintf(hname, "DQMData/Run %06d/EcalPreshower/Run summary/ESOccupancyTask/ES Num of Good RecHits Z 1 P 2", run);
0170   sprintf(tname, "ES Number of good rec hits ES+R");
0171   draw1d(f, hname, tname, c1, 2, 1, 1000);
0172   sprintf(hname, "ES_Occupancy_SelHits_1D_ESpR_%06d.gif", run);
0173   c1->Print(hname);
0174 
0175   c1->Clear();
0176   sprintf(hname, "DQMData/Run %06d/EcalPreshower/Run summary/ESOccupancyTask/ES Num of Good RecHits Z -1 P 1", run);
0177   sprintf(tname, "ES Number of good rec hits ES-F");
0178   draw1d(f, hname, tname, c1, 2, 1, 1000);
0179   sprintf(hname, "ES_Occupancy_SelHits_1D_ESmF_%06d.gif", run);
0180   c1->Print(hname);
0181 
0182   c1->Clear();
0183   sprintf(hname, "DQMData/Run %06d/EcalPreshower/Run summary/ESOccupancyTask/ES Num of Good RecHits Z -1 P 2", run);
0184   sprintf(tname, "ES Number of good rec hits ES-R");
0185   draw1d(f, hname, tname, c1, 2, 1, 1000);
0186   sprintf(hname, "ES_Occupancy_SelHits_1D_ESmR_%06d.gif", run);
0187   c1->Print(hname);
0188 
0189   // ES timing plots
0190   c1->Clear();
0191   sprintf(hname, "DQMData/Run %06d/EcalPreshower/Run summary/ESTimingTask/ES 2D Timing", run);
0192   draw2d(f, hname, c1);
0193   sprintf(hname, "ES_Timing_2D_%06d.gif", run);
0194   c1->Print(hname);
0195 
0196   c1->Clear();
0197   sprintf(hname, "DQMData/Run %06d/EcalPreshower/Run summary/ESTimingTask/ES Timing Z 1 P 1", run);
0198   sprintf(tname, "ES Timing ES+F");
0199   draw1dFitGaus(f, hname, tname, c1);
0200   sprintf(hname, "ES_Timing_ESpF_%06d.gif", run);
0201   c1->Print(hname);
0202 
0203   c1->Clear();
0204   sprintf(hname, "DQMData/Run %06d/EcalPreshower/Run summary/ESTimingTask/ES Timing Z 1 P 2", run);
0205   sprintf(tname, "ES Timing ES+R");
0206   draw1dFitGaus(f, hname, tname, c1);
0207   sprintf(hname, "ES_Timing_ESpR_%06d.gif", run);
0208   c1->Print(hname);
0209 
0210   c1->Clear();
0211   sprintf(hname, "DQMData/Run %06d/EcalPreshower/Run summary/ESTimingTask/ES Timing Z -1 P 1", run);
0212   sprintf(tname, "ES Timing ES-F");
0213   draw1dFitGaus(f, hname, tname, c1);
0214   sprintf(hname, "ES_Timing_ESmF_%06d.gif", run);
0215   c1->Print(hname);
0216 
0217   c1->Clear();
0218   sprintf(hname, "DQMData/Run %06d/EcalPreshower/Run summary/ESTimingTask/ES Timing Z -1 P 2", run);
0219   sprintf(tname, "ES Timing ES-R");
0220   draw1dFitGaus(f, hname, tname, c1);
0221   sprintf(hname, "ES_Timing_ESmR_%06d.gif", run);
0222   c1->Print(hname);
0223 }  
0224 
0225 void draw1dFitGaus(TFile *f, Char_t *hname, Char_t *tname, TCanvas *c) {
0226 
0227   TH1F *h1 = (TH1F*) f->Get(hname);
0228   TF1 *g = new TF1("g", "gaus");
0229   h1->Fit("g", "Q");
0230 
0231   //gStyle->SetOptStat(10);
0232   c->cd();
0233   gPad->SetLogy(0);
0234   h1->SetTitle(tname);
0235   h1->Draw();
0236 
0237   return;
0238 }
0239 
0240 void draw1d(TFile *f, Char_t *hname, Char_t *tname, TCanvas *c, Int_t color=1, Int_t log=0, Int_t Range=1000) {
0241 
0242   TH1F *h1 = (TH1F*) f->Get(hname);
0243 
0244   gStyle->SetOptStat(1110);
0245   c->cd();
0246   gPad->SetLogy(log);
0247   h1->SetTitle(tname);
0248   h1->SetLineColor(color);
0249   h1->GetXaxis()->SetLimits(0, Range);
0250   h1->Draw();
0251 
0252   return;
0253 }
0254 
0255 void draw2d(TFile *f, Char_t *hname, TCanvas *c) {
0256 
0257   TH2F *h2 = (TH2F*) f->Get(hname);
0258 
0259   gStyle->SetOptStat(10);
0260   c->cd();
0261   gPad->SetLogy(0);
0262   h2->Draw("colz");
0263 
0264   return;
0265 }
0266 
0267 void draw2dOcc(TFile *f, Char_t *hname, Char_t *tname, TCanvas *c) {
0268 
0269   TH2F *h2 = (TH2F*) f->Get(hname);
0270 
0271   float NEntries = (float) h2->GetBinContent(40,40);
0272   h2->SetBinContent(40,40,0.);
0273   h2->Scale(1/NEntries);
0274   h2->SetMaximum(32);
0275 
0276   gStyle->SetOptStat(0);
0277   c->cd();
0278   gPad->SetLogy(0);
0279   h2->SetTitle(tname);
0280   h2->Draw("colz");
0281 
0282   return;
0283 }
0284 
0285 void draw2dEn(TFile *f, Char_t *hname, Char_t *tname, TCanvas *c) {
0286 
0287   TH2F *h2 = (TH2F*) f->Get(hname);
0288 
0289   float NEntries = (float) h2->GetBinContent(40,40);
0290   h2->SetBinContent(40,40,0.);
0291   h2->Scale(1/NEntries);
0292 
0293   gStyle->SetOptStat(0);
0294   c->cd();
0295   gPad->SetLogy(0);
0296   h2->SetTitle(tname);
0297   h2->Draw("colz");
0298 
0299   return;
0300 }
0301