QtCalib Class Reference

#include <QtCalib.h>

Inheritance diagram for QtCalib:

CalibBase List of all members.

Public Member Functions

 QtCalib ()
 ~QtCalib ()
void init (TObjArray *hlist, MdcCosGeom *pGeom)
void mergeHist (TFile *fhist)
void calib (MdcCalibConst *calconst, TObjArray *newXtList, TObjArray *r2tList)

Static Public Member Functions

static Double_t qtFun (Double_t *x, Double_t *par)

Private Member Functions

void renameHist ()

Private Attributes

MdcCosGeomm_pGeom
double m_qbinw [NLAYER]
double m_qmin [NLAYER]
double m_qmax [NLAYER]
double m_qtpar [NLAYER][QtOrd]
TFolder * m_fdQt
TH1F * m_hqhit [NLAYER]
TH1F * m_hqt [NLAYER][NQBin]
TFolder * m_fdQ_T
TGraphErrors * m_grqt [NLAYER]
TGraphErrors * m_grqdt [NLAYER]

Static Private Attributes

static const int QtOrd = 2
static const int NQBin = 10

Detailed Description

Definition at line 12 of file QtCalib.h.


Constructor & Destructor Documentation

QtCalib::QtCalib (  ) 

Definition at line 6 of file QtCalib.cpp.

00006                 {
00007      cout << "Calibration type: QtCalib" << endl;
00008 }

QtCalib::~QtCalib (  ) 

Definition at line 10 of file QtCalib.cpp.

00010                  {
00011 }


Member Function Documentation

void QtCalib::calib ( MdcCalibConst calconst,
TObjArray *  newXtList,
TObjArray *  r2tList 
) [virtual]

Implements CalibBase.

Definition at line 77 of file QtCalib.cpp.

References bin, CalibBase::calib(), MdcCalibConst::getQtpar(), gFgCalib, m_grqdt, m_grqt, m_hqt, m_qbinw, m_qmax, m_qmin, NLAYER, NQBin, qtFun(), QtOrd, and renameHist().

00077                                                                                     {
00078      CalibBase::calib(calconst, newXtList, r2tList);
00079 
00080      double vdr = 0.03;
00081      Stat_t entry;
00082      double qtpar;
00083      double qbcen;
00084      double tw;
00085      double deltw;
00086      double qterr;
00087      TF1* funQt = new TF1("funQt", qtFun, 200, 2000, 2);
00088 
00089      ofstream fqtlog("qtlog");
00090      for(int lay=0; lay<NLAYER; lay++){
00091           if(0 == gFgCalib[lay]) continue;
00092 
00093           fqtlog << "Layer" << lay << endl;
00094           double qtini[2];
00095           for(int ord=0; ord<QtOrd; ord++) qtini[ord] = calconst->getQtpar(lay, ord);
00096           for(int bin=0; bin<NQBin; bin++){
00097                entry = m_hqt[lay][bin]->GetEntries();
00098                if(entry > 300){
00099                     deltw = m_hqt[lay][bin] -> GetMean();
00100                     qterr = ( m_hqt[lay][bin]->GetRMS() ) / sqrt((double)entry);
00101                     deltw /= vdr;
00102                     qterr /= vdr;
00103                } else{
00104                     continue;
00105                }
00106 
00107                qbcen = ( (double)bin + 0.5 ) * m_qbinw[lay] + m_qmin[lay];
00108 //             tw = qtFun(qbcen, m_qtpar[lay]) + deltw;
00109 //             tw = (m_mdcFunSvc->getTimeWalk(lay, qbcen)) + deltw;
00110                tw = qtini[1] / sqrt(qbcen) + qtini[0] + deltw;
00111 
00112                m_grqt[lay]->SetPoint(bin, qbcen, tw);
00113                m_grqt[lay]->SetPointError(bin, 0, qterr);
00114 
00115                m_grqdt[lay]->SetPoint(bin, qbcen, deltw);
00116                m_grqdt[lay]->SetPointError(bin, 0, qterr);
00117 
00118                fqtlog << setw(3) << bin << setw(12) << deltw << setw(12) << tw
00119                       << setw(12) << qbcen << setw(12) << qterr << endl;
00120           }
00121 
00122           m_grqt[lay]->Fit("funQt", "Q+", "", m_qmin[lay], m_qmax[lay]);
00123 
00124           fqtlog << "Qtpar:  ";
00125           for(int ord=0; ord<QtOrd; ord++){
00126                qtpar = funQt->GetParameter(ord);
00127                qterr = funQt->GetParError(ord);
00128                calconst -> resetQtpar(lay, ord, qtpar);
00129 
00130                fqtlog << setw(12) << qtpar << setw(12) << qterr << endl;
00131           }
00132      } // end of layer loop
00133      fqtlog.close();
00134      renameHist();
00135      delete funQt;
00136 }

void QtCalib::init ( TObjArray *  hlist,
MdcCosGeom pGeom 
) [virtual]

Implements CalibBase.

Definition at line 13 of file QtCalib.cpp.

References bin, gQmax, gQmin, CalibBase::init(), m_fdQ_T, m_fdQt, m_grqdt, m_grqt, m_hqhit, m_hqt, m_pGeom, m_qbinw, m_qmax, m_qmin, NLAYER, and NQBin.

00013                                                      {
00014      CalibBase::init(hlist, pGeom);
00015      m_pGeom = pGeom;
00016 
00017      char hname[200];
00018      for(int lay=0; lay<NLAYER; lay++){
00019           m_qmin[lay] = gQmin[lay];
00020           m_qmax[lay] = gQmax[lay];
00021           m_qbinw[lay] = (m_qmax[lay] - m_qmin[lay]) / (double)NQBin;
00022      }
00023 
00024      m_fdQt = new TFolder("mfdQt", "fdQt");
00025      m_fdQ_T = new TFolder("mQtPlot", "QtPlot");
00026      hlist -> Add(m_fdQt);
00027      hlist -> Add(m_fdQ_T);
00028 
00029      for(int lay=0; lay<NLAYER; lay++){
00030           sprintf(hname, "mHQ_Layer%02d", lay);
00031           m_hqhit[lay] = new TH1F(hname, "", 1500, 0, 3000);
00032           m_fdQt -> Add(m_hqhit[lay]);
00033 
00034           sprintf(hname, "mHQT_Plot_lay%02d", lay);
00035           m_grqt[lay] = new TGraphErrors();
00036           m_grqt[lay]->SetName(hname);
00037           m_grqt[lay]->SetMarkerStyle(20);
00038           m_grqt[lay]->SetMarkerColor(1);
00039           m_grqt[lay]->SetLineColor(10);
00040           m_fdQ_T->Add(m_grqt[lay]);
00041 
00042           sprintf(hname, "mHQdelT_Plot_lay%02d", lay);
00043           m_grqdt[lay] = new TGraphErrors();
00044           m_grqdt[lay]->SetName(hname);
00045           m_grqdt[lay]->SetMarkerStyle(10);
00046           m_grqdt[lay]->SetMarkerColor(1);
00047           m_grqdt[lay]->SetLineColor(10);
00048           m_fdQ_T->Add(m_grqdt[lay]);
00049         
00050           for(int bin=0; bin<NQBin; bin++){
00051                sprintf(hname, "mHQT_Lay%02d_Bin%02d", lay, bin);
00052                m_hqt[lay][bin] = new TH1F(hname, "", 200, -1, 1);
00053                m_fdQt -> Add(m_hqt[lay][bin]);
00054           }
00055      }
00056 }

void QtCalib::mergeHist ( TFile *  fhist  )  [virtual]

Implements CalibBase.

Definition at line 58 of file QtCalib.cpp.

References bin, m_hqhit, m_hqt, CalibBase::mergeHist(), NLAYER, and NQBin.

00058                                    {
00059      CalibBase::mergeHist(fhist);
00060 
00061      char hname[200];
00062      TH1F* hist;
00063      TFolder* fdQt = (TFolder*)fhist->Get("fdQt");
00064      for(int lay=0; lay<NLAYER; lay++){
00065           sprintf(hname, "HQ_Layer%02d", lay);
00066           hist = (TH1F*)fdQt->FindObjectAny(hname);
00067           m_hqhit[lay]->Add(hist);
00068 
00069           for(int bin=0; bin<NQBin; bin++){
00070                sprintf(hname, "HQT_Lay%02d_Bin%02d", lay, bin);
00071                hist = (TH1F*)fdQt->FindObjectAny(hname);
00072                m_hqt[lay][bin]->Add(hist);
00073           }
00074      }
00075 }

Double_t QtCalib::qtFun ( Double_t *  x,
Double_t *  par 
) [static]

Definition at line 138 of file QtCalib.cpp.

Referenced by calib().

00138                                                  {
00139      Double_t tw = par[1] / sqrt(x[0]) + par[0];
00140      return tw;
00141 }

void QtCalib::renameHist (  )  [private]

Reimplemented from CalibBase.

Definition at line 143 of file QtCalib.cpp.

References bin, m_fdQ_T, m_fdQt, m_grqdt, m_grqt, m_hqhit, m_hqt, NLAYER, and NQBin.

Referenced by calib().

00143                         {
00144      char hname[200];
00145      m_fdQt->SetName("fdQt");
00146      m_fdQ_T->SetName("QtPlot");
00147      for(int lay=0; lay<NLAYER; lay++){
00148           sprintf(hname, "HQ_Layer%02d", lay);
00149           m_hqhit[lay]->SetName(hname);
00150 
00151           sprintf(hname, "HQT_Plot_lay%02d", lay);
00152           m_grqt[lay]->SetName(hname);
00153 
00154           sprintf(hname, "HQdelT_Plot_lay%02d", lay);
00155           m_grqdt[lay]->SetName(hname);
00156 
00157           for(int bin=0; bin<NQBin; bin++){
00158                sprintf(hname, "HQT_Lay%02d_Bin%02d", lay, bin);
00159                m_hqt[lay][bin]->SetName(hname);
00160           }
00161      }
00162 }


Member Data Documentation

TFolder* QtCalib::m_fdQ_T [private]

Definition at line 36 of file QtCalib.h.

Referenced by init(), and renameHist().

TFolder* QtCalib::m_fdQt [private]

Definition at line 33 of file QtCalib.h.

Referenced by init(), and renameHist().

TGraphErrors* QtCalib::m_grqdt[NLAYER] [private]

Definition at line 38 of file QtCalib.h.

Referenced by calib(), init(), and renameHist().

TGraphErrors* QtCalib::m_grqt[NLAYER] [private]

Definition at line 37 of file QtCalib.h.

Referenced by calib(), init(), and renameHist().

TH1F* QtCalib::m_hqhit[NLAYER] [private]

Definition at line 34 of file QtCalib.h.

Referenced by init(), mergeHist(), and renameHist().

TH1F* QtCalib::m_hqt[NLAYER][NQBin] [private]

Definition at line 35 of file QtCalib.h.

Referenced by calib(), init(), mergeHist(), and renameHist().

MdcCosGeom* QtCalib::m_pGeom [private]

Definition at line 26 of file QtCalib.h.

Referenced by init().

double QtCalib::m_qbinw[NLAYER] [private]

Definition at line 28 of file QtCalib.h.

Referenced by calib(), and init().

double QtCalib::m_qmax[NLAYER] [private]

Definition at line 30 of file QtCalib.h.

Referenced by calib(), and init().

double QtCalib::m_qmin[NLAYER] [private]

Definition at line 29 of file QtCalib.h.

Referenced by calib(), and init().

double QtCalib::m_qtpar[NLAYER][QtOrd] [private]

Definition at line 31 of file QtCalib.h.

const int QtCalib::NQBin = 10 [static, private]

Definition at line 23 of file QtCalib.h.

Referenced by calib(), init(), mergeHist(), and renameHist().

const int QtCalib::QtOrd = 2 [static, private]

Definition at line 22 of file QtCalib.h.

Referenced by calib().


Generated on Tue Nov 29 23:20:44 2016 for BOSS_7.0.2 by  doxygen 1.4.7