Back to home page

Project CMSSW displayed by LXR

 
 

    


Warning, /CondCore/EcalPlugins/plugins/EcalDrawUtils_class_example is written in an unsupported language. File is not indexed.

0001 #include "TH2F.h"
0002 #include "TCanvas.h"
0003 #include "TStyle.h"
0004 #include "TLine.h"
0005 #include "TLatex.h"
0006 
0007 #include <memory>
0008 
0009 class EcalDrawMaps {
0010 public:
0011   void DrawEB(TH2F* ebmap, float min, float max) {
0012     ebmap->SetXTitle("i#phi");
0013     ebmap->SetYTitle("i#eta");
0014     ebmap->GetXaxis()->SetNdivisions(-418,kFALSE);
0015     ebmap->GetYaxis()->SetNdivisions(-1702,kFALSE);
0016     ebmap->GetXaxis()->SetLabelSize(0.03);
0017     ebmap->GetYaxis()->SetLabelSize(0.03);
0018     ebmap->GetXaxis()->SetTickLength(0.01);
0019     ebmap->GetYaxis()->SetTickLength(0.01);
0020     ebmap->SetMaximum(max);
0021     ebmap->SetMinimum(min);
0022     ebmap->Draw("colz");
0023     TLine* l = new TLine;
0024     l->SetLineWidth(1);
0025     for(int i = 0; i <17; i++) {
0026       Double_t x = 20.+ (i *20);
0027       l = new TLine(x, -85., x, 85.);
0028       l->Draw();
0029     }
0030     l = new TLine(0., 85., 360., 85.);
0031     l->Draw();
0032     l = new TLine(0., 0., 360., 0.);
0033     l->Draw();
0034   }   //   DrawEB method
0035 
0036   void DrawEE(TH2F* endc, float min, float max) {
0037     int ixSectorsEE[202] = {
0038       62, 62, 61, 61, 60, 60, 59, 59, 58, 58, 56, 56, 46, 46, 44, 44, 43, 43, 42, 42, 
0039       41, 41, 40, 40, 41, 41, 42, 42, 43, 43, 44, 44, 46, 46, 56, 56, 58, 58, 59, 59, 
0040       60, 60, 61, 61, 62, 62,  0,101,101, 98, 98, 96, 96, 93, 93, 88, 88, 86, 86, 81, 
0041       81, 76, 76, 66, 66, 61, 61, 41, 41, 36, 36, 26, 26, 21, 21, 16, 16, 14, 14,  9,
0042        9,  6,  6,  4,  4,  1,  1,  4,  4,  6,  6,  9,  9, 14, 14, 16, 16, 21, 21, 26, 
0043       26, 36, 36, 41, 41, 61, 61, 66, 66, 76, 76, 81, 81, 86, 86, 88, 88, 93, 93, 96, 
0044       96, 98, 98,101,101,  0, 62, 66, 66, 71, 71, 81, 81, 91, 91, 93,  0, 62, 66, 66, 
0045       91, 91, 98,  0, 58, 61, 61, 66, 66, 71, 71, 76, 76, 81, 81,  0, 51, 51,  0, 44, 
0046       41, 41, 36, 36, 31, 31, 26, 26, 21, 21,  0, 40, 36, 36, 11, 11,  4,  0, 40, 36, 
0047       36, 31, 31, 21, 21, 11, 11,  9,  0, 46, 46, 41, 41, 36, 36,  0, 56, 56, 61, 61, 66, 66};
0048 
0049     int iySectorsEE[202] = {
0050       51, 56, 56, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 61, 61, 60, 60, 59, 59, 58, 
0051       58, 56, 56, 46, 46, 44, 44, 43, 43, 42, 42, 41, 41, 40, 40, 41, 41, 42, 42, 43, 
0052       43, 44, 44, 46, 46, 51,  0, 51, 61, 61, 66, 66, 76, 76, 81, 81, 86, 86, 88, 88, 
0053       93, 93, 96, 96, 98, 98,101,101, 98, 98, 96, 96, 93, 93, 88, 88, 86, 86, 81, 81, 
0054       76, 76, 66, 66, 61, 61, 41, 41, 36, 36, 26, 26, 21, 21, 16, 16, 14, 14,  9,  9, 
0055        6,  6,  4,  4,  1,  1,  4,  4,  6,  6,  9,  9, 14, 14, 16, 16, 21, 21, 26, 26, 
0056       36, 36, 41, 41, 51,  0, 46, 46, 41, 41, 36, 36, 31, 31, 26, 26,  0, 51, 51, 56, 
0057       56, 61, 61,  0, 61, 61, 66, 66, 71, 71, 76, 76, 86, 86, 88,  0, 62,101,  0, 61, 
0058       61, 66, 66, 71, 71, 76, 76, 86, 86, 88,  0, 51, 51, 56, 56, 61, 61,  0, 46, 46, 
0059       41, 41, 36, 36, 31, 31, 26, 26,  0, 40, 31, 31, 16, 16,  6,  0, 40, 31, 31, 16, 16,  6};
0060 
0061     TLine* l = new TLine;
0062     l->SetLineWidth(1);
0063 
0064     endc->SetMaximum(max);
0065     endc->SetMinimum(min);
0066     endc->Draw("colz1");
0067     for ( int i=0; i<201; i=i+1) {
0068       if ( (ixSectorsEE[i]!=0 || iySectorsEE[i]!=0) && 
0069            (ixSectorsEE[i+1]!=0 || iySectorsEE[i+1]!=0) ) {
0070         l->DrawLine(ixSectorsEE[i], iySectorsEE[i], 
0071                     ixSectorsEE[i+1], iySectorsEE[i+1]);
0072       }
0073     }
0074   }   //   DrawEE method
0075 };    // class EcalDrawMaps