Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:59:44

0001 
0002 #include<vector>
0003 
0004 
0005 void DrawSuperposedHistos(TFile** File, char** Histos_Name, std::vector<char*> legend, int Rebin, char* Title,  char* Xlegend, char* Ylegend, double xmin, double xmax, double ymin, double ymax, bool save, char* save_path, bool special);
0006 //void DrawTH2D(TFile** File, char** Histos_Name, std::vector<char*> legend, char* Title, bool save, char* save_path);
0007 void DrawTProfile(TFile** File, char** Histos_Name, std::vector<char*> legend, char* Title, char* Xlegend, char* Ylegend, double xmin, double xmax, double ymin, double ymax,  bool save, char* save_path);
0008 void DrawTH2D  (TFile** File, char** Histos_Name, std::vector<char*> legend, char* Title, char* Xlegend, char* Ylegend, double xmin, double xmax, double ymin, double ymax,  bool save, char* save_path, double MarkerSize);
0009 void DrawTH2D  (TFile** File, char** Histos_Name, std::vector<char*> legend, char* Title, char* Xlegend, char* Ylegend, double xmin, double xmax, double ymin, double ymax,  bool save, char* save_path);
0010 void DrawTH2DZ(TFile* File, char* Histos_Name, char* legend, char* Title, char* Xlegend, char* Ylegend, double xmin, double xmax, double ymin, double ymax,  bool save, char* save_path, bool Normalization);
0011 void PrintJobInfo(TFile* File);
0012 
0013 void macro()
0014 {
0015     gROOT->Reset();
0016     gStyle->SetCanvasColor(0);
0017         gStyle->SetPalette(1);
0018         gStyle->SetBarOffset(0);
0019     bool save = true;
0020 
0021 
0022         TFile* CRAFT  = new TFile("file:../SiStripCalib.root");
0023 
0024         PrintJobInfo(CRAFT);
0025 
0026         char** Histos_Name = new char*[4];                  std::vector<char*> legend;legend.clear();   TFile** Files = new TFile*[4];
0027         Histos_Name[0] = "MPV_Vs_EtaTEC";                   legend.push_back("TEC");                    Files[0] = CRAFT;
0028         Histos_Name[1] = "MPV_Vs_EtaTIB";                   legend.push_back("TIB");                    Files[1] = CRAFT;
0029         Histos_Name[2] = "MPV_Vs_EtaTID";                   legend.push_back("TID");                    Files[2] = CRAFT;
0030         Histos_Name[3] = "MPV_Vs_EtaTOB";                   legend.push_back("TOB");                    Files[3] = CRAFT;
0031         DrawTH2D(Files, Histos_Name,legend, "", "module #eta", "MPV (ADC/mm)", -3.0,3.0, 0,500,save,"Pictures/CRAFT_MPV_Vs_EtaSubDet.png");
0032         delete [] Histos_Name; Histos_Name=NULL;    
0033 
0034         char** Histos_Name = new char*[4];                  std::vector<char*> legend;legend.clear();   TFile** Files = new TFile*[4];
0035         Histos_Name[0] = "MPV_Vs_PhiTEC";                   legend.push_back("TEC");                    Files[0] = CRAFT;
0036         Histos_Name[1] = "MPV_Vs_PhiTIB";                   legend.push_back("TIB");                    Files[1] = CRAFT;
0037         Histos_Name[2] = "MPV_Vs_PhiTID";                   legend.push_back("TID");                    Files[2] = CRAFT;
0038         Histos_Name[3] = "MPV_Vs_PhiTOB";                   legend.push_back("TOB");                    Files[3] = CRAFT;
0039         DrawTH2D(Files, Histos_Name,legend, "", "module #phi", "MPV (ADC/mm)", -3.2,3.2, 0,500,save,"Pictures/CRAFT_MPV_Vs_PhiSubDet.png");
0040         delete [] Histos_Name; Histos_Name=NULL;
0041  
0042 
0043         char** Histos_Name = new char*[4];                  std::vector<char*> legend;legend.clear();   TFile** Files = new TFile*[4];
0044         Histos_Name[0] = "APV_MPV";                         legend.push_back("");                       Files[0] = CRAFT;
0045         DrawSuperposedHistos(Files, Histos_Name, legend, 1, "",  "APV Pair Index", "MPV (ADC/mm)", 0, 0, 0, 500, save, "Pictures/CRAFT_APV_MPV.png",true);
0046 
0047         char** Histos_Name = new char*[4];                  std::vector<char*> legend;legend.clear();   TFile** Files = new TFile*[4];
0048         Histos_Name[0] = "APV_Gain";                        legend.push_back("");                       Files[0] = CRAFT;
0049         DrawSuperposedHistos(Files, Histos_Name, legend, 1, "",  "APV Pair Index", "Gain", 0, 0, 0.0, 2.0, save, "Pictures/CRAFT_APV_Gain.png",true);
0050 
0051         DrawTH2DZ(CRAFT, "APV_Charge" ,"", "", "APV Pair Index", "Charge", 0,0,0,0,save,"Pictures/CRAFT_APV_Charge.png", false);
0052 
0053 
0054         char** Histos_Name = new char*[4];                  std::vector<char*> legend;legend.clear();   TFile** Files = new TFile*[4];
0055         Histos_Name[0] = "MPVs320";                         legend.push_back("320 #mum");               Files[0] = CRAFT;
0056         Histos_Name[1] = "MPVs500";                         legend.push_back("500 #mum");               Files[1] = CRAFT;
0057         Histos_Name[2] = "MPVs";                            legend.push_back("320 + 500 #mum");         Files[2] = CRAFT;
0058         DrawSuperposedHistos(Files, Histos_Name, legend, 1, "",  "MPV (ADC/mm)", "a.u.", 0, 500, 0, 0, save, "Pictures/CRAFT_MPVs.png",false);
0059         delete [] Histos_Name; Histos_Name=NULL;
0060 
0061         char** Histos_Name = new char*[4];                  std::vector<char*> legend;legend.clear();   TFile** Files = new TFile*[4];
0062         Histos_Name[0] = "MPV_Vs_PathLength";               legend.push_back("");                       Files[0] = CRAFT;
0063         DrawSuperposedHistos(Files, Histos_Name, legend, 1, "",  "Pathlength", "MPV (ADC/mm)", 0, 0, 0, 400, save, "Pictures/CRAFT_MPV_Vs_PathLength.png",false);
0064         delete [] Histos_Name; Histos_Name=NULL;     
0065         DrawTH2DZ(CRAFT, "Charge_Vs_PathLength" ,"", "", "PathLength", "Charge", 0,0,0,0,save,"Pictures/CRAFT_Charge_Vs_PathLength.png", false);
0066 
0067 
0068         char** Histos_Name = new char*[4];                  std::vector<char*> legend;legend.clear();   TFile** Files = new TFile*[4];
0069         Histos_Name[0] = "MPV_Vs_PathLength320";            legend.push_back("");                       Files[0] = CRAFT;
0070         DrawSuperposedHistos(Files, Histos_Name, legend, 1, "",  "Pathlength", "MPV (ADC/mm)", 0, 0, 0, 400, save, "Pictures/CRAFT_MPV_Vs_PathLength320.png",false);
0071         delete [] Histos_Name; Histos_Name=NULL;
0072         DrawTH2DZ(CRAFT, "Charge_Vs_PathLength320" ,"", "", "PathLength", "Charge", 0,0,0,0,save,"Pictures/CRAFT_Charge_Vs_PathLength320.png", false);
0073 
0074 
0075         char** Histos_Name = new char*[4];                  std::vector<char*> legend;legend.clear();   TFile** Files = new TFile*[4];
0076         Histos_Name[0] = "MPV_Vs_PathLength500";            legend.push_back("");                       Files[0] = CRAFT;
0077         DrawSuperposedHistos(Files, Histos_Name, legend, 1, "",  "Pathlength", "MPV (ADC/mm)", 0, 0, 0, 400, save, "Pictures/CRAFT_MPV_Vs_PathLength500.png",false);
0078         delete [] Histos_Name; Histos_Name=NULL;
0079         DrawTH2DZ(CRAFT, "Charge_Vs_PathLength500" ,"", "", "PathLength", "Charge", 0,0,0,0,save,"Pictures/CRAFT_Charge_Vs_PathLength500.png", false);
0080 
0081 
0082 
0083         char** Histos_Name = new char*[4];                  std::vector<char*> legend;legend.clear();   TFile** Files = new TFile*[4];
0084         Histos_Name[0] = "MPV_Vs_PathTIB";                  legend.push_back("");                       Files[0] = CRAFT;
0085         DrawSuperposedHistos(Files, Histos_Name, legend, 1, "",  "Pathlength", "MPV (ADC/mm)", 0, 0, 0, 400, save, "Pictures/CRAFT_MPV_Vs_PathLengthTIB.png",false);
0086         delete [] Histos_Name; Histos_Name=NULL;
0087         DrawTH2DZ(CRAFT, "Charge_Vs_PathTIB" ,"", "", "PathLength", "Charge", 0,0,0,0,save,"Pictures/CRAFT_Charge_Vs_PathLengthTIB.png", false);
0088 
0089 
0090         char** Histos_Name = new char*[4];                  std::vector<char*> legend;legend.clear();   TFile** Files = new TFile*[4];
0091         Histos_Name[0] = "MPV_Vs_PathTID";                  legend.push_back("");                       Files[0] = CRAFT;
0092         DrawSuperposedHistos(Files, Histos_Name, legend, 1, "",  "Pathlength", "MPV (ADC/mm)", 0, 0, 0, 400, save, "Pictures/CRAFT_MPV_Vs_PathLengthTID.png",false);
0093         delete [] Histos_Name; Histos_Name=NULL;
0094         DrawTH2DZ(CRAFT, "Charge_Vs_PathTID" ,"", "", "PathLength", "Charge", 0,0,0,0,save,"Pictures/CRAFT_Charge_Vs_PathLengthTID.png", false);
0095 
0096 
0097         char** Histos_Name = new char*[4];                  std::vector<char*> legend;legend.clear();   TFile** Files = new TFile*[4];
0098         Histos_Name[0] = "MPV_Vs_PathTOB";                  legend.push_back("");                       Files[0] = CRAFT;
0099         DrawSuperposedHistos(Files, Histos_Name, legend, 1, "",  "Pathlength", "MPV (ADC/mm)", 0, 0, 0, 400, save, "Pictures/CRAFT_MPV_Vs_PathLengthTOB.png",false);
0100         delete [] Histos_Name; Histos_Name=NULL;
0101         DrawTH2DZ(CRAFT, "Charge_Vs_PathTOB" ,"", "", "PathLength", "Charge", 0,0,0,0,save,"Pictures/CRAFT_Charge_Vs_PathLengthTOB.png", false);
0102 
0103 
0104 
0105         char** Histos_Name = new char*[4];                  std::vector<char*> legend;legend.clear();   TFile** Files = new TFile*[4];
0106         Histos_Name[0] = "MPV_Vs_PathTEC1";                  legend.push_back("");                       Files[0] = CRAFT;
0107         DrawSuperposedHistos(Files, Histos_Name, legend, 1, "",  "Pathlength", "MPV (ADC/mm)", 0, 0, 0, 400, save, "Pictures/CRAFT_MPV_Vs_PathLengthTEC320.png",false);
0108         delete [] Histos_Name; Histos_Name=NULL;
0109         DrawTH2DZ(CRAFT, "Charge_Vs_PathTEC1" ,"", "", "PathLength", "Charge", 0,0,0,0,save,"Pictures/CRAFT_Charge_Vs_PathTEC320.png", false);
0110 
0111 
0112         char** Histos_Name = new char*[4];                  std::vector<char*> legend;legend.clear();   TFile** Files = new TFile*[4];
0113         Histos_Name[0] = "MPV_Vs_PathTEC2";                  legend.push_back("");                       Files[0] = CRAFT;
0114         DrawSuperposedHistos(Files, Histos_Name, legend, 1, "",  "Pathlength", "MPV (ADC/mm)", 0, 0, 0, 400, save, "Pictures/CRAFT_MPV_Vs_PathLengthTEC500.png",false);
0115         delete [] Histos_Name; Histos_Name=NULL;
0116         DrawTH2DZ(CRAFT, "Charge_Vs_PathTEC2" ,"", "", "PathLength", "Charge", 0,0,0,0,save,"Pictures/CRAFT_Charge_Vs_PathTEC500.png", false);
0117 
0118 
0119         char** Histos_Name = new char*[4];                  std::vector<char*> legend;legend.clear();   TFile** Files = new TFile*[4];
0120         Histos_Name[0] = "FirstStrip";                      legend.push_back("");                       Files[0] = CRAFT;
0121         DrawSuperposedHistos(Files, Histos_Name, legend, 1, "",  "FirstStrip", "u.a.", 0, 0, 0, 0, save, "Pictures/CRAFT_FirstStrip.png",false);
0122         delete [] Histos_Name; Histos_Name=NULL;
0123 
0124 
0125         char** Histos_Name = new char*[4];                  std::vector<char*> legend;legend.clear();   TFile** Files = new TFile*[4];
0126         Histos_Name[0] = "Error_Vs_Entries";                legend.push_back("");                       Files[0] = CRAFT;
0127         DrawTH2D(Files, Histos_Name,legend, "", "#Entries in Charge Distribution", "Fit Error on the MPV (ADC/mm)", 0,1000,0,0,save,"Pictures/CRAFT_Error_Vs_Entries.png");
0128         delete [] Histos_Name; Histos_Name=NULL;
0129 
0130         char** Histos_Name = new char*[4];                  std::vector<char*> legend;legend.clear();   TFile** Files = new TFile*[4];
0131         Histos_Name[0] = "Error_Vs_MPV";                    legend.push_back("");                       Files[0] = CRAFT;
0132         DrawTH2D(Files, Histos_Name,legend, "", "MPV (ADC/mm)", "Fit Error on the MPV (ADC/mm)", 0,1000,0,0,save,"Pictures/CRAFT_Error_Vs_MPV.png");
0133         delete [] Histos_Name; Histos_Name=NULL;
0134 
0135         char** Histos_Name = new char*[4];                  std::vector<char*> legend;legend.clear();   TFile** Files = new TFile*[4];
0136         Histos_Name[0] = "Error_Vs_Eta";                    legend.push_back("");                       Files[0] = CRAFT;
0137         DrawTH2D(Files, Histos_Name,legend, "", "module #eta", "Fit Error on the MPV (ADC/mm)", 0,0,0,0,save,"Pictures/CRAFT_Error_Vs_Eta.png");
0138         delete [] Histos_Name; Histos_Name=NULL;
0139 
0140         char** Histos_Name = new char*[4];                  std::vector<char*> legend;legend.clear();   TFile** Files = new TFile*[4];
0141         Histos_Name[0] = "Error_Vs_Phi";                    legend.push_back("");                       Files[0] = CRAFT;
0142         DrawTH2D(Files, Histos_Name,legend, "", "module #phi", "Fit Error on the MPV (ADC/mm)", 0,0,0,0,save,"Pictures/CRAFT_Error_Vs_Phi.png");
0143         delete [] Histos_Name; Histos_Name=NULL;
0144 
0145 
0146         char** Histos_Name = new char*[4];                  std::vector<char*> legend;legend.clear();   TFile** Files = new TFile*[4];
0147         Histos_Name[0] = "NoMPV_Vs_EtaPhi";                 legend.push_back("");                       Files[0] = CRAFT;
0148         DrawTH2D(Files, Histos_Name,legend, "", "module #eta", "module #phi", 0,0,0,0,save,"Pictures/CRAFT_NoMPV_Vs_EtaPhi.png");
0149         delete [] Histos_Name; Histos_Name=NULL;
0150 
0151 
0152         char** Histos_Name = new char*[4];                  std::vector<char*> legend;legend.clear();   TFile** Files = new TFile*[4];
0153         Histos_Name[0] = "Charge_TEC";                      legend.push_back("TEC");                    Files[0] = CRAFT;
0154         Histos_Name[1] = "Charge_TIB";                      legend.push_back("TIB");                    Files[1] = CRAFT;
0155         Histos_Name[2] = "Charge_TID";                      legend.push_back("TID");                    Files[2] = CRAFT;
0156         Histos_Name[3] = "Charge_TOB";                      legend.push_back("TOB");                    Files[3] = CRAFT;
0157         DrawSuperposedHistos(Files, Histos_Name,legend, 1, "", "Normalized Charge (ADC/mm)", "u.a.", 0,800,0,0, save, "Pictures/CRAFT_Charge_Vs_SubDet.png", false);
0158         delete [] Histos_Name; Histos_Name=NULL;  
0159 
0160         char** Histos_Name = new char*[4];                  std::vector<char*> legend;legend.clear();   TFile** Files = new TFile*[4];
0161         Histos_Name[0] = "Charge_TEC+";                     legend.push_back("TEC+");                    Files[0] = CRAFT;
0162         Histos_Name[1] = "Charge_TEC-";                     legend.push_back("TEC-");                    Files[1] = CRAFT;
0163         Histos_Name[2] = "Charge_TID+";                     legend.push_back("TID+");                    Files[2] = CRAFT;
0164         Histos_Name[3] = "Charge_TID-";                     legend.push_back("TID-");                    Files[3] = CRAFT;
0165         DrawSuperposedHistos(Files, Histos_Name,legend, 1, "", "Normalized Charge (ADC/mm)", "u.a.", 0,800,0,0, save, "Pictures/CRAFT_Charge_Vs_SubDetSided.png", false);
0166         delete [] Histos_Name; Histos_Name=NULL;
0167 
0168 
0169 
0170 }
0171 
0172 
0173 void PrintJobInfo(TFile* File){
0174    TH1D* JobInfo = File->FindObjectAny("JobInfo");
0175 
0176    printf("NEvent = %i\n",  JobInfo->GetBinContent(JobInfo->GetXaxis()->FindBin(1)));
0177    printf("SRun   = %i\n",  JobInfo->GetBinContent(JobInfo->GetXaxis()->FindBin(3)));
0178    printf("SEvent = %i\n",  JobInfo->GetBinContent(JobInfo->GetXaxis()->FindBin(4)));
0179    printf("ERun   = %i\n",  JobInfo->GetBinContent(JobInfo->GetXaxis()->FindBin(6)));
0180    printf("EEvent = %i\n",  JobInfo->GetBinContent(JobInfo->GetXaxis()->FindBin(7)));
0181 
0182 }
0183 
0184 void DrawSuperposedHistos(TFile** File, char** Histos_Name, std::vector<char*> legend, int Rebin, char* Title,  char* Xlegend, char* Ylegend, double xmin, double xmax, double ymin, double ymax, bool save, char* save_path, bool special)
0185 {
0186    int Color[]    = {4,2,1,3,6,8,9,5};
0187    int Marker[]   = {21,22,23,20,20,3,2};
0188    int Style[]    = {1,5,7,9,10};
0189 
0190    int    N         = legend.size();
0191    TH1D** Histos    = new TH1D*[N];
0192 
0193    double HistoMax      = -1;
0194    int    HistoHeighest = -1;
0195 
0196    for(int i=0;i<N;i++){
0197         Histos[i] = File[i]->FindObjectAny(Histos_Name[i]);
0198 //        Histos[i] = File[i]->Get(Histos_Name[i]);
0199         Histos[i] = Histos[i]->Rebin(Rebin);
0200         Histos[i]->SetTitle();
0201         Histos[i]->SetStats(kFALSE);
0202 //        Histos[i]->SetStats(kTRUE);
0203         Histos[i]->GetXaxis()->SetTitle(Xlegend);
0204         Histos[i]->GetYaxis()->SetTitle(Ylegend);
0205         Histos[i]->GetYaxis()->SetTitleOffset(1.20);
0206         if(xmin!=xmax)Histos[i]->SetAxisRange(xmin,xmax,"X");
0207         if(ymin!=ymax)Histos[i]->SetAxisRange(ymin,ymax,"Y");
0208 //        if(i==0)Histos[i]->SetFillColor(Color[i]);
0209         Histos[i]->SetFillColor(0);
0210         Histos[i]->SetMarkerStyle(Marker[i]);
0211         Histos[i]->SetMarkerColor(Color[i]);
0212         Histos[i]->SetMarkerSize(0.5);
0213 
0214 //        Histos[i]->SetLineStyle(Style[i]);
0215         Histos[i]->SetLineColor(Color[i]);
0216         Histos[i]->SetLineWidth(2.0);
0217 
0218         if(special){
0219            Histos[i]->SetLineColor(1);
0220            Histos[i]->SetLineWidth(1.0);
0221         }
0222 
0223         if(Histos[i]->GetMaximum() >= HistoMax){
0224        HistoMax      = Histos[i]->GetMaximum();
0225            HistoHeighest = i;
0226     }
0227 
0228    }
0229 
0230    Histos[HistoHeighest]->Draw("");
0231    for(int i=0;i<N;i++){
0232         Histos[i]->Draw("Same");
0233    }
0234 
0235 
0236    if(strcmp(legend[0],"")!=0){
0237       TLegend* leg;
0238 //    leg = new TLegend(0.10,0.90,0.45,0.90 - N*0.1);
0239       leg = new TLegend(0.55,0.90,0.90,0.90 - N*0.08);
0240       leg->SetFillColor(0);
0241       if(strcmp(Title,"")!=0)leg->SetHeader(Title);
0242 
0243       for(int i=0;i<N;i++){
0244           if(strcmp(legend[i],"")==0)continue;
0245           leg->AddEntry(Histos[i], legend[i] ,"L");
0246       }
0247       leg->Draw();
0248    }
0249 
0250 
0251    if(save==1){
0252 //        char path[255]; sprintf(path,"Pictures/PNG/%s.png",save_path);  c1->SaveAs(path);
0253 //        char path[255]; sprintf(path,"Pictures/EPS/%s.eps",save_path);  c1->SaveAs(path);
0254 //        char path[255]; sprintf(path,"Pictures/C/%s.C"  ,save_path);  c1->SaveAs(path);
0255           c1->SaveAs(save_path);
0256    }
0257 }
0258 
0259 /*
0260 void DrawTH2D(TFile** File, char** Histos_Name, std::vector<char*> legend, char* Title, bool save, char* save_path)
0261 {
0262    int Color[]    = {2,4,8,1,4,6,3,9,5};
0263    int Marker[]   = {21,22,23,20,20,3,2};
0264    int Style[]    = {1,5,7,9,10};
0265 
0266    int    N         = legend.size();
0267    TH2D** Histos    = new TH2D*[N];
0268 
0269    double HistoMax      = -1;
0270    int    HistoHeighest = -1;
0271 
0272    for(int i=0;i<N;i++){
0273         Histos[i] = File[i]->Get(Histos_Name[i]);
0274         Histos[i]->SetTitle();
0275         Histos[i]->SetStats(kFALSE);
0276         Histos[i]->GetXaxis()->SetTitle("\eta");
0277         Histos[i]->GetYaxis()->SetTitle("MPV");
0278         Histos[i]->GetYaxis()->SetTitleOffset(1.20);
0279 //        Histos[i]->SetAxisRange(0,500,"X");
0280         Histos[i]->SetAxisRange(150,600,"Y");
0281         Histos[i]->SetMarkerStyle(Marker[i]);
0282         Histos[i]->SetMarkerColor(Color[i]);
0283         Histos[i]->SetMarkerSize(1.5);
0284    }
0285 
0286    TLegend* leg;
0287    leg = new TLegend(0.10,0.90,0.50,0.90-N*0.1);
0288    leg->SetFillColor(0);
0289    leg->SetHeader(Title);
0290 
0291    Histos[0]->Draw("");
0292    for(int i=0;i<N;i++){
0293         Histos[i]->Draw("Same");
0294    }
0295 
0296    for(int i=0;i<N;i++){
0297       leg->AddEntry(Histos[i], legend[i] ,"P");
0298    }
0299    leg->Draw();
0300 
0301 
0302    if(save==1){
0303 //        char path[255]; sprintf(path,"Pictures/PNG/%s.png",save_path);  c1->SaveAs(path);
0304 //        char path[255]; sprintf(path,"Pictures/EPS/%s.eps",save_path);  c1->SaveAs(path);
0305 //        char path[255]; sprintf(path,"Pictures/C/%s.C"  ,save_path);  c1->SaveAs(path);
0306            c1->SaveAs(save_path);
0307 
0308    }
0309 }
0310 */
0311 
0312 
0313 void DrawTProfile(TFile** File, char** Histos_Name, std::vector<char*> legend, char* Title, char* Xlegend, char* Ylegend, double xmin, double xmax, double ymin, double ymax,  bool save, char* save_path)
0314 {
0315    int Color[]    = {2,4,8,1,4,6,3,9,5};
0316    int Marker[]   = {21,22,23,20,20,3,2};
0317    int Style[]    = {1,5,7,9,10};
0318 
0319    int    N         = legend.size();
0320    TProfile** Histos    = new TProfile*[N];
0321 
0322    double HistoMax      = -1;
0323    int    HistoHeighest = -1;
0324 
0325    for(int i=0;i<N;i++){
0326         Histos[i] = File[i]->Get(Histos_Name[i]);
0327         Histos[i]->SetTitle();
0328         Histos[i]->SetStats(kFALSE);
0329         Histos[i]->GetXaxis()->SetTitle(Xlegend);
0330         Histos[i]->GetYaxis()->SetTitle(Ylegend);
0331         Histos[i]->GetYaxis()->SetTitleOffset(1.20);
0332         if(xmin!=xmax)Histos[i]->SetAxisRange(xmin,xmax,"X");
0333         if(ymin!=ymax)Histos[i]->SetAxisRange(ymin,ymax,"Y");
0334         Histos[i]->SetMarkerStyle(Marker[i]);
0335         Histos[i]->SetMarkerColor(Color[i]);
0336         Histos[i]->SetMarkerSize(1.5);
0337    }
0338 
0339    TLegend* leg;
0340 //   leg = new TLegend(0.10,0.90,0.50,0.90-N*0.1);
0341    leg = new TLegend(0.90,0.90,0.55,0.90-N*0.1);
0342    leg->SetFillColor(0);
0343    if(strcmp(Title,"")!=0)leg->SetHeader(Title);
0344 
0345    Histos[0]->Draw("");
0346    for(int i=0;i<N;i++){
0347         Histos[i]->Draw("Same");
0348    }
0349 
0350    for(int i=0;i<N;i++){
0351       leg->AddEntry(Histos[i], legend[i] ,"P");
0352    }
0353    leg->Draw();
0354 
0355 
0356    if(save==1){
0357 //        char path[255]; sprintf(path,"Pictures/PNG/%s.png",save_path);  c1->SaveAs(path);
0358 //        char path[255]; sprintf(path,"Pictures/EPS/%s.eps",save_path);  c1->SaveAs(path);
0359 //        char path[255]; sprintf(path,"Pictures/C/%s.C"  ,save_path);  c1->SaveAs(path);
0360            c1->SaveAs(save_path);
0361 
0362    }
0363 }
0364 
0365 
0366 void DrawTH2D(TFile** File, char** Histos_Name, std::vector<char*> legend, char* Title, char* Xlegend, char* Ylegend, double xmin, double xmax, double ymin, double ymax,  bool save, char* save_path)
0367 {
0368    DrawTH2D(File, Histos_Name, legend, Title, Xlegend, Ylegend, xmin, xmax, ymin, ymax,  save, save_path, 0.3);
0369 }
0370 
0371 
0372 void DrawTH2D(TFile** File, char** Histos_Name, std::vector<char*> legend, char* Title, char* Xlegend, char* Ylegend, double xmin, double xmax, double ymin, double ymax,  bool save, char* save_path, double MarkerSize)
0373 {
0374    int Color[]    = {4,2,1,3};
0375 //   int Color[]    = {8, 4,2,1,4,6,3,9,5};
0376    int Marker[]   = {20,22,21,23,20,3,2};
0377    int Style[]    = {1,5,7,9,10};
0378 
0379    int    N         = legend.size();
0380    TH2D** Histos    = new TH2D*[N];
0381 
0382 
0383    double HistoMax      = -1;
0384    int    HistoHeighest = -1;
0385 
0386    for(int i=0;i<N;i++){
0387         Histos[i] = File[i]->Get(Histos_Name[i]);
0388         Histos[i]->SetTitle();
0389         Histos[i]->SetStats(kFALSE);
0390         Histos[i]->GetXaxis()->SetTitle(Xlegend);
0391         Histos[i]->GetYaxis()->SetTitle(Ylegend);
0392         Histos[i]->GetYaxis()->SetTitleOffset(1.20);
0393         if(xmin!=xmax)Histos[i]->SetAxisRange(xmin,xmax,"X");
0394         if(ymin!=ymax)Histos[i]->SetAxisRange(ymin,ymax,"Y");
0395         Histos[i]->SetMarkerStyle(Marker[i]);
0396         Histos[i]->SetMarkerColor(Color[i]);
0397         Histos[i]->SetMarkerSize(MarkerSize);
0398 //        Histos[i]->SetMarkerSize(1.3);
0399 
0400    }
0401    //     Histos[1]->SetMarkerSize(MarkerSize*1.5);
0402 
0403    Histos[0]->Draw("");
0404    for(int i=0;i<N;i++){
0405         Histos[i]->Draw("Same");
0406    }
0407 
0408 
0409    if(strcmp(legend[0],"")!=0){
0410       TLegend* leg;
0411 //    leg = new TLegend(0.10,0.90,0.50,0.90-N*0.1);
0412       leg = new TLegend(0.90,0.90,0.55,0.90-N*0.05);
0413       leg->SetFillColor(0);
0414       if(strcmp(Title,"")!=0)leg->SetHeader(Title);
0415 
0416       for(int i=0;i<N;i++){
0417          TH2D* temp = Histos[i]->Clone();
0418          temp->SetMarkerSize(1.3);
0419          leg->AddEntry(temp, legend[i] ,"P");
0420 //       Histos[i]->SetMarkerSize(MarkerSize);
0421       }
0422       leg->Draw();
0423    }
0424 
0425 
0426    if(save==1){
0427 //        char path[255]; sprintf(path,"Pictures/PNG/%s.png",save_path);  c1->SaveAs(path);
0428 //        char path[255]; sprintf(path,"Pictures/EPS/%s.eps",save_path);  c1->SaveAs(path);
0429 //        char path[255]; sprintf(path,"Pictures/C/%s.C"  ,save_path);  c1->SaveAs(path);
0430            c1->SaveAs(save_path);
0431 
0432    }
0433    delete [] Histos;
0434 }
0435 
0436 void DrawTH2DZ(TFile* File, char* Histos_Name, char* legend, char* Title, char* Xlegend, char* Ylegend, double xmin, double xmax, double ymin, double ymax,  bool save, char* save_path, bool Normalization)
0437 {
0438    TH2D* Histos = File->Get(Histos_Name);
0439    Histos->SetTitle();
0440    Histos->SetStats(kFALSE);
0441    Histos->GetXaxis()->SetTitle(Xlegend);
0442    Histos->GetYaxis()->SetTitle(Ylegend);
0443    Histos->GetYaxis()->SetTitleOffset(1.20);
0444 //   Histos->GetYaxis()->SetTitleOffset(1.0);
0445    if(xmin!=xmax)Histos->SetAxisRange(xmin,xmax,"X");
0446    if(ymin!=ymax)Histos->SetAxisRange(ymin,ymax,"Y");
0447 
0448    if(Normalization){
0449       for(int x=0;x<Histos->GetXaxis()->GetNbins();x++){     
0450          TH1D* tmp = Histos->ProjectionY("",x,x);
0451      double Integral = tmp->Integral();
0452          if(Integral==0)continue;
0453          double Factor = 1/Integral;
0454          for(int y=0;y<Histos->GetYaxis()->GetNbins();y++){
0455             Histos->SetBinContent(x,y, Histos->GetBinContent(x,y)*Factor );
0456             Histos->SetBinError  (x,y, Histos->GetBinError  (x,y)*Factor );
0457          }
0458       }
0459    }
0460 
0461 
0462 
0463 
0464    Histos->Draw("COLZ");
0465    gPad->SetLogz(1);
0466 /*   c1->Update();
0467    TPaletteAxis* palette = (TPaletteAxis*)Histos->GetListOfFunctions()->FindObject("palette");
0468    palette->SetLabelOffset(0.1);
0469    palette->SetTitleOffset(0.1);
0470    c1->Modified();
0471 */
0472 
0473   
0474    if(save==1){
0475 //        char path[255]; sprintf(path,"Pictures/PNG/%s.png",save_path);  c1->SaveAs(path);
0476 //        char path[255]; sprintf(path,"Pictures/EPS/%s.eps",save_path);  c1->SaveAs(path);
0477 //        char path[255]; sprintf(path,"Pictures/C/%s.C"  ,save_path);  c1->SaveAs(path);
0478            c1->SaveAs(save_path);
0479 
0480    }
0481 }
0482 
0483