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

IniMdcCalib Class Reference

#include <IniMdcCalib.h>

Inheritance diagram for IniMdcCalib:

MdcCalib MdcCalib List of all members.

Public Member Functions

void clear ()
void clear ()
int fillHist (MdcCalEvent *event)
int fillHist (MdcCalEvent *event)
 IniMdcCalib ()
 IniMdcCalib ()
void initialize (TObjArray *hlist, IMdcGeomSvc *mdcGeomSvc, IMdcCalibFunSvc *mdcFunSvc)
void initialize (TObjArray *hlist, IMdcGeomSvc *mdcGeomSvc, IMdcCalibFunSvc *mdcFunSvc)
virtual void read_file (std::vector< std::string > path)
virtual void read_file (std::vector< std::string > path)
void setParam (MdcCalParams &param)
void setParam (MdcCalParams &param)
virtual void settuple (std::string path)
virtual void settuple (std::string path)
int updateConst (MdcCalibConst *calconst)
int updateConst (MdcCalibConst *calconst)
 ~IniMdcCalib ()
 ~IniMdcCalib ()

Static Private Member Functions

Double_t funTmax (Double_t *x, Double_t *par)
Double_t funTmax (Double_t *x, Double_t *par)
Double_t funTmin (Double_t *x, Double_t *par)
Double_t funTmin (Double_t *x, Double_t *par)

Private Attributes

TFolder * m_fdcom
TFolder * m_fdcom
TFolder * m_fdQmap
TFolder * m_fdQmap
TFolder * m_fdQraw
TFolder * m_fdQraw
TFolder * m_fdQrawCel
TFolder * m_fdQrawCel
TFolder * m_fdTmap
TFolder * m_fdTmap
TFolder * m_fdTraw
TFolder * m_fdTraw
TFolder * m_fdTrawCel
TFolder * m_fdTrawCel
TFolder * m_fdTrawTes
TFolder * m_fdTrawTes
TH1F * m_hLayerHitmapQ
TH1F * m_hLayerHitmapQ
TH1F * m_hLayerHitmapT
TH1F * m_hLayerHitmapT
TH1F * m_hlaymapQ [MdcCalNLayer]
TH1F * m_hlaymapQ [MdcCalNLayer]
TH1F * m_hlaymapT [MdcCalNLayer]
TH1F * m_hlaymapT [MdcCalNLayer]
TObjArray * m_hlist
TObjArray * m_hlist
TH1F * m_hqraw [MdcCalNLayer]
TH1F * m_hqraw [MdcCalNLayer]
TH1F * m_hqrawCel [MdcCalTotCell]
TH1F * m_hqrawCel [MdcCalTotCell]
TH1F * m_htdc [MdcCalNLayer]
TH1F * m_htdc [MdcCalNLayer]
TH1F * m_htdcTes [MdcCalNLayer][10]
TH1F * m_htdcTes [MdcCalNLayer][10]
TH1F * m_hTes [10]
TH1F * m_hTes [10]
TH1F * m_hTesAll
TH1F * m_hTesAll
TH1F * m_hTesCal
TH1F * m_hTesCal
TH1F * m_hTesFlag
TH1F * m_hTesFlag
TH1F * m_htraw [MdcCalNLayer]
TH1F * m_htraw [MdcCalNLayer]
TH1F * m_htrawCel [MdcCalTotCell]
TH1F * m_htrawCel [MdcCalTotCell]
TH1F * m_htrawTes [MdcCalNLayer][10]
TH1F * m_htrawTes [MdcCalNLayer][10]
TH1F * m_hWireHitMapQ
TH1F * m_hWireHitMapQ
TH1F * m_hWireHitMapT
TH1F * m_hWireHitMapT
IMdcCalibFunSvcm_mdcFunSvc
IMdcCalibFunSvcm_mdcFunSvc
IMdcGeomSvcm_mdcGeomSvc
IMdcGeomSvcm_mdcGeomSvc
int m_nLayer
int m_nWire
MdcCalParams m_param

Constructor & Destructor Documentation

IniMdcCalib::IniMdcCalib  ) 
 

00031                         {
00032 }

IniMdcCalib::~IniMdcCalib  ) 
 

00034                          {
00035 }

IniMdcCalib::IniMdcCalib  ) 
 

IniMdcCalib::~IniMdcCalib  ) 
 


Member Function Documentation

void IniMdcCalib::clear  )  [virtual]
 

Implements MdcCalib.

void IniMdcCalib::clear  )  [virtual]
 

Implements MdcCalib.

00037                        {
00038      int iEs;
00039      for(int lay=0; lay<MdcCalNLayer; lay++){
00040           delete m_hlaymapT[lay];
00041           delete m_htdc[lay];
00042           delete m_htraw[lay];
00043           for(iEs=0; iEs<m_param.nEsFlag; iEs++){
00044                delete m_htdcTes[lay][iEs];
00045                delete m_htrawTes[lay][iEs];
00046           }
00047 
00048           delete m_hlaymapQ[lay];
00049           delete m_hqraw[lay];
00050      }
00051 
00052      for(int wir=0; wir<MdcCalTotCell; wir++){
00053           delete m_htrawCel[wir];
00054           delete m_hqrawCel[wir];
00055      }
00056 
00057      delete m_hLayerHitmapT;
00058      delete m_hWireHitMapT;
00059 
00060      delete m_hLayerHitmapQ;
00061      delete m_hWireHitMapQ;
00062      for(iEs=0; iEs<m_param.nEsFlag; iEs++) delete m_hTes[iEs];
00063      delete m_hTesAll;
00064      delete m_hTesCal;
00065      delete m_hTesFlag;
00066 
00067      delete m_fdcom;
00068      delete m_fdTmap;
00069      delete m_fdTraw;
00070      delete m_fdTrawCel;
00071      delete m_fdTrawTes;
00072      delete m_fdQmap;
00073      delete m_fdQraw;
00074      delete m_fdQrawCel;
00075 }

int IniMdcCalib::fillHist MdcCalEvent event  )  [virtual]
 

Implements MdcCalib.

int IniMdcCalib::fillHist MdcCalEvent event  )  [virtual]
 

Implements MdcCalib.

00197                                            {
00198      IMessageSvc* msgSvc;
00199      Gaudi::svcLocator() -> service("MessageSvc", msgSvc);
00200      MsgStream log(msgSvc, "IniMdcCalib");
00201      log << MSG::DEBUG << "IniMdcCalib::fillHist()" << endreq;
00202 
00203      int lay;
00204      int cel;
00205      int wir;
00206      int digiId;
00207      unsigned fgOverFlow;
00208      double tdc;
00209      double traw;
00210      double adc;
00211      double qraw;
00212      Identifier id; 
00213 
00214      IDataProviderSvc* eventSvc = NULL;
00215      Gaudi::svcLocator()->service("EventDataSvc", eventSvc);
00216 
00217      // get EsTimeCol
00218      double tes = -9999.0;
00219      int esTimeflag = -1;
00220      SmartDataPtr<RecEsTimeCol> aevtimeCol(eventSvc,"/Event/Recon/RecEsTimeCol");
00221      if( (!aevtimeCol) || (aevtimeCol->size()==0) ){
00222           tes = -9999.0;
00223           esTimeflag = -1;
00224      }else{
00225           RecEsTimeCol::iterator iter_evt = aevtimeCol->begin();
00226           for(; iter_evt!=aevtimeCol->end(); iter_evt++){
00227                tes = (*iter_evt)->getTest();
00228                esTimeflag = (*iter_evt)->getStat();
00229           }
00230      }
00231      m_hTesAll->Fill(tes);
00232      m_hTesFlag->Fill(esTimeflag);
00233      int nTesFlag = -1;
00234      for(int iEs=0; iEs<m_param.nEsFlag; iEs++){
00235           if(esTimeflag == m_param.esFlag[iEs]){
00236                m_hTes[iEs]->Fill(tes);
00237                nTesFlag = iEs;
00238                break;
00239           }
00240      }
00241      bool fgFillTes = false;
00242      if( (nTesFlag > -1) && (tes > m_param.tesMin) && (tes < m_param.tesMax) ){
00243           m_hTesCal->Fill(tes);
00244           fgFillTes = true;
00245      }
00246 
00247      // retrieve Mdc digi
00248      SmartDataPtr<MdcDigiCol> mdcDigiCol(eventSvc,"/Event/Digi/MdcDigiCol");
00249      if (!mdcDigiCol) {
00250           log << MSG::FATAL << "Could not find event" << endreq;
00251      }
00252 
00253      MdcDigiCol::iterator iter = mdcDigiCol->begin();
00254      digiId = 0;
00255      for(; iter != mdcDigiCol->end(); iter++, digiId++) {
00256           MdcDigi *aDigi = (*iter);
00257           id = (aDigi)->identify();
00258 
00259           lay = MdcID::layer(id);
00260           cel = MdcID::wire(id);
00261           wir = m_mdcGeomSvc->Wire(lay, cel)->Id();
00262 
00263           tdc = (aDigi) -> getTimeChannel();
00264           adc = (aDigi) -> getChargeChannel();
00265           fgOverFlow = (aDigi) -> getOverflow();
00266 
00267           if ( ((fgOverFlow & 3) !=0 ) || ((fgOverFlow & 12) != 0) ||
00268                (aDigi->getTimeChannel() == 0x7FFFFFFF) ||
00269                (aDigi->getChargeChannel() == 0x7FFFFFFF) ) continue;
00270 
00271           traw = tdc * MdcCalTdcCnv;
00272           qraw = adc * MdcCalAdcCnv;
00273 
00274           m_hLayerHitmapT -> Fill(lay);
00275           m_hWireHitMapT -> Fill(wir);
00276           m_hlaymapT[lay] -> Fill(cel);
00277 
00278           m_hLayerHitmapQ -> Fill(lay);
00279           m_hWireHitMapQ -> Fill(wir);
00280           m_hlaymapQ[lay] -> Fill(cel);
00281 
00282           if(fgFillTes){
00283                traw -= tes;
00284                traw += m_param.timeShift;
00285 
00286                m_htdc[lay] -> Fill(tdc);
00287                m_htraw[lay] -> Fill(traw);
00288                m_hqraw[lay] -> Fill(qraw);
00289 
00290                m_htdcTes[lay][nTesFlag] -> Fill(tdc);
00291                m_htrawTes[lay][nTesFlag] -> Fill(traw);
00292 
00293                m_htrawCel[wir] -> Fill(traw);
00294                m_hqrawCel[wir] -> Fill(qraw);
00295           }
00296      }
00297      return 1;
00298 }

Double_t IniMdcCalib::funTmax Double_t *  x,
Double_t *  par
[static, private]
 

Double_t IniMdcCalib::funTmax Double_t *  x,
Double_t *  par
[static, private]
 

00479                                                        {
00480      Double_t fitval;
00481      fitval = par[0] + par[1] / (1 + exp((x[0]-par[2])/par[3]));
00482      return fitval;
00483 }

Double_t IniMdcCalib::funTmin Double_t *  x,
Double_t *  par
[static, private]
 

Double_t IniMdcCalib::funTmin Double_t *  x,
Double_t *  par
[static, private]
 

00472                                                        {
00473      Double_t fitval;
00474      fitval = par[0] + par[1]*exp( -par[2]*(x[0]-par[3]) ) /
00475           ( 1 + exp( -(x[0]-par[4])/par[5] ));
00476      return fitval;
00477 }

void IniMdcCalib::initialize TObjArray *  hlist,
IMdcGeomSvc mdcGeomSvc,
IMdcCalibFunSvc mdcFunSvc
[virtual]
 

Implements MdcCalib.

void IniMdcCalib::initialize TObjArray *  hlist,
IMdcGeomSvc mdcGeomSvc,
IMdcCalibFunSvc mdcFunSvc
[virtual]
 

Implements MdcCalib.

00078                                                          {
00079      IMessageSvc* msgSvc;
00080      Gaudi::svcLocator() -> service("MessageSvc", msgSvc);
00081      MsgStream log(msgSvc, "IniMdcCalib");
00082      log << MSG::INFO << "IniMdcCalib::initialize()" << endreq;
00083 
00084      m_hlist = hlist;
00085      m_mdcGeomSvc = mdcGeomSvc;
00086      m_mdcFunSvc = mdcFunSvc;
00087 
00088      int lay;
00089      int cel;
00090      int wir;
00091      int ncel;
00092      char hname[200];
00093 
00094      m_nWire = m_mdcGeomSvc -> getWireSize();
00095      m_nLayer = m_mdcGeomSvc -> getLayerSize();
00096 
00097      m_fdcom = new TFolder("Common", "Common");
00098      m_hlist->Add(m_fdcom);
00099 
00100      m_fdTmap = new TFolder("Thitmap", "Thitmap");
00101      m_hlist->Add(m_fdTmap);
00102 
00103      m_fdTraw = new TFolder("Traw", "Traw");
00104      m_hlist->Add(m_fdTraw);
00105 
00106      m_fdTrawCel = new TFolder("TrawCell", "TrawCell");
00107      m_hlist->Add(m_fdTrawCel);
00108 
00109      m_fdTrawTes = new TFolder("TrawTes", "TrawTes");
00110      m_hlist->Add(m_fdTrawTes);
00111 
00112      m_fdQmap = new TFolder("Qhitmap", "Qhitmap");
00113      m_hlist->Add(m_fdQmap);
00114 
00115      m_fdQraw = new TFolder("Qraw", "Qraw");
00116      m_hlist->Add(m_fdQraw);
00117 
00118      m_fdQrawCel = new TFolder("QrawCell", "QrawCell");
00119      m_hlist->Add(m_fdQrawCel);
00120 
00121      m_hLayerHitmapT = new TH1F("T_Hitmap_Layer", "", 43, -0.5, 42.5);
00122      m_fdcom->Add(m_hLayerHitmapT);
00123                 
00124      m_hWireHitMapT = new TH1F("T_Hitmap_Wire", "", 6796, -0.5, 6795.5);
00125      m_fdcom->Add(m_hWireHitMapT);
00126 
00127      m_hLayerHitmapQ = new TH1F("Q_Hitmap_Layer", "", 43, -0.5, 42.5);
00128      m_fdcom->Add(m_hLayerHitmapQ);
00129                 
00130      m_hWireHitMapQ = new TH1F("Q_Hitmap_Wire", "", 6796, -0.5, 6795.5);
00131      m_fdcom->Add(m_hWireHitMapQ);
00132 
00133      int iEs;
00134      for(iEs=0; iEs<m_param.nEsFlag; iEs++){
00135           sprintf(hname, "Tes_%d", m_param.esFlag[iEs]);
00136           m_hTes[iEs] = new TH1F(hname, "", 750, 0, 1500);
00137           m_fdcom->Add(m_hTes[iEs]);
00138      }
00139 
00140      m_hTesAll = new TH1F("TesAll", "", 750, 0, 1500);
00141      m_fdcom->Add(m_hTesAll);
00142 
00143      m_hTesCal = new TH1F("TesCal", "", 750, 0, 1500);
00144      m_fdcom->Add(m_hTesCal);
00145 
00146      m_hTesFlag = new TH1F("Tes_Flag", "", 300, -0.5, 299.5);
00147      m_fdcom->Add(m_hTesFlag);
00148 
00149      for(lay=0; lay<m_nLayer; lay++){
00150           ncel = m_mdcGeomSvc->Layer(lay)->NCell();
00151 
00152           sprintf(hname, "T_hitmap_Lay%02d", lay);
00153           m_hlaymapT[lay] = new TH1F(hname, "", ncel, -0.5, (float)ncel-0.5);
00154           m_fdTmap -> Add(m_hlaymapT[lay]);
00155 
00156           sprintf(hname, "TDC_Lay%02d", lay);
00157           m_htdc[lay] = new TH1F(hname, "", 800, 0, 20000);
00158           m_fdTraw -> Add(m_htdc[lay]);
00159 
00160           sprintf(hname, "Traw_Lay%02d", lay);
00161           m_htraw[lay] = new TH1F(hname, "", 300, 0, 600);
00162           m_fdTraw -> Add(m_htraw[lay]);
00163 
00164           for(iEs=0; iEs<m_param.nEsFlag; iEs++){
00165                sprintf(hname, "TDC_Lay%02d_Tes%d", lay, m_param.esFlag[iEs]);
00166                m_htdcTes[lay][iEs] = new TH1F(hname, "", 800, 0, 20000);
00167                m_fdTrawTes -> Add(m_htdcTes[lay][iEs]);
00168 
00169                sprintf(hname, "Traw_Lay%02d_Tes%d", lay, m_param.esFlag[iEs]);
00170                m_htrawTes[lay][iEs] = new TH1F(hname, "", 300, 0, 600);
00171                m_fdTrawTes -> Add(m_htrawTes[lay][iEs]);
00172           }
00173 
00174           sprintf(hname, "Q_hitmap_Lay%02d", lay);
00175           m_hlaymapQ[lay] = new TH1F(hname, "", ncel, -0.5, (float)ncel-0.5);
00176           m_fdQmap -> Add(m_hlaymapQ[lay]);
00177 
00178           sprintf(hname, "Qraw_Lay%02d", lay);
00179           m_hqraw[lay] = new TH1F(hname, "", 2000, 0, 4000);
00180           m_fdQraw -> Add(m_hqraw[lay]);
00181      }
00182 
00183      for(wir=0; wir<MdcCalTotCell; wir++){
00184           lay = m_mdcGeomSvc -> Wire(wir) -> Layer();
00185           cel = m_mdcGeomSvc -> Wire(wir) -> Cell();
00186 
00187           sprintf(hname, "Traw_%02d_%03d_%04d", lay, cel, wir);
00188           m_htrawCel[wir] = new TH1F(hname, "", 300, 0, 600);
00189           m_fdTrawCel -> Add(m_htrawCel[wir]);
00190 
00191           sprintf(hname, "Qraw_%02d_%03d_%04d", lay, cel, wir);
00192           m_hqrawCel[wir] = new TH1F(hname, "", 2000, 0, 4000);
00193           m_fdQrawCel -> Add(m_hqrawCel[wir]);
00194      }
00195 }

virtual void IniMdcCalib::read_file std::vector< std::string >  path  )  [virtual]
 

Reimplemented from MdcCalib.

void IniMdcCalib::read_file std::vector< std::string >  path  )  [virtual]
 

Reimplemented from MdcCalib.

00570                                                      {
00571      MdcCalib::read_file(path);
00572 }

void IniMdcCalib::setParam MdcCalParams param  )  [virtual]
 

Implements MdcCalib.

void IniMdcCalib::setParam MdcCalParams param  )  [inline, virtual]
 

Implements MdcCalib.

00077                                                     {
00078      MdcCalib::setParam(param);
00079      m_param = param;
00080 }

virtual void IniMdcCalib::settuple std::string  path  )  [virtual]
 

Reimplemented from MdcCalib.

void IniMdcCalib::settuple std::string  path  )  [virtual]
 

Reimplemented from MdcCalib.

00485                                         {
00486      MdcCalib::settuple(path);
00487      TFile *f1 = new TFile(path.c_str());
00488      std::cout<<path<<std::endl;
00489 
00490      int lay;
00491      int cel;
00492      int wir;
00493      int ncel;
00494      char hname[200];
00495 
00496      m_nWire = m_mdcGeomSvc -> getWireSize();
00497      m_nLayer = m_mdcGeomSvc -> getLayerSize();
00498 
00499      m_fdcom=(TFolder *)f1->Get("Common;1");
00500      //
00501      m_fdTmap=(TFolder *)f1->Get("Thitmap;1");
00502      //
00503      m_fdTraw=(TFolder *)f1->Get("Traw;1");
00504      //
00505      m_fdTrawCel=(TFolder *)f1->Get("TrawCell;1");
00506      //
00507      m_fdTrawTes=(TFolder *)f1->Get("TrawTes;1");
00508      //
00509      m_fdQmap=(TFolder *)f1->Get("Qhitmap;1");
00510      //
00511      m_fdQraw=(TFolder *)f1->Get("Qraw;1");
00512      //
00513      m_fdQrawCel =(TFolder *)f1->Get("QrawCell;1");
00514      //
00515      m_hLayerHitmapT =(TH1F *)m_fdcom->FindObject("T_Hitmap_Layer");
00516      m_hWireHitMapT =(TH1F *)m_fdcom->FindObject("T_Hitmap_Wire");
00517      m_hLayerHitmapQ=(TH1F *)m_fdcom->FindObject("Q_Hitmap_Layer");
00518      m_hWireHitMapQ =(TH1F *)m_fdcom->FindObject("Q_Hitmap_Wire");
00519      int iEs;
00520      for (iEs=0; iEs<m_param.nEsFlag; iEs++)
00521      { 
00522           sprintf(hname,"Tes_%d", m_param.esFlag[iEs]);
00523           m_hTes[iEs]=(TH1F *)m_fdcom->FindObject(hname);
00524       
00525      }
00526    
00527      m_hTesAll =(TH1F *)m_fdcom->FindObject("TesAll");
00528      m_hTesCal =(TH1F *)m_fdcom->FindObject("TesCal");
00529      m_hTesFlag =(TH1F *)m_fdcom->FindObject("Tes_Flag");
00530 
00531      for(lay=0; lay<m_nLayer; lay++){
00532           //ncel = m_mdcGeomSvc->Layer(lay)->NCell();
00533           sprintf(hname, "T_hitmap_Lay%02d", lay); 
00534           m_hlaymapT[lay]=(TH1F *)m_fdTmap->FindObject(hname); 
00535      
00536           sprintf(hname, "TDC_Lay%02d", lay);
00537           m_htdc[lay]=(TH1F *)m_fdTraw->FindObject(hname);
00538 
00539           sprintf(hname, "Traw_Lay%02d", lay);
00540           m_htraw[lay]=(TH1F *) m_fdTraw->FindObject(hname);
00541 
00542           for(iEs=0; iEs<m_param.nEsFlag; iEs++){
00543                sprintf(hname, "TDC_Lay%02d_Tes%d", lay, m_param.esFlag[iEs]);
00544                m_htdcTes[lay][iEs]=(TH1F *)m_fdTrawTes->FindObject(hname);
00545            
00546                sprintf(hname, "Traw_Lay%02d_Tes%d", lay, m_param.esFlag[iEs]);
00547                m_htrawTes[lay][iEs]=(TH1F *) m_fdTrawTes->FindObject(hname);
00548           }
00549           
00550           sprintf(hname, "Q_hitmap_Lay%02d", lay);
00551           m_hlaymapQ[lay]=(TH1F *)m_fdQmap->FindObject(hname);
00552      
00553           sprintf(hname, "Qraw_Lay%02d", lay);
00554           m_hqraw[lay]=(TH1F *)m_fdQraw->FindObject(hname);
00555      }
00556   
00557      for(wir=0; wir<MdcCalTotCell; wir++){
00558           lay = m_mdcGeomSvc -> Wire(wir) -> Layer();
00559           cel = m_mdcGeomSvc -> Wire(wir) -> Cell();
00560 
00561           sprintf(hname, "Traw_%02d_%03d_%04d", lay, cel, wir);
00562           m_htrawCel[wir]=(TH1F *) m_fdTrawCel -> FindObject(hname);
00563 
00564           sprintf(hname, "Qraw_%02d_%03d_%04d", lay, cel, wir);
00565           m_hqrawCel[wir]=(TH1F *) m_fdQrawCel -> FindObject(hname);
00566      }
00567 }

int IniMdcCalib::updateConst MdcCalibConst calconst  )  [virtual]
 

Implements MdcCalib.

int IniMdcCalib::updateConst MdcCalibConst calconst  )  [virtual]
 

Implements MdcCalib.

00300                                                    {
00301      IMessageSvc* msgSvc;
00302      Gaudi::svcLocator() -> service("MessageSvc", msgSvc);
00303      MsgStream log(msgSvc, "IniMdcCalib");
00304      log << MSG::DEBUG << "IniMdcCalib::updateConst()" << endreq;
00305 
00306      int lay;
00307      int wir;
00308      double t0Fit[MdcCalNLayer];
00309      double t0Cal[MdcCalNLayer];
00310      double tmax[MdcCalNLayer];
00311      double initT0 = m_param.initT0;
00312 
00313      int fitTminFg[MdcCalNLayer];
00314      int fitTmaxFg[MdcCalNLayer];
00315      double chisq;
00316      double ndf;
00317      double chindfTmin[MdcCalNLayer];
00318      double chindfTmax[MdcCalNLayer];
00319      char funname[200];
00320 
00321      // fit Tmin
00322      TF1* ftmin[MdcCalNLayer];
00323      for(lay=0; lay<m_nLayer; lay++){
00324           fitTminFg[lay] = 0;
00325           chindfTmin[lay] = -1;
00326           sprintf(funname, "ftmin%02d", lay);
00327           ftmin[lay] = new TF1(funname, funTmin, 0, 150, 6);
00328 
00329           if(1 == m_param.fgCalib[lay]){
00330                ftmin[lay] -> SetParameter(0, 0);
00331                ftmin[lay] -> SetParameter(4, initT0);
00332                ftmin[lay] -> SetParameter(5, 1);
00333 
00334                m_htraw[lay] -> Fit(funname, "Q", "",
00335                                    m_param.tminFitRange[lay][0],
00336                                    m_param.tminFitRange[lay][1]);
00337                gStyle -> SetOptFit(11);
00338                chisq = ftmin[lay]->GetChisquare();
00339                ndf = ftmin[lay]->GetNDF();
00340                chindfTmin[lay] = chisq / ndf;
00341                if(chindfTmin[lay] < m_param.tminFitChindf){
00342                     fitTminFg[lay] = 1;
00343                     t0Fit[lay] = ftmin[lay]->GetParameter(4);
00344                     t0Fit[lay] += m_param.t0Shift;
00345                     t0Cal[lay] = t0Fit[lay] - m_param.timeShift;
00346                }
00347           }
00348 
00349           if(0 == fitTminFg[lay]){
00350                wir = m_mdcGeomSvc->Wire(lay, 0)->Id();
00351                t0Cal[lay] = calconst->getT0(wir);
00352                t0Fit[lay] = t0Cal[lay] + m_param.timeShift;
00353           }
00354      }
00355 
00356      // fit Tmax
00357      TF1* ftmax[MdcCalNLayer];
00358      for(lay=0; lay<m_nLayer; lay++){
00359           fitTmaxFg[lay] = 0;
00360           chindfTmax[lay] = -1;
00361           sprintf(funname, "ftmax%02d", lay);
00362           ftmax[lay] = new TF1(funname, funTmax, 250, 500, 4);
00363 
00364           if(1 == m_param.fgCalib[lay]){
00365                ftmax[lay] -> SetParameter(2, m_param.initTm[lay]);
00366                ftmax[lay] -> SetParameter(3, 10);
00367 
00368                m_htraw[lay] -> Fit(funname, "Q+", "",
00369                                    m_param.tmaxFitRange[lay][0],
00370                                    m_param.tmaxFitRange[lay][1]);
00371                gStyle -> SetOptFit(11);
00372                chisq = ftmax[lay]->GetChisquare();
00373                ndf = ftmax[lay]->GetNDF();
00374                chindfTmax[lay] = chisq / ndf;
00375                if(chindfTmax[lay] < m_param.tmaxFitChindf){
00376                     fitTmaxFg[lay] = 1;
00377                     tmax[lay] = ftmax[lay]->GetParameter(2);
00378                }
00379           }
00380 
00381           if(0 == fitTmaxFg[lay]){
00382                tmax[lay] = (calconst->getXtpar(lay, 0, 0, 6)) + t0Fit[lay];
00383           }
00384      }
00385 
00386      // output for check
00387      ofstream ft0("iniT0.dat");
00388      for(lay=0; lay<m_nLayer; lay++){
00389           ft0 << setw(5) << lay << setw(3) << fitTminFg[lay]
00390               << setw(12) << t0Cal[lay] << setw(12) << t0Fit[lay]
00391               << setw(12) << chindfTmin[lay] << setw(5) << fitTmaxFg[lay]
00392               << setw(12) << tmax[lay] << setw(12) << tmax[lay] - t0Fit[lay]
00393               << setw(12) << chindfTmax[lay] << endl;
00394      }
00395      ft0.close();
00396      cout << "iniT0.dat was written." << endl;
00397 
00398      // set T0
00399      int i;
00400      int nwire = m_mdcGeomSvc -> getWireSize();
00401      for(i=0; i<nwire; i++){
00402           lay = m_mdcGeomSvc -> Wire(i) -> Layer();
00403           if(1 == m_param.fgCalib[lay]){
00404                calconst -> resetT0(i, t0Cal[lay]);
00405                calconst -> resetDelT0(i, 0.0);
00406           }
00407      }
00408 
00409      if(0 == m_param.fgIniCalConst){
00410           // set X-T
00411           int lr;
00412           int iEntr;
00413           int ord;
00414           double xtpar;
00415           double xtini[8] = {0, 0.03, 0, 0, 0, 0, 999.9, 0};
00416           for(lay=0; lay<m_nLayer; lay++){
00417                if(1 != m_param.fgCalib[lay]) continue;
00418 
00419                for(iEntr=0; iEntr<MdcCalNENTRXT; iEntr++){
00420                     for(lr=0; lr<MdcCalLR; lr++){
00421                          for(ord=0; ord<MdcCalXtNPars; ord++){
00422                               if(6 == ord){
00423                                    xtpar = tmax[lay] - t0Fit[lay];
00424                               } else{
00425                                    xtpar = xtini[ord];
00426                               }
00427                               calconst -> resetXtpar(lay, iEntr, lr, ord, xtpar);
00428                          }
00429                     }
00430                }
00431           }
00432 
00433           // set Q-T
00434           for(lay=0; lay<m_nLayer; lay++){
00435                calconst -> resetQtpar0(lay, 0.0);
00436                calconst -> resetQtpar1(lay, 0.0);
00437           }
00438 
00439           // set S-D
00440           int bin;
00441           double sdpar = m_param.initSigma;     // mm
00442           for(lay=0; lay<m_nLayer; lay++){
00443                for(iEntr=0; iEntr<MdcCalNENTRSD; iEntr++){
00444                     for(lr=0; lr<2; lr++){
00445                          for(bin=0; bin<MdcCalSdNBIN; bin++){
00446                               calconst -> resetSdpar(lay, iEntr, lr, bin, sdpar);
00447                          }
00448                     }
00449                }
00450           }
00451      } else if(2 == m_param.fgIniCalConst){
00452           int lr;
00453           int iEntr;
00454           double xtpar;
00455           for(lay=0; lay<m_nLayer; lay++){
00456                for(iEntr=0; iEntr<MdcCalNENTRXT; iEntr++){
00457                     for(lr=0; lr<MdcCalLR; lr++){
00458                          xtpar = tmax[lay] - t0Fit[lay];
00459                          calconst -> resetXtpar(lay, iEntr, lr, 6, xtpar);
00460                     }
00461                }
00462           }
00463      }
00464 
00465      for(lay=0; lay<MdcCalNLayer; lay++){
00466           delete ftmin[lay];
00467           delete ftmax[lay];
00468      }
00469      return 1;
00470 }


Member Data Documentation

TFolder* IniMdcCalib::m_fdcom [private]
 

Reimplemented from MdcCalib.

TFolder* IniMdcCalib::m_fdcom [private]
 

Reimplemented from MdcCalib.

TFolder* IniMdcCalib::m_fdQmap [private]
 

TFolder* IniMdcCalib::m_fdQmap [private]
 

TFolder* IniMdcCalib::m_fdQraw [private]
 

TFolder* IniMdcCalib::m_fdQraw [private]
 

TFolder* IniMdcCalib::m_fdQrawCel [private]
 

TFolder* IniMdcCalib::m_fdQrawCel [private]
 

TFolder* IniMdcCalib::m_fdTmap [private]
 

TFolder* IniMdcCalib::m_fdTmap [private]
 

TFolder* IniMdcCalib::m_fdTraw [private]
 

TFolder* IniMdcCalib::m_fdTraw [private]
 

TFolder* IniMdcCalib::m_fdTrawCel [private]
 

TFolder* IniMdcCalib::m_fdTrawCel [private]
 

TFolder* IniMdcCalib::m_fdTrawTes [private]
 

TFolder* IniMdcCalib::m_fdTrawTes [private]
 

TH1F* IniMdcCalib::m_hLayerHitmapQ [private]
 

TH1F* IniMdcCalib::m_hLayerHitmapQ [private]
 

TH1F* IniMdcCalib::m_hLayerHitmapT [private]
 

TH1F* IniMdcCalib::m_hLayerHitmapT [private]
 

TH1F* IniMdcCalib::m_hlaymapQ[MdcCalNLayer] [private]
 

TH1F* IniMdcCalib::m_hlaymapQ[MdcCalNLayer] [private]
 

TH1F* IniMdcCalib::m_hlaymapT[MdcCalNLayer] [private]
 

TH1F* IniMdcCalib::m_hlaymapT[MdcCalNLayer] [private]
 

TObjArray* IniMdcCalib::m_hlist [private]
 

Reimplemented from MdcCalib.

TObjArray* IniMdcCalib::m_hlist [private]
 

Reimplemented from MdcCalib.

TH1F* IniMdcCalib::m_hqraw[MdcCalNLayer] [private]
 

TH1F* IniMdcCalib::m_hqraw[MdcCalNLayer] [private]
 

TH1F* IniMdcCalib::m_hqrawCel[MdcCalTotCell] [private]
 

TH1F* IniMdcCalib::m_hqrawCel[MdcCalTotCell] [private]
 

TH1F* IniMdcCalib::m_htdc[MdcCalNLayer] [private]
 

TH1F* IniMdcCalib::m_htdc[MdcCalNLayer] [private]
 

TH1F* IniMdcCalib::m_htdcTes[MdcCalNLayer][10] [private]
 

TH1F* IniMdcCalib::m_htdcTes[MdcCalNLayer][10] [private]
 

TH1F* IniMdcCalib::m_hTes[10] [private]
 

Reimplemented from MdcCalib.

TH1F* IniMdcCalib::m_hTes[10] [private]
 

Reimplemented from MdcCalib.

TH1F* IniMdcCalib::m_hTesAll [private]
 

Reimplemented from MdcCalib.

TH1F* IniMdcCalib::m_hTesAll [private]
 

Reimplemented from MdcCalib.

TH1F* IniMdcCalib::m_hTesCal [private]
 

TH1F* IniMdcCalib::m_hTesCal [private]
 

TH1F* IniMdcCalib::m_hTesFlag [private]
 

TH1F* IniMdcCalib::m_hTesFlag [private]
 

TH1F* IniMdcCalib::m_htraw[MdcCalNLayer] [private]
 

Reimplemented from MdcCalib.

TH1F* IniMdcCalib::m_htraw[MdcCalNLayer] [private]
 

Reimplemented from MdcCalib.

TH1F* IniMdcCalib::m_htrawCel[MdcCalTotCell] [private]
 

TH1F* IniMdcCalib::m_htrawCel[MdcCalTotCell] [private]
 

TH1F* IniMdcCalib::m_htrawTes[MdcCalNLayer][10] [private]
 

TH1F* IniMdcCalib::m_htrawTes[MdcCalNLayer][10] [private]
 

TH1F* IniMdcCalib::m_hWireHitMapQ [private]
 

TH1F* IniMdcCalib::m_hWireHitMapQ [private]
 

TH1F* IniMdcCalib::m_hWireHitMapT [private]
 

TH1F* IniMdcCalib::m_hWireHitMapT [private]
 

IMdcCalibFunSvc* IniMdcCalib::m_mdcFunSvc [private]
 

Reimplemented from MdcCalib.

IMdcCalibFunSvc* IniMdcCalib::m_mdcFunSvc [private]
 

Reimplemented from MdcCalib.

IMdcGeomSvc* IniMdcCalib::m_mdcGeomSvc [private]
 

Reimplemented from MdcCalib.

IMdcGeomSvc* IniMdcCalib::m_mdcGeomSvc [private]
 

Reimplemented from MdcCalib.

int IniMdcCalib::m_nLayer [private]
 

int IniMdcCalib::m_nWire [private]
 

MdcCalParams IniMdcCalib::m_param [private]
 

Reimplemented from MdcCalib.


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