diff --git a/.gitignore b/.gitignore index c140bbb12084cfae2f14ad9356d81d93e9b25b6e..c4ab6bc5b2b396d683f2c6a689892b6c8169289a 100644 --- a/.gitignore +++ b/.gitignore @@ -14,8 +14,6 @@ HISTOGRAMS/* REPORT_OUTPUT REPORT_OUTPUT/* log/* -full_hms.sh -full_shms.sh onlineGUI/Config/kpp_* *.d *.so diff --git a/DBASE/COIN/STD/standard.kinematics b/DBASE/COIN/STD/standard.kinematics index 449f64a68e6e4c7f9ffdd26714a785f97695d0d6..4f791f04fa487bf92a16ba1c8f0b6e99d3bb9b4c 100644 --- a/DBASE/COIN/STD/standard.kinematics +++ b/DBASE/COIN/STD/standard.kinematics @@ -6,7 +6,7 @@ # 27Al gtargmass_amu = 26.98 # -0-99999 +0-1710 gpbeam = 6.430 gtargmass_amu=12.0107 htheta_lab = -15. @@ -418,7 +418,7 @@ ppartmass = 0.93827231 hpartmass = 0.0005109 #Color Transparency --Feb 14/H coincidence run -2406-9999 +2406-2418 gpbeam = 10.600 gtargmass_amu = 1.00794 htheta_lab = -39.280 @@ -426,4 +426,136 @@ ptheta_lab = 12.800 hpcentral = 2.982 ppcentral = 8.505*0.985 ppartmass = 0.93827231 -hpartmass = 0.0005109 \ No newline at end of file +hpartmass = 0.0005109 + +#Color Transparency --Feb 15/H coincidence run +2419-2419 +gpbeam = 10.600 +gtargmass_amu = 1.00794 +htheta_lab = -39.280 +ptheta_lab = 12.800 +hpcentral = 2.982 +ppcentral = 8.505*0.985 +ppartmass = 0.93827231 +hpartmass = 0.0005109 + +#Color Transparency --Feb 16/H coincidence run +2420-2429 +gpbeam = 10.600 +gtargmass_amu = 1.00794 +htheta_lab = -39.280 +ptheta_lab = 12.800 +hpcentral = 2.982 +ppcentral = 8.505*0.985 +ppartmass = 0.93827231 +hpartmass = 0.0005109 + +#Color Transparency --Feb 17/H coincidence run +2430-2435 +gpbeam = 10.600 +gtargmass_amu = 1.00794 +htheta_lab = -39.280 +ptheta_lab = 12.800 +hpcentral = 2.982 +ppcentral = 8.505*0.985 +ppartmass = 0.93827231 +hpartmass = 0.0005109 + +#Color Transparency --Feb 17/H singles run +2436-2437 +gpbeam = 10.600 +gtargmass_amu = 1.00794 +htheta_lab = -39.280 +ptheta_lab = 12.800 +hpcentral = 2.982 +ppcentral = 8.505*0.985 +ppartmass = 0.93827231 +hpartmass = 0.0005109 + +#Color Transparency --Feb 17/Al coincidence run +2438-2438 +gpbeam = 10.600 +gtargmass_amu = 26.98 +htheta_lab = -39.280 +ptheta_lab = 12.800 +hpcentral = 2.982 +ppcentral = 8.505*0.985 +ppartmass = 0.93827231 +hpartmass = 0.0005109 + +#Color Transparency --Feb 17/C singles +2439-2440 +gpbeam = 10.600 +gtargmass_amu = 12.0107 +htheta_lab = -39.280 +ptheta_lab = 12.800 +hpcentral = 2.982 +ppcentral = 8.505*0.985 +ppartmass = 0.93827231 +hpartmass = 0.0005109 + +#Color Transparency --Feb 17/C coincidence run +2441-2445 +gpbeam = 10.600 +gtargmass_amu = 12.0107 +htheta_lab = -28.505 +ptheta_lab = 17.830 +hpcentral = 4.278 +ppcentral = 7.001*0.985 +ppartmass = 0.93827231 +hpartmass = 0.0005109 + +#Color Transparency --Feb 18/C coincidence run +2446-2451 +gpbeam = 10.600 +gtargmass_amu = 12.0107 +htheta_lab = -28.505 +ptheta_lab = 17.830 +hpcentral = 4.478 +ppcentral = 7.001*0.985 +ppartmass = 0.93827231 +hpartmass = 0.0005109 + +#Color Transparency --Feb 18/H coincidence run +2452-2454 +gpbeam = 10.600 +gtargmass_amu = 1.00794 +htheta_lab = -28.505 +ptheta_lab = 17.830 +hpcentral = 4.478 +ppcentral = 7.001*0.985 +ppartmass = 0.93827231 +hpartmass = 0.0005109 + +#Color Transparency --Feb 18/Al coincidence run +2455 +gpbeam = 10.600 +gtargmass_amu = 26.98 +htheta_lab = -28.505 +ptheta_lab = 17.830 +hpcentral = 4.478 +ppcentral = 7.001*0.985 +ppartmass = 0.93827231 +hpartmass = 0.0005109 + +#Color Transparency --Feb 18/C coincidence run +2456-2463 +gpbeam = 10.600 +gtargmass_amu = 12.0107 +htheta_lab = -28.505 +ptheta_lab = 17.830 +hpcentral = 4.478 +ppcentral = 7.001*0.985 +ppartmass = 0.93827231 +hpartmass = 0.0005109 + +#Color Transparency --Feb 18/C coincidence run +2464-2464 +gpbeam = 10.600 +gtargmass_amu = 12.0107 +htheta_lab = -28.505 +ptheta_lab = 17.830 +hpcentral = 4.478 +ppcentral = 7.001*0.985 +ppartmass = 0.93827231 +hpartmass = 0.0005109 diff --git a/SCRIPTS/COIN/MONITOR/Bean_counter.C b/SCRIPTS/COIN/MONITOR/Bean_counter.C index 82cbe1b9105bdefb1bb3e50216fbbcc95d9f56e2..17e9dc4ed34776078e2dbae8d16bb495a64d39bb 100644 --- a/SCRIPTS/COIN/MONITOR/Bean_counter.C +++ b/SCRIPTS/COIN/MONITOR/Bean_counter.C @@ -192,7 +192,7 @@ void Bean_counter(Int_t runNumber, Int_t targ){ } else if (targ == 2) { - if (sqrt(pPm*pPm) < 0.6) + if (sqrt(pPm*pPm) < 0.4) { h_hdelta->Fill(hdelta); h_hxptar->Fill(HgtrPh); diff --git a/UTIL/PEDESTAL_MON/COIN/PRODUCTION/hms_ped.C b/UTIL/PEDESTAL_MON/COIN/PRODUCTION/hms_ped.C new file mode 100644 index 0000000000000000000000000000000000000000..d547657436e0b2117f52582b1a3b18433fb1c51f --- /dev/null +++ b/UTIL/PEDESTAL_MON/COIN/PRODUCTION/hms_ped.C @@ -0,0 +1,155 @@ +//Read one 1D histogram from rootfile + +void hms_ped(Int_t runNumber, Int_t eventNumber) +{ + const Int_t run = runNumber; + const Int_t nevents = eventNumber; + const Int_t goldRunNum = 1292; + const Int_t numHistos = 3; //Number of histos + + // Define golden run in which to compare current run to + TFile *f = new TFile(Form("ROOTfiles/hms_replay_production_%d_50000.root", goldRunNum)); + // TFile *f = new TFile(Form("ROOTfiles/hms_coin_replay_production_%d_50000.root", goldRunNum)); + + + ofstream myfile; + myfile.open("outHMS.txt"); //To store pedestals differences + myfile <<"___________________________________________________________________________"<<endl; + myfile <<"HMS PEDESTAL GOLDEN RUN NUMBER =" " "<<goldRunNum<<endl; + myfile <<"HMS TRIGGER PPED RUN NUMBER =" " "<<run<<endl; + myfile <<"___________________________________________________________________________"<<endl; + myfile <<"hms_pped"<< "\t\t\t"<<"Mean_Golden"<<"\t"<<"Mean"<<"\t\t"<<"Mean_Diff"<<endl; + myfile <<"___________________________________________________________________________"<<endl; + + //cout<<"Channel "<<" Bar"<<"\t"<<"Variable"<<"\t"<<"Mean_Golden"<<"\t"<<"Mean "<<"\t"<<"Mean_Diff"<<endl; + // cout<<"________________________________________________________________"<<endl; + + + TH1D *histG[numHistos]; + TH1D *hist[numHistos]; + Int_t channel [3]={13,12,15};//(see hallc_replay/MAPS/HMS/DETEC/TRIG/htrig.map) + TString variables[numHistos]={"hSHWR","hPSHWR","hCER"}; + TString histos[numHistos]={"htrig_hshwr_adc_pped", "htrig_hpreShwr_adc_pped", "htrig_hcersum_adc_pped" }; + + Int_t plane=1; + Int_t bar [3]={6,5,8}; //variables are corresponding to these bars + + //For Golden + + double meanG[numHistos],rmsG[numHistos]; + double mean[numHistos],rms[numHistos]; + double meanDiff[numHistos],rmsDiff[numHistos]; + double eff_rms[numHistos]; + + for (int i = 0; i<numHistos ; i++) + { + histG[i] = (TH1D*)gDirectory->Get(histos[i]); + //histG[i] = (TH1D*)gDirectory->GetList()->FindObject(branches[i]); + if (histG[i]) { + + meanG[i]=histG[i]->GetMean(); + rmsG[i]=histG[i]->GetRMS(); + } + else + { + + cout << "****************ATTENTION REQUIRED *****************************" << endl; + cout << "************HMS_TRIGGER_PULSE_PEDESTALS_HAVE PROBLEMS *********" << endl; + cout << "************PLEASE LOOK AT HMS_TRIGGER_SUM_PPED_HISTOGRAMS*****" << endl; + + + } + } + + + // no golden + + // TFile *f1= new TFile(Form("../../../../ROOTfiles/hms_replay_production_%d_%d.root",run,nevents)); + TFile *f1= new TFile(Form("ROOTfiles/hms_coin_replay_production_%d_%d.root",run,nevents)); + + for (int i = 0; i<numHistos ; i++) + { + hist[i] = (TH1D*)gDirectory->Get(histos[i]); + mean[i]=hist[i]->GetMean(); + rms[i]=hist[i]->GetRMS(); + } + + for (int i = 0; i<numHistos ; i++) + { + meanDiff[i]=meanG[i]-mean[i]; + eff_rms[i] = sqrt(pow(rmsG[i], 2)+pow(rms[i], 2)); + } + + + + for (int i = 0; i<numHistos ; i++) + { + //open this cout if we want to print values in terminal + // cout <<channel[i]<<""<<"\t"<< bar[i]<<"\t"<<variables[i]<<"\t"<<"\t"<<meanG[i]<<"\t\t"<<mean[i]<<"\t\t"<<meanDiff[i]<<endl; + // myfile<<variables[i]<<"\t"<<"\t"<<meanG[i]<<"\t\t"<<mean[i]<<"\t\t"<<meanDiff[i]<<endl;//to stores values in .txt file + myfile<<histos[i]<<"\t"<<"\t"<<meanG[i]<<"\t\t"<<mean[i]<<"\t\t"<<meanDiff[i]<<endl;//to stores values in .txt file + //cout<<histos[i]<<"\t"<<"\t"<<meanG[i]<<"\t\t"<<mean[i]<<"\t\t"<<meanDiff[i]<<endl; + } + + for (int i = 0; i<numHistos ; i++) + { + if(abs(meanDiff[i])>10.0) // //The following message will appear in terminal if Pedestal mean differnce is greater than 10 Channels + { + cout<<"_____________________________________________________________________"<<endl; + cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!Attention Needed !!!!!!!!!!!!!!!!!!!!!" << endl; + cout<<"_____________________________________________________________________"<<endl; + + cout << "--------------------See ROC1 --- SLOT 17---------------------------" << endl;//hallc_replay/MAPS/HMS/DETEC/TRIG/htrig.map + cout << "-----SEE THE PROBLEMATIC CHANNELS FOR HMS TRIGGER SUM PPED---------"<<endl; + cout<< "THE FOLLOWING FIGURES ARE THE VALUES OF HMS TRIGGER PULSE PEDESTALS"<<endl; + cout<< "------------- FOR SHWER SUM, PRESHWER SUM AND CERENKOV SUM---------"<<endl; + cout << "NOTE----> MEAN VALUE OF PULSE PEDESTALS OF HMS GOLDEN RUN = MG-----"<<endl; + cout<< "NOTE----> MEAN FOR CURRENT RUN = M AND THEIR DIFFERNCE = MD------"<<endl; + cout << "-----ABSOLUTE VALUE OF MD should be < 10 Channels(2.5 mV)----------"<< endl; + cout<< "------------BUT HERE YOU SEE THE MG VALUE(S) > 10 Channels----------"<<endl; + cout << "-----------------PLEASE CONSULT WITH EXPERTS-----------------------" <<endl; + cout<<"_____________________________________________________________________"<<endl; + cout << "!!!!!!!!!!!!!!!!!Attention Needed !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + cout << setprecision(4) << fixed <<"chan"<<" "<< channel[i] << " " <<"bar"<<" "<< bar[i] + << "\t" << variables[i] << "\t" <<"MG"<<" "<<meanG[i] <<" " + <<"M"<<" "<< mean[i] <<" " <<"MD"<<" "<< meanDiff[i] << endl;//MG=mean golden,M = mean current, MD = mean diff + cout<<"_____________________________________________________________________"<<endl; + } + + } + myfile <<"____________________________________________________________________________"<<endl; + + myfile.close(); + + // TCanvas *c2 = new TCanvas(); + + // double x[numHistos] ={1,2,3}; + + + // TGraphErrors *gr = new TGraphErrors(numHistos, x, meanDiff, 0, eff_rms); + + // c2->cd(1); + // gr->GetXaxis()->SetTitle(" HMS SHWR PRESHWR CERENKOV"); + // gr->GetYaxis()->SetTitle("HMS PED_MEAN_DIFF"); + // gr->SetTitle("HMS PED SHWR PRESHWR CER Golden_vs_current_Run"); + // gr->SetMarkerColor(2); + // gr->SetMarkerSize(1); + // gr->SetMarkerStyle(3); + // gr->Draw("AP*"); + + // TLegend *leg = new TLegend(0.2,0.9,0.5,0.7); + // leg->AddEntry(gr ,"1 = Pshwr","p"); + // leg->AddEntry(gr ,"2 = Pprshwr","p"); + // leg->AddEntry(gr ,"3 = Pcer","p"); + + + + // leg->Draw(); + + + + // c2->Update(); + + + +} diff --git a/UTIL/PEDESTAL_MON/COIN/PRODUCTION/shms_ped.C b/UTIL/PEDESTAL_MON/COIN/PRODUCTION/shms_ped.C new file mode 100644 index 0000000000000000000000000000000000000000..a80047757ba272d0a69cb8d1fc82018da3cd4f17 --- /dev/null +++ b/UTIL/PEDESTAL_MON/COIN/PRODUCTION/shms_ped.C @@ -0,0 +1,155 @@ +//Read one 1D histogram from rootfile +void shms_ped(Int_t runNumber, Int_t eventNumber) +{ + + const Int_t run = runNumber; + const Int_t nevents = eventNumber; + const Int_t goldRunNum = 1757; + const Int_t numHistos = 5; //Number of histos + + // Define golden run in which to compare current run to + TFile *f = new TFile(Form("ROOTfiles/shms_replay_production_%d_50000.root", goldRunNum)); + // TFile *f = new TFile(Form("ROOTfiles/shms_coin_replay_production_%d_50000.root", goldRunNum)); + ofstream myfile; + myfile.open("outSHMS.txt"); //To store pedestals differences + //cout<<"________________________________________________________________"<<endl; + myfile <<"___________________________________________________________________________"<<endl; + myfile <<"SHMS PEDESTAL GOLDEN RUN NUMBER =" " "<<goldRunNum<<endl; + myfile <<"SHMS TRIGGER SUM PPED RUN NUMBER =" " "<<run<<endl; + myfile <<"___________________________________________________________________________"<<endl; + myfile <<"shms_sum_pped"<< "\t\t\t"<<"Mean_Golden"<<"\t"<<"Mean"<<"\t\t"<<"Mean_Diff"<<endl; + myfile <<"___________________________________________________________________________"<<endl; + + + // myfile<< "shms_sum_pped " << "Mean_Golden"<<"\t"<<"Mean"<<"\t\t"<<"Mean_Diff"<<endl; + + + + // cout<<"Channel "<<" Bar"<<"\t"<<"Variable"<<"\t"<<"Mean_Golden"<<"\t"<<"Mean "<<"\t"<<"Mean_Diff"<<endl; + // cout<<"________________________________________________________________"<<endl; + + TH1D *histG[numHistos]; + TH1D *hist[numHistos]; + Int_t channel[5] = {1,2,3,4,5}; //(see hallc_replay/MAPS/SHMS/DETEC/TRIG/ptrig.map) + TString variables[numHistos] = {"pHGCER", "pNGCER", "pPSHWR", "pHG_MOD", "pNG_MOD"}; + TString histos[numHistos] = {"ptrig_phgc_sum_pped", "ptrig_pngc_sum_pped", "ptrig_prshwr_sum_pped", "ptrig_phgc_sum_MOD_pped", "ptrig_pngc_sum_MOD_pped"}; + + Int_t plane=1; + Int_t bar [5]={2,3,4,6,7}; //variables are corresponding to these bars + + // For Goldern + + double meanG[numHistos], rmsG[numHistos]; + double mean[numHistos], rms[numHistos]; + double meanDiff[numHistos], rmsDiff[numHistos]; + double eff_rms[numHistos]; + + for (int i = 0; i < numHistos-2 ; i++) + { + histG[i] = (TH1D*)gDirectory->Get(histos[i]); + // cout << "histG[i] = " << histG[i] << endl; + if (histG[i]) { + // histG[i]->Draw(); + meanG[i]=histG[i]->GetMean(); + rmsG[i]=histG[i]->GetRMS(); + } + else + { + cout << "****************ATTENTION REQUIRED *****************************" << endl; + cout << "************SHMS_TRIGGER_PULSE_PEDESTALS_HAVE PROBLEMS *********" << endl; + cout << "************PLEASE LOOK AT SHMS_TRIGGER_SUM_PPED_HISTOGRAMS*****" << endl; + } + } + // no golden + // TFile *f1= new TFile(Form("../../../../ROOTfiles/shms_replay_production_%d_%d.root",run,nevents)); + TFile *f1= new TFile(Form("ROOTfiles/shms_coin_replay_production_%d_%d.root",run,nevents)); + + for (int i = 0; i < numHistos-2 ; i++) + { + hist[i] = (TH1D*)gDirectory->Get(histos[i]); + // cout << "mean = " << hist[i]->GetMean() << endl; + mean[i]=hist[i]->GetMean(); + rms[i]=hist[i]->GetRMS(); + } + + for (int i = 0; i < numHistos-2 ; i++) + { + meanDiff[i]=meanG[i]-mean[i]; + eff_rms[i] = sqrt(pow(rmsG[i], 2)+pow(rms[i], 2)); + } + + + for (int i = 0; i < numHistos-2 ; i++) + { + // cout <<channel[i]<<""<<"\t"<< bar[i]<<"\t"<<variables[i]<<"\t"<<"\t"<<meanG[i]<<"\t\t"<<mean[i]<<"\t\t"<<meanDiff[i]<<endl; + myfile<<histos[i]<<"\t"<<"\t"<<meanG[i]<<"\t\t"<<mean[i]<<"\t\t"<<meanDiff[i]<<endl;//to store values in .txt file + + } + + for (int i = 0; i < numHistos-2 ; i++) + { + if(abs(meanDiff[i])>10.0) //The following message will appear in terminal if Pedestal mean differnce is greater than 2.5 + { + +cout<<"_____________________________________________________________________"<<endl; + cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!Attention Needed !!!!!!!!!!!!!!!!!!!!!" << endl; + cout<<"_____________________________________________________________________"<<endl; + + cout << "--------------------See ROC2 --- SLOT 14---------------------------" << endl;//hallc_replay/MAPS/HMS/DETEC/TRIG/htrig.map + cout << "-----SEE THE PROBLEMATIC CHANNELS FOR SHMS TRIGGER SUM PPED---------"<<endl; + cout<< "THE FOLLOWING FIGURES ARE THE VALUES OF SHMS TRIGGER PULSE PEDESTALS"<<endl; + cout<< " FOR SHMS HEAVY GAS CERENKOV SUM, NOBEL GAS CERENKOV SUM AND SHWER SUM"<<endl; + cout << "NOTE----> MEAN VALUE OF PULSE PEDESTALS OF HMS GOLDEN RUN = MG-----"<<endl; + cout<< "NOTE----> MEAN FOR CURRENT RUN = M AND THEIR DIFFERNCE = MD------"<<endl; + cout << "--------ABSOLUTE VALUE OF MD should be < 10 Channels (2.5 mV)-------"<< endl; + cout<< "------------BUT HERE YOU SEE THE MG VALUE(S) > 10-----------------"<<endl; + cout << "-----------------PLEASE CONSULT WITH EXPERTS-------------------" <<endl; + cout<<"_____________________________________________________________________"<<endl; + cout << "!!!!!!!!!!!!!!!!!Attention Needed !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + cout << setprecision(4) << fixed <<"chan"<<" "<< channel[i] << " " <<"bar"<<" "<< bar[i] + << "\t" << variables[i] << "\t" <<"MG"<<" "<<meanG[i] <<" " + <<"M"<<" "<< mean[i] <<" " <<"MD"<<" "<< meanDiff[i] << endl;//MG=mean golden,M = mean current, MD = mean diff + cout<<"_____________________________________________________________________"<<endl; + + + } + } + myfile <<"___________________________________________________________________________"<<endl; + + myfile.close(); + + // TCanvas *c2 = new TCanvas(); + + // double x[numHistos] ={1,2,3,4,5}; + + + // TGraphErrors *gr = new TGraphErrors(numHistos-2, x, meanDiff, 0, eff_rms); + + // c2->cd(1); + // gr->GetXaxis()->SetTitle(" SHMS HGC NGC PRSHWR");// PHGC_SUM PNGC_SUM"); + // gr->GetYaxis()->SetTitle("PED_MEAN_DIFF"); + // gr->SetTitle("SHMS PED HGC NGC PRSHWR Golden (1757)_vs_current_Run"); + // gr->SetMarkerColor(2); + // gr->SetMarkerSize(1); + // gr->SetMarkerStyle(3); + // gr->Draw("AP*"); + + + // TLegend *leg = new TLegend(0.20,0.9,0.45,0.7); + // leg->AddEntry(gr ,"1 = PHGC","p"); + // leg->AddEntry(gr ,"2 = PNGC","p"); + // leg->AddEntry(gr,"3 = PRSHWR","p"); + // //leg->AddEntry(gr ,"2 = PHGC_SUM","p"); + // // leg->AddEntry(gr,"3 = PNGC_SUM","p"); + + + + // leg->Draw(); + + + + // c2->Update(); + + + +} diff --git a/UTIL/PEDESTAL_MON/HMS/PRODUCTION/hms_ped.C b/UTIL/PEDESTAL_MON/HMS/PRODUCTION/hms_ped.C new file mode 100644 index 0000000000000000000000000000000000000000..9fae1a65e22af614c8d3c6ee5eac79588ae12751 --- /dev/null +++ b/UTIL/PEDESTAL_MON/HMS/PRODUCTION/hms_ped.C @@ -0,0 +1,156 @@ +//Read one 1D histogram from rootfile +void hms_ped(Int_t runNumber, Int_t eventNumber) +{ + const Int_t run = runNumber; + const Int_t nevents = eventNumber; + const Int_t goldRunNum = 1292; + const Int_t numHistos = 3; //Number of histos + + // Define golden run in which to compare current run to + + TFile *f = new TFile(Form("ROOTfiles/hms_replay_production_%d_50000.root", goldRunNum)); + + + ofstream myfile; + myfile.open("outHMS.txt"); //To store pedestals differences + myfile <<"___________________________________________________________________________"<<endl; + myfile <<"HMS PEDESTAL GOLDEN RUN NUMBER =" " "<<goldRunNum<<endl; + myfile <<"HMS TRIGGER PPED RUN NUMBER =" " "<<run<<endl; + myfile <<"___________________________________________________________________________"<<endl; + myfile <<"hms_pped"<< "\t\t\t"<<"Mean_Golden"<<"\t"<<"Mean"<<"\t\t"<<"Mean_Diff"<<endl; + myfile <<"___________________________________________________________________________"<<endl; + + + + TH1D *histG[numHistos]; + TH1D *hist[numHistos]; + Int_t channel [3]={13,12,15};//(see hallc_replay/MAPS/HMS/DETEC/TRIG/htrig.map) + TString variables[numHistos]={"hSHWR","hPSHWR","hCER"}; + TString histos[numHistos]={"htrig_hshwr_adc_pped", "htrig_hpreShwr_adc_pped", "htrig_hcersum_adc_pped" }; + + Int_t plane=1; + Int_t bar [3]={6,5,8}; //variables are corresponding to these bars + + //For Golden + + double meanG[numHistos],rmsG[numHistos]; + double mean[numHistos],rms[numHistos]; + double meanDiff[numHistos],rmsDiff[numHistos]; + double eff_rms[numHistos]; + + for (int i = 0; i<numHistos ; i++) + { + histG[i] = (TH1D*)gDirectory->Get(histos[i]); + //histG[i] = (TH1D*)gDirectory->GetList()->FindObject(branches[i]); + if (histG[i]) { + + meanG[i]=histG[i]->GetMean(); + rmsG[i]=histG[i]->GetRMS(); + } + else + { + + cout << "****************ATTENTION REQUIRED *****************************" << endl; + cout << "************HMS_TRIGGER_PULSE_PEDESTALS_HAVE PROBLEMS *********" << endl; + cout << "************PLEASE LOOK AT HMS_TRIGGER_SUM_PPED_HISTOGRAMS*****" << endl; + + + } + } + + + // no golden + + TFile *f1= new TFile(Form("ROOTfiles/hms_replay_production_%d_%d.root",run,nevents)); + + for (int i = 0; i<numHistos ; i++) + { + hist[i] = (TH1D*)gDirectory->Get(histos[i]); + mean[i]=hist[i]->GetMean(); + rms[i]=hist[i]->GetRMS(); + } + + for (int i = 0; i<numHistos ; i++) + { + meanDiff[i]=meanG[i]-mean[i]; + eff_rms[i] = sqrt(pow(rmsG[i], 2)+pow(rms[i], 2)); + } + + + + for (int i = 0; i<numHistos ; i++) + { + //open this cout if we want to print values in terminal + // cout <<channel[i]<<""<<"\t"<< bar[i]<<"\t"<<variables[i]<<"\t"<<"\t"<<meanG[i]<<"\t\t"<<mean[i]<<"\t\t"<<meanDiff[i]<<endl; + myfile<<histos[i]<<"\t"<<"\t"<<meanG[i]<<"\t\t"<<mean[i]<<"\t\t"<<meanDiff[i]<<endl;//to stores values in .txt file + + + } + + for (int i = 0; i<numHistos ; i++) + { + if(abs(meanDiff[i])>10.0) // //The following message will appear in terminal if Pedestal mean differnce is greater than 2.5 + { + /* + //commented out on Feb. 18 for F2 running (Sanghwa) + cout<<"_____________________________________________________________________"<<endl; + cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!Attention Needed!!!!!!!!!!!!!!!!!!!!!" << endl; + cout<<"_____________________________________________________________________"<<endl; + + cout << "--------------------See ROC1 --- SLOT 17---------------------------" << endl;//hallc_replay/MAPS/HMS/DETEC/TRIG/htrig.map + cout << "-----SEE THE PROBLEMATIC CHANNELS FOR HMS TRIGGER SUM PPED---------"<<endl; + cout<< "THE FOLLOWING FIGURES ARE THE VALUES OF HMS TRIGGER PULSE PEDESTALS"<<endl; + cout<< "------------- FOR SHWER SUM, PRESHWER SUM AND CERENKOV SUM---------"<<endl; + cout << "NOTE----> MEAN VALUE OF PULSE PEDESTALS OF HMS GOLDEN RUN = MG-----"<<endl; + cout<< "NOTE----> MEAN FOR CURRENT RUN = M AND THEIR DIFFERNCE = MD------"<<endl; + cout << "-----ABSOLUTE VALUE OF MD should be < 10 Channels (2.5 mV)---------"<< endl; + cout<< "------------BUT HERE YOU SEE THE MG VALUE(S) > 10-----------------"<<endl; + cout << "-----------------PLEASE CONSULT WITH EXPERTS----------------" <<endl; + cout<<"_____________________________________________________________________"<<endl; + */ + + cout << " " << endl; + cout << " " << endl; + cout << "!!!!!!!!!!!!!!!!!Attention Needed IT AFFECTS TRIGGER EFFICIENCY!!!!!!!!!!!!!!!!!" << endl; + cout << setprecision(4) << fixed <<"chan"<<" "<< channel[i] << " " <<"bar"<<" "<< bar[i] + << "\t" << variables[i] << "\t" <<"Mean gold run:"<<" "<<meanG[i] <<" " + <<"Mean current run:"<<" "<< mean[i] <<" " <<"Mean diff:"<<" "<< meanDiff[i] << endl;//MG=mean golden,M = mean current, MD = mean diff + } + + } + myfile <<"____________________________________________________________________________"<<endl; + + myfile.close(); + + // TCanvas *c2 = new TCanvas(); + + // double x[numHistos] ={1,2,3}; + + + // TGraphErrors *gr = new TGraphErrors(numHistos, x, meanDiff, 0, eff_rms); + + // c2->cd(1); + // gr->GetXaxis()->SetTitle(" HMS SHWR PRESHWR CERENKOV"); + // gr->GetYaxis()->SetTitle("HMS PED_MEAN_DIFF"); + // gr->SetTitle("HMS PED SHWR PRESHWR CER Golden_vs_current_Run"); + // gr->SetMarkerColor(2); + // gr->SetMarkerSize(1); + // gr->SetMarkerStyle(3); + // gr->Draw("AP*"); + + // TLegend *leg = new TLegend(0.2,0.9,0.5,0.7); + // leg->AddEntry(gr ,"1 = Pshwr","p"); + // leg->AddEntry(gr ,"2 = Pprshwr","p"); + // leg->AddEntry(gr ,"3 = Pcer","p"); + + + + // leg->Draw(); + + + + // c2->Update(); + + + +} diff --git a/UTIL/PEDESTAL_MON/HMS/PRODUCTION/hms_ped.C.Feb18 b/UTIL/PEDESTAL_MON/HMS/PRODUCTION/hms_ped.C.Feb18 new file mode 100644 index 0000000000000000000000000000000000000000..d1934357a28aac81cac286c064024f9e5e8e3d48 --- /dev/null +++ b/UTIL/PEDESTAL_MON/HMS/PRODUCTION/hms_ped.C.Feb18 @@ -0,0 +1,151 @@ +//Read one 1D histogram from rootfile +void hms_ped(Int_t runNumber, Int_t eventNumber) +{ + const Int_t run = runNumber; + const Int_t nevents = eventNumber; + const Int_t goldRunNum = 1292; + const Int_t numHistos = 3; //Number of histos + + // Define golden run in which to compare current run to + + TFile *f = new TFile(Form("ROOTfiles/hms_replay_production_%d_50000.root", goldRunNum)); + + + ofstream myfile; + myfile.open("outHMS.txt"); //To store pedestals differences + myfile <<"___________________________________________________________________________"<<endl; + myfile <<"HMS PEDESTAL GOLDEN RUN NUMBER =" " "<<goldRunNum<<endl; + myfile <<"HMS TRIGGER PPED RUN NUMBER =" " "<<run<<endl; + myfile <<"___________________________________________________________________________"<<endl; + myfile <<"hms_pped"<< "\t\t\t"<<"Mean_Golden"<<"\t"<<"Mean"<<"\t\t"<<"Mean_Diff"<<endl; + myfile <<"___________________________________________________________________________"<<endl; + + + + TH1D *histG[numHistos]; + TH1D *hist[numHistos]; + Int_t channel [3]={13,12,15};//(see hallc_replay/MAPS/HMS/DETEC/TRIG/htrig.map) + TString variables[numHistos]={"hSHWR","hPSHWR","hCER"}; + TString histos[numHistos]={"htrig_hshwr_adc_pped", "htrig_hpreShwr_adc_pped", "htrig_hcersum_adc_pped" }; + + Int_t plane=1; + Int_t bar [3]={6,5,8}; //variables are corresponding to these bars + + //For Golden + + double meanG[numHistos],rmsG[numHistos]; + double mean[numHistos],rms[numHistos]; + double meanDiff[numHistos],rmsDiff[numHistos]; + double eff_rms[numHistos]; + + for (int i = 0; i<numHistos ; i++) + { + histG[i] = (TH1D*)gDirectory->Get(histos[i]); + //histG[i] = (TH1D*)gDirectory->GetList()->FindObject(branches[i]); + if (histG[i]) { + + meanG[i]=histG[i]->GetMean(); + rmsG[i]=histG[i]->GetRMS(); + } + else + { + + cout << "****************ATTENTION REQUIRED *****************************" << endl; + cout << "************HMS_TRIGGER_PULSE_PEDESTALS_HAVE PROBLEMS *********" << endl; + cout << "************PLEASE LOOK AT HMS_TRIGGER_SUM_PPED_HISTOGRAMS*****" << endl; + + + } + } + + + // no golden + + TFile *f1= new TFile(Form("ROOTfiles/hms_replay_production_%d_%d.root",run,nevents)); + + for (int i = 0; i<numHistos ; i++) + { + hist[i] = (TH1D*)gDirectory->Get(histos[i]); + mean[i]=hist[i]->GetMean(); + rms[i]=hist[i]->GetRMS(); + } + + for (int i = 0; i<numHistos ; i++) + { + meanDiff[i]=meanG[i]-mean[i]; + eff_rms[i] = sqrt(pow(rmsG[i], 2)+pow(rms[i], 2)); + } + + + + for (int i = 0; i<numHistos ; i++) + { + //open this cout if we want to print values in terminal + // cout <<channel[i]<<""<<"\t"<< bar[i]<<"\t"<<variables[i]<<"\t"<<"\t"<<meanG[i]<<"\t\t"<<mean[i]<<"\t\t"<<meanDiff[i]<<endl; + myfile<<histos[i]<<"\t"<<"\t"<<meanG[i]<<"\t\t"<<mean[i]<<"\t\t"<<meanDiff[i]<<endl;//to stores values in .txt file + + + } + + for (int i = 0; i<numHistos ; i++) + { + if(abs(meanDiff[i])>10.0) // //The following message will appear in terminal if Pedestal mean differnce is greater than 2.5 + { + cout<<"_____________________________________________________________________"<<endl; + cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!Attention Needed !!!!!!!!!!!!!!!!!!!!!" << endl; + cout<<"_____________________________________________________________________"<<endl; + + cout << "--------------------See ROC1 --- SLOT 17---------------------------" << endl;//hallc_replay/MAPS/HMS/DETEC/TRIG/htrig.map + cout << "-----SEE THE PROBLEMATIC CHANNELS FOR HMS TRIGGER SUM PPED---------"<<endl; + cout<< "THE FOLLOWING FIGURES ARE THE VALUES OF HMS TRIGGER PULSE PEDESTALS"<<endl; + cout<< "------------- FOR SHWER SUM, PRESHWER SUM AND CERENKOV SUM---------"<<endl; + cout << "NOTE----> MEAN VALUE OF PULSE PEDESTALS OF HMS GOLDEN RUN = MG-----"<<endl; + cout<< "NOTE----> MEAN FOR CURRENT RUN = M AND THEIR DIFFERNCE = MD------"<<endl; + cout << "-----ABSOLUTE VALUE OF MD should be < 10 Channels (2.5 mV)---------"<< endl; + cout<< "------------BUT HERE YOU SEE THE MG VALUE(S) > 10-----------------"<<endl; + cout << "-----------------PLEASE CONSULT WITH EXPERTS----------------" <<endl; + cout<<"_____________________________________________________________________"<<endl; + cout << "!!!!!!!!!!!!!!!!!Attention Needed !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + cout << setprecision(4) << fixed <<"chan"<<" "<< channel[i] << " " <<"bar"<<" "<< bar[i] + << "\t" << variables[i] << "\t" <<"MG"<<" "<<meanG[i] <<" " + <<"M"<<" "<< mean[i] <<" " <<"MD"<<" "<< meanDiff[i] << endl;//MG=mean golden,M = mean current, MD = mean diff + cout<<"_____________________________________________________________________"<<endl; + } + + } + myfile <<"____________________________________________________________________________"<<endl; + + myfile.close(); + + // TCanvas *c2 = new TCanvas(); + + // double x[numHistos] ={1,2,3}; + + + // TGraphErrors *gr = new TGraphErrors(numHistos, x, meanDiff, 0, eff_rms); + + // c2->cd(1); + // gr->GetXaxis()->SetTitle(" HMS SHWR PRESHWR CERENKOV"); + // gr->GetYaxis()->SetTitle("HMS PED_MEAN_DIFF"); + // gr->SetTitle("HMS PED SHWR PRESHWR CER Golden_vs_current_Run"); + // gr->SetMarkerColor(2); + // gr->SetMarkerSize(1); + // gr->SetMarkerStyle(3); + // gr->Draw("AP*"); + + // TLegend *leg = new TLegend(0.2,0.9,0.5,0.7); + // leg->AddEntry(gr ,"1 = Pshwr","p"); + // leg->AddEntry(gr ,"2 = Pprshwr","p"); + // leg->AddEntry(gr ,"3 = Pcer","p"); + + + + // leg->Draw(); + + + + // c2->Update(); + + + +} diff --git a/UTIL/PEDESTAL_MON/SHMS/PRODUCTION/shms_ped.C b/UTIL/PEDESTAL_MON/SHMS/PRODUCTION/shms_ped.C new file mode 100644 index 0000000000000000000000000000000000000000..f3329929ae59e438b00a5e4267dbc14f5888c0ef --- /dev/null +++ b/UTIL/PEDESTAL_MON/SHMS/PRODUCTION/shms_ped.C @@ -0,0 +1,158 @@ +//Read one 1D histogram from rootfile +void shms_ped(Int_t runNumber, Int_t eventNumber) +{ + + const Int_t run = runNumber; + const Int_t nevents = eventNumber; + const Int_t goldRunNum = 1757; + const Int_t numHistos = 5; //Number of histos + + // Define golden run in which to compare current run to + TFile *f = new TFile(Form("ROOTfiles/shms_replay_production_%d_50000.root", goldRunNum)); + ofstream myfile; + + + + myfile.open("outSHMS.txt"); //To store pedestals differences + myfile <<"___________________________________________________________________________"<<endl; + myfile <<"SHMS PEDESTAL GOLDEN RUN NUMBER =" " "<<goldRunNum<<endl; + myfile <<"SHMS TRIGGER SUM PPED RUN NUMBER =" " "<<run<<endl; + myfile <<"___________________________________________________________________________"<<endl; + myfile <<"shms_sum_pped"<< "\t\t\t"<<"Mean_Golden"<<"\t"<<"Mean"<<"\t\t"<<"Mean_Diff"<<endl; + myfile <<"___________________________________________________________________________"<<endl; + + + TH1D *histG[numHistos]; + TH1D *hist[numHistos]; + Int_t channel[5] = {1,2,3,4,5}; //(see hallc_replay/MAPS/SHMS/DETEC/TRIG/ptrig.map) + TString variables[numHistos] = {"pHGCER", "pNGCER", "pPSHWR", "pHG_MOD", "pNG_MOD"}; + TString histos[numHistos] = {"ptrig_phgc_sum_pped", "ptrig_pngc_sum_pped", "ptrig_prshwr_sum_pped", "ptrig_phgc_sum_MOD_pped", "ptrig_pngc_sum_MOD_pped"}; + + Int_t plane=1; + Int_t bar [5]={2,3,4,6,7}; //variables are corresponding to these bars + + // For Goldern + + double meanG[numHistos], rmsG[numHistos]; + double mean[numHistos], rms[numHistos]; + double meanDiff[numHistos], rmsDiff[numHistos]; + double eff_rms[numHistos]; + + for (int i = 0; i < numHistos-2 ; i++) + { + histG[i] = (TH1D*)gDirectory->Get(histos[i]); + // cout << "histG[i] = " << histG[i] << endl; + if (histG[i]) { + // histG[i]->Draw(); + meanG[i]=histG[i]->GetMean(); + rmsG[i]=histG[i]->GetRMS(); + } + else + { + cout << "****************ATTENTION REQUIRED *****************************" << endl; + cout << "************SHMS_TRIGGER_PULSE_PEDESTALS_HAVE PROBLEMS *********" << endl; + cout << "************PLEASE LOOK AT SHMS_TRIGGER_SUM_PPED_HISTOGRAMS*****" << endl; + } + } + // no golden + // TFile *f1= new TFile(Form("../../../../ROOTfiles/shms_replay_production_%d_%d.root",run,nevents)); + TFile *f1= new TFile(Form("ROOTfiles/shms_replay_production_%d_%d.root",run,nevents)); + + for (int i = 0; i < numHistos-2 ; i++) + { + hist[i] = (TH1D*)gDirectory->Get(histos[i]); + // cout << "mean = " << hist[i]->GetMean() << endl; + mean[i]=hist[i]->GetMean(); + rms[i]=hist[i]->GetRMS(); + } + + for (int i = 0; i < numHistos-2 ; i++) + { + meanDiff[i]=meanG[i]-mean[i]; + eff_rms[i] = sqrt(pow(rmsG[i], 2)+pow(rms[i], 2)); + } + + + for (int i = 0; i < numHistos-2 ; i++) + { + // cout <<channel[i]<<""<<"\t"<< bar[i]<<"\t"<<variables[i]<<"\t"<<"\t"<<meanG[i]<<"\t\t"<<mean[i]<<"\t\t"<<meanDiff[i]<<endl; + myfile<<histos[i]<<"\t"<<"\t"<<meanG[i]<<"\t\t"<<mean[i]<<"\t\t"<<meanDiff[i]<<endl;//to store values in .txt file + + } + + for (int i = 0; i < numHistos-2 ; i++) + { + if(abs(meanDiff[i])>10.0) //The following message will appear in terminal if Pedestal mean differnce is greater than 2.5 + { + + /* + //commented out on Feb. 18 for F2 running (Sanghwa) + cout<<"_____________________________________________________________________"<<endl; + cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!Attention Needed !!!!!!!!!!!!!!!!!!!!!" << endl; + cout<<"_____________________________________________________________________"<<endl; + + cout << "--------------------See ROC2 --- SLOT 14---------------------------" << endl;//hallc_replay/MAPS/HMS/DETEC/TRIG/htrig.map + cout << "-----SEE THE PROBLEMATIC CHANNELS FOR SHMS TRIGGER SUM PPED---------"<<endl; + cout<< "THE FOLLOWING FIGURES ARE THE VALUES OF SHMS TRIGGER PULSE PEDESTALS"<<endl; + cout<< " FOR SHMS HEAVY GAS CERENKOV SUM, NOBEL GAS CERENKOV SUM AND SHWER SUM"<<endl; + cout << "NOTE----> MEAN VALUE OF PULSE PEDESTALS OF HMS GOLDEN RUN = MG-----"<<endl; + cout<< "NOTE----> MEAN FOR CURRENT RUN = M AND THEIR DIFFERNCE = MD------"<<endl; + cout << "--------ABSOLUTE VALUE OF MD should be < 10 Channels (2.5 mV)------"<< endl; + cout<< "------------BUT HERE YOU SEE THE MG VALUE(S) > 10-------------------"<<endl; + cout << "-----------------PLEASE CONSULT WITH EXPERTS----------------------" <<endl; + cout<<"_____________________________________________________________________"<<endl; + cout << "!!!!!!!!!!!!!!!!!Attention Needed !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + cout << setprecision(4) << fixed <<"chan"<<" "<< channel[i] << " " <<"bar"<<" "<< bar[i] + << "\t" << variables[i] << "\t" <<"MG"<<" "<<meanG[i] <<" " + <<"M"<<" "<< mean[i] <<" " <<"MD"<<" "<< meanDiff[i] << endl;//MG=mean golden,M = mean current, MD = mean diff + cout<<"_____________________________________________________________________"<<endl; + */ + + cout << " " << endl; + cout << " " << endl; + cout << "!!!!!!!!!!!!!!!!!Attention Needed IT AFFECTS TRIGGER EFFICIENCY!!!!!!!!!!!!!!!!!" << endl; + cout << setprecision(4) << fixed <<"chan"<<" "<< channel[i] << " " <<"bar"<<" "<< bar[i] + << "\t" << variables[i] << "\t" <<"Mean golden run:"<<" "<<meanG[i] <<" " + <<"Mean current run:"<<" "<< mean[i] <<" " <<"Mean diff:"<<" "<< meanDiff[i] << endl;//MG=mean golden,M = mean current, MD = mean diff + + } + } +myfile <<"___________________________________________________________________________"<<endl; + + myfile.close(); + + // TCanvas *c2 = new TCanvas(); + + // double x[numHistos] ={1,2,3,4,5}; + + + // TGraphErrors *gr = new TGraphErrors(numHistos-2, x, meanDiff, 0, eff_rms); + + // c2->cd(1); + // gr->GetXaxis()->SetTitle(" SHMS HGC NGC PRSHWR");// PHGC_SUM PNGC_SUM"); + // gr->GetYaxis()->SetTitle("PED_MEAN_DIFF"); + // gr->SetTitle("SHMS PED HGC NGC PRSHWR Golden (1757)_vs_current_Run"); + // gr->SetMarkerColor(2); + // gr->SetMarkerSize(1); + // gr->SetMarkerStyle(3); + // gr->Draw("AP*"); + + + // TLegend *leg = new TLegend(0.20,0.9,0.45,0.7); + // leg->AddEntry(gr ,"1 = PHGC","p"); + // leg->AddEntry(gr ,"2 = PNGC","p"); + // leg->AddEntry(gr,"3 = PRSHWR","p"); + // //leg->AddEntry(gr ,"2 = PHGC_SUM","p"); + // // leg->AddEntry(gr,"3 = PNGC_SUM","p"); + + + + // leg->Draw(); + + + + // c2->Update(); + + + +} diff --git a/UTIL/PEDESTAL_MON/SHMS/PRODUCTION/shms_ped.C.Feb18 b/UTIL/PEDESTAL_MON/SHMS/PRODUCTION/shms_ped.C.Feb18 new file mode 100644 index 0000000000000000000000000000000000000000..2242ae5d01a3a752e3a2aaaa9a7efb01181888a2 --- /dev/null +++ b/UTIL/PEDESTAL_MON/SHMS/PRODUCTION/shms_ped.C.Feb18 @@ -0,0 +1,149 @@ +//Read one 1D histogram from rootfile +void shms_ped(Int_t runNumber, Int_t eventNumber) +{ + + const Int_t run = runNumber; + const Int_t nevents = eventNumber; + const Int_t goldRunNum = 1757; + const Int_t numHistos = 5; //Number of histos + + // Define golden run in which to compare current run to + TFile *f = new TFile(Form("ROOTfiles/shms_replay_production_%d_50000.root", goldRunNum)); + ofstream myfile; + + + + myfile.open("outSHMS.txt"); //To store pedestals differences + myfile <<"___________________________________________________________________________"<<endl; + myfile <<"SHMS PEDESTAL GOLDEN RUN NUMBER =" " "<<goldRunNum<<endl; + myfile <<"SHMS TRIGGER SUM PPED RUN NUMBER =" " "<<run<<endl; + myfile <<"___________________________________________________________________________"<<endl; + myfile <<"shms_sum_pped"<< "\t\t\t"<<"Mean_Golden"<<"\t"<<"Mean"<<"\t\t"<<"Mean_Diff"<<endl; + myfile <<"___________________________________________________________________________"<<endl; + + + TH1D *histG[numHistos]; + TH1D *hist[numHistos]; + Int_t channel[5] = {1,2,3,4,5}; //(see hallc_replay/MAPS/SHMS/DETEC/TRIG/ptrig.map) + TString variables[numHistos] = {"pHGCER", "pNGCER", "pPSHWR", "pHG_MOD", "pNG_MOD"}; + TString histos[numHistos] = {"ptrig_phgc_sum_pped", "ptrig_pngc_sum_pped", "ptrig_prshwr_sum_pped", "ptrig_phgc_sum_MOD_pped", "ptrig_pngc_sum_MOD_pped"}; + + Int_t plane=1; + Int_t bar [5]={2,3,4,6,7}; //variables are corresponding to these bars + + // For Goldern + + double meanG[numHistos], rmsG[numHistos]; + double mean[numHistos], rms[numHistos]; + double meanDiff[numHistos], rmsDiff[numHistos]; + double eff_rms[numHistos]; + + for (int i = 0; i < numHistos-2 ; i++) + { + histG[i] = (TH1D*)gDirectory->Get(histos[i]); + // cout << "histG[i] = " << histG[i] << endl; + if (histG[i]) { + // histG[i]->Draw(); + meanG[i]=histG[i]->GetMean(); + rmsG[i]=histG[i]->GetRMS(); + } + else + { + cout << "****************ATTENTION REQUIRED *****************************" << endl; + cout << "************SHMS_TRIGGER_PULSE_PEDESTALS_HAVE PROBLEMS *********" << endl; + cout << "************PLEASE LOOK AT SHMS_TRIGGER_SUM_PPED_HISTOGRAMS*****" << endl; + } + } + // no golden + // TFile *f1= new TFile(Form("../../../../ROOTfiles/shms_replay_production_%d_%d.root",run,nevents)); + TFile *f1= new TFile(Form("ROOTfiles/shms_replay_production_%d_%d.root",run,nevents)); + + for (int i = 0; i < numHistos-2 ; i++) + { + hist[i] = (TH1D*)gDirectory->Get(histos[i]); + // cout << "mean = " << hist[i]->GetMean() << endl; + mean[i]=hist[i]->GetMean(); + rms[i]=hist[i]->GetRMS(); + } + + for (int i = 0; i < numHistos-2 ; i++) + { + meanDiff[i]=meanG[i]-mean[i]; + eff_rms[i] = sqrt(pow(rmsG[i], 2)+pow(rms[i], 2)); + } + + + for (int i = 0; i < numHistos-2 ; i++) + { + // cout <<channel[i]<<""<<"\t"<< bar[i]<<"\t"<<variables[i]<<"\t"<<"\t"<<meanG[i]<<"\t\t"<<mean[i]<<"\t\t"<<meanDiff[i]<<endl; + myfile<<histos[i]<<"\t"<<"\t"<<meanG[i]<<"\t\t"<<mean[i]<<"\t\t"<<meanDiff[i]<<endl;//to store values in .txt file + + } + + for (int i = 0; i < numHistos-2 ; i++) + { + if(abs(meanDiff[i])>10.0) //The following message will appear in terminal if Pedestal mean differnce is greater than 2.5 + { + +cout<<"_____________________________________________________________________"<<endl; + cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!Attention Needed !!!!!!!!!!!!!!!!!!!!!" << endl; + cout<<"_____________________________________________________________________"<<endl; + + cout << "--------------------See ROC2 --- SLOT 14---------------------------" << endl;//hallc_replay/MAPS/HMS/DETEC/TRIG/htrig.map + cout << "-----SEE THE PROBLEMATIC CHANNELS FOR SHMS TRIGGER SUM PPED---------"<<endl; + cout<< "THE FOLLOWING FIGURES ARE THE VALUES OF SHMS TRIGGER PULSE PEDESTALS"<<endl; + cout<< " FOR SHMS HEAVY GAS CERENKOV SUM, NOBEL GAS CERENKOV SUM AND SHWER SUM"<<endl; + cout << "NOTE----> MEAN VALUE OF PULSE PEDESTALS OF HMS GOLDEN RUN = MG-----"<<endl; + cout<< "NOTE----> MEAN FOR CURRENT RUN = M AND THEIR DIFFERNCE = MD------"<<endl; + cout << "--------ABSOLUTE VALUE OF MD should be < 10 Channels (2.5 mV)------"<< endl; + cout<< "------------BUT HERE YOU SEE THE MG VALUE(S) > 10-------------------"<<endl; + cout << "-----------------PLEASE CONSULT WITH EXPERTS----------------------" <<endl; + cout<<"_____________________________________________________________________"<<endl; + cout << "!!!!!!!!!!!!!!!!!Attention Needed !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + cout << setprecision(4) << fixed <<"chan"<<" "<< channel[i] << " " <<"bar"<<" "<< bar[i] + << "\t" << variables[i] << "\t" <<"MG"<<" "<<meanG[i] <<" " + <<"M"<<" "<< mean[i] <<" " <<"MD"<<" "<< meanDiff[i] << endl;//MG=mean golden,M = mean current, MD = mean diff + cout<<"_____________________________________________________________________"<<endl; + + + } + } +myfile <<"___________________________________________________________________________"<<endl; + + myfile.close(); + + // TCanvas *c2 = new TCanvas(); + + // double x[numHistos] ={1,2,3,4,5}; + + + // TGraphErrors *gr = new TGraphErrors(numHistos-2, x, meanDiff, 0, eff_rms); + + // c2->cd(1); + // gr->GetXaxis()->SetTitle(" SHMS HGC NGC PRSHWR");// PHGC_SUM PNGC_SUM"); + // gr->GetYaxis()->SetTitle("PED_MEAN_DIFF"); + // gr->SetTitle("SHMS PED HGC NGC PRSHWR Golden (1757)_vs_current_Run"); + // gr->SetMarkerColor(2); + // gr->SetMarkerSize(1); + // gr->SetMarkerStyle(3); + // gr->Draw("AP*"); + + + // TLegend *leg = new TLegend(0.20,0.9,0.45,0.7); + // leg->AddEntry(gr ,"1 = PHGC","p"); + // leg->AddEntry(gr ,"2 = PNGC","p"); + // leg->AddEntry(gr,"3 = PRSHWR","p"); + // //leg->AddEntry(gr ,"2 = PHGC_SUM","p"); + // // leg->AddEntry(gr,"3 = PNGC_SUM","p"); + + + + // leg->Draw(); + + + + // c2->Update(); + + + +} diff --git a/UTIL/REPORT_MON/HMS/readout_hms.py b/UTIL/REPORT_MON/HMS/readout_hms.py new file mode 100755 index 0000000000000000000000000000000000000000..4da380644a4fd91dc3487d08949b40bda129e3e0 --- /dev/null +++ b/UTIL/REPORT_MON/HMS/readout_hms.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python +import sys +runNo = sys.argv[1] +evenNo = sys.argv[2] +filename = '../../../REPORT_OUTPUT/HMS/PRODUCTION/replay_hms_production_%s_%s.report'% (runNo, evenNo) + +f = open(filename) +fout = open('output.txt','w') + +for line in f: + data = line.split(':') + if ('Run #' in data[0])or ('3_of_4 EFF' in data[0]) or ('BCM1 Current'in data[0]) or ('BCM2 Current'in data[0]) or('BCM4a Current' in data[0]) or ('SING FID' in data[0]and 'HADRON' not in data[0])or('Plane 1' in data[0]) or('Plane 2' in data[0])or('Plane 3'in data[0])or ('Plane 4'in data[0]) or ('Pre-Scaled Ps1 HMS Computer Live Time' in data[0])or ('Pre-Scaled Ps2 HMS Computer Live Time' in data[0]) or('Pre-Scaled Ps3 HMS Computer Live Time' in data[0]): + + + # print (data[0]+ ': '+ data[1]) + + fout.write(data[0]+ ': '+ data[1]) + + + + + + + data2 = line.split('=') + if ('Ps' in data2[0] and 'factor' in data2[0] and 'Ps4' not in data2[0] and 'Ps5' not in data2[0] and 'Ps6' not in data2[0]): + line = data2[0] + line = line.replace('Ps1_factor','Pre-Scale HMS 3/4') + line = line.replace('Ps2_factor','Pre-Scale HMS EL-Real') + line = line.replace('Ps3_factor','Pre-Scale HMS EL-clean') + + + + # print (line + ': '+ data2[1]) + + fout.write(line + ':'+ data2[1]) + +fout.close() +f.close() diff --git a/UTIL/REPORT_MON/SHMS/readout_shms.py b/UTIL/REPORT_MON/SHMS/readout_shms.py new file mode 100755 index 0000000000000000000000000000000000000000..fbbb29061e794a4bb1f65e9f60ffd93e9966af1f --- /dev/null +++ b/UTIL/REPORT_MON/SHMS/readout_shms.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python +import sys +runNo = sys.argv[1] +evenNo = sys.argv[2] +#raw_input("Enter the run number: ") +#eveNo = $2 +#raw_input("Enter the event number: ") +filename = '../../../REPORT_OUTPUT/SHMS/PRODUCTION/replay_shms_production_%s_%s.report'% (runNo, evenNo) + +f = open(filename) +fout = open('output.txt','w') + +for line in f: + data = line.split(':') + if ('Run #' in data[0])or ('3_of_4 EFF' in data[0]) or ('BCM1 Current'in data[0]) or ('BCM2 Current'in data[0]) or('BCM4a Current' in data[0]) or ('SING FID' in data[0]and 'HADRON' not in data[0])or('Plane 1' in data[0]) or('Plane 2' in data[0])or('Plane 3'in data[0])or ('Plane 4'in data[0]) or ('Pre-Scaled Ps1 SHMS Computer Live Time' in data[0])or ('Pre-Scaled Ps2 SHMS Computer Live Time' in data[0]) or('Pre-Scaled Ps3 SHMS Computer Live Time' in data[0]): + + + # print (data[0]+ ': '+ data[1]) + + fout.write(data[0]+ ': '+ data[1]) + + + + + + data2 = line.split('=') + if ('Ps' in data2[0] and 'factor' in data2[0] and 'Ps4' not in data2[0] and 'Ps5' not in data2[0] and 'Ps6' not in data2[0]): + line = data2[0] + line = line.replace('Ps1_factor','Pre-Scale SHMS 3/4') + line = line.replace('Ps2_factor','Pre-Scale SHMS EL-Real') + line = line.replace('Ps3_factor','Pre-Scale SHMS EL-clean') + + + + # print (line + ': '+ data2[1]) + + fout.write(line + ':'+ data2[1]) + +fout.close() +f.close() diff --git a/UTIL/SHELL/full_coin_shms.sh b/UTIL/SHELL/full_coin_shms.sh new file mode 100755 index 0000000000000000000000000000000000000000..c2d2d2bdf66767460bcf64042faf07d5b7d650fa --- /dev/null +++ b/UTIL/SHELL/full_coin_shms.sh @@ -0,0 +1,103 @@ +#! /bin/bash + +# Which spectrometer are we analyzing. +spec=${0##*_} +spec=${spec%%.sh} +SPEC=$(echo "$spec" | tr '[:lower:]' '[:upper:]') + +# What is the last run number for the spectrometer. +# The pre-fix zero must be stripped because ROOT is ... well ROOT +#lastRun=$( \ +# ls raw/"${spec}"_all_*.dat raw/../raw.copiedtotape/"${spec}"_all_*.dat -R 2>/dev/null | perl -ne 'if(/0*(\d+)/) {prin#t "$1\n"}' | sort -n | tail -1 \ +#) +lastRun=$( \ + ls raw/coin_all_*.dat raw/../raw.copiedtotape/coin_all_*.dat cache/coin_all_*.dat -R 2>/dev/null | perl -ne 'if(/0*(\d+)/) {print "$1\n"}' | sort -n | tail -1 \ +) + +# Which run to analyze. +runNum=$1 +if [ -z "$runNum" ]; then + runNum=$lastRun +fi + +# How many events to analyze. +numEvents=-1 + +# Which scripts to run. +script="SCRIPTS/${SPEC}/PRODUCTION/replay_production_${spec}_coin.C" +config="CONFIG/${SPEC}/PRODUCTION/${spec}_coin_production.cfg" + +# Which commands to run. +runHcana="./hcana -q \"${script}(${runNum}, ${numEvents})\"" +runOnlineGUI="./online -f ${config} -r ${runNum}" +saveOnlineGUI="./online -f ${config} -r ${runNum} -P" + +# Name of the replay ROOT file +rootFileDir="./ROOTfiles" +replayFile="${spec}_coin_replay_production_${runNum}" +rootFile="${replayFile}_${numEvents}.root" +latestRootFile="${rootFileDir}/${replayFile}_latest.root" + +# Names of the monitoring file +monRootDir="./HISTOGRAMS/${SPEC}/ROOT" +monPdfDir="./HISTOGRAMS/${SPEC}/PDF" +monRootFile="${spec}_coin_production_${runNum}.root" +monPdfFile="${spec}_coin_production_${runNum}.pdf" +latestMonRootFile="${monRootDir}/${spec}_coin_production_latest.root" +latestMonPdfFile="${monPdfDir}/${spec}_coin_production_latest.pdf" + +# Where to put log. +reportFile="REPORT_OUTPUT/${SPEC}/PRODUCTION/replay_${spec}_coin_production_${runNum}_${numEvents}.txt" +summaryFile="REPORT_OUTPUT/${SPEC}/PRODUCTION/summary_production_${runNum}_${numEvents}.txt" + +# What is base name of onlineGUI output. +outFile="${spec}_coin_production_${runNum}" + +# Start analysis and monitoring plots. +{ + echo "" + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + echo "" + date + echo "" + echo "Running ${SPEC} COIN analysis on the run ${runNum}:" + echo " -> SCRIPT: ${script}" + echo " -> RUN: ${runNum}" + echo " -> NEVENTS: ${numEvents}" + echo " -> COMMAND: ${runHcana}" + echo "" + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + + sleep 2 + eval ${runHcana} + + # Link the ROOT file to latest for online monitoring + ln -fs ${rootFile} ${latestRootFile} + + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + echo "" + echo "Running onlineGUI for analyzed ${SPEC} COIN run ${runNum}:" + echo " -> CONFIG: ${config}" + echo " -> RUN: ${runNum}" + echo " -> COMMAND: ${runOnlineGUI}" + echo "" + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + + sleep 2 + cd onlineGUI + eval ${runOnlineGUI} + eval ${saveOnlineGUI} + mv "${outFile}.pdf" "../HISTOGRAMS/${SPEC}/PDF/${outFile}.pdf" + mv "${outFile}.root" "../HISTOGRAMS/${SPEC}/ROOT/${outFile}.root" + cd .. + ln -fs ${monRootFile} ${latestMonRootFile} + ln -fs ${monPdfFile} ${latestMonPdfFile} + + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + echo "" + echo "Done analyzing ${SPEC} run ${runNum}." + echo "" + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + +} 2>&1 | tee "${reportFile}" +2>&1 | tee "${summaryFile}" diff --git a/UTIL/SHELL/full_shms.sh b/UTIL/SHELL/full_shms.sh new file mode 100755 index 0000000000000000000000000000000000000000..22a5787d5b45cac484280cca378c94132ca402c6 --- /dev/null +++ b/UTIL/SHELL/full_shms.sh @@ -0,0 +1,98 @@ +#! /bin/bash + +# Which spectrometer are we analyzing. +spec=${0##*_} +spec=${spec%%.sh} +SPEC=$(echo "$spec" | tr '[:lower:]' '[:upper:]') + +# What is the last run number for the spectrometer. +# The pre-fix zero must be stripped because ROOT is ... well ROOT +lastRun=$( \ + ls raw/"${spec}"_all_*.dat raw/../raw.copiedtotape/"${spec}"_all_*.dat -R 2>/dev/null | perl -ne 'if(/0*(\d+)/) {print "$1\n"}' | sort -n | tail -1 \ +) + +# Which run to analyze. +runNum=$1 +if [ -z "$runNum" ]; then + runNum=$lastRun +fi + +# How many events to analyze. +numEvents=-1 + +# Which scripts to run. +script="SCRIPTS/${SPEC}/PRODUCTION/replay_production_${spec}.C" +config="CONFIG/${SPEC}/PRODUCTION/${spec}_production.cfg" + +# Which commands to run. +runHcana="./hcana -q \"${script}(${runNum}, ${numEvents})\"" +runOnlineGUI="./online -f ${config} -r ${runNum} -P" + +# Name of the replay ROOT file +rootFileDir="./ROOTfiles" +replayFile="${spec}_replay_production_${runNum}" +rootFile="${replayFile}_${numEvents}.root" +latestRootFile="${rootFileDir}/${replayFile}_latest.root" + +# Where to put log. +reportFile="REPORT_OUTPUT/${SPEC}/PRODUCTION/replay_${spec}_production_${runNum}_${numEvents}.txt" +summaryFile="REPORT_OUTPUT/${SPEC}/PRODUCTION/summary_production_${runNum}_${numEvents}.txt" + +# Names of the monitoring file +monRootDir="./HISTOGRAMS/${SPEC}/ROOT" +monPdfDir="./HISTOGRAMS/${SPEC}/PDF" +monRootFile="${spec}_production_${runNum}.root" +monPdfFile="${spec}_production_${runNum}.pdf" +latestMonRootFile="${monRootDir}/${spec}_production_latest.root" +latestMonPdfFile="${monPdfDir}/${spec}_production_latest.pdf" + +# What is base name of onlineGUI output. +outFile="${spec}_production_${runNum}" + +# Start analysis and monitoring plots. +{ + echo "" + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + echo "" + date + echo "" + echo "Running ${SPEC} analysis on the run ${runNum}:" + echo " -> SCRIPT: ${script}" + echo " -> RUN: ${runNum}" + echo " -> NEVENTS: ${numEvents}" + echo " -> COMMAND: ${runHcana}" + echo "" + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + + sleep 2 + eval ${runHcana} + + # Link the ROOT file to latest for online monitoring + ln -fs ${rootFile} ${latestRootFile} + + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + echo "" + echo "Running onlineGUI for analyzed ${SPEC} run ${runNum}:" + echo " -> CONFIG: ${config}" + echo " -> RUN: ${runNum}" + echo " -> COMMAND: ${runOnlineGUI}" + echo "" + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + + sleep 2 + cd onlineGUI + eval ${runOnlineGUI} + mv "${outFile}.pdf" "../HISTOGRAMS/${SPEC}/PDF/${outFile}.pdf" + mv "${outFile}.root" "../HISTOGRAMS/${SPEC}/ROOT/${outFile}.root" + cd .. + ln -fs ${monRootFile} ${latestMonRootFile} + ln -fs ${monPdfFile} ${latestMonPdfFile} + + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + echo "" + echo "Done analyzing ${SPEC} run ${runNum}." + echo "" + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + +} 2>&1 | tee "${reportFile}" +2>&1 | tee "${summaryFile}" diff --git a/UTIL/SHELL/run_all_shms.sh b/UTIL/SHELL/run_all_shms.sh new file mode 100755 index 0000000000000000000000000000000000000000..d18d930aacd8711ef4ee77c5303c431fc155eec8 --- /dev/null +++ b/UTIL/SHELL/run_all_shms.sh @@ -0,0 +1,61 @@ +#! /bin/bash + +# Which spectrometer are we analyzing. +spec=${0##*_} +spec=${spec%%.sh} +SPEC=$(echo "$spec" | tr '[:lower:]' '[:upper:]') + +# What is the last run number for the spectrometer. +# The pre-fix zero must be stripped because ROOT is ... well ROOT +lastRun=$( \ + ls raw/"${spec}"_all_*.dat raw/../raw.copiedtotape/"${spec}"_all_*.dat -R 2>/dev/null | perl -ne 'if(/0*(\d+)/) {print "$1\n"}' | sort -n | tail -1 \ +) + +# Which run to analyze. +runNum=$1 +if [ -z "$runNum" ]; then + runNum=$lastRun +fi + +# How many events to analyze. +numEvents=50000 + +# Which scripts to run. +script="SCRIPTS/${SPEC}/PRODUCTION/replay_production_all_${spec}.C" + +# Which commands to run. +runHcana="./hcana -q \"${script}(${runNum}, ${numEvents})\"" + +# Where to put log. +reportFile="REPORT_OUTPUT/${SPEC}/PRODUCTION/replay_${spec}_production_${runNum}_${numEvents}.txt" +summaryFile="REPORT_OUTPUT/${SPEC}/PRODUCTION/summary_production_${runNum}_${numEvents}.txt" + +# Start analysis and monitoring plots. +{ + echo "" + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + echo "" + date + echo "" + echo "Running ${SPEC} analysis on the run ${runNum}:" + echo " -> SCRIPT: ${script}" + echo " -> RUN: ${runNum}" + echo " -> NEVENTS: ${numEvents}" + echo " -> COMMAND: ${runHcana}" + echo "" + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + echo + + sleep 2 + eval ${runHcana} + sleep 2 + + echo + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + echo "" + echo "Done analyzing ${SPEC} run ${runNum}." + echo "" + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + +} 2>&1 | tee "${reportFile}" +2>&1 | tee "${summaryFile}" diff --git a/UTIL/SHELL/run_beancounter.sh b/UTIL/SHELL/run_beancounter.sh new file mode 100755 index 0000000000000000000000000000000000000000..eb19aab3697298948cd3d8733b3b9c76e13ffb18 --- /dev/null +++ b/UTIL/SHELL/run_beancounter.sh @@ -0,0 +1,33 @@ +#! /bin/bash + +# Which run to use +runNum=$1 +if [ -z "$runNum" ]; then + echo " give Run Number to use" + exit +fi + +# which target +target=$2 +if [ -z "$target" ]; then + echo " give target type h or c " + exit +fi + +if [ "$target" = "h" ]; then + targ=1 +fi +if [ "$target" = "c" ]; then + targ=2 +fi + +echo " counting for ${target} target" + +# Which scripts to run. +script="SCRIPTS/COIN/MONITOR/Bean_counter.C" + +# Which commands to run. +runbc="root -l \"${script}(${runNum}, ${targ})\"" +eval ${runbc} + +echo "If the plots look good quit root otherwise call an expert" diff --git a/UTIL/SHELL/run_coin.sh b/UTIL/SHELL/run_coin.sh new file mode 100755 index 0000000000000000000000000000000000000000..5550c77ad2a7e1c3b51f19f77abcb1c09e61bc36 --- /dev/null +++ b/UTIL/SHELL/run_coin.sh @@ -0,0 +1,101 @@ +#! /bin/bash + +SPEC="COIN" + +# What is the last run number for the spectrometer. +# The pre-fix zero must be stripped because ROOT is ... well ROOT +#lastRun=$( \ +# ls raw/"${spec}"_all_*.dat raw/../raw.copiedtotape/"${spec}"_all_*.dat -R 2>/dev/null | perl -ne 'if(/0*(\d+)/) {prin#t "$1\n"}' | sort -n | tail -1 \ +#) +lastRun=$( \ + ls raw/coin_all_*.dat raw/../raw.copiedtotape/coin_all_*.dat cache/coin_all_*.dat -R 2>/dev/null | perl -ne 'if(/0*(\d+)/) {print "$1\n"}' | sort -n | tail -1 \ +) + +# Which run to analyze. +runNum=$1 +if [ -z "$runNum" ]; then + runNum=$lastRun +fi + +# How many events to analyze. +numEvents=1000000 + +# Which scripts to run. +script="SCRIPTS/${SPEC}/PRODUCTION/replay_production_coin.C" +#config="CONFIG/${SPEC}/PRODUCTION/${spec}_coin_production.cfg" + +# Which commands to run. +runHcana="./hcana -q \"${script}(${runNum}, ${numEvents})\"" +#runOnlineGUI="./online -f ${config} -r ${runNum}" +#saveOnlineGUI="./online -f ${config} -r ${runNum} -P" + +# Name of the replay ROOT file +rootFileDir="./ROOTfiles" +replayFile="coin_ev7_replay_production_${runNum}" +rootFile="${replayFile}_${numEvents}.root" +latestRootFile="${rootFileDir}/${replayFile}_latest.root" + +# Names of the monitoring file +#monRootDir="./HISTOGRAMS/${SPEC}/ROOT" +#monPdfDir="./HISTOGRAMS/${SPEC}/PDF" +#monRootFile="${spec}_coin_production_${runNum}.root" +#monPdfFile="${spec}_coin_production_${runNum}.pdf" +#latestMonRootFile="${monRootDir}/${spec}_coin_production_latest.root" +#latestMonPdfFile="${monPdfDir}/${spec}_coin_production_latest.pdf" + +# Where to put log. +reportFile="REPORT_OUTPUT/${SPEC}/PRODUCTION/replay_coin_ev7_production_${runNum}_${numEvents}.txt" +summaryFile="REPORT_OUTPUT/${SPEC}/PRODUCTION/summary_production_ev7_${runNum}_${numEvents}.txt" + +# What is base name of onlineGUI output. +#outFile="${spec}_coin_production_${runNum}" + +# Start analysis and monitoring plots. +{ + echo "" + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + echo "" + date + echo "" + echo "Running ${SPEC} COIN analysis on the run ${runNum}:" + echo " -> SCRIPT: ${script}" + echo " -> RUN: ${runNum}" + echo " -> NEVENTS: ${numEvents}" + echo " -> COMMAND: ${runHcana}" + echo "" + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + + sleep 2 + eval ${runHcana} + + # Link the ROOT file to latest for online monitoring + # ln -fs ${rootFile} ${latestRootFile} + + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + echo "" + echo "Running onlineGUI for analyzed ${SPEC} COIN run ${runNum}:" + echo " -> CONFIG: ${config}" + echo " -> RUN: ${runNum}" + echo " -> COMMAND: ${runOnlineGUI}" + echo "" + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + +# sleep 2 +# cd onlineGUI +# eval ${runOnlineGUI} +# eval ${saveOnlineGUI} +# mv "${outFile}.pdf" "../HISTOGRAMS/${SPEC}/PDF/${outFile}.pdf" +# mv "${outFile}.root" "../HISTOGRAMS/${SPEC}/ROOT/${outFile}.root" +# cd .. +# ln -fs ${monRootFile} ${latestMonRootFile} +# ln -fs ${monPdfFile} ${latestMonPdfFile} + + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + echo "" + echo "Done analyzing ${SPEC} run ${runNum}." + echo "" + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + +} +#2>&1 | tee "${reportFile}" +#2>&1 | tee "${summaryFile}" diff --git a/UTIL/SHELL/run_coin_ep.sh b/UTIL/SHELL/run_coin_ep.sh new file mode 100755 index 0000000000000000000000000000000000000000..47a82c1bca5cf2c3f90461629ede9164051cf0d9 --- /dev/null +++ b/UTIL/SHELL/run_coin_ep.sh @@ -0,0 +1,101 @@ +#! /bin/bash + +SPEC="COIN" + +# What is the last run number for the spectrometer. +# The pre-fix zero must be stripped because ROOT is ... well ROOT +#lastRun=$( \ +# ls raw/"${spec}"_all_*.dat raw/../raw.copiedtotape/"${spec}"_all_*.dat -R 2>/dev/null | perl -ne 'if(/0*(\d+)/) {prin#t "$1\n"}' | sort -n | tail -1 \ +#) +lastRun=$( \ + ls raw/coin_all_*.dat raw/../raw.copiedtotape/coin_all_*.dat cache/coin_all_*.dat -R 2>/dev/null | perl -ne 'if(/0*(\d+)/) {print "$1\n"}' | sort -n | tail -1 \ +) + +# Which run to analyze. +runNum=$1 +if [ -z "$runNum" ]; then + runNum=$lastRun +fi + +# How many events to analyze. +numEvents=-1 + +# Which scripts to run. +script="SCRIPTS/${SPEC}/PRODUCTION/replay_production_ep.C" +#config="CONFIG/${SPEC}/PRODUCTION/${spec}_coin_production.cfg" + +# Which commands to run. +runHcana="./hcana -q \"${script}(${runNum}, ${numEvents})\"" +#runOnlineGUI="./online -f ${config} -r ${runNum}" +#saveOnlineGUI="./online -f ${config} -r ${runNum} -P" + +# Name of the replay ROOT file +rootFileDir="./ROOTfiles" +replayFile="ep_${runNum}" +rootFile="${replayFile}.root" +latestRootFile="${rootFileDir}/${replayFile}_latest.root" + +# Names of the monitoring file +#monRootDir="./HISTOGRAMS/${SPEC}/ROOT" +#monPdfDir="./HISTOGRAMS/${SPEC}/PDF" +#monRootFile="${spec}_coin_production_${runNum}.root" +#monPdfFile="${spec}_coin_production_${runNum}.pdf" +#latestMonRootFile="${monRootDir}/${spec}_coin_production_latest.root" +#latestMonPdfFile="${monPdfDir}/${spec}_coin_production_latest.pdf" + +# Where to put log. +reportFile="REPORT_OUTPUT/${SPEC}/PRODUCTION/replay_ep_production_${runNum}.txt" +summaryFile="REPORT_OUTPUT/${SPEC}/PRODUCTION/summary_ep_${runNum}.txt" + +# What is base name of onlineGUI output. +#outFile="${spec}_coin_production_${runNum}" + +# Start analysis and monitoring plots. +{ + echo "" + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + echo "" + date + echo "" + echo "Running ${SPEC} COIN analysis on the run ${runNum}:" + echo " -> SCRIPT: ${script}" + echo " -> RUN: ${runNum}" + echo " -> NEVENTS: ${numEvents}" + echo " -> COMMAND: ${runHcana}" + echo "" + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + + sleep 2 + eval ${runHcana} + + # Link the ROOT file to latest for online monitoring + # ln -fs ${rootFile} ${latestRootFile} + +# echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" +# echo "" +# echo "Running onlineGUI for analyzed ${SPEC} ep run ${runNum}:" +# echo " -> CONFIG: ${config}" +# echo " -> RUN: ${runNum}" +# echo " -> COMMAND: ${runOnlineGUI}" +# echo "" +# echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + +# sleep 2 +# cd onlineGUI +# eval ${runOnlineGUI} +# eval ${saveOnlineGUI} +# mv "${outFile}.pdf" "../HISTOGRAMS/${SPEC}/PDF/${outFile}.pdf" +# mv "${outFile}.root" "../HISTOGRAMS/${SPEC}/ROOT/${outFile}.root" +# cd .. +# ln -fs ${monRootFile} ${latestMonRootFile} +# ln -fs ${monPdfFile} ${latestMonPdfFile} + + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + echo "" + echo "Done analyzing ${SPEC} run ${runNum}." + echo "" + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + +} +#2>&1 | tee "${reportFile}" +#2>&1 | tee "${summaryFile}" diff --git a/UTIL/SHELL/run_coin_hElec_pProt.C b/UTIL/SHELL/run_coin_hElec_pProt.C new file mode 100755 index 0000000000000000000000000000000000000000..563cfd23e64c29eb2343f5703236e983f26c6179 --- /dev/null +++ b/UTIL/SHELL/run_coin_hElec_pProt.C @@ -0,0 +1,101 @@ +#! /bin/bash + +SPEC="COIN" + +# What is the last run number for the spectrometer. +# The pre-fix zero must be stripped because ROOT is ... well ROOT +#lastRun=$( \ +# ls raw/"${spec}"_all_*.dat raw/../raw.copiedtotape/"${spec}"_all_*.dat -R 2>/dev/null | perl -ne 'if(/0*(\d+)/) {prin#t "$1\n"}' | sort -n | tail -1 \ +#) +lastRun=$( \ + ls raw/coin_all_*.dat raw/../raw.copiedtotape/coin_all_*.dat cache/coin_all_*.dat -R 2>/dev/null | perl -ne 'if(/0*(\d+)/) {print "$1\n"}' | sort -n | tail -1 \ +) + +# Which run to analyze. +runNum=$1 +if [ -z "$runNum" ]; then + runNum=$lastRun +fi + +# How many events to analyze. +numEvents=-1 + +# Which scripts to run. +script="SCRIPTS/${SPEC}/PRODUCTION/replay_production_coin_hElec_pProt.C" +#config="CONFIG/${SPEC}/PRODUCTION/${spec}_coin_production.cfg" + +# Which commands to run. +runHcana="./hcana -q \"${script}(${runNum}, ${numEvents})\"" +#runOnlineGUI="./online -f ${config} -r ${runNum}" +#saveOnlineGUI="./online -f ${config} -r ${runNum} -P" + +# Name of the replay ROOT file +rootFileDir="./ROOTfiles" +replayFile="coin_replay_production_hElec_pProt_${runNum}" +rootFile="${replayFile}_${numEvents}.root" +latestRootFile="${rootFileDir}/${replayFile}_latest.root" + +# Names of the monitoring file +#monRootDir="./HISTOGRAMS/${SPEC}/ROOT" +#monPdfDir="./HISTOGRAMS/${SPEC}/PDF" +#monRootFile="${spec}_coin_production_${runNum}.root" +#monPdfFile="${spec}_coin_production_${runNum}.pdf" +#latestMonRootFile="${monRootDir}/${spec}_coin_production_latest.root" +#latestMonPdfFile="${monPdfDir}/${spec}_coin_production_latest.pdf" + +# Where to put log. +reportFile="REPORT_OUTPUT/${SPEC}/PRODUCTION/replay_coin_ev7_production_${runNum}_${numEvents}.txt" +summaryFile="REPORT_OUTPUT/${SPEC}/PRODUCTION/summary_production_ev7_${runNum}_${numEvents}.txt" + +# What is base name of onlineGUI output. +#outFile="${spec}_coin_production_${runNum}" + +# Start analysis and monitoring plots. +{ + echo "" + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + echo "" + date + echo "" + echo "Running ${SPEC} COIN analysis on the run ${runNum}:" + echo " -> SCRIPT: ${script}" + echo " -> RUN: ${runNum}" + echo " -> NEVENTS: ${numEvents}" + echo " -> COMMAND: ${runHcana}" + echo "" + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + + sleep 2 + eval ${runHcana} + + # Link the ROOT file to latest for online monitoring + # ln -fs ${rootFile} ${latestRootFile} + + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + echo "" + echo "Running onlineGUI for analyzed ${SPEC} COIN run ${runNum}:" + echo " -> CONFIG: ${config}" + echo " -> RUN: ${runNum}" + echo " -> COMMAND: ${runOnlineGUI}" + echo "" + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + +# sleep 2 +# cd onlineGUI +# eval ${runOnlineGUI} +# eval ${saveOnlineGUI} +# mv "${outFile}.pdf" "../HISTOGRAMS/${SPEC}/PDF/${outFile}.pdf" +# mv "${outFile}.root" "../HISTOGRAMS/${SPEC}/ROOT/${outFile}.root" +# cd .. +# ln -fs ${monRootFile} ${latestMonRootFile} +# ln -fs ${monPdfFile} ${latestMonPdfFile} + + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + echo "" + echo "Done analyzing ${SPEC} run ${runNum}." + echo "" + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + +} +#2>&1 | tee "${reportFile}" +#2>&1 | tee "${summaryFile}" diff --git a/UTIL/SHELL/run_coin_monitor.sh b/UTIL/SHELL/run_coin_monitor.sh new file mode 100755 index 0000000000000000000000000000000000000000..4a320db69d5451220bcec9af31f51b070df8ac5d --- /dev/null +++ b/UTIL/SHELL/run_coin_monitor.sh @@ -0,0 +1,43 @@ +#! /bin/bash + +# Which run to use +runNum=$1 +if [ -z "$runNum" ]; then + echo " give Run Number to use" + exit +fi + +# which target +target=$2 +if [ -z "$target" ]; then + echo " give target type h or c " + exit +fi + +if [ "$target" = "h" ]; then + targ=1 +fi +if [ "$target" = "c" ]; then + targ=2 +fi +if [ "$target" = "d" ]; then + targ=3 +fi + +echo " Grabbing monitored data for run ${runNum}, ${target} target" + +# Grab monitored data and put it in the database +script="SCRIPTS/COIN/MONITOR/coin_monitor_calc.C" + +runbc="root -q -l \"${script}(${runNum}, ${targ})\"" +eval ${runbc} + +# Plot this run, with 5 on either side +script="SCRIPTS/COIN/MONITOR/coin_monitor_graph.C" +runMin=$((runNum-10)) +runMax=$((runNum+5)) +runbc="root -l \"${script}(${runMin}, ${runMax})\"" +eval ${runbc} + + +echo "If the plots look good quit root otherwise call an expert" diff --git a/UTIL/SHELL/run_coin_shms.sh b/UTIL/SHELL/run_coin_shms.sh new file mode 100755 index 0000000000000000000000000000000000000000..a84b1b1710c21ebfee8c98e97976ab9da4033117 --- /dev/null +++ b/UTIL/SHELL/run_coin_shms.sh @@ -0,0 +1,123 @@ +#! /bin/bash + +# Which spectrometer are we analyzing. +spec=${0##*_} +spec=${spec%%.sh} +SPEC=$(echo "$spec" | tr '[:lower:]' '[:upper:]') + +# What is the last run number for the spectrometer. +# The pre-fix zero must be stripped because ROOT is ... well ROOT +#lastRun=$( \ +# ls raw/"${spec}"_all_*.dat raw/../raw.copiedtotape/"${spec}"_all_*.dat -R 2>/dev/null | perl -ne 'if(/0*(\d+)/) {prin#t "$1\n"}' | sort -n | tail -1 \ +#) +lastRun=$( \ + ls raw/coin_all_*.dat raw/../raw.copiedtotape/coin_all_*.dat cache/coin_all_*.dat -R 2>/dev/null | perl -ne 'if(/0*(\d+)/) {print "$1\n"}' | sort -n | tail -1 \ +) + +# Which run to analyze. +runNum=$1 +if [ -z "$runNum" ]; then + runNum=$lastRun +fi + +# How many events to analyze. +numEvents=50000 + +# Which scripts to run. +script="SCRIPTS/${SPEC}/PRODUCTION/replay_production_${spec}_coin.C" +config="CONFIG/${SPEC}/PRODUCTION/${spec}_coin_production.cfg" + +# Which commands to run. +runHcana="./hcana -q \"${script}(${runNum}, ${numEvents})\"" +runOnlineGUI="./online -f ${config} -r ${runNum}" +saveOnlineGUI="./online -f ${config} -r ${runNum} -P" +runPedMon="root -l -q \"UTIL/PEDESTAL_MON/COIN/PRODUCTION/${spec}_ped.C(${runNum}, ${numEvents})\"" + +#Define where to put the PEDESTAL_MON +reportFile="REPORT_OUTPUT/${SPEC}/PRODUCTION/replay_${spec}_production_${runNum}_${numEvents}.txt" +pedMonFile="PEDESTAL_MONITOR/COIN/reportPedestal_${spec}_coin_production_${runNum}_${numEvents}.txt" + +# Name of the replay ROOT file +rootFileDir="./ROOTfiles" +replayFile="${spec}_coin_replay_production_${runNum}" +rootFile="${replayFile}_${numEvents}.root" +latestRootFile="${rootFileDir}/${replayFile}_latest.root" + +# Names of the monitoring file +monRootDir="./HISTOGRAMS/${SPEC}/ROOT" +monPdfDir="./HISTOGRAMS/${SPEC}/PDF" +monRootFile="${spec}_coin_production_${runNum}.root" +monPdfFile="${spec}_coin_production_${runNum}.pdf" +latestMonRootFile="${monRootDir}/${spec}_coin_production_latest.root" +latestMonPdfFile="${monPdfDir}/${spec}_coin_production_latest.pdf" + +# Where to put log. +reportFile="REPORT_OUTPUT/${SPEC}/PRODUCTION/replay_${spec}_coin_production_${runNum}_${numEvents}.txt" +summaryFile="REPORT_OUTPUT/${SPEC}/PRODUCTION/summary_production_${runNum}_${numEvents}.txt" + +# What is base name of onlineGUI output. +outFile="${spec}_coin_production_${runNum}" +outFilePed="out${SPEC}" + +# Start analysis and monitoring plots. +{ + echo "" + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + echo "" + date + echo "" + echo "Running ${SPEC} COIN analysis on the run ${runNum}:" + echo " -> SCRIPT: ${script}" + echo " -> RUN: ${runNum}" + echo " -> NEVENTS: ${numEvents}" + echo " -> COMMAND: ${runHcana}" + echo "" + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + + sleep 2 + eval ${runHcana} + + # Link the ROOT file to latest for online monitoring + ln -fs ${rootFile} ${latestRootFile} + + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + echo "" + echo "Running onlineGUI for analyzed ${SPEC} COIN run ${runNum}:" + echo " -> CONFIG: ${config}" + echo " -> RUN: ${runNum}" + echo " -> COMMAND: ${runOnlineGUI}" + echo "" + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + + sleep 2 + cd onlineGUI + eval ${runOnlineGUI} + eval ${saveOnlineGUI} + mv "${outFile}.pdf" "../HISTOGRAMS/${SPEC}/PDF/${outFile}.pdf" + mv "${outFile}.root" "../HISTOGRAMS/${SPEC}/ROOT/${outFile}.root" + cd .. + ln -fs ${monRootFile} ${latestMonRootFile} + ln -fs ${monPdfFile} ${latestMonPdfFile} + + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + echo "" + echo "Done analyzing ${SPEC} run ${runNum}." + echo "" + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + + sleep 2 + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + echo "" + echo "Performing pedestal monitoring for COIN ${SPEC} run ${runNum}." + echo "" + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + + sleep 2 + eval ${runPedMon} + mv "${outFilePed}.txt" ${pedMonFile} + + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + + +} 2>&1 | tee "${reportFile}" +2>&1 | tee "${summaryFile}" diff --git a/UTIL/SHELL/run_shms.sh b/UTIL/SHELL/run_shms.sh new file mode 100755 index 0000000000000000000000000000000000000000..5fef81f45e9d00fcc8cfe4b8c07aa0338dd52ec2 --- /dev/null +++ b/UTIL/SHELL/run_shms.sh @@ -0,0 +1,150 @@ +#! /bin/bash + +# Which spectrometer are we analyzing. +spec=${0##*_} +spec=${spec%%.sh} +SPEC=$(echo "$spec" | tr '[:lower:]' '[:upper:]') + +# What is the last run number for the spectrometer. +# The pre-fix zero must be stripped because ROOT is ... well ROOT +lastRun=$( \ + ls raw/"${spec}"_all_*.dat raw/../raw.copiedtotape/"${spec}"_all_*.dat -R 2>/dev/null | perl -ne 'if(/0*(\d+)/) {print "$1\n"}' | sort -n | tail -1 \ +) + +# Which run to analyze. +runNum=$1 +if [ -z "$runNum" ]; then + runNum=$lastRun +fi + +# How many events to analyze. +numEvents=50000 + +# Which scripts to run. +script="SCRIPTS/${SPEC}/PRODUCTION/replay_production_${spec}.C" +config="CONFIG/${SPEC}/PRODUCTION/${spec}_production.cfg" + +# Which commands to run. +runHcana="./hcana -q \"${script}(${runNum}, ${numEvents})\"" +runOnlineGUI="./online -f ${config} -r ${runNum}" +saveOnlineGUI="./online -f ${config} -r ${runNum} -P" +runReportMon="./readout_${spec}.py ${runNum} ${numEvents}" +runPedMon="root -l -q \"UTIL/PEDESTAL_MON/${SPEC}/PRODUCTION/${spec}_ped.C(${runNum}, ${numEvents})\"" + +# Define report monitoring directroy +reportMonDir="UTIL/REPORT_MON/${SPEC}/" + +#Define where to put the REPORT_MON +ReportMon="emacs ../../../REPORT_MONITOR/${SPEC}/reportMonitor_${spec}_production_${runNum}_${numEvents}.txt" + +pathReportMon="../../../REPORT_MONITOR/${SPEC}/reportMonitor_${spec}_production_${runNum}_${numEvents}.txt" + +#Define where to put the PEDESTAL_MON +reportFile="REPORT_OUTPUT/${SPEC}/PRODUCTION/replay_${spec}_production_${runNum}_${numEvents}.txt" +pedMonFile="PEDESTAL_MONITOR/${SPEC}/reportPedestal_${spec}_production_${runNum}_${numEvents}.txt" + +# Name of the replay ROOT file +rootFileDir="./ROOTfiles" +replayFile="${spec}_replay_production_${runNum}" +rootFile="${replayFile}_${numEvents}.root" +latestRootFile="${rootFileDir}/${replayFile}_latest.root" + +# Names of the monitoring file +monRootDir="./HISTOGRAMS/${SPEC}/ROOT" +monPdfDir="./HISTOGRAMS/${SPEC}/PDF" +monRootFile="${spec}_production_${runNum}.root" +monPdfFile="${spec}_production_${runNum}.pdf" +latestMonRootFile="${monRootDir}/${spec}_production_latest.root" +latestMonPdfFile="${monPdfDir}/${spec}_production_latest.pdf" + +# Where to put log. +reportFile="REPORT_OUTPUT/${SPEC}/PRODUCTION/replay_${spec}_production_${runNum}_${numEvents}.txt" +summaryFile="REPORT_OUTPUT/${SPEC}/PRODUCTION/summary_production_${runNum}_${numEvents}.txt" + +# What is base name of onlineGUI output. +outFile="${spec}_production_${runNum}" +outFileMonitor="output" +outFilePed="out${SPEC}" + +# Start analysis and monitoring plots. +{ + echo "" + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + echo "" + date + echo "" + echo "Running ${SPEC} analysis on the run ${runNum}:" + echo " -> SCRIPT: ${script}" + echo " -> RUN: ${runNum}" + echo " -> NEVENTS: ${numEvents}" + echo " -> COMMAND: ${runHcana}" + echo "" + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + + sleep 2 + eval ${runHcana} + + # Link the ROOT file to latest for online monitoring + ln -fs ${rootFile} ${latestRootFile} + + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + echo "" + echo "Running onlineGUI for analyzed ${SPEC} run ${runNum}:" + echo " -> CONFIG: ${config}" + echo " -> RUN: ${runNum}" + echo " -> COMMAND: ${runOnlineGUI}" + echo "" + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + + sleep 2 + cd onlineGUI + eval ${runOnlineGUI} + eval ${saveOnlineGUI} + mv "${outFile}.pdf" "../HISTOGRAMS/${SPEC}/PDF/${outFile}.pdf" + mv "${outFile}.root" "../HISTOGRAMS/${SPEC}/ROOT/${outFile}.root" + cd .. + ln -fs ${monRootFile} ${latestMonRootFile} + ln -fs ${monPdfFile} ${latestMonPdfFile} + + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + echo "" + echo "Done analyzing ${SPEC} run ${runNum}." + echo "" + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + + sleep 2 + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + echo "" + echo "Performing pedestal monitoring for ${SPEC} run ${runNum}." + echo "" + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + + sleep 2 + eval ${runPedMon} + mv "${outFilePed}.txt" ${pedMonFile} + + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + echo "" + echo "Generating report file monitoring data file ${SPEC} run ${runNum}." + echo "" + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + + cd ${reportMonDir} + eval ${runReportMon} + mv "${outFileMonitor}.txt" ${pathReportMon} + eval ${ReportMon} + sleep 2 + + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + echo "" + echo "Done producing report file monitoring data file ${SPEC} run ${runNum}." + echo "" + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + echo "" + echo "So long and thanks for all the fish!" + echo "" + echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" + +} 2>&1 | tee "${reportFile}" +2>&1 | tee "${summaryFile}" diff --git a/full_coin_hms.sh b/full_coin_hms.sh new file mode 120000 index 0000000000000000000000000000000000000000..05528058a089159ae466931985a8a74f2d7ed91b --- /dev/null +++ b/full_coin_hms.sh @@ -0,0 +1 @@ +full_coin_shms.sh \ No newline at end of file diff --git a/full_coin_shms.sh b/full_coin_shms.sh new file mode 120000 index 0000000000000000000000000000000000000000..2fbd67c24b83ff1cdfd46fe23fd98da5a8d92b79 --- /dev/null +++ b/full_coin_shms.sh @@ -0,0 +1 @@ +UTIL/SHELL/full_coin_shms.sh \ No newline at end of file diff --git a/full_hms.sh b/full_hms.sh new file mode 120000 index 0000000000000000000000000000000000000000..36534e0c5ff2144d7b62affd93582c19e2334b17 --- /dev/null +++ b/full_hms.sh @@ -0,0 +1 @@ +full_shms.sh \ No newline at end of file diff --git a/full_shms.sh b/full_shms.sh new file mode 120000 index 0000000000000000000000000000000000000000..77513444fbb6e7f2ce6a78b49352df36599cbddc --- /dev/null +++ b/full_shms.sh @@ -0,0 +1 @@ +UTIL/SHELL/full_shms.sh \ No newline at end of file diff --git a/run_all_shms.sh b/run_all_shms.sh new file mode 120000 index 0000000000000000000000000000000000000000..953985b3303db473d25fb8312fdcaee6c143c963 --- /dev/null +++ b/run_all_shms.sh @@ -0,0 +1 @@ +UTIL/SHELL/run_all_shms.sh \ No newline at end of file diff --git a/run_beancounter.sh b/run_beancounter.sh new file mode 120000 index 0000000000000000000000000000000000000000..7287ee7f614d3cb5c1bac1b510679182c7065640 --- /dev/null +++ b/run_beancounter.sh @@ -0,0 +1 @@ +UTIL/SHELL/run_beancounter.sh \ No newline at end of file diff --git a/run_coin.sh b/run_coin.sh new file mode 120000 index 0000000000000000000000000000000000000000..e3c3aaf1ba34f7cbd7107a5971b2fec819a3f4c3 --- /dev/null +++ b/run_coin.sh @@ -0,0 +1 @@ +UTIL/SHELL/run_coin.sh \ No newline at end of file diff --git a/run_coin_ep.sh b/run_coin_ep.sh new file mode 120000 index 0000000000000000000000000000000000000000..9471e54b7bf06ef671c9f9701150523d68a1e1fd --- /dev/null +++ b/run_coin_ep.sh @@ -0,0 +1 @@ +UTIL/SHELL/run_coin_ep.sh \ No newline at end of file diff --git a/run_coin_hms.sh b/run_coin_hms.sh new file mode 120000 index 0000000000000000000000000000000000000000..e3a3941c7375755d0e824d44b6f1c40e454211ec --- /dev/null +++ b/run_coin_hms.sh @@ -0,0 +1 @@ +run_coin_shms.sh \ No newline at end of file diff --git a/run_coin_monitor.sh b/run_coin_monitor.sh new file mode 120000 index 0000000000000000000000000000000000000000..d16e8ce14796700573c389cdc3dcd8f9ff7d81b7 --- /dev/null +++ b/run_coin_monitor.sh @@ -0,0 +1 @@ +UTIL/SHELL/run_coin_monitor.sh \ No newline at end of file diff --git a/run_coin_shms.sh b/run_coin_shms.sh new file mode 120000 index 0000000000000000000000000000000000000000..75d0b06c2beea4d7c491c33bccd23ad39ab23719 --- /dev/null +++ b/run_coin_shms.sh @@ -0,0 +1 @@ +UTIL/SHELL/run_coin_shms.sh \ No newline at end of file diff --git a/run_hms.sh b/run_hms.sh new file mode 120000 index 0000000000000000000000000000000000000000..b3c278fe18006cbffe9868492262b00f11ef7c3a --- /dev/null +++ b/run_hms.sh @@ -0,0 +1 @@ +run_shms.sh \ No newline at end of file diff --git a/run_shms.sh b/run_shms.sh new file mode 120000 index 0000000000000000000000000000000000000000..9a279130e6f3b4b2dcc31d3026489930dfce3fb5 --- /dev/null +++ b/run_shms.sh @@ -0,0 +1 @@ +UTIL/SHELL/run_shms.sh \ No newline at end of file