#include <DedxCalibDocaEAng.h>
Inheritance diagram for DedxCalibDocaEAng:
Public Member Functions | |
void | AnalyseHists () |
void | AnalyseHists () |
void | BookHists () |
void | BookHists () |
void | checkSelections () |
void | checkSelections () |
DedxCalibDocaEAng (const std::string &name, ISvcLocator *pSvcLocator) | |
DedxCalibDocaEAng (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 |
IDedxCorrecSvc * | exsvc |
IDedxCorrecSvc * | exsvc |
IMdcGeomSvc * | geosvc |
IMdcGeomSvc * | geosvc |
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 | |
TProfile2D ** | hprof2d |
TProfile2D ** | hprof2d |
vector< TProfile2D * > | m_profhist |
vector< TProfile2D * > | m_profhist |
TObjArray * | m_proflist |
TObjArray * | m_proflist |
TRandom * | m_rand |
TRandom * | m_rand |
|
00025 : DedxCalib(name, pSvcLocator) 00026 { 00027 log<<MSG::INFO<<"DedxCalibDocaEAng::DedxCalibDocaEAng( )..."<<endreq; 00028 }
|
|
|
|
Implements DedxCalib. |
|
Implements DedxCalib. 00188 { 00189 log<<MSG::INFO<<"DedxCalibDocaEAng::AnalyseHists( )..."<<endreq; 00190 cout<<"drift distance m_phshape_flag="<<m_phshape_flag<<endl; 00191 double gaincell[43][5][5],gaincheck[25]; 00192 00193 }
|
|
Implements DedxCalib. |
|
Implements DedxCalib. 00085 { 00086 log<<MSG::INFO<<"DedxCalibDocaEAng::BookHists( )..."<<endreq; 00087 log<<MSG::DEBUG<<" bookhist...1" <<endreq; 00088 m_proflist = new TObjArray(0); 00089 log<<MSG::DEBUG<<" bookhist...2" <<endreq; 00090 m_rand = new TRandom(); 00091 std::string hlabel; 00092 00093 log<<MSG::DEBUG<<" bookhist...3" <<endreq; 00094 00095 hprof2d = new TProfile2D* [43]; 00096 for(int L=0; L<43; L++) { 00097 std::ostringstream strout; 00098 strout<< "Gain_Layer_" << L ; 00099 hlabel = strout.str(); 00100 00101 // hprof2d[L] = new TProfile2D(hlabel.c_str(),hlabel.c_str(),10,0,10,10,0.0,2.0,0,20); 00102 hprof2d[L] = new TProfile2D(hlabel.c_str(),hlabel.c_str(),40,0,1.0,40,-0.8,0.8); 00103 00104 // hprof2d->GetXaxis()->SetTitle("doca(mm)"); 00105 // hprof2d->GetYaxis()->SetTitle("entrance angle"); 00106 // m_profhist.push_back(hprof2d); 00107 // m_proflist -> Add(hprof2d); 00108 } 00109 00110 00111 00112 log<<MSG::DEBUG<<" m_profhist size..." <<m_profhist.size()<<endreq; 00113 }
|
|
|
|
00121 { 00122 log<<MSG::INFO<<"DedxCalib::checkSelections()...."<<endreq; 00123 }
|
|
|
|
00075 { 00076 00077 this->FillTree(); 00078 00079 this->FillHists(); 00080 return StatusCode::SUCCESS; 00081 }
|
|
Implements DedxCalib. |
|
Implements DedxCalib. 00116 { 00117 log<<MSG::INFO<<"DedxCalibDocaEAng::FillHists( )..."<<endreq; 00118 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader"); 00119 if (!eventHeader) { 00120 log << MSG::FATAL << "Could not find Event Header" << endreq; 00121 return; 00122 } 00123 int event = eventHeader->eventNumber(); 00124 int runNO = eventHeader->runNumber(); 00125 int typFlag; //data type flag: 0:MC data, 1: 2150, 2:2200 00126 if(runNO<0) typFlag =0; 00127 else if(runNO>=0 && runNO<5459) typFlag =1; 00128 else if(runNO>=5459 && runNO<8093) typFlag =2; 00129 else if(runNO>=8093) typFlag =3; 00130 00131 Identifier mdcid; 00132 SmartDataPtr<RecMdcTrackCol> trkCol(eventSvc(),"/Event/Recon/RecMdcTrackCol"); 00133 if (!trkCol) { 00134 log << MSG::FATAL << "Could not find RecMdcTrackCol" << endreq; 00135 return; 00136 } 00137 int layid, hid, lr, localwid; 00138 double adc_raw, costhe, zhit, ddl, ddr, dd, ph, sinenta, eangle, pathlength, sintheta, rphi_path; 00139 log << MSG::INFO << "Begin to check RecMdcTrackCol"<<endreq; 00140 RecMdcTrackCol::iterator iter_trk = trkCol->begin(); 00141 for( ; iter_trk != trkCol->end(); iter_trk++) { 00142 HepVector a = (*iter_trk)->helix(); 00143 HepSymMatrix tkErrM = (*iter_trk)->err(); 00144 double m_d0E = tkErrM[0][0]; 00145 double m_phi0E = tkErrM[1][1]; 00146 double m_cpaE = tkErrM[2][2]; 00147 double m_z0E = tkErrM[3][3]; 00148 00149 HepPoint3D IP(0,0,0); 00150 Dedx_Helix exhel(IP, a); 00151 00152 double phi0= a[1]; 00153 log << MSG::DEBUG << "hitList of this track:" << endreq; 00154 HitRefVec gothits = (*iter_trk)->getVecHits(); 00155 HitRefVec::iterator it_gothit = gothits.begin(); 00156 for( ; it_gothit != gothits.end(); it_gothit++) { 00157 mdcid = (*it_gothit)->getMdcId(); 00158 layid = MdcID::layer(mdcid); 00159 localwid = MdcID::wire(mdcid); 00160 adc_raw = (*it_gothit)->getAdc()*1000000; 00161 zhit = (*it_gothit)->getZhit(); 00162 00163 dd = fabs((*it_gothit)->getDoca()); 00164 sinenta = sin((*it_gothit)->getEntra()); 00165 costhe = cos(atan(a[4])); 00166 sintheta = sin(M_PI_2-atan(a[4])); 00167 eangle = (*it_gothit)->getEntra(); 00168 eangle = eangle/M_PI; 00169 int ntpFlag = 1; 00170 ph = exsvc->StandardCorrec(typFlag, ntpFlag, runNO, exhel, mdcid, adc_raw, dd, sinenta, zhit, costhe ); 00171 pathlength = exsvc->PathL(ntpFlag, exhel, layid, localwid, zhit); 00172 lr = (*it_gothit)->getFlagLR(); 00173 // pathlength = exsvc->PathL(flag,exhel, layid, localwid, zhit); 00174 //pathlength = exsvc->PathLCosmic(exhel, layid, localwid, zhit, m_z0E); 00175 if(lr == 0 || lr == 2) ddl = fabs((*it_gothit)->getDriftDistLeft()); 00176 if(lr == 1 ) ddr = (*it_gothit)->getDriftDistRight(); 00177 rphi_path = pathlength * sintheta; 00178 if(layid <8) 00179 {if(ph<MinPHcut || ph>MaxPHcut || adc_raw<MinADCValuecut || adc_raw>MaxADCValuecut || rphi_path>RPhi_PathMaxCut || rphi_path<Iner_RPhi_PathMinCut || dd>Iner_DriftDistCut) continue;} 00180 else if(layid >= 8) 00181 {if(ph<MinPHcut || ph>MaxPHcut ||adc_raw<MinADCValuecut || adc_raw>MaxADCValuecut || rphi_path>RPhi_PathMaxCut || rphi_path<Out_RPhi_PathMinCut || dd>Out_DriftDistCut) continue;} 00182 hprof2d[layid]->Fill(dd,sinenta,ph); 00183 } 00184 } 00185 }
|
|
Implements DedxCalib. |
|
Implements DedxCalib. 00196 { 00197 log<<MSG::INFO<<"DedxCalibDocaEAng::FillHistsFromTree( )..."<<endreq; 00198 }
|
|
|
|
00117 { 00118 log<<MSG::INFO<<"DedxCalib::FillTestHists()...."<<endreq; 00119 }
|
|
|
|
00105 { 00106 log<<MSG::INFO<<"DedxCalib::FillTree()...."<<endreq; 00107 }
|
|
|
|
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 }
|
|
Implements DedxCalib. |
|
Implements DedxCalib. 00033 { 00034 log<<MSG::INFO<<"DedxCalibDocaEAng::GetChargeOffCorr( )..."<<endreq; 00035 return 1.0; 00036 }
|
|
|
|
00127 { 00128 00129 }
|
|
|
|
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 }
|
|
|
|
|
|
|
|
00109 { 00110 log<<MSG::INFO<<"DedxCalib::ReadCalibdEdxParameters()...."<<endreq; 00111 }
|
|
Reimplemented from DedxCalib. |
|
Reimplemented from DedxCalib. 00201 { 00202 log<<MSG::INFO<<"DedxCalibDocaEAng::WriteCalibdEdxParameters( )..."<<endreq; 00203 }
|
|
Implements DedxCalib. |
|
Implements DedxCalib. 00040 { log<<MSG::INFO<<"DedxCalibDocaEAng::WriteHists( )..."<<endreq; 00041 int k=0; 00042 int h =0; 00043 double fitmean[43][40][40]; 00044 double fitmean0[43]; 00045 double mean[43][1600]; 00046 double meanall[68800]; 00047 double gaincheck[100]; 00048 for(int layer=0; layer<43;layer++) 00049 { k=0; 00050 if ((hprof2d[layer]->GetBinContent(1,1))>0) 00051 fitmean0[layer] = hprof2d[layer]->GetBinContent(1,1); 00052 else fitmean0[layer] =2500; 00053 // cout<<"fitmean0= "<<fitmean0[layer]<<endl; 00054 for(int i=1;i<41;i++) 00055 {for(int j=1;j<41;j++) 00056 { 00057 fitmean[layer][i-1][j-1]= hprof2d[layer]->GetBinContent(i,j); 00058 fitmean[layer][i-1][j-1] = fitmean[layer][i-1][j-1]/fitmean0[layer]; 00059 mean[layer][k]= fitmean[layer][i-1][j-1]; 00060 meanall[h] = fitmean[layer][i-1][j-1]; 00061 k++; 00062 h++; 00063 } 00064 } 00065 } 00066 00067 TFile fhist("/ihepbatch/besd09/xcao/calibconst_temp/dcasincalib.root", "recreate"); 00068 for(int i=0;i<43;i++) 00069 {hprof2d[i] ->Write();} 00070 00071 // delete m_prolist; 00072 //for(int i=0;i<43;i++) delete m_profhist[i]; 00073 TTree* ddeng = new TTree("dcasincalb", "ddengcalib"); 00074 ddeng -> Branch("dcasing", &meanall, "meanall[68800]/D"); 00075 ddeng -> Fill(); 00076 ddeng -> Write(); 00077 fhist.Close(); 00078 00079 // delete ddeng; 00080 for(int i=0;i<43;i++) delete hprof2d[i]; 00081 delete m_rand; 00082 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|