From c0afe74096a7fb80f72764fa9fbfe993ddb59f45 Mon Sep 17 00:00:00 2001 From: Hall C Online Analyzer User <brad.hallc-online@swatter.net> Date: Mon, 19 Feb 2018 13:13:53 -0500 Subject: [PATCH] More clean up (#405) * Add utility submodules * Remove UTIL directories since they are now submodules --- .gitmodules | 12 ++ DBASE/COIN/standard.kinematics | 136 ++++++++++++++- UTIL-CT/Bean_counter.C | 265 ----------------------------- UTIL-CT/Bean_counter_carbon.C | 230 ------------------------- UTIL-CT/coin_histo.C | 119 ------------- UTIL-CT/coin_monitor.README | 35 ---- UTIL-CT/coin_monitor_calc.C | 223 ------------------------ UTIL-CT/coin_monitor_calc_batch.sh | 49 ------ UTIL-CT/coin_monitor_graph.C | 149 ---------------- UTIL-CT/coin_monitor_init.C | 26 --- UTIL-OL/PED_MON/hms_coin_ped.C | 155 ----------------- UTIL-OL/PED_MON/hms_ped.C | 151 ---------------- UTIL-OL/PED_MON/shms_coin_ped.C | 155 ----------------- UTIL-OL/PED_MON/shms_ped.C | 149 ---------------- UTIL-OL/REP_MON/readout_hms.py | 38 ----- UTIL-OL/REP_MON/readout_shms.py | 40 ----- UTIL-OL/SCRIPTS/SHELL/run_hms.sh | 1 - UTIL-OL/SCRIPTS/SHELL/run_shms.sh | 172 ------------------- UTIL_CT | 1 + UTIL_F2_XEM | 1 + UTIL_OL | 1 + run_hms.sh | 2 +- run_shms.sh | 2 +- 23 files changed, 151 insertions(+), 1961 deletions(-) create mode 100644 .gitmodules delete mode 100644 UTIL-CT/Bean_counter.C delete mode 100644 UTIL-CT/Bean_counter_carbon.C delete mode 100644 UTIL-CT/coin_histo.C delete mode 100644 UTIL-CT/coin_monitor.README delete mode 100644 UTIL-CT/coin_monitor_calc.C delete mode 100755 UTIL-CT/coin_monitor_calc_batch.sh delete mode 100644 UTIL-CT/coin_monitor_graph.C delete mode 100644 UTIL-CT/coin_monitor_init.C delete mode 100644 UTIL-OL/PED_MON/hms_coin_ped.C delete mode 100644 UTIL-OL/PED_MON/hms_ped.C delete mode 100644 UTIL-OL/PED_MON/shms_coin_ped.C delete mode 100644 UTIL-OL/PED_MON/shms_ped.C delete mode 100755 UTIL-OL/REP_MON/readout_hms.py delete mode 100755 UTIL-OL/REP_MON/readout_shms.py delete mode 120000 UTIL-OL/SCRIPTS/SHELL/run_hms.sh delete mode 100755 UTIL-OL/SCRIPTS/SHELL/run_shms.sh create mode 160000 UTIL_CT create mode 160000 UTIL_F2_XEM create mode 160000 UTIL_OL diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..2804a427 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,12 @@ +[submodule "UTIL_OL"] + path = UTIL_OL + url = https://github.com/JeffersonLab/UTIL_OL + branch = master +[submodule "UTIL_CT"] + path = UTIL_CT + url = https://github.com/JeffersonLab/UTIL_CT + branch = master +[submodule "UTIL_F2_XEM"] + path = UTIL_F2_XEM + url = https://github.com/JeffersonLab/UTIL_F2_XEM + branch = master diff --git a/DBASE/COIN/standard.kinematics b/DBASE/COIN/standard.kinematics index 449f64a6..fd539621 100644 --- a/DBASE/COIN/standard.kinematics +++ b/DBASE/COIN/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 + +#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 \ No newline at end of file diff --git a/UTIL-CT/Bean_counter.C b/UTIL-CT/Bean_counter.C deleted file mode 100644 index 82cbe1b9..00000000 --- a/UTIL-CT/Bean_counter.C +++ /dev/null @@ -1,265 +0,0 @@ -// Filename: Bean_counter.C -// Description: delta, xptar,yptar, ytar distributions for SHMS and HMS and W, Em, Pm and Cointime distributions -// are plotted and the number of good counts are printed out to add to the count of good events. -// Needs runnumber, and if target is "h" or "c" - -void Bean_counter(Int_t runNumber, Int_t targ){ - - //read the input file from data - TString fileNameD = "/net/cdaq/cdaql3data/cdaq/hallc-online/ROOTfiles/" ; - fileNameD += "coin_replay_production_"; //read the root file from data - fileNameD += runNumber; //read the root file from data - fileNameD += "_-1.root"; //read the root file from data - TFile *f1 = new TFile(fileNameD); - TTree *tt = (TTree*)f1->Get("T"); - //get the relevant branch - int nentriesD = tt->GetEntries(); - cout<<"Entries:\t"<<nentriesD<<endl; - TString fileO; - fileO += "HISTOGRAMS/COIN/ROOT/run_"; //read the root file from data - fileO += runNumber; //read the root file from data - fileO += "_hists_coin.root"; //read the root file from data - - //TFile *fout = new TFile(fileO,"RECREATE"); - - gROOT->SetBatch(kTRUE); - - - //make histograms: - TH1D *h_hdelta = new TH1D("h_hdelta","HMS DELTA (%)",100,-12,12); - TH1D *h_hxptar = new TH1D("h_hxptar","HMS XPTAR (rad)",100,-0.1,0.1); - TH1D *h_hyptar = new TH1D("h_hyptar","HMS YPTAR (rad)",100,-0.08,0.08); - TH1D *h_hytar = new TH1D("h_hytar","HMS YTAR (cm)",100,-12.0,12.0); - - TH1D *h_pdelta = new TH1D("h_pdelta","SHMS DELTA (%)",100,-15,15); - TH1D *h_pxptar = new TH1D("h_pxptar","SHMS XPTAR (rad)",100,-0.06,0.06); - TH1D *h_pyptar = new TH1D("h_pyptar","SHMS YPTAR (rad)",100,-0.06,0.06); - TH1D *h_pytar = new TH1D("h_pytar","SHMS YTAR (cm)",100,-12.0,12.0); - - TH1D *h_Emd = new TH1D("h_Emd",Form("Missing Energy (GeV) Run:%d",runNumber),200,-0.15,0.25); - TH1D *h_Wd = new TH1D("h_Wd",Form("W (GeV) Run:%d",runNumber), 150, 0., 2.); - TH1D *h_pmd = new TH1D("h_pmd","Pm (GeV/c)", 100, -0.02, 0.35); - TH1D *h1PcointimeROC1 = new TH1D("SHMS ROC1 Corrected Coin Time","SHMS ROC1 Corrected Coin Time; cointime [ns]", 200, -10, 10); - TH1D *h1PcointimeROC2 = new TH1D("SHMS ROC2 Corrected Coin Time","SHMS ROC2 Corrected Coin Time; cointime [ns]", 200, -10, 10); - - - Double_t HgtrX, HgtrTh, HgtrY, HgtrPh, hdelta, PgtrX, PgtrTh, PgtrY, PgtrPh, pdelta; - Double_t HgtrBetaCalc, PgtrBetaCalc, evtType, PgtrP, HgtrP, PhodStatus, PhodStartTime, PhodfpHitsTime; - Double_t cointime, HhodStatus, HhodStartTime, HhodfpHitsTime, SHMSpartMass, HMSpartMass; - Double_t pkinW, pEm, pPm, modPm, pbeta, hbeta, hcalepr, hcaletot, hcernpe, pcaletot, pcalepr, pcernpe; - Double_t TcoinpTRIG1_ROC1_tdcTimeRaw, TcoinpTRIG4_ROC1_tdcTimeRaw, TcoinpTRIG1_ROC2_tdcTimeRaw; - Double_t TcoinhTRIG1_ROC1_tdcTimeRaw, TcoinhTRIG1_ROC2_tdcTimeRaw, TcoinhTRIG4_ROC1_tdcTimeRaw; - Double_t TcoinhTRIG4_ROC2_tdcTimeRaw, TcoinpTRIG4_ROC2_tdcTimeRaw; - - int cnts=0; - TCut hpdelta; - TCut evtCut; - TCut eBetaCut; - TCut pBetaCut; - TCut cerCut; - TCut calCut; - TCut hodoTimeCut; - TCut Wcut; - TCut Emcut; - TCut Pmcut; - - tt->SetBranchAddress("P.gtr.p", &PgtrP); - tt->SetBranchAddress("H.gtr.p", &HgtrP); - tt->SetBranchAddress("P.gtr.beta", &pbeta); - tt->SetBranchAddress("H.gtr.beta", &hbeta); - tt->SetBranchAddress("H.gtr.dp", &hdelta); - tt->SetBranchAddress("P.gtr.dp", &pdelta); - - tt->SetBranchAddress("P.cal.eprtracknorm", &pcalepr); - tt->SetBranchAddress("P.cal.etottracknorm", &pcaletot); - tt->SetBranchAddress("P.hgcer.npeSum", &pcernpe); - - tt->SetBranchAddress("H.cal.eprtracknorm", &hcalepr); - tt->SetBranchAddress("H.cal.etottracknorm", &hcaletot); - tt->SetBranchAddress("H.cer.npeSum", &hcernpe); - tt->SetBranchAddress("H.kin.primary.W", &pkinW); - if (targ == 1) { - tt->SetBranchAddress("P.kin.secondary.emiss", &pEm); - } - else if (targ == 2){ - tt->SetBranchAddress("P.kin.secondary.emiss_nuc", &pEm); } - - tt->SetBranchAddress("P.kin.secondary.pmiss", &pPm); - - tt->SetBranchAddress("P.hod.goodstarttime", &PhodStatus); - tt->SetBranchAddress("P.hod.starttime", &PhodStartTime); - tt->SetBranchAddress("P.hod.fpHitsTime", &PhodfpHitsTime); - - tt->SetBranchAddress("H.hod.goodstarttime", &HhodStatus); - tt->SetBranchAddress("H.hod.starttime", &HhodStartTime); - tt->SetBranchAddress("H.hod.fpHitsTime", &HhodfpHitsTime); - - tt->SetBranchAddress("H.gtr.x", &HgtrX); - tt->SetBranchAddress("H.gtr.th", &HgtrTh); - tt->SetBranchAddress("H.gtr.y", &HgtrY); - tt->SetBranchAddress("H.gtr.ph", &HgtrPh); - - tt->SetBranchAddress("P.gtr.x", &PgtrX); - tt->SetBranchAddress("P.gtr.th", &PgtrTh); - tt->SetBranchAddress("P.gtr.y", &PgtrY); - tt->SetBranchAddress("P.gtr.ph", &PgtrPh); - - tt->SetBranchAddress("T.coin.pTRIG1_ROC1_tdcTimeRaw", &TcoinpTRIG1_ROC1_tdcTimeRaw); - tt->SetBranchAddress("T.coin.pTRIG4_ROC1_tdcTimeRaw", &TcoinpTRIG4_ROC1_tdcTimeRaw); - tt->SetBranchAddress("T.coin.pTRIG1_ROC2_tdcTimeRaw", &TcoinpTRIG1_ROC2_tdcTimeRaw); - tt->SetBranchAddress("T.coin.pTRIG4_ROC2_tdcTimeRaw", &TcoinpTRIG4_ROC2_tdcTimeRaw); - - tt->SetBranchAddress("T.coin.hTRIG1_ROC1_tdcTimeRaw", &TcoinhTRIG1_ROC1_tdcTimeRaw); - tt->SetBranchAddress("T.coin.hTRIG4_ROC1_tdcTimeRaw", &TcoinhTRIG4_ROC1_tdcTimeRaw); - tt->SetBranchAddress("T.coin.hTRIG1_ROC2_tdcTimeRaw", &TcoinhTRIG1_ROC2_tdcTimeRaw); - tt->SetBranchAddress("T.coin.hTRIG4_ROC2_tdcTimeRaw", &TcoinhTRIG4_ROC2_tdcTimeRaw); - - SHMSpartMass = 0.93827208; // proton mass in GeV/c^2 - HMSpartMass = 0.000510998; // electron mass in GeV/c^2 - hpdelta = "P.gtr.dp > -10 && P.gtr.dp < 10 && H.gtr.dp > -8 && H.gtr.dp < 8"; - eBetaCut = "P.gtr.beta > 0.8 && P.gtr.beta < 1.3"; - pBetaCut = "H.gtr.beta > 0.8 && H.gtr.beta < 1.3"; - cerCut = "P.hgcer.npeSum < 0.1 && H.cer.npeSum > 0.5"; - calCut = "H.cal.etottracknorm > 0.8 && H.cal.etottracknorm < 1.5 && H.cal.eprtracknorm > 0.2"; - hodoTimeCut ="P.hod.goodstarttime == 1 && H.hod.goodstarttime == 1"; - Wcut = "H.kin.primary.W >0.75 && H.kin.primary.W < 1.1"; - - - - TCanvas *canvas1 = new TCanvas("canvas1","canvas1"); - tt->Draw("P.hod.starttime >> SHMShodoStartTime", eBetaCut && pBetaCut && cerCut && calCut && hodoTimeCut); - TH1D *h1PhodoStartTime = (TH1D*)gDirectory->Get("SHMShodoStartTime"); - h1PhodoStartTime->GetXaxis()->SetTitle("SHMS hodo start time [ns]"); - Double_t PhodoStartTimeMean = h1PhodoStartTime->GetMean(); - TCanvas *canvas2 = new TCanvas("canvas2","canvas2"); - tt->Draw("H.hod.starttime >> HMShodoStartTime", eBetaCut && pBetaCut && cerCut && calCut && hodoTimeCut); - TH1D *h1HhodoStartTime = (TH1D*)gDirectory->Get("HMShodoStartTime"); - h1HhodoStartTime->GetXaxis()->SetTitle("HMS hodo start time [ns]"); - Double_t HhodoStartTimeMean = h1HhodoStartTime->GetMean(); - - - Double_t pOffset = 1.5; //9.5 + 10; // in ns - Double_t hOffset = 335; - Double_t speedOfLight = 29.9792; // in cm/ns - Double_t SHMScentralPathLen = 18.1*100; // SHMS Target to focal plane path length converted to cm - Double_t SHMSpathLength = 18.1*100; // For now assume that it's same as SHMScentralPathLen - Double_t HMScentralPathLen = 22*100; // HMS Target to focal plane path length converted to cm - Double_t DeltaHMSpathLength; // For now assume that it's same as HMScentralPathLen - Double_t SHMScoinCorr = 0.0; - Double_t HMScoinCorr = 0.0; - Double_t SHMSrawCoinTimeROC1; - Double_t SHMSrawCoinTimeROC2; - Double_t HMSrawCoinTimeROC1; - Double_t HMSrawCoinTimeROC2; - - Double_t SHMScorrCoinTimeROC1; - Double_t SHMScorrCoinTimeROC2; - Double_t HMScorrCoinTimeROC1; - Double_t HMScorrCoinTimeROC2; - - for (int kk=0; kk<nentriesD; kk++){ - tt->GetEntry(kk); - if (kk % 50000 == 0) cout << kk*100/nentriesD << " % of data done" << endl; - evtType = tt->GetLeaf("fEvtHdr.fEvtType")->GetValue(); - if (pbeta>0.6 && pbeta<1.4 && hbeta>0.8 && hbeta<1.2 && hcernpe>0. && hcaletot >0.6 && hcaletot<2.0 && PhodStatus == 1 && HhodStatus ==1 && hdelta > -10 && hdelta < 10 && pdelta > -15 && pdelta < 15 && pcernpe < 0.1) - { - DeltaHMSpathLength = 12.462*HgtrTh + 0.1138*HgtrTh*HgtrX - 0.0154*HgtrX - 72.292*HgtrTh*HgtrTh - 0.0000544*HgtrX*HgtrX - 116.52*HgtrPh*HgtrPh; - PgtrBetaCalc = PgtrP/sqrt(PgtrP*PgtrP + SHMSpartMass*SHMSpartMass); - HgtrBetaCalc = HgtrP/sqrt(HgtrP*HgtrP + HMSpartMass*HMSpartMass); - SHMScoinCorr = SHMScentralPathLen / (speedOfLight*PgtrBetaCalc) + (SHMSpathLength - SHMScentralPathLen) / speedOfLight*PgtrBetaCalc + (PhodoStartTimeMean - PhodfpHitsTime); - HMScoinCorr = HMScentralPathLen / (speedOfLight*HgtrBetaCalc) + DeltaHMSpathLength / speedOfLight*HgtrBetaCalc + (HhodoStartTimeMean - HhodfpHitsTime); - SHMScorrCoinTimeROC1 = (TcoinpTRIG1_ROC1_tdcTimeRaw*0.1 - SHMScoinCorr) - (TcoinpTRIG4_ROC1_tdcTimeRaw*0.1 - HMScoinCorr) - pOffset; // 0.1 to convert to ns - SHMScorrCoinTimeROC2 = (TcoinpTRIG1_ROC2_tdcTimeRaw*0.1 - SHMScoinCorr) - (TcoinpTRIG4_ROC2_tdcTimeRaw*0.1 - HMScoinCorr) - pOffset; - h1PcointimeROC1->Fill(SHMScorrCoinTimeROC1); - h1PcointimeROC2->Fill(SHMScorrCoinTimeROC2); - if (targ == 1) - { - if (pkinW > 0.75 && pkinW < 1.15) - { - h_hdelta->Fill(hdelta); - h_hxptar->Fill(HgtrPh); - h_hyptar->Fill(HgtrTh); - h_hytar->Fill(HgtrY); - h_pdelta->Fill(pdelta); - h_pxptar->Fill(PgtrPh); - h_pyptar->Fill(PgtrTh); - h_pytar->Fill(PgtrY); - h_Emd->Fill(pEm+0.025); - h_Wd->Fill(pkinW); - h_pmd->Fill(pPm-0.04); - cnts++; - } - } - else if (targ == 2) - { - if (sqrt(pPm*pPm) < 0.6) - { - h_hdelta->Fill(hdelta); - h_hxptar->Fill(HgtrPh); - h_hyptar->Fill(HgtrTh); - h_hytar->Fill(HgtrY); - h_pdelta->Fill(pdelta); - h_pxptar->Fill(PgtrPh); - h_pyptar->Fill(PgtrTh); - h_pytar->Fill(PgtrY); - h_Emd->Fill(pEm); - h_Wd->Fill(pkinW); - modPm = sqrt(pPm*pPm); - h_pmd->Fill(modPm); - cnts++; - } - } - } - - } - - - - gROOT->SetBatch(kFALSE); - - TCanvas *can1 = new TCanvas ("can1","can1"); - can1->Divide(4,2); - - can1->cd(1); - h_hdelta->Draw(); - can1->cd(2); - h_hxptar->Draw(); - can1->cd(3); - h_hyptar->Draw(); - can1->cd(4); - h_hytar->Draw(); - can1->cd(5); - h_pdelta->Draw(); - can1->cd(6); - h_pxptar->Draw(); - can1->cd(7); - h_pyptar->Draw(); - can1->cd(8); - h_pytar->Draw(); - // can1->SaveAs("tmp1.pdf"); - - TCanvas *can2 = new TCanvas ("can2",Form("can2 Run: %d",runNumber)); - can2->Divide(2,2); - can2->cd(1); - h_Wd->SetFillColor(kBlue); - h_Wd->Draw(); - can2->cd(2); - h_Emd->SetFillColor(kBlue); - h_Emd->Draw(); - can2->cd(3); - h_pmd->SetFillColor(kBlue); - h_pmd->Draw(); - can2->cd(4); - h1PcointimeROC1->SetLineColor(kBlue); - h1PcointimeROC1->SetLineWidth(3); - h1PcointimeROC1->Draw(); - - // can2->SaveAs("tmp.pdf"); - - //fout->Write(); - // fout->Close(); - cout << "-------------------------------------------------------------------------------------------------------" << endl; - cout << "NOTE:>>>> " << cnts <<" <<<<< GOOD EVENTS have passed all cuts (update the white board and excel sheet)" << endl; - cout << "-------------------------------------------------------------------------------------------------------" << endl; - -} diff --git a/UTIL-CT/Bean_counter_carbon.C b/UTIL-CT/Bean_counter_carbon.C deleted file mode 100644 index a19eaee7..00000000 --- a/UTIL-CT/Bean_counter_carbon.C +++ /dev/null @@ -1,230 +0,0 @@ -// Filename: Bean_counter_carbon.C -// Description: delta, xptar,yptar, ytar distributions for SHMS and HMS and W, Em, Pm and Cointime distributions -// are plotted and the number of good counts are printed out to add to the count of good events. -// Needs runnumber, - -void Bean_counter_carbon(Int_t runNumber){ - - //read the input file from data - TString fileNameD = "/net/cdaq/cdaql3data/cdaq/hallc-online/ROOTfiles/" ; - fileNameD += "coin_replay_production_"; //read the root file from data - fileNameD += runNumber; //read the root file from data - fileNameD += "_-1.root"; //read the root file from data - TFile *f1 = new TFile(fileNameD); - TTree *tt = (TTree*)f1->Get("T"); - //get the relevant branch - int nentriesD = tt->GetEntries(); - cout<<"Entries:\t"<<nentriesD<<endl; - TString fileO; - fileO += "HISTOGRAMS/COIN/ROOT/run_"; //read the root file from data - fileO += runNumber; //read the root file from data - fileO += "_hists_coin.root"; //read the root file from data - - //TFile *fout = new TFile(fileO,"RECREATE"); - - gROOT->SetBatch(kTRUE); - - - //make histograms: - TH1D *h_hdelta = new TH1D("h_hdelta","HMS DELTA (%)",100,-12,12); - TH1D *h_hxptar = new TH1D("h_hxptar","HMS XPTAR (rad)",100,-0.1,0.1); - TH1D *h_hyptar = new TH1D("h_hyptar","HMS YPTAR (rad)",100,-0.08,0.08); - TH1D *h_hytar = new TH1D("h_hytar","HMS YTAR (cm)",100,-12.0,12.0); - - TH1D *h_pdelta = new TH1D("h_pdelta","SHMS DELTA (%)",100,-12,12); - TH1D *h_pxptar = new TH1D("h_pxptar","SHMS XPTAR (rad)",100,-0.06,0.06); - TH1D *h_pyptar = new TH1D("h_pyptar","SHMS YPTAR (rad)",100,-0.06,0.06); - TH1D *h_pytar = new TH1D("h_pytar","SHMS YTAR (cm)",100,-12.0,12.0); - - TH1D *h_Emd = new TH1D("h_Emd","Missing Energy (GeV)",200,-0.2,0.2); - TH1D *h_Wd = new TH1D("h_Wd","W (GeV)", 150, 0, 2); - TH1D *h_pmd = new TH1D("h_pmd","Pm (GeV/c)", 100, -0.2, 0.2); - TH1D *h1PcointimeROC1 = new TH1D("SHMS ROC1 Corrected Coin Time","SHMS ROC1 Corrected Coin Time; cointime [ns]", 200, -10, 10); - TH1D *h1PcointimeROC2 = new TH1D("SHMS ROC2 Corrected Coin Time","SHMS ROC2 Corrected Coin Time; cointime [ns]", 200, -10, 10); - - - Double_t HgtrX, HgtrTh, HgtrY, HgtrPh, hdelta, PgtrX, PgtrTh, PgtrY, PgtrPh, pdelta;// Ep, Epp, p_e, p_p, defEm; - Double_t HgtrBetaCalc, PgtrBetaCalc, evtType, PgtrP, HgtrP, PhodStatus, PhodStartTime, PhodfpHitsTime; - Double_t cointime, HhodStatus, HhodStartTime, HhodfpHitsTime, SHMSpartMass, HMSpartMass; - Double_t pkinW, pEm, pPm, pbeta, hbeta, hcalepr, hcaletot, hcernpe, pcaletot, pcalepr, pcernpe; - Double_t TcoinpTRIG1_ROC1_tdcTimeRaw, TcoinpTRIG4_ROC1_tdcTimeRaw, TcoinpTRIG1_ROC2_tdcTimeRaw; - Double_t TcoinhTRIG1_ROC1_tdcTimeRaw, TcoinhTRIG1_ROC2_tdcTimeRaw, TcoinhTRIG4_ROC1_tdcTimeRaw; - Double_t TcoinhTRIG4_ROC2_tdcTimeRaw, TcoinpTRIG4_ROC2_tdcTimeRaw; - - int cnts=0; - TCut hpdelta; - TCut evtCut; - TCut eBetaCut; - TCut pBetaCut; - TCut cerCut; - TCut calCut; - TCut hodoTimeCut; - TCut Wcut; - TCut Emcut; - TCut Pmcut; - - tt->SetBranchAddress("P.gtr.p", &PgtrP); - tt->SetBranchAddress("H.gtr.p", &HgtrP); - tt->SetBranchAddress("P.gtr.beta", &pbeta); - tt->SetBranchAddress("H.gtr.beta", &hbeta); - tt->SetBranchAddress("H.gtr.dp", &hdelta); - tt->SetBranchAddress("P.gtr.dp", &pdelta); - - tt->SetBranchAddress("P.cal.eprtracknorm", &pcalepr); - tt->SetBranchAddress("P.cal.etottracknorm", &pcaletot); - tt->SetBranchAddress("P.hgcer.npeSum", &pcernpe); - - tt->SetBranchAddress("H.cal.eprtracknorm", &hcalepr); - tt->SetBranchAddress("H.cal.etottracknorm", &hcaletot); - tt->SetBranchAddress("H.cer.npeSum", &hcernpe); - tt->SetBranchAddress("H.kin.primary.W", &pkinW); - tt->SetBranchAddress("P.kin.secondary.emiss", &pEm); - tt->SetBranchAddress("P.kin.secondary.pmiss", &pPm); - - tt->SetBranchAddress("P.hod.goodstarttime", &PhodStatus); - tt->SetBranchAddress("P.hod.starttime", &PhodStartTime); - tt->SetBranchAddress("P.hod.fpHitsTime", &PhodfpHitsTime); - - tt->SetBranchAddress("H.hod.goodstarttime", &HhodStatus); - tt->SetBranchAddress("H.hod.starttime", &HhodStartTime); - tt->SetBranchAddress("H.hod.fpHitsTime", &HhodfpHitsTime); - - tt->SetBranchAddress("H.gtr.x", &HgtrX); - tt->SetBranchAddress("H.gtr.th", &HgtrTh); - tt->SetBranchAddress("H.gtr.y", &HgtrY); - tt->SetBranchAddress("H.gtr.ph", &HgtrPh); - - tt->SetBranchAddress("P.gtr.x", &PgtrX); - tt->SetBranchAddress("P.gtr.th", &PgtrTh); - tt->SetBranchAddress("P.gtr.y", &PgtrY); - tt->SetBranchAddress("P.gtr.ph", &PgtrPh); - - tt->SetBranchAddress("T.coin.pTRIG1_ROC1_tdcTimeRaw", &TcoinpTRIG1_ROC1_tdcTimeRaw); - tt->SetBranchAddress("T.coin.pTRIG4_ROC1_tdcTimeRaw", &TcoinpTRIG4_ROC1_tdcTimeRaw); - tt->SetBranchAddress("T.coin.pTRIG1_ROC2_tdcTimeRaw", &TcoinpTRIG1_ROC2_tdcTimeRaw); - tt->SetBranchAddress("T.coin.pTRIG4_ROC2_tdcTimeRaw", &TcoinpTRIG4_ROC2_tdcTimeRaw); - - tt->SetBranchAddress("T.coin.hTRIG1_ROC1_tdcTimeRaw", &TcoinhTRIG1_ROC1_tdcTimeRaw); - tt->SetBranchAddress("T.coin.hTRIG4_ROC1_tdcTimeRaw", &TcoinhTRIG4_ROC1_tdcTimeRaw); - tt->SetBranchAddress("T.coin.hTRIG1_ROC2_tdcTimeRaw", &TcoinhTRIG1_ROC2_tdcTimeRaw); - tt->SetBranchAddress("T.coin.hTRIG4_ROC2_tdcTimeRaw", &TcoinhTRIG4_ROC2_tdcTimeRaw); - - SHMSpartMass = 0.93827208; // proton mass in GeV/c^2 - HMSpartMass = 0.000510998; // electron mass in GeV/c^2 - hpdelta = "P.gtr.dp > -10 && P.gtr.dp < 10 && H.gtr.dp > -8 && H.gtr.dp < 8"; - eBetaCut = "P.gtr.beta > 0.8 && P.gtr.beta < 1.3"; - pBetaCut = "H.gtr.beta > 0.8 && H.gtr.beta < 1.3"; - cerCut = "P.hgcer.npeSum < 0.1 && H.cer.npeSum > 0.5"; - calCut = "H.cal.etottracknorm > 0.8 && H.cal.etottracknorm < 1.5 && H.cal.eprtracknorm > 0.2"; - hodoTimeCut ="P.hod.goodstarttime == 1 && H.hod.goodstarttime == 1"; - Wcut = "H.kin.primary.W >0.75 && H.kin.primary.W < 1.1"; - - - - TCanvas *canvas1 = new TCanvas("canvas1","canvas1"); - tt->Draw("P.hod.starttime >> SHMShodoStartTime", eBetaCut && pBetaCut && cerCut && calCut && hodoTimeCut); - TH1D *h1PhodoStartTime = (TH1D*)gDirectory->Get("SHMShodoStartTime"); - h1PhodoStartTime->GetXaxis()->SetTitle("SHMS hodo start time [ns]"); - Double_t PhodoStartTimeMean = h1PhodoStartTime->GetMean(); - TCanvas *canvas2 = new TCanvas("canvas2","canvas2"); - tt->Draw("H.hod.starttime >> HMShodoStartTime", eBetaCut && pBetaCut && cerCut && calCut && hodoTimeCut); - TH1D *h1HhodoStartTime = (TH1D*)gDirectory->Get("HMShodoStartTime"); - h1HhodoStartTime->GetXaxis()->SetTitle("HMS hodo start time [ns]"); - Double_t HhodoStartTimeMean = h1HhodoStartTime->GetMean(); - - - Double_t pOffset = 3.0; //9.5 + 10; // in ns - Double_t hOffset = 335; - Double_t speedOfLight = 29.9792; // in cm/ns - Double_t SHMScentralPathLen = 18.1*100; // SHMS Target to focal plane path length converted to cm - Double_t SHMSpathLength = 18.1*100; // For now assume that it's same as SHMScentralPathLen - Double_t HMScentralPathLen = 22*100; // HMS Target to focal plane path length converted to cm - Double_t DeltaHMSpathLength; // For now assume that it's same as HMScentralPathLen - Double_t SHMScoinCorr = 0.0; - Double_t HMScoinCorr = 0.0; - Double_t SHMSrawCoinTimeROC1; - Double_t SHMSrawCoinTimeROC2; - Double_t HMSrawCoinTimeROC1; - Double_t HMSrawCoinTimeROC2; - - Double_t SHMScorrCoinTimeROC1; - Double_t SHMScorrCoinTimeROC2; - Double_t HMScorrCoinTimeROC1; - Double_t HMScorrCoinTimeROC2; - - for (int kk=0; kk<nentriesD; kk++){ - tt->GetEntry(kk); - if (kk % 50000 == 0) cout << kk*100/nentriesD << " % of data done" << endl; - evtType = tt->GetLeaf("fEvtHdr.fEvtType")->GetValue(); - if (pbeta>0.7 && pbeta<1.5 && hbeta>0.8 && hbeta<1.2 && hcernpe>0 && hcaletot >0.6 && hcaletot<1.5 && PhodStatus == 1 && HhodStatus ==1 && hdelta > -10 && hdelta < 10 && pdelta > -12 && pdelta < 12 && pcernpe < 0.5) - { - DeltaHMSpathLength = 12.462*HgtrTh + 0.1138*HgtrTh*HgtrX - 0.0154*HgtrX - 72.292*HgtrTh*HgtrTh - 0.0000544*HgtrX*HgtrX - 116.52*HgtrPh*HgtrPh; - PgtrBetaCalc = PgtrP/sqrt(PgtrP*PgtrP + SHMSpartMass*SHMSpartMass); - HgtrBetaCalc = HgtrP/sqrt(HgtrP*HgtrP + HMSpartMass*HMSpartMass); - SHMScoinCorr = SHMScentralPathLen / (speedOfLight*PgtrBetaCalc) + (SHMSpathLength - SHMScentralPathLen) / speedOfLight*PgtrBetaCalc + (PhodoStartTimeMean - PhodfpHitsTime); - HMScoinCorr = HMScentralPathLen / (speedOfLight*HgtrBetaCalc) + DeltaHMSpathLength / speedOfLight*HgtrBetaCalc + (HhodoStartTimeMean - HhodfpHitsTime); - SHMScorrCoinTimeROC1 = (TcoinpTRIG1_ROC1_tdcTimeRaw*0.1 - SHMScoinCorr) - (TcoinpTRIG4_ROC1_tdcTimeRaw*0.1 - HMScoinCorr) - pOffset; // 0.1 to convert to ns - SHMScorrCoinTimeROC2 = (TcoinpTRIG1_ROC2_tdcTimeRaw*0.1 - SHMScoinCorr) - (TcoinpTRIG4_ROC2_tdcTimeRaw*0.1 - HMScoinCorr) - pOffset; - h1PcointimeROC1->Fill(SHMScorrCoinTimeROC1); - h1PcointimeROC2->Fill(SHMScorrCoinTimeROC2); - h_hdelta->Fill(hdelta); - h_hxptar->Fill(HgtrPh); - h_hyptar->Fill(HgtrTh); - h_hytar->Fill(HgtrY); - h_pdelta->Fill(pdelta); - h_pxptar->Fill(PgtrPh); - h_pyptar->Fill(PgtrTh); - h_pytar->Fill(PgtrY); - h_Emd->Fill(pEm+0.025); - h_Wd->Fill(pkinW); - h_pmd->Fill(pPm-0.04); - cnts++; - } - - } - - - - gROOT->SetBatch(kFALSE); - - TCanvas *can1 = new TCanvas ("can1","can1"); - can1->Divide(4,2); - - can1->cd(1); - h_hdelta->Draw(); - can1->cd(2); - h_hxptar->Draw(); - can1->cd(3); - h_hyptar->Draw(); - can1->cd(4); - h_hytar->Draw(); - can1->cd(5); - h_pdelta->Draw(); - can1->cd(6); - h_pxptar->Draw(); - can1->cd(7); - h_pyptar->Draw(); - can1->cd(8); - h_pytar->Draw(); - // can1->SaveAs("tmp1.pdf"); - - TCanvas *can2 = new TCanvas ("can2","can2"); - can2->Divide(2,2); - can2->cd(1); - h_Wd->Draw(); - can2->cd(2); - h_Emd->Draw(); - can2->cd(3); - h_pmd->Draw(); - can2->cd(4); - h1PcointimeROC1->Draw(); - - // can2->SaveAs("tmp.pdf"); - - //fout->Write(); - // fout->Close(); - cout << "-------------------------------------------------------------------------------------------------------" << endl; - cout << "NOTE:>>>> " << cnts <<" <<<<< GOOD EVENTS have passed all cuts (update the white board and excel sheet)" << endl; - cout << "-------------------------------------------------------------------------------------------------------" << endl; - -} diff --git a/UTIL-CT/coin_histo.C b/UTIL-CT/coin_histo.C deleted file mode 100644 index 33dc1f0a..00000000 --- a/UTIL-CT/coin_histo.C +++ /dev/null @@ -1,119 +0,0 @@ -// Small code to check the histograms for the coincidence runs - -#include "TFile.h" -#include "TTree.h" -#include "TH1F.h" -#include "TF1.h" -#include "TGraph.h" -#include <fstream> -#include <iostream> -#include <TROOT.h> - - -void - -coin_histo(){ - - Int_t run_NUM ; - cout << "hms_run_NUM "<< endl; - cin >> run_NUM ; - - - TFile *f = new TFile(Form("/net/cdaq/cdaql3data/cdaq/hallc-online/ROOTfiles/coin_replay_production_%d_-1.root",run_NUM),"READ"); // %d : expects integer; %f expects float - - - TTree *T = (TTree*)f->Get("T"); - - - Int_t totev = T->GetEntries(); - cout << totev << endl; - - - // Read the branch - - Double_t HkinQ2; - Double_t HkinW; - Double_t pkinpmiss; - Double_t pkinemiss; - Double_t Hgtrdp; - Double_t Hgtrbeta; - Double_t Pgtrdp; - Double_t Pgtrbeta; - Double_t Hgtrph; - Double_t Hgtrth; - Double_t Hgtry; - Double_t Pgtrph; - Double_t Pgtrth; - Double_t Pgtry; - Double_t hcernpe; - Double_t pcernpe; - Double_t hcalepr; - Double_t hcaletot; - - - - - T->SetBranchAddress("H.kin.primary.Q2", &HkinQ2); - T->SetBranchAddress("H.kin.primary.W", &HkinW); - T->SetBranchAddress("P.kin.secondary.pmiss",&pkinpmiss); - T->SetBranchAddress("P.kin.secondary.emiss",&pkinemiss); - T->SetBranchAddress("H.gtr.dp",&Hgtrdp); - T->SetBranchAddress("H.gtr.beta",&Hgtrbeta); - T->SetBranchAddress("P.gtr.dp",&Pgtrdp); - T->SetBranchAddress("P.gtr.beta",&Pgtrbeta); - T->SetBranchAddress("H.gtr.ph",&Hgtrph); - T->SetBranchAddress("H.gtr.th",&Hgtrth); - T->SetBranchAddress("H.gtr.y",&Hgtry); - T->SetBranchAddress("P.gtr.ph",&Pgtrph); - T->SetBranchAddress("P.gtr.th",&Pgtrth); - T->SetBranchAddress("P.gtr.y",&Pgtry); - T->SetBranchAddress("H.cal.eprtracknorm", &hcalepr); - T->SetBranchAddress("P.hgcer.npeSum", &pcernpe); - T->SetBranchAddress("H.cer.npeSum", &hcernpe); - T->SetBranchAddress("H.cal.etottracknorm", &hcaletot); - - //Creating the histogram - TH1F* hHkinQ2 =new TH1F("HkinQ2","HkinQ2",50,5,15); - TH1F* hHkinW = new TH1F("HkinW","HkinW",50,0,2); - TH1F* hpkinpmiss = new TH1F("pkinpmiss","pkinpmiss",50,-0.2,0.2); - TH1F* hpkinemiss = new TH1F("pkinemiss","pkinemiss",50,-100,100); - TH1F* hHgtrdp = new TH1F("Hgtrdp","Hgtrdp",50,-15,15); - TH1F* hHgtrbeta = new TH1F("Hgtrbeta","hgtrbeta",50,0.5,1.5); - TH1F* hPgtrdp = new TH1F("Pgtrdp","Pgtrdp",100,-15,15); - TH1F* hPgtrbeta= new TH1F("Pgtrbeta","Pgtrbeta",50,0.5,1.5); - TH1F* hHgtrph = new TH1F("Hgtrph","Hgtrph",50,-0.1,0.1); - TH1F* hHgtrth= new TH1F("Hgtrth","Hgtrth",50,-0.1,0.1); - TH1F* hHgtry=new TH1F("Hgtry","Hgtry",50,-10,10); - TH1F* hPgtrph = new TH1F("Pgtrph","Pgtrph",50, -0.1, 0.1); - TH1F* hPgtrth= new TH1F("Pgtrth","Pgtrth",50,-0.1,0.1); - TH1F* hPgtry=new TH1F("Pgtry","Pgtry",50,-10,10); - TH1F* hHcernpe=new TH1F("hcernpe","hcernpe",50,0,20); - TH1F* hPcernpe=new TH1F("pcernpe","pcernpe",50,0,20); - TH1F* hHcaletot=new TH1F("hcaletot","hcaletot",50,0,2.0); - TH1F* hHcalepr=new TH1F("hcalepr","hcalepr",50,0,2.0); - - //Fill the Histogram - for (Int_t iev = 0 ; iev < totev ;iev ++){ - T->GetEntry(iev); - hHcalepr->Fill(hcalepr); - hHcaletot->Fill(hcaletot); - hHcernpe->Fill(hcernpe); - hPcernpe->Fill(pcernpe); - hHkinQ2 ->Fill(HkinQ2); - hHkinW ->Fill(HkinW); - hpkinpmiss ->Fill(pkinpmiss); - hpkinemiss ->Fill(pkinemiss); - hHgtrdp ->Fill(Hgtrdp); - hHgtrbeta -> Fill(Hgtrbeta); - hPgtrdp -> Fill(Pgtrdp); - hPgtrbeta-> Fill(Pgtrbeta); - hHgtrph -> Fill(Hgtrph); - hHgtrth-> Fill(Hgtrth); - hHgtry->Fill(Hgtry); - hPgtrph->Fill(Pgtrph); - hPgtrth->Fill(Pgtrth); - hPgtry->Fill(Pgtry); - - - } -} diff --git a/UTIL-CT/coin_monitor.README b/UTIL-CT/coin_monitor.README deleted file mode 100644 index 9b7553a4..00000000 --- a/UTIL-CT/coin_monitor.README +++ /dev/null @@ -1,35 +0,0 @@ -These two scripts calculate and plot (vs run number) various quantities -including yield per mC, live time, and efficiencies. These are all -grabbed from report files using awk. This obviously makes STRONG assumptions -about the structure of the template report file, so be careful. - -1) Grab monitored quantities - 1) Run `./hcana SCRIPTS/COIN/MONITOR/coin_monitor_calc.C` - in your hallc_replay directory - 2) Enter run number - 3) Enter index specifying target - - It will warn you if you're overwriting a run already in coin_monitor.root, - but this might be what you want to do! For example, you might have added - something to the macro and need to add the new quantities for old runs. - -2) Plot monitored quantities vs run - 1) Run `./hcana SCRIPTS/COIN/MONITOR/coin_monitor_graph.C` - in your hallc_replay directory - 2) Make sure nothing has fluctuated - - *) If you prefer, you can specify a range of runs to graph - e.g. `.x SCRIPTS/COIN/MONITOR/coin_monitor_graph.C(2185,2191)` - -TROUBLESHOOTING: -If coin_monitor.root gets deleted, you can run coin_monitor_init.C to create an -empty coin_monitor.root. Running this will also overwrite any existing data in -a non-empty coin_monitor.root - -TO-DO: -- Macro to delete a run's data from coin_monitor.root -- Implement kinematic settings (different markers?) -- Save as PDF - -QUESTIONS/CONCERNS: -Email matter@virginia.edu diff --git a/UTIL-CT/coin_monitor_calc.C b/UTIL-CT/coin_monitor_calc.C deleted file mode 100644 index 7644c3e3..00000000 --- a/UTIL-CT/coin_monitor_calc.C +++ /dev/null @@ -1,223 +0,0 @@ -void coin_monitor_calc(Int_t RunNumber = 0, Int_t TargetType = 0, Int_t KinematicsType = 0) -{ - - // Get RunNumber if not provided. - if(RunNumber == 0) { - cout << "Enter a Run Number (-1 to exit): "; - cin >> RunNumber; - if( RunNumber<=0 ) return; - } - - // Get if not provided. - if(TargetType == 0) { - cout << "Enter a target (1=LH2, 2=6% Carbon, 3=dummy, -1 to exit): "; - cin >> TargetType; - if( TargetType<=0 ) return; - } - - // Get KinematicsType if not provided. - //if(KinematicsType == 0) { - // cout << "Enter a kinematics index (see coin_monitor.README; -1 to exit): "; - // cin >> KinematicsType; - // if( KinematicsType<=0 ) return; - //} - - - // ======================================================================== - // A cheat to grab some efficiencies from the report output. - // I'm doing this because I don't know how to access this from the root file - // Note that this makes BIG assumptions about the structure of the template! - // - TString sysOutput; // awk output - TString field; // description in report - TObjArray* stringsPtr; // used in tokenizing - - // report filename - TString reportFile = Form("REPORT_OUTPUT/COIN/PRODUCTION/replay_coin_production_%d_-1.report", RunNumber); - - // awk template for getting value form report - // Assumes value is separated from description by a colon. - // You need to be careful if there are multiple matches in the file. - TString awk_template = "awk -F':' '/%s/{print $2}' %s"; - - // SHMS charge1 ------------------------------------------------------- - field = "SHMS BCM1 Beam Cut Charge"; - sysOutput = gSystem->GetFromPipe(Form(awk_template.Data(), field.Data(), reportFile.Data())); - stringsPtr = sysOutput.Tokenize("\n"); - double pQ_BCM1 = ((TObjString *)(stringsPtr->At(0)))->String().Atof(); - - // SHMS charge2 ------------------------------------------------------- - field = "SHMS BCM2 Beam Cut Charge"; - sysOutput = gSystem->GetFromPipe(Form(awk_template.Data(), field.Data(), reportFile.Data())); - stringsPtr = sysOutput.Tokenize("\n"); - double pQ_BCM2 = ((TObjString *)(stringsPtr->At(0)))->String().Atof(); - - // HMS charge1 -------------------------------------------------------- - field = "HMS BCM1 Beam Cut Charge"; - sysOutput = gSystem->GetFromPipe(Form(awk_template.Data(), field.Data(), reportFile.Data())); - stringsPtr = sysOutput.Tokenize("\n"); - double hQ_BCM1 = ((TObjString *)(stringsPtr->At(0)))->String().Atof(); - - // HMS charge2 -------------------------------------------------------- - field = "HMS BCM1 Beam Cut Charge"; - sysOutput = gSystem->GetFromPipe(Form(awk_template.Data(), field.Data(), reportFile.Data())); - stringsPtr = sysOutput.Tokenize("\n"); - double hQ_BCM2 = ((TObjString *)(stringsPtr->At(0)))->String().Atof(); - - // SHMS N TRIG -------------------------------------------------------- - field = "SHMS Accepted Physics Triggers"; - sysOutput = gSystem->GetFromPipe(Form(awk_template.Data(), field.Data(), reportFile.Data())); - stringsPtr = sysOutput.Tokenize("\n"); - double pN_trig = ((TObjString *)(stringsPtr->At(0)))->String().Atof(); - - // HMS N TRIG --------------------------------------------------------- - field = "HMS Accepted Physics Triggers"; - sysOutput = gSystem->GetFromPipe(Form(awk_template.Data(), field.Data(), reportFile.Data())); - stringsPtr = sysOutput.Tokenize("\n"); - double hN_trig = ((TObjString *)(stringsPtr->At(0)))->String().Atof(); - - - // Yield per mC - double pYield = 1000 * pN_trig / ((pQ_BCM1 + pQ_BCM2)/2.0); - double hYield = 1000 * hN_trig / ((hQ_BCM1 + hQ_BCM2)/2.0); - - // SHMS hadron track efficiency --------------------------------------- - // Assume SHMS is the first match, HMS is the second - field = "HADRON SING FID TRACK EFF"; - sysOutput = gSystem->GetFromPipe(Form(awk_template.Data(), field.Data(), reportFile.Data())); - stringsPtr = sysOutput.Tokenize("\n"); - sysOutput = ((TObjString *)(stringsPtr->At(0)))->String(); // first match - stringsPtr = sysOutput.Tokenize("+-"); // this line has erorr printed as well - double pHadTrackEff = ((TObjString *)(stringsPtr->At(0)))->String().Atof(); - double pHadTrackEffErr = ((TObjString *)(stringsPtr->At(1)))->String().Atof(); - - // HMS electron track efficiency --------------------------------------- - // Assume SHMS is the first match, HMS is the second - field = "E SING FID TRACK EFFIC"; - sysOutput = gSystem->GetFromPipe(Form(awk_template.Data(), field.Data(), reportFile.Data())); - stringsPtr = sysOutput.Tokenize("\n"); - sysOutput = ((TObjString *)(stringsPtr->At(1)))->String(); // second match - stringsPtr = sysOutput.Tokenize("+-"); // this line has erorr printed as well - double hElecTrackEff = ((TObjString *)(stringsPtr->At(0)))->String().Atof(); - double hElecTrackEffErr = ((TObjString *)(stringsPtr->At(1)))->String().Atof(); - - // SHMS and HMS 3/4 trigger efficiency --------------------------------- - // Assume SHMS is the first match, HMS is the second - field = "3_of_4 EFF"; - sysOutput = gSystem->GetFromPipe(Form(awk_template.Data(), field.Data(), reportFile.Data())); - stringsPtr = sysOutput.Tokenize("\n"); - double p3of4Eff = ((TObjString *)(stringsPtr->At(0)))->String().Atof(); - double h3of4Eff = ((TObjString *)(stringsPtr->At(1)))->String().Atof(); - - // Live Time ---------------------------------------------------------- - field = "ROC2 Pre-Scaled Ps6 ROC2 Computer Live Time"; - sysOutput = gSystem->GetFromPipe(Form(awk_template.Data(), field.Data(), reportFile.Data())); - stringsPtr = sysOutput.Tokenize("\n"); - double roc2PS6liveTime = ((TObjString *)(stringsPtr->At(0)))->String().Atof(); - - // ======================================================================== - // Bookkeeping - - // Open old data, copy to new tree. - // We skip if an old datum's run number matches the one the user specified. - TFile* newYieldF = new TFile("ROOTfiles/coin_monitor_new.root", "RECREATE"); - TTree* TY_new = new TTree("Y","coin_monitor tree"); - int run_new, tgt_new, kin_new, pN_trig_new, hN_trig_new; - double pYpc_new, hYpc_new, pQ_new, hQ_new; - double pHadTrackEff_new, pHadTrackEffErr_new, hElecTrackEff_new, hElecTrackEffErr_new; - double p3of4Eff_new, h3of4Eff_new, roc2PS6liveTime_new; - TY_new->Branch("run",&run_new); - TY_new->Branch("tgt",&tgt_new); - TY_new->Branch("kin",&kin_new); - TY_new->Branch("pYpc",&pYpc_new); - TY_new->Branch("hYpc",&hYpc_new); - TY_new->Branch("pN_trig",&pN_trig_new); - TY_new->Branch("hN_trig",&hN_trig_new); - TY_new->Branch("pQ",&pQ_new); - TY_new->Branch("hQ",&hQ_new); - TY_new->Branch("pHadTrackEff",&pHadTrackEff_new); - TY_new->Branch("pHadTrackEffErr",&pHadTrackEffErr_new); - TY_new->Branch("hElecTrackEff",&hElecTrackEff_new); - TY_new->Branch("hElecTrackEffErr",&hElecTrackEffErr_new); - TY_new->Branch("p3of4Eff",&p3of4Eff_new); - TY_new->Branch("h3of4Eff",&h3of4Eff_new); - TY_new->Branch("roc2PS6liveTime",&roc2PS6liveTime_new); - - TFile* yieldF = new TFile("ROOTfiles/coin_monitor.root","READ"); - TTree* TY_old = (TTree*)yieldF->Get("Y"); - - int run_old, tgt_old, kin_old, pN_trig_old, hN_trig_old; - double pYpc_old, hYpc_old, pQ_old, hQ_old; - double pHadTrackEff_old, pHadTrackEffErr_old, hElecTrackEff_old, hElecTrackEffErr_old; - double p3of4Eff_old, h3of4Eff_old, roc2PS6liveTime_old; - TY_old->SetBranchAddress("run",&run_old); - TY_old->SetBranchAddress("tgt",&tgt_old); - TY_old->SetBranchAddress("kin",&kin_old); - TY_old->SetBranchAddress("pYpc",&pYpc_old); - TY_old->SetBranchAddress("hYpc",&hYpc_old); - TY_old->SetBranchAddress("pN_trig",&pN_trig_old); - TY_old->SetBranchAddress("hN_trig",&hN_trig_old); - TY_old->SetBranchAddress("pQ",&pQ_old); - TY_old->SetBranchAddress("hQ",&hQ_old); - TY_old->SetBranchAddress("pHadTrackEff",&pHadTrackEff_old); - TY_old->SetBranchAddress("pHadTrackEffErr",&pHadTrackEffErr_old); - TY_old->SetBranchAddress("hElecTrackEff",&hElecTrackEff_old); - TY_old->SetBranchAddress("hElecTrackEffErr",&hElecTrackEffErr_old); - TY_old->SetBranchAddress("p3of4Eff",&p3of4Eff_old); - TY_old->SetBranchAddress("h3of4Eff",&h3of4Eff_old); - TY_old->SetBranchAddress("roc2PS6liveTime",&roc2PS6liveTime_old); - - newYieldF->cd(); - for (int i=0; i<TY_old->GetEntries(); i++) { - TY_old->GetEntry(i); - - // Skip if matches user specified run - if (run_old == RunNumber) { - cout << "WARNING: Overwriting run " << RunNumber << endl; - continue; - } - - run_new = run_old; - tgt_new = tgt_old; - kin_new = kin_old; - pYpc_new = pYpc_old; - hYpc_new = hYpc_old; - pN_trig_new = pN_trig_old; - hN_trig_new = pN_trig_old; - pQ_new = pQ_old; - hQ_new = hQ_old; - pHadTrackEff_new = pHadTrackEff_old; - pHadTrackEffErr_new = pHadTrackEffErr_old; - hElecTrackEff_new = hElecTrackEff_old; - hElecTrackEffErr_new = hElecTrackEffErr_old; - p3of4Eff_new = p3of4Eff_old; - h3of4Eff_new = h3of4Eff_old; - roc2PS6liveTime_new = roc2PS6liveTime_old; - - TY_new->Fill(); - } - - // Add user specified run - run_new = RunNumber; - tgt_new = TargetType; - kin_new = KinematicsType; - pYpc_new = pYield; - hYpc_new = hYield; - pN_trig_new = pN_trig; - hN_trig_new = hN_trig; - pQ_new = ((pQ_BCM1 + pQ_BCM2)/2.0) / 1000.0; - hQ_new = ((hQ_BCM1 + hQ_BCM2)/2.0) / 1000.0; - pHadTrackEff_new = pHadTrackEff; - pHadTrackEffErr_new = pHadTrackEffErr; - hElecTrackEff_new = hElecTrackEff; - hElecTrackEffErr_new = hElecTrackEffErr; - p3of4Eff_new = p3of4Eff; - h3of4Eff_new = h3of4Eff; - roc2PS6liveTime_new = roc2PS6liveTime; - TY_new->Fill(); - - // Rename new root file to old one - newYieldF->Write(); - newYieldF->Close(); - gSystem->Exec("mv ROOTfiles/coin_monitor_new.root ROOTfiles/coin_monitor.root"); -} diff --git a/UTIL-CT/coin_monitor_calc_batch.sh b/UTIL-CT/coin_monitor_calc_batch.sh deleted file mode 100755 index ce0e053a..00000000 --- a/UTIL-CT/coin_monitor_calc_batch.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash -echo Creating blank coin_monitor.root -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_init.C" - -# Hydrogen -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2278,1)" -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2279,1)" -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2280,1)" -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2281,1)" -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2283,1)" - -# Carbon -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2284,2)" -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2285,2)" -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2286,2)" -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2290,2)" -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2291,2)" -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2292,2)" -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2293,2)" -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2294,2)" -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2295,2)" -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2296,2)" -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2297,2)" -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2298,2)" -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2299,2)" -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2300,2)" -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2301,2)" -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2303,2)" -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2304,2)" -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2305,2)" -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2306,2)" -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2308,2)" -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2309,2)" -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2310,2)" -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2311,2)" -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2312,2)" -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2313,2)" -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2314,2)" -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2315,2)" -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2316,2)" -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2317,2)" -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2318,2)" -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2319,2)" -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2320,2)" -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2321,2)" -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2322,2)" -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2323,2)" -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2324,2)" -./hcana -q "SCRIPTS/COIN/MONITOR/coin_monitor_calc.C(2325,2)" diff --git a/UTIL-CT/coin_monitor_graph.C b/UTIL-CT/coin_monitor_graph.C deleted file mode 100644 index d3885af2..00000000 --- a/UTIL-CT/coin_monitor_graph.C +++ /dev/null @@ -1,149 +0,0 @@ -void coin_monitor_graph(int runMin = -1, int runMax = -1) { - TFile* yieldF = new TFile("ROOTfiles/coin_monitor.root","READ"); - TTree* TY=(TTree*)yieldF->Get("Y"); - - //gStyle->SetOptTitle(kFALSE); - gStyle->SetPalette(1); - TVirtualPad *pad; - - TCanvas* c = new TCanvas("c", "Coincidence monitoring", 1024, 640); - c->Divide(2,2); - - // Get min and max run number - // If user specifies -1 for min||max, we use the min||max in coin_monitor.root - // These are also the defaults - Y->Draw("run>>htemp","","goff"); - if (runMin==-1) { - runMin = htemp->GetXaxis()->GetXmin() - 5; - } - if (runMax==-1) { - runMax = htemp->GetXaxis()->GetXmax() + 5; - } - - // ============================================= - // YIELD - pad = c->cd(1); - - TCut hCut = "tgt==1"; - Y->Draw("run:pYpc:(sqrt(pN_trig)/pQ)",hCut,"goff"); - TGraphErrors* gHydrogen = new TGraphErrors(Y->GetEntries(),Y->GetV1(),Y->GetV2(),0,Y->GetV3()); - - TCut cCut = "tgt==2"; - Y->Draw("run:pYpc:(sqrt(pN_trig)/pQ)",cCut,"goff"); - TGraphErrors* gCarbon = new TGraphErrors(Y->GetEntries(),Y->GetV1(),Y->GetV2(),0,Y->GetV3()); - - //TCut dCut = "tgt==3"; - //Y->Draw("run:pYpc:(sqrt(pN_trig)/pQ)",dCut,"goff"); - //TGraphErrors* gDummy = new TGraphErrors(Y->GetEntries(),Y->GetV1(),Y->GetV2(),0,Y->GetV3()); - - gHydrogen->SetLineColor(46); - gCarbon->SetLineColor(38); - //gDummy->SetLineColor(41); - - - TMultiGraph *mgYield = new TMultiGraph("mgYield", "Coincidence yield per run"); - - mgYield->Add(gHydrogen); - mgYield->Add(gCarbon); - //mgYield->Add(gDummy); - - mgYield->Draw("AP"); - mgYield->GetXaxis()->SetLimits(runMin, runMax); - mgYield->GetXaxis()->SetTitle("Run Number"); - mgYield->GetYaxis()->SetTitle("Yield per mC"); - - TLegend *legYield = new TLegend(0.15, 0.3, 0.35, 0.2); - legYield->SetFillColor(0); - legYield->AddEntry(gHydrogen, "Hydrogen", "lp"); - legYield->AddEntry(gCarbon, "Carbon", "lp"); - //legYield->AddEntry(gDummy, "Dummy", "lp"); - legYield->Draw(); - - - // ============================================= - // LIVE TIME - pad = c->cd(2); - - Y->Draw("run:roc2PS6liveTime","","goff"); - TGraph* gPLive = new TGraph(Y->GetEntries(), Y->GetV1(), Y->GetV2()); - - gPLive->SetTitle("ROC2 PS6 Live Time"); - - gPLive->SetMarkerStyle(22); - gPLive->SetMarkerColor(30); - gPLive->SetMinimum(48); - gPLive->SetMaximum(102); - gPLive->Draw("AP"); - - gPLive->GetXaxis()->SetLimits(runMin, runMax); - gPLive->GetXaxis()->SetTitle("Run Number"); - gPLive->GetYaxis()->SetTitle("Live time"); - - // ============================================= - // 3 of 4 efficiency - pad = c->cd(3); - - Y->Draw("run:p3of4Eff","","goff"); - TGraph* gP3of4 = new TGraph(Y->GetEntries(), Y->GetV1(), Y->GetV2()); - - Y->Draw("run:h3of4Eff","","goff"); - TGraph* gH3of4 = new TGraph(Y->GetEntries(), Y->GetV1(), Y->GetV2()); - - gP3of4->SetMarkerColor(46); - gP3of4->SetMarkerStyle(26); - gH3of4->SetMarkerColor(30); - gH3of4->SetMarkerStyle(32); - - TMultiGraph *mg3of4 = new TMultiGraph("mg3of4", "3 of 4 Efficiency"); - - mg3of4->Add(gP3of4); - mg3of4->Add(gH3of4); - - mg3of4->Draw("AP"); - mg3of4->SetMinimum(0.48); - mg3of4->SetMaximum(1.02); - mg3of4->GetXaxis()->SetLimits(runMin, runMax); - mg3of4->GetXaxis()->SetTitle("Run Number"); - mg3of4->GetYaxis()->SetTitle("3/4 Efficiency"); - - TLegend *leg3of4 = new TLegend(0.15, 0.3, 0.35, 0.2); - leg3of4->SetFillColor(0); - leg3of4->AddEntry(gP3of4, "SHMS 3/4", "p"); - leg3of4->AddEntry(gH3of4, "HMS 3/4", "p"); - leg3of4->Draw(); - - // ============================================= - // PID track efficiency - pad = c->cd(4); - - Y->Draw("run:pHadTrackEff:pHadTrackEffErr","","goff"); - TGraphErrors* gPTrack = new TGraphErrors(Y->GetEntries(),Y->GetV1(),Y->GetV2(),0,Y->GetV3()); - - Y->Draw("run:hElecTrackEff:hElecTrackEffErr","","goff"); - TGraphErrors* gHTrack = new TGraphErrors(Y->GetEntries(),Y->GetV1(),Y->GetV2(),0,Y->GetV3()); - - gPTrack->SetMarkerColor(46); - gPTrack->SetLineColor(46); - gPTrack->SetMarkerStyle(26); - gHTrack->SetMarkerColor(30); - gHTrack->SetLineColor(30); - gHTrack->SetMarkerStyle(32); - - TMultiGraph *mgTrack = new TMultiGraph("mgTrack", "PID Tracking Efficiency"); - mgTrack->Add(gPTrack); - mgTrack->Add(gHTrack); - - mgTrack->Draw("AP"); - mgTrack->SetMinimum(0.48); - mgTrack->SetMaximum(1.02); - mgTrack->GetXaxis()->SetLimits(runMin, runMax); - mgTrack->GetXaxis()->SetTitle("Run Number"); - mgTrack->GetYaxis()->SetTitle("PID Tracking Efficiency"); - - TLegend *legTrack = new TLegend(0.15, 0.3, 0.35, 0.2); - legTrack->SetFillColor(0); - legTrack->AddEntry(gPTrack, "SHMS Hadron", "p"); - legTrack->AddEntry(gHTrack, "HMS Electron", "p"); - legTrack->Draw(); - -} diff --git a/UTIL-CT/coin_monitor_init.C b/UTIL-CT/coin_monitor_init.C deleted file mode 100644 index cea6d96e..00000000 --- a/UTIL-CT/coin_monitor_init.C +++ /dev/null @@ -1,26 +0,0 @@ -{ - TFile* newYieldF = new TFile("ROOTfiles/coin_monitor.root", "RECREATE"); - TTree* TY_new = new TTree("Y","coin_monitor tree"); - int run_new, tgt_new, kin_new, pN_trig_new, hN_trig_new; - double pYpc_new, hYpc_new, pQ_new, hQ_new; - double pHadTrackEff_new, pHadTrackEffErr_new, hElecTrackEff_new, hElecTrackEffErr_new; - double p3of4Eff_new, h3of4Eff_new, roc2PS6liveTime_new; - TY_new->Branch("run",&run_new); - TY_new->Branch("tgt",&tgt_new); - TY_new->Branch("kin",&kin_new); - TY_new->Branch("pYpc",&pYpc_new); - TY_new->Branch("hYpc",&hYpc_new); - TY_new->Branch("pN_trig",&pN_trig_new); - TY_new->Branch("hN_trig",&hN_trig_new); - TY_new->Branch("pQ",&pQ_new); - TY_new->Branch("hQ",&hQ_new); - TY_new->Branch("pHadTrackEff",&pHadTrackEff_new); - TY_new->Branch("pHadTrackEffErr",&pHadTrackEffErr_new); - TY_new->Branch("hElecTrackEff",&hElecTrackEff_new); - TY_new->Branch("hElecTrackEffErr",&hElecTrackEffErr_new); - TY_new->Branch("p3of4Eff",&p3of4Eff_new); - TY_new->Branch("h3of4Eff",&h3of4Eff_new); - TY_new->Branch("roc2PS6liveTime",&roc2PS6liveTime_new); - newYieldF->Write(); - newYieldF->Close(); -} diff --git a/UTIL-OL/PED_MON/hms_coin_ped.C b/UTIL-OL/PED_MON/hms_coin_ped.C deleted file mode 100644 index ae3fcff2..00000000 --- a/UTIL-OL/PED_MON/hms_coin_ped.C +++ /dev/null @@ -1,155 +0,0 @@ -//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])>2.5) // //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 < 2.5----------------"<< endl; - cout<< "------------BUT HERE YOU SEE THE MG VALUE(S) > 2.5-----------------"<<endl; - cout << "-----------------PLEASE CONSULT WITH SHIFT LEADER-----------------" <<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-OL/PED_MON/hms_ped.C b/UTIL-OL/PED_MON/hms_ped.C deleted file mode 100644 index 42a7f9e3..00000000 --- a/UTIL-OL/PED_MON/hms_ped.C +++ /dev/null @@ -1,151 +0,0 @@ -//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])>2.5) // //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 < 2.5----------------"<< endl; - cout<< "------------BUT HERE YOU SEE THE MG VALUE(S) > 2.5-----------------"<<endl; - cout << "-----------------PLEASE CONSULT WITH SHIFT LEADER-----------------" <<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-OL/PED_MON/shms_coin_ped.C b/UTIL-OL/PED_MON/shms_coin_ped.C deleted file mode 100644 index adb5fc24..00000000 --- a/UTIL-OL/PED_MON/shms_coin_ped.C +++ /dev/null @@ -1,155 +0,0 @@ -//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])>2.5) //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 < 2.5----------------"<< endl; - cout<< "------------BUT HERE YOU SEE THE MG VALUE(S) > 2.5-----------------"<<endl; - cout << "-----------------PLEASE CONSULT WITH SHIFT LEADER-----------------" <<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-OL/PED_MON/shms_ped.C b/UTIL-OL/PED_MON/shms_ped.C deleted file mode 100644 index 3794c93d..00000000 --- a/UTIL-OL/PED_MON/shms_ped.C +++ /dev/null @@ -1,149 +0,0 @@ -//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])>2.5) //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 < 2.5----------------"<< endl; - cout<< "------------BUT HERE YOU SEE THE MG VALUE(S) > 2.5-----------------"<<endl; - cout << "-----------------PLEASE CONSULT WITH SHIFT LEADER-----------------" <<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-OL/REP_MON/readout_hms.py b/UTIL-OL/REP_MON/readout_hms.py deleted file mode 100755 index 69095f5d..00000000 --- a/UTIL-OL/REP_MON/readout_hms.py +++ /dev/null @@ -1,38 +0,0 @@ -#!/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 ('4_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])or('Pre-Trigger' 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-OL/REP_MON/readout_shms.py b/UTIL-OL/REP_MON/readout_shms.py deleted file mode 100755 index 6c0e8979..00000000 --- a/UTIL-OL/REP_MON/readout_shms.py +++ /dev/null @@ -1,40 +0,0 @@ -#!/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 ('4_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])or('Pre-Trigger' 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-OL/SCRIPTS/SHELL/run_hms.sh b/UTIL-OL/SCRIPTS/SHELL/run_hms.sh deleted file mode 120000 index b3c278fe..00000000 --- a/UTIL-OL/SCRIPTS/SHELL/run_hms.sh +++ /dev/null @@ -1 +0,0 @@ -run_shms.sh \ No newline at end of file diff --git a/UTIL-OL/SCRIPTS/SHELL/run_shms.sh b/UTIL-OL/SCRIPTS/SHELL/run_shms.sh deleted file mode 100755 index 08f8a238..00000000 --- a/UTIL-OL/SCRIPTS/SHELL/run_shms.sh +++ /dev/null @@ -1,172 +0,0 @@ -#! /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" - -# Define some useful directories -rootFileDir="./ROOTfiles" -monRootDir="./HISTOGRAMS/${SPEC}/ROOT" -monPdfDir="./HISTOGRAMS/${SPEC}/PDF" -reportFileDir="./REPORT_OUTPUT/${SPEC}/PRODUCTION" -reportMonDir="./UTIL-OL/REP_MON" -reportMonOutDir="./MON_OUTPUT/REPORT" -pedMonDir="./UTIL-OL/PED_MON" -pedMonOutDir="./MON_OUTPUT/PED" - -# Name of the pedestal monitoring file -reportMonFile="reportMonitor_${spec}_${runNum}_${numEvents}.txt" -pedMonFile="pedReport_${spec}_${runNum}_${numEvents}.txt" - -# Which commands to run. -runHcana="./hcana -q \"${script}(${runNum}, ${numEvents})\"" -runOnlineGUI="./online -f ${config} -r ${runNum}" -saveOnlineGUI="./online -f ${config} -r ${runNum} -P" -runReportMon="./${reportMonDir}/readout_${spec}.py ${runNum} ${numEvents}" -runPedMon="root -l -q \"${pedMonDir}/${spec}_ped.C(${runNum}, ${numEvents})\"" -openReportMon="emacs ${reportMonOutDir}/${reportMonFile}" - -# Name of the replay ROOT file -replayFile="${spec}_replay_production_${runNum}" -rootFile="${replayFile}_${numEvents}.root" -latestRootFile="${rootFileDir}/${replayFile}_latest.root" - -# Names of the monitoring file -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="${reportFileDir}/replay_${spec}_production_${runNum}_${numEvents}.txt" -summaryFile="${reportFileDir}/summary_production_${runNum}_${numEvents}.txt" - -# What is base name of onlineGUI output. -outFile="${spec}_production_${runNum}" -outFileMonitor="output.txt" -outFilePed="out${SPEC}.txt" - -# Replay out files -replayReport="${reportFileDir}/replayReport_${spec}_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 ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" - - sleep 2 - eval ${runHcana} - - # Link the ROOT file to latest for online monitoring - ln -fs ${rootFile} ${latestRootFile} - - echo "" - echo "" - echo "" - 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 "" - echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" - echo "" - echo "Done analyzing ${SPEC} run ${runNum}." - echo "" - echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" - echo "" - echo "" - echo "" - - sleep 2 - echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" - echo "" - echo "Performing pedestal monitoring for ${SPEC} run ${runNum}." - echo "" - echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" - - sleep 2 - eval ${runPedMon} - mv "${outFilePed}" "${pedMonOutDir}/${pedMonFile}" - - echo "" - echo "" - echo "" - echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" - echo "" - echo "Generating report file monitoring data file ${SPEC} run ${runNum}." - echo "" - echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" - - eval ${runReportMon} - mv "${outFileMonitor}" "${reportMonOutDir}/${reportMonFile}" - eval ${openReportMon} - sleep 2 - - echo "" - echo "" - echo "" - echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" - echo "" - echo "Done producing report file monitoring data file ${SPEC} run ${runNum}." - echo "" - echo ":=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=" - echo "" - echo "" - echo "" - echo "-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|" - echo "" - echo "So long and thanks for all the fish!" - echo "" - echo "-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|" - echo "" - echo "" - echo "" - -} 2>&1 | tee "${replayReport}" diff --git a/UTIL_CT b/UTIL_CT new file mode 160000 index 00000000..74f7d43d --- /dev/null +++ b/UTIL_CT @@ -0,0 +1 @@ +Subproject commit 74f7d43d6536fe55f5beed7e564368be11281e80 diff --git a/UTIL_F2_XEM b/UTIL_F2_XEM new file mode 160000 index 00000000..e73b9002 --- /dev/null +++ b/UTIL_F2_XEM @@ -0,0 +1 @@ +Subproject commit e73b90022cff24a862ddab0faec273fd944be411 diff --git a/UTIL_OL b/UTIL_OL new file mode 160000 index 00000000..ab978be7 --- /dev/null +++ b/UTIL_OL @@ -0,0 +1 @@ +Subproject commit ab978be7640cc3c19aa96228fc0d805ce030d8cc diff --git a/run_hms.sh b/run_hms.sh index 6d640fea..3e1c6b1b 120000 --- a/run_hms.sh +++ b/run_hms.sh @@ -1 +1 @@ -UTIL-OL/SCRIPTS/SHELL/run_shms.sh \ No newline at end of file +UTIL_OL/SCRIPTS/SHELL/run_hms.sh \ No newline at end of file diff --git a/run_shms.sh b/run_shms.sh index 6d640fea..b669af6d 120000 --- a/run_shms.sh +++ b/run_shms.sh @@ -1 +1 @@ -UTIL-OL/SCRIPTS/SHELL/run_shms.sh \ No newline at end of file +UTIL_OL/SCRIPTS/SHELL/run_shms.sh \ No newline at end of file -- GitLab