#include <DedxCalibHadron.h>
Inheritance diagram for DedxCalibHadron:
Public Member Functions | |
void | AnalyseHists () |
void | AnalyseHists () |
void | BookHists () |
void | BookHists () |
void | checkSelections () |
void | checkSelections () |
DedxCalibHadron (const std::string &name, ISvcLocator *pSvcLocator) | |
DedxCalibHadron (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 () |
Public Attributes | |
double | chi2_tmp |
double | chi2hit_tmp |
double | chie_tmp |
double | chiededx_tmp |
double | chiehit_tmp |
double | chik_tmp |
double | chikdedx_tmp |
double | chikhit_tmp |
double | chimu_tmp |
double | chimudedx_tmp |
double | chimuhit_tmp |
double | chip_tmp |
double | chipdedx_tmp |
double | chiphit_tmp |
double | chipi_tmp |
double | chipidedx_tmp |
double | chipihit_tmp |
double | cos_tmp |
double | coshit_tmp |
double | dedx_tmp |
TTree * | dedx_tree |
TTree * | dedx_tree |
double | dedxhit_tmp |
TTree * | dedxhit_tree |
TTree * | dedxhit_tree |
double | depth_tmp |
double | depthhit_tmp |
double | dr_tmp |
double | drhit_tmp |
double | dz_tmp |
double | dzhit_tmp |
double | edr_tmp |
double | edrhit_tmp |
double | edz_tmp |
double | edzhit_tmp |
double | eop_tmp |
double | eophit_tmp |
double | event_tmp |
double | eventhit_tmp |
TObjArray * | m_caliblist |
TObjArray * | m_caliblist |
vector< TH2F * > | m_hist_e |
vector< TH2F * > | m_hist_e |
vector< TH2F * > | m_hist_p |
vector< TH2F * > | m_hist_p |
vector< TH2F * > | m_histcalib |
vector< TH2F * > | m_histcalib |
TRandom * | m_rand |
TRandom * | m_rand |
TObjArray * | m_spacelist |
TObjArray * | m_spacelist |
double | nhit_tmp |
double | nhithit_tmp |
double | p_tmp |
double | partid_tmp |
double | phit_tmp |
double | run_tmp |
double | rung_tmp |
double | runhit_tmp |
double | t0_tmp |
double | t0hit_tmp |
double | time_tof_tmp |
double | timehit_tof_tmp |
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 |
|
00037 : DedxCalib(name, pSvcLocator) 00038 { 00039 log<<MSG::INFO<<"DedxCalibHadron::DedxCalibHadron( )..."<<endreq; 00040 }
|
|
|
|
Implements DedxCalib. |
|
Implements DedxCalib. 00610 { 00611 log<<MSG::INFO<<"DedxCalibHadron::AnalyseHists( )..."<<endreq; 00612 }
|
|
Implements DedxCalib. |
|
Implements DedxCalib. 00090 { 00091 log<<MSG::INFO<<"DedxCalibHadron::BookHists( )..."<<endreq; 00092 log<<MSG::DEBUG<<" bookhist...1" <<endreq; 00093 m_spacelist = new TObjArray(0); 00094 m_caliblist = new TObjArray(0); 00095 log<<MSG::DEBUG<<" bookhist...2" <<endreq; 00096 m_rand = new TRandom(); 00097 std::string hlabel; 00098 log<<MSG::DEBUG<<" bookhist...3" <<endreq; 00099 00100 for(int mm=0; mm<NumBinMomentum; mm++) { 00101 std::ostringstream strout; 00102 strout << "Dedx_Vs" <<"_Costheta_"<<mm; 00103 hlabel = strout.str(); 00104 TH2F *space_e = new TH2F(hlabel.c_str(), hlabel.c_str(), 100,-1,1,1000,0,10); 00105 // wireg->Print("base"); 00106 space_e->GetXaxis()->SetTitle("costheta"); 00107 space_e->GetYaxis()->SetTitle("dEdx)"); 00108 00109 m_hist_e.push_back(space_e); 00110 m_spacelist -> Add(space_e); 00111 00112 } 00113 00114 00115 std::ostringstream strout4; 00116 strout4 << "dedx_momentum"; 00117 hlabel = strout4.str(); 00118 TH2F *calib = new TH2F(hlabel.c_str(), hlabel.c_str(), 100, 0, 2.00,1000,0,10); 00119 // wireg->Print("base"); 00120 calib->GetXaxis()->SetTitle("momentum"); 00121 calib->GetYaxis()->SetTitle("dE/dx"); 00122 00123 m_histcalib.push_back(calib); 00124 m_caliblist -> Add(calib); 00125 00126 dedxhit_tree=new TTree("dedxhittree","dedxhittree"); 00127 dedxhit_tree->Branch("run",&runhit_tmp,"run/D"); 00128 dedxhit_tree->Branch("event",&eventhit_tmp,"event/D"); 00129 dedxhit_tree->Branch("dedx",&dedxhit_tmp,"dedx/D"); 00130 dedxhit_tree->Branch("nhit",&nhithit_tmp,"nhit/D"); 00131 dedxhit_tree->Branch("dz",&dzhit_tmp,"dz/D"); 00132 dedxhit_tree->Branch("dr",&drhit_tmp,"dr/D"); 00133 dedxhit_tree->Branch("edz",&edzhit_tmp,"edz/D"); 00134 dedxhit_tree->Branch("edr",&edrhit_tmp,"edr/D"); 00135 dedxhit_tree->Branch("chi2",&chi2hit_tmp,"chi2/D"); 00136 dedxhit_tree->Branch("p",&phit_tmp,"p/D"); 00137 dedxhit_tree->Branch("costh",&coshit_tmp,"costh/D"); 00138 dedxhit_tree->Branch("t0",&t0hit_tmp,"t0/D"); 00139 dedxhit_tree->Branch("eop",&eophit_tmp,"eop/D"); 00140 dedxhit_tree->Branch("depth",&depthhit_tmp,"depth/D"); 00141 dedxhit_tree->Branch("chietof", &chiehit_tmp,"chie/D"); 00142 dedxhit_tree->Branch("chimutof",&chimuhit_tmp,"chimu/D"); 00143 dedxhit_tree->Branch("chipitof",&chipihit_tmp,"chipi/D"); 00144 dedxhit_tree->Branch("chiktof", &chikhit_tmp, "chik/D"); 00145 dedxhit_tree->Branch("chiptof", &chiphit_tmp, "chip/D"); 00146 dedxhit_tree->Branch("timetof", &timehit_tof_tmp, "time/D"); 00147 00148 //book a tree to store dedx and p values 00149 dedx_tree=new TTree("dedxtree","dedxtree"); 00150 dedx_tree->Branch("partid",&partid_tmp,"partid/D"); 00151 dedx_tree->Branch("run",&run_tmp,"run/D"); 00152 dedx_tree->Branch("rung",&rung_tmp,"rung/D"); 00153 dedx_tree->Branch("event",&event_tmp,"event/D"); 00154 dedx_tree->Branch("dedx",&dedx_tmp,"dedx/D"); 00155 dedx_tree->Branch("nhit",&nhit_tmp,"nhit/D"); 00156 dedx_tree->Branch("dz",&dz_tmp,"dz/D"); 00157 dedx_tree->Branch("dr",&dr_tmp,"dr/D"); 00158 dedx_tree->Branch("edz",&edz_tmp,"edz/D"); 00159 dedx_tree->Branch("edr",&edr_tmp,"edr/D"); 00160 dedx_tree->Branch("chi2",&chi2_tmp,"chi2/D"); 00161 dedx_tree->Branch("p",&p_tmp,"p/D"); 00162 dedx_tree->Branch("costh",&cos_tmp,"costh/D"); 00163 dedx_tree->Branch("t0",&t0_tmp,"t0/D"); 00164 dedx_tree->Branch("eop",&eop_tmp,"eop/D"); 00165 dedx_tree->Branch("depth",&depth_tmp,"depth/D"); 00166 dedx_tree->Branch("chiededx", &chiededx_tmp,"chiededx/D"); 00167 dedx_tree->Branch("chimudedx",&chimudedx_tmp,"chimudedx/D"); 00168 dedx_tree->Branch("chipidedx",&chipidedx_tmp,"chipidedx/D"); 00169 dedx_tree->Branch("chikdedx", &chikdedx_tmp, "chikdedx/D"); 00170 dedx_tree->Branch("chipdedx", &chipdedx_tmp, "chipdedx/D"); 00171 dedx_tree->Branch("chietof", &chie_tmp,"chie/D"); 00172 dedx_tree->Branch("chimutof",&chimu_tmp,"chimu/D"); 00173 dedx_tree->Branch("chipitof",&chipi_tmp,"chipi/D"); 00174 dedx_tree->Branch("chiktof", &chik_tmp, "chik/D"); 00175 dedx_tree->Branch("chiptof", &chip_tmp, "chip/D"); 00176 dedx_tree->Branch("timetof", &time_tof_tmp, "time/D"); 00177 }
|
|
|
|
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. 00179 { 00180 log<<MSG::INFO<<"DedxCalibHadron::FillHists( )..."<<endreq; 00181 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader"); 00182 if (!eventHeader) { 00183 log << MSG::FATAL << "Could not find Event Header" << endreq; 00184 return; 00185 } 00186 int event = eventHeader->eventNumber(); 00187 int runNO = eventHeader->runNumber(); 00188 //cout<<"event : "<<event<<" runNO : "<<runNO<<endl; 00189 run_tmp=runNO; 00190 event_tmp=event; 00191 runhit_tmp=runNO; 00192 eventhit_tmp=event; 00193 00194 int typFlag; //data type flag: 0:MC data, 1: 2150, 2:2200 00195 if(runNO<0) typFlag =0; 00196 else if(runNO>=0 && runNO<5459) typFlag =1; 00197 else if(runNO>=5459 && runNO<8093) typFlag =2; 00198 else if(runNO>=8093 && runNO<9947) typFlag =3; 00199 else if(runNO>=8847 ) typFlag =4; 00200 00201 00202 //get run gain constaints 00203 IDataProviderSvc* pCalibDataSvc; 00204 StatusCode sc = service("CalibDataSvc", pCalibDataSvc, true); 00205 if ( !sc.isSuccess() ) { 00206 log << MSG::ERROR 00207 << "Could not get IDataProviderSvc interface of CalibXmlCnvSvc" 00208 << endreq; 00209 return ; 00210 } else { 00211 log << MSG::DEBUG 00212 << "Retrieved IDataProviderSvc interface of CalibXmlCnvSvc" 00213 << endreq; 00214 } 00215 00216 /* 00217 std::string fullPath = "/Calib/DedxCal"; 00218 SmartDataPtr<CalibData::DedxCalibData> test(pCalibDataSvc, fullPath); 00219 //rung par---------------------------------------------------------- 00220 int N_run = test->getrunNO(); 00221 //cout<<"N_run = "<<N_run<<endl; 00222 00223 for(int j=0;j<N_run;j++) { 00224 int runnum = test->getrung(2,j); 00225 if(runnum==runNO) 00226 //cout<<"run gain for this run is:"<<test->getrung(0,j)<<endl; 00227 rung_tmp=test->getrung(0,j); 00228 } 00229 00230 */ 00231 00232 double t0; 00233 int esTimeflag = -1; 00234 SmartDataPtr<RecEsTimeCol> estimeCol(eventSvc(),"/Event/Recon/RecEsTimeCol"); 00235 if( ! estimeCol) { 00236 log << MSG::WARNING << "Could not find EvTimeCol" << endreq; 00237 } 00238 else{ 00239 RecEsTimeCol::iterator iter_evt = estimeCol->begin(); 00240 for(; iter_evt!=estimeCol->end(); iter_evt++){ 00241 t0 = (*iter_evt)->getTest(); 00242 esTimeflag = (*iter_evt)->getStat(); 00243 } 00244 } 00245 // //if(t0>700) return; 00246 00247 00248 Identifier mdcid; 00249 00250 00251 SmartDataPtr<EvtRecEvent> evtRecEvent(eventSvc(), EventModel::EvtRec::EvtRecEvent); 00252 log << MSG::DEBUG <<"ncharg, nneu, tottks = " 00253 << evtRecEvent->totalCharged() << " , " 00254 << evtRecEvent->totalNeutral() << " , " 00255 << evtRecEvent->totalTracks() <<endreq; 00256 //cout<<"ncharg, nneu, tottks = " 00257 // << evtRecEvent->totalCharged() << " , " 00258 // << evtRecEvent->totalNeutral() << " , " 00259 //<< evtRecEvent->totalTracks() <<endl; 00260 00261 SmartDataPtr<EvtRecTrackCol> evtRecTrkCol(eventSvc(), EventModel::EvtRec::EvtRecTrackCol); 00262 00263 00264 00265 //SmartDataPtr<RecMdcTrackCol> trkCol(eventSvc(),"/Event/Recon/RecMdcTrackCol"); 00266 //if (!trkCol) { 00267 // log << MSG::WARNING << "Could not find RecMdcTrackCol" << endreq; 00268 // return; 00269 //} 00270 00271 00272 int layid, hid, localwid, lr; 00273 double adc_raw, costhe, zhit, driftdist, dd, ph, sinenta,eangle, dipan, pathlength, sintheta, rphi_path; 00274 double m_driftd, driftd; 00275 double m_P, logp; 00276 log << MSG::INFO << "Begin to check RecMdcTrackCol"<<endreq; 00277 // RecMdcTrackCol::iterator iter_trk = trkCol->begin(); 00278 00279 00280 //for( ; iter_trk != trkCol->end(); iter_trk++) { 00281 for(int i = 0; i < evtRecEvent->totalCharged(); i++){ 00282 EvtRecTrackIterator itTrk=evtRecTrkCol->begin() + i; 00283 00284 //MUC information 00285 double depth_muc=-99; 00286 if( (*itTrk)->isMucTrackValid()){ 00287 RecMucTrack* mucTrk=(*itTrk)->mucTrack(); 00288 depth_muc=mucTrk->depth(); 00289 } 00290 //cout<<"depth : "<<depth_muc<<endl; 00291 00292 //some TOF information 00293 00294 double chiE_tof=-99; 00295 double chiMu_tof=-99; 00296 double chiPi_tof=-99; 00297 double chiK_tof=-99; 00298 double chiP_tof=-99; 00299 double expE_tof=-99; 00300 double expMu_tof=-99; 00301 double expPi_tof=-99; 00302 double expK_tof=-99; 00303 double expP_tof=-99; 00304 00305 double offsetE_tof=-99; 00306 double offsetMu_tof=-99; 00307 double offsetPi_tof=-99; 00308 double offsetK_tof=-99; 00309 double offsetP_tof=-99; 00310 00311 double detaE_tof=-99; 00312 double detaMu_tof=-99; 00313 double detaPi_tof=-99; 00314 double detaK_tof=-99; 00315 double detaP_tof=-99; 00316 00317 double time=-99; 00318 double sigma=-99; 00319 00320 if((*itTrk)->isTofTrackValid()){ 00321 SmartRefVector<RecTofTrack> tofTrkCol=(*itTrk)->tofTrack(); 00322 SmartRefVector<RecTofTrack>::iterator iter_tof=tofTrkCol.begin(); 00323 for(;iter_tof!=tofTrkCol.end();iter_tof++){ 00324 TofHitStatus* status =new TofHitStatus; 00325 status->setStatus( (*iter_tof)->status() ); 00326 if(status->is_cluster()){ 00327 time=(*iter_tof)->tof(); 00328 sigma=1.1*(*iter_tof)->sigma(0)/1000; 00329 expE_tof=(*iter_tof)->texpElectron(); 00330 expMu_tof=(*iter_tof)->texpMuon(); 00331 expPi_tof=(*iter_tof)->texpPion(); 00332 expK_tof=(*iter_tof)->texpKaon(); 00333 expP_tof=(*iter_tof)->texpProton(); 00334 00335 offsetE_tof=(*iter_tof)->toffsetElectron(); 00336 offsetMu_tof=(*iter_tof)->toffsetMuon(); 00337 offsetPi_tof=(*iter_tof)->toffsetPion(); 00338 offsetK_tof=(*iter_tof)->toffsetKaon(); 00339 offsetP_tof=(*iter_tof)->toffsetProton(); 00340 00341 //cout<<"sigma : "<<sigma<<endl; 00342 00343 if( sigma!=0 ){ 00344 chiE_tof= ( time- expE_tof )/ sigma; 00345 chiMu_tof= ( time- expMu_tof)/ sigma; 00346 chiPi_tof= ( time- expPi_tof )/ sigma; 00347 chiK_tof= ( time- expK_tof )/ sigma; 00348 chiP_tof= ( time- expP_tof )/ sigma; 00349 detaE_tof = time - offsetE_tof - expE_tof; 00350 detaMu_tof = time- offsetMu_tof - expMu_tof; 00351 detaPi_tof = time - offsetPi_tof - expPi_tof; 00352 detaK_tof = time - offsetK_tof - expK_tof; 00353 detaP_tof = time - offsetP_tof - expP_tof; 00354 } 00355 00356 } 00357 delete status; 00358 } 00359 00360 }//end of TOF information 00361 00362 00363 if(!(*itTrk)->isMdcTrackValid()) continue; 00364 RecMdcTrack *mdcTrk = (*itTrk)->mdcTrack(); 00365 00366 if(!(*itTrk)->isMdcKalTrackValid()) continue; 00367 RecMdcKalTrack *mdckalTrk = (*itTrk)->mdcKalTrack(); 00368 //mdckalTrk->setPidType(RecMdcKalTrack::pion); 00369 00370 HepVector a_helix_trk = mdcTrk->helix(); 00371 HepVector a = mdckalTrk->getLHelix(); 00372 00373 HepSymMatrix tkErrM = mdcTrk->err(); 00374 double m_d0E = tkErrM[0][0]; 00375 double m_phi0E = tkErrM[1][1]; 00376 double m_cpaE = tkErrM[2][2]; 00377 double m_z0E = tkErrM[3][3]; 00378 00379 //track information 00380 double dz=mdcTrk->helix(3); 00381 double edz=sqrt(mdcTrk->err(12)); 00382 double dr=mdcTrk->helix(0); 00383 double edr=sqrt(mdcTrk->err(0)); 00384 double chi2=-99; 00385 if(mdcTrk->ndof()>0) 00386 chi2=mdcTrk->chi2()/mdcTrk->ndof(); 00387 00388 vector<double> phlist; 00389 HepPoint3D IP(0,0,0); 00390 Dedx_Helix exhel(IP, a_helix_trk); 00391 //QvsDipAngP->Reset(); 00392 log << MSG::DEBUG << "hitList of this track:" << endreq; 00393 //HitRefVec gothits = mdcTrk->getVecHits(); 00394 //HitRefVec::iterator it_gothit = gothits.begin(); 00395 00396 00397 HelixSegRefVec gothits = mdckalTrk->getVecHelixSegs(); 00398 HelixSegRefVec::iterator it_gothit = gothits.begin(); 00399 00400 00401 if( a(3)==0) continue; 00402 float m_Pt = 1.0/fabs( a(3) ); 00403 m_P = m_Pt*sqrt(1 + a(5)*a(5)); 00404 00405 //m_P=mdcTrk->p(); 00406 //m_P=mdckalTrk->p(); 00407 //cout<<"kalman track momentum="<<m_P<<endl; 00408 00409 //if(m_P>2.50 || m_P<0.0) continue; 00410 00411 double eop_emc=-99; 00412 if( (*itTrk)->isEmcShowerValid()){ 00413 RecEmcShower* emcTrk=(*itTrk)->emcShower(); 00414 eop_emc=emcTrk->energy()/m_P; 00415 } 00416 00417 //if(m_P<0.0 || m_P>100) continue; 00418 for( ; it_gothit != gothits.end(); it_gothit++) { 00419 00420 HepVector a_hit = (*it_gothit)->getHelixIncl(); 00421 Dedx_Helix exhel_hit(IP, a_hit); 00422 00423 mdcid = (*it_gothit)->getMdcId(); 00424 layid = MdcID::layer(mdcid); 00425 localwid = MdcID::wire(mdcid); 00426 adc_raw = (*it_gothit)->getAdc(); 00427 //adc_raw = adc_raw*1000000; 00428 zhit = (*it_gothit)->getZhit(); 00429 lr = (*it_gothit)->getFlagLR(); 00430 m_driftd = (*it_gothit)->getDD(); 00431 driftd = fabs(m_driftd); 00432 dd = (*it_gothit)->getDocaIncl(); 00433 //in which: getDocaIncl() include fit unused hit, 00434 //getDocaExcl() exclude hit unused in track fit; 00435 00436 if(lr==-1 || lr == 2) dd =dd; 00437 else if(lr ==1) dd =-dd; 00438 // dd = dd/doca_norm[layid]; 00439 00440 sinenta = sin((*it_gothit)->getEntra()); 00441 costhe = cos(M_PI_2-atan(a_helix_trk[4])); 00442 sintheta = sin(M_PI_2-atan(a_helix_trk[4])); 00443 eangle = (*it_gothit)->getEntra(); 00444 if(fabs(eangle)>=M_PI/2.0) 00445 cout<<"eangle="<<eangle<<endl; 00446 eangle = eangle/M_PI; 00447 int ntpFlag = 1; 00448 ph = exsvc->StandardHitCorrec(0, typFlag,ntpFlag, runNO, exhel_hit, mdcid, adc_raw, dd, eangle, zhit, costhe ); 00449 ph = exsvc->StandardTrackCorrec(0, typFlag, 1.0, runNO,ph,costhe,t0); 00450 pathlength = exsvc->PathL(ntpFlag, exhel_hit, layid, localwid, zhit); 00451 rphi_path = pathlength * sintheta; 00452 //pathlength = exsvc->PathL(ntpFlag, exhel_hit, layid, localwid, zhit); 00453 //rphi_path = pathlength * sintheta; 00454 //cout<<"ph is "<<ph<<endl; 00455 //pathlength = exsvc->PathL(ntpFlag, exhel_hit, layid, localwid, zhit); 00456 //rphi_path = pathlength * sintheta; 00457 if(layid <4) continue; 00458 // {if(adc_raw<MinADCValuecut || adc_raw>MaxADCValuecut || rphi_path>RPhi_PathMaxCut || rphi_path<Iner_RPhi_PathMinCut || driftd>Iner_DriftDistCut) continue;} 00459 else if (layid>=4 && layid<8){ 00460 if(adc_raw<MinHistValue || adc_raw>MaxHistValue || rphi_path>RPhi_PathMaxCut || rphi_path<Iner_RPhi_PathMinCut || driftd>Iner_DriftDistCut) continue; 00461 } 00462 else if(layid >= 8){ 00463 if(adc_raw<MinHistValue || adc_raw>MaxHistValue || rphi_path>RPhi_PathMaxCut || rphi_path<Out_RPhi_PathMinCut || driftd>Out_DriftDistCut ) continue; 00464 } 00465 //if(ntpFlag>0) cout<<layid<<" "<<localwid<<" "<<adc_raw<<" "<<ph<<" "<<rphi_path<<" "<<driftd<<endl; 00466 00467 if( ph>0 ) { 00468 dedxhit_tmp=ph; 00469 nhithit_tmp=gothits.size(); 00470 phit_tmp=m_P; 00471 coshit_tmp=costhe; 00472 t0hit_tmp=t0; 00473 00474 eophit_tmp=eop_emc; 00475 depthhit_tmp=depth_muc; 00476 00477 chiehit_tmp=detaE_tof; 00478 chimuhit_tmp=detaMu_tof; 00479 chipihit_tmp=detaPi_tof; 00480 chikhit_tmp=detaK_tof; 00481 chiphit_tmp=detaP_tof; 00482 timehit_tof_tmp = time; 00483 00484 //chie_tmp=chiE_tof; 00485 //chimu_tmp=chiMu_tof; 00486 //chipi_tmp=chiPi_tof; 00487 //chik_tmp=chiK_tof; 00488 //chip_tmp=chiP_tof; 00489 00490 00491 //save track information 00492 dzhit_tmp=dz; 00493 drhit_tmp=dr; 00494 edzhit_tmp=edz; 00495 edrhit_tmp=edr; 00496 chi2hit_tmp=chi2; 00497 dedxhit_tree->Fill(); 00498 phlist.push_back(ph); 00499 } 00500 } 00501 sort(phlist.begin(),phlist.end()); 00502 int nsampl = (int)( phlist.size()*Truncate ); 00503 int smpl = (int)(phlist.size()*(Truncate+0.05)); 00504 int min_cut = (int)( phlist.size()*0.05 + 0.5 ); 00505 double qSum = 0; 00506 unsigned i = 0; 00507 for(vector<double>::iterator ql= phlist.begin();ql!=phlist.end();ql++){ 00508 i++; 00509 if(i<= smpl && i>=min_cut ) qSum += (*ql); 00510 } 00511 float trunc=qSum/(smpl-min_cut+1); 00512 double m_dEdx=0; 00513 m_dEdx = trunc; 00514 //m_dEdx = exsvc->StandardTrackCorrec(typFlag, 1.0, runNO,trunc,costhe,t0); 00515 00516 //cout<<"dedx is "<<m_dEdx<<endl; 00517 00518 if(fabs(costhe)> CosthetaMax) continue; 00519 00520 00521 //fill some information to ntuple 00522 dedx_tmp=m_dEdx; 00523 nhit_tmp=smpl-min_cut+1; 00524 p_tmp=m_P; 00525 cos_tmp=costhe; 00526 t0_tmp=t0; 00527 00528 00529 //cout<<"p="<<m_P<<", cos="<<costhe<<",dedx="<<m_dEdx<<endl; 00530 m_dEdx=m_dEdx/550.0; 00531 00532 if(fabs(costhe)<0.83){ 00533 if(fabs(m_P-0.3)<0.05) 00534 m_hist_e[0]->Fill(costhe,m_dEdx); 00535 else if(fabs(m_P-0.4)<0.05) 00536 m_hist_e[1]->Fill(costhe,m_dEdx); 00537 else if(fabs(m_P-0.5)<0.05) 00538 m_hist_e[2]->Fill(costhe,m_dEdx); 00539 else if(fabs(m_P-0.6)<0.05) 00540 m_hist_e[3]->Fill(costhe,m_dEdx); 00541 00542 m_histcalib[0]->Fill(m_P,m_dEdx); 00543 } 00544 00545 //calcuate chi dedx 00546 const float Charge_Mass[5] = 00547 {0.00051100, 0.10566, 0.13957, 0.4937, 0.93827 }; 00548 double par[5]={550.0*0.0154625, 34.9635, 4.04586e-14, 2.39614, 7.31565}; 00549 double sig_the=sqrt(1-costhe*costhe); 00550 int Nohit=nhit_tmp; 00551 m_dEdx=m_dEdx*550; 00552 00553 for(int it=0;it<5;it++){ 00554 00555 double beta_G=m_P/Charge_Mass[it]; 00556 double beta = beta_G/sqrt(1+(beta_G)*(beta_G)); 00557 double betterm = par[1]-std::log(par[2]+pow(1/beta_G,par[4])); 00558 double bethe_B = par[0]/pow(beta,par[3])*betterm-par[0]; 00559 00560 double sigma=0; 00561 00562 double f_betagamma = 1.41792e+01*pow(beta_G,-2.82457 ) + 2.91780e+01; 00563 double g_sinth = ( 1.59138e-02*sig_the*sig_the+ 4.25527e-02) / ( 1.59138e-02*0.8034*0.8034+ 4.25527e-02) ; 00564 double h_nhit = ( 1.87903e-04*Nohit*Nohit-1.09517e-02*Nohit+ 2.15604e-01) / ( 1.87903e-04*26.84*26.84-1.09517e-02*26.84+ 2.15604e-01); 00565 double i_t0=1; 00566 sigma = f_betagamma* g_sinth * h_nhit * i_t0; 00567 00568 if(it==0) chiededx_tmp= (m_dEdx-bethe_B)/sigma; 00569 else if(it==1) chimudedx_tmp= (m_dEdx-bethe_B)/sigma; 00570 else if(it==2) chipidedx_tmp= (m_dEdx-bethe_B)/sigma; 00571 else if(it==3) chikdedx_tmp= (m_dEdx-bethe_B)/sigma; 00572 else if(it==4) chipdedx_tmp= (m_dEdx-bethe_B)/sigma; 00573 } 00574 00575 int particle_type = (*itTrk)->partId(); 00576 //cout<<"particle type = "<< (*itTrk)->partId()<<endl; 00577 00578 partid_tmp = particle_type; 00579 eop_tmp=eop_emc; 00580 depth_tmp=depth_muc; 00581 00582 chie_tmp=detaE_tof; 00583 chimu_tmp=detaMu_tof; 00584 chipi_tmp=detaPi_tof; 00585 chik_tmp=detaK_tof; 00586 chip_tmp=detaP_tof; 00587 time_tof_tmp = time; 00588 00589 //chie_tmp=chiE_tof; 00590 //chimu_tmp=chiMu_tof; 00591 //chipi_tmp=chiPi_tof; 00592 //chik_tmp=chiK_tof; 00593 //chip_tmp=chiP_tof; 00594 00595 00596 //save track information 00597 dz_tmp=dz; 00598 dr_tmp=dr; 00599 edz_tmp=edz; 00600 edr_tmp=edr; 00601 chi2_tmp=chi2; 00602 00603 dedx_tree->Fill(); 00604 phlist.clear(); 00605 } 00606 00607 }
|
|
Implements DedxCalib. |
|
Implements DedxCalib. 00616 { 00617 log<<MSG::INFO<<"DedxCalibHadron::FillHistsFromTree( )..."<<endreq; 00618 }
|
|
|
|
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. 00044 { 00045 log<<MSG::INFO<<"DedxCalibHadron::GetChargeOffCorr( )..."<<endreq; 00046 return 1.0; 00047 }
|
|
|
|
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. 00621 { 00622 log<<MSG::INFO<<"DedxCalibHadron::WriteCalibdEdxParameters( )..."<<endreq; 00623 }
|
|
Implements DedxCalib. |
|
Implements DedxCalib. 00050 { 00051 log<<MSG::INFO<<"DedxCalibDipAngle::WriteHists( )..."<<endreq; 00052 00053 00054 /* 00055 TTree tree("hadron","hadron"); 00056 double tmp[1]; 00057 tree.Branch("costheta",&tmp,"cosbin/D"); 00058 for(int i=1;i<=NumBinMomentum;i++){ 00059 tmp[0]=m_histcalib[2]->GetBinContent(i); 00060 tree.Fill(); 00061 } 00062 */ 00063 00064 // TFile fhist("/ihepbatch/besd13/chunlei/calib/sat-muon-new.root", "recreate"); 00065 cout<<m_rootfile.c_str()<<endl; 00066 TFile fhist(m_rootfile.c_str(), "recreate"); 00067 // tree.Write(); 00068 //m_spacelist -> Write(); 00069 //m_caliblist -> Write(); 00070 dedx_tree->Write(); 00071 dedxhit_tree->Write(); 00072 fhist.Close(); 00073 00074 00075 for(int i=0; i<NumBinMomentum; i++) delete m_hist_e[i]; 00076 //for(int i=0; i<NumBinMomentum; i++) delete m_hist_p[i]; 00077 for(int i=0; i<1; i++) delete m_histcalib[i]; 00078 delete m_spacelist; 00079 delete m_caliblist; 00080 //delete spcharge; 00081 delete m_rand; 00082 00083 delete dedx_tree; 00084 delete dedxhit_tree; 00085 00086 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|