#include <DedxCalibDocaEAngOver.h>
Inheritance diagram for DedxCalibDocaEAngOver:
Public Member Functions | |
void | AnalyseHists () |
void | AnalyseHists () |
void | BookHists () |
void | BookHists () |
void | checkSelections () |
void | checkSelections () |
DedxCalibDocaEAngOver (const std::string &name, ISvcLocator *pSvcLocator) | |
DedxCalibDocaEAngOver (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 | |
Int_t | EAng_dis [400] |
Double_t | Iner_chisq [40][40] |
TH2F * | Iner_DocaEAngAverdE |
TH2F * | Iner_DocaEAngAverdE |
TH1F *** | Iner_DocaEAngdE |
TH1F *** | Iner_DocaEAngdE |
Double_t | Iner_entry [40][40] |
Double_t | Iner_mean [40][40] |
TProfile2D * | Iner_ProfDocaEAng |
TProfile2D * | Iner_ProfDocaEAng |
vector< TH1F * > | m_hist |
vector< TH1F * > | m_hist |
vector< TProfile2D * > | m_profhist |
vector< TProfile2D * > | m_profhist |
TObjArray * | m_proflist |
TObjArray * | m_proflist |
TRandom * | m_rand |
TRandom * | m_rand |
Double_t | Out_chisq [40][40] |
TH2F * | Out_DocaEAngAverdE |
TH2F * | Out_DocaEAngAverdE |
TH1F *** | Out_DocaEAngdE |
TH1F *** | Out_DocaEAngdE |
Double_t | Out_entry [40][40] |
Double_t | Out_mean [40][40] |
TProfile2D * | Out_ProfDocaEAng |
TProfile2D * | Out_ProfDocaEAng |
TProfile2D ** | ProfdEdxDocaEAng |
TProfile2D ** | ProfdEdxDocaEAng |
|
00035 : DedxCalib(name, pSvcLocator) 00036 { 00037 log<<MSG::INFO<<"DedxCalibDocaEAngOver::DedxCalibDocaEAngOver( )..."<<endreq; 00038 /*for(int i=0; i<400; i++) { 00039 double i_eangle_value = i*0.005-1; 00040 for(int k=0; k<40; k++) { 00041 if(Eangle_bin[k] - 0.000001 <= i_eangle_value && i_eangle_value< Eangle_bin[k+1] + 0.000001) { 00042 EAng_dis[i] = k; 00043 } 00044 } 00045 }*/ 00046 }
|
|
|
|
Implements DedxCalib. |
|
Implements DedxCalib. 00465 { 00466 log<<MSG::INFO<<"DedxCalibDocaEAngOver::AnalyseHists( )..."<<endreq; 00467 Float_t NormdE=0; 00468 //Float_t NormdE_dp=0; 00469 Float_t weight=0; 00470 Float_t w_w=0; 00471 Float_t sigmadp[40][40]; 00472 00473 TF1* func; 00474 if(m_phshape_flag==0) { 00475 func = new TF1("mylan",mylan,1000,4000,4); 00476 func->SetParameters(10000.0,2010.1,300,-1.0); 00477 } else if(m_phshape_flag==1) { 00478 func = new TF1("landaun",landaun,1000,4000,3); 00479 func->SetParameters(2000.0,300.0); 00480 } else if(m_phshape_flag==2) { 00481 func = new TF1("land",Landau,1000,4000,2); 00482 func->SetParameters(2010.1,300); 00483 } else if(m_phshape_flag==3) { 00484 func = new TF1("vavi",Vavilov,1000,4000,2); 00485 func->SetParameters(3.1,0.4); 00486 } else if(m_phshape_flag==4) { 00487 func = new TF1("asym",AsymGauss,1000,4000,4); 00488 func->SetParameters(10000.0,2000.0,300.0,100.); 00489 } 00490 func->SetLineWidth(2.1); 00491 func->SetLineColor(2); 00492 Double_t entry_iner, mean_iner, rms_iner; 00493 Double_t binmax_iner; 00494 Double_t lp_iner[3]; 00495 00496 /*for(Int_t id=0;id<NumSlicesDoca;id++){ 00497 for(Int_t ip=0;ip<NumSlicesEAng;ip++){ 00498 entry_iner = Iner_DocaEAngdE[id][ip]->GetEntries(); 00499 mean_iner = Iner_DocaEAngdE[id][ip]->GetMean(); 00500 rms_iner = Iner_DocaEAngdE[id][ip]->GetRMS(); 00501 binmax_iner = Iner_DocaEAngdE[id][ip]->GetMaximumBin(); 00502 //cout<<"entry_iner : "<<entry_iner<<" mean_iner : "<<mean_iner<<" rms_iner : "<<rms_iner<<" binmax_iner : "<<binmax_iner<<endl; 00503 lp_iner[1] = Iner_DocaEAngdE[id][ip]->GetBinCenter(binmax_iner); 00504 lp_iner[2] = 200; 00505 lp_iner[0] = (Iner_DocaEAngdE[id][ip]->GetBinContent(binmax_iner)+Iner_DocaEAngdE[id][ip]->GetBinContent(binmax_iner-1)+Iner_DocaEAngdE[id][ip]->GetBinContent(binmax_iner+1))/3; 00506 00507 if(m_phshape_flag==0) { 00508 func->SetParameters(entry_iner, mean_iner, rms_iner, -0.8); 00509 } else if(m_phshape_flag==1) { 00510 //func->SetParameters(entry_iner, 0.7*mean_iner, rms_iner ); 00511 func->SetParameters(lp_iner[0], lp_iner[1], lp_iner[2] ); 00512 } else if(m_phshape_flag==2) { 00513 func->SetParameters(0.7*mean_iner, rms_iner ); 00514 } else if(m_phshape_flag==3) { 00515 func->SetParameters(0.05, 0.6); 00516 } else if(m_phshape_flag==4) { 00517 func->SetParameters(entry_iner, mean_iner, rms_iner, 1.0 ); 00518 } 00519 Iner_DocaEAngdE[id][ip]->Fit(func, "Q" ); 00520 } 00521 }*/ 00522 00523 Double_t entry, mean, rms; 00524 Double_t binmax; 00525 Double_t lp[3]; 00526 for(Int_t id=0;id<NumSlicesDoca;id++){ 00527 for(Int_t ip=0;ip<NumSlicesEAng;ip++){ 00528 entry = Out_DocaEAngdE[id][ip]->GetEntries(); 00529 mean = Out_DocaEAngdE[id][ip]->GetMean(); 00530 rms = Out_DocaEAngdE[id][ip]->GetRMS(); 00531 binmax = Out_DocaEAngdE[id][ip]->GetMaximumBin(); 00532 //cout<<"entry : "<<entry<<" mean : "<<mean<<" rms : "<<rms<<" binmax : "<<binmax<<endl; 00533 00534 lp[1] = Out_DocaEAngdE[id][ip]->GetBinCenter(binmax); 00535 lp[2] = 200; 00536 lp[0] = (Out_DocaEAngdE[id][ip]->GetBinContent(binmax)+Out_DocaEAngdE[id][ip]->GetBinContent(binmax-1)+Out_DocaEAngdE[id][ip]->GetBinContent(binmax+1))/3; 00537 if(m_phshape_flag==0) { 00538 func->SetParameters(entry, mean, rms, -0.8); 00539 } else if(m_phshape_flag==1) { 00540 //func->SetParameters(entry, 0.7*mean, rms ); 00541 func->SetParameters(lp[0], lp[1], lp[2] ); 00542 } else if(m_phshape_flag==2) { 00543 func->SetParameters(0.7*mean, rms ); 00544 } else if(m_phshape_flag==3) { 00545 func->SetParameters(0.05, 0.6); 00546 } else if(m_phshape_flag==4) { 00547 func->SetParameters(entry, mean, rms, 1.0 ); 00548 } 00549 Out_DocaEAngdE[id][ip]->Fit(func, "Q" ); 00550 } 00551 } 00552 00553 Double_t Iner_Doca_bin, Out_Doca_bin; 00554 //satic Double_t Iner_mean[3][40][40], Out_mean[3][40][40]; 00555 for(Int_t id=0;id<NumSlicesDoca;id++){ 00556 Iner_Doca_bin = id*Iner_Stepdoca+Iner_DocaMin+Iner_Stepdoca/2; 00557 Out_Doca_bin = id*Out_Stepdoca+Out_DocaMin+Out_Stepdoca/2; 00558 for(Int_t ip=0;ip<NumSlicesEAng;ip++){ 00559 if(m_phshape_flag==0) { 00560 //Iner_mean[id][ip] = Iner_DocaEAngdE[id][ip] -> GetFunction("mylan") -> GetParameter(1); 00561 Out_mean[id][ip] = Out_DocaEAngdE[id][ip] -> GetFunction("mylan") -> GetParameter(1); 00562 //Iner_chisq[id][ip] = Iner_DocaEAngdE[id][ip] -> GetFunction("mylan") -> GetParameter(2); 00563 Out_chisq[id][ip] = Out_DocaEAngdE[id][ip] -> GetFunction("mylan") -> GetParameter(2); 00564 sigmadp[id][ip]=Out_DocaEAngdE[id][ip] -> GetFunction("mylan") ->GetParError(1); 00565 00566 //Iner_entry[id][ip] = Iner_DocaEAngdE[id][ip] -> GetEntries(); 00567 Out_entry[id][ip] = Out_DocaEAngdE[id][ip] -> GetEntries(); 00568 } else if(m_phshape_flag==1) { 00569 //Iner_mean[id][ip] = Iner_DocaEAngdE[id][ip] -> GetFunction("landaun") -> GetParameter(1); 00570 Out_mean[id][ip] = Out_DocaEAngdE[id][ip] -> GetFunction("landaun") -> GetParameter(1); 00571 //Iner_chisq[id][ip] = Iner_DocaEAngdE[id][ip] -> GetFunction("landaun") -> GetParameter(2); 00572 Out_chisq[id][ip] = Out_DocaEAngdE[id][ip] -> GetFunction("landaun") -> GetParameter(2); 00573 //sigmadp[id][ip]=Out_DocaEAngdE[id][ip] -> GetFunction("landaun") ->GetParError(1); 00574 00575 Iner_entry[id][ip] = Iner_DocaEAngdE[id][ip] -> GetEntries(); 00576 Out_entry[id][ip] = Out_DocaEAngdE[id][ip] -> GetEntries(); 00577 } else if(m_phshape_flag==2) { 00578 //Iner_mean[id][ip] = Iner_DocaEAngdE[id][ip] -> GetFunction("land") -> GetParameter(1); 00579 Out_mean[id][ip] = Out_DocaEAngdE[id][ip] -> GetFunction("land") -> GetParameter(1); 00580 //Iner_chisq[id][ip] = Iner_DocaEAngdE[id][ip] -> GetFunction("land") -> GetParameter(2); 00581 Out_chisq[id][ip] = Out_DocaEAngdE[id][ip] -> GetFunction("land") -> GetParameter(2); 00582 sigmadp[id][ip]=Out_DocaEAngdE[id][ip] -> GetFunction("land") ->GetParError(1); 00583 00584 //Iner_entry[id][ip] = Iner_DocaEAngdE[id][ip] -> GetEntries(); 00585 Out_entry[id][ip] = Out_DocaEAngdE[id][ip] -> GetEntries(); 00586 } else if(m_phshape_flag==3) { 00587 //Iner_mean[id][ip] = Iner_DocaEAngdE[id][ip] -> GetFunction("vavi") -> GetParameter(1); 00588 Out_mean[id][ip] = Out_DocaEAngdE[id][ip] -> GetFunction("vavi") -> GetParameter(1); 00589 //Iner_chisq[id][ip] = Iner_DocaEAngdE[id][ip] -> GetFunction("vavi") -> GetParameter(2); 00590 Out_chisq[id][ip] = Out_DocaEAngdE[id][ip] -> GetFunction("vavi") -> GetParameter(2); 00591 sigmadp[id][ip]=Out_DocaEAngdE[id][ip] -> GetFunction("vavi") ->GetParError(1); 00592 00593 //Iner_entry[id][ip] = Iner_DocaEAngdE[id][ip] -> GetEntries(); 00594 Out_entry[id][ip] = Out_DocaEAngdE[id][ip] -> GetEntries(); 00595 } else if(m_phshape_flag==4) { 00596 //Iner_mean[id][ip] = Iner_DocaEAngdE[id][ip] -> GetFunction("asym") -> GetParameter(1); 00597 Out_mean[id][ip] = Out_DocaEAngdE[id][ip] -> GetFunction("asym") -> GetParameter(1); 00598 //Iner_chisq[id][ip] = Iner_DocaEAngdE[id][ip] -> GetFunction("asym") -> GetParameter(2); 00599 Out_chisq[id][ip] = Out_DocaEAngdE[id][ip] -> GetFunction("asym") -> GetParameter(2); 00600 sigmadp[id][ip]=Out_DocaEAngdE[id][ip] -> GetFunction("asym") ->GetParError(1); 00601 00602 //Iner_entry[id][ip] = Iner_DocaEAngdE[id][ip] -> GetEntries(); 00603 Out_entry[id][ip] = Out_DocaEAngdE[id][ip] -> GetEntries(); 00604 } 00605 cout<<"Out_Doca_bin = "<<Out_Doca_bin<<" Out_mean[id][ip] = "<<Out_mean[id][ip]<<endl; 00606 double eangle_bin_value=(Eangle_bin_value[ip] + Eangle_bin_value[ip+1])/2; 00607 //Iner_DocaEAngAverdE->Fill(Iner_Doca_bin, eangle_bin_value, Iner_mean[id][ip]); 00608 //Out_DocaEAngAverdE->Fill(Out_Doca_bin, eangle_bin_value, Out_mean[id][ip]); 00609 //Iner_DocaEAngAverdE->SetBinContent(id, ip, Iner_mean[id][ip]); 00610 Out_DocaEAngAverdE->SetBinContent(id, ip, Out_mean[id][ip]); 00611 } 00612 } 00613 00614 NormdE_dp=0; 00615 w_w=0; 00616 for(Int_t id=0;id<NumSlicesDoca;id++) 00617 { 00618 for(Int_t ip=0;ip<NumSlicesEAng;ip++) 00619 { 00620 if(Out_mean[id][ip]>0&&sigmadp[id][ip]<10&&sigmadp[id][ip]>0&&Out_chisq[id][ip]>0&&Out_chisq[id][ip]<150&&Out_entry[id][ip]>1500) 00621 { 00622 cout<<"mean[ "<<id<<"][ "<<ip<<" ] : "<<Out_mean[id][ip]<<" sigmadp: "<< sigmadp[id][ip]<<" Out_chisq : "<<Out_chisq[id][ip]<<endl; 00623 // weight=1./sq(sigmadp[id][ip]); ! fix 00624 weight=1; 00625 NormdE_dp+=weight*Out_mean[id][ip]; 00626 w_w+=weight; 00627 } 00628 } 00629 } 00630 if(w_w ==0) { 00631 log<<MSG::ERROR<<"All fit Function Error in Doca and Eangle combined correction"<<endreq; 00632 NormdE_dp = 1; } 00633 else NormdE_dp/=w_w; 00634 cout<<"NormdE_dp = "<<NormdE_dp<<endl; 00635 cout<<"total event number : "<<eventNO<<endl; 00636 }
|
|
Implements DedxCalib. |
|
Implements DedxCalib. 00185 { 00186 eventNO ==0; 00187 log<<MSG::INFO<<"DedxCalibDocaEAngOver::BookHists( )..."<<endreq; 00188 log<<MSG::DEBUG<<" bookhist...1" <<endreq; 00189 m_proflist = new TObjArray(0); 00190 log<<MSG::DEBUG<<" bookhist...2" <<endreq; 00191 m_rand = new TRandom(); 00192 std::string hlabel; 00193 log<<MSG::DEBUG<<" bookhist...3" <<endreq; 00194 00195 char NameHist[50]; 00196 //Iner_DocaEAngdE=new TH1F*** [3]; 00197 //Out_DocaEAngdE=new TH1F*** [3]; 00198 //for(Int_t k=0;k<3;k++) 00199 //{ 00200 Iner_DocaEAngdE=new TH1F** [NumSlicesDoca]; 00201 Out_DocaEAngdE=new TH1F** [NumSlicesDoca]; 00202 for(Int_t id=0;id<NumSlicesDoca;id++) 00203 { 00204 Iner_DocaEAngdE[id]=new TH1F* [NumSlicesEAng]; 00205 Out_DocaEAngdE[id]=new TH1F* [NumSlicesEAng]; 00206 for(Int_t ip=0;ip<NumSlicesEAng;ip++) 00207 { 00208 sprintf(NameHist,"Iner_Doca%d_EAng%d_dEdx",id+1,ip+1); 00209 Iner_DocaEAngdE[id][ip]=new TH1F(NameHist,"dE/dx",NumHistBins,MinHistValue,MaxHistValue); 00210 sprintf(NameHist,"Out_Doca%d_EAng%d_dEdx",id+1,ip+1); 00211 Out_DocaEAngdE[id][ip]=new TH1F(NameHist,"dE/dx",NumHistBins,MinHistValue,MaxHistValue); 00212 00213 } 00214 } 00215 //} 00216 00217 /*Iner_DocaEAngdE=new TH1F** [NumSlicesDoca]; 00218 Out_DocaEAngdE=new TH1F** [NumSlicesDoca]; 00219 for(Int_t id=0;id<NumSlicesDoca;id++) 00220 { 00221 Iner_DocaEAngdE[id]=new TH1F* [NumSlicesEAng]; 00222 Out_DocaEAngdE[id]=new TH1F* [NumSlicesEAng]; 00223 for(Int_t ip=0;ip<NumSlicesEAng;ip++) 00224 { 00225 sprintf(NameHist,"Iner_Doca%d_EAng%d_dEdx",id+1,ip+1); 00226 Iner_DocaEAngdE[id][ip]=new TH1F(NameHist,"dE/dx",NumHistBins,MinHistValue,MaxHistValue); 00227 sprintf(NameHist,"Out_Doca%d_EAng%ddEdx",id+1,ip+1); 00228 Out_DocaEAngdE[id][ip]=new TH1F(NameHist,"dE/dx",NumHistBins,MinHistValue,MaxHistValue); 00229 } 00230 }*/ 00231 00232 char NameHist1[50]; 00233 Iner_DocaEAngAverdE=new TH2F; 00234 Out_DocaEAngAverdE=new TH2F; 00235 sprintf(NameHist1,"Iner_AverdEVsDocaEAngBin"); 00236 Iner_DocaEAngAverdE=new TH2F(NameHist1,"dE vs Doca & EAng",NumSlicesDoca,Iner_DocaMin,Iner_DocaMax,NumSlicesEAng,Phi_Min,Phi_Max); 00237 sprintf(NameHist1,"Out_AverdEVsDocaEAngBin"); 00238 Out_DocaEAngAverdE=new TH2F(NameHist1,"dE vs Doca & EAng",NumSlicesDoca,Out_DocaMin,Out_DocaMax,NumSlicesEAng,Phi_Min,Phi_Max); 00239 00240 //Iner_DocaEAngAverdE=new TH2F; 00241 //Out_DocaEAngAverdE=new TH2F; 00242 00243 /*sprintf(NameHist1,"Iner_AverdEVsDocaEAngBin_ltype%d",i); 00244 Iner_DocaEAngAverdE=new TH2F(NameHist1,"dE vs Doca & EAng",NumSlicesDoca,Iner_DocaMin,Iner_DocaMax,NumSlicesEAng,Phi_Min,Phi_Max); 00245 sprintf(NameHist1,"Out_AverdEVsDocaEAngBin_ltype%d",i); 00246 Out_DocaEAngAverdE=new TH2F(NameHist1,"dE vs Doca & EAng",NumSlicesDoca,Out_DocaMin,Out_DocaMax,NumSlicesEAng,Phi_Min,Phi_Max);*/ 00247 00248 00249 char NameHist2[50]; 00250 Iner_ProfDocaEAng=new TProfile2D; 00251 Out_ProfDocaEAng=new TProfile2D; 00252 sprintf(NameHist2,"Iner_ProfDocaEAng"); 00253 Iner_ProfDocaEAng=new TProfile2D(NameHist2,"Prof. Doca & EAng calibration",NumSlicesDoca,Iner_DocaMin,Iner_DocaMax,NumSlicesEAng,Phi_Min,Phi_Max); 00254 sprintf(NameHist2,"Out_ProfDocaEAng"); 00255 Out_ProfDocaEAng=new TProfile2D(NameHist2,"Prof. Doca & EAng calibration",NumSlicesDoca,Out_DocaMin,Out_DocaMax,NumSlicesEAng,Phi_Min,Phi_Max); 00256 00257 //Iner_ProfDocaEAng=new TProfile2D; 00258 //Out_ProfDocaEAng=new TProfile2D; 00259 /*sprintf(NameHist2,"Iner_ProfDocaEAng"); 00260 Iner_ProfDocaEAng=new TProfile2D(NameHist2,"Prof. Doca & EAng calibration",NumSlicesDoca,Iner_DocaMin,Iner_DocaMax,NumSlicesEAng,Phi_Min,Phi_Max); 00261 sprintf(NameHist2,"Out_ProfDocaEAng"); 00262 Out_ProfDocaEAng=new TProfile2D(NameHist2,"Prof. Doca & EAng calibration",NumSlicesDoca,Out_DocaMin,Out_DocaMax,NumSlicesEAng,Phi_Min,Phi_Max); */ 00263 00264 ProfdEdxDocaEAng=new TProfile2D* [NumLayers]; 00265 //HistEAngLayer=new TH2F("HistEAngLayer","dE vs Layer & EAng",40,1,40,NumSlicesEAng,Phi_Min,Phi_Max); 00266 00267 char NameHist3[50]; 00268 for(Int_t i=0;i<NumLayers;i++) 00269 { 00270 sprintf(NameHist3,"ProfdEdxDocaEAng%d",i+1); 00271 if(i<8) 00272 ProfdEdxDocaEAng[i]=new TProfile2D(NameHist3,"Prof. Doca & EAng dEdx",NumSlicesDoca,Iner_DocaMin,Iner_DocaMax,NumSlicesEAng,Phi_Min,Phi_Max); 00273 // ProfdEdxDocaEAng[i]->SetAxisRange(0.,10000.,"Z"); 00274 else if (i>= 8) 00275 ProfdEdxDocaEAng[i]=new TProfile2D(NameHist3,"Prof. Doca & EAng dEdx",NumSlicesDoca,Out_DocaMin,Out_DocaMax,NumSlicesEAng,Phi_Min,Phi_Max); 00276 00277 } 00278 00279 /*printf(NameHist,"HistEntries"); 00280 HistEntries=new TH1F(NameHist,"Number of entries",100,0,2000); 00281 Iner_HistDocaEAng=new TH1F* [3]; 00282 Out_HistDocaEAng=new TH1F* [3]; 00283 for(Int_t i=0;i<3;i++) 00284 { 00285 sprintf(NameHist,"HistDocaEAng%d",i); 00286 Iner_HistDocaEAng[i]=new TH1F(NameHist,"Hist Doca & EAng calibration",50,0,2.5); 00287 Out_HistDocaEAng[i]=new TH1F(NameHist,"Hist Doca & EAng calibration",50,0,2.5); 00288 }*/ 00289 00290 }
|
|
|
|
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. 00294 { 00295 log<<MSG::INFO<<"DedxCalibDocaEAngOver::FillHists( )..."<<endreq; 00296 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader"); 00297 if (!eventHeader) { 00298 log << MSG::FATAL << "Could not find Event Header" << endreq; 00299 return; 00300 } 00301 int event = eventHeader->eventNumber(); 00302 int runNO = eventHeader->runNumber(); 00303 int typFlag; //data type flag: 0:MC data, 1: 2150, 2:2200 00304 if(runNO<0) typFlag =0; 00305 else if(runNO>=0 && runNO<5459) typFlag =1; 00306 else if(runNO>=5459 && runNO<8093) typFlag =2; 00307 else if(runNO>=8093 && runNO<9815) typFlag =3; 00308 else if(runNO>=9815 ) typFlag =4; 00309 //cout<<"event = "<<event<<" runNO = "<<runNO <<endl; 00310 RunNO2_doca= runNO; 00311 if(RunNO1_doca==0) RunNO1_doca=runNO; 00312 if(RunNO2_doca != RunNO1_doca){ 00313 cout<<"RunNO2 = "<<RunNO2_doca <<" RunNO1 = "<<RunNO1_doca<<endl; 00314 } 00315 RunNO1_doca = runNO; 00316 00317 double tes; 00318 int esTimeflag = -1; 00319 SmartDataPtr<RecEsTimeCol> estimeCol(eventSvc(),"/Event/Recon/RecEsTimeCol"); 00320 if( ! estimeCol) { 00321 log << MSG::WARNING << "Could not find EvTimeCol" << endreq; 00322 }else{ 00323 RecEsTimeCol::iterator iter_evt = estimeCol->begin(); 00324 for(; iter_evt!=estimeCol->end(); iter_evt++){ 00325 tes = (*iter_evt)->getTest(); 00326 esTimeflag = (*iter_evt)->getStat(); 00327 } 00328 } 00329 if(typFlag ==2) {if( tes>1000 ) return;} 00330 else if(typFlag ==3 ){if (tes>700 ) return;} 00331 else if(typFlag ==4 ){if (tes>1400 ) return;} 00332 if(typFlag ==3 && tes>700) cout<<"run : "<<runNO<<" event : "<<event<<" typFlag : "<<typFlag<<" tes : "<<tes<<endl; 00333 if(typFlag ==4 && tes>1400) cout<<"run : "<<runNO<<" event : "<<event<<" typFlag : "<<typFlag<<" tes : "<<tes<<endl; 00334 00335 Identifier mdcid; 00336 SmartDataPtr<RecMdcTrackCol> trkCol(eventSvc(),"/Event/Recon/RecMdcTrackCol"); 00337 if (!trkCol) { 00338 log << MSG::INFO << "Could not find RecMdcTrackCol" << endreq; 00339 return; 00340 } 00341 00342 int ltype, EAng_bin, iDoca, iEAng, layid, hid, lr, localwid; 00343 double stepdoca, adc_raw, tdc_raw, costhe, zhit, driftdist, driftd, dd, ph, sinenta, eangle, pathlength, sintheta, rphi_path; 00344 log << MSG::INFO << "Begin to check RecMdcTrackCol"<<endreq; 00345 RecMdcTrackCol::iterator iter_trk = trkCol->begin(); 00346 for( ; iter_trk != trkCol->end(); iter_trk++) { 00347 HepVector a = (*iter_trk)->helix(); 00348 HepSymMatrix tkErrM = (*iter_trk)->err(); 00349 double m_d0E = tkErrM[0][0]; 00350 double m_phi0E = tkErrM[1][1]; 00351 double m_cpaE = tkErrM[2][2]; 00352 double m_z0E = tkErrM[3][3]; 00353 00354 HepPoint3D IP(0,0,0); 00355 Dedx_Helix exhel(IP, a); 00356 double phi0= a[1]; 00357 log << MSG::DEBUG << "hitList of this track:" << endreq; 00358 HitRefVec gothits = (*iter_trk)->getVecHits(); 00359 HitRefVec::iterator it_gothit = gothits.begin(); 00360 double costhe_cut = cos(M_PI_2-atan(a[4])); 00361 if(abs(costhe_cut)>0.9 ) continue; 00362 if(gothits.size()<15) continue; 00363 //cout <<"hit size : "<<gothits.size()<<endl; 00364 for( ; it_gothit != gothits.end(); it_gothit++) { 00365 mdcid = (*it_gothit)->getMdcId(); 00366 layid = MdcID::layer(mdcid); 00367 localwid = MdcID::wire(mdcid); 00368 adc_raw = (*it_gothit)->getAdc(); 00369 //adc_raw = (*it_gothit)->getAdc(); 00370 tdc_raw = (*it_gothit)->getTdc(); 00371 zhit = (*it_gothit)->getZhit(); 00372 sinenta = sin((*it_gothit)->getEntra()); 00373 costhe = cos(M_PI_2-atan(a[4])); 00374 sintheta = sin(M_PI_2-atan(a[4])); 00375 eangle = (*it_gothit)->getEntra(); 00376 eangle = eangle/M_PI; 00377 lr = (*it_gothit)->getFlagLR(); 00378 if(lr == 0 || lr == 2) driftdist = (*it_gothit)->getDriftDistLeft(); 00379 if(lr == 1 ) driftdist = (*it_gothit)->getDriftDistRight(); 00380 driftd = abs(driftdist); 00381 dd = (*it_gothit)->getDoca(); 00382 if(lr == 0 || lr == 2 ) dd = -abs(dd); 00383 if(lr == 1 ) dd = abs(dd); 00384 dd = dd/doca_norm[layid]; 00385 00386 int ntpFlag = 1; 00387 ph = exsvc->StandardCorrec(typFlag, ntpFlag, runNO, exhel, mdcid, adc_raw, dd, eangle, zhit, costhe ); 00388 pathlength = exsvc->PathL(ntpFlag, exhel, layid, localwid, zhit); 00389 lr = (*it_gothit)->getFlagLR(); 00390 // cpathlength = exsvc->PathL(flag,exhel, layid, localwid, zhit); 00391 //pathlength = exsvc->PathLCosmic(exhel, layid, localwid, zhit, m_z0E); 00392 if(lr == 1 ) driftdist = (*it_gothit)->getDriftDistRight(); 00393 rphi_path = pathlength * sintheta; 00394 //cout<<event<<setw(10)<<layid<<setw(8)<<localwid<<setw(15)<<driftd<<setw(15)<<rphi_path<<setw(15)<<pathlength<<setw(15)<<ph<<endl; 00395 if(eangle >0.25) eangle = eangle -0.5; 00396 else if(eangle <-0.25) eangle = eangle +0.5; 00397 if(pathlength >0 && eangle>-0.25 && eangle<0.25){ 00398 if(layid <4) continue; 00399 /*else if(layid>=4 &&layid<8) 00400 { 00401 if(adc_raw<MinADCValuecut || adc_raw>MaxADCValuecut || rphi_path>RPhi_PathMaxCut || rphi_path<Iner_RPhi_PathMinCut || driftd>Iner_DriftDistCut || abs(dd)>Iner_DocaMax) continue; 00402 ltype=layer_typ[layid]; 00403 iDoca =(Int_t)floor((dd-Iner_DocaMin)/Iner_Stepdoca); 00404 //iEAng = (Int_t)floor((eangle-Phi_Min)/IEangle_step); 00405 00406 int iEAng = 0; 00407 for(int i =0; i<14; i++){ 00408 if(eangle <Eangle_value_cut[i] || eangle > Eangle_value_cut[i+1]) continue; 00409 else if(eangle>= Eangle_value_cut[i] && eangle < Eangle_value_cut[i+1]) { 00410 for(int k =0; k<i; k++){ 00411 iEAng+= Eangle_cut_bin[k]; 00412 } 00413 double eangle_bin_cut_step = (Eangle_value_cut[i+1] - Eangle_value_cut[i])/Eangle_cut_bin[i]; 00414 int temp_bin = int((eangle-Eangle_value_cut[i])/eangle_bin_cut_step); 00415 iEAng+= temp_bin; 00416 //cout<<"eangle "<<eangle<<" i : "<<i<<" eangle_step = "<<eangle_bin_cut_step<<" temp_bin : "<<temp_bin<<" iEAng : "<<iEAng<<endl; 00417 } 00418 } 00419 //EAng_bin = (Int_t)floor((eangle-Phi_Min)/0.005); 00420 //iEAng = EAng_dis[EAng_bin]; 00421 //cout<<"ltype : "<<ltype<<" iDoca : "<<iDoca<<" iEAng: "<<iEAng<<" ph : "<<ph<<endl; 00422 Iner_DocaEAngdE[iDoca][iEAng]->Fill(ph); 00423 Iner_ProfDocaEAng->Fill(dd,eangle,ph); 00424 }*/ 00425 else if(layid >= 4) 00426 { 00427 if(layid>=4 &&layid<8){ 00428 if(adc_raw<MinADCValuecut || adc_raw>MaxADCValuecut || rphi_path>RPhi_PathMaxCut || rphi_path<Iner_RPhi_PathMinCut || driftd>Iner_DriftDistCut || abs(dd)>Iner_DocaMax) continue;} 00429 else if(layid>=8){ 00430 if( adc_raw<MinADCValuecut || adc_raw>MaxADCValuecut || rphi_path>RPhi_PathMaxCut || rphi_path<Out_RPhi_PathMinCut || driftd>Out_DriftDistCut || abs(dd)>Out_DocaMax) continue;} 00431 ltype=layer_typ[layid]; 00432 iDoca =(Int_t)floor((dd-Out_DocaMin)/Out_Stepdoca); 00433 //iEAng = (Int_t)floor((eangle-Phi_Min)/IEangle_step); 00434 int iEAng = 0; 00435 for(int i =0; i<14; i++){ 00436 if(eangle <Eangle_value_cut[i] || eangle >= Eangle_value_cut[i+1]) continue; 00437 else if(eangle>= Eangle_value_cut[i] && eangle < Eangle_value_cut[i+1]) { 00438 for(int k =0; k<i; k++){ 00439 iEAng+= Eangle_cut_bin[k]; 00440 } 00441 double eangle_bin_cut_step = (Eangle_value_cut[i+1] - Eangle_value_cut[i])/Eangle_cut_bin[i]; 00442 int temp_bin = int((eangle-Eangle_value_cut[i])/eangle_bin_cut_step); 00443 iEAng+= temp_bin; 00444 //cout<<"eangle "<<eangle<<" i : "<<i<<" eangle_step = "<<eangle_bin_cut_step<<" temp_bin : "<<temp_bin<<" iEAng : "<<iEAng<<endl; 00445 } 00446 } 00447 //cout<<"dd = "<<dd<<" iDoca = "<<iDoca<<" eangle = "<<eangle <<" iEAng = "<<iEAng<<endl; 00448 00449 //EAng_bin = (Int_t)floor((eangle-Phi_Min)/0.005); 00450 //iEAng = EAng_dis[EAng_bin]; 00451 //cout<<"ltype : "<<ltype<<" iDoca : "<<iDoca<<" iEAng: "<<iEAng<<" ph : "<<ph<<endl; 00452 00453 Out_DocaEAngdE[iDoca][iEAng]->Fill(ph); 00454 Out_ProfDocaEAng->Fill(dd,eangle,ph); 00455 } 00456 ProfdEdxDocaEAng[layid]->Fill(dd,eangle,ph); 00457 } 00458 } 00459 } 00460 eventNO++; 00461 }
|
|
Implements DedxCalib. |
|
Implements DedxCalib. 00639 { 00640 log<<MSG::INFO<<"DedxCalibDocaEAngOver::FillHistsFromTree( )..."<<endreq; 00641 }
|
|
|
|
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. 00051 { 00052 log<<MSG::INFO<<"DedxCalibDocaEAngOver::GetChargeOffCorr( )..."<<endreq; 00053 return 1.0; 00054 }
|
|
|
|
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. 00644 { 00645 log<<MSG::INFO<<"DedxCalibDocaEAngOver::WriteCalibdEdxParameters( )..."<<endreq; 00646 }
|
|
Implements DedxCalib. |
|
Implements DedxCalib. 00058 { log<<MSG::INFO<<"DedxCalibDocaEAngOver::WriteHists( )..."<<endreq; 00059 //TFile fhist("dcasincalib.root", "recreate"); 00060 const int Total_cell = NumSlicesDoca*NumSlicesEAng; 00061 cout<<"Total_cell = "<<Total_cell<<endl; 00062 Double_t Iner_mean0, Out_mean0, Iner_gain[Total_cell], Out_gain[Total_cell]; 00063 Double_t Iner_chi[Total_cell], Out_chi[Total_cell], Iner_hits[Total_cell], Out_hits[Total_cell]; 00064 if(m_phshape_flag==0) { 00065 //Iner_mean0 = Iner_DocaEAngdE[Dcasin_dd_iner][Dcasin_sin_iner]->GetFunction("mylan")->GetParameter(1); 00066 Out_mean0 = Out_DocaEAngdE[Dcasin_dd_out][Dcasin_sin_out]->GetFunction("mylan")->GetParameter(1); 00067 } else if(m_phshape_flag==1) { 00068 //Iner_mean0 = Iner_DocaEAngdE[Dcasin_dd_iner][Dcasin_sin_iner]->GetFunction("landaun")->GetParameter(1); 00069 Out_mean0 = Out_DocaEAngdE[Dcasin_dd_out][Dcasin_sin_out]->GetFunction("landaun")->GetParameter(1); 00070 } else if(m_phshape_flag==2) { 00071 //Iner_mean0 = Iner_DocaEAngdE[Dcasin_dd_iner][Dcasin_sin_iner]->GetFunction("land")->GetParameter(1); 00072 Out_mean0 = Out_DocaEAngdE[Dcasin_dd_out][Dcasin_sin_out] -> GetFunction("land") -> GetParameter(1); 00073 } else if(m_phshape_flag==3) { 00074 //Iner_mean0 = Iner_DocaEAngdE[Dcasin_dd_iner][Dcasin_sin_iner]->GetFunction("vavi")->GetParameter(1); 00075 Out_mean0 = Out_DocaEAngdE[Dcasin_dd_out][Dcasin_sin_out]->GetFunction("vavi")->GetParameter(1); 00076 } else if(m_phshape_flag==4) { 00077 //Iner_mean0 = Iner_DocaEAngdE[Dcasin_dd_iner][Dcasin_sin_iner]->GetFunction("asym")->GetParameter(1); 00078 Out_mean0 = Out_DocaEAngdE[Dcasin_dd_out][Dcasin_sin_out]->GetFunction("asym")->GetParameter(1); 00079 } 00080 cout<<" Out_mean0 : "<<Out_mean0<<endl; 00081 00082 Int_t N=0; 00083 double Id_doca[1600], Ip_eangle[1600]; 00084 00085 for(Int_t id=0;id<NumSlicesDoca;id++){ 00086 for(Int_t ip=0;ip<NumSlicesEAng;ip++){ 00087 Id_doca[N] = id; 00088 Ip_eangle[N] = ip; 00089 /*if(Iner_entry[id][ip]<CellEntry_cut ||Iner_chisq[id][ip]<0){ 00090 Iner_gain[N] = 0; 00091 Iner_chi[N] = Iner_chisq[id][ip]; 00092 Iner_hits[N] = Iner_entry[id][ip]; 00093 } 00094 else if(Iner_entry[id][ip]>CellEntry_cut &&Iner_chisq[id][ip]>0){ 00095 Iner_gain[N] = Iner_mean[id][ip]/NormdE_dp; 00096 Iner_chi[N] = Iner_chisq[id][ip]; 00097 Iner_hits[N] = Iner_entry[id][ip]; 00098 }*/ 00099 Iner_gain[N] = 0; 00100 Iner_chi[N] = 0; 00101 Iner_hits[N] = 0; 00102 if(Out_entry[id][ip]<CellEntry_cut ||Out_chisq[id][ip]<0){ 00103 Out_gain[N] = 0; 00104 Out_chi[N] = Out_chisq[id][ip]; 00105 Out_hits[N] = Out_entry[id][ip]; 00106 cout<<"out_gain[ "<<N<<" ] : "<<Out_gain[N]<<" chi value : "<<Out_chi[N]<<" cell entries : "<< Out_hits[N]<<endl; 00107 } 00108 else if (Out_entry[id][ip]>CellEntry_cut &&Out_chisq[id][ip]>0){ 00109 //Out_gain[N] = Out_mean[id][ip]/Out_mean0; 00110 //cout<<"mean[ "<<id<<"][ "<<ip<<" ] : "<<Out_mean[id][ip]<<" chisq : "<<Out_chisq[id][ip]<<" cell entries : "<< Out_entry[id][ip]<<endl; 00111 Out_gain[N] = Out_mean[id][ip]/NormdE_dp; 00112 Out_chi[N] = Out_chisq[id][ip]; 00113 Out_hits[N] = Out_entry[id][ip]; 00114 cout<<"out_gain[ "<<N<<" ] : "<<Out_gain[N]<<" chi value : "<<Out_chi[N]<<" cell entries : "<< Out_hits[N]<<endl; 00115 } 00116 N++; 00117 } 00118 } 00119 00120 00121 std::string rootpath_docangle = m_rootfile; 00122 std::string hlabel_rootpath_docangle; 00123 std::ostringstream strout; 00124 strout << rootpath_docangle <<"/doca_eangle_tsf_normal.root"; 00125 hlabel_rootpath_docangle = strout.str(); 00126 std::cout<<"string doca angle : "<<hlabel_rootpath_docangle.c_str()<<endl; 00127 00128 TFile fhist(hlabel_rootpath_docangle.c_str(), "recreate"); 00129 00130 TTree* docasin = new TTree("docasincalib", "docasincalib"); 00131 docasin-> Branch("Iner_gain", &Iner_gain, "Iner_gain[1600]/D"); 00132 docasin -> Branch("Out_gain", &Out_gain, "Out_gain[1600]/D"); 00133 docasin-> Branch("Iner_chi", &Iner_chi, "Iner_chi[1600]/D"); 00134 docasin -> Branch("Out_chi", &Out_chi, "Out_chi[1600]/D"); 00135 docasin-> Branch("Iner_hits", &Iner_hits, "Iner_hits[1600]/D"); 00136 docasin -> Branch("Out_hits", &Out_hits, "Out_hits[1600]/D"); 00137 docasin -> Branch("Id_doca", &Id_doca, "Id_doca[1600]/D"); 00138 docasin -> Branch("Ip_eangle", &Ip_eangle, "Ip_eangle[1600]/D"); 00139 docasin-> Fill(); 00140 docasin -> Write(); 00141 00142 00143 Iner_DocaEAngAverdE->Write(); 00144 Out_DocaEAngAverdE->Write(); 00145 Iner_ProfDocaEAng->Write(); 00146 Out_ProfDocaEAng->Write(); 00147 00148 for(Int_t id=0;id<NumSlicesDoca;id++){ 00149 for(Int_t ip=0;ip<NumSlicesEAng;ip++){ 00150 Iner_DocaEAngdE[id][ip]->Write(); 00151 Out_DocaEAngdE[id][ip]->Write(); 00152 } 00153 } 00154 00155 for(Int_t i=0;i<NumLayers;i++){ 00156 ProfdEdxDocaEAng[i]->Write(); 00157 } 00158 //HistEAngLayer->Write(); 00159 //HistEntries->Write(); 00160 00161 fhist.Close(); 00162 00163 delete Iner_DocaEAngAverdE; 00164 delete Out_DocaEAngAverdE; 00165 delete Iner_ProfDocaEAng; 00166 delete Out_ProfDocaEAng; 00167 00168 for(Int_t id=0;id<NumSlicesDoca;id++){ 00169 for(Int_t ip=0;ip<NumSlicesEAng;ip++){ 00170 delete Iner_DocaEAngdE[id][ip]; 00171 delete Out_DocaEAngdE[id][ip]; 00172 } 00173 } 00174 00175 for(int i=0; i<NumLayers; i++) delete ProfdEdxDocaEAng[i]; 00176 //delete HistEAngLayer; 00177 //delete HistEntries; 00178 //delete docasin; 00179 delete m_rand; 00180 00181 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|