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

XtMdcCalib Class Reference

#include <XtMdcCalib.h>

Inheritance diagram for XtMdcCalib:

MdcCalib MdcCalib List of all members.

Public Member Functions

void clear ()
void clear ()
int fillHist (MdcCalEvent *event)
int fillHist (MdcCalEvent *event)
int getHxtKey (int lay, int entr, int lr, int bin) const
int getHxtKey (int lay, int entr, int lr, int bin) const
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)
 XtMdcCalib ()
 XtMdcCalib ()
 ~XtMdcCalib ()
 ~XtMdcCalib ()

Static Public Member Functions

void fcnXT (Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
void fcnXT (Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
void fcnXtEdge (Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
void fcnXtEdge (Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
double xtFun (double t, double xtpar[])
double xtFun (double t, double xtpar[])

Static Public Attributes

double Dmax
std::vector< double > ERR
std::vector< double > ERR
std::vector< double > ERRED
std::vector< double > ERRED
std::vector< double > TBINCEN
std::vector< double > TBINCEN
std::vector< double > TBINCENED
std::vector< double > TBINCENED
double Tmax
std::vector< double > XMEAS
std::vector< double > XMEAS
std::vector< double > XMEASED
std::vector< double > XMEASED

Private Attributes

double m_docaMax [MdcCalNLayer]
TFolder * m_fdXt
TFolder * m_fdXt
bool m_fgIni
TObjArray * m_hlist
TObjArray * m_hlist
std::vector< TH1D * > m_hxt
std::vector< TH1D * > m_hxt
std::map< int, int > m_hxtmap
std::map< int, int > m_hxtmap
IMdcCalibFunSvcm_mdcFunSvc
IMdcCalibFunSvcm_mdcFunSvc
IMdcGeomSvcm_mdcGeomSvc
IMdcGeomSvcm_mdcGeomSvc
int m_nbin
int m_nEntr [43]
int m_nlayer
int m_nLR
int m_nxtpar
MdcCalParams m_param
double m_tbinw
double m_tm [MdcCalNLayer][MdcCalNENTRXT][MdcCalLR]

Static Private Attributes

const int HXTBIN_INDEX = 0
const int HXTBIN_MASK = 0x3F
const int HXTENTRA_INDEX = 8
const int HXTENTRA_MASK = 0x1F00
const int HXTLAYER_INDEX = 13
const int HXTLAYER_MASK = 0x7E000
const int HXTLR_INDEX = 6
const int HXTLR_MASK = 0xC0

Constructor & Destructor Documentation

XtMdcCalib::XtMdcCalib  ) 
 

00034                       {
00035      m_nbin = 50;
00036      m_nLR = 3;
00037      m_nxtpar = 8;
00038 
00039      for(int lay=0; lay<43; lay++){
00040           if(lay < 15) m_nEntr[lay] = 1;
00041           else  m_nEntr[lay] = 2;               // for entr>0 and entr<0
00042      }
00043 
00044      m_tbinw = 10.0;
00045      m_fgIni = false;
00046 }

XtMdcCalib::~XtMdcCalib  ) 
 

00048                        {
00049 }

XtMdcCalib::XtMdcCalib  ) 
 

XtMdcCalib::~XtMdcCalib  ) 
 


Member Function Documentation

void XtMdcCalib::clear  )  [virtual]
 

Implements MdcCalib.

void XtMdcCalib::clear  )  [virtual]
 

Implements MdcCalib.

00051                       {
00052      cout << "~XtMdcCalib" << endl;
00053 
00054      unsigned int i;
00055      for(i=0; i<m_hxt.size(); i++){
00056           delete m_hxt[i];
00057           if(0 == (i % 1000)) cout << "delete hxt[" << i << "]" << endl;
00058      }
00059      delete m_fdXt;
00060      m_hxt.clear();
00061      m_hxtmap.clear();
00062 
00063      MdcCalib::clear();
00064 }

void XtMdcCalib::fcnXT Int_t &  npar,
Double_t *  gin,
Double_t &  f,
Double_t *  par,
Int_t  iflag
[static]
 

void XtMdcCalib::fcnXT Int_t &  npar,
Double_t *  gin,
Double_t &  f,
Double_t *  par,
Int_t  iflag
[static]
 

00513                                                   {
00514      unsigned int i;
00515      int ord;
00516      Double_t deta;
00517      Double_t chisq = 0.0;
00518      Double_t dfit;
00519 
00520      for(i=0; i<TBINCEN.size(); i++){
00521           dfit = 0;
00522           for(ord=0; ord<=5; ord++){
00523                dfit += par[ord] * pow(TBINCEN[i], ord);
00524           }
00525           deta = (dfit - XMEAS[i]) / ERR[i];
00526           chisq += deta * deta;
00527      }
00528 
00529      f = chisq;
00530 }

void XtMdcCalib::fcnXtEdge Int_t &  npar,
Double_t *  gin,
Double_t &  f,
Double_t *  par,
Int_t  iflag
[static]
 

void XtMdcCalib::fcnXtEdge Int_t &  npar,
Double_t *  gin,
Double_t &  f,
Double_t *  par,
Int_t  iflag
[static]
 

00551                                                       {
00552      unsigned int i;
00553      Double_t deta;
00554      Double_t chisq = 0.0;
00555      Double_t dfit;
00556 
00557      for(i=0; i<TBINCENED.size(); i++){
00558           dfit = par[0] * (TBINCENED[i] - Tmax) + Dmax;
00559           deta = (dfit - XMEASED[i]) / ERRED[i];
00560           chisq += deta * deta;
00561      }
00562 
00563      f = chisq;
00564 }

int XtMdcCalib::fillHist MdcCalEvent event  )  [virtual]
 

Implements MdcCalib.

int XtMdcCalib::fillHist MdcCalEvent event  )  [virtual]
 

Implements MdcCalib.

00113                                           {
00114      IMessageSvc* msgSvc;
00115      Gaudi::svcLocator() -> service("MessageSvc", msgSvc);
00116      MsgStream log(msgSvc, "XtMdcCalib");
00117      log << MSG::DEBUG << "XtMdcCalib::fillHist()" << endreq;
00118 
00119      MdcCalib::fillHist(event);
00120 
00121      // get EsTimeCol
00122      bool esCutFg = event->getEsCutFlag();
00123      if( ! esCutFg ) return -1;
00124 
00125      int i;
00126      int k;
00127      int lay;
00128      int iLR;
00129      int iEntr;
00130      int bin;
00131      int key;
00132      int hid;
00133 
00134      double dr;
00135      double dz;
00136      double tdr;
00137      double doca;
00138      double resi;
00139      double entrance;
00140      int stat;
00141 
00142      double xtpar[MdcCalXtNPars];
00143      int nhitlay;
00144      bool fgHitLay[MdcCalNLayer];
00145 
00146      if(! m_fgIni){
00147           for(lay=0; lay<MdcCalNLayer; lay++){
00148                if(lay < 8) m_docaMax[lay] = m_param.maxDocaInner;
00149                else m_docaMax[lay] = m_param.maxDocaOuter;
00150           }
00151 
00152           for(lay=0; lay<MdcCalNLayer; lay++){
00153                for(iEntr=0; iEntr<m_nEntr[lay]; iEntr++){
00154                     for(iLR=0; iLR<MdcCalLR; iLR++){
00155 //                       m_mdcFunSvc -> getXtpar(lay, iEntr, iLR, xtpar);
00156                          if(0 == iEntr) m_mdcFunSvc -> getXtpar(lay, 8, iLR, xtpar);
00157                          else if(1 == iEntr) m_mdcFunSvc -> getXtpar(lay, 9, iLR, xtpar);
00158                          m_tm[lay][iEntr][iLR] = xtpar[6];
00159                     }
00160                }
00161           }
00162           m_fgIni = true;
00163      }
00164 
00165      MdcCalRecTrk* rectrk;
00166      MdcCalRecHit* rechit;
00167 
00168      int nhit;
00169      int ntrk = event -> getNTrk();
00170      if((ntrk < m_param.nTrkCut[0]) || (ntrk > m_param.nTrkCut[1])) return -1;
00171      for(i=0; i<ntrk; i++){
00172           rectrk = event->getRecTrk(i);
00173           nhit = rectrk -> getNHits();
00174 
00175           // dr cut
00176           dr = rectrk->getDr();
00177           if(fabs(dr) > m_param.drCut) continue;
00178 
00179           // dz cut
00180           dz = rectrk->getDz();
00181           if(fabs(dz) > m_param.dzCut) continue;
00182 
00183           for(lay=0; lay<MdcCalNLayer; lay++){
00184                fgHitLay[lay] = false;
00185           }
00186 
00187           for(k=0; k<nhit; k++){
00188                rechit = rectrk -> getRecHit(k);
00189                lay = rechit -> getLayid();
00190                fgHitLay[lay] = true;
00191           }
00192 
00193           nhitlay = 0;
00194           for(lay=0; lay<MdcCalNLayer; lay++){
00195                if(fgHitLay[lay]) nhitlay++;
00196           }
00197           if(nhitlay < m_param.nHitLayCut) continue;
00198 
00199           for(k=0; k<nhit; k++){
00200                rechit = rectrk -> getRecHit(k);
00201                lay = rechit -> getLayid();
00202                doca = rechit -> getDocaInc();
00203                iLR = rechit -> getLR();
00204                entrance = rechit -> getEntra();
00205                resi = rechit -> getResiInc();
00206                tdr = rechit -> getTdrift();
00207                stat = rechit -> getStat();
00208 
00209                if(1 != stat) continue;
00210 
00211                if( (fabs(doca) > m_docaMax[lay]) || 
00212                    (fabs(resi) > m_param.maxResi) ){
00213                     continue;
00214                }
00215 
00216                if(0 == lay){
00217                     if( ! fgHitLay[1] ) continue;
00218                } else if(42 == lay){
00219                     if( ! fgHitLay[41] ) continue;
00220                } else{
00221                     if( (!fgHitLay[lay-1]) && (!fgHitLay[lay+1]) ) continue;
00222                }
00223 
00224                iEntr = m_mdcFunSvc -> getXtEntrIndex(entrance);
00225                if(1 == m_nEntr[lay]){
00226                     iEntr = 0;
00227                } else if(2 == m_nEntr[lay]){
00228                     if(entrance > 0.0) iEntr = 1;
00229                     else iEntr = 0;
00230                }
00231 
00232                bin = (int)(tdr / m_tbinw);
00233 
00234                // left-right separately
00235                key = getHxtKey(lay, iEntr, iLR, bin);
00236                if((bin < m_nbin) && (1 == m_hxtmap.count(key))){
00237                     hid = m_hxtmap[key];
00238                     m_hxt[hid] -> Fill( resi );
00239                }
00240 
00241                // left-right in common
00242                key = getHxtKey(lay, iEntr, 2, bin);
00243                if((bin < m_nbin) && (1 == m_hxtmap.count(key))){
00244                     hid = m_hxtmap[key];
00245                     m_hxt[hid] -> Fill( resi );
00246                }
00247 
00248                if(fabs(tdr - m_tm[lay][iEntr][iLR]) < 5){
00249                     key = getHxtKey(lay, iEntr, iLR, m_nbin);
00250                     if( 1 == m_hxtmap.count(key) ){
00251                          hid = m_hxtmap[key];
00252                          m_hxt[hid] -> Fill( resi );
00253                     }
00254 
00255                     key = getHxtKey(lay, iEntr, 2, m_nbin);
00256                     if( 1 == m_hxtmap.count(key) ){
00257                          hid = m_hxtmap[key];
00258                          m_hxt[hid] -> Fill( resi );
00259                     }
00260                }
00261 
00262           } // hit loop
00263      } // track loop
00264      return 1;
00265 }

int XtMdcCalib::getHxtKey int  lay,
int  entr,
int  lr,
int  bin
const
 

int XtMdcCalib::getHxtKey int  lay,
int  entr,
int  lr,
int  bin
const
 

00501                                                                   {
00502      int key;
00503 
00504      key = ( (lay << HXTLAYER_INDEX) & HXTLAYER_MASK ) |
00505           ( (entr << HXTENTRA_INDEX) & HXTENTRA_MASK ) |
00506           ( (lr << HXTLR_INDEX) & HXTLR_MASK ) |
00507           ( (bin << HXTBIN_INDEX) & HXTBIN_MASK );
00508 
00509      return key;
00510 }

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

Implements MdcCalib.

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

Implements MdcCalib.

00068                                                         {
00069      IMessageSvc* msgSvc;
00070      Gaudi::svcLocator() -> service("MessageSvc", msgSvc);
00071      MsgStream log(msgSvc, "XtMdcCalib");
00072      log << MSG::INFO << "XtMdcCalib::initialize()" << endreq;
00073 
00074      m_hlist = hlist;
00075      m_mdcGeomSvc = mdcGeomSvc;
00076      m_mdcFunSvc = mdcFunSvc;
00077 
00078      MdcCalib::initialize(m_hlist, m_mdcGeomSvc, m_mdcFunSvc);
00079 
00080      int lay;
00081      int iLR;
00082      int iEntr;
00083      int bin;
00084      int hid;
00085      int key;
00086      char hname[200];
00087      TH1D* hist;
00088 
00089      m_fdXt = new TFolder("fdXt", "fdXt");
00090      m_hlist -> Add(m_fdXt);
00091 
00092      m_nlayer = m_mdcGeomSvc -> getLayerSize();
00093 
00094      hid = 0;
00095      for(lay=0; lay<m_nlayer; lay++){
00096           for(iEntr=0; iEntr<m_nEntr[lay]; iEntr++){
00097                for(iLR=0; iLR<m_nLR; iLR++){
00098                     for(bin=0; bin<=m_nbin; bin++){
00099                          sprintf(hname, "Hxt%02d_E%02d_LR%01d_B%02d", lay, iEntr, iLR, bin);
00100                          hist = new TH1D(hname, "", 300, -1.5, 1.5);
00101                          m_hxt.push_back( hist );
00102                          m_fdXt -> Add( hist );
00103 
00104                          key = getHxtKey(lay, iEntr, iLR, bin);
00105                          m_hxtmap.insert( valType2( key, hid ) );
00106                          hid++;
00107                     }
00108                }
00109           }
00110      }
00111 }

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

Reimplemented from MdcCalib.

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

Reimplemented from MdcCalib.

00626                                                     {
00627      MdcCalib::read_file(path);
00628 }

void XtMdcCalib::setParam MdcCalParams param  )  [virtual]
 

Implements MdcCalib.

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

Implements MdcCalib.

00082                                                    {
00083      MdcCalib::setParam(param);
00084      m_param = param;
00085 }

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

Reimplemented from MdcCalib.

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

Reimplemented from MdcCalib.

00566                                        {
00567      MdcCalib::settuple(path);
00568      TFile *f1 = new TFile(path.c_str());
00569      std::cout<<path<<std::endl;
00570      //
00571      m_fdXt=(TFolder *)f1->Get("fdXt;1");
00572      m_nlayer = m_mdcGeomSvc -> getLayerSize();
00573      int lay;
00574      int iLR;
00575      int iEntr;
00576      int bin;
00577      int hid=0;
00578      int key;
00579      char hname[200];
00580      TH1D* hist;
00581      /* for(int i=0; i<m_hxt.size(); i++){
00582         delete m_hxt[i];
00583         if(0 == (i % 1000)) cout << "delete hxt[" << i << "]" << endl;
00584         }*/
00585      m_hxt.clear();
00586      //   m_hxtmap.clear();
00587      for(lay=0; lay<m_nlayer; lay++){
00588           for( iEntr=0; iEntr<m_nEntr[lay]; iEntr++){
00589                for( iLR=0; iLR<m_nLR; iLR++){
00590                     for(bin=0; bin<=m_nbin; bin++){
00591                          sprintf(hname, "Hxt%02d_E%02d_LR%01d_B%02d", lay, iEntr, iLR, bin);
00592                          // hist = new TH1D(hname, "", 300, -1.5, 1.5);
00593                          hist=(TH1D *)m_fdXt->FindObject(hname);
00594                          m_hxt.push_back( hist );
00595 //                       m_fdXt -> Add( hist );
00596 //                       key = getHxtKey(lay, iEntr, iLR, bin);
00597 //                       m_hxtmap.insert( valType2( key, hid ) );
00598 //                       hid++;
00599                     }
00600                }
00601           }
00602      }
00603      double xtpar[MdcCalXtNPars];
00604      if(! m_fgIni){
00605           for(lay=0; lay<MdcCalNLayer; lay++){
00606                if(lay < 8) m_docaMax[lay] = m_param.maxDocaInner;
00607                else m_docaMax[lay] = m_param.maxDocaOuter;
00608           }
00609 
00610           for(lay=0; lay<MdcCalNLayer; lay++){
00611                for(iEntr=0; iEntr<m_nEntr[lay]; iEntr++){
00612                     for(iLR=0; iLR<MdcCalLR; iLR++){
00613 //                       m_mdcFunSvc -> getXtpar(lay, iEntr, iLR, xtpar);
00614                          if(0 == iEntr) m_mdcFunSvc -> getXtpar(lay, 8, iLR, xtpar);
00615                          else if(1 == iEntr) m_mdcFunSvc -> getXtpar(lay, 9, iLR, xtpar);
00616                          m_tm[lay][iEntr][iLR] = xtpar[6];
00617                     }
00618                }
00619           }
00620           m_fgIni = true;
00621      }
00622 
00623 }

int XtMdcCalib::updateConst MdcCalibConst calconst  )  [virtual]
 

Implements MdcCalib.

int XtMdcCalib::updateConst MdcCalibConst calconst  )  [virtual]
 

Implements MdcCalib.

00267                                                   {
00268      IMessageSvc* msgSvc;
00269      Gaudi::svcLocator() -> service("MessageSvc", msgSvc);
00270      MsgStream log(msgSvc, "XtMdcCalib");
00271      log << MSG::INFO << "XtMdcCalib::updateConst()" << endreq;
00272 
00273      MdcCalib::updateConst(calconst);
00274 
00275      int i;
00276      int hid;
00277      int lay;
00278      int iLR;
00279      int iEntr;
00280      int bin;
00281      int ord;
00282      int key;
00283 
00284      Stat_t entry;
00285      double xtpar;
00286      double xterr;
00287      double tbcen;
00288      double deltx;
00289      double xcor;
00290      double xerr;
00291      double xtini[8];
00292      double xtfit[8];
00293 
00294      Int_t ierflg;
00295      Int_t istat;
00296      Int_t nvpar;
00297      Int_t nparx;
00298      Double_t fmin;
00299      Double_t edm;
00300      Double_t errdef;
00301      Double_t arglist[10];
00302 
00303      TMinuit* gmxt = new TMinuit(6);
00304      gmxt -> SetPrintLevel(-1);
00305      gmxt -> SetFCN(fcnXT);
00306      gmxt -> SetErrorDef(1.0);
00307      gmxt -> mnparm(0, "xtpar0", 0, 0.1, 0, 0, ierflg);
00308      gmxt -> mnparm(1, "xtpar1", 0, 0.1, 0, 0, ierflg);
00309      gmxt -> mnparm(2, "xtpar2", 0, 0.1, 0, 0, ierflg);
00310      gmxt -> mnparm(3, "xtpar3", 0, 0.1, 0, 0, ierflg);
00311      gmxt -> mnparm(4, "xtpar4", 0, 0.1, 0, 0, ierflg);
00312      gmxt -> mnparm(5, "xtpar5", 0, 0.1, 0, 0, ierflg);
00313      arglist[0] = 0;
00314      gmxt -> mnexcm("SET NOW", arglist, 0, ierflg);
00315 
00316      TMinuit* gmxtEd = new TMinuit(1);
00317      gmxtEd -> SetPrintLevel(-1);
00318      gmxtEd -> SetFCN(fcnXtEdge);
00319      gmxtEd -> SetErrorDef(1.0);
00320      gmxtEd -> mnparm(0, "xtpar0", 0, 0.1, 0, 0, ierflg);
00321      arglist[0] = 0;
00322      gmxtEd -> mnexcm("SET NOW", arglist, 0, ierflg);
00323 
00324      ofstream fxtlog("xtlog");
00325      for(lay=0; lay<m_nlayer; lay++){
00326           if(0 == m_param.fgCalib[lay]) continue;
00327 
00328           for(iEntr=0; iEntr<m_nEntr[lay]; iEntr++){
00329                for(iLR=0; iLR<m_nLR; iLR++){
00330 
00331                     fxtlog << "Layer " << setw(3) << lay << setw(3) << iEntr
00332                            << setw(3) << iLR << endl;
00333 
00334                     for(ord=0; ord<m_nxtpar; ord++){
00335 //                       xtpar = calconst -> getXtpar(lay, iEntr, iLR, ord);
00336                          if(0 == iEntr) xtpar = calconst -> getXtpar(lay, 8, iLR, ord);
00337                          else if(1 == iEntr) xtpar = calconst -> getXtpar(lay, 9, iLR, ord);
00338 
00339                          xtini[ord] = xtpar;
00340                          xtfit[ord] = xtpar;
00341                     }
00342 
00343                     Tmax = xtini[6];
00344 
00345                     for(bin=0; bin<=m_nbin; bin++){
00346                          key = getHxtKey(lay, iEntr, iLR, bin);
00347                          hid = m_hxtmap[key];
00348 
00349                          entry = m_hxt[hid] -> GetEntries();
00350                          if(entry > 100){
00351                               deltx = m_hxt[hid] -> GetMean();
00352                               xerr = m_hxt[hid]->GetRMS();
00353                          } else{
00354                               continue;
00355                          }
00356 
00357                          if(bin < m_nbin)
00358                               tbcen = ( (double)bin + 0.5 ) * m_tbinw;
00359                          else tbcen = m_tm[lay][iEntr][iLR];
00360                          xcor = xtFun(tbcen, xtini) - deltx;
00361 
00362                          if((tbcen <= Tmax) || (bin == m_nbin)){
00363                               TBINCEN.push_back( tbcen );
00364                               XMEAS.push_back( xcor );
00365                               ERR.push_back( xerr );
00366                          } else{
00367                               TBINCENED.push_back( tbcen );
00368                               XMEASED.push_back( xcor );
00369                               ERRED.push_back( xerr );                              
00370                          } 
00371                          fxtlog << setw(3) << bin
00372                                 << setw(15) << deltx
00373                                 << setw(15) << xcor
00374                                 << setw(15) << tbcen
00375                                 << setw(15) << xerr
00376                                 << endl;
00377                     } // end of bin loop
00378 
00379                     if( XMEAS.size() < 12 ){
00380                          TBINCEN.clear();
00381                          XMEAS.clear();
00382                          ERR.clear();
00383 
00384                          TBINCENED.clear();
00385                          XMEASED.clear();
00386                          ERRED.clear();
00387 
00388                          continue;
00389                     }               
00390 
00391                     for(ord=0; ord<=5; ord++){
00392                          arglist[0] = ord + 1;
00393                          arglist[1] = xtini[ord];
00394                          gmxt -> mnexcm("SET PARameter", arglist, 2, ierflg);
00395                     }
00396 
00397                     // fix the xtpar[0] at 0
00398                     if(1 == m_param.fixXtC0){
00399                          arglist[0] = 1;
00400                          arglist[1] = 0.0;
00401                          gmxt -> mnexcm("SET PARameter", arglist, 2, ierflg);
00402                          gmxt -> mnexcm("FIX", arglist, 1, ierflg);
00403                     }
00404 
00405                     arglist[0] = 1000;
00406                     arglist[1] = 0.1;
00407                     gmxt -> mnexcm("MIGRAD", arglist, 2, ierflg);
00408                     gmxt -> mnstat(fmin, edm, errdef, nvpar, nparx, istat);
00409 
00410                     fxtlog << "Xtpar: " << endl;
00411                     if( (0 == ierflg) && (istat >= 2) ){
00412                          for(ord=0; ord<=5; ord++){
00413                               gmxt -> GetParameter(ord, xtpar, xterr);
00414 //                            calconst -> resetXtpar(lay, iEntr, iLR, ord, xtpar);
00415                               xtfit[ord] = xtpar;
00416 
00417                               if(1 == m_nEntr[lay]){
00418                                    for(i=0; i<18; i++)
00419                                         calconst -> resetXtpar(lay, i, iLR, ord, xtpar);
00420                               } else if(2 == m_nEntr[lay]){
00421                                    if(0 == iEntr){
00422                                         for(i=0; i<9; i++) // entr<0
00423                                              calconst->resetXtpar(lay, i, iLR, ord, xtpar);
00424                                    } else{
00425                                         for(i=9; i<18; i++) // entr>0
00426                                              calconst->resetXtpar(lay, i, iLR, ord, xtpar);
00427                                    }
00428                               }
00429                               fxtlog << setw(15) << xtpar << setw(15) << xterr << endl;
00430                          }
00431                     } else{
00432                          for(ord=0; ord<=5; ord++){
00433                               fxtlog << setw(15) << xtini[ord] << setw(15) << "0" << endl;
00434                          } 
00435                     }
00436                     fxtlog << setw(15) << Tmax << setw(15) << "0" << endl;
00437 
00438                     //   release the first parameter
00439                     if(1 == m_param.fixXtC0){
00440                          arglist[0] = 1;
00441                          gmxt -> mnexcm("REL", arglist, 1, ierflg);
00442                     }
00443 
00444                     Dmax = xtFun(Tmax, xtfit);
00445 
00446                     if( XMEASED.size() >= 3 ){
00447                          // fit xt in the edge area
00448                          arglist[0] = 1;
00449                          arglist[1] = xtini[7];
00450                          gmxtEd -> mnexcm("SET PARameter", arglist, 2, ierflg);
00451 
00452                          arglist[0] = 1000;
00453                          arglist[1] = 0.1;
00454                          gmxtEd -> mnexcm("MIGRAD", arglist, 2, ierflg);
00455                          gmxtEd -> mnstat(fmin, edm, errdef, nvpar, nparx, istat);
00456 
00457                          if( (0 == ierflg) && (istat >=2) ){
00458                               gmxtEd -> GetParameter(0, xtpar, xterr);
00459                               if(xtpar < 0.0) xtpar = 0.0;
00460 //                            calconst -> resetXtpar(lay, iEntr, iLR, 7, xtpar);
00461 
00462                               if(1 == m_nEntr[lay]){
00463                                    for(i=0; i<18; i++)
00464                                         calconst -> resetXtpar(lay, i, iLR, 7, xtpar);
00465                               } else if(2 == m_nEntr[lay]){
00466                                    if(0 == iEntr){
00467                                         for(i=0; i<9; i++)
00468                                              calconst->resetXtpar(lay, i, iLR, 7, xtpar);
00469                                    } else{
00470                                         for(i=9; i<18; i++)
00471                                              calconst->resetXtpar(lay, i, iLR, 7, xtpar);
00472                                    }
00473                               }
00474                               fxtlog << setw(15) << xtpar << setw(15) << xterr << endl;                              
00475                          } else {
00476                               fxtlog << setw(15) << xtini[7] << setw(15) << "0" << endl;
00477                          }
00478                     } else {
00479                          fxtlog << setw(15) << xtini[7] << setw(15) << "0" << endl;
00480                     }    
00481                     fxtlog << "Tm " << setw(15) << Tmax
00482                            << "  Dmax " << setw(15) << Dmax << endl;
00483 
00484                     TBINCEN.clear();
00485                     XMEAS.clear();
00486                     ERR.clear();
00487                     TBINCENED.clear();
00488                     XMEASED.clear();
00489                     ERRED.clear();                    
00490                } // end of l-r loop
00491           } // end of entrance angle loop
00492      } // end of layer loop
00493 
00494      fxtlog.close();
00495      delete gmxt;
00496      delete gmxtEd;
00497      cout << "Xt update finished" << endl;
00498      return 1;
00499 }

double XtMdcCalib::xtFun double  t,
double  xtpar[]
[static]
 

double XtMdcCalib::xtFun double  t,
double  xtpar[]
[static]
 

00532                                                 {
00533      int ord;
00534      double dist = 0.0;
00535      double tmax = xtpar[6];
00536 
00537      if(t < tmax ){
00538           for(ord=0; ord<=5; ord++){
00539                dist += xtpar[ord] * pow(t, ord);
00540           }
00541      }else{
00542           for(ord=0; ord<=5; ord++){
00543                dist += xtpar[ord] * pow(tmax, ord);
00544           }
00545           dist += xtpar[7] * (t - tmax);
00546      }
00547 
00548      return dist;
00549 }


Member Data Documentation

double XtMdcCalib::Dmax [static]
 

std::vector<double> XtMdcCalib::ERR [static]
 

vector< double > XtMdcCalib::ERR [static]
 

std::vector<double> XtMdcCalib::ERRED [static]
 

vector< double > XtMdcCalib::ERRED [static]
 

const int XtMdcCalib::HXTBIN_INDEX = 0 [static, private]
 

const int XtMdcCalib::HXTBIN_MASK = 0x3F [static, private]
 

const int XtMdcCalib::HXTENTRA_INDEX = 8 [static, private]
 

const int XtMdcCalib::HXTENTRA_MASK = 0x1F00 [static, private]
 

const int XtMdcCalib::HXTLAYER_INDEX = 13 [static, private]
 

const int XtMdcCalib::HXTLAYER_MASK = 0x7E000 [static, private]
 

const int XtMdcCalib::HXTLR_INDEX = 6 [static, private]
 

const int XtMdcCalib::HXTLR_MASK = 0xC0 [static, private]
 

double XtMdcCalib::m_docaMax [private]
 

Reimplemented from MdcCalib.

TFolder* XtMdcCalib::m_fdXt [private]
 

TFolder* XtMdcCalib::m_fdXt [private]
 

bool XtMdcCalib::m_fgIni [private]
 

Reimplemented from MdcCalib.

TObjArray* XtMdcCalib::m_hlist [private]
 

Reimplemented from MdcCalib.

TObjArray* XtMdcCalib::m_hlist [private]
 

Reimplemented from MdcCalib.

std::vector<TH1D*> XtMdcCalib::m_hxt [private]
 

std::vector<TH1D*> XtMdcCalib::m_hxt [private]
 

std::map<int, int> XtMdcCalib::m_hxtmap [private]
 

std::map<int, int> XtMdcCalib::m_hxtmap [private]
 

IMdcCalibFunSvc* XtMdcCalib::m_mdcFunSvc [private]
 

Reimplemented from MdcCalib.

IMdcCalibFunSvc* XtMdcCalib::m_mdcFunSvc [private]
 

Reimplemented from MdcCalib.

IMdcGeomSvc* XtMdcCalib::m_mdcGeomSvc [private]
 

Reimplemented from MdcCalib.

IMdcGeomSvc* XtMdcCalib::m_mdcGeomSvc [private]
 

Reimplemented from MdcCalib.

int XtMdcCalib::m_nbin [private]
 

int XtMdcCalib::m_nEntr [private]
 

Reimplemented from MdcCalib.

int XtMdcCalib::m_nlayer [private]
 

Reimplemented from MdcCalib.

int XtMdcCalib::m_nLR [private]
 

int XtMdcCalib::m_nxtpar [private]
 

MdcCalParams XtMdcCalib::m_param [private]
 

Reimplemented from MdcCalib.

double XtMdcCalib::m_tbinw [private]
 

double XtMdcCalib::m_tm [private]
 

std::vector<double> XtMdcCalib::TBINCEN [static]
 

vector< double > XtMdcCalib::TBINCEN [static]
 

std::vector<double> XtMdcCalib::TBINCENED [static]
 

vector< double > XtMdcCalib::TBINCENED [static]
 

double XtMdcCalib::Tmax [static]
 

std::vector<double> XtMdcCalib::XMEAS [static]
 

vector< double > XtMdcCalib::XMEAS [static]
 

std::vector<double> XtMdcCalib::XMEASED [static]
 

vector< double > XtMdcCalib::XMEASED [static]
 


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