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

DedxCalibWWLL Class Reference

#include <DedxCalibWWLL.h>

Inheritance diagram for DedxCalibWWLL:

DedxCalib DedxCalib List of all members.

Public Member Functions

void AnalyseHists ()
void AnalyseHists ()
void BookHists ()
void BookHists ()
void checkSelections ()
void checkSelections ()
 DedxCalibWWLL (const std::string &name, ISvcLocator *pSvcLocator)
 DedxCalibWWLL (const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode execute ()
virtual StatusCode execute ()
void FillHists ()
void FillHists ()
void FillHistsFromTree ()
void FillHistsFromTree ()
void FillTestHists ()
void FillTestHists ()
void FillTree ()
void FillTree ()
virtual StatusCode finalize ()
virtual StatusCode finalize ()
virtual Float_t GetChargeOffCorr (Int_t il, Int_t iw, Float_t ChargeIn, Float_t path, Float_t doca, Float_t EAngle, Float_t dipAngle, Float_t z)
virtual Float_t GetChargeOffCorr (Int_t il, Int_t iw, Float_t ChargeIn, Float_t path, Float_t doca, Float_t EAngle, Float_t dipAngle, Float_t z)
Float_t GetChargeOnCorr (Int_t il, Int_t iw, Float_t ChargeIn, Float_t path, Float_t doca, Float_t EAngle, Float_t dipAngle, Float_t z)
Float_t GetChargeOnCorr (Int_t il, Int_t iw, Float_t ChargeIn, Float_t path, Float_t doca, Float_t EAngle, Float_t dipAngle, Float_t z)
virtual StatusCode initialize ()
virtual StatusCode initialize ()
void ReadBetheBlochParameters ()
void ReadBetheBlochParameters ()
void ReadCalibdEdxParameters ()
void ReadCalibdEdxParameters ()
void WriteCalibdEdxParameters ()
void WriteCalibdEdxParameters ()
void WriteHists ()
void WriteHists ()

Protected Attributes

int calib_flag
bool ddgflag
IDedxCorrecSvcexsvc
IDedxCorrecSvcexsvc
IMdcGeomSvcgeosvc
IMdcGeomSvcgeosvc
bool ggsflag
bool layergflag
MsgStream log
std::string m_constrootfile
int m_correc_flag
std::string m_inputfile
int m_par_flag
int m_phshape_flag
std::string m_rootfile
bool wiregflag
bool zdepflag

Private Attributes

vector< TH1F * > m_layerhist
vector< TH1F * > m_layerhist
vector< TH1F * > m_layerhist_adc
vector< TH1F * > m_layerhist_adc
TObjArray * m_layerlist
TObjArray * m_layerlist
TObjArray * m_layerlist_adc
TObjArray * m_layerlist_adc
TRandom * m_rand
TRandom * m_rand
vector< TH1F * > m_wireghist
vector< TH1F * > m_wireghist
vector< TH1F * > m_wireghist_adc
vector< TH1F * > m_wireghist_adc
TObjArray * m_wireglist
TObjArray * m_wireglist
TObjArray * m_wireglist_adc
TObjArray * m_wireglist_adc

Constructor & Destructor Documentation

DedxCalibWWLL::DedxCalibWWLL const std::string &  name,
ISvcLocator *  pSvcLocator
 

00028   : DedxCalib(name, pSvcLocator)
00029 {
00030   log<<MSG::INFO<<"DedxCalibWWLL::DedxCalibWWLL( )..."<<endreq;
00031 }

DedxCalibWWLL::DedxCalibWWLL const std::string &  name,
ISvcLocator *  pSvcLocator
 


Member Function Documentation

void DedxCalibWWLL::AnalyseHists  )  [virtual]
 

Implements DedxCalib.

void DedxCalibWWLL::AnalyseHists  )  [virtual]
 

Implements DedxCalib.

00333 {
00334   log<<MSG::INFO<<"DedxCalibWWLL::AnalyseHists( )..."<<endreq;
00335 
00336   TF1* func;
00337   cout<<"wire m_phshape_flag="<<m_phshape_flag<<endl;
00338   if(m_phshape_flag==0) {
00339     func = new TF1("mylan",mylan,100,4000,4);
00340     func->SetParameters(10000.0,2010.1,300,-1.0);
00341   } else if(m_phshape_flag==1) { 
00342     func = new TF1("landaun",landaun,1000,4000,3);
00343     func->SetParameters(2000.0,300.0);
00344   } else if(m_phshape_flag==2) { 
00345     func = new TF1("land",Landau,100,4000,3);
00346     func->SetParameters(2010.1,300,10);
00347   } else if(m_phshape_flag==3) { 
00348     func = new TF1("vavi",Vavilov,1000,4000,2);
00349     func->SetParameters(3.1,0.4);
00350   } else if(m_phshape_flag==4) { 
00351     func = new TF1("asym",AsymGauss,1000,4000,4);
00352     func->SetParameters(10000.0,2000.0,300.0,100.);
00353 
00354   } 
00355 
00356   func->SetLineWidth(2.1);
00357   func->SetLineColor(2);   
00358   Double_t entry, mean, rms;
00359   Double_t binmax1;
00360   Double_t lp1[3];
00361 
00362   for(int wire=0; wire<6796; wire++){
00363     entry = m_wireghist[wire]->GetEntries();
00364     mean = m_wireghist[wire]->GetMean();
00365     rms = m_wireghist[wire]->GetRMS();
00366     binmax1 = m_wireghist[wire]->GetMaximumBin();
00367     //cout<<"binmax = "<<binmax<<endl;
00368     lp1[1] = m_wireghist[wire] ->GetBinCenter(binmax1);
00369     lp1[2] = 200;
00370     lp1[0] = (m_wireghist[wire]->GetBinContent(binmax1)+m_wireghist[wire]->GetBinContent(binmax1-1)+m_wireghist[wire]->GetBinContent(binmax1+1))/3;
00371  
00372 
00373    if(m_phshape_flag==0) {
00374       func->SetParameters(entry, mean, rms, -0.8);
00375     } else if(m_phshape_flag==1) {     
00376      //func->SetParameters(entry, 0.7*mean, rms );
00377       func->SetParameters(lp1[0], lp1[1], lp1[2] );
00378     } else if(m_phshape_flag==2) {     
00379       func->SetParameters(entry, 0.7*mean, rms );
00380     } else if(m_phshape_flag==3) { 
00381       func->SetParameters(0.05, 0.6);
00382     } else if(m_phshape_flag==4) {    
00383       func->SetParameters(entry, mean, rms, 1.0 );
00384    }
00385     m_wireghist[wire]->Fit(func, "Q" );    
00386   }         
00387 
00388   log<<MSG::INFO<<"DedxCalibLayerGain::AnalyseHists( )..."<<endreq;
00389  
00390   if(m_phshape_flag==0) {
00391     func = new TF1("mylan",mylan,100,4000,4);
00392     func->SetParameters(10000.0,2010.1,300,-1.0);
00393   } else if(m_phshape_flag==1) { 
00394     func = new TF1("landaun",landaun,1000,4000,3);
00395     func->SetParameters(2000.0,300.0);
00396   } else if(m_phshape_flag==2) { 
00397     func = new TF1("land",Landau,100,4000,3);
00398     func->SetParameters(2010.1,300,10);
00399   } else if(m_phshape_flag==3) { 
00400     func = new TF1("vavi",Vavilov,1000,4000,2);
00401     func->SetParameters(3.1,0.4);
00402   } else if(m_phshape_flag==4) { 
00403     func = new TF1("asym",AsymGauss,1000,4000,4);
00404     func->SetParameters(10000.0,2000.0,300.0,100.);
00405   } 
00406 
00407   func->SetLineWidth(2.1);
00408   func->SetLineColor(2);   
00409 //Double_t entry, mean, rms;
00410   Double_t binmax2;
00411   Double_t lp2[3];
00412   for(int lay=0; lay<43; lay++){
00413     entry = m_layerhist[lay]->GetEntries();
00414     mean = m_layerhist[lay]->GetMean();
00415     rms = m_layerhist[lay]->GetRMS();
00416     binmax2 = m_layerhist[lay]->GetMaximumBin();
00417     //cout<<"binmax = "<<binmax<<endl;
00418     lp2[1] = m_layerhist[lay]->GetBinCenter(binmax2);
00419     lp2[2] = 200;
00420     lp2[0] = (m_layerhist[lay]->GetBinContent(binmax2)+m_layerhist[lay]->GetBinContent(binmax2-1)+m_layerhist[lay]->GetBinContent(binmax2+1))/3;
00421     
00422     if(m_phshape_flag==0) {
00423       func->SetParameters(entry, mean, rms, -0.8);
00424     } else if(m_phshape_flag==1) {     
00425       func->SetParameters(entry, 0.7*mean, rms );
00426        func->SetParameters(lp2[0], lp2[1], lp2[2] );
00427     } else if(m_phshape_flag==2) {     
00428       func->SetParameters(entry, 0.7*mean, rms );
00429     } else if(m_phshape_flag==3) { 
00430       func->SetParameters(0.05, 0.6);
00431     } else if(m_phshape_flag==4) {     
00432       func->SetParameters(entry, mean, rms, 1.0 );
00433     }
00434     m_layerhist[lay]->Fit(func, "Q" );    
00435   }     
00436 }

void DedxCalibWWLL::BookHists  )  [virtual]
 

Implements DedxCalib.

void DedxCalibWWLL::BookHists  )  [virtual]
 

Implements DedxCalib.

00180 {  
00181   log<<MSG::INFO<<"DedxCalibWWLL::BookHists( )..."<<endreq;  
00182   log<<MSG::DEBUG<<" bookhist...1" <<endreq;                   
00183   m_wireglist = new TObjArray(0);
00184   m_layerlist = new TObjArray(0);
00185   m_wireglist_adc = new TObjArray(0);
00186   m_layerlist_adc = new TObjArray(0);
00187 
00188   log<<MSG::DEBUG<<" bookhist...2" <<endreq;                   
00189   m_rand = new TRandom();
00190   std::string hlabel;            
00191   log<<MSG::DEBUG<<" bookhist...3" <<endreq;
00192   
00193   for(int jj=0; jj<6796; jj++) {
00194     std::ostringstream strout;                                                 
00195     strout << "Wire_Gain_" << jj;
00196     hlabel = strout.str();
00197     TH1F *wireg = new TH1F(hlabel.c_str(), hlabel.c_str(), NumHistBins,MinHistValue,MaxHistValue);
00198     //    wireg->Print("base");
00199     wireg->GetXaxis()->SetTitle("dEdx(eV/1.5cm)");
00200     wireg->GetYaxis()->SetTitle("entries/(40eV/1.5cm)");
00201     m_wireghist.push_back(wireg);                                              
00202     m_wireglist -> Add(wireg);                             
00203   }
00204   for(int jj=0; jj<6796; jj++) {
00205     std::ostringstream strout;
00206     strout << "Wire_Gain_Adc_" << jj;
00207     hlabel = strout.str();
00208     TH1F *wireg_adc = new TH1F(hlabel.c_str(), hlabel.c_str(), NumHistBins,MinHistValue,MaxHistValue);
00209     //    wireg->Print("base");
00210     wireg_adc->GetXaxis()->SetTitle("dEdx(eV/1.5cm)");
00211     wireg_adc->GetYaxis()->SetTitle("entries/(40eV/1.5cm)");
00212     m_wireghist_adc.push_back(wireg_adc);
00213     m_wireglist_adc -> Add(wireg_adc);
00214   }
00215   
00216   log<<MSG::DEBUG<<" m_wireghist size..." <<m_wireghist.size()<<endreq;  
00217 
00218    for(int jj=0; jj<43; jj++) {
00219     std::ostringstream strout;                                                 
00220     strout << "Layer_Gain_" << jj;
00221     hlabel = strout.str();
00222     TH1F *layerg = new TH1F(hlabel.c_str(), hlabel.c_str(), NumHistBins,MinHistValue,MaxHistValue);
00223     //    layerg->Print("base");
00224     layerg->GetXaxis()->SetTitle("dE/dx(eV/1.5cm)");
00225     layerg->GetYaxis()->SetTitle("entries/(40eV/1.5cm)");
00226     m_layerhist.push_back(layerg);                                              
00227     m_layerlist -> Add(layerg);                             
00228   }
00229 
00230   for(int jj=0; jj<43; jj++) {
00231     std::ostringstream strout;
00232     strout << "Layer_Gain_Adc_" << jj;
00233     hlabel = strout.str();
00234     TH1F *layerg_adc = new TH1F(hlabel.c_str(), hlabel.c_str(), NumHistBins,MinHistValue,MaxHistValue);
00235 //    layerg->Print("base");
00236     layerg_adc->GetXaxis()->SetTitle("dE/dx(eV/1.5cm)");
00237     layerg_adc->GetYaxis()->SetTitle("entries/(40eV/1.5cm)");
00238     m_layerhist_adc.push_back(layerg_adc);
00239     m_layerlist_adc -> Add(layerg_adc);
00240                 }
00241                   
00242    log<<MSG::DEBUG<<" m_layerhist size..." <<m_layerhist.size()<<endreq;  
00243 }

void DedxCalib::checkSelections  )  [inherited]
 

void DedxCalib::checkSelections  )  [inherited]
 

00121                                 {
00122   log<<MSG::INFO<<"DedxCalib::checkSelections()...."<<endreq;
00123 }

virtual StatusCode DedxCalib::execute  )  [virtual, inherited]
 

StatusCode DedxCalib::execute  )  [virtual, inherited]
 

00075                               {
00076   
00077   this->FillTree();
00078   
00079   this->FillHists();
00080   return StatusCode::SUCCESS;
00081 }

void DedxCalibWWLL::FillHists  )  [virtual]
 

Implements DedxCalib.

void DedxCalibWWLL::FillHists  )  [virtual]
 

Implements DedxCalib.

00246 {  
00247   log<<MSG::INFO<<"DedxCalibWWLL::FillHists( )..."<<endreq;  
00248     SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
00249   if (!eventHeader) {
00250     log << MSG::FATAL << "Could not find Event Header" << endreq;
00251     return;
00252   }   
00253   int event = eventHeader->eventNumber();
00254   int runNO = eventHeader->runNumber();
00255   int typFlag; //data type flag: 0:MC data,   1: 2150,      2:2200
00256   if(runNO<0) typFlag =0;
00257   else if(runNO>=0 && runNO<5459) typFlag =1;
00258   else if(runNO>=5459 && runNO<8093) typFlag =2;
00259   else if(runNO>=8093) typFlag =3;
00260 
00261   Identifier mdcid;
00262   SmartDataPtr<RecMdcTrackCol> trkCol(eventSvc(),"/Event/Recon/RecMdcTrackCol");
00263   if (!trkCol) { 
00264      log << MSG::WARNING << "Could not find RecMdcTrackCol" << endreq;
00265      return;
00266   }
00267    int ntrk = trkCol->size();
00268    int lr, layid, hid, localwid, w0id, wid;;
00269    double adc_raw, costhe, zhit, ddl, ddr, dd, ph, sinenta, sintheta, pathlength, rphi_path;
00270    double m_driftd, driftd; 
00271    log << MSG::INFO << "Begin to check RecMdcTrackCol"<<endreq; 
00272   
00273    RecMdcTrackCol::iterator iter_trk_hit = trkCol->begin();
00274    if (trkCol->size() !=2 ) return;
00275    for( ; iter_trk_hit != trkCol->end(); iter_trk_hit++){
00276      HitRefVec gothits = (*iter_trk_hit)->getVecHits();
00277      if(gothits.size()<25) return;
00278    }
00279 
00280    RecMdcTrackCol::iterator iter_trk = trkCol->begin();
00281    for( ; iter_trk != trkCol->end(); iter_trk++) {
00282    //   if(ntrk!=2) continue; 
00283  
00284       HepVector a = (*iter_trk)->helix();  
00285       HepSymMatrix tkErrM = (*iter_trk)->err();
00286       double m_d0E   = tkErrM[0][0];
00287       double m_phi0E = tkErrM[1][1];
00288       double m_cpaE  = tkErrM[2][2];
00289       double m_z0E   = tkErrM[3][3]; 
00290         
00291    //   cout<<"ntrk = "<<ntrk<<endl;
00292       HepPoint3D IP(0,0,0);
00293       Dedx_Helix exhel(IP, a);
00294       log << MSG::DEBUG << "hitList of this  track:" << endreq;
00295       HitRefVec gothits = (*iter_trk)->getVecHits();
00296       HitRefVec::iterator it_gothit = gothits.begin();
00297       for( ; it_gothit != gothits.end(); it_gothit++) {
00298         mdcid = (*it_gothit)->getMdcId();
00299         layid =  MdcID::layer(mdcid);
00300         localwid = MdcID::wire(mdcid);
00301         w0id = geosvc->Layer(layid)->Wirst();
00302         wid = w0id + localwid;
00303         adc_raw = (*it_gothit)->getAdc()*1000000;
00304         zhit = (*it_gothit)->getZhit();
00305         lr = (*it_gothit)->getFlagLR();
00306         if(lr == 0 || lr == 2) m_driftd = (*it_gothit)->getDriftDistLeft();
00307         if(lr == 1 ) m_driftd = (*it_gothit)->getDriftDistRight();
00308         driftd = abs(m_driftd);
00309         dd = (*it_gothit)->getDoca();
00310         sinenta = sin((*it_gothit)->getEntra());        
00311         costhe = cos(atan(a[4]));
00312         sintheta = sin(M_PI_2-atan(a[4]));
00313         int ntpFlag = 1;
00314         ph = exsvc->StandardCorrec(typFlag, ntpFlag, runNO, exhel, mdcid, adc_raw, dd, sinenta, zhit, costhe );
00315         pathlength = exsvc->PathL(ntpFlag, exhel, layid, localwid, zhit);
00316         rphi_path = pathlength * sintheta;
00317         if (pathlength ==-1) continue;
00318            if(layid <8)
00319         {if(adc_raw<MinADCValuecut || adc_raw>MaxADCValuecut || rphi_path>RPhi_PathMaxCut || rphi_path<Iner_RPhi_PathMinCut || driftd>Iner_DriftDistCut) continue;}
00320         else if(layid >= 8)
00321         {if(adc_raw<MinADCValuecut || adc_raw>MaxADCValuecut || rphi_path>RPhi_PathMaxCut || rphi_path<Out_RPhi_PathMinCut || driftd>Out_DriftDistCut) continue;}
00322         m_wireghist[wid]->Fill(ph);
00323         m_wireghist_adc[wid]->Fill(adc_raw);
00324         //        if(w_stat[wid] == -1) continue;
00325         m_layerhist[layid]->Fill(ph);     
00326         m_layerhist_adc[layid]->Fill(adc_raw);
00327       } 
00328    }
00329 }

void DedxCalibWWLL::FillHistsFromTree  )  [virtual]
 

Implements DedxCalib.

void DedxCalibWWLL::FillHistsFromTree  )  [virtual]
 

Implements DedxCalib.

00439 {
00440   log<<MSG::INFO<<"DedxCalibWWLL::FillHistsFromTree( )..."<<endreq;  
00441 }

void DedxCalib::FillTestHists  )  [inherited]
 

void DedxCalib::FillTestHists  )  [inherited]
 

00117                               {
00118   log<<MSG::INFO<<"DedxCalib::FillTestHists()...."<<endreq;
00119 }

void DedxCalib::FillTree  )  [inherited]
 

void DedxCalib::FillTree  )  [inherited]
 

00105                          {
00106   log<<MSG::INFO<<"DedxCalib::FillTree()...."<<endreq;
00107 }

virtual StatusCode DedxCalib::finalize  )  [virtual, inherited]
 

StatusCode DedxCalib::finalize  )  [virtual, inherited]
 

00084                                {
00085   
00086   log << MSG::INFO << "DedxCalib finalize() ..." << endreq;
00087   this->AnalyseHists();
00088   
00089   this->WriteCalibdEdxParameters();
00090   this->WriteHists();
00091 
00092   this->FillTestHists();
00093 
00094   
00095   
00096   return StatusCode::SUCCESS;
00097 }

virtual Float_t DedxCalibWWLL::GetChargeOffCorr Int_t  il,
Int_t  iw,
Float_t  ChargeIn,
Float_t  path,
Float_t  doca,
Float_t  EAngle,
Float_t  dipAngle,
Float_t  z
[virtual]
 

Implements DedxCalib.

Float_t DedxCalibWWLL::GetChargeOffCorr Int_t  il,
Int_t  iw,
Float_t  ChargeIn,
Float_t  path,
Float_t  doca,
Float_t  EAngle,
Float_t  dipAngle,
Float_t  z
[virtual]
 

Implements DedxCalib.

00036 {
00037   log<<MSG::INFO<<"DedxCalibWWLL::GetChargeOffCorr( )..."<<endreq;
00038         return 1.0;
00039 }

Float_t DedxCalib::GetChargeOnCorr Int_t  il,
Int_t  iw,
Float_t  ChargeIn,
Float_t  path,
Float_t  doca,
Float_t  EAngle,
Float_t  dipAngle,
Float_t  z
[inherited]
 

Float_t DedxCalib::GetChargeOnCorr Int_t  il,
Int_t  iw,
Float_t  ChargeIn,
Float_t  path,
Float_t  doca,
Float_t  EAngle,
Float_t  dipAngle,
Float_t  z
[inherited]
 

00127                                                                {
00128   
00129 }

virtual StatusCode DedxCalib::initialize  )  [virtual, inherited]
 

StatusCode DedxCalib::initialize  )  [virtual, inherited]
 

00035                                  {
00036   log << MSG::INFO << "DedxCalib initialze() ..." << endreq;
00037   /*StatusCode scint = Service::initialize();
00038   if( scint.isFailure() ) return scint;
00039   IIncidentSvc* incsvc;
00040   scint = service("IncidentSvc", incsvc);
00041   int priority = 100;
00042   if( sc.isSuccess() ){
00043     incsvc -> addListener(this, "BeginEvent", priority);
00044    //incsvc -> addListener(this, "NewRun", priority);
00045   }*/  
00046 
00047   StatusCode sc = service("MdcGeomSvc", geosvc);   
00048   if (sc ==  StatusCode::SUCCESS) {              
00049     log << MSG::INFO <<"MdcGeomSvc is running"<<endl;
00050   } else {
00051     log << MSG::ERROR <<"MdcGeomSvc is failed"<<endl;
00052     return StatusCode::SUCCESS;
00053   }
00054 
00055   StatusCode scex = service("DedxCorrecSvc", exsvc);
00056   if (scex ==  StatusCode::SUCCESS) {              
00057     log << MSG::INFO <<"Hi, DedxCorrectSvc is running"<<endl;
00058   } else {
00059     log << MSG::ERROR <<"DedxCorrectSvc is failed"<<endl;
00060     return StatusCode::SUCCESS;
00061   }
00062 
00063   exsvc->set_flag( calib_flag );
00064   this->checkSelections();
00065   log << MSG::INFO <<"DedxCalib: read correction parameters"<<endreq;
00066   this->ReadCalibdEdxParameters();
00067   this->FillHistsFromTree();
00068   
00069   this->BookHists();
00070   
00071   return StatusCode::SUCCESS;
00072 }

void DedxCalib::ReadBetheBlochParameters  )  [inherited]
 

void DedxCalib::ReadBetheBlochParameters  )  [inherited]
 

void DedxCalib::ReadCalibdEdxParameters  )  [inherited]
 

void DedxCalib::ReadCalibdEdxParameters  )  [inherited]
 

00109                                         {
00110   log<<MSG::INFO<<"DedxCalib::ReadCalibdEdxParameters()...."<<endreq;
00111 }

void DedxCalibWWLL::WriteCalibdEdxParameters  )  [virtual]
 

Reimplemented from DedxCalib.

void DedxCalibWWLL::WriteCalibdEdxParameters  )  [virtual]
 

Reimplemented from DedxCalib.

00444 {  
00445   log<<MSG::INFO<<"DedxCalibWWLL::WriteCalibdEdxParameters( )..."<<endreq;
00446 }

void DedxCalibWWLL::WriteHists  )  [virtual]
 

Implements DedxCalib.

void DedxCalibWWLL::WriteHists  )  [virtual]
 

Implements DedxCalib.

00042 {        
00043   log<<MSG::INFO<<"DedxCalibLayerGain::WriteHists( )..."<<endreq;
00044   double layermean[43],layermean0,layergain[43],layerchisq[43],meanlayer[43],rmslayer[43];
00045   double layerentries[43];
00046   double layNO[43];
00047   if(m_phshape_flag==0) {
00048     layermean0 = m_layerhist[34] -> GetFunction("mylan") -> GetParameter(1); 
00049   } else   if(m_phshape_flag==1) {
00050     layermean0 = m_layerhist[34] -> GetFunction("landaun") -> GetParameter(1); 
00051   } else   if(m_phshape_flag==2) {
00052     layermean0 = m_layerhist[34] -> GetFunction("land") -> GetParameter(1);
00053   } else   if(m_phshape_flag==3) {
00054     layermean0 = m_layerhist[34] -> GetFunction("vavi") -> GetParameter(1); 
00055   } else   if(m_phshape_flag==4) {
00056     layermean0 = m_layerhist[34] -> GetFunction("asym") -> GetParameter(1); 
00057   }
00058 
00059   for(int lay=0; lay<43; lay++) {
00060     layerentries[lay] = m_layerhist[lay]->GetEntries();
00061     meanlayer[lay] = m_layerhist[lay]->GetMean();
00062     rmslayer[lay] = m_layerhist[lay]->GetRMS();
00063     layNO[lay] = lay;
00064     if(m_phshape_flag==0) {
00065       layermean[lay]  = m_layerhist[lay] -> GetFunction("mylan") -> GetParameter(1); 
00066       layerchisq[lay] = m_layerhist[lay] -> GetFunction("mylan") -> GetParameter(2);
00067     } else if(m_phshape_flag==1) {
00068       layermean[lay]  = m_layerhist[lay] -> GetFunction("landaun") -> GetParameter(1); 
00069       layerchisq[lay] = m_layerhist[lay] -> GetFunction("landaun") -> GetParameter(2);
00070     } else if(m_phshape_flag==2) {
00071       layermean[lay]  = m_layerhist[lay] -> GetFunction("land") -> GetParameter(1); 
00072       layerchisq[lay] = m_layerhist[lay] -> GetFunction("land") -> GetParameter(2);
00073     } else if(m_phshape_flag==3) {
00074       layermean[lay]  = m_layerhist[lay] -> GetFunction("vavi") -> GetParameter(1); 
00075     } else if(m_phshape_flag==4) {
00076       layermean[lay]  = m_layerhist[lay] -> GetFunction("asym") -> GetParameter(1); 
00077     }
00078 
00079     if(layermean0) {
00080       layergain[lay] = layermean[lay]/layermean0;
00081     } else {
00082       layergain[lay] = layermean[lay]/2000.0;
00083     }
00084       log<<MSG::WARNING <<"layermean["<<lay<<"] = "<<m_layerhist[lay]->GetMean()
00085       <<"fitted mean:"<<layermean[lay]<<endreq;           
00086 //      cout<<"layermean["<<lay<<"] = "<<layermean[lay] <<endl;
00087   }
00088   
00089   
00090  log<<MSG::INFO <<"DedxCalibWireGain::WriteHists( )..."<<endreq;
00091  double wiregmean[6796],wiregmean0,wiregain[6796],wiregchisq[6796],meanwire[6796],rmswire[6796];
00092  int layerNO;
00093  double    wirentries[6796],wireNO[6796];
00094   if(m_phshape_flag==0) {
00095  //   mean0  = m_hist[0]->GetMean();
00096     wiregmean0 = m_wireghist[0] -> GetFunction("mylan") -> GetParameter(1); 
00097   } else   if(m_phshape_flag==1) {
00098     wiregmean0 = m_wireghist[0] -> GetFunction("landaun") -> GetParameter(1); 
00099   } else   if(m_phshape_flag==2) {
00100     wiregmean0 = m_wireghist[0] -> GetFunction("land") -> GetParameter(1);
00101   } else   if(m_phshape_flag==3) {
00102     wiregmean0 = m_wireghist[0] -> GetFunction("vavi") -> GetParameter(1); 
00103   } else   if(m_phshape_flag==4) {
00104     wiregmean0 = m_wireghist[0] -> GetFunction("asym") -> GetParameter(1);
00105   }
00106 
00107   for(int wire=0; wire<6796; wire++) {
00108      wirentries[wire] = m_wireghist[wire]->GetEntries();
00109      meanwire[wire] = m_wireghist[wire]->GetMean();
00110      rmswire[wire] = m_wireghist[wire]->GetRMS();
00111     if(m_phshape_flag==0) {
00112 //      mean[wire]  = m_hist[wire]->GetMean();
00113       wiregmean[wire]  = m_wireghist[wire] -> GetFunction("mylan") -> GetParameter(1); 
00114       wiregchisq[wire] = m_wireghist[wire] -> GetFunction("mylan") -> GetParameter(2);
00115     } else if(m_phshape_flag==1) {
00116       wiregmean[wire]  = m_wireghist[wire] -> GetFunction("landaun") -> GetParameter(1); 
00117       wiregchisq[wire] = m_wireghist[wire] -> GetFunction("landaun") -> GetParameter(2);
00118     } else if(m_phshape_flag==2) {
00119       wiregmean[wire]  = m_wireghist[wire] -> GetFunction("land") -> GetParameter(1); 
00120       wiregchisq[wire] = m_wireghist[wire] -> GetFunction("land") -> GetParameter(2);
00121     } else if(m_phshape_flag==3) {
00122       wiregmean[wire]  = m_wireghist[wire] -> GetFunction("vavi") -> GetParameter(1); 
00123     } else if(m_phshape_flag==4) {
00124       wiregmean[wire]  = m_wireghist[wire] -> GetFunction("asym") -> GetParameter(1);
00125         }
00126   layerNO = geosvc->Wire(wire)->Layer();
00127   //cout<<"layerNO = "<<layerNO<<",     layermean= "<<layermean[layerNO] <<endl;
00128   if(layermean[layerNO] ) {
00129       wiregain[wire] = wiregmean[wire]/layermean[layerNO];
00130     } else {
00131       wiregain[wire] = wiregmean[wire]/2000.0;
00132     }
00133     log<< MSG::INFO << "mean["<<wire<<"] = " <<m_wireghist[wire]->GetMean()
00134        <<"fitted mean:"<<wiregmean[wire]<<endreq;        
00135   //  cout<<"wiregmean["<<wire<<"] = "<<wiregmean[wire] <<endl;
00136   }
00137    
00138    
00139   TFile fhist("/ihepbatch/besd09/xcao/calibconst_temp/wwllcalib.root", "recreate");
00140   TTree* wwllg = new TTree("wwllcalib", "wwllcalib");
00141   wwllg -> Branch("wireg", &wiregain, "wireg[6796]/D");
00142   wwllg -> Branch("wirentries", &wirentries, "wirentries[6796]/D");
00143   wwllg -> Branch("meanwire", &meanwire, "meanwire[6796]/D");
00144   wwllg -> Branch("rmswire", &rmswire, "rmswire[6796]/D");
00145   wwllg -> Branch("wiregchisq", &wiregchisq, "wiregchisq[6796]/D");
00146   wwllg -> Branch("wiregmean", &wiregmean, "wiregmean[6796]/D");
00147 
00148   wwllg -> Branch("layerg", &layergain, "layerg[43]/D");
00149   wwllg -> Branch("layerentries", &layerentries, "layerentries[43]/D");
00150   wwllg -> Branch("meanlayer", &meanlayer, "meanlayer[43]/D");
00151   wwllg -> Branch("rmslayer", &rmslayer, "rmslayer[43]/D");
00152   wwllg -> Branch("layerchisq", &layerchisq, "layerchisq[43]/D");
00153   wwllg -> Branch("layermean", &layermean, "layermean[43]/D");
00154 
00155 
00156 //  wireg -> Branch("parameter",&parameter,"parameter[6796]/D");
00157   wwllg -> Fill();
00158   wwllg -> Write();
00159   m_wireglist -> Write();
00160   m_layerlist -> Write(); 
00161   m_wireglist_adc -> Write();
00162   m_layerlist_adc -> Write();
00163   fhist.Close();    
00164 
00165   for(int i=0; i<6796; i++) {delete m_wireghist[i];
00166                              delete m_wireghist_adc[i]; }
00167   delete m_wireglist;   
00168   delete m_wireglist_adc;
00169   //delete wireg;
00170  // delete m_rand;     
00171   for(int i=0; i<43; i++) {delete m_layerhist[i];   
00172                            delete m_layerhist_adc[i]; }                               
00173   delete m_layerlist;                            
00174   delete m_layerlist_adc;
00175   delete m_rand;       
00176  
00177 }


Member Data Documentation

int DedxCalib::calib_flag [protected, inherited]
 

bool DedxCalib::ddgflag [protected, inherited]
 

IDedxCorrecSvc* DedxCalib::exsvc [protected, inherited]
 

IDedxCorrecSvc* DedxCalib::exsvc [protected, inherited]
 

IMdcGeomSvc* DedxCalib::geosvc [protected, inherited]
 

IMdcGeomSvc* DedxCalib::geosvc [protected, inherited]
 

bool DedxCalib::ggsflag [protected, inherited]
 

bool DedxCalib::layergflag [protected, inherited]
 

MsgStream DedxCalib::log [protected, inherited]
 

std::string DedxCalib::m_constrootfile [protected, inherited]
 

int DedxCalib::m_correc_flag [protected, inherited]
 

std::string DedxCalib::m_inputfile [protected, inherited]
 

vector<TH1F*> DedxCalibWWLL::m_layerhist [private]
 

vector<TH1F*> DedxCalibWWLL::m_layerhist [private]
 

vector<TH1F*> DedxCalibWWLL::m_layerhist_adc [private]
 

vector<TH1F*> DedxCalibWWLL::m_layerhist_adc [private]
 

TObjArray* DedxCalibWWLL::m_layerlist [private]
 

TObjArray* DedxCalibWWLL::m_layerlist [private]
 

TObjArray* DedxCalibWWLL::m_layerlist_adc [private]
 

TObjArray* DedxCalibWWLL::m_layerlist_adc [private]
 

int DedxCalib::m_par_flag [protected, inherited]
 

int DedxCalib::m_phshape_flag [protected, inherited]
 

TRandom* DedxCalibWWLL::m_rand [private]
 

TRandom* DedxCalibWWLL::m_rand [private]
 

std::string DedxCalib::m_rootfile [protected, inherited]
 

vector<TH1F*> DedxCalibWWLL::m_wireghist [private]
 

vector<TH1F*> DedxCalibWWLL::m_wireghist [private]
 

vector<TH1F*> DedxCalibWWLL::m_wireghist_adc [private]
 

vector<TH1F*> DedxCalibWWLL::m_wireghist_adc [private]
 

TObjArray* DedxCalibWWLL::m_wireglist [private]
 

TObjArray* DedxCalibWWLL::m_wireglist [private]
 

TObjArray* DedxCalibWWLL::m_wireglist_adc [private]
 

TObjArray* DedxCalibWWLL::m_wireglist_adc [private]
 

bool DedxCalib::wiregflag [protected, inherited]
 

bool DedxCalib::zdepflag [protected, inherited]
 


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