00001
00002
00003
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00019
00020 #include "TFndPreanHistos.h"
00021
00022 #include "TFndFitter.h"
00023
00024 ClassImp(TFndPreanHistos)
00025
00026 TFndPreanHistos::TFndPreanHistos():
00027 fCount_EventTotal(),
00028 fCount_EventPerRun(),fCount_KminPerRun(),fCount_KpluPerRun(),
00029 fCount_Stat_Time(),fCount_Stat_BhaNum(),fCount_Stat_HypNum(),
00030 fGR_Stat_BhaNum(),fGR_Stat_HypNum(),
00031 fGR_Stat_Evs(),
00032 fGR_Stat_AvgLum(),fGR_Stat_IntLum(),fGR_Stat_IntLum_Tot(),
00033 fGR_Stat_KminStop_Num(),fGR_Stat_KpluStop_Num(),
00034 fGR_Stat_MuPluAll_Num(),fGR_Stat_MuPluAll_Mom(),
00035 fGR_Stat_BhaRec_Num(),fGR_Stat_BhaRec_ECMee(),
00036 fGR_Stat_BhaRec_Kshort_Num(),fGR_Stat_BhaRec_Kshort_InvMass(),fGR_Stat_BhaRec_Ratio(),
00037 fHTmp_MuPluAll(),fHTmp_BhaInvMass(),fHTmp_PionsInvMass(),
00038 fCut_Fitted(kTRUE),fCut_TrkType(-1)
00039 {
00040
00041 fGesHistosInitialized = kFALSE;
00042 fBhabhaHistosInitialized = kFALSE;
00043 fHypeHistosInitialized = kFALSE;
00044 fStatGraphsInitialized = kFALSE;
00045
00046 gStyle->SetPalette(1,0);
00047 gStyle->SetOptStat(1001100);
00048
00049 gStyle->SetTitleW(0.7);
00050 gStyle->SetStatH(0.17);
00051 gStyle->SetStatW(0.3);
00052 gStyle->SetStatX(.99);
00053 gStyle->SetStatY(.97);
00054
00055 fKstopMarkCol[E_Kaon_Stop_Target] = 1;
00056 fKstopMarkCol[E_Kaon_Stop_Isim] = 3;
00057 fKstopMarkCol[E_Kaon_Stop_Glass] = 4;
00058 fKstopMarkCol[E_Kaon_Stop_Upilex] = 4;
00059 fKstopMarkCol[E_Kaon_Stop_Osim] = 9;
00060 fKstopMarkCol[E_Kaon_Stop_Other] = 2;
00061
00062 }
00063
00064 TFndPreanHistos::~TFndPreanHistos(){
00065
00066 delete fH_GesTrigBit;
00067
00068
00069
00070
00071 delete fH_BhaVert_XYZ;
00072 delete fH_BhaVert_XY;
00073 delete fH_BhaVert_XZ;
00074
00075 delete fH_BhaMom_2D;
00076 delete fH_InvMass_EpluEmin;
00077 delete fH_InvMass_PIpluPImin;
00078
00079 delete fH_BhaTracksAngle;
00080 delete fH_BhaTotalMomentum;
00081
00082 delete fH_BhaParticleTOF_2D;
00083 delete fH_BhaTofi_TimeDiff;
00084 delete fH_BhaTofi_Time_2D;
00085 delete fH_BhaTofo_TimeDiff;
00086
00087
00088
00089
00090 delete fH_Hyp_PattRecErr;
00091 delete fH_Hyp_Kmin_StopCode;
00092 delete fH_Hyp_Kplu_StopCode;
00093 for(Int_t i=(Int_t)E_Kaon_Stop_Target; i<=(Int_t)E_Kaon_Stop_Other; i++){
00094 delete fH_HypKmin_stop_XY[i];
00095 delete fH_HypKplu_stop_XY[i];
00096 }
00097 delete fH_Hyp_K_StopTgt_2D;
00098 delete fH_Hyp_K_StopVol_2D;
00099
00100 delete fH_Hyp_PhiDecPos_XYZ;
00101 delete fH_Hyp_PhiDecPos_XY;
00102 delete fH_Hyp_PhiDecPos_XZ;
00103 delete fH_PhiDecPos_X;
00104 delete fH_PhiDecPos_Y;
00105 delete fH_PhiDecPos_Z;
00106
00107 for(Int_t i=0;i<8;i++){
00108 delete fH_HypTrk_KpluPosAll;
00109 delete fH_HypTrk_KpluPosPthAll;
00110 delete fH_HypTrk_KpluPosTgt[i];
00111 delete fH_HypTrk_KpluPosPth[i];
00112 }
00113
00114 delete fH_Hyp_KTofi_TimeDiff;
00115 delete fH_Hyp_KTofi_Time_2D;
00116 delete fH_Hyp_MuTof;
00117 delete fH_Hyp_MuTofCorr;
00118
00119
00120
00121 DeleteStatGraphs();
00122 }
00123
00125
00126
00127 void TFndPreanHistos::InitGesHistos(){
00128
00129 if(fGesHistosInitialized == kTRUE) return;
00130
00131 fH_GesTrigBit = new TH1F("TriggerCode","Trigger-code",22,-0.5,21.5);
00132
00133
00134 fGesHistosInitialized = kTRUE;
00135 ResetGesHistos();
00136 }
00137
00138
00139 void TFndPreanHistos::ResetGesHistos(){
00140
00141 if(fGesHistosInitialized == kFALSE) return;
00142 fH_GesTrigBit->Reset();
00143 }
00144
00145
00146 void TFndPreanHistos::WriteGesHistos(){
00147
00148 if(fGesHistosInitialized == kFALSE) return;
00149 fH_GesTrigBit->Write();
00150 }
00151
00152
00153 void TFndPreanHistos::LoadGesHistos(TFile *fin){
00154
00155 if(fGesHistosInitialized == kFALSE) return;
00156
00157 ResetGesHistos();
00158 AddSingleHistoFromFile(fH_GesTrigBit , fin);
00159 }
00160
00161
00162 void TFndPreanHistos::FillGesHistos(){
00163
00164 if(fGesHistosInitialized == kFALSE) return;
00165 Int_t n_entries = fGesTree->GetEntries();
00166 if(fDebugLev>=1) Printf("Number of entries in Ges tree: %d",n_entries);
00167
00168 for(Int_t ev=0;ev<n_entries;ev++){
00169 fGesTree->GetEntry(ev);
00170 fH_GesTrigBit->Fill(fGesTrigType);
00171 }
00172
00173 }
00174
00175
00176 void TFndPreanHistos::EvalGesHistos(){
00177
00178 if(fDebugLev > 0) Info("EvalGesHistos","Evaluating histograms");
00179 }
00180
00182
00183
00184 void TFndPreanHistos::InitBhabhaHistos(){
00185
00186 if(fBhabhaHistosInitialized == kTRUE) return;
00187
00188 Float_t pos_resol[3] = { 0.1, 0.1, 0.30 };
00189 Float_t pos_half[3] = { 4.5 , 3, 4.5 };
00190 Int_t pos_bins[3];
00191 for(Int_t i=0;i<3;i++){
00192 pos_bins[i] = (Int_t)( (pos_half[i] * 2) / pos_resol[i] );
00193 }
00194
00195
00196 fH_BhaMom_2D = new TH2F("Bhabha_Momentum_2D","Bhabha momentum e- vs e+",200,0,1,200,0,1);
00197
00198 fH_InvMass_EpluEmin = new TH1F("Bhabha_EpluEmin_InvMass","Bhabha (e+,e-) inv.mass. (GeV/c2)",500,0,1.5);
00199 fH_InvMass_PIpluPImin = new TH1F("Bhabha_PIpluPImin_InvMass","Bhabha (pi+,pi-) inv.mass. (GeV/c2)",500,0,1.5);
00200
00201 fH_BhaVert_XYZ = new TH3F("Bhabha_Vertex_XYZ","Bhabha Vertex 3D (cm)",
00202 pos_bins[0],-pos_half[0],pos_half[0],
00203 pos_bins[1],-pos_half[1],pos_half[1],
00204 pos_bins[2],-pos_half[2],pos_half[2]);
00205
00206 fH_BhaVert_XY = new TH2F("Bhabha_Vertex_XY","Bhabha Vertex Y vs X",
00207 pos_bins[0],-pos_half[0],pos_half[0],
00208 pos_bins[1],-pos_half[1],pos_half[1]);
00209 fH_BhaVert_XZ = new TH2F("Bhabha_Vertex_XZ","Bhabha Vertex Z vs X",
00210 pos_bins[0],-pos_half[0],pos_half[0],
00211 pos_bins[2],-pos_half[2],pos_half[2]);
00212
00213
00214 fH_BhaTracksAngle = new TH1F("Bhabha_TracksAngle","Bhabha tracks angle (deg)",500,0,180);
00215 fH_BhaTotalMomentum = new TH1F("Bhabha_TotalMomentum","Bhabha total momentum (GeV/c)",500,0,1);
00216
00217
00218 Float_t tof_limits[2] = { -1., 30. };
00219 Int_t tof_bins = 92;
00220 fH_BhaParticleTOF_2D = new TH2F("Bhabha_TOF_2D","Bhabha TOF e- vs e+",
00221 tof_bins,tof_limits[0],tof_limits[1],
00222 tof_bins,tof_limits[0],tof_limits[1]);
00223
00224 Float_t tdiff_limits[2] = { -15., 15. };
00225 Int_t tdiff_bins = 90;
00226
00227
00228 fH_BhaTofi_TimeDiff = new TH1F("Bhabha_TofinoTimeDiff","Bhabha tofino DeltaT (ns) [e+ - e-]",
00229 tdiff_bins,tdiff_limits[0],tdiff_limits[1]);
00230 fH_BhaTofi_Time_2D = new TH2F("Bhabha_Tofino_Time_2D"," Bhabha tofino Time 2D e- vs e+",
00231 50,-170,-140,50,-170,-140);
00232
00233
00234 fH_BhaTofo_TimeDiff = new TH1F("Bhabha_TofoneTimeDiff","Bhabha tofone DeltaT (ns) [e+ - e-]",
00235 tdiff_bins,tdiff_limits[0],tdiff_limits[1]);
00236
00237
00238
00239
00240 fH_BhaVert_XYZ->SetMarkerColor(9);
00241 fH_BhaVert_XYZ->SetMarkerStyle(20);
00242 fH_BhaVert_XYZ->SetMarkerSize(0.7);
00243
00244 fH_BhaVert_XY->SetAxisRange(-1.5,1.5,"X");
00245 fH_BhaVert_XY->SetAxisRange(-1.5,1.5,"Y");
00246
00247 fH_BhaVert_XYZ->SetStats(kFALSE);
00248
00249 fBhabhaHistosInitialized = kTRUE;
00250 ResetBhabhaHistos();
00251 }
00252
00253
00254 void TFndPreanHistos::ResetBhabhaHistos(){
00255
00256 if(fBhabhaHistosInitialized == kFALSE) return;
00257
00258 fH_BhaMom_2D->Reset();;
00259
00260 fH_InvMass_EpluEmin->Reset();
00261 fH_InvMass_PIpluPImin->Reset();
00262
00263 fH_BhaVert_XYZ->Reset();
00264 fH_BhaVert_XY->Reset();
00265 fH_BhaVert_XZ->Reset();
00266
00267 fH_BhaTracksAngle->Reset();
00268 fH_BhaTotalMomentum->Reset();
00269
00270 fH_BhaParticleTOF_2D->Reset();
00271 fH_BhaTofi_TimeDiff->Reset();
00272 fH_BhaTofi_Time_2D->Reset();
00273 fH_BhaTofo_TimeDiff->Reset();
00274
00275 }
00276
00277
00278 void TFndPreanHistos::WriteBhabhaHistos(){
00279
00280 if(fBhabhaHistosInitialized == kFALSE) return;
00281
00282 fH_BhaMom_2D->Write();;
00283
00284 fH_InvMass_EpluEmin->Write();
00285 fH_InvMass_PIpluPImin->Write();
00286
00287 fH_BhaVert_XYZ->Write();
00288 fH_BhaVert_XY->Write();
00289 fH_BhaVert_XZ->Write();
00290
00291 fH_BhaTracksAngle->Write();
00292 fH_BhaTotalMomentum->Write();
00293
00294 fH_BhaParticleTOF_2D->Write();
00295 fH_BhaTofi_TimeDiff->Write();
00296 fH_BhaTofi_Time_2D->Write();
00297 fH_BhaTofo_TimeDiff->Write();
00298
00299 }
00300
00301
00302 void TFndPreanHistos::LoadBhabhaHistos(TFile *fin){
00303
00304 if(fBhabhaHistosInitialized == kFALSE) return;
00305
00306 ResetBhabhaHistos();
00307
00308 AddSingleHistoFromFile( fH_BhaMom_2D , fin);
00309
00310 AddSingleHistoFromFile( fH_InvMass_EpluEmin , fin);
00311 AddSingleHistoFromFile( fH_InvMass_PIpluPImin , fin);
00312
00313 AddSingleHistoFromFile( fH_BhaVert_XYZ , fin);
00314 AddSingleHistoFromFile( fH_BhaVert_XY , fin);
00315 AddSingleHistoFromFile( fH_BhaVert_XZ , fin);
00316
00317 AddSingleHistoFromFile( fH_BhaTracksAngle , fin);
00318 AddSingleHistoFromFile( fH_BhaTotalMomentum , fin);
00319
00320 AddSingleHistoFromFile( fH_BhaParticleTOF_2D , fin);
00321 AddSingleHistoFromFile( fH_BhaTofi_TimeDiff , fin);
00322 AddSingleHistoFromFile( fH_BhaTofi_Time_2D , fin);
00323 AddSingleHistoFromFile( fH_BhaTofo_TimeDiff , fin);
00324
00325 }
00326
00327
00328 void TFndPreanHistos::FillBhabhaHistos(){
00329
00330 if(!fBhabhaTree){
00331 cout << "FillBhabhaHistos exiting (fBhabhaTree not available)" << endl;
00332 return;
00333 }
00334
00335 Float_t in_val_floats = -999.;
00336
00337 Int_t n_entries = fBhabhaTree->GetEntries();
00338 if(fDebugLev>=1) Printf("Number of entries in Bhabha tree: %d",n_entries);
00339 for(Int_t ev=0;ev<n_entries;ev++){
00340 fBhabhaTree->GetEntry(ev);
00341
00342 if(fBhaMom[FPh_BhaElec_id] == 0 || fBhaMom[FPh_BhaPosit_id] == 0) continue;
00343
00344
00345 Bool_t can_fill_int_point = kTRUE;
00346 for(Int_t i=0;i<3;i++) if(fBhaVertPos[i]==-999) can_fill_int_point = kFALSE;
00347 if(can_fill_int_point){
00348
00349 fH_BhaVert_XYZ->Fill(fBhaVertPos[0],fBhaVertPos[1],fBhaVertPos[2]);
00350 fH_BhaVert_XY->Fill(fBhaVertPos[0],fBhaVertPos[1]);
00351 fH_BhaVert_XZ->Fill(fBhaVertPos[0],fBhaVertPos[2]);
00352 }
00353
00354 fH_BhaMom_2D->Fill(fBhaMom[FPh_BhaPosit_id],fBhaMom[FPh_BhaElec_id]);
00355
00356 fH_InvMass_EpluEmin->Fill(fBhaInvMass_EpluEmin);
00357 fH_InvMass_PIpluPImin->Fill(fBhaInvMass_PIpluPImin);
00358
00359
00360
00361
00362 if(fBhaAngle != in_val_floats) fH_BhaTracksAngle->Fill(fBhaAngle);
00363 fH_BhaTotalMomentum->Fill(fBhaTotalMomentum);
00364
00365
00366 Bool_t can_fill_tof = kTRUE;
00367 for(Int_t ch_s = (Int_t)FPh_BhaElec_id; ch_s <= (Int_t)FPh_BhaPosit_id; ch_s++ ){
00368 if(
00369 fBhaTofiTime[ch_s] == in_val_floats ||
00370 fBhaTofoTime[ch_s] == in_val_floats ||
00371 fBhaTofiTime[ch_s] == 0 ||
00372 fBhaTofoTime[ch_s] == 0 ||
00373 fBhaTofiTime[ch_s] == fBhaTofoTime[ch_s]
00374 ){
00375 can_fill_tof = kFALSE;
00376 break;
00377 }
00378 }
00379
00380
00381 if(can_fill_tof){
00382 Float_t TOF_min = fBhaTofoTime[FPh_BhaElec_id] - fBhaTofiTime[FPh_BhaElec_id];
00383 Float_t TOF_plu = fBhaTofoTime[FPh_BhaPosit_id] - fBhaTofiTime[FPh_BhaPosit_id];
00384 fH_BhaParticleTOF_2D->Fill(TOF_plu,TOF_min);
00385
00386 fH_BhaTofi_TimeDiff->Fill(fBhaTofiTime[FPh_BhaPosit_id] - fBhaTofiTime[FPh_BhaElec_id]);
00387 fH_BhaTofi_Time_2D->Fill(fBhaTofiTime[FPh_BhaPosit_id] , fBhaTofiTime[FPh_BhaElec_id]);
00388
00389 fH_BhaTofo_TimeDiff->Fill(fBhaTofoTime[FPh_BhaPosit_id] - fBhaTofoTime[FPh_BhaElec_id]);
00390
00391 if(0){
00392 cout << " --- --- --- " << endl;
00393 cout << "TOFI time: " << fBhaTofiTime[FPh_BhaPosit_id] << " ; " << fBhaTofiTime[FPh_BhaElec_id] << endl;
00394 cout << "TOFO time: " << fBhaTofoTime[FPh_BhaPosit_id] << " ; " << fBhaTofoTime[FPh_BhaElec_id] << endl;
00395 cout << "TOF_min: " << TOF_min << endl;
00396 cout << "TOF_plu: " << TOF_plu << endl;
00397 cout << " --- --- --- " << endl << endl;
00398 }
00399
00400 }
00401
00402 }
00403
00404 }
00405
00406
00407 void TFndPreanHistos::EvalBhabhaHistos(){
00408
00409 if(fDebugLev > 0) Info("EvalBhabhaHistos","Evaluating histograms");
00410 }
00411
00413
00414
00415 void TFndPreanHistos::InitHypeHistos(){
00416
00417
00418 if(fHypeHistosInitialized == kTRUE) return;
00419
00420 fH_Hyp_PattRecErr = new TH1F("HypPattRecErr","Kaon P.R. error-code",13,-0.5,12.5);
00421
00422 TString hname;
00423 TString htitle;
00424
00425 Float_t pos_resol[2] = { 0.1, 0.1 };
00426 Float_t pos_half[2] = { 25 , 25 };
00427 Int_t pos_bins[2];
00428 for(Int_t i=0;i<2;i++){
00429 pos_bins[i] = (Int_t)( (pos_half[i] * 2) / pos_resol[i] );
00430 }
00431
00432
00433
00434
00435 fH_Hyp_Kmin_StopCode = new TH1F("Kmin_StopCode","K- stop code",9,-0.5,8.5);
00436 fH_Hyp_Kplu_StopCode = new TH1F("Kplu_StopCode","K+ stop code",9,-0.5,8.5);
00437
00438
00439 hname = "";
00440 htitle = "";
00441 for(Int_t i=(Int_t)E_Kaon_Stop_Target; i<=(Int_t)E_Kaon_Stop_Other; i++){
00442 TString sfx;
00443 switch(i){
00444 case (E_Kaon_StopCode)E_Kaon_Stop_Target:
00445 sfx = "tgt";
00446 break;
00447 case (E_Kaon_StopCode)E_Kaon_Stop_Isim:
00448 sfx = "isi";
00449 break;
00450 case (E_Kaon_StopCode)E_Kaon_Stop_Glass:
00451 sfx = "glass";
00452 break;
00453 case (E_Kaon_StopCode)E_Kaon_Stop_Upilex:
00454 sfx = "upilex";
00455 break;
00456 case (E_Kaon_StopCode)E_Kaon_Stop_Osim:
00457 sfx = "osim";
00458 break;
00459 case (E_Kaon_StopCode)E_Kaon_Stop_Other:
00460 sfx = "other";
00461 break;
00462 default:
00463 gROOT->Error("InitHypeHistos","kaon stop code not accepted");
00464 TerminateFroot();
00465 }
00466 hname.Form("KminStopPos_XY_%s",sfx.Data());
00467 htitle.Form("Kmin Stop XY (%s) [cm]",sfx.Data());
00468 fH_HypKmin_stop_XY[i] = new TH2F(hname,htitle,
00469 pos_bins[0],-pos_half[0],pos_half[0],
00470 pos_bins[1],-pos_half[1],pos_half[1]
00471 );
00472
00473 hname.Replace(1,3,"plu");
00474 htitle.Replace(1,3,"plu");
00475 fH_HypKplu_stop_XY[i] = new TH2F(hname,htitle,
00476 pos_bins[0],-pos_half[0],pos_half[0],
00477 pos_bins[1],-pos_half[1],pos_half[1]
00478 );
00479
00480 fH_HypKmin_stop_XY[i]->SetMarkerColor(fKstopMarkCol[i]);
00481 fH_HypKplu_stop_XY[i]->SetMarkerColor(fKstopMarkCol[i]);
00482 }
00483
00484 hname = "";
00485 htitle = "";
00486
00487 fH_Hyp_Kmin_StopTgt = new TH1F("KminStopTgt","K- Stop target",10,-0.5,9.5);
00488 fH_Hyp_Kplu_StopTgt = new TH1F("KpluStopTgt","K+ Stop target",10,-0.5,9.5);
00489 fH_Hyp_K_StopTgt_2D = new TH2F("KaonStopTgt_2D","Stop target (K- vs K+)",10,-0.5,9.5,10,-0.5,9.5);
00490
00491 fH_Hyp_Kmin_StopVol = new TH1F("KminStopVol","K- Stop volume",10,-0.5,9.5);
00492 fH_Hyp_Kplu_StopVol = new TH1F("KpluStopVol","K+ Stop volume",10,-0.5,9.5);
00493 fH_Hyp_K_StopVol_2D = new TH2F("KaonStopVol_sD","Stop volume (K- vs K+)",7,-0.5,8.5,10,-0.5,8.5);
00494
00495
00496 Float_t pos_phi_resol[3] = { 0.005, 0.05, 0.30 };
00497 Float_t pos_phi_half[3] = { 0.5 , 0.7, 4. };
00498 Int_t pos_phi_bins[3];
00499 for(Int_t i=0;i<3;i++){
00500 pos_phi_bins[i] = (Int_t)( (pos_phi_half[i] * 2) / pos_phi_resol[i] );
00501 }
00502
00503
00504 fH_Hyp_PhiDecPos_XYZ = new TH3F("Phi_DecayPos_XYZ","PHI decay position 3D (cm)",
00505 pos_phi_bins[0],-pos_phi_half[0],pos_phi_half[0],
00506 pos_phi_bins[1],-pos_phi_half[1],pos_phi_half[1],
00507 pos_phi_bins[2],-pos_phi_half[2],pos_phi_half[2]);
00508
00509 fH_Hyp_PhiDecPos_XY = new TH2F("Phi_DecayPos_XY","PHI decay position Y vs X",
00510 pos_phi_bins[0],-pos_phi_half[0],pos_phi_half[0],
00511 pos_phi_bins[1],-pos_phi_half[1],pos_phi_half[1]);
00512 fH_Hyp_PhiDecPos_XZ = new TH2F("Phi_DecayPos_XZ","PHI decay position Z vs X",
00513 pos_phi_bins[0],-pos_phi_half[0],pos_phi_half[0],
00514 pos_phi_bins[2],-pos_phi_half[2],pos_phi_half[2]);
00515
00516 fH_PhiDecPos_X = new TH1F("Phi_DecayPos_X","PHI decay X position (cm)",
00517 pos_phi_bins[0],-pos_phi_half[0],pos_phi_half[0]);
00518
00519 fH_PhiDecPos_Y = new TH1F("Phi_DecayPos_Y","PHI decay Y position [when y!=0] (cm)",
00520 pos_phi_bins[1],-pos_phi_half[1],pos_phi_half[1]);
00521
00522 fH_PhiDecPos_Z = new TH1F("Phi_DecayPos_Z","PHI decay Z position (cm)",
00523 pos_phi_bins[2],-pos_phi_half[2],pos_phi_half[2]);
00524
00525 for(Int_t id = (Int_t)E_Kaon_Stop_Target; id <= (Int_t)E_Kaon_Stop_Other; id++ ){
00526 if(id != (Int_t)E_Kaon_Stop_Other ){
00527 fH_HypKmin_stop_XY[id]->SetAxisRange(-15,15,"X");
00528 fH_HypKmin_stop_XY[id]->SetAxisRange(-15,15,"Y");
00529 fH_HypKplu_stop_XY[id]->SetAxisRange(-15,15,"X");
00530 fH_HypKplu_stop_XY[id]->SetAxisRange(-15,15,"Y");
00531 }
00532 }
00533
00534
00535 Int_t h_tgt_bins = 250;
00536 Float_t h_tgt_limits[2] = { 0.13 , 0.28 };
00537
00538 Int_t h_pth_bins = 250;
00539 Float_t h_pth_limits[2] = { 0.13 , 0.28 };
00540
00541 TString h_tgt_nam = "";
00542 TString h_tgt_tit = "";
00543 TString h_pth_nam = "";
00544 TString h_pth_tit = "";
00545
00546
00547 fH_HypTrk_KpluPosAll = new TH1F("KpluPosTrkMom_All","K+ Pos. Trk [All tgts] mom. (GeV/c)",
00548 h_tgt_bins,h_tgt_limits[0],h_tgt_limits[1]);
00549
00550 fH_HypTrk_KpluPosPthAll = new TH1F("KpluPosTrkMom_PthAll","K+ Pos. Trk [All tgts+pth] mom. (GeV/c)",
00551 h_tgt_bins,h_tgt_limits[0],h_tgt_limits[1]);
00552
00553
00554 for(Int_t i=0;i<8;i++) {
00555 h_tgt_nam.Form("KpluPosTrkMom_Tgt_%i",i+1);
00556 h_tgt_tit.Form("K+ Pos. Trk [Tgt %i] mom. (GeV/c)",i+1);
00557 fH_HypTrk_KpluPosTgt[i] = new TH1F(h_tgt_nam,h_tgt_tit,h_tgt_bins,h_tgt_limits[0],h_tgt_limits[1]);
00558
00559 h_pth_nam.Form("KpluPosTrkMom_Pth_%s",MuPathNameTitle(i+1,kTRUE).Data());
00560 h_pth_tit.Form("K+ Pos. Trk [Pth %s] mom. (GeV/c)",MuPathNameTitle(i+1,kFALSE).Data());
00561 fH_HypTrk_KpluPosPth[i] = new TH1F(h_pth_nam,h_pth_tit,h_pth_bins,h_pth_limits[0],h_pth_limits[1]);
00562 }
00563
00564
00565 fH_Hyp_KTofi_TimeDiff = new TH1F("KTofiTimeDiff","time_diff K-k+ (tofi)",200,-2.5,2.5);
00566 fH_Hyp_KTofi_Time_2D = new TH2F("KTofiTime2D","K-vsK+ time (tofi)",200,-157,-154,200,-157,-154);
00567 fH_Hyp_MuTof = new TH1F("MuPluTof","Mu+ TOF",510,-10,50);
00568 fH_Hyp_MuTofCorr = new TH1F("MuPluTofCor","Mu+ TOF corr.(- L/bc)",510,-10,50);
00569
00570
00571
00572
00573 fH_Hyp_PhiDecPos_XY->SetAxisRange(-0.5,0.5,"X");
00574 fH_Hyp_PhiDecPos_XY->SetAxisRange(-0.7,0.7,"Y");
00575
00576 fH_PhiDecPos_X->SetAxisRange(-0.5,0.5,"X");
00577 fH_PhiDecPos_Y->SetAxisRange(-0.7,0.7,"X");
00578 fH_PhiDecPos_Z->SetAxisRange(-3.7,3.7,"X");
00579
00580 fH_Hyp_PattRecErr->SetStats(kFALSE);
00581 for(Int_t id = (Int_t)E_Kaon_Stop_Target; id <= (Int_t)E_Kaon_Stop_Other; id++ ){
00582 fH_HypKmin_stop_XY[id]->SetStats(kFALSE);
00583 fH_HypKplu_stop_XY[id]->SetStats(kFALSE);
00584 }
00585 fH_Hyp_Kmin_StopCode->SetStats(kFALSE);
00586 fH_Hyp_Kplu_StopCode->SetStats(kFALSE);
00587 fH_Hyp_Kmin_StopTgt->SetStats(kFALSE);
00588 fH_Hyp_Kplu_StopTgt->SetStats(kFALSE);
00589 fH_Hyp_K_StopTgt_2D->SetStats(kFALSE);
00590 fH_Hyp_Kmin_StopVol->SetStats(kFALSE);
00591 fH_Hyp_Kplu_StopVol->SetStats(kFALSE);
00592 fH_Hyp_K_StopVol_2D->SetStats(kFALSE);
00593 fH_Hyp_PhiDecPos_XYZ->SetStats(kFALSE);
00594 fH_Hyp_PhiDecPos_XY->SetStats(kFALSE);
00595 fH_Hyp_PhiDecPos_XZ->SetStats(kFALSE);
00596 fH_Hyp_K_StopTgt_2D->SetStats(kFALSE);
00597
00598
00599 fHypeHistosInitialized = kTRUE;
00600 ResetHypeHistos();
00601 }
00602
00603
00604 void TFndPreanHistos::ResetHypeHistos(){
00605
00606
00607 if(fHypeHistosInitialized == kFALSE) return;
00608
00609 fH_Hyp_PattRecErr->Reset();
00610 fH_Hyp_Kmin_StopCode->Reset();
00611 fH_Hyp_Kplu_StopCode->Reset();
00612 for(Int_t i=(Int_t)E_Kaon_Stop_Target; i<=(Int_t)E_Kaon_Stop_Other; i++){
00613 fH_HypKmin_stop_XY[i]->Reset();
00614 fH_HypKplu_stop_XY[i]->Reset();
00615 }
00616
00617 fH_Hyp_Kmin_StopTgt->Reset();
00618 fH_Hyp_Kplu_StopTgt->Reset();
00619 fH_Hyp_K_StopTgt_2D->Reset();;
00620
00621 fH_Hyp_Kmin_StopVol->Reset();
00622 fH_Hyp_Kplu_StopVol->Reset();
00623 fH_Hyp_K_StopVol_2D->Reset();
00624
00625 fH_Hyp_PhiDecPos_XYZ->Reset();
00626 fH_Hyp_PhiDecPos_XY->Reset();
00627 fH_Hyp_PhiDecPos_XZ->Reset();
00628 fH_PhiDecPos_X->Reset();
00629 fH_PhiDecPos_Y->Reset();
00630 fH_PhiDecPos_Z->Reset();
00631
00632 for(Int_t i=0;i<8;i++){
00633 fH_HypTrk_KpluPosAll->Reset();
00634 fH_HypTrk_KpluPosPthAll->Reset();
00635 fH_HypTrk_KpluPosTgt[i]->Reset();
00636 fH_HypTrk_KpluPosPth[i]->Reset();
00637 }
00638
00639 fH_Hyp_KTofi_TimeDiff->Reset();
00640 fH_Hyp_KTofi_Time_2D->Reset();
00641 fH_Hyp_MuTof->Reset();
00642 fH_Hyp_MuTofCorr->Reset();
00643
00644
00645
00646
00647 for(Int_t i=0;i<8;i++){
00648 fEval_NumOfStoppedKplu[i] = 0;
00649 fEval_NumOf_Mu_plu[i] = 0;
00650 fEval_NumOf_Mu_plu_Pth[i] = 0;
00651 fEval_RecEff[i] = 0;
00652 fEval_RecEff_Pth[i] = 0;
00653
00654 fEval_NumOfStoppedKmin[i] = 0;
00655 }
00656
00657 fEval_NumOfStoppedKplu_All = 0;
00658 fEval_NumOf_Mu_plu_All = 0;
00659 fEval_NumOf_Mu_plu_Pth_All = 0;
00660 fEval_RecEff_All = 0;
00661 fEval_RecEff_Pth_All = 0;
00662
00663 fEval_NumOfStoppedKmin_All = 0;
00664 }
00665
00666
00667 void TFndPreanHistos::WriteHypeHistos(){
00668
00669
00670 if(fHypeHistosInitialized == kFALSE) return;
00671
00672 fH_Hyp_PattRecErr->Write();
00673 fH_Hyp_Kmin_StopCode->Write();
00674 fH_Hyp_Kplu_StopCode->Write();
00675 for(Int_t i=(Int_t)E_Kaon_Stop_Target; i<=(Int_t)E_Kaon_Stop_Other; i++){
00676 fH_HypKmin_stop_XY[i]->Write();
00677 fH_HypKplu_stop_XY[i]->Write();
00678 }
00679
00680 fH_Hyp_Kmin_StopTgt->Write();
00681 fH_Hyp_Kplu_StopTgt->Write();
00682 fH_Hyp_K_StopTgt_2D->Write();;
00683
00684 fH_Hyp_Kmin_StopVol->Write();
00685 fH_Hyp_Kplu_StopVol->Write();
00686 fH_Hyp_K_StopVol_2D->Write();
00687
00688 fH_Hyp_PhiDecPos_XYZ->Write();
00689 fH_Hyp_PhiDecPos_XY->Write();
00690 fH_Hyp_PhiDecPos_XZ->Write();
00691 fH_PhiDecPos_X->Write();
00692 fH_PhiDecPos_Y->Write();
00693 fH_PhiDecPos_Z->Write();
00694
00695 fH_HypTrk_KpluPosAll->Write();
00696 fH_HypTrk_KpluPosPthAll->Write();
00697 for(Int_t i=0;i<8;i++){
00698 fH_HypTrk_KpluPosTgt[i]->Write();
00699 fH_HypTrk_KpluPosPth[i]->Write();
00700 }
00701
00702 fH_Hyp_KTofi_TimeDiff->Write();
00703 fH_Hyp_KTofi_Time_2D->Write();
00704 fH_Hyp_MuTof->Write();
00705 fH_Hyp_MuTofCorr->Write();
00706
00707 }
00708
00709
00710 void TFndPreanHistos::LoadHypeHistos(TFile *fin){
00711
00712
00713 if(fHypeHistosInitialized == kFALSE) return;
00714
00715 ResetHypeHistos();
00716
00717
00718 AddSingleHistoFromFile( fH_Hyp_PattRecErr , fin );
00719 AddSingleHistoFromFile( fH_Hyp_Kmin_StopCode , fin );
00720 AddSingleHistoFromFile( fH_Hyp_Kplu_StopCode , fin );
00721 for(Int_t i=(Int_t)E_Kaon_Stop_Target; i<=(Int_t)E_Kaon_Stop_Other; i++){
00722 AddSingleHistoFromFile( fH_HypKmin_stop_XY[i] , fin );
00723 AddSingleHistoFromFile( fH_HypKplu_stop_XY[i] , fin );
00724 }
00725
00726 AddSingleHistoFromFile( fH_Hyp_Kmin_StopTgt , fin );
00727 AddSingleHistoFromFile( fH_Hyp_Kplu_StopTgt , fin );
00728 AddSingleHistoFromFile( fH_Hyp_K_StopTgt_2D , fin );;
00729
00730 AddSingleHistoFromFile( fH_Hyp_Kmin_StopVol , fin );
00731 AddSingleHistoFromFile( fH_Hyp_Kplu_StopVol , fin );
00732 AddSingleHistoFromFile( fH_Hyp_K_StopVol_2D , fin );
00733
00734 AddSingleHistoFromFile( fH_Hyp_PhiDecPos_XYZ , fin );
00735 AddSingleHistoFromFile( fH_Hyp_PhiDecPos_XY , fin );
00736 AddSingleHistoFromFile( fH_Hyp_PhiDecPos_XZ , fin );
00737 AddSingleHistoFromFile( fH_PhiDecPos_X , fin );
00738 AddSingleHistoFromFile( fH_PhiDecPos_Y , fin );
00739 AddSingleHistoFromFile( fH_PhiDecPos_Z , fin );
00740
00741 AddSingleHistoFromFile( fH_HypTrk_KpluPosAll , fin );
00742 AddSingleHistoFromFile( fH_HypTrk_KpluPosPthAll , fin );
00743 for(Int_t i=0;i<8;i++){
00744 AddSingleHistoFromFile( fH_HypTrk_KpluPosTgt[i] , fin );
00745 AddSingleHistoFromFile( fH_HypTrk_KpluPosPth[i] , fin );
00746 }
00747
00748 AddSingleHistoFromFile( fH_Hyp_KTofi_TimeDiff , fin );
00749 AddSingleHistoFromFile( fH_Hyp_KTofi_Time_2D , fin );
00750 AddSingleHistoFromFile( fH_Hyp_MuTof , fin );
00751 AddSingleHistoFromFile( fH_Hyp_MuTofCorr , fin );
00752
00753
00754 }
00755
00756
00757
00758 void TFndPreanHistos::FillHypeHistos(){
00759
00760
00761
00762
00763
00764
00765
00766
00767
00768
00769
00770
00771
00772
00773 if(!fHypeTree){
00774 cout << "FillHypeHistos exiting (fHypeTree not available)" << endl;
00775 return;
00776 }
00777
00778 Float_t in_val_floats = -999.;
00779
00780 Int_t n_entries = fHypeTree->GetEntries();
00781 if(fDebugLev>=1) Printf("Number of entries in Hype tree: %d",n_entries);
00782 for(Int_t ev=0;ev<n_entries;ev++){
00783 fHypeTree->GetEntry(ev);
00784
00785 Float_t kmin_time = in_val_floats;
00786 Float_t kplu_time = in_val_floats;
00787 Float_t muplu_time = in_val_floats;
00788 Float_t muplu_tcorr = in_val_floats;
00789
00790 fH_Hyp_PattRecErr->Fill(fHyp_PattRec_Err);
00791
00792
00793 fH_Hyp_Kmin_StopCode->Fill(fHypStopID[FPh_HypKmin_id]);
00794 fH_Hyp_Kplu_StopCode->Fill(fHypStopID[FPh_HypKplu_id]);
00795
00796
00797 if( fHypStopID[FPh_HypKmin_id] == (E_Kaon_StopCode)E_Kaon_Stop_Target &&
00798 fHypStopID[FPh_HypKplu_id] == (E_Kaon_StopCode)E_Kaon_Stop_Target ){
00799 fH_Hyp_K_StopTgt_2D->Fill(fHypStopTgtNum[FPh_HypKplu_id],fHypStopTgtNum[FPh_HypKmin_id]);
00800 }
00801 else{
00802 fH_Hyp_K_StopVol_2D->Fill(fHypStopVolNum[FPh_HypKplu_id],fHypStopVolNum[FPh_HypKmin_id]);
00803 }
00804
00805 if( fHypStopID[FPh_HypKmin_id] == (E_Kaon_StopCode)E_Kaon_Stop_Target ){
00806 fCount_KminPerRun++;
00807 fH_Hyp_Kmin_StopTgt->Fill(fHypStopTgtNum[FPh_HypKmin_id]);
00808 }
00809 else{
00810 fH_Hyp_Kmin_StopVol->Fill(fHypStopVolNum[FPh_HypKmin_id]);
00811 }
00812
00813 if( fHypStopID[FPh_HypKplu_id] == (E_Kaon_StopCode)E_Kaon_Stop_Target ){
00814 fCount_KpluPerRun++;
00815 fH_Hyp_Kplu_StopTgt->Fill(fHypStopTgtNum[FPh_HypKplu_id]);
00816 }
00817 else{
00818 fH_Hyp_Kplu_StopVol->Fill(fHypStopVolNum[FPh_HypKplu_id]);
00819 }
00820
00821
00822
00823 fH_HypKmin_stop_XY[ fHypStopID[FPh_HypKmin_id] ] -> Fill(
00824 fHyp_K_StopPoint_X[FPh_HypKmin_id],
00825 fHyp_K_StopPoint_Y[FPh_HypKmin_id]);
00826
00827 fH_HypKplu_stop_XY[ fHypStopID[FPh_HypKplu_id] ] -> Fill(
00828 fHyp_K_StopPoint_X[FPh_HypKplu_id],
00829 fHyp_K_StopPoint_Y[FPh_HypKplu_id]);
00830
00831 Bool_t can_fill_pos = kTRUE;
00832 if (fHyp_PattRec_Err != 0) can_fill_pos = kFALSE;
00833 if(can_fill_pos){
00834 for(Int_t ip=0;ip<3;ip++){
00835 if(fHyp_PhiDecayPos[ip] == in_val_floats) can_fill_pos = kFALSE;
00836 break;
00837
00838
00839 }
00840 }
00841
00842
00843
00844 if(can_fill_pos){
00845 fH_Hyp_PhiDecPos_XYZ->Fill(fHyp_PhiDecayPos[0],fHyp_PhiDecayPos[1],fHyp_PhiDecayPos[2]);
00846 fH_Hyp_PhiDecPos_XY->Fill(fHyp_PhiDecayPos[0],fHyp_PhiDecayPos[1]);
00847 fH_Hyp_PhiDecPos_XZ->Fill(fHyp_PhiDecayPos[0],fHyp_PhiDecayPos[2]);
00848
00849
00850 if(fHyp_PhiDecayPos[0] !=0 && fHyp_PhiDecayPos[2] !=0 && fHyp_PhiDecayPos[1] == 0){
00851
00852
00853
00854
00855
00856
00857 fH_PhiDecPos_X->Fill(fHyp_PhiDecayPos[0]);
00858 fH_PhiDecPos_Z->Fill(fHyp_PhiDecayPos[2]);
00859 }
00860 else if(fHyp_PhiDecayPos[1] !=0){
00861
00862 fH_PhiDecPos_Y->Fill(fHyp_PhiDecayPos[1]);
00863 }
00864 }
00865
00867 Int_t hard_coded_debug = 0;
00868 if(hard_coded_debug != 0){
00869 Printf(" ************* K+ tracks (ev: %i) *************",fHypEvNum);
00870 for(Int_t tr_i=0; tr_i < fTracks_Kplu->GetEntries(); tr_i++){
00871 fCurTrack = (TFndTrack *)fTracks_Kplu->At(tr_i);
00872 fCurTrack->PrintData(4);
00873 }
00874
00875 Printf(" ************* K- tracks (ev: %i) *************",fHypEvNum);
00876 for(Int_t tr_i=0; tr_i < fTracks_Kmin->GetEntries(); tr_i++){
00877 fCurTrack = (TFndTrack *)fTracks_Kmin->At(tr_i);
00878 fCurTrack->PrintData(4);
00879 }
00880 }
00882
00883
00884 if( fHypStopID[FPh_HypKplu_id] == (E_Kaon_StopCode)E_Kaon_Stop_Target ) {
00885 if(fHypStopTgtNum[FPh_HypKplu_id] < 1 || fHypStopTgtNum[FPh_HypKplu_id] > 8) continue;
00886
00887
00888 for(Int_t tr_i=0; tr_i < fTracks_Kmin->GetEntries(); tr_i++){
00889 fCurTrack = (TFndTrack *)fTracks_Kmin->At(tr_i);
00890 if(tr_i==0) kmin_time = fCurTrack->fStart[TFndTrack::E_Trk_T];
00891 }
00892
00893
00894
00895 for(Int_t tr_i=0; tr_i < fTracks_Kplu->GetEntries(); tr_i++){
00896 fCurTrack = (TFndTrack *)fTracks_Kplu->At(tr_i);
00897
00898
00899 if(fCurTrack->fCharge != (Float_t)TFndTrack::E_Trk_Pos) continue;
00900
00901 #ifdef FIDA_USE_SHORT
00902 if(fTrkStream > 1){
00903 if( fCut_TrkType != -1){
00904 if(fCurTrack->fType == 0 || fCurTrack->fType != fCut_TrkType) continue;
00905 }
00906 }
00907 else if(fCurTrack->fFwd == kFALSE) continue;
00908 #endif
00909
00910
00911 Float_t used_mom = fCurTrack->fPR_MomVert[TFndTrack::E_Hel_Mom];
00912 if(fCut_Fitted){
00913 if(fCurTrack->fFitErr != (Int_t)TFndTrack::E_Trk_Fit_Success) continue;
00914 if(fTrkStream > 2 && fCurTrack->fChargeAmbig == kTRUE ) continue;
00915 }
00916
00917 if(fCurTrack->fFitErr == (Int_t)TFndTrack::E_Trk_Fit_Success){
00918 if(fTrkStream > 1) used_mom = fCurTrack->fSpecMom;
00919 else used_mom = fCurTrack->fFit_MomVert[TFndTrack::E_Hel_Mom];
00920 }
00921
00922
00924
00925 kplu_time = fCurTrack->fStart[TFndTrack::E_Trk_T];
00926 muplu_time = fCurTrack->fStop[TFndTrack::E_Trk_T];
00927 Float_t mumass = (Float_t)FIN_PHYS::GetParticleMass(FIN_PHYS::FPh_PID_Muon_plu);
00928 Float_t tmpbeta = used_mom / (TMath::Sqrt( (used_mom * used_mom) + (mumass * mumass) ) );
00929 if(used_mom > 0.227 && used_mom < 0.243)
00930 muplu_tcorr = fCurTrack->fLength / (tmpbeta * 30);
00931 else
00932 muplu_tcorr = -1;
00933
00934
00935 fH_HypTrk_KpluPosTgt[ fHypStopTgtNum[FPh_HypKplu_id] -1 ]->Fill( used_mom );
00936
00937 UInt_t ori_pth = fCurTrack->fPath;
00938 UInt_t used_pth = (UInt_t) ( ori_pth & ( (UInt_t)0xFFF00 ) );
00939 UInt_t req_pth = GetSelMuPath(fHypStopTgtNum[FPh_HypKplu_id] );
00940
00941 if(used_pth == req_pth ){
00942 if(fDebugLev > 1){
00943 Printf("ori_pth : \"0x%x\"", ori_pth);
00944 Printf("used_pth : \"0x%x\"", used_pth);
00945 Printf("req_pth : \"0x%x\"\n", req_pth );
00946 }
00947 fH_HypTrk_KpluPosPth[ fHypStopTgtNum[FPh_HypKplu_id] -1 ]->Fill( used_mom );
00948 }
00949 }
00950 }
00951
00952 if(kmin_time != in_val_floats && kmin_time != 0 &&
00953 kplu_time != in_val_floats && kplu_time != 0 &&
00954 muplu_time != in_val_floats && muplu_time != 0 &&
00955 muplu_tcorr != in_val_floats && muplu_tcorr != 0)
00956 {
00957
00958 fH_Hyp_KTofi_TimeDiff->Fill(kmin_time - kplu_time);
00959 fH_Hyp_KTofi_Time_2D->Fill(kplu_time,kplu_time);
00960 if(muplu_tcorr != -1){
00961 fH_Hyp_MuTof->Fill(muplu_time - kplu_time);
00962 fH_Hyp_MuTofCorr->Fill(muplu_time - kplu_time - muplu_tcorr);
00963 }
00964 }
00965
00966 }
00967
00968 }
00969
00970
00971 void TFndPreanHistos::EvalHypeHistos(){
00972
00973 if(fDebugLev > 0) Info("EvalHypeHistos","Evaluating histograms");
00974
00975
00976
00977 fEval_NumOfStoppedKplu_All = 0;
00978 fEval_NumOf_Mu_plu_All = 0;
00979 fEval_NumOf_Mu_plu_Pth_All = 0;
00980
00981 fEval_NumOfStoppedKmin_All = 0;
00982
00983 for(Int_t i=0;i<8;i++){
00984 fEval_NumOfStoppedKplu[i] = (Int_t)( fH_Hyp_Kplu_StopTgt->GetBinContent(i+2) );
00985 fEval_NumOfStoppedKmin[i] = (Int_t)( fH_Hyp_Kmin_StopTgt->GetBinContent(i+2) );
00986 }
00987
00988
00989
00990 for(Int_t i=0;i<8;i++){
00991 fEval_NumOfStoppedKplu_All += fEval_NumOfStoppedKplu[i];
00992 fEval_NumOfStoppedKmin_All += fEval_NumOfStoppedKmin[i];
00993
00994 if(fEval_NumOfStoppedKplu[i]){
00995 fEval_RecEff[i] = ( (Float_t)fEval_NumOf_Mu_plu[i] ) / ( (Float_t)fEval_NumOfStoppedKplu[i] );
00996 fEval_RecEff_Pth[i] = ( (Float_t)fEval_NumOf_Mu_plu_Pth[i] ) / ( (Float_t)fEval_NumOfStoppedKplu[i] );
00997 }
00998
00999 }
01000
01001
01002 if(fEval_NumOfStoppedKplu_All){
01003 fEval_RecEff_All = ( (Float_t)fEval_NumOf_Mu_plu_All ) / ( (Float_t)fEval_NumOfStoppedKplu_All );
01004 fEval_RecEff_Pth_All = ( (Float_t)fEval_NumOf_Mu_plu_Pth_All ) / ( (Float_t)fEval_NumOfStoppedKplu_All );
01005 }
01006
01007
01008 }
01009
01011
01012
01013 void TFndPreanHistos::InitStatGraphs(){
01014
01015
01016 if(fStatGraphsInitialized == kTRUE) return;
01017
01018
01019 TString hnam = "";
01020 TString htit = "";
01021
01022 fGR_Stat_Evs = new TFndGraph("Evs_vs_run","# events vs run");
01023
01024 for(Int_t i=0; i< (Int_t)(E_Scal_Inhib_End); i++){
01025
01026 hnam.Form("BhaNum_vs_run_%s",GetScalInhibitStatusName(i,kTRUE).Data() );
01027 htit.Form("BhaNum_vs_run_%s",GetScalInhibitStatusName(i,kFALSE).Data() );
01028 fGR_Stat_BhaNum[i] = new TFndGraph(hnam,htit);
01029
01030 hnam.Form("HypNum_vs_run_%s",GetScalInhibitStatusName(i,kTRUE).Data() );
01031 htit.Form("HypNum_vs_run_%s",GetScalInhibitStatusName(i,kFALSE).Data() );
01032 fGR_Stat_HypNum[i] = new TFndGraph(hnam,htit);
01033
01034 hnam.Form("AvgLum_vs_run_%s",GetScalInhibitStatusName(i,kTRUE).Data() );
01035 htit.Form("AvgLum_vs_run_%s( 1e+32 cm-2 s-1)",GetScalInhibitStatusName(i,kFALSE).Data() );
01036 fGR_Stat_AvgLum[i] = new TFndGraph(hnam,htit);
01037
01038 hnam.Form("IntLum_vs_run_%s",GetScalInhibitStatusName(i,kTRUE).Data() );
01039 htit.Form("IntLum_vs_run_%s (nb-1)",GetScalInhibitStatusName(i,kFALSE).Data() );
01040 fGR_Stat_IntLum[i] = new TFndGraph(hnam,htit);
01041
01042 hnam.Form("IntLum_Tot_%s",GetScalInhibitStatusName(i,kTRUE).Data() );
01043 htit.Form("IntLum_Tot_%s (nb-1)",GetScalInhibitStatusName(i,kFALSE).Data() );
01044 fGR_Stat_IntLum_Tot[i] = new TFndGraph(hnam,htit);
01045 }
01046
01047 fGR_Stat_KminStop_Num = new TFndGraph("KminStop_num_vs_run","# stopped K-/inv.nb vs run");
01048 fGR_Stat_KpluStop_Num = new TFndGraph("KpluStop_num_vs_run","# stopped K+/inv.nb vs run");
01049
01050 fGR_Stat_MuPluAll_Num = new TFndGraph("MuPluAll_numnb_vs_run","# mu+/inv.nb (all) vs run");
01051 fGR_Stat_MuPluAll_Mom = new TFndGraph("MuPluAll_mom_vs_run","mu+ mom. [GeV/c] (all) vs run");
01052
01053 fGR_Stat_BhaRec_Num = new TFndGraph("BhaRec_Num_vs_run","# rec. Bhabha (e+e-) /inv.nb vs run");
01054 fGR_Stat_BhaRec_ECMee = new TFndGraph("BhaRec_ECMee_vs_run","Center of mass energy [GeV] (e+e-) vs run");
01055 fGR_Stat_BhaRec_Kshort_Num = new TFndGraph("BhaRec_KshortNum_vs_run","# rec. K short /inv.nb vs run");
01056 fGR_Stat_BhaRec_Kshort_InvMass = new TFndGraph("BhaRec_KshortInvMass_vs_run","K short mass vs run");
01057 fGR_Stat_BhaRec_Ratio = new TFndGraph("BhaRec_Ratio_vs_run","#K_short/#Bhabha ratio vs run");
01058
01059
01060
01061
01062
01063 fGR_Stat_BhaNum[E_Scal_Inhib_No]->SetLineWidth(2);
01064 fGR_Stat_BhaNum[E_Scal_Inhib_No]->SetLineStyle(1);
01065 fGR_Stat_BhaNum[E_Scal_Inhib_No]->SetLineColor(1);
01066 fGR_Stat_BhaNum[E_Scal_Inhib_No]->SetFillStyle(3002);
01067 fGR_Stat_BhaNum[E_Scal_Inhib_No]->SetFillColor(5);
01068 fGR_Stat_BhaNum[E_Scal_Inhib_No]->SetMarkerColor(5);
01069
01070 fGR_Stat_BhaNum[E_Scal_Inhib_Inj]->SetLineWidth(2);
01071 fGR_Stat_BhaNum[E_Scal_Inhib_Inj]->SetLineStyle(1);
01072 fGR_Stat_BhaNum[E_Scal_Inhib_Inj]->SetLineColor(1);
01073 fGR_Stat_BhaNum[E_Scal_Inhib_Inj]->SetFillStyle(3001);
01074 fGR_Stat_BhaNum[E_Scal_Inhib_Inj]->SetFillColor(3);
01075 fGR_Stat_BhaNum[E_Scal_Inhib_Inj]->SetMarkerColor(3);
01076
01077 fGR_Stat_BhaNum[E_Scal_Inhib_All]->SetLineWidth(1);
01078 fGR_Stat_BhaNum[E_Scal_Inhib_All]->SetLineStyle(1);
01079 fGR_Stat_BhaNum[E_Scal_Inhib_All]->SetLineColor(2);
01080 fGR_Stat_BhaNum[E_Scal_Inhib_All]->SetFillStyle(3001);
01081 fGR_Stat_BhaNum[E_Scal_Inhib_All]->SetFillColor(2);
01082 fGR_Stat_BhaNum[E_Scal_Inhib_All]->SetMarkerColor(2);
01083
01084 fGR_Stat_HypNum[E_Scal_Inhib_No]->SetLineWidth(2);
01085 fGR_Stat_HypNum[E_Scal_Inhib_No]->SetLineStyle(1);
01086 fGR_Stat_HypNum[E_Scal_Inhib_No]->SetLineColor(1);
01087 fGR_Stat_HypNum[E_Scal_Inhib_No]->SetFillStyle(3002);
01088 fGR_Stat_HypNum[E_Scal_Inhib_No]->SetFillColor(5);
01089 fGR_Stat_HypNum[E_Scal_Inhib_No]->SetMarkerColor(5);
01090
01091 fGR_Stat_HypNum[E_Scal_Inhib_Inj]->SetLineWidth(2);
01092 fGR_Stat_HypNum[E_Scal_Inhib_Inj]->SetLineStyle(1);
01093 fGR_Stat_HypNum[E_Scal_Inhib_Inj]->SetLineColor(1);
01094 fGR_Stat_HypNum[E_Scal_Inhib_Inj]->SetFillStyle(3001);
01095 fGR_Stat_HypNum[E_Scal_Inhib_Inj]->SetFillColor(3);
01096 fGR_Stat_HypNum[E_Scal_Inhib_Inj]->SetMarkerColor(3);
01097
01098 fGR_Stat_HypNum[E_Scal_Inhib_All]->SetLineWidth(1);
01099 fGR_Stat_HypNum[E_Scal_Inhib_All]->SetLineStyle(1);
01100 fGR_Stat_HypNum[E_Scal_Inhib_All]->SetLineColor(2);
01101 fGR_Stat_HypNum[E_Scal_Inhib_All]->SetFillStyle(3001);
01102 fGR_Stat_HypNum[E_Scal_Inhib_All]->SetFillColor(2);
01103 fGR_Stat_HypNum[E_Scal_Inhib_All]->SetMarkerColor(2);
01104
01105 fGR_Stat_AvgLum[E_Scal_Inhib_No]->SetLineWidth(2);
01106 fGR_Stat_AvgLum[E_Scal_Inhib_No]->SetLineStyle(1);
01107 fGR_Stat_AvgLum[E_Scal_Inhib_No]->SetLineColor(1);
01108 fGR_Stat_AvgLum[E_Scal_Inhib_No]->SetFillStyle(3002);
01109 fGR_Stat_AvgLum[E_Scal_Inhib_No]->SetFillColor(5);
01110 fGR_Stat_AvgLum[E_Scal_Inhib_No]->SetMarkerColor(5);
01111
01112 fGR_Stat_AvgLum[E_Scal_Inhib_Inj]->SetLineWidth(2);
01113 fGR_Stat_AvgLum[E_Scal_Inhib_Inj]->SetLineStyle(1);
01114 fGR_Stat_AvgLum[E_Scal_Inhib_Inj]->SetLineColor(1);
01115 fGR_Stat_AvgLum[E_Scal_Inhib_Inj]->SetFillStyle(3001);
01116 fGR_Stat_AvgLum[E_Scal_Inhib_Inj]->SetFillColor(3);
01117 fGR_Stat_AvgLum[E_Scal_Inhib_Inj]->SetMarkerColor(3);
01118
01119 fGR_Stat_AvgLum[E_Scal_Inhib_All]->SetLineWidth(1);
01120 fGR_Stat_AvgLum[E_Scal_Inhib_All]->SetLineStyle(1);
01121 fGR_Stat_AvgLum[E_Scal_Inhib_All]->SetLineColor(2);
01122 fGR_Stat_AvgLum[E_Scal_Inhib_All]->SetFillStyle(3001);
01123 fGR_Stat_AvgLum[E_Scal_Inhib_All]->SetFillColor(2);
01124 fGR_Stat_AvgLum[E_Scal_Inhib_All]->SetMarkerColor(2);
01125
01126 fGR_Stat_IntLum[E_Scal_Inhib_No]->SetLineWidth(2);
01127 fGR_Stat_IntLum[E_Scal_Inhib_No]->SetLineStyle(1);
01128 fGR_Stat_IntLum[E_Scal_Inhib_No]->SetLineColor(1);
01129 fGR_Stat_IntLum[E_Scal_Inhib_No]->SetFillStyle(3002);
01130 fGR_Stat_IntLum[E_Scal_Inhib_No]->SetFillColor(5);
01131 fGR_Stat_IntLum[E_Scal_Inhib_No]->SetMarkerColor(5);
01132
01133 fGR_Stat_IntLum[E_Scal_Inhib_Inj]->SetLineWidth(2);
01134 fGR_Stat_IntLum[E_Scal_Inhib_Inj]->SetLineStyle(1);
01135 fGR_Stat_IntLum[E_Scal_Inhib_Inj]->SetLineColor(1);
01136 fGR_Stat_IntLum[E_Scal_Inhib_Inj]->SetFillStyle(3001);
01137 fGR_Stat_IntLum[E_Scal_Inhib_Inj]->SetFillColor(3);
01138 fGR_Stat_IntLum[E_Scal_Inhib_Inj]->SetMarkerColor(3);
01139
01140 fGR_Stat_IntLum[E_Scal_Inhib_All]->SetLineWidth(1);
01141 fGR_Stat_IntLum[E_Scal_Inhib_All]->SetLineStyle(1);
01142 fGR_Stat_IntLum[E_Scal_Inhib_All]->SetLineColor(2);
01143 fGR_Stat_IntLum[E_Scal_Inhib_All]->SetFillStyle(3001);
01144 fGR_Stat_IntLum[E_Scal_Inhib_All]->SetFillColor(2);
01145 fGR_Stat_IntLum[E_Scal_Inhib_All]->SetMarkerColor(2);
01146
01147 fGR_Stat_IntLum_Tot[E_Scal_Inhib_No]->SetFillColor(5);
01148 fGR_Stat_IntLum_Tot[E_Scal_Inhib_No]->SetFillStyle(3001);
01149 fGR_Stat_IntLum_Tot[E_Scal_Inhib_No]->SetMarkerColor(5);
01150
01151 fGR_Stat_IntLum_Tot[E_Scal_Inhib_Inj]->SetFillColor(3);
01152 fGR_Stat_IntLum_Tot[E_Scal_Inhib_Inj]->SetFillStyle(3001);
01153 fGR_Stat_IntLum_Tot[E_Scal_Inhib_Inj]->SetMarkerColor(3);
01154
01155 fGR_Stat_IntLum_Tot[E_Scal_Inhib_All]->SetFillColor(2);
01156 fGR_Stat_IntLum_Tot[E_Scal_Inhib_All]->SetFillStyle(3001);
01157 fGR_Stat_IntLum_Tot[E_Scal_Inhib_All]->SetMarkerColor(2);
01158
01159 fGR_Stat_KminStop_Num->SetMarkerStyle(20);
01160 fGR_Stat_KminStop_Num->SetMarkerSize(0.7);
01161 fGR_Stat_KminStop_Num->SetLineWidth(1);
01162 fGR_Stat_KminStop_Num->SetLineStyle(1);
01163 fGR_Stat_KminStop_Num->SetLineColor(2);
01164 fGR_Stat_KminStop_Num->SetFillStyle(3001);
01165 fGR_Stat_KminStop_Num->SetFillColor(5);
01166 fGR_Stat_KminStop_Num->SetMarkerColor(4);
01167
01168 fGR_Stat_KpluStop_Num->SetMarkerStyle(20);
01169 fGR_Stat_KpluStop_Num->SetMarkerSize(0.7);
01170 fGR_Stat_KpluStop_Num->SetLineWidth(1);
01171 fGR_Stat_KpluStop_Num->SetLineStyle(1);
01172 fGR_Stat_KpluStop_Num->SetLineColor(2);
01173 fGR_Stat_KpluStop_Num->SetFillStyle(3001);
01174 fGR_Stat_KpluStop_Num->SetFillColor(5);
01175 fGR_Stat_KpluStop_Num->SetMarkerColor(4);
01176
01177 fGR_Stat_MuPluAll_Num->SetMarkerStyle(20);
01178 fGR_Stat_MuPluAll_Num->SetMarkerSize(0.7);
01179 fGR_Stat_MuPluAll_Num->SetLineWidth(1);
01180 fGR_Stat_MuPluAll_Num->SetLineStyle(1);
01181 fGR_Stat_MuPluAll_Num->SetLineColor(2);
01182 fGR_Stat_MuPluAll_Num->SetFillStyle(3001);
01183 fGR_Stat_MuPluAll_Num->SetFillColor(5);
01184 fGR_Stat_MuPluAll_Num->SetMarkerColor(4);
01185
01186 fGR_Stat_MuPluAll_Mom->SetMarkerStyle(20);
01187 fGR_Stat_MuPluAll_Mom->SetMarkerSize(0.7);
01188 fGR_Stat_MuPluAll_Mom->SetLineWidth(1);
01189 fGR_Stat_MuPluAll_Mom->SetLineStyle(1);
01190 fGR_Stat_MuPluAll_Mom->SetLineColor(2);
01191 fGR_Stat_MuPluAll_Mom->SetFillStyle(3001);
01192 fGR_Stat_MuPluAll_Mom->SetFillColor(5);
01193 fGR_Stat_MuPluAll_Mom->SetMarkerColor(3);
01194
01195 fGR_Stat_BhaRec_Num->SetMarkerStyle(20);
01196 fGR_Stat_BhaRec_Num->SetMarkerSize(0.7);
01197 fGR_Stat_BhaRec_Num->SetLineWidth(1);
01198 fGR_Stat_BhaRec_Num->SetLineStyle(1);
01199 fGR_Stat_BhaRec_Num->SetLineColor(2);
01200 fGR_Stat_BhaRec_Num->SetFillStyle(3001);
01201 fGR_Stat_BhaRec_Num->SetFillColor(5);
01202 fGR_Stat_BhaRec_Num->SetMarkerColor(3);
01203
01204 fGR_Stat_BhaRec_ECMee->SetMarkerStyle(20);
01205 fGR_Stat_BhaRec_ECMee->SetMarkerSize(0.7);
01206 fGR_Stat_BhaRec_ECMee->SetLineWidth(1);
01207 fGR_Stat_BhaRec_ECMee->SetLineStyle(1);
01208 fGR_Stat_BhaRec_ECMee->SetLineColor(2);
01209 fGR_Stat_BhaRec_ECMee->SetFillStyle(3001);
01210 fGR_Stat_BhaRec_ECMee->SetFillColor(5);
01211 fGR_Stat_BhaRec_ECMee->SetMarkerColor(3);
01212
01213 fGR_Stat_BhaRec_Kshort_Num->SetMarkerStyle(20);
01214 fGR_Stat_BhaRec_Kshort_Num->SetMarkerSize(0.7);
01215 fGR_Stat_BhaRec_Kshort_Num->SetLineWidth(1);
01216 fGR_Stat_BhaRec_Kshort_Num->SetLineStyle(1);
01217 fGR_Stat_BhaRec_Kshort_Num->SetLineColor(2);
01218 fGR_Stat_BhaRec_Kshort_Num->SetFillStyle(3001);
01219 fGR_Stat_BhaRec_Kshort_Num->SetFillColor(5);
01220 fGR_Stat_BhaRec_Kshort_Num->SetMarkerColor(3);
01221
01222 fGR_Stat_BhaRec_Kshort_InvMass->SetMarkerStyle(20);
01223 fGR_Stat_BhaRec_Kshort_InvMass->SetMarkerSize(0.7);
01224 fGR_Stat_BhaRec_Kshort_InvMass->SetLineWidth(1);
01225 fGR_Stat_BhaRec_Kshort_InvMass->SetLineStyle(1);
01226 fGR_Stat_BhaRec_Kshort_InvMass->SetLineColor(2);
01227 fGR_Stat_BhaRec_Kshort_InvMass->SetFillStyle(3001);
01228 fGR_Stat_BhaRec_Kshort_InvMass->SetFillColor(5);
01229 fGR_Stat_BhaRec_Kshort_InvMass->SetMarkerColor(3);
01230
01231 fGR_Stat_BhaRec_Ratio->SetMarkerStyle(20);
01232 fGR_Stat_BhaRec_Ratio->SetMarkerSize(0.7);
01233 fGR_Stat_BhaRec_Ratio->SetLineWidth(1);
01234 fGR_Stat_BhaRec_Ratio->SetLineStyle(1);
01235 fGR_Stat_BhaRec_Ratio->SetLineColor(2);
01236 fGR_Stat_BhaRec_Ratio->SetFillStyle(3001);
01237 fGR_Stat_BhaRec_Ratio->SetFillColor(5);
01238 fGR_Stat_BhaRec_Ratio->SetMarkerColor(3);
01239
01240
01241 fStatGraphsInitialized = kTRUE;
01242 }
01243
01244
01245 void TFndPreanHistos::DeleteStatGraphs(){
01246
01247 if(fStatGraphsInitialized == kFALSE) return;
01248
01249 fCount_EventTotal = 0;
01250 fCount_EventPerRun = 0;
01251 fCount_KminPerRun = 0;
01252 fCount_KpluPerRun = 0;
01253
01254 delete fGR_Stat_Evs; fGR_Stat_Evs = 0;
01255
01256 for(Int_t i=0; i< (Int_t)(E_Scal_Inhib_End); i++){
01257 fCount_Stat_Time[i] = 0;
01258 fCount_Stat_BhaNum[i] = 0;
01259 fCount_Stat_HypNum[i] = 0;
01260
01261 delete fGR_Stat_BhaNum[i];
01262 fGR_Stat_BhaNum[i] = 0;
01263
01264 delete fGR_Stat_HypNum[i];
01265 fGR_Stat_HypNum[i] = 0;
01266
01267 delete fGR_Stat_AvgLum[i];
01268 fGR_Stat_AvgLum[i] = 0;
01269
01270 delete fGR_Stat_IntLum[i];
01271 fGR_Stat_IntLum[i] = 0;
01272
01273 delete fGR_Stat_IntLum_Tot[i];
01274 fGR_Stat_IntLum_Tot[i] = 0;
01275 }
01276
01277 delete fGR_Stat_KminStop_Num;
01278 fGR_Stat_KminStop_Num = 0;
01279
01280 delete fGR_Stat_KpluStop_Num;
01281 fGR_Stat_KpluStop_Num = 0;
01282
01283 delete fGR_Stat_MuPluAll_Num;
01284 fGR_Stat_MuPluAll_Num = 0;
01285
01286 delete fGR_Stat_MuPluAll_Mom;
01287 fGR_Stat_MuPluAll_Mom = 0;
01288
01289 delete fGR_Stat_BhaRec_Num;
01290 fGR_Stat_BhaRec_Num = 0;
01291
01292 delete fGR_Stat_BhaRec_ECMee;
01293 fGR_Stat_BhaRec_ECMee = 0;
01294
01295 delete fGR_Stat_BhaRec_Kshort_Num;
01296 fGR_Stat_BhaRec_Kshort_Num = 0;
01297
01298 delete fGR_Stat_BhaRec_Kshort_InvMass;
01299 fGR_Stat_BhaRec_Kshort_InvMass = 0;
01300
01301 delete fGR_Stat_BhaRec_Ratio;
01302 fGR_Stat_BhaRec_Ratio = 0;
01303
01304
01305
01306 delete fHTmp_MuPluAll;
01307 fHTmp_MuPluAll = 0;
01308
01309 delete fHTmp_BhaInvMass;
01310 fHTmp_BhaInvMass = 0;
01311
01312 delete fHTmp_PionsInvMass;
01313 fHTmp_PionsInvMass = 0;
01314
01315
01316 fStatGraphsInitialized = kFALSE;
01317 }
01318
01319
01320 void TFndPreanHistos::ResetStatGraphs(const Bool_t &recreate){
01321
01322
01323
01324
01325 if(recreate){
01326 DeleteStatGraphs();
01327 InitStatGraphs();
01328 return;
01329 }
01330
01331 if( fGR_Stat_Evs ) fGR_Stat_Evs->Reset();
01332
01333 for(Int_t i=0; i< (Int_t)(E_Scal_Inhib_End); i++){
01334 fCount_Stat_Time[i] = 0;
01335 fCount_Stat_BhaNum[i] = 0;
01336 fCount_Stat_HypNum[i] = 0;
01337
01338 if( fGR_Stat_BhaNum[i] ) fGR_Stat_BhaNum[i]->Reset();
01339 if( fGR_Stat_HypNum[i] ) fGR_Stat_HypNum[i]->Reset();
01340 if( fGR_Stat_AvgLum[i] ) fGR_Stat_AvgLum[i]->Reset();
01341 if( fGR_Stat_IntLum[i] ) fGR_Stat_IntLum[i]->Reset();
01342 if( fGR_Stat_IntLum_Tot[i] ) fGR_Stat_IntLum_Tot[i]->Reset();
01343 }
01344
01345 if( fGR_Stat_KminStop_Num ) fGR_Stat_KminStop_Num->Reset();
01346 if( fGR_Stat_KpluStop_Num ) fGR_Stat_KpluStop_Num->Reset();
01347
01348 if( fGR_Stat_MuPluAll_Num ) fGR_Stat_MuPluAll_Num->Reset();
01349 if( fGR_Stat_MuPluAll_Mom ) fGR_Stat_MuPluAll_Mom->Reset();
01350
01351 if( fGR_Stat_BhaRec_Num ) fGR_Stat_BhaRec_Num->Reset();
01352 if( fGR_Stat_BhaRec_ECMee ) fGR_Stat_BhaRec_ECMee->Reset();
01353 if( fGR_Stat_BhaRec_Kshort_Num ) fGR_Stat_BhaRec_Kshort_Num->Reset();
01354 if( fGR_Stat_BhaRec_Kshort_InvMass ) fGR_Stat_BhaRec_Kshort_InvMass->Reset();
01355 if( fGR_Stat_BhaRec_Ratio ) fGR_Stat_BhaRec_Ratio->Reset();
01356
01357 if( fHTmp_MuPluAll ){
01358 delete fHTmp_MuPluAll;
01359 fHTmp_MuPluAll = 0;
01360 }
01361 if( fHTmp_BhaInvMass ){
01362 delete fHTmp_BhaInvMass;
01363 fHTmp_BhaInvMass = 0;
01364 }
01365 if( fHTmp_PionsInvMass ){
01366 delete fHTmp_PionsInvMass;
01367 fHTmp_PionsInvMass = 0;
01368 }
01369
01370 return;
01371 }
01372
01373
01374 void TFndPreanHistos::WriteStatGraphs(){
01375
01376 for(Int_t id=0; id< (Int_t)(E_Scal_Inhib_End); id++){
01377 fGR_Stat_BhaNum[id]->Write();
01378 fGR_Stat_HypNum[id]->Write();
01379 fGR_Stat_AvgLum[id]->Write();
01380 fGR_Stat_IntLum[id]->Write();
01381 fGR_Stat_IntLum_Tot[id]->Write();
01382 }
01383
01384 fGR_Stat_Evs->Write();
01385 fGR_Stat_KminStop_Num->Write();
01386 fGR_Stat_KpluStop_Num->Write();
01387
01388 fGR_Stat_MuPluAll_Num->Write();
01389 fGR_Stat_MuPluAll_Mom->Write();
01390
01391 fGR_Stat_BhaRec_Num->Write();
01392 fGR_Stat_BhaRec_ECMee->Write();
01393 fGR_Stat_BhaRec_Kshort_Num->Write();
01394 fGR_Stat_BhaRec_Kshort_InvMass->Write();
01395 fGR_Stat_BhaRec_Ratio->Write();
01396
01397 }
01398
01399
01400 void TFndPreanHistos::LoadStatHistos(TFile *fin){
01401
01402 ResetStatGraphs(kTRUE);
01403
01404 fGR_Stat_Evs->LoadFromFile( fin );
01405 for(Int_t id=0; id< (Int_t)(E_Scal_Inhib_End); id++){
01406 fGR_Stat_BhaNum[id]->LoadFromFile( fin );
01407 fGR_Stat_HypNum[id]->LoadFromFile( fin );
01408 fGR_Stat_AvgLum[id]->LoadFromFile( fin );
01409 fGR_Stat_IntLum[id]->LoadFromFile( fin );
01410 fGR_Stat_IntLum_Tot[id]->LoadFromFile( fin );
01411 }
01412
01413 fGR_Stat_KminStop_Num->LoadFromFile( fin );
01414 fGR_Stat_KpluStop_Num->LoadFromFile( fin );
01415
01416 fGR_Stat_MuPluAll_Num->LoadFromFile( fin );
01417 fGR_Stat_MuPluAll_Mom->LoadFromFile( fin );
01418
01419 fGR_Stat_BhaRec_Num->LoadFromFile( fin );
01420 fGR_Stat_BhaRec_ECMee->LoadFromFile( fin );
01421 fGR_Stat_BhaRec_Kshort_Num->LoadFromFile( fin );
01422 fGR_Stat_BhaRec_Kshort_InvMass->LoadFromFile( fin );
01423 fGR_Stat_BhaRec_Ratio->LoadFromFile( fin );
01424 }
01425
01426
01427 void TFndPreanHistos::FillScalVariables(){
01428
01429 if(!fScalTree){
01430 cout << "FillScalVariables exiting (fScalTree not available)" << endl;
01431 return;
01432 }
01433
01434 Int_t n_entries = fScalTree->GetEntries();
01435 if(fDebugLev>=1) Printf("Number of entries in Scal tree: %d",n_entries);
01436
01437 fCount_EventPerRun = (Int_t)( fScalTree->GetEntries() );
01438 fCount_EventTotal += fCount_EventPerRun;
01439
01440 fScalTree->GetEntry(n_entries-1);
01441
01442 for(Int_t i=0; i< (Int_t)(E_Scal_Inhib_End); i++){
01443 fCount_Stat_Time[i] = fScal_Time[i];
01444 fCount_Stat_BhaNum[i] = fScal_BHA[i];
01445 fCount_Stat_HypNum[i] = fScal_HYP[i];
01446
01447
01448 }
01449 }
01450
01451
01452 void TFndPreanHistos::EvalStatGraphs(const Int_t &cur_run){
01453
01454
01455
01456
01457
01458 if(fDebugLev >= 1) Info("EvalStatGraphs","Evaluating histograms for run %d",cur_run);
01459
01460
01461 if(fCount_EventPerRun <= 0) return;
01462
01463 Double_t tot_evs = static_cast<Double_t>(fCount_EventPerRun);
01464
01465
01466
01467 Bool_t IsHypeRun = ( fCount_Stat_HypNum[E_Scal_Inhib_All] >= (tot_evs / 2) ) ?
01468 kTRUE :
01469 kFALSE;
01470
01471 Bool_t IsBhabhaRun = ( fCount_Stat_BhaNum[E_Scal_Inhib_All] >= (tot_evs / 2) ) ?
01472 kTRUE :
01473 kFALSE;
01474
01475
01477 Float_t AvgLumin[(Int_t)(E_Scal_Inhib_End)] = {0};
01478 Float_t IntLumin[(Int_t)(E_Scal_Inhib_End)] = {0};
01479
01480 for(Int_t i=0; i< (Int_t)(E_Scal_Inhib_End); i++){
01481 IntLumin[i] = GetBhaRate_Lumin_Factor() * ( (Float_t)(fCount_Stat_BhaNum[i]) );
01482 AvgLumin[i] = IntLumin[i] / ( (Float_t)(fCount_Stat_Time[i]) / 100. );
01483
01484
01485 fGR_Stat_BhaNum[i]->AddPoint(cur_run,fCount_Stat_BhaNum[i] ,0.5);
01486 fGR_Stat_HypNum[i]->AddPoint(cur_run,fCount_Stat_HypNum[i] ,0.5);
01487 fGR_Stat_AvgLum[i]->AddPoint(cur_run,(1e-32 * AvgLumin[i]) ,0.5);
01488 fGR_Stat_IntLum[i]->AddPoint(cur_run,(1e-33 * IntLumin[i]) ,0.5);
01489 }
01490
01491
01492
01493 fGR_Stat_Evs->AddPoint(cur_run,tot_evs,0.5,0);
01494
01495 for(Int_t i=0; i< (Int_t)(E_Scal_Inhib_End); i++){
01496 Double_t integral = fGR_Stat_IntLum_Tot[i]->GetMaxY();
01497 integral+=(1e-33 * IntLumin[i]);
01498 fGR_Stat_IntLum_Tot[i]->AddPoint(cur_run,integral,0.5);
01499 }
01500
01502 Double_t lumavg = (Double_t) (1.0e-33 * (Double_t)(IntLumin[(Int_t)(E_Scal_Inhib_All)]) );
01503
01504 TH1F *htmp = 0;
01505 TSpectrum *spec = 0;
01506 if( IsHypeRun ){
01507
01508
01509 fH_HypTrk_KpluPosAll->Reset();
01510 fH_HypTrk_KpluPosPthAll->Reset();
01511 for(Int_t i=0;i<8;i++){
01512 fH_HypTrk_KpluPosAll -> Add(fH_HypTrk_KpluPosTgt[i]);
01513 fH_HypTrk_KpluPosPthAll -> Add(fH_HypTrk_KpluPosPth[i]);
01514 }
01515
01516 Int_t n_pk = 3;
01517 Double_t sig = 0.005;
01518 Double_t thr = 0.1;
01519 Double_t resf = 1.;
01520 Option_t *dopt = "";
01521
01522 htmp = (TH1F *)fH_HypTrk_KpluPosAll->Clone("temp_his");
01523 ((TAxis *)( htmp->GetXaxis() ))->UnZoom();
01524
01525 if( htmp && fHTmp_MuPluAll ) htmp->Add(fHTmp_MuPluAll,-1);
01526
01527
01528 fHTmp_MuPluAll = (TH1F *)fH_HypTrk_KpluPosAll->Clone("buf_his_muplu");
01529 ((TAxis *)( fHTmp_MuPluAll->GetXaxis() ))->UnZoom();
01530
01531 if(fDebugLev>=2){
01532 cout << "==========> ori: " << fH_HypTrk_KpluPosAll->GetEntries() << endl;
01533 cout << "==========> tmp: " << htmp->GetEntries() << endl;
01534 cout << "==========> buf: " << fHTmp_MuPluAll->GetEntries() << endl;
01535 }
01536
01537 spec = FindPeaks(htmp,n_pk,sig,thr,resf,dopt);
01538 if(fDebugLev>=1) PrintFoundPeaks(spec);
01539
01540 Double_t low_lim = 0.225;
01541 Double_t high_lim = 0.245;
01542 Double_t exp_sigma = 0.003;
01543 Double_t exp_sigma_err = 0.001;
01544
01545 Int_t peakid = LocatePeak(spec,low_lim,high_lim);
01546 Float_t n_mu_plu_all = -1;
01547 Float_t muplu_mom_mean = -1;
01548 Float_t muplu_mom_sigma = -1;
01549
01550
01551 if(fCount_EventPerRun > 1000 && peakid>0){
01552 TFndFitter *fndfit = new TFndFitter();
01553 fndfit->SetCurrentHistogram(htmp);
01554 fndfit->SetCurrentSpectrum(spec);
01555 fndfit->SetResolutionFactor(resf);
01556
01557 Int_t fres = fndfit->FitSinglePeak_GausYield(peakid,exp_sigma,exp_sigma_err);
01558 if(fDebugLev>=1) fndfit->PrintFittedPeaks_GausYield();
01559 if(fres ==0){
01560 TF1 *ft = fndfit->LocateFittedPeak_GausYield(low_lim,high_lim);
01561 if(ft){
01562 n_mu_plu_all = (Double_t) ( ft->GetParameter(0) / (Double_t)(htmp->GetBinWidth(1)) );
01563 muplu_mom_mean = (Double_t) ( ft->GetParameter(1) );
01564 muplu_mom_sigma = (Double_t) ( ft->GetParameter(2) );
01565 }
01566 delete ft;
01567 }
01568 delete fndfit;
01569 }
01570
01571
01572 if( n_mu_plu_all > 0 ){
01573
01574 Double_t nkst_min = fCount_KminPerRun;
01575 Double_t nkst_min_err = TMath::Sqrt(fCount_KminPerRun);
01576 Double_t nkst_plu = fCount_KpluPerRun;
01577 Double_t nkst_plu_err = TMath::Sqrt(fCount_KpluPerRun);
01578 nkst_min = nkst_min / lumavg;
01579 nkst_min_err = nkst_min_err / lumavg;
01580 nkst_plu = nkst_plu / lumavg;
01581 nkst_plu_err = nkst_plu_err / lumavg;
01582
01583 Double_t n_mu_err = TMath::Sqrt(n_mu_plu_all);
01584 n_mu_plu_all = n_mu_plu_all / lumavg;
01585 n_mu_err = n_mu_err / lumavg;
01586
01587 fGR_Stat_KminStop_Num->AddPoint( cur_run,nkst_min,0.5,nkst_min_err );
01588 fGR_Stat_KpluStop_Num->AddPoint( cur_run,nkst_plu,0.5,nkst_plu_err );
01589
01590 fGR_Stat_MuPluAll_Num->AddPoint(cur_run,n_mu_plu_all,0.5,n_mu_err);
01591 fGR_Stat_MuPluAll_Mom->AddPoint(cur_run,muplu_mom_mean,0.5,muplu_mom_sigma);
01592 }
01593 }
01594 else if(IsBhabhaRun){
01595 cout << " --- BHABHA run detected ---" << endl;
01596
01597 htmp = (TH1F *)fH_InvMass_EpluEmin->Clone("temp_his");
01598 ((TAxis *)( htmp->GetXaxis() ))->UnZoom();
01599
01600 if( htmp && fHTmp_BhaInvMass ) htmp->Add(fHTmp_BhaInvMass,-1);
01601
01602 fHTmp_BhaInvMass = (TH1F *)fH_InvMass_EpluEmin->Clone("buf_his_bhaen");
01603 ((TAxis *)( fHTmp_BhaInvMass->GetXaxis() ))->UnZoom();
01604
01605 if(fDebugLev>=2){
01606 cout << "==========> ori: " << fH_InvMass_EpluEmin->GetEntries() << endl;
01607 cout << "==========> tmp: " << htmp->GetEntries() << endl;
01608 cout << "==========> buf: " << fHTmp_BhaInvMass->GetEntries() << endl;
01609 }
01610
01611
01612
01613 Int_t n_pk = 3;
01614 Double_t sig = 0.005;
01615 Double_t thr = 0.2;
01616 Double_t resf = 20.;
01617 Option_t *dopt = "";
01618
01619 spec = FindPeaks(htmp,n_pk,sig,thr,resf,dopt);
01620 if(fDebugLev>=2) PrintFoundPeaks(spec);
01621
01622
01623 Double_t low_lim = 0.95;
01624 Double_t high_lim = 1.05;
01625 Double_t exp_sigma = 0.005;
01626 Double_t exp_sigma_err = 0.002;
01627
01628 Int_t peakid = LocatePeak(spec,low_lim,high_lim);
01629
01630
01631 Double_t eplumin_all = -1;
01632 Double_t eplumin_all_err = -1;
01633 Double_t eplumin_en_mean = -1;
01634 Double_t eplumin_en_sigma = -1;
01635 if(fCount_EventPerRun > 1000 && peakid>0){
01636 TFndFitter *fndfit = new TFndFitter();
01637 fndfit->SetCurrentHistogram(htmp);
01638 fndfit->SetCurrentSpectrum(spec);
01639 fndfit->SetResolutionFactor(resf);
01640
01641 Int_t fres = fndfit->FitSinglePeak_GausYield(peakid,exp_sigma,exp_sigma_err);
01642 if(fDebugLev>=1) fndfit->PrintFittedPeaks_GausYield();
01643 if(fres ==0){
01644 TF1 *ft = fndfit->LocateFittedPeak_GausYield(low_lim,high_lim);
01645 if(ft){
01646 eplumin_all = (Double_t) ( ft->GetParameter(0) / (Double_t)(htmp->GetBinWidth(1)) );
01647 eplumin_en_mean = (Double_t) ( ft->GetParameter(1) );
01648
01649
01650 eplumin_en_sigma = (Double_t) ( ft->GetParameter(2) );
01651 }
01652 delete ft;
01653 }
01654 delete fndfit;
01655 }
01656
01657
01658 delete htmp;
01659 htmp = (TH1F *)fH_InvMass_PIpluPImin->Clone("temp_his");
01660 ((TAxis *)( htmp->GetXaxis() ))->UnZoom();
01661
01662 if( htmp && fHTmp_PionsInvMass ) htmp->Add(fHTmp_PionsInvMass,-1);
01663
01664 fHTmp_PionsInvMass = (TH1F *)fH_InvMass_PIpluPImin->Clone("buf_his_kshorten");
01665 ((TAxis *)( fHTmp_PionsInvMass->GetXaxis() ))->UnZoom();
01666
01667 if(fDebugLev>=2){
01668 cout << "==========> ori: " << fH_InvMass_PIpluPImin->GetEntries() << endl;
01669 cout << "==========> tmp: " << htmp->GetEntries() << endl;
01670 cout << "==========> buf: " << fHTmp_PionsInvMass->GetEntries() << endl;
01671 }
01672
01673 spec = FindPeaks(htmp,n_pk,sig,thr,resf,dopt);
01674 if(fDebugLev>=2) PrintFoundPeaks(spec);
01675
01676 low_lim = 0.46;
01677 high_lim = 0.54;
01678 exp_sigma = 0.009;
01679 exp_sigma_err = 0.001;
01680
01681 peakid = LocatePeak(spec,low_lim,high_lim);
01682
01683
01684 Double_t kshort_all = -1;
01685 Double_t kshort_all_err = -1;
01686 Double_t kshort_en_mean = -1;
01687 Double_t kshort_en_sigma = -1;
01688 if(fCount_EventPerRun > 1000 && peakid>0){
01689 TFndFitter *fndfit = new TFndFitter();
01690 fndfit->SetCurrentHistogram(htmp);
01691 fndfit->SetCurrentSpectrum(spec);
01692 fndfit->SetResolutionFactor(resf);
01693
01694 Int_t fres = fndfit->FitSinglePeak_GausYield(peakid,exp_sigma,exp_sigma_err);
01695 if(fDebugLev>=1) fndfit->PrintFittedPeaks_GausYield();
01696 if(fres ==0){
01697 TF1 *ft = fndfit->LocateFittedPeak_GausYield(low_lim,high_lim);
01698 if(ft){
01699 kshort_all = (Double_t) ( ft->GetParameter(0) / (Double_t)(htmp->GetBinWidth(1)) );
01700 kshort_en_mean = (Double_t) ( ft->GetParameter(1) );
01701 kshort_en_sigma = (Double_t) ( ft->GetParameter(2) );
01702 }
01703 delete ft;
01704 }
01705 delete fndfit;
01706 }
01707
01708
01709
01710
01711 if(eplumin_all > 0 && kshort_all > 0){
01712 eplumin_all_err = TMath::Sqrt(eplumin_all);
01713 kshort_all_err = TMath::Sqrt(kshort_all);
01714 Double_t kbratio = kshort_all / eplumin_all;
01715
01716 Double_t kbratio_err = kbratio * ( (eplumin_all_err / eplumin_all) + (kshort_all_err / kshort_all_err) );
01717
01718 eplumin_all = eplumin_all / lumavg;
01719 eplumin_all_err = eplumin_all_err / lumavg;
01720
01721 kshort_all = kshort_all / lumavg;
01722 kshort_all_err = kshort_all_err / lumavg;
01723
01724 fGR_Stat_BhaRec_Num->AddPoint( cur_run,eplumin_all,0.5,eplumin_all_err );
01725 fGR_Stat_BhaRec_ECMee->AddPoint( cur_run,eplumin_en_mean,0.5,eplumin_en_sigma );
01726
01727 fGR_Stat_BhaRec_Kshort_Num->AddPoint( cur_run,kshort_all,0.5,kshort_all_err );
01728 fGR_Stat_BhaRec_Kshort_InvMass->AddPoint( cur_run,kshort_en_mean,0.5,kshort_en_sigma );
01729 fGR_Stat_BhaRec_Ratio->AddPoint( cur_run,kbratio,0.5,kbratio_err );
01730
01731 }
01732 }
01733 else{
01734 cout << "NOT HYPE AND NOT BHABHA." << endl;
01735 }
01736 delete htmp;
01737 delete spec;
01738
01739
01740 fCount_EventPerRun = 0;
01741 fCount_KminPerRun = 0;
01742 fCount_KpluPerRun = 0;
01743
01744 }
01745
01746
01747 void TFndPreanHistos::WriteHistosToFile(const TString &fnam){
01748
01749 TFile fout(fnam,"RECREATE");
01750 fout.cd();
01751
01752 WriteGesHistos();
01753 WriteBhabhaHistos();
01754 WriteHypeHistos();
01755 WriteStatGraphs();
01756
01757 fout.Close();
01758
01759 }
01760
01761
01762
01763 void TFndPreanHistos::LoadHistosFromFile(const TString &fnam){
01764
01765 TFile *fin = new TFile(fnam,"OPEN");
01766
01767 if(!fin){
01768 Error("LoadHistosFromFile","File not found");
01769 return;
01770 }
01771
01772 LoadGesHistos(fin);
01773 LoadBhabhaHistos(fin);
01774 LoadHypeHistos(fin);
01775 LoadStatHistos(fin);
01776
01777 fin->Close();
01778 delete fin;
01779 }
01780