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