Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

PreXtCalib Class Reference

#include <PreXtCalib.h>

Inheritance diagram for PreXtCalib:

CalibBase List of all members.

Public Member Functions

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

Private Member Functions

void renameHist ()

Static Private Member Functions

Double_t xtfun (Double_t *x, Double_t *par)

Private Attributes

TFolder * m_fdNhit
TFolder * m_fdPreXt
TGraph * m_grXt [NLAYER]
TH2F * m_haxis
TH1F * m_htrec [NLAYER]
TH1F * m_nhitBin [NLAYER]
TH1F * m_nhitTot
MdcCosGeomm_pGeom
double m_tbin [NPreXtBin]

Static Private Attributes

const int NPreXtBin = 40

Constructor & Destructor Documentation

PreXtCalib::PreXtCalib  ) 
 

00007                       {
00008      cout << "Calibration type: PreXtCalib" << endl;
00009 }

PreXtCalib::~PreXtCalib  ) 
 

00011                        {
00012 }


Member Function Documentation

void PreXtCalib::calib MdcCalibConst calconst  )  [virtual]
 

Implements CalibBase.

00065                                              {
00066      double pi = 3.141592653;
00067      double dist[NPreXtBin];
00068      double xtpar[6];
00069      char hname[200];
00070 
00071      TF1* funXt = new TF1("funXt", xtfun, 0, 300, 6);
00072      funXt -> FixParameter(0, 0.0);
00073      funXt -> SetParameter(1, 0.03);
00074      funXt -> SetParameter(2, 0.0);
00075      funXt -> SetParameter(3, 0.0);
00076      funXt -> SetParameter(4, 0.0);
00077      funXt -> SetParameter(5, 0.0);
00078 
00079      ofstream fxtlog("preXtpar.dat");
00080      for(int lay=0; lay<NLAYER; lay++){
00081           sprintf(hname, "mgrPreXt%02d", lay);
00082           m_grXt[lay] = new TGraph();
00083           m_grXt[lay] -> SetName(hname);
00084           m_grXt[lay] -> SetMarkerStyle(20);
00085           m_fdPreXt -> Add(m_grXt[lay]);
00086 
00087           double layRad = m_pGeom -> getLayer(lay) -> getLayerRad();
00088           int ncel = m_pGeom -> getLayer(lay) -> getNcell();
00089           double dm = pi * layRad / (double)ncel;
00090           Double_t nTot = m_nhitTot->GetBinContent(lay+1);
00091           double tm = calconst->getXtpar(lay, 0, 0, 6);
00092 
00093           fxtlog << "layer " << lay << endl;
00094           for(int bin=0; bin<NPreXtBin; bin++){
00095                Double_t nhitBin = m_nhitBin[lay]->GetBinContent(bin+1);
00096                dist[bin] = dm * nhitBin / nTot;
00097                m_grXt[lay] -> SetPoint(bin, m_tbin[bin], dist[bin]);
00098                fxtlog << setw(4) << bin << setw(15) << m_tbin[bin]
00099                       << setw(15) << dist[bin] << setw(15) << dm
00100                       << setw(10) << nhitBin
00101                       << setw(10) << nTot << endl;
00102 
00103                if(m_tbin[bin] >= tm) break;
00104           }
00105 
00106           if(1 == gFgCalib[lay]){
00107                m_grXt[lay] -> Fit(funXt, "Q", "", 0.0, tm);
00108                for(int ord=0; ord<6; ord++) xtpar[ord] = funXt -> GetParameter(ord);
00109 
00110                for(int iEntr=0; iEntr<NENTRXT; iEntr++){
00111                     for(int iLR=0; iLR<NLR; iLR++){
00112                          for(int ord=0; ord<6; ord++){
00113                               calconst -> resetXtpar(lay, iEntr, iLR, ord, xtpar[ord]);
00114                          }
00115                     }
00116                }
00117           } else{
00118                for(int ord=0; ord<6; ord++) xtpar[ord] = calconst->getXtpar(lay, 0, 0, ord);
00119           }
00120 
00121           for(int ord=0; ord<6; ord++)  fxtlog << setw(14) << xtpar[ord];
00122           fxtlog << setw(10) << tm << "  0" << endl;
00123      } // end of layer loop
00124      fxtlog.close();
00125      cout << "preXt.dat was written." << endl;
00126 
00127      renameHist();
00128      delete funXt;
00129 }

void PreXtCalib::init TObjArray *  hlist,
MdcCosGeom pGeom
[virtual]
 

Implements CalibBase.

00014                                                         {
00015      m_pGeom = pGeom;
00016 
00017      double twid = 10.0;        // ns
00018      for(int bin=0; bin<NPreXtBin; bin++)  m_tbin[bin] = (double)(bin+1) * twid;
00019 
00020      m_fdPreXt = new TFolder("mPreXt", "PreXt");
00021      hlist->Add(m_fdPreXt);
00022 
00023      m_fdNhit = new TFolder("mXtNhit", "XtNhit");
00024      hlist->Add(m_fdNhit);
00025 
00026      m_haxis = new TH2F("maxis", "", 50, 0, 300, 50, 0, 9);
00027      m_haxis -> SetStats(0);
00028      m_fdPreXt -> Add(m_haxis);
00029 
00030      m_nhitTot = new TH1F("mnhitTot", "", 43, -0.5, 42.5);
00031      m_fdNhit -> Add(m_nhitTot);
00032 
00033      char hname[200];
00034      for(int lay=0; lay<NLAYER; lay++){
00035           sprintf(hname, "mtrec%02d", lay);
00036           m_htrec[lay] = new TH1F(hname, "", 310, -20, 600);
00037           m_fdPreXt -> Add(m_htrec[lay]);
00038 
00039           sprintf(hname, "mnhitBin%02d", lay);
00040           m_nhitBin[lay] = new TH1F(hname, "", 40, 5.0, 405.0);
00041           m_fdNhit -> Add(m_nhitBin[lay]);
00042      }
00043 }

void PreXtCalib::mergeHist TFile *  fhist  )  [virtual]
 

Implements CalibBase.

00045                                       {
00046      TFolder* fdPreXt = (TFolder*)fhist->Get("PreXt");
00047      TFolder* fdNhit = (TFolder*)fhist->Get("XtNhit");
00048 
00049      char hname[200];
00050      TH1F* hist;
00051      for(int lay=0; lay<NLAYER; lay++){
00052           sprintf(hname, "trec%02d", lay);
00053           hist = (TH1F*)fdPreXt->FindObjectAny(hname);
00054           m_htrec[lay]->Add(hist);
00055 
00056           sprintf(hname, "nhitBin%02d", lay);
00057           hist = (TH1F*)fdNhit->FindObjectAny(hname);
00058           m_nhitBin[lay]->Add(hist);
00059      }
00060 
00061      hist = (TH1F*)fdPreXt->FindObjectAny("nhitTot");
00062      m_nhitTot->Add(hist);
00063 }

void PreXtCalib::renameHist  )  [private]
 

Reimplemented from CalibBase.

00139                            {
00140      m_fdPreXt->SetName("PreXt");
00141      m_fdNhit->SetName("XtNhit");
00142      m_haxis->SetName("axis");
00143      m_nhitTot->SetName("nhitTot");
00144 
00145      char hname[200];
00146      for(int lay=0; lay<NLAYER; lay++){
00147           sprintf(hname, "trec%02d", lay);
00148           m_htrec[lay]->SetName(hname);
00149 
00150           sprintf(hname, "nhitBin%02d", lay);
00151           m_nhitBin[lay]->SetName(hname);
00152 
00153           sprintf(hname, "grPreXt%02d", lay);
00154           m_grXt[lay] -> SetName(hname);
00155      }
00156 }

Double_t PreXtCalib::xtfun Double_t *  x,
Double_t *  par
[static, private]
 

00131                                                     {
00132      Double_t val = 0.0;
00133      for(Int_t ord=0; ord<6; ord++){
00134           val += par[ord] * pow(x[0], ord);
00135      }
00136      return val;
00137 }


Member Data Documentation

TFolder* PreXtCalib::m_fdNhit [private]
 

TFolder* PreXtCalib::m_fdPreXt [private]
 

TGraph* PreXtCalib::m_grXt[NLAYER] [private]
 

TH2F* PreXtCalib::m_haxis [private]
 

TH1F* PreXtCalib::m_htrec[NLAYER] [private]
 

TH1F* PreXtCalib::m_nhitBin[NLAYER] [private]
 

TH1F* PreXtCalib::m_nhitTot [private]
 

MdcCosGeom* PreXtCalib::m_pGeom [private]
 

double PreXtCalib::m_tbin[NPreXtBin] [private]
 

const int PreXtCalib::NPreXtBin = 40 [static, private]
 


The documentation for this class was generated from the following files:
Generated on Wed Feb 2 16:41:27 2011 for BOSS6.5.5 by  doxygen 1.3.9.1