Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef RecoLocalMuon_Histograms_H
0002 #define RecoLocalMuon_Histograms_H
0003 
0004 /** \class Histograms
0005  *  Collection of histograms for DT RecHit and Segment test.
0006  *  This interface is intended only for reading histogram sets from root files. cf ../plugins/Histograms.h
0007  *
0008  *  \author S. Bolognesi and G. Cerminara - INFN Torino
0009  */
0010 
0011 
0012 #include "TH1F.h"
0013 #include "TH2F.h"
0014 #include "TFile.h"
0015 #include "TString.h"
0016 #include "TMath.h"
0017 
0018 #include <string>
0019 #include <iostream>
0020 #include <math.h>
0021 
0022 
0023 // Retrieve standard name string for histogram sets. Note that validation plots are currently done per abs(wheel).
0024 TString buildName(int wheel, int station, int sl) {
0025   TString name_;
0026   if(sl == 0) {
0027     name_+="W";    
0028   } else if(sl == 2) {
0029     name_+="RZ_W";
0030   } else {
0031     name_+="RPhi_W";
0032   }
0033   if (station==0) {
0034     name_+=long(abs(wheel));
0035   } else {
0036     name_=name_+long(abs(wheel))+"_St"+long(station);
0037   }
0038   return name_;
0039 }
0040   
0041 
0042 
0043 
0044 //---------------------------------------------------------------------------------------
0045 /// A set of histograms of residuals and pulls for 1D RecHits
0046 class HRes1DHit{
0047   public:
0048 
0049   HRes1DHit(TFile* file, int wheel, int station, int sl, const TString& step){
0050     TString name_=step;
0051     name_+=buildName(wheel,station,sl);
0052     initFromFile(name_,file);
0053   }
0054   
0055 
0056   HRes1DHit(TString name_, TFile* file){
0057     initFromFile(name_,file);
0058   }
0059   
0060 
0061   void initFromFile(TString name_, TFile* file){
0062     name=name_;
0063     hDist          = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/1DRecHits/Res/1D_"+name+"_hDist");
0064     hRes           = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/1DRecHits/Res/1D_"+name+"_hRes");
0065     hResSt[0]           = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/1DRecHits/Res/1D_"+name+"_hResMB1");
0066     hResSt[1]           = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/1DRecHits/Res/1D_"+name+"_hResMB2");
0067     hResSt[2]           = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/1DRecHits/Res/1D_"+name+"_hResMB3");
0068     hResSt[3]           = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/1DRecHits/Res/1D_"+name+"_hResMB4");
0069     hResVsEta      = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/1DRecHits/Res/1D_"+name+"_hResVsEta");
0070     hResVsPhi      = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/1DRecHits/Res/1D_"+name+"_hResVsPhi");
0071     hResVsPos      = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/1DRecHits/Res/1D_"+name+"_hResVsPos");
0072     hResVsAngle    = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/1DRecHits/Res/1D_"+name+"_hResVsAngle");
0073     hResVsDistFE   = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/1DRecHits/Res/1D_"+name+"_hResVsDistFE");
0074     hPull          = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/1DRecHits/Pull/1D_"+name+"_hPull");
0075     hPullSt[0]           = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/1DRecHits/Pull/1D_"+name+"_hPullMB1");
0076     hPullSt[1]           = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/1DRecHits/Pull/1D_"+name+"_hPullMB2");
0077     hPullSt[2]           = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/1DRecHits/Pull/1D_"+name+"_hPullMB3");
0078     hPullSt[3]           = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/1DRecHits/Pull/1D_"+name+"_hPullMB4");
0079     hPullVsPos     = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/1DRecHits/Pull/1D_"+name+"_hPullVsPos");
0080     hPullVsAngle   = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/1DRecHits/Pull/1D_"+name+"_hPullVsAngle");
0081     hPullVsDistFE  = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/1DRecHits/Pull/1D_"+name+"_hPullVsDistFE");
0082 
0083     if (hRes) {
0084       hRes->SetXTitle("|d_{hit}|-|d_{true}| (cm)");
0085       hResVsPos->SetXTitle("|d_{true}| (cm)");
0086       hResVsPos->SetYTitle("|d_{hit}|-|d_{true}| (cm)");
0087       hResVsAngle->SetXTitle("#alpha_{true} (rad)");
0088       hResVsAngle->SetYTitle("|d_{hit}|-|d_{true}| (cm)");
0089     }
0090   }
0091 
0092 
0093     ~HRes1DHit(){}
0094 
0095     void Fill(float distSimHit,
0096               float thetaSimHit,
0097               float distFESimHit,
0098               float distRecHit,
0099               float etaSimHit,
0100               float phiSimHit,
0101               float errRecHit) {
0102       // Reso, pull
0103       hDist->Fill(distRecHit);
0104       float res = distRecHit-distSimHit;
0105       hRes->Fill(res);
0106       hResVsEta->Fill(etaSimHit,res);
0107       hResVsPhi->Fill(phiSimHit,res);
0108       hResVsPos->Fill(distSimHit,res);
0109       hResVsAngle->Fill(thetaSimHit,res);
0110       hResVsDistFE->Fill(distFESimHit,res);
0111       if(errRecHit!=0) {
0112         float pull=res/errRecHit;
0113         hPull->Fill(pull);
0114         hPullVsPos->Fill(distSimHit,pull);
0115         hPullVsAngle->Fill(thetaSimHit,pull);
0116         hPullVsDistFE->Fill(distFESimHit,pull);
0117       }
0118       else std::cout<<"Error: RecHit error = 0" << std::endl;
0119     }
0120 
0121   public:
0122     TH1F* hDist;
0123     TH1F* hRes;
0124     TH1F* hResSt[4];
0125     TH2F* hResVsEta;
0126     TH2F* hResVsPhi;
0127     TH2F* hResVsPos;
0128     TH2F* hResVsAngle;
0129     TH2F* hResVsDistFE;
0130 
0131     TH1F* hPull;
0132     TH1F* hPullSt[4];
0133     TH2F* hPullVsPos;
0134     TH2F* hPullVsAngle;
0135     TH2F* hPullVsDistFE;
0136 
0137     TString name;
0138 
0139 };
0140 
0141 
0142 //---------------------------------------------------------------------------------------
0143 /// A set of histograms for efficiency 1D DT RecHits
0144 class HEff1DHit{
0145   public:
0146   
0147     HEff1DHit (TFile* file, int wheel, int station, int sl, const TString& step){
0148       TString name_=step;
0149       name_+=buildName(wheel,station,sl);
0150       initFromFile(name_,file);
0151     }
0152   
0153 
0154     HEff1DHit (TString name_, TFile* file){
0155       initFromFile(name_,file);
0156     }
0157   
0158     void initFromFile (TString name_, TFile* file){
0159       name=name_;
0160 
0161       hEtaMuSimHit        = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/1DRecHits/1D_"+name+"_hEtaMuSimHit");
0162       hEtaRecHit          = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/1DRecHits/1D_"+name+"_hEtaRecHit");
0163       hEffVsEta           = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/1DRecHits/1D_"+name+"_hEffVsEta");
0164 
0165       hPhiMuSimHit        = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/1DRecHits/1D_"+name+"_hPhiMuSimHit");
0166       hPhiRecHit          = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/1DRecHits/1D_"+name+"_hPhiRecHit");
0167       hEffVsPhi           = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/1DRecHits/1D_"+name+"_hEffVsPhi");
0168 
0169       hDistMuSimHit       = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/1DRecHits/1D_"+name+"_hDistMuSimHit");
0170       hDistRecHit         = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/1DRecHits/1D_"+name+"_hDistRecHit");
0171       hEffVsDist          = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/1DRecHits/1D_"+name+"_hEffVsDist");
0172 
0173       ComputeEfficiency();
0174 
0175     }
0176 
0177 
0178     ~HEff1DHit(){}
0179 
0180     void Fill(float distSimHit,
0181               float etaSimHit,
0182               float phiSimHit,
0183               bool fillRecHit) {
0184 
0185       hEtaMuSimHit->Fill(etaSimHit);
0186       hPhiMuSimHit->Fill(phiSimHit);
0187       hDistMuSimHit->Fill(distSimHit);
0188       if(fillRecHit) {
0189         hEtaRecHit->Fill(etaSimHit);
0190         hPhiRecHit->Fill(phiSimHit);
0191         hDistRecHit->Fill(distSimHit);
0192       }
0193     }
0194 
0195 
0196 
0197     void ComputeEfficiency() {
0198 
0199       if (hEffVsEta!=0 || hEffVsPhi!=0 || hEffVsDist!=0) {
0200     cout << "ComputeEfficiency: histogram already present" << endl;
0201     abort();
0202       }
0203       
0204       hEffVsEta = (TH1F *) hEtaRecHit->Clone();
0205       hEffVsEta->SetName("1D_"+name+"_hEffVsEta");
0206       hEffVsEta->SetTitle("1D RecHit Efficiency as a function of Eta");
0207       hEffVsEta->Divide(hEtaMuSimHit);
0208       // Set the error accordingly to binomial statistics
0209       int nBinsEta = hEffVsEta->GetNbinsX();
0210       for(int bin = 1; bin <=  nBinsEta; bin++) {
0211         float nSimHit = hEtaMuSimHit->GetBinContent(bin);
0212         float eff = hEffVsEta->GetBinContent(bin);
0213         float error = 0;
0214         if(nSimHit != 0) {
0215           error = sqrt(eff*(1-eff)/nSimHit);
0216         }
0217         hEffVsEta->SetBinError(bin, error);
0218       }
0219 
0220       hEffVsPhi = (TH1F *) hPhiRecHit->Clone();
0221       hEffVsPhi->SetName("1D_"+name+"_hEffVsPhi");
0222       hEffVsPhi->SetTitle("1D RecHit Efficiency as a function of Phi");
0223       hEffVsPhi->Divide(hPhiMuSimHit);
0224       // Set the error accordingly to binomial statistics
0225       int nBinsPhi = hEffVsPhi->GetNbinsX();
0226       for(int bin = 1; bin <=  nBinsPhi; bin++) {
0227         float nSimHit = hPhiMuSimHit->GetBinContent(bin);
0228         float eff = hEffVsPhi->GetBinContent(bin);
0229         float error = 0;
0230         if(nSimHit != 0) {
0231           error = sqrt(eff*(1-eff)/nSimHit);
0232         }
0233         hEffVsPhi->SetBinError(bin, error);
0234       }
0235 
0236       hEffVsDist = (TH1F *) hDistRecHit->Clone();
0237       hEffVsDist->SetName("1D_"+name+"_hEffVsDist");
0238       hEffVsDist->SetTitle("1D RecHit Efficiency as a function of Dist");
0239       hEffVsDist->Divide(hDistMuSimHit);
0240       // Set the error accordingly to binomial statistics
0241       int nBinsDist = hEffVsDist->GetNbinsX();
0242       for(int bin = 1; bin <=  nBinsDist; bin++) {
0243         float nSimHit = hDistMuSimHit->GetBinContent(bin);
0244         float eff = hEffVsDist->GetBinContent(bin);
0245         float error = 0;
0246         if(nSimHit != 0) {
0247           error = sqrt(eff*(1-eff)/nSimHit);
0248         }
0249         hEffVsDist->SetBinError(bin, error);
0250       }
0251     }
0252 
0253 
0254   public:
0255     TH1F* hEtaMuSimHit;
0256     TH1F* hEtaRecHit;
0257     TH1F* hEffVsEta;
0258 
0259     TH1F* hPhiMuSimHit;
0260     TH1F* hPhiRecHit;
0261     TH1F* hEffVsPhi;
0262 
0263     TH1F* hDistMuSimHit;
0264     TH1F* hDistRecHit;
0265     TH1F* hEffVsDist;
0266 
0267     TString name;
0268 
0269 };
0270 
0271 //---------------------------------------------------------------//
0272 
0273 // Histos of residuals for 2D rechits
0274 class HRes2DHit{
0275   public:
0276     HRes2DHit (TString name_, TFile* file){
0277       name=name_;
0278 
0279       hRecAngle = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/2DSegments/2D_"+name+"_hRecAngle");
0280       hSimAngle = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/2DSegments/2D_"+name+"_hSimAngle");
0281       hRecVsSimAngle = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/2DSegments/2D_"+name+"_hRecVsSimAngle");
0282       hResAngle = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/2DSegments/2D_"+name+"_hResAngle");
0283       hResAngleVsEta = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/2DSegments/2D_"+name+"_hResAngleVsEta");
0284       hResAngleVsPhi = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/2DSegments/2D_"+name+"_hResAngleVsPhi");
0285       hResPos = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/2DSegments/2D_"+name+"_hResPos");
0286       hResPosVsEta = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/2DSegments/2D_"+name+"_hResPosVsEta");
0287       hResPosVsPhi = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/2DSegments/2D_"+name+"_hResPosVsPhi");
0288       hResPosVsResAngle = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/2DSegments/2D_"+name+"_hResPosVsResAngle");
0289       hPullAngle = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/2DSegments/2D_"+name+"_hPullAngle");
0290       hPullPos = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/2DSegments/2D_"+name+"_hPullPos");
0291 
0292     }
0293 
0294 
0295     ~HRes2DHit(){}
0296 
0297     void Fill(float angleSimSegment,
0298               float angleRecSegment,
0299               float posSimSegment,
0300               float posRecSegment,
0301               float etaSimSegment,
0302               float phiSimSegment,
0303               float sigmaPos,
0304               float sigmaAngle) {
0305 
0306       hRecAngle->Fill(angleRecSegment);
0307       hSimAngle->Fill(angleSimSegment);
0308       hRecVsSimAngle->Fill(angleSimSegment, angleRecSegment);
0309       float resAngle = angleRecSegment-angleSimSegment;
0310       hResAngle->Fill(resAngle);
0311       hResAngleVsEta->Fill(etaSimSegment, resAngle);
0312       hResAngleVsPhi->Fill(phiSimSegment, resAngle);
0313       float resPos = posRecSegment-posSimSegment;
0314       hResPos->Fill(resPos);
0315       hResPosVsEta->Fill(etaSimSegment, resPos);
0316       hResPosVsPhi->Fill(phiSimSegment, resPos);
0317       hResPosVsResAngle->Fill(resAngle, resPos);
0318       hPullAngle->Fill(resAngle/sigmaAngle);
0319       hPullPos->Fill(resPos/sigmaPos);
0320     }
0321 
0322   public:
0323     TH1F *hRecAngle;
0324     TH1F *hSimAngle;
0325     TH2F *hRecVsSimAngle;
0326     TH1F *hResAngle;
0327     TH2F *hResAngleVsEta;
0328     TH2F *hResAngleVsPhi;
0329     TH1F *hResPos;
0330     TH2F *hResPosVsEta;
0331     TH2F *hResPosVsPhi;
0332     TH2F *hResPosVsResAngle;
0333     TH1F *hPullAngle;
0334     TH1F *hPullPos;
0335     TString name;
0336 
0337 };
0338 
0339 //--------------------------------------------------------------------------------//
0340 
0341 // Histos for 2D RecHit efficiency
0342 class HEff2DHit{
0343   public:
0344 
0345     HEff2DHit (TString name_, TFile* file){
0346       name=name_;
0347       hEtaSimSegm = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/2DSegments/2D_"+name+"_hEtaSimSegm");
0348       hEtaRecHit = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/2DSegments/2D_"+name+"_hEtaRecHit");
0349       hEffVsEta = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/2DSegments/2D_"+name+"_hEffVsEta");
0350 
0351       hPhiSimSegm = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/2DSegments/2D_"+name+"_hPhiSimSegm");
0352       hPhiRecHit = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/2DSegments/2D_"+name+"_hPhiRecHit");
0353       hEffVsPhi = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/2DSegments/2D_"+name+"_hEffVsPhi");
0354 
0355       hPosSimSegm = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/2DSegments/2D_"+name+"_hPosSimSegm");
0356       hPosRecHit = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/2DSegments/2D_"+name+"_hPosRecHit");
0357       hEffVsPos = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/2DSegments/2D_"+name+"_hEffVsPos");
0358 
0359       hAngleSimSegm = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/2DSegments/2D_"+name+"_hAngleSimSegm");
0360       hAngleRecHit = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/2DSegments/2D_"+name+"_hAngleRecHit");
0361       hEffVsAngle = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/2DSegments/2D_"+name+"_hEffVsAngle");
0362     }
0363 
0364 
0365     ~HEff2DHit(){}
0366 
0367     void Fill(float etaSimSegm,
0368               float phiSimSegm,
0369               float posSimSegm,
0370               float angleSimSegm,
0371               bool fillRecHit) {
0372 
0373       hEtaSimSegm->Fill(etaSimSegm);       
0374       hPhiSimSegm->Fill(phiSimSegm);   
0375       hPosSimSegm->Fill(posSimSegm);   
0376       hAngleSimSegm->Fill(angleSimSegm); 
0377 
0378       if(fillRecHit) {
0379         hEtaRecHit->Fill(etaSimSegm);    
0380         hPhiRecHit->Fill(phiSimSegm);    
0381         hPosRecHit->Fill(posSimSegm);    
0382         hAngleRecHit->Fill(angleSimSegm);  
0383       }
0384     }
0385 
0386 
0387 
0388     void ComputeEfficiency() {
0389 
0390       hEffVsEta = (TH1F *) hEtaRecHit->Clone();
0391       hEffVsEta->SetName("2D_"+name+"_hEffVsEta");
0392       hEffVsEta->SetTitle("2D RecHit Efficiency as a function of Eta");
0393       hEffVsEta->Divide(hEtaSimSegm);
0394       // Set the error accordingly to binomial statistics
0395       int nBinsEta = hEffVsEta->GetNbinsX();
0396       for(int bin = 1; bin <=  nBinsEta; bin++) {
0397         float nSimHit = hEtaSimSegm->GetBinContent(bin);
0398         float eff = hEffVsEta->GetBinContent(bin);
0399         float error = 0;
0400         if(nSimHit != 0) {
0401           error = sqrt(eff*(1-eff)/nSimHit);
0402         }
0403         hEffVsEta->SetBinError(bin, error);
0404       }
0405 
0406       hEffVsPhi = (TH1F *) hPhiRecHit->Clone();
0407       hEffVsPhi->SetName("2D_"+name+"_hEffVsPhi");
0408       hEffVsPhi->SetTitle("2D RecHit Efficiency as a function of Phi");
0409       hEffVsPhi->Divide(hPhiSimSegm);
0410       // Set the error accordingly to binomial statistics
0411       int nBinsPhi = hEffVsPhi->GetNbinsX();
0412       for(int bin = 1; bin <=  nBinsPhi; bin++) {
0413         float nSimHit = hPhiSimSegm->GetBinContent(bin);
0414         float eff = hEffVsPhi->GetBinContent(bin);
0415         float error = 0;
0416         if(nSimHit != 0) {
0417           error = sqrt(eff*(1-eff)/nSimHit);
0418         }
0419         hEffVsPhi->SetBinError(bin, error);
0420       }
0421 
0422       hEffVsPos = (TH1F *) hPosRecHit->Clone();
0423       hEffVsPos->SetName("2D_"+name+"_hEffVsPos");
0424       hEffVsPos->SetTitle("2D RecHit Efficiency as a function of position in SL");
0425       hEffVsPos->Divide(hPosSimSegm);
0426       // Set the error accordingly to binomial statistics
0427       int nBinsPos = hEffVsPos->GetNbinsX();
0428       for(int bin = 1; bin <=  nBinsPos; bin++) {
0429         float nSimHit = hPosSimSegm->GetBinContent(bin);
0430         float eff = hEffVsPos->GetBinContent(bin);
0431         float error = 0;
0432         if(nSimHit != 0) {
0433           error = sqrt(eff*(1-eff)/nSimHit);
0434         }
0435         hEffVsPos->SetBinError(bin, error);
0436       }
0437 
0438       hEffVsAngle = (TH1F *) hAngleRecHit->Clone();
0439       hEffVsAngle->SetName("2D_"+name+"_hEffVsAngle");
0440       hEffVsAngle->SetTitle("2D RecHit Efficiency as a function of angle");
0441       hEffVsAngle->Divide(hAngleSimSegm);
0442       // Set the error accordingly to binomial statistics
0443       int nBinsAngle = hEffVsAngle->GetNbinsX();
0444       for(int bin = 1; bin <=  nBinsAngle; bin++) {
0445         float nSimHit = hAngleSimSegm->GetBinContent(bin);
0446         float eff = hEffVsAngle->GetBinContent(bin);
0447         float error = 0;
0448         if(nSimHit != 0) {
0449           error = sqrt(eff*(1-eff)/nSimHit);
0450         }
0451         hEffVsAngle->SetBinError(bin, error);
0452       }
0453 
0454     }
0455 
0456 
0457   public:
0458 
0459     TH1F *hEtaSimSegm;   
0460     TH1F *hEtaRecHit;    
0461     TH1F *hEffVsEta;     
0462     TH1F *hPhiSimSegm;   
0463     TH1F *hPhiRecHit;    
0464     TH1F *hEffVsPhi;     
0465     TH1F *hPosSimSegm;   
0466     TH1F *hPosRecHit;    
0467     TH1F *hEffVsPos;     
0468     TH1F *hAngleSimSegm; 
0469     TH1F *hAngleRecHit;  
0470     TH1F *hEffVsAngle;   
0471 
0472     TString name;
0473 
0474 };
0475 //---------------------------------------------------------------------------------------
0476 // Histos of residuals for 4D rechits
0477 class HRes4DHit{
0478   public:
0479   
0480     HRes4DHit (TFile* file, int wheel, int station, int sl){
0481       initFromFile(buildName(wheel,station,sl),file);
0482     }
0483   
0484 
0485     HRes4DHit (TString name_, TFile* file){
0486       initFromFile(name_,file);
0487     }
0488   
0489 
0490     void initFromFile (TString name_, TFile* file){
0491       name=name_;
0492 
0493       hRecAlpha = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Res/4D_"+name+"_hRecAlpha");
0494       hRecBeta = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Res/4D_"+name+"_hRecBeta");
0495 
0496       hSimAlpha = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Res/4D_"+name+"_hSimAlpha");
0497       hSimBeta = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Res/4D_"+name+"_hSimBeta");
0498 
0499       hRecVsSimAlpha = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Res/4D_"+name+"_hRecVsSimAlpha");
0500       hRecVsSimBeta = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Res/4D_"+name+"_hRecVsSimBeta");
0501 
0502       hResAlpha = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Res/4D_"+name+"_hResAlpha");
0503       hResAlphaVsEta = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Res/4D_"+name+"_hResAlphaVsEta");
0504       hResAlphaVsPhi = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Res/4D_"+name+"_hResAlphaVsPhi");
0505 
0506       hResBeta = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Res/4D_"+name+"_hResBeta");
0507       hResBetaVsEta = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Res/4D_"+name+"_hResBetaVsEta");
0508       hResBetaVsPhi = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Res/4D_"+name+"_hResBetaVsPhi");
0509 
0510       hResX = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Res/4D_"+name+"_hResX");
0511       hResXVsEta = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Res/4D_"+name+"_hResXVsEta");
0512       hResXVsPhi = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Res/4D_"+name+"_hResXVsPhi");
0513 
0514       hResY = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Res/4D_"+name+"_hResY");
0515       hResYVsEta = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Res/4D_"+name+"_hResYVsEta");
0516       hResYVsPhi = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Res/4D_"+name+"_hResYVsPhi");
0517 
0518       hResAlphaVsResBeta = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Res/4D_"+name+"_hResAlphaVsResBeta");
0519       hResXVsResY = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Res/4D_"+name+"_hResXVsResY");
0520       hResAlphaVsResX = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Res/4D_"+name+"_hResAlphaVsResX");
0521       hResAlphaVsResY = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Res/4D_"+name+"_hResAlphaVsResY"); 
0522 
0523       hPullAlpha = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Pull/4D_"+name+"_hPullAlpha");
0524       hPullAlphaVsEta = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Pull/4D_"+name+"_hPullAlphaVsEta");
0525       hPullAlphaVsPhi = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Pull/4D_"+name+"_hPullAlphaVsPhi");
0526 
0527       hPullBeta = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Pull/4D_"+name+"_hPullBeta");
0528       hPullBetaVsEta = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Pull/4D_"+name+"_hPullBetaVsEta");
0529       hPullBetaVsPhi = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Pull/4D_"+name+"_hPullBetaVsPhi");
0530 
0531       hPullX = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Pull/4D_"+name+"_hPullX");
0532       hPullXVsEta = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Pull/4D_"+name+"_hPullXVsEta");
0533       hPullXVsPhi = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Pull/4D_"+name+"_hPullXVsPhi");
0534 
0535       hPullY = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Pull/4D_"+name+"_hPullY");
0536       hPullYVsEta = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Pull/4D_"+name+"_hPullYVsEta");
0537       hPullYVsPhi = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Pull/4D_"+name+"_hPullYVsPhi");
0538 
0539       // RX SL frame
0540       hRecBetaRZ = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Res/4D_"+name+"_hRecBetaRZ");
0541 
0542       hSimBetaRZ = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Res/4D_"+name+"_hSimBetaRZ");
0543 
0544       hRecVsSimBetaRZ = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Res/4D_"+name+"_hRecVsSimBetaRZ");
0545 
0546       hResBetaRZ = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Res/4D_"+name+"_hResBetaRZ");
0547       hResBetaVsEtaRZ = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Res/4D_"+name+"_hResBetaVsEtaRZ");
0548       hResBetaVsPhiRZ = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Res/4D_"+name+"_hResBetaVsPhiRZ");
0549 
0550       hResYRZ = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Res/4D_"+name+"_hResYRZ");
0551       hResYVsEtaRZ = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Res/4D_"+name+"_hResYVsEtaRZ");
0552       hResYVsPhiRZ = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Res/4D_"+name+"_hResYVsPhiRZ");
0553 
0554       hPullBetaRZ = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Pull/4D_"+name+"_hPullBetaRZ");
0555       hPullBetaVsEtaRZ = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Pull/4D_"+name+"_hPullBetaVsEtaRZ");
0556       hPullBetaVsPhiRZ = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Pull/4D_"+name+"_hPullBetaVsPhiRZ");
0557 
0558       hPullYRZ = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Pull/4D_"+name+"_hPullYRZ");
0559       hPullYVsEtaRZ = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Pull/4D_"+name+"_hPullYVsEtaRZ");
0560       hPullYVsPhiRZ = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/Pull/4D_"+name+"_hPullYVsPhiRZ");
0561 
0562       hHitMult = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/4D_"+name+"_hNHits");
0563       ht0      = (TH2F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/4D_"+name+"_ht0");
0564     
0565     }
0566 
0567     ~HRes4DHit(){}
0568 
0569   public:
0570 
0571     TH1F *hRecAlpha;
0572     TH1F *hRecBeta;
0573 
0574     TH1F *hSimAlpha;
0575     TH1F *hSimBeta;
0576 
0577     TH2F *hRecVsSimAlpha;
0578     TH2F *hRecVsSimBeta;
0579 
0580     TH1F *hResAlpha;
0581     TH2F *hResAlphaVsEta;
0582     TH2F *hResAlphaVsPhi;
0583 
0584     TH1F *hResBeta;
0585     TH2F *hResBetaVsEta;
0586     TH2F *hResBetaVsPhi;
0587 
0588     TH1F *hResX;
0589     TH2F *hResXVsEta;
0590     TH2F *hResXVsPhi;
0591 
0592     TH1F *hResY;
0593     TH2F *hResYVsEta;
0594     TH2F *hResYVsPhi;
0595 
0596     TH2F *hResAlphaVsResBeta;   
0597     TH2F *hResXVsResY;          
0598     TH2F *hResAlphaVsResX;      
0599     TH2F *hResAlphaVsResY;      
0600 
0601     TH1F *hPullAlpha;
0602     TH2F *hPullAlphaVsEta;
0603     TH2F *hPullAlphaVsPhi;
0604 
0605     TH1F *hPullBeta;
0606     TH2F *hPullBetaVsEta;
0607     TH2F *hPullBetaVsPhi;
0608 
0609     TH1F *hPullX;
0610     TH2F *hPullXVsEta;
0611     TH2F *hPullXVsPhi;
0612 
0613     TH1F *hPullY;
0614     TH2F *hPullYVsEta;
0615     TH2F *hPullYVsPhi;
0616 
0617     // RZ SL 
0618     TH1F *hRecBetaRZ;
0619 
0620     TH1F *hSimBetaRZ;
0621 
0622     TH2F *hRecVsSimBetaRZ;
0623 
0624     TH1F *hResBetaRZ;
0625     TH2F *hResBetaVsEtaRZ;
0626     TH2F *hResBetaVsPhiRZ;
0627 
0628     TH1F *hResYRZ;
0629     TH2F *hResYVsEtaRZ;
0630     TH2F *hResYVsPhiRZ;
0631 
0632     TH1F *hPullBetaRZ;
0633     TH2F *hPullBetaVsEtaRZ;
0634     TH2F *hPullBetaVsPhiRZ;
0635 
0636     TH1F *hPullYRZ;
0637     TH2F *hPullYVsEtaRZ;
0638     TH2F *hPullYVsPhiRZ;
0639 
0640     TH2F* hHitMult;
0641     TH2F *ht0;
0642 
0643     TString name;
0644 };
0645 
0646 //---------------------------------------------------------------------------------------
0647 /// A set of histograms for efficiency 4D RecHits
0648 class HEff4DHit{
0649   
0650  public: 
0651   
0652   HEff4DHit (TFile* file, int wheel, int station, int sl){
0653     initFromFile(buildName(wheel,station,sl),file);
0654   }
0655   
0656   
0657   HEff4DHit (TString name_, TFile* file){
0658     initFromFile(name_,file);
0659   }
0660   
0661   
0662   
0663   HEff4DHit(std::string name_){
0664     TString N = name_.c_str();
0665     name=N;
0666     
0667     hEtaSimSegm     = new TH1F("4D_"+N+"_hEtaSimSegm", "Eta of SimHit segment", 100, -1.5, 1.5);
0668     hEtaRecHit      = new TH1F("4D_"+N+"_hEtaRecHit", "Eta distribution of SimHit segment with 4D RecHit",
0669                    100, -1.5, 1.5);
0670     hEffVsEta       = 0;
0671     
0672     hPhiSimSegm     = new TH1F("4D_"+N+"_hPhiSimSegm", "Phi of SimHit segment",
0673                    100, -TMath::Pi(),TMath::Pi());
0674     hPhiRecHit      = new TH1F("4D_"+N+"_hPhiRecHit", "Phi distribution of SimHit segment with 4D RecHit",
0675                    100, -TMath::Pi(),TMath::Pi());
0676     hEffVsPhi       = 0;
0677     
0678     
0679     hXSimSegm       = new TH1F("4D_"+N+"_hXSimSegm", "X position in Chamber of SimHit segment (cm)",
0680                    100, -200, 200);
0681     hXRecHit        = new TH1F("4D_"+N+"_hXRecHit", "X position in Chamber of SimHit segment with 4D RecHit (cm)",
0682                    100, -200, 200);
0683     hEffVsX         = 0;
0684     
0685     hYSimSegm       = new TH1F("4D_"+N+"_hYSimSegm", "Y position in Chamber of SimHit segment (cm)",
0686                    100, -200, 200);
0687     hYRecHit        = new TH1F("4D_"+N+"_hYRecHit", "Y position in Chamber of SimHit segment with 4D RecHit (cm)",
0688                    100, -200, 200);
0689     hEffVsY         = 0;
0690     
0691     hAlphaSimSegm   = new TH1F("4D_"+N+"_hAlphaSimSegm", "Alpha of SimHit segment (rad)",
0692                    100, -1.5, 1.5);
0693     hAlphaRecHit    = new TH1F("4D_"+N+"_hAlphaRecHit", "Alpha of SimHit segment with 4D RecHit (rad)",
0694                    100, -1.5, 1.5);
0695     hEffVsAlpha     = 0;
0696     
0697     hBetaSimSegm   = new TH1F("4D_"+N+"_hBetaSimSegm", "Beta of SimHit segment (rad)",
0698                   100, -2, 2);
0699     hBetaRecHit    = new TH1F("4D_"+N+"_hBetaRecHit", "Beta of SimHit segment with 4D RecHit (rad)",
0700                   100, -2, 2);
0701     hEffVsBeta     = 0;
0702 
0703     hNSeg          = new TH1F(" 4D_"+N+"_hNSeg", "Number of rec segment per sim seg",
0704                                  20, 0, 20);
0705 
0706   }
0707   
0708   void initFromFile (TString name_, TFile* file){
0709   
0710     name=name_;
0711     hEtaSimSegm = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/4D_"+name+"_hEtaSimSegm");
0712     hEtaRecHit = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/4D_"+name+"_hEtaRecHit");
0713     hEffVsEta = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/4D_"+name+"_hEffVsEta");
0714 
0715       hPhiSimSegm = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/4D_"+name+"_hPhiSimSegm");
0716       hPhiRecHit = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/4D_"+name+"_hPhiRecHit");
0717       hEffVsPhi = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/4D_"+name+"_hEffVsPhi");
0718 
0719       hXSimSegm  = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/4D_"+name+"_hXSimSegm");
0720       hXRecHit  = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/4D_"+name+"_hXRecHit");
0721       hEffVsX  = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/4D_"+name+"_hEffVsX");
0722 
0723       hYSimSegm  = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/4D_"+name+"_hYSimSegm");
0724       hYRecHit  = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/4D_"+name+"_hYRecHit");
0725       hEffVsY  = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/4D_"+name+"_hEffVsY");
0726 
0727       hAlphaSimSegm  = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/4D_"+name+"_hAlphaSimSegm");
0728       hAlphaRecHit  = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/4D_"+name+"_hAlphaRecHit");
0729       hEffVsAlpha  = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/4D_"+name+"_hEffVsAlpha");
0730 
0731       hBetaSimSegm  = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/4D_"+name+"_hBetaSimSegm");
0732       hBetaRecHit  = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/4D_"+name+"_hBetaRecHit");
0733       hEffVsBeta  = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/4D_"+name+"_hEffVsBeta");
0734 
0735       hNSeg  = (TH1F *) file->Get("DQMData/Run 1/DT/Run summary/4DSegments/4D_"+name+"_hNSeg");
0736 
0737       ComputeEfficiency();
0738 
0739     }
0740 
0741 
0742     ~HEff4DHit(){}
0743 
0744     void Fill(float etaSimSegm,
0745               float phiSimSegm,
0746               float xSimSegm,
0747               float ySimSegm,
0748               float alphaSimSegm,
0749               float betaSimSegm,
0750               bool fillRecHit,
0751               int nSeg) {
0752 
0753       hEtaSimSegm->Fill(etaSimSegm);
0754       hPhiSimSegm->Fill(phiSimSegm);
0755       hXSimSegm->Fill(xSimSegm);
0756       hYSimSegm->Fill(ySimSegm);
0757       hAlphaSimSegm->Fill(alphaSimSegm);
0758       hBetaSimSegm->Fill(betaSimSegm);
0759       hNSeg->Fill(nSeg);
0760 
0761       if(fillRecHit) {
0762         hEtaRecHit->Fill(etaSimSegm);  
0763         hPhiRecHit->Fill(phiSimSegm);
0764         hXRecHit->Fill(xSimSegm);
0765         hYRecHit->Fill(ySimSegm);
0766         hAlphaRecHit->Fill(alphaSimSegm);
0767         hBetaRecHit->Fill(betaSimSegm);
0768       }
0769     }
0770 
0771 
0772 
0773     void ComputeEfficiency() {
0774 
0775       hEffVsEta = (TH1F *) hEtaRecHit->Clone();
0776       hEffVsEta->SetName("4D_"+name+"_hEffVsEta");
0777       hEffVsEta->SetTitle("4D RecHit Efficiency as a function of Eta");
0778       hEffVsEta->Divide(hEtaSimSegm);
0779       // Set the error accordingly to binomial statistics
0780       int nBinsEta = hEffVsEta->GetNbinsX();
0781       for(int bin = 1; bin <=  nBinsEta; bin++) {
0782         float nSimHit = hEtaSimSegm->GetBinContent(bin);
0783         float eff = hEffVsEta->GetBinContent(bin);
0784         float error = 0;
0785         if(nSimHit != 0) {
0786           error = sqrt(eff*(1-eff)/nSimHit);
0787         }
0788         hEffVsEta->SetBinError(bin, error);
0789       }
0790 
0791       hEffVsPhi = (TH1F *) hPhiRecHit->Clone();
0792       hEffVsPhi->SetName("4D_"+name+"_hEffVsPhi");
0793       hEffVsPhi->SetTitle("4D RecHit Efficiency as a function of Phi");
0794       hEffVsPhi->Divide(hPhiSimSegm);
0795       // Set the error accordingly to binomial statistics
0796       int nBinsPhi = hEffVsPhi->GetNbinsX();
0797       for(int bin = 1; bin <=  nBinsPhi; bin++) {
0798         float nSimHit = hPhiSimSegm->GetBinContent(bin);
0799         float eff = hEffVsPhi->GetBinContent(bin);
0800         float error = 0;
0801         if(nSimHit != 0) {
0802           error = sqrt(eff*(1-eff)/nSimHit);
0803         }
0804         hEffVsPhi->SetBinError(bin, error);
0805       }
0806 
0807       hEffVsX = (TH1F *) hXRecHit->Clone();
0808       hEffVsX->SetName("4D_"+name+"_hEffVsX");
0809       hEffVsX->SetTitle("4D RecHit Efficiency as a function of x position in Chamber");
0810       hEffVsX->Divide(hXSimSegm);
0811       // Set the error accordingly to binomial statistics
0812       int nBinsX = hEffVsX->GetNbinsX();
0813       for(int bin = 1; bin <=  nBinsX; bin++) {
0814         float nSimHit = hXSimSegm->GetBinContent(bin);
0815         float eff = hEffVsX->GetBinContent(bin);
0816         float error = 0;
0817         if(nSimHit != 0) {
0818           error = sqrt(eff*(1-eff)/nSimHit);
0819         }
0820         hEffVsX->SetBinError(bin, error);
0821       }
0822 
0823 
0824       hEffVsY = (TH1F *) hYRecHit->Clone();
0825       hEffVsY->SetName("4D_"+name+"_hEffVsY");
0826       hEffVsY->SetTitle("4D RecHit Efficiency as a function of y position in Chamber");
0827       hEffVsY->Divide(hYSimSegm);
0828       // Set the error accordingly to binomial statistics
0829       int nBinsY = hEffVsY->GetNbinsX();
0830       for(int bin = 1; bin <=  nBinsY; bin++) {
0831         float nSimHit = hYSimSegm->GetBinContent(bin);
0832         float eff = hEffVsY->GetBinContent(bin);
0833         float error = 0;
0834         if(nSimHit != 0) {
0835           error = sqrt(eff*(1-eff)/nSimHit);
0836         }
0837         hEffVsY->SetBinError(bin, error);
0838       }
0839 
0840       hEffVsAlpha = (TH1F *) hAlphaRecHit->Clone();
0841       hEffVsAlpha->SetName("4D_"+name+"_hEffVsAlpha");
0842       hEffVsAlpha->SetTitle("4D RecHit Efficiency as a function of alpha");
0843       hEffVsAlpha->Divide(hAlphaSimSegm);
0844       // Set the error accordingly to binomial statistics
0845       int nBinsAlpha = hEffVsAlpha->GetNbinsX();
0846       for(int bin = 1; bin <=  nBinsAlpha; bin++) {
0847         float nSimHit = hAlphaSimSegm->GetBinContent(bin);
0848         float eff = hEffVsAlpha->GetBinContent(bin);
0849         float error = 0;
0850         if(nSimHit != 0) {
0851           error = sqrt(eff*(1-eff)/nSimHit);
0852         }
0853         hEffVsAlpha->SetBinError(bin, error);
0854       }
0855 
0856 
0857       hEffVsBeta = (TH1F *) hBetaRecHit->Clone();
0858       hEffVsBeta->SetName("4D_"+name+"_hEffVsBeta");
0859       hEffVsBeta->SetTitle("4D RecHit Efficiency as a function of beta");
0860       hEffVsBeta->Divide(hBetaSimSegm);
0861       // Set the error accordingly to binomial statistics
0862       int nBinsBeta = hEffVsBeta->GetNbinsX();
0863       for(int bin = 1; bin <=  nBinsBeta; bin++) {
0864         float nSimHit = hBetaSimSegm->GetBinContent(bin);
0865         float eff = hEffVsBeta->GetBinContent(bin);
0866         float error = 0;
0867         if(nSimHit != 0) {
0868           error = sqrt(eff*(1-eff)/nSimHit);
0869         }
0870         hEffVsBeta->SetBinError(bin, error);
0871       }
0872     }
0873 
0874 
0875   public:
0876     TH1F *hEtaSimSegm;   
0877     TH1F *hEtaRecHit;    
0878     TH1F *hEffVsEta;     
0879     TH1F *hPhiSimSegm;   
0880     TH1F *hPhiRecHit;    
0881     TH1F *hEffVsPhi;     
0882     TH1F *hXSimSegm;     
0883     TH1F *hXRecHit;      
0884     TH1F *hEffVsX;       
0885     TH1F *hYSimSegm;     
0886     TH1F *hYRecHit;      
0887     TH1F *hEffVsY;       
0888     TH1F *hAlphaSimSegm; 
0889     TH1F *hAlphaRecHit;  
0890     TH1F *hEffVsAlpha;   
0891     TH1F *hBetaSimSegm;  
0892     TH1F *hBetaRecHit;   
0893     TH1F *hEffVsBeta;    
0894     TH1F *hNSeg;    
0895  
0896     TString name;
0897 
0898 };
0899 
0900 
0901 #endif
0902