Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:29:34

0001 #include "root_prefs.h"
0002 
0003 void initStyle( TStyle * sty )
0004 {
0005   sty->SetCanvasBorderMode(0);
0006   sty->SetOptStat(1110);
0007   sty->SetStatW(0.22);
0008   sty->SetStatH(0.17);
0009   sty->SetStatX(0.993);
0010   sty->SetStatY(0.993);
0011   sty->SetStatFormat("6.4g");
0012   sty->SetOptStat("emuo");
0013   sty->SetStatColor(0);
0014   sty->SetTitleBorderSize(1);
0015   sty->SetTitleOffset(1, "Y");
0016   sty->SetTitleOffset(0.8, "X");
0017   sty->SetTitleSize(0.05, "XY");
0018   sty->SetNdivisions(507, "XY");
0019   sty->SetPadBorderMode(0);
0020   sty->SetPadBottomMargin(0.13);
0021   sty->SetPadLeftMargin(0.1);
0022   sty->SetPadRightMargin(0.18);
0023   sty->SetPadTopMargin(0.1);
0024   sty->SetFrameBorderMode(0);
0025   sty->SetPadTickX(1);
0026   sty->SetPadTickY(1);
0027   sty->SetOptLogy(0);
0028   sty->SetPadColor(0);
0029   sty->SetTitleFillColor(0);
0030   sty->SetFrameBorderSize(0);
0031   sty->SetPadBorderSize(0);
0032   sty->SetCanvasBorderMode(0);
0033   sty->SetPadTickX(1);
0034   sty->SetPadTickY(1);
0035   sty->SetOptLogy(0);
0036   sty->SetPadColor(0);
0037   sty->SetTitleFillColor(0);
0038   sty->SetFrameBorderSize(0);
0039   sty->SetPadBorderSize(0);
0040   sty->SetCanvasBorderMode(0);
0041   sty->SetCanvasColor(0);
0042   sty->SetCanvasDefW(616);
0043   sty->SetCanvasDefH(820);
0044   sty->SetPalette(1);
0045 }
0046 
0047 void SetupTowerDisplay(TH2F *hist)
0048 {
0049   hist->SetStats(kFALSE);
0050   hist->SetXTitle("ieta");
0051   hist->SetYTitle("iphi");
0052   hist->GetXaxis()->CenterTitle();
0053   hist->GetYaxis()->CenterTitle();
0054   hist->GetXaxis()->SetNdivisions(65);
0055   hist->GetXaxis()->SetLabelColor(0);
0056   hist->GetXaxis()->SetTickLength(.78);
0057   hist->GetXaxis()->SetTitleOffset(0.95);
0058   hist->GetYaxis()->SetNdivisions(72);
0059   hist->GetYaxis()->SetLabelColor(0);
0060   hist->GetYaxis()->SetTitleOffset(0.85);
0061   TText *yLabel = new TText();
0062   TLine *pLine = new TLine();
0063   pLine->SetLineStyle(1);
0064   pLine->SetLineColor(1);
0065   pLine->SetLineWidth(1);
0066   yLabel->SetTextAlign(22);
0067   yLabel->SetTextSize(0.015);
0068   char phi_num[3];
0069   char eta_num[3];
0070   TText *xLabel = new TText();
0071   xLabel->SetTextSize(0.015);
0072   xLabel->SetTextAlign(22);
0073   for (Int_t i=1; i<73; ++i)
0074     {
0075       sprintf(phi_num,"%d",i);
0076       if(TMath::Abs(i%2)==1) {yLabel->DrawText(-33,0.5+i,phi_num);}
0077       else {yLabel->DrawText(-34.5,0.5+i,phi_num);}
0078       pLine->DrawLine(-32,i,33,i);
0079     }
0080   for (Int_t i=-32; i<33;++i)
0081     {
0082       sprintf(eta_num,"%d",i);
0083       if(TMath::Abs(i%2)==0) {xLabel->DrawText(0.5+i,-0.5,eta_num);}
0084       else {xLabel->DrawText(0.5+i,-2,eta_num);}
0085       pLine->DrawLine(i,1,i,72);
0086     }
0087 }
0088 
0089 void SetStatus(TH1F* hist, string status)
0090 {
0091   hist->SetFillStyle(1001);
0092   cout << "Status = " << status;
0093   if (status=="GOOD")
0094     {
0095       hist->SetFillColor(kGreen);
0096       cout << "\nshould be green\n";
0097     }
0098   else if (status=="BAD")
0099     {
0100       hist->SetFillColor(kRed);
0101       cout << "\nshould be red\n";
0102     }
0103   else if (status=="UNCHECKED")
0104     {
0105       hist->SetFillColor(kBlue);
0106       cout << "\nshould be blue\n";
0107     }
0108   else
0109     {
0110       hist->SetFillColor(14);
0111       cout << "\nshould be grey\n";
0112     }
0113 }
0114 
0115 void SetupTitle(TH1F* hist, char* xtitle, char* ytitle)
0116 {
0117   hist->GetXaxis()->SetTitle(xtitle);
0118   hist->GetXaxis()->CenterTitle();
0119   hist->GetYaxis()->SetTitle(ytitle);
0120   hist->GetYaxis()->CenterTitle();
0121 }  
0122 
0123 void SetupTitle(TProfile* hist, char* xtitle, char* ytitle)
0124 {
0125   hist->GetXaxis()->SetTitle(xtitle);
0126   hist->GetXaxis()->CenterTitle();
0127   hist->GetYaxis()->SetTitle(ytitle);
0128   hist->GetYaxis()->CenterTitle();
0129 }
0130 
0131 void SetupTitle(TH2F* hist, char* xtitle, char* ytitle)
0132 {
0133   hist->GetXaxis()->SetTitle(xtitle);
0134   hist->GetXaxis()->CenterTitle();
0135   hist->GetYaxis()->SetTitle(ytitle);
0136   hist->GetYaxis()->CenterTitle();
0137 }
0138 
0139 index_map::index_map()
0140 {
0141   ifstream in;
0142   in.open("index_map.dat");
0143   if  (!in)
0144     {
0145       cerr << "Unable to open index_map.dat\n";
0146       exit(1);
0147     }
0148   int tpgindex, vecindex;
0149   while (in >> tpgindex >> vecindex)
0150     {
0151       ntpg2nvec[tpgindex] = vecindex;
0152       nvec2ntpg[vecindex] = tpgindex;
0153     }
0154   in.close();
0155 }
0156 
0157 index_map::~index_map() {}
0158