Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:32:14

0001 // include files
0002 #include <iostream>
0003 #include <iomanip>
0004 #include <fstream>
0005 #include <cmath>
0006 #include "TStyle.h"
0007 
0008 void setTDRStyle() {
0009 
0010   TStyle *tdrStyle = new TStyle("tdrStyle","Style for P-TDR");
0011 
0012 // For the canvas:
0013   tdrStyle->SetCanvasBorderMode(0);
0014   tdrStyle->SetCanvasColor(kWhite);
0015   tdrStyle->SetCanvasDefH(600); //Height of canvas
0016   tdrStyle->SetCanvasDefW(600); //Width of canvas
0017   tdrStyle->SetCanvasDefX(0);   //POsition on screen
0018   tdrStyle->SetCanvasDefY(0);
0019 
0020 // For the Pad:
0021   tdrStyle->SetPadBorderMode(0);
0022   tdrStyle->SetPadColor(kWhite);
0023   tdrStyle->SetPadGridX(false);
0024   tdrStyle->SetPadGridY(false);
0025   tdrStyle->SetGridColor(0);
0026   tdrStyle->SetGridStyle(3);
0027   tdrStyle->SetGridWidth(1);
0028 
0029 // For the frame:
0030   tdrStyle->SetFrameBorderMode(0);
0031   tdrStyle->SetFrameBorderSize(1);
0032   tdrStyle->SetFrameFillColor(0);
0033   tdrStyle->SetFrameFillStyle(0);
0034   tdrStyle->SetFrameLineColor(1);
0035   tdrStyle->SetFrameLineStyle(1);
0036   tdrStyle->SetFrameLineWidth(1);
0037 
0038 // For the histo:
0039   tdrStyle->SetHistLineColor(1);
0040   tdrStyle->SetHistLineStyle(0);
0041   tdrStyle->SetHistLineWidth(1);
0042   tdrStyle->SetEndErrorSize(2);
0043   tdrStyle->SetErrorX(0.);
0044   tdrStyle->SetMarkerStyle(20);
0045 
0046 //For the fit/function:
0047   tdrStyle->SetOptFit(1);
0048   tdrStyle->SetFitFormat("5.4g");
0049   tdrStyle->SetFuncColor(2);
0050   tdrStyle->SetFuncStyle(1);
0051   tdrStyle->SetFuncWidth(1);
0052 
0053 //For the date:
0054   tdrStyle->SetOptDate(0);
0055 
0056 // For the statistics box:
0057   tdrStyle->SetOptFile(0);
0058   tdrStyle->SetOptStat(0); // To display the mean and RMS:   SetOptStat("mr");
0059   tdrStyle->SetStatColor(kWhite);
0060   tdrStyle->SetStatFont(42);
0061   tdrStyle->SetStatFontSize(0.025);
0062   tdrStyle->SetStatTextColor(1);
0063   tdrStyle->SetStatFormat("6.4g");
0064   tdrStyle->SetStatBorderSize(1);
0065   tdrStyle->SetStatH(0.1);
0066   tdrStyle->SetStatW(0.15);
0067 
0068 // Margins:
0069   tdrStyle->SetPadTopMargin(0.05);
0070   tdrStyle->SetPadBottomMargin(0.13);
0071   tdrStyle->SetPadLeftMargin(0.16);
0072   tdrStyle->SetPadRightMargin(0.02);
0073 
0074 // For the Global title:
0075   tdrStyle->SetOptTitle(0);
0076   tdrStyle->SetTitleFont(42);
0077   tdrStyle->SetTitleColor(1);
0078   tdrStyle->SetTitleTextColor(1);
0079   tdrStyle->SetTitleFillColor(10);
0080   tdrStyle->SetTitleFontSize(0.05);
0081 
0082 // For the axis titles:
0083   tdrStyle->SetTitleColor(1, "XYZ");
0084   tdrStyle->SetTitleFont(42, "XYZ");
0085   tdrStyle->SetTitleSize(0.06, "XYZ");
0086   tdrStyle->SetTitleXOffset(0.9);
0087   tdrStyle->SetTitleYOffset(1.25);
0088 
0089 // For the axis labels:
0090   tdrStyle->SetLabelColor(1, "XYZ");
0091   tdrStyle->SetLabelFont(42, "XYZ");
0092   tdrStyle->SetLabelOffset(0.007, "XYZ");
0093   tdrStyle->SetLabelSize(0.05, "XYZ");
0094 
0095 // For the axis:
0096   tdrStyle->SetAxisColor(1, "XYZ");
0097   tdrStyle->SetStripDecimals(kTRUE);
0098   tdrStyle->SetTickLength(0.03, "XYZ");
0099   tdrStyle->SetNdivisions(510, "XYZ");
0100   tdrStyle->SetPadTickX(1);  // To get tick marks on the opposite side of the frame
0101   tdrStyle->SetPadTickY(1);
0102 
0103 // Change for log plots:
0104   tdrStyle->SetOptLogx(0);
0105   tdrStyle->SetOptLogy(0);
0106   tdrStyle->SetOptLogz(0);
0107 
0108 // Postscript options:
0109   tdrStyle->SetPaperSize(20.,20.);
0110 
0111   tdrStyle->cd();
0112 }
0113 
0114 // data dirs
0115 TString theDirName = "Figures";
0116 
0117 // data files
0118 // All the rootfiles must be present:
0119 //  TkStrct PixBar PixFwdPlus PixFwdMinus TIB TIDF TIDB TOB TEC BeamPipe InnerServices
0120 //
0121 
0122 // histograms
0123 TProfile* prof_x0_BeamPipe;
0124 TProfile* prof_x0_PixBar;
0125 TProfile* prof_x0_PixFwdPlus;
0126 TProfile* prof_x0_PixFwdMinus;
0127 TProfile* prof_x0_TIB;
0128 TProfile* prof_x0_TIDF;
0129 TProfile* prof_x0_TIDB;
0130 TProfile* prof_x0_InnerServices;
0131 TProfile* prof_x0_TOB;
0132 TProfile* prof_x0_TEC;
0133 TProfile* prof_x0_Outside;
0134 //
0135 TProfile* prof_x0_SEN;
0136 TProfile* prof_x0_SUP;
0137 TProfile* prof_x0_ELE;
0138 TProfile* prof_x0_CAB;
0139 TProfile* prof_x0_COL;
0140 TProfile* prof_x0_OTH;
0141 TProfile* prof_x0_AIR;
0142 //
0143 TH1D* hist_x0_BeamPipe;
0144 TH1D* hist_x0_Pixel;
0145 TH1D* hist_x0_IB;
0146 TH1D* hist_x0_TOB;
0147 TH1D* hist_x0_TEC;
0148 TH1D* hist_x0_Outside;
0149 //
0150 TH1D* hist_x0_SEN;
0151 TH1D* hist_x0_SUP;
0152 TH1D* hist_x0_ELE;
0153 TH1D* hist_x0_CAB;
0154 TH1D* hist_x0_COL;
0155 TH1D* hist_x0_OTH;
0156 //
0157 float xmin;
0158 float xmax; 
0159 
0160 float ymin;
0161 float ymax;
0162 //
0163 void createPlots(TString plot);
0164 
0165 using namespace std;
0166 
0167 // Main
0168 void MaterialBudget_TDR() {
0169 
0170   //TDR style
0171   setTDRStyle();  
0172 
0173   // plots
0174   createPlots("x_vs_eta");
0175   createPlots("x_vs_phi");
0176   createPlots("x_vs_R");
0177   createPlots("l_vs_eta");
0178   createPlots("l_vs_phi");
0179   createPlots("l_vs_R");
0180 }
0181 
0182 void createPlots(TString plot){
0183   unsigned int plotNumber = 0;
0184   TString abscissaName = "dummy";
0185   TString ordinateName = "dummy";
0186   if(plot.CompareTo("x_vs_eta") == 0) {
0187     plotNumber = 10;
0188     abscissaName = TString("#eta");
0189     ordinateName = TString("t/X_{0}");
0190     ymin =  0.0;
0191     ymax =  2.575;
0192     xmin = -4.0;
0193     xmax =  4.0;
0194   }
0195   else if(plot.CompareTo("x_vs_phi") == 0) {
0196     plotNumber = 20;
0197     abscissaName = TString("#varphi [rad]");
0198     ordinateName = TString("t/X_{0}");
0199     ymin =  0.0;
0200     ymax =  6.2;
0201     xmin = -4.0;
0202     xmax =  4.0;
0203   }
0204   else if(plot.CompareTo("x_vs_R") == 0) {
0205     plotNumber = 40;
0206     abscissaName = TString("R [cm]");
0207     ordinateName = TString("t/X_{0}");
0208     ymin =  0.0;
0209     ymax =  70.0;
0210     xmin =  0.0;
0211     xmax =  1200.0;
0212   }
0213 
0214   else if(plot.CompareTo("l_vs_eta") == 0) {
0215     plotNumber = 1010;
0216     abscissaName = TString("#eta");
0217     ordinateName = TString("t/#lambda_{I}");
0218     ymin =  0.0;
0219     ymax =  0.73;
0220     xmin = -4.0;
0221     xmax =  4.0;
0222   }
0223   else if(plot.CompareTo("l_vs_phi") == 0) {
0224     plotNumber = 1020;
0225     abscissaName = TString("#varphi [rad]");
0226     ordinateName = TString("t/#lambda_{I}");
0227     ymin =  0.0;
0228     ymax =  1.2;
0229     xmin = -4.0;
0230     xmax =  4.0;
0231   }
0232   else if(plot.CompareTo("l_vs_R") == 0) {
0233     plotNumber = 1040;
0234     abscissaName = TString("R [cm]");
0235     ordinateName = TString("t/#lambda_{I}");
0236     ymin =  0.0;
0237     ymax =  7.5;
0238     xmin =  0.0;
0239     xmax =  1200.0;
0240   }
0241   else {
0242     cout << " error: chosen plot name not known " << plot << endl;
0243     return;
0244   }
0245   
0246   TString subDetector("empty");
0247   for(unsigned int i_detector=0; i_detector<=10; i_detector++) {
0248     switch(i_detector) {
0249     case 0: {
0250       subDetector = "TIB";
0251       break;
0252     }
0253     case 1: {
0254       subDetector = "TIDF";
0255       break;
0256     }
0257     case 2: {
0258       subDetector = "TIDB";
0259       break;
0260     }
0261     case 3: {
0262       subDetector = "InnerServices";
0263       break;
0264     }
0265     case 4: {
0266       subDetector = "TOB";
0267       break;
0268     }
0269     case 5: {
0270       subDetector = "TEC";
0271       break;
0272     }
0273     case 6: {
0274       subDetector = "TkStrct";
0275       break;
0276     }
0277     case 7: {
0278       subDetector = "PixBar";
0279       break;
0280     }
0281     case 8: {
0282       subDetector = "PixFwdPlus";
0283       break;
0284     }
0285     case 9: {
0286       subDetector = "PixFwdMinus";
0287       break;
0288     }
0289     case 10: {
0290       subDetector = "BeamPipe";
0291       break;
0292     }
0293     default: cout << " something wrong" << endl;
0294     }
0295 
0296     // file name
0297     TString subDetectorFileName = "matbdg_" + subDetector + ".root";
0298 
0299     // open file
0300     TFile* subDetectorFile = new TFile(subDetectorFileName);
0301     cout << "*** Open file... " << endl;
0302     cout << subDetectorFileName << endl;
0303     cout << "***" << endl;
0304     
0305     switch(i_detector) {
0306     case 0: {
0307       // subDetector = "TIB";
0308       // subdetector profiles
0309       prof_x0_TIB = (TProfile*)subDetectorFile->Get(Form("%u", plotNumber));
0310       hist_x0_IB  = (TH1D*)prof_x0_TIB->ProjectionX();
0311       // category profiles
0312       prof_x0_SUP   = (TProfile*)subDetectorFile->Get(Form("%u", 100 + plotNumber));
0313       prof_x0_SEN   = (TProfile*)subDetectorFile->Get(Form("%u", 200 + plotNumber));
0314       prof_x0_CAB   = (TProfile*)subDetectorFile->Get(Form("%u", 300 + plotNumber));
0315       prof_x0_COL   = (TProfile*)subDetectorFile->Get(Form("%u", 400 + plotNumber));
0316       prof_x0_ELE   = (TProfile*)subDetectorFile->Get(Form("%u", 500 + plotNumber));
0317       prof_x0_OTH   = (TProfile*)subDetectorFile->Get(Form("%u", 600 + plotNumber));
0318       prof_x0_AIR   = (TProfile*)subDetectorFile->Get(Form("%u", 700 + plotNumber));
0319       // add to summary histogram
0320       hist_x0_SUP = (TH1D*)prof_x0_SUP->ProjectionX();
0321       hist_x0_SEN = (TH1D*)prof_x0_SEN->ProjectionX();
0322       hist_x0_CAB = (TH1D*)prof_x0_CAB->ProjectionX();
0323       hist_x0_COL = (TH1D*)prof_x0_COL->ProjectionX();
0324       hist_x0_ELE = (TH1D*)prof_x0_ELE->ProjectionX();
0325       hist_x0_OTH = (TH1D*)prof_x0_OTH->ProjectionX();
0326       hist_x0_OTH = (TH1D*)prof_x0_AIR->ProjectionX();
0327       break;
0328     }
0329     case 1: {
0330       // subDetector = "TIDF";
0331       // subdetector profiles
0332       prof_x0_TIDF = (TProfile*)subDetectorFile->Get(Form("%u", plotNumber));
0333       hist_x0_IB->Add( (TH1D*)prof_x0_TIDF->ProjectionX("B") , +1.000 );
0334       // category profiles
0335       prof_x0_SUP   = (TProfile*)subDetectorFile->Get(Form("%u", 100 + plotNumber));
0336       prof_x0_SEN   = (TProfile*)subDetectorFile->Get(Form("%u", 200 + plotNumber));
0337       prof_x0_CAB   = (TProfile*)subDetectorFile->Get(Form("%u", 300 + plotNumber));
0338       prof_x0_COL   = (TProfile*)subDetectorFile->Get(Form("%u", 400 + plotNumber));
0339       prof_x0_ELE   = (TProfile*)subDetectorFile->Get(Form("%u", 500 + plotNumber));
0340       prof_x0_OTH   = (TProfile*)subDetectorFile->Get(Form("%u", 600 + plotNumber));
0341       prof_x0_AIR   = (TProfile*)subDetectorFile->Get(Form("%u", 700 + plotNumber));
0342       // add to summary histogram
0343       hist_x0_SUP->Add(   (TH1D*)prof_x0_SUP->ProjectionX("B")  , +1.000 );
0344       hist_x0_SEN->Add(   (TH1D*)prof_x0_SEN->ProjectionX("B")  , +1.000 );
0345       hist_x0_CAB->Add(   (TH1D*)prof_x0_CAB->ProjectionX("B")  , +1.000 );
0346       hist_x0_COL->Add(   (TH1D*)prof_x0_COL->ProjectionX("B")  , +1.000 );
0347       hist_x0_ELE->Add(   (TH1D*)prof_x0_ELE->ProjectionX("B")  , +1.000 );
0348       hist_x0_OTH->Add(   (TH1D*)prof_x0_OTH->ProjectionX("B")  , +1.000 );
0349       hist_x0_OTH->Add(   (TH1D*)prof_x0_AIR->ProjectionX("B")  , +1.000 );
0350       break;
0351     }
0352     case 2: {
0353       // subDetector = "TIDB";
0354       // subdetector profiles
0355       prof_x0_TIDB = (TProfile*)subDetectorFile->Get(Form("%u", plotNumber));
0356       hist_x0_IB->Add( (TH1D*)prof_x0_TIDB->ProjectionX("B") , +1.000 );
0357       // category profiles
0358       prof_x0_SUP   = (TProfile*)subDetectorFile->Get(Form("%u", 100 + plotNumber));
0359       prof_x0_SEN   = (TProfile*)subDetectorFile->Get(Form("%u", 200 + plotNumber));
0360       prof_x0_CAB   = (TProfile*)subDetectorFile->Get(Form("%u", 300 + plotNumber));
0361       prof_x0_COL   = (TProfile*)subDetectorFile->Get(Form("%u", 400 + plotNumber));
0362       prof_x0_ELE   = (TProfile*)subDetectorFile->Get(Form("%u", 500 + plotNumber));
0363       prof_x0_OTH   = (TProfile*)subDetectorFile->Get(Form("%u", 600 + plotNumber));
0364       prof_x0_AIR   = (TProfile*)subDetectorFile->Get(Form("%u", 700 + plotNumber));
0365       // add to summary histogram
0366       hist_x0_SUP->Add(   (TH1D*)prof_x0_SUP->ProjectionX("B")  , +1.000 );
0367       hist_x0_SEN->Add(   (TH1D*)prof_x0_SEN->ProjectionX("B")  , +1.000 );
0368       hist_x0_CAB->Add(   (TH1D*)prof_x0_CAB->ProjectionX("B")  , +1.000 );
0369       hist_x0_COL->Add(   (TH1D*)prof_x0_COL->ProjectionX("B")  , +1.000 );
0370       hist_x0_ELE->Add(   (TH1D*)prof_x0_ELE->ProjectionX("B")  , +1.000 );
0371       hist_x0_OTH->Add(   (TH1D*)prof_x0_OTH->ProjectionX("B")  , +1.000 );
0372       hist_x0_OTH->Add(   (TH1D*)prof_x0_AIR->ProjectionX("B")  , +1.000 );
0373       break;
0374     }
0375     case 3: {
0376       // subDetector = "InnerServices";
0377       // subdetector profiles
0378       prof_x0_InnerServices = (TProfile*)subDetectorFile->Get(Form("%u", plotNumber));
0379       hist_x0_IB->Add( (TH1D*)prof_x0_InnerServices->ProjectionX("B") , +1.000 );
0380       // category profiles
0381       prof_x0_SUP   = (TProfile*)subDetectorFile->Get(Form("%u", 100 + plotNumber));
0382       prof_x0_SEN   = (TProfile*)subDetectorFile->Get(Form("%u", 200 + plotNumber));
0383       prof_x0_CAB   = (TProfile*)subDetectorFile->Get(Form("%u", 300 + plotNumber));
0384       prof_x0_COL   = (TProfile*)subDetectorFile->Get(Form("%u", 400 + plotNumber));
0385       prof_x0_ELE   = (TProfile*)subDetectorFile->Get(Form("%u", 500 + plotNumber));
0386       prof_x0_OTH   = (TProfile*)subDetectorFile->Get(Form("%u", 600 + plotNumber));
0387       prof_x0_AIR   = (TProfile*)subDetectorFile->Get(Form("%u", 700 + plotNumber));
0388       // add to summary histogram
0389       hist_x0_SUP->Add(   (TH1D*)prof_x0_SUP->ProjectionX("B")  , +1.000 );
0390       hist_x0_SEN->Add(   (TH1D*)prof_x0_SEN->ProjectionX("B")  , +1.000 );
0391       hist_x0_CAB->Add(   (TH1D*)prof_x0_CAB->ProjectionX("B")  , +1.000 );
0392       hist_x0_COL->Add(   (TH1D*)prof_x0_COL->ProjectionX("B")  , +1.000 );
0393       hist_x0_ELE->Add(   (TH1D*)prof_x0_ELE->ProjectionX("B")  , +1.000 );
0394       hist_x0_OTH->Add(   (TH1D*)prof_x0_OTH->ProjectionX("B")  , +1.000 );
0395       hist_x0_OTH->Add(   (TH1D*)prof_x0_AIR->ProjectionX("B")  , +1.000 );
0396       break;
0397     }
0398     case 4: {
0399       // subDetector = "TOB";
0400       // subdetector profiles
0401       prof_x0_TOB = (TProfile*)subDetectorFile->Get(Form("%u", plotNumber));
0402       hist_x0_TOB = (TH1D*)prof_x0_TOB->ProjectionX();
0403       // category profiles
0404       prof_x0_SUP   = (TProfile*)subDetectorFile->Get(Form("%u", 100 + plotNumber));
0405       prof_x0_SEN   = (TProfile*)subDetectorFile->Get(Form("%u", 200 + plotNumber));
0406       prof_x0_CAB   = (TProfile*)subDetectorFile->Get(Form("%u", 300 + plotNumber));
0407       prof_x0_COL   = (TProfile*)subDetectorFile->Get(Form("%u", 400 + plotNumber));
0408       prof_x0_ELE   = (TProfile*)subDetectorFile->Get(Form("%u", 500 + plotNumber));
0409       prof_x0_OTH   = (TProfile*)subDetectorFile->Get(Form("%u", 600 + plotNumber));
0410       prof_x0_AIR   = (TProfile*)subDetectorFile->Get(Form("%u", 700 + plotNumber));
0411       // add to summary histogram
0412       hist_x0_SUP->Add(   (TH1D*)prof_x0_SUP->ProjectionX("B")  , +1.000 );
0413       hist_x0_SEN->Add(   (TH1D*)prof_x0_SEN->ProjectionX("B")  , +1.000 );
0414       hist_x0_CAB->Add(   (TH1D*)prof_x0_CAB->ProjectionX("B")  , +1.000 );
0415       hist_x0_COL->Add(   (TH1D*)prof_x0_COL->ProjectionX("B")  , +1.000 );
0416       hist_x0_ELE->Add(   (TH1D*)prof_x0_ELE->ProjectionX("B")  , +1.000 );
0417       hist_x0_OTH->Add(   (TH1D*)prof_x0_OTH->ProjectionX("B")  , +1.000 );
0418       hist_x0_OTH->Add(   (TH1D*)prof_x0_AIR->ProjectionX("B")  , +1.000 );
0419       break;
0420     }
0421     case 5: {
0422       // subDetector = "TEC";
0423       // subdetector profiles
0424       prof_x0_TEC = (TProfile*)subDetectorFile->Get(Form("%u", plotNumber));
0425       hist_x0_TEC =  (TH1D*)prof_x0_TEC->ProjectionX();
0426       // category profiles
0427       prof_x0_SUP   = (TProfile*)subDetectorFile->Get(Form("%u", 100 + plotNumber));
0428       prof_x0_SEN   = (TProfile*)subDetectorFile->Get(Form("%u", 200 + plotNumber));
0429       prof_x0_CAB   = (TProfile*)subDetectorFile->Get(Form("%u", 300 + plotNumber));
0430       prof_x0_COL   = (TProfile*)subDetectorFile->Get(Form("%u", 400 + plotNumber));
0431       prof_x0_ELE   = (TProfile*)subDetectorFile->Get(Form("%u", 500 + plotNumber));
0432       prof_x0_OTH   = (TProfile*)subDetectorFile->Get(Form("%u", 600 + plotNumber));
0433       prof_x0_AIR   = (TProfile*)subDetectorFile->Get(Form("%u", 700 + plotNumber));
0434       // add to summary histogram
0435       hist_x0_SUP->Add(   (TH1D*)prof_x0_SUP->ProjectionX("B")  , +1.000 );
0436       hist_x0_SEN->Add(   (TH1D*)prof_x0_SEN->ProjectionX("B")  , +1.000 );
0437       hist_x0_CAB->Add(   (TH1D*)prof_x0_CAB->ProjectionX("B")  , +1.000 );
0438       hist_x0_COL->Add(   (TH1D*)prof_x0_COL->ProjectionX("B")  , +1.000 );
0439       hist_x0_ELE->Add(   (TH1D*)prof_x0_ELE->ProjectionX("B")  , +1.000 );
0440       hist_x0_OTH->Add(   (TH1D*)prof_x0_OTH->ProjectionX("B")  , +1.000 );
0441       hist_x0_OTH->Add(   (TH1D*)prof_x0_AIR->ProjectionX("B")  , +1.000 );
0442       break;
0443     }
0444     case 6: {
0445       // subDetector = "TkStrct";
0446       // subdetector profiles
0447       prof_x0_Outside = (TProfile*)subDetectorFile->Get(Form("%u", plotNumber));
0448       hist_x0_Outside = (TH1D*)prof_x0_Outside->ProjectionX();
0449       break;
0450     }
0451     case 7: {
0452       // subDetector = "PixBar";
0453       // subdetector profiles
0454       prof_x0_PixBar = (TProfile*)subDetectorFile->Get(Form("%u", plotNumber));
0455       hist_x0_Pixel  = (TH1D*)prof_x0_PixBar->ProjectionX();
0456       // category profiles
0457       prof_x0_SUP   = (TProfile*)subDetectorFile->Get(Form("%u", 100 + plotNumber));
0458       prof_x0_SEN   = (TProfile*)subDetectorFile->Get(Form("%u", 200 + plotNumber));
0459       prof_x0_CAB   = (TProfile*)subDetectorFile->Get(Form("%u", 300 + plotNumber));
0460       prof_x0_COL   = (TProfile*)subDetectorFile->Get(Form("%u", 400 + plotNumber));
0461       prof_x0_ELE   = (TProfile*)subDetectorFile->Get(Form("%u", 500 + plotNumber));
0462       prof_x0_OTH   = (TProfile*)subDetectorFile->Get(Form("%u", 600 + plotNumber));
0463       prof_x0_AIR   = (TProfile*)subDetectorFile->Get(Form("%u", 700 + plotNumber));
0464       // add to summary histogram
0465       hist_x0_SUP->Add(   (TH1D*)prof_x0_SUP->ProjectionX("B")  , +1.000 );
0466       hist_x0_SEN->Add(   (TH1D*)prof_x0_SEN->ProjectionX("B")  , +1.000 );
0467       hist_x0_CAB->Add(   (TH1D*)prof_x0_CAB->ProjectionX("B")  , +1.000 );
0468       hist_x0_COL->Add(   (TH1D*)prof_x0_COL->ProjectionX("B")  , +1.000 );
0469       hist_x0_ELE->Add(   (TH1D*)prof_x0_ELE->ProjectionX("B")  , +1.000 );
0470       hist_x0_OTH->Add(   (TH1D*)prof_x0_OTH->ProjectionX("B")  , +1.000 );
0471       hist_x0_OTH->Add(   (TH1D*)prof_x0_AIR->ProjectionX("B")  , +1.000 );
0472       break;
0473     }
0474     case 8: {
0475       // subDetector = "PixFwdPlus";
0476       // subdetector profiles
0477       prof_x0_PixFwdPlus = (TProfile*)subDetectorFile->Get(Form("%u", plotNumber));
0478       hist_x0_Pixel->Add( (TH1D*)prof_x0_PixFwdPlus->ProjectionX("B") , +1.000 );
0479       // category profiles
0480       prof_x0_SUP   = (TProfile*)subDetectorFile->Get(Form("%u", 100 + plotNumber));
0481       prof_x0_SEN   = (TProfile*)subDetectorFile->Get(Form("%u", 200 + plotNumber));
0482       prof_x0_CAB   = (TProfile*)subDetectorFile->Get(Form("%u", 300 + plotNumber));
0483       prof_x0_COL   = (TProfile*)subDetectorFile->Get(Form("%u", 400 + plotNumber));
0484       prof_x0_ELE   = (TProfile*)subDetectorFile->Get(Form("%u", 500 + plotNumber));
0485       prof_x0_OTH   = (TProfile*)subDetectorFile->Get(Form("%u", 600 + plotNumber));
0486       prof_x0_AIR   = (TProfile*)subDetectorFile->Get(Form("%u", 700 + plotNumber));
0487       // add to summary histogram
0488       hist_x0_SUP->Add(   (TH1D*)prof_x0_SUP->ProjectionX("B")  , +1.000 );
0489       hist_x0_SEN->Add(   (TH1D*)prof_x0_SEN->ProjectionX("B")  , +1.000 );
0490       hist_x0_CAB->Add(   (TH1D*)prof_x0_CAB->ProjectionX("B")  , +1.000 );
0491       hist_x0_COL->Add(   (TH1D*)prof_x0_COL->ProjectionX("B")  , +1.000 );
0492       hist_x0_ELE->Add(   (TH1D*)prof_x0_ELE->ProjectionX("B")  , +1.000 );
0493       hist_x0_OTH->Add(   (TH1D*)prof_x0_OTH->ProjectionX("B")  , +1.000 );
0494       hist_x0_OTH->Add(   (TH1D*)prof_x0_AIR->ProjectionX("B")  , +1.000 );
0495       break;
0496     }
0497     case 9: {
0498       subDetector = "PixFwdMinus";
0499       // subdetector profiles
0500       prof_x0_PixFwdMinus = (TProfile*)subDetectorFile->Get(Form("%u", plotNumber));
0501       hist_x0_Pixel->Add( (TH1D*)prof_x0_PixFwdMinus->ProjectionX("B") , +1.000 );
0502       // category profiles
0503       prof_x0_SUP   = (TProfile*)subDetectorFile->Get(Form("%u", 100 + plotNumber));
0504       prof_x0_SEN   = (TProfile*)subDetectorFile->Get(Form("%u", 200 + plotNumber));
0505       prof_x0_CAB   = (TProfile*)subDetectorFile->Get(Form("%u", 300 + plotNumber));
0506       prof_x0_COL   = (TProfile*)subDetectorFile->Get(Form("%u", 400 + plotNumber));
0507       prof_x0_ELE   = (TProfile*)subDetectorFile->Get(Form("%u", 500 + plotNumber));
0508       prof_x0_OTH   = (TProfile*)subDetectorFile->Get(Form("%u", 600 + plotNumber));
0509       prof_x0_AIR   = (TProfile*)subDetectorFile->Get(Form("%u", 700 + plotNumber));
0510       // add to summary histogram
0511       hist_x0_SUP->Add(   (TH1D*)prof_x0_SUP->ProjectionX("B")  , +1.000 );
0512       hist_x0_SEN->Add(   (TH1D*)prof_x0_SEN->ProjectionX("B")  , +1.000 );
0513       hist_x0_CAB->Add(   (TH1D*)prof_x0_CAB->ProjectionX("B")  , +1.000 );
0514       hist_x0_COL->Add(   (TH1D*)prof_x0_COL->ProjectionX("B")  , +1.000 );
0515       hist_x0_ELE->Add(   (TH1D*)prof_x0_ELE->ProjectionX("B")  , +1.000 );
0516       hist_x0_OTH->Add(   (TH1D*)prof_x0_OTH->ProjectionX("B")  , +1.000 );
0517       hist_x0_OTH->Add(   (TH1D*)prof_x0_AIR->ProjectionX("B")  , +1.000 );
0518       break;
0519     }
0520     case 10: {
0521       // subDetector = "BeamPipe";
0522       // subdetector profiles
0523       prof_x0_BeamPipe = (TProfile*)subDetectorFile->Get(Form("%u", plotNumber));
0524       hist_x0_BeamPipe = (TH1D*)prof_x0_BeamPipe->ProjectionX();
0525       break;
0526     }
0527     default: cout << " something wrong" << endl;
0528     }
0529   }
0530   
0531   // colors
0532   int kpipe  = kGray+2;
0533   int kpixel = kAzure-5;
0534   int ktib   = kMagenta-2;
0535   int ktob   = kOrange+10;
0536   int ktec   = kOrange-2;
0537   int kout   = kGray;
0538 
0539   int ksen = 27;
0540   int kele = 46;
0541   int kcab = kOrange-8;
0542   int kcol = 30;
0543   int ksup = 38;
0544   int koth = kOrange-2;
0545 
0546   hist_x0_BeamPipe->SetFillColor(kpipe); // Beam Pipe    = dark gray
0547   hist_x0_Pixel->SetFillColor(kpixel);   // Pixel    = dark blue
0548   hist_x0_IB->SetFillColor(ktib);    // TIB and TID  = violet
0549   hist_x0_TOB->SetFillColor(ktob);       // TOB          = red
0550   hist_x0_TEC->SetFillColor(ktec);       // TEC          = yellow gold
0551   hist_x0_Outside->SetFillColor(kout);   // Support tube = light gray
0552 
0553   hist_x0_SEN->SetFillColor(ksen); // Sensitive   = brown
0554   hist_x0_ELE->SetFillColor(kele); // Electronics = red
0555   hist_x0_CAB->SetFillColor(kcab); // Cabling     = dark orange 
0556   hist_x0_COL->SetFillColor(kcol); // Cooling     = green
0557   hist_x0_SUP->SetFillColor(ksup); // Support     = light blue
0558   hist_x0_OTH->SetFillColor(koth); // Other+Air   = light orange
0559   //
0560   
0561   
0562   // First Plot: BeamPipe + Pixel + TIB/TID + TOB + TEC + Outside
0563   // stack
0564   TString stackTitle_SubDetectors = Form( "Tracker Material Budget;%s;%s",abscissaName.Data(),ordinateName.Data() );
0565   THStack stack_x0_SubDetectors("stack_x0",stackTitle_SubDetectors);
0566   stack_x0_SubDetectors.Add(hist_x0_BeamPipe);
0567   stack_x0_SubDetectors.Add(hist_x0_Pixel);
0568   stack_x0_SubDetectors.Add(hist_x0_IB);
0569   stack_x0_SubDetectors.Add(hist_x0_TOB);
0570   stack_x0_SubDetectors.Add(hist_x0_TEC);
0571   stack_x0_SubDetectors.Add(hist_x0_Outside);
0572   //
0573   
0574   // canvas
0575   TCanvas can_SubDetectors("can_SubDetectors","can_SubDetectors",800,800);
0576   can_SubDetectors.Range(0,0,25,25);
0577   can_SubDetectors.SetFillColor(kWhite);
0578   gStyle->SetOptStat(0);
0579   //
0580   
0581   // Draw
0582   stack_x0_SubDetectors.SetMinimum(ymin);
0583   stack_x0_SubDetectors.SetMaximum(ymax);
0584   stack_x0_SubDetectors.Draw("HIST");
0585   stack_x0_SubDetectors.GetXaxis()->SetLimits(xmin,xmax);
0586   //
0587   
0588   // Legenda
0589   TLegend* theLegend_SubDetectors = new TLegend(0.180,0.8,0.98,0.92); 
0590   theLegend_SubDetectors->SetNColumns(3); 
0591   theLegend_SubDetectors->SetFillColor(0); 
0592   theLegend_SubDetectors->SetFillStyle(0); 
0593   theLegend_SubDetectors->SetBorderSize(0); 
0594 
0595   theLegend_SubDetectors->AddEntry(hist_x0_Outside,   "Support Tube",  "f");
0596   theLegend_SubDetectors->AddEntry(hist_x0_TOB,       "TOB",           "f");
0597   theLegend_SubDetectors->AddEntry(hist_x0_Pixel,     "Pixel",         "f");
0598 
0599   theLegend_SubDetectors->AddEntry(hist_x0_TEC,       "TEC",           "f");
0600   theLegend_SubDetectors->AddEntry(hist_x0_IB,        "TIB and TID",   "f");
0601   theLegend_SubDetectors->AddEntry(hist_x0_BeamPipe,  "Beam Pipe",     "f");
0602   theLegend_SubDetectors->Draw();
0603   //
0604 
0605   // text
0606   TPaveText* text_SubDetectors = new TPaveText(0.180,0.727,0.402,0.787,"NDC");
0607   text_SubDetectors->SetFillColor(0);
0608   text_SubDetectors->SetBorderSize(0);
0609   text_SubDetectors->AddText("CMS Simulation");
0610   text_SubDetectors->SetTextAlign(11);
0611   text_SubDetectors->Draw();
0612   //
0613   
0614   // Store
0615   can_SubDetectors.Update();
0616   //  can_SubDetectors.SaveAs( Form( "%s/Tracker_SubDetectors_%s.eps",  theDirName.Data(), plot.Data() ) );
0617   //  can_SubDetectors.SaveAs( Form( "%s/Tracker_SubDetectors_%s.gif",  theDirName.Data(), plot.Data() ) );
0618   can_SubDetectors.SaveAs( Form( "%s/Tracker_SubDetectors_%s.pdf",  theDirName.Data(), plot.Data() ) );
0619   //  can_SubDetectors.SaveAs( Form( "%s/Tracker_SubDetectors_%s.png",  theDirName.Data(), plot.Data() ) );
0620   can_SubDetectors.SaveAs( Form( "%s/Tracker_SubDetectors_%s.root",  theDirName.Data(), plot.Data() ) );
0621   //  can_SubDetectors.SaveAs( Form( "%s/Tracker_SubDetectors_%s.C",  theDirName.Data(), plot.Data() ) );
0622   //
0623   
0624   
0625   // Second Plot: BeamPipe + SEN + ELE + CAB + COL + SUP + OTH/AIR + Outside
0626   // stack
0627   TString stackTitle_Materials = Form( "Tracker Material Budget;%s;%s",abscissaName.Data(),ordinateName.Data() );
0628   THStack stack_x0_Materials("stack_x0",stackTitle_Materials);
0629   stack_x0_Materials.Add(hist_x0_BeamPipe);
0630   stack_x0_Materials.Add(hist_x0_SEN);
0631   stack_x0_Materials.Add(hist_x0_ELE);
0632   stack_x0_Materials.Add(hist_x0_CAB);
0633   stack_x0_Materials.Add(hist_x0_COL);
0634   stack_x0_Materials.Add(hist_x0_SUP);
0635   stack_x0_Materials.Add(hist_x0_OTH);
0636   stack_x0_Materials.Add(hist_x0_Outside);
0637   //
0638   
0639   // canvas
0640   TCanvas can_Materials("can_Materials","can_Materials",800,800);
0641   can_Materials.Range(0,0,25,25);
0642   can_Materials.SetFillColor(kWhite);
0643   gStyle->SetOptStat(0);
0644   //
0645   
0646   // Draw
0647   stack_x0_Materials.SetMinimum(ymin);
0648   stack_x0_Materials.SetMaximum(ymax);
0649   stack_x0_Materials.Draw("HIST");
0650   stack_x0_Materials.GetXaxis()->SetLimits(xmin,xmax);
0651   //
0652   
0653   // Legenda
0654   TLegend* theLegend_Materials = new TLegend(0.180,0.8,0.95,0.92); 
0655   theLegend_Materials->SetNColumns(3); 
0656   theLegend_Materials->SetFillColor(0); 
0657   theLegend_Materials->SetBorderSize(0); 
0658 
0659   theLegend_Materials->AddEntry(hist_x0_Outside,   "Support and Thermal Screen",  "f");
0660   theLegend_Materials->AddEntry(hist_x0_OTH,       "Other",                       "f");
0661   theLegend_Materials->AddEntry(hist_x0_SUP,       "Mechanical Structures",       "f");
0662 
0663   theLegend_Materials->AddEntry(hist_x0_COL,       "Cooling",                     "f");
0664   theLegend_Materials->AddEntry(hist_x0_CAB,       "Cables",                      "f");
0665   theLegend_Materials->AddEntry(hist_x0_ELE,       "Electronics",                 "f");
0666 
0667   theLegend_Materials->AddEntry(hist_x0_SEN,       "Sensitive",                   "f");
0668   theLegend_Materials->AddEntry(hist_x0_BeamPipe,  "Beam Pipe",                   "f");
0669   theLegend_Materials->Draw();
0670   //
0671 
0672   // text
0673   TPaveText* text_Materials = new TPaveText(0.180,0.727,0.402,0.787,"NDC");
0674   text_Materials->SetFillColor(0);
0675   text_Materials->SetBorderSize(0);
0676   text_Materials->AddText("CMS Simulation");
0677   text_Materials->SetTextAlign(11);
0678   text_Materials->Draw();
0679   //
0680   
0681   // Store
0682   can_Materials.Update();
0683   // can_Materials.SaveAs( Form( "%s/Tracker_Materials_%s.eps",  theDirName.Data(), plot.Data() ) );
0684   // can_Materials.SaveAs( Form( "%s/Tracker_Materials_%s.gif",  theDirName.Data(), plot.Data() ) );
0685   can_Materials.SaveAs( Form( "%s/Tracker_Materials_%s.pdf",  theDirName.Data(), plot.Data() ) );
0686   // can_Materials.SaveAs( Form( "%s/Tracker_Materials_%s.png",  theDirName.Data(), plot.Data() ) );
0687   can_Materials.SaveAs( Form( "%s/Tracker_Materials_%s.root",  theDirName.Data(), plot.Data() ) );
0688   // can_Materials.SaveAs( Form( "%s/Tracker_Materials_%s.C",  theDirName.Data(), plot.Data() ) );
0689   //
0690   
0691 }