diff --git a/.gitignore b/.gitignore index b95fc3124e49d320ede6a448b64db97170cdf024..a07d797a1822a9e346c317da492049c7e0a59d69 100644 --- a/.gitignore +++ b/.gitignore @@ -26,4 +26,5 @@ CALIBRATION/shms_cal_calib/pcal_calib_cpp_ACLiC_dict_rdict.pcm CALIBRATION/*/data_files/* CALIBRATION/*/root_files/* onlineGUI/onlineGUI_v1.2.1/onlineDict_rdict.pcm +onlineGUI/onlineGUI_v1.2.1/onlineDict.h diff --git a/MAPS/SCALERS/db_PScalevt.dat b/MAPS/SCALERS/db_PScalevt.dat index 31ec1a5c00112fa3ac9f7177f8ea27feb62de248..c941be4e3ae737eee2a8d9d62cfe4b810bc8a201 100644 --- a/MAPS/SCALERS/db_PScalevt.dat +++ b/MAPS/SCALERS/db_PScalevt.dat @@ -46,6 +46,8 @@ variable 0 7 1 .hod.1x8.posScaler SHMS 1X+ paddle 8 variable 0 7 2 .hod.1x8.posScalerRate SHMS 1X+ paddle 8 variable 3 9 1 .hod.2y11.posScaler SHMS 2y+ paddle 11 variable 3 9 2 .hod.2y11.posScalerRate SHMS 2y+ paddle 11 +variable 7 4 1 .S1XS1Y.scaler SHMS S1T +variable 7 4 2 .S1XS1Y.scalerRate SHMS S1T variable 2 12 1 .hod.2x10.posScaler SHMS 2X+ paddle 10 variable 2 12 2 .hod.2x10.posScalerRate SHMS 2X+ paddle 10 variable 7 27 1 .BCM1.scaler bcm1 @@ -62,8 +64,6 @@ variable 0 17 1 .hod.1x3.negScaler SHMS 1X- paddle 3 variable 0 17 2 .hod.1x3.negScalerRate SHMS 1X- paddle 3 variable 1 29 1 .hod.1y12.posScaler SHMS 1Y+ paddle 12 variable 1 29 2 .hod.1y12.posScalerRate SHMS 1Y+ paddle 12 -variable 7 4 1 .S1XS1y.scaler SHMS S1T -variable 7 4 2 .S1XS1y.scalerRate SHMS S1T variable 1 17 1 .hod.1y3.posScaler SHMS 1Y+ paddle 3 variable 1 17 2 .hod.1y3.posScalerRate SHMS 1Y+ paddle 3 variable 1 1 1 .hod.1y3.negScaler SHMS 1Y- paddle 3 diff --git a/MAPS/SCALERS/make_scaler_db.py b/MAPS/SCALERS/make_scaler_db.py index 259a643cf4567827def4e5ec4fd36541fb6e8d24..ed1ee21d2157fa5519913b2a59b6990663545f6c 100755 --- a/MAPS/SCALERS/make_scaler_db.py +++ b/MAPS/SCALERS/make_scaler_db.py @@ -89,6 +89,5 @@ with open(xscalerMapName, 'r') as fi: print >>fo, 'variable', slot, chan, 1, printHodoName, comment print >>fo, 'variable', slot, chan, 2, printHodoName+'Rate', comment else: - print(printname) print >>fo, 'variable', slot, chan, 1, printname, comment print >>fo, 'variable', slot, chan, 2, printname+'Rate', comment diff --git a/MAPS/SCALERS/scaler.map b/MAPS/SCALERS/scaler.map index 772b95e88f80ef8b098175215bc97db282afdcf5..082eb85a864e63325f0e8be5d38b62c9c3fbcacc 100755 --- a/MAPS/SCALERS/scaler.map +++ b/MAPS/SCALERS/scaler.map @@ -355,7 +355,7 @@ S1X 0 5 7 0 1 SHMS S1X S1Y 0 5 7 1 1 SHMS S1Y S2X 0 5 7 2 1 SHMS S2X S2Y 0 5 7 3 1 SHMS S2Y -S1XS1y 0 5 7 4 1 SHMS S1T +S1XS1Y 0 5 7 4 1 SHMS S1T S2XS2Y 0 5 7 5 1 SHMS S2T Trig 0 5 7 6 1 SHMS T1 ASUM 0 5 7 7 1 SHMS ASUM diff --git a/SCRIPTS/HMS/SCALERS/replay_hms_scalers.C b/SCRIPTS/HMS/SCALERS/replay_hms_scalers.C index f834cb40aed698d84f33fcd76bc808b85e4a8129..9d479b762215871a94bb480587ebd6ea62632f6c 100644 --- a/SCRIPTS/HMS/SCALERS/replay_hms_scalers.C +++ b/SCRIPTS/HMS/SCALERS/replay_hms_scalers.C @@ -23,26 +23,19 @@ void replay_hms_scalers(Int_t RunNumber=0, Int_t MaxEvent=0) { // Add variables to global list. gHcParms->Define("gen_run_number", "Run Number", RunNumber); gHcParms->AddString("g_ctp_database_filename", "DBASE/STD/standard.database"); - // Load varibles from files to global list. gHcParms->Load(gHcParms->GetString("g_ctp_database_filename"), RunNumber); - // g_ctp_parm_filename and g_decode_map_filename should now be defined. gHcParms->Load(gHcParms->GetString("g_ctp_kinematics_filename"), RunNumber); gHcParms->Load(gHcParms->GetString("g_ctp_parm_filename")); gHcParms->Load(gHcParms->GetString("g_ctp_calib_filename")); - // Load params for HMS trigger configuration gHcParms->Load("PARAM/TRIG/thms.param"); // Load the Hall C style detector map gHcDetectorMap = new THcDetectorMap(); - if ( RunNumber > 243) { - gHcDetectorMap->Load("MAPS/HMS/DETEC/hms_stack.map"); - } else { - gHcDetectorMap->Load("MAPS/HMS/DETEC/hms_stack_spring17_run_00001_00243.map"); - } - + gHcDetectorMap->Load("MAPS/HMS/DETEC/STACK/hms_stack.map"); + // Add trigger apparatus THaApparatus* TRG = new THcTrigApp("T", "TRG"); gHaApps->Add(TRG); diff --git a/onlineGUI/Config/kpp.cfg b/onlineGUI/Config/EXAMPLES/kpp.cfg similarity index 100% rename from onlineGUI/Config/kpp.cfg rename to onlineGUI/Config/EXAMPLES/kpp.cfg diff --git a/onlineGUI/Config/standard.cfg b/onlineGUI/Config/EXAMPLES/standard.cfg similarity index 100% rename from onlineGUI/Config/standard.cfg rename to onlineGUI/Config/EXAMPLES/standard.cfg diff --git a/onlineGUI/Config/hms_scaler.cfg b/onlineGUI/Config/SCALERS/hms_scaler.cfg similarity index 92% rename from onlineGUI/Config/hms_scaler.cfg rename to onlineGUI/Config/SCALERS/hms_scaler.cfg index 04b618f06e9835bdab538c677bd4999b3205ffc3..62a27bcdb56b0713e96a218ca743926e3a0a35fb 100644 --- a/onlineGUI/Config/hms_scaler.cfg +++ b/onlineGUI/Config/SCALERS/hms_scaler.cfg @@ -1,14 +1,14 @@ -protorootfile ../ROOTfiles/hms_replay_scalers_XXXXX.root -guicolor lightblue +protorootfile ../ROOTfiles/hms_replay_scalers_XXXXX_10000.root +guicolor orange canvassize 800 800 newpage 2 3 title Trig rates -macro Macros/plot_hms_scalers.C("uhScalTrigh1X","none") -macro Macros/plot_hms_scalers.C("uhScalTrigh1Y","none") -macro Macros/plot_hms_scalers.C("uhScalTrigh2X","none") -macro Macros/plot_hms_scalers.C("uhScalTrigh2Y","none") -macro Macros/plot_hms_scalers.C("uhScalTrigh1Xh1y","none") -macro Macros/plot_hms_scalers.C("uhScalTrighTrig","none") +macro Macros/plot_hms_scalers.C("uhScalTrigS1X","none") +macro Macros/plot_hms_scalers.C("uhScalTrigS1Y","none") +macro Macros/plot_hms_scalers.C("uhScalTrigS2X","none") +macro Macros/plot_hms_scalers.C("uhScalTrigS2Y","none") +macro Macros/plot_hms_scalers.C("uhScalTrigS1XS1Y","none") +macro Macros/plot_hms_scalers.C("uhScalTrigTrig","none") newpage 2 2 title Hod ave rates macro Macros/plot_hms_scalers.C("uhScalHodNeg1x","uhScalHodPos1x") diff --git a/onlineGUI/Config/shms_scaler.cfg b/onlineGUI/Config/SCALERS/shms_scaler.cfg similarity index 90% rename from onlineGUI/Config/shms_scaler.cfg rename to onlineGUI/Config/SCALERS/shms_scaler.cfg index 2617c730405ee3d4996792a61f9cf6bf53bfcec8..e5975fd9578507b5622b1aadedd4e05a2ec1e004 100644 --- a/onlineGUI/Config/shms_scaler.cfg +++ b/onlineGUI/Config/SCALERS/shms_scaler.cfg @@ -1,14 +1,14 @@ -protorootfile ../ROOTfiles/shms_replay_scalers_XXXXX.root -guicolor lightblue +protorootfile ../ROOTfiles/shms_replay_scalers_XXXXX_10000.root +guicolor orange canvassize 800 800 newpage 2 3 title Trig rates -macro Macros/plot_shms_scalers.C("uhScalTrigs1X","none") -macro Macros/plot_shms_scalers.C("uhScalTrigs1Y","none") -macro Macros/plot_shms_scalers.C("uhScalTrigs2X","none") -macro Macros/plot_shms_scalers.C("uhScalTrigs2Y","none") -macro Macros/plot_shms_scalers.C("uhScalTrigs1Xs1y","none") -macro Macros/plot_shms_scalers.C("uhScalTrigsTrig","none") +macro Macros/plot_shms_scalers.C("uhScalTrigS1X","none") +macro Macros/plot_shms_scalers.C("uhScalTrigS1Y","none") +macro Macros/plot_shms_scalers.C("uhScalTrigS2X","none") +macro Macros/plot_shms_scalers.C("uhScalTrigS2Y","none") +macro Macros/plot_shms_scalers.C("uhScalTrigS1XS1Y","none") +macro Macros/plot_shms_scalers.C("uhScalTrigTrig","none") newpage 2 2 title Hod ave rates macro Macros/plot_shms_scalers.C("uhScalHodNeg1x","uhScalHodPos1x") diff --git a/onlineGUI/Config/SHMS/shms_cer_eff.cfg b/onlineGUI/Config/SHMS/CER/shms_cer_eff.cfg similarity index 100% rename from onlineGUI/Config/SHMS/shms_cer_eff.cfg rename to onlineGUI/Config/SHMS/CER/shms_cer_eff.cfg diff --git a/onlineGUI/Config/hmsdc.cfg b/onlineGUI/Config/hmsdc.cfg deleted file mode 100644 index 83f2b1d5c75f3bff8329f1c4266b825509a8ad7e..0000000000000000000000000000000000000000 --- a/onlineGUI/Config/hmsdc.cfg +++ /dev/null @@ -1,43 +0,0 @@ -################################################## -# This is an example configuration file -# for the onlineGUI. -# Documentation for the onlineGUI can be found here: -# http://www.jlab.org/~moffit/onlineGUI/ -# -protorootfile ../ROOTfiles/hms1190_XXXXX.root -#protorootfile ROOTfiles/hadron_XXXXX.root -#goldenrootfile ROOTfiles/hadron_golden.root - -#definecut zerocut BB.tp.e.LA[0]>0 - -# FIRST PAGE -newpage 2 3 # remove logy to make linear scale y-axis -title HMS DC 1 Wiremaps - hdc1x1_wm -nostat - hdc1y1_wm -nostat - hdc1u1_wm -nostat - hdc1v1_wm -nostat - hdc1x2_wm -nostat - hdc1y2_wm -nostat - -newpage 2 3 # remove logy to make linear scale y-axis -title HMS DC 1 Wiremaps v time - hdc1x1_wm_time -nostat -type colz - hdc1y1_wm_time -nostat -type colz - hdc1u1_wm_time -nostat -type colz - hdc1v1_wm_time -nostat -type colz - hdc1x2_wm_time -nostat -type colz - hdc1y2_wm_time -nostat -type colz - -newpage 2 3 # remove logy to make linear scale y-axis -title HMS DC 2 Wiremaps - hdc2x1_wm -nostat - hdc2y1_wm -nostat - hdc2u1_wm -nostat - hdc2v1_wm -nostat - hdc2x2_wm -nostat - hdc2y2_wm -nostat - - - - diff --git a/onlineGUI/Config/rawhmshodo.cfg b/onlineGUI/Config/rawhmshodo.cfg deleted file mode 100755 index 21ec61899bbd7fcfd511f040fd815120ec9af529..0000000000000000000000000000000000000000 --- a/onlineGUI/Config/rawhmshodo.cfg +++ /dev/null @@ -1,243 +0,0 @@ -protorootfile ../ROOTfiles/hhodo_htrig_replay_XXXXX.root -guicolor lightblue -canvassize 1600 800 -newpage 4 4 -title HMS X1+ Raw TDCS -macro Macros/rawdraw.C("uhtdc1x1posTime") -macro Macros/rawdraw.C("uhtdc1x2posTime") -macro Macros/rawdraw.C("uhtdc1x3posTime") -macro Macros/rawdraw.C("uhtdc1x4posTime") -macro Macros/rawdraw.C("uhtdc1x5posTime") -macro Macros/rawdraw.C("uhtdc1x6posTime") -macro Macros/rawdraw.C("uhtdc1x7posTime") -macro Macros/rawdraw.C("uhtdc1x8posTime") -macro Macros/rawdraw.C("uhtdc1x9posTime") -macro Macros/rawdraw.C("uhtdc1x10posTime") -macro Macros/rawdraw.C("uhtdc1x11posTime") -macro Macros/rawdraw.C("uhtdc1x12posTime") -macro Macros/rawdraw.C("uhtdc1x13posTime") -macro Macros/rawdraw.C("uhtdc1x14posTime") -macro Macros/rawdraw.C("uhtdc1x15posTime") -macro Macros/rawdraw.C("uhtdc1x16posTime") -newpage 4 4 -title HMS X1- Raw TDCS -macro Macros/rawdraw.C("uhtdc1x1negTime") -macro Macros/rawdraw.C("uhtdc1x2negTime") -macro Macros/rawdraw.C("uhtdc1x3negTime") -macro Macros/rawdraw.C("uhtdc1x4negTime") -macro Macros/rawdraw.C("uhtdc1x5negTime") -macro Macros/rawdraw.C("uhtdc1x6negTime") -macro Macros/rawdraw.C("uhtdc1x7negTime") -macro Macros/rawdraw.C("uhtdc1x8negTime") -macro Macros/rawdraw.C("uhtdc1x9negTime") -macro Macros/rawdraw.C("uhtdc1x10negTime") -macro Macros/rawdraw.C("uhtdc1x11negTime") -macro Macros/rawdraw.C("uhtdc1x12negTime") -macro Macros/rawdraw.C("uhtdc1x13negTime") -macro Macros/rawdraw.C("uhtdc1x14negTime") -macro Macros/rawdraw.C("uhtdc1x15negTime") -macro Macros/rawdraw.C("uhtdc1x16negTime") -newpage 4 4 -title HMS X1+ Raw ADCS -macro Macros/rawdraw.C("uhadc1x1posPed") -macro Macros/rawdraw.C("uhadc1x2posPed") -macro Macros/rawdraw.C("uhadc1x3posPed") -macro Macros/rawdraw.C("uhadc1x4posPed") -macro Macros/rawdraw.C("uhadc1x5posPed") -macro Macros/rawdraw.C("uhadc1x6posPed") -macro Macros/rawdraw.C("uhadc1x7posPed") -macro Macros/rawdraw.C("uhadc1x8posPed") -macro Macros/rawdraw.C("uhadc1x9posPed") -macro Macros/rawdraw.C("uhadc1x10posPed") -macro Macros/rawdraw.C("uhadc1x11posPed") -macro Macros/rawdraw.C("uhadc1x12posPed") -macro Macros/rawdraw.C("uhadc1x13posPed") -macro Macros/rawdraw.C("uhadc1x14posPed") -macro Macros/rawdraw.C("uhadc1x15posPed") -macro Macros/rawdraw.C("uhadc1x16posPed") -newpage 4 4 -title HMS X1- Raw ADCS -macro Macros/rawdraw.C("uhadc1x1negPed") -macro Macros/rawdraw.C("uhadc1x2negPed") -macro Macros/rawdraw.C("uhadc1x3negPed") -macro Macros/rawdraw.C("uhadc1x4negPed") -macro Macros/rawdraw.C("uhadc1x5negPed") -macro Macros/rawdraw.C("uhadc1x6negPed") -macro Macros/rawdraw.C("uhadc1x7negPed") -macro Macros/rawdraw.C("uhadc1x8negPed") -macro Macros/rawdraw.C("uhadc1x9negPed") -macro Macros/rawdraw.C("uhadc1x10negPed") -macro Macros/rawdraw.C("uhadc1x11negPed") -macro Macros/rawdraw.C("uhadc1x12negPed") -macro Macros/rawdraw.C("uhadc1x13negPed") -macro Macros/rawdraw.C("uhadc1x14negPed") -macro Macros/rawdraw.C("uhadc1x15negPed") -macro Macros/rawdraw.C("uhadc1x16negPed") -newpage 4 4 -title HMS Y1+ Raw TDCS -macro Macros/rawdraw.C("uhtdc1y1posTime") -macro Macros/rawdraw.C("uhtdc1y2posTime") -macro Macros/rawdraw.C("uhtdc1y3posTime") -macro Macros/rawdraw.C("uhtdc1y4posTime") -macro Macros/rawdraw.C("uhtdc1y5posTime") -macro Macros/rawdraw.C("uhtdc1y6posTime") -macro Macros/rawdraw.C("uhtdc1y7posTime") -macro Macros/rawdraw.C("uhtdc1y8posTime") -macro Macros/rawdraw.C("uhtdc1y9posTime") -macro Macros/rawdraw.C("uhtdc1y10posTime") -newpage 4 4 -title HMS Y1- Raw TDCS -macro Macros/rawdraw.C("uhtdc1y1negTime") -macro Macros/rawdraw.C("uhtdc1y2negTime") -macro Macros/rawdraw.C("uhtdc1y3negTime") -macro Macros/rawdraw.C("uhtdc1y4negTime") -macro Macros/rawdraw.C("uhtdc1y5negTime") -macro Macros/rawdraw.C("uhtdc1y6negTime") -macro Macros/rawdraw.C("uhtdc1y7negTime") -macro Macros/rawdraw.C("uhtdc1y8negTime") -macro Macros/rawdraw.C("uhtdc1y9negTime") -macro Macros/rawdraw.C("uhtdc1y10negTime") -newpage 4 4 -title HMS Y1+ Raw ADCS -macro Macros/rawdraw.C("uhadc1y1posPed") -macro Macros/rawdraw.C("uhadc1y2posPed") -macro Macros/rawdraw.C("uhadc1y3posPed") -macro Macros/rawdraw.C("uhadc1y4posPed") -macro Macros/rawdraw.C("uhadc1y5posPed") -macro Macros/rawdraw.C("uhadc1y6posPed") -macro Macros/rawdraw.C("uhadc1y7posPed") -macro Macros/rawdraw.C("uhadc1y8posPed") -macro Macros/rawdraw.C("uhadc1y9posPed") -macro Macros/rawdraw.C("uhadc1y10posPed") -newpage 4 4 -title HMS Y1- Raw ADCS -macro Macros/rawdraw.C("uhadc1y1negPed") -macro Macros/rawdraw.C("uhadc1y2negPed") -macro Macros/rawdraw.C("uhadc1y3negPed") -macro Macros/rawdraw.C("uhadc1y4negPed") -macro Macros/rawdraw.C("uhadc1y5negPed") -macro Macros/rawdraw.C("uhadc1y6negPed") -macro Macros/rawdraw.C("uhadc1y7negPed") -macro Macros/rawdraw.C("uhadc1y8negPed") -macro Macros/rawdraw.C("uhadc1y9negPed") -macro Macros/rawdraw.C("uhadc1y10negPed") -newpage 4 4 -title HMS X2+ Raw TDCS -macro Macros/rawdraw.C("uhtdc2x1posTime") -macro Macros/rawdraw.C("uhtdc2x2posTime") -macro Macros/rawdraw.C("uhtdc2x3posTime") -macro Macros/rawdraw.C("uhtdc2x4posTime") -macro Macros/rawdraw.C("uhtdc2x5posTime") -macro Macros/rawdraw.C("uhtdc2x6posTime") -macro Macros/rawdraw.C("uhtdc2x7posTime") -macro Macros/rawdraw.C("uhtdc2x8posTime") -macro Macros/rawdraw.C("uhtdc2x9posTime") -macro Macros/rawdraw.C("uhtdc2x10posTime") -macro Macros/rawdraw.C("uhtdc2x11posTime") -macro Macros/rawdraw.C("uhtdc2x12posTime") -macro Macros/rawdraw.C("uhtdc2x13posTime") -macro Macros/rawdraw.C("uhtdc2x14posTime") -macro Macros/rawdraw.C("uhtdc2x15posTime") -macro Macros/rawdraw.C("uhtdc2x16posTime") -newpage 4 4 -title HMS X2- Raw TDCS -macro Macros/rawdraw.C("uhtdc2x1negTime") -macro Macros/rawdraw.C("uhtdc2x2negTime") -macro Macros/rawdraw.C("uhtdc2x3negTime") -macro Macros/rawdraw.C("uhtdc2x4negTime") -macro Macros/rawdraw.C("uhtdc2x5negTime") -macro Macros/rawdraw.C("uhtdc2x6negTime") -macro Macros/rawdraw.C("uhtdc2x7negTime") -macro Macros/rawdraw.C("uhtdc2x8negTime") -macro Macros/rawdraw.C("uhtdc2x9negTime") -macro Macros/rawdraw.C("uhtdc2x10negTime") -macro Macros/rawdraw.C("uhtdc2x11negTime") -macro Macros/rawdraw.C("uhtdc2x12negTime") -macro Macros/rawdraw.C("uhtdc2x13negTime") -macro Macros/rawdraw.C("uhtdc2x14negTime") -macro Macros/rawdraw.C("uhtdc2x15negTime") -macro Macros/rawdraw.C("uhtdc2x16negTime") -newpage 4 4 -title HMS X2+ Raw ADCS -macro Macros/rawdraw.C("uhadc2x1posPed") -macro Macros/rawdraw.C("uhadc2x2posPed") -macro Macros/rawdraw.C("uhadc2x3posPed") -macro Macros/rawdraw.C("uhadc2x4posPed") -macro Macros/rawdraw.C("uhadc2x5posPed") -macro Macros/rawdraw.C("uhadc2x6posPed") -macro Macros/rawdraw.C("uhadc2x7posPed") -macro Macros/rawdraw.C("uhadc2x8posPed") -macro Macros/rawdraw.C("uhadc2x9posPed") -macro Macros/rawdraw.C("uhadc2x10posPed") -macro Macros/rawdraw.C("uhadc2x11posPed") -macro Macros/rawdraw.C("uhadc2x12posPed") -macro Macros/rawdraw.C("uhadc2x13posPed") -macro Macros/rawdraw.C("uhadc2x14posPed") -macro Macros/rawdraw.C("uhadc2x15posPed") -macro Macros/rawdraw.C("uhadc2x16posPed") -newpage 4 4 -title HMS X2- Raw ADCS -macro Macros/rawdraw.C("uhadc2x1negPed") -macro Macros/rawdraw.C("uhadc2x2negPed") -macro Macros/rawdraw.C("uhadc2x3negPed") -macro Macros/rawdraw.C("uhadc2x4negPed") -macro Macros/rawdraw.C("uhadc2x5negPed") -macro Macros/rawdraw.C("uhadc2x6negPed") -macro Macros/rawdraw.C("uhadc2x7negPed") -macro Macros/rawdraw.C("uhadc2x8negPed") -macro Macros/rawdraw.C("uhadc2x9negPed") -macro Macros/rawdraw.C("uhadc2x10negPed") -macro Macros/rawdraw.C("uhadc2x11negPed") -macro Macros/rawdraw.C("uhadc2x12negPed") -macro Macros/rawdraw.C("uhadc2x13negPed") -macro Macros/rawdraw.C("uhadc2x14negPed") -macro Macros/rawdraw.C("uhadc2x15negPed") -macro Macros/rawdraw.C("uhadc2x16negPed") -newpage 4 4 -title HMS Y2+ Raw TDCS -macro Macros/rawdraw.C("uhtdc2y1posTime") -macro Macros/rawdraw.C("uhtdc2y2posTime") -macro Macros/rawdraw.C("uhtdc2y3posTime") -macro Macros/rawdraw.C("uhtdc2y4posTime") -macro Macros/rawdraw.C("uhtdc2y5posTime") -macro Macros/rawdraw.C("uhtdc2y6posTime") -macro Macros/rawdraw.C("uhtdc2y7posTime") -macro Macros/rawdraw.C("uhtdc2y8posTime") -macro Macros/rawdraw.C("uhtdc2y9posTime") -macro Macros/rawdraw.C("uhtdc2y10posTime") -newpage 4 4 -title HMS Y2- Raw TDCS -macro Macros/rawdraw.C("uhtdc2y1negTime") -macro Macros/rawdraw.C("uhtdc2y2negTime") -macro Macros/rawdraw.C("uhtdc2y3negTime") -macro Macros/rawdraw.C("uhtdc2y4negTime") -macro Macros/rawdraw.C("uhtdc2y5negTime") -macro Macros/rawdraw.C("uhtdc2y6negTime") -macro Macros/rawdraw.C("uhtdc2y7negTime") -macro Macros/rawdraw.C("uhtdc2y8negTime") -macro Macros/rawdraw.C("uhtdc2y9negTime") -macro Macros/rawdraw.C("uhtdc2y10negTime") -newpage 4 4 -title HMS Y2+ Raw ADCS -macro Macros/rawdraw.C("uhadc2y1posPed") -macro Macros/rawdraw.C("uhadc2y2posPed") -macro Macros/rawdraw.C("uhadc2y3posPed") -macro Macros/rawdraw.C("uhadc2y4posPed") -macro Macros/rawdraw.C("uhadc2y5posPed") -macro Macros/rawdraw.C("uhadc2y6posPed") -macro Macros/rawdraw.C("uhadc2y7posPed") -macro Macros/rawdraw.C("uhadc2y8posPed") -macro Macros/rawdraw.C("uhadc2y9posPed") -macro Macros/rawdraw.C("uhadc2y10posPed") -newpage 4 4 -title HMS Y2- Raw ADCS -macro Macros/rawdraw.C("uhadc2y1negPed") -macro Macros/rawdraw.C("uhadc2y2negPed") -macro Macros/rawdraw.C("uhadc2y3negPed") -macro Macros/rawdraw.C("uhadc2y4negPed") -macro Macros/rawdraw.C("uhadc2y5negPed") -macro Macros/rawdraw.C("uhadc2y6negPed") -macro Macros/rawdraw.C("uhadc2y7negPed") -macro Macros/rawdraw.C("uhadc2y8negPed") -macro Macros/rawdraw.C("uhadc2y9negPed") -macro Macros/rawdraw.C("uhadc2y10negPed") diff --git a/onlineGUI/Macros/kpp_analysis.C b/onlineGUI/Macros/EXAMPLES/EXAMPLE/kpp_analysis.C similarity index 100% rename from onlineGUI/Macros/kpp_analysis.C rename to onlineGUI/Macros/EXAMPLES/EXAMPLE/kpp_analysis.C diff --git a/onlineGUI/Macros/hodo_efficiency.C b/onlineGUI/Macros/EXAMPLES/hodo_efficiency.C similarity index 100% rename from onlineGUI/Macros/hodo_efficiency.C rename to onlineGUI/Macros/EXAMPLES/hodo_efficiency.C diff --git a/onlineGUI/Macros/overlay.C b/onlineGUI/Macros/EXAMPLES/overlay.C similarity index 100% rename from onlineGUI/Macros/overlay.C rename to onlineGUI/Macros/EXAMPLES/overlay.C diff --git a/onlineGUI/Macros/rawdraw.C b/onlineGUI/Macros/EXAMPLES/rawdraw.C similarity index 100% rename from onlineGUI/Macros/rawdraw.C rename to onlineGUI/Macros/EXAMPLES/rawdraw.C diff --git a/onlineGUI/Macros/gooddraw_2d_hhodo.C b/onlineGUI/Macros/HMS/HODO/gooddraw_2d_hhodo.C similarity index 100% rename from onlineGUI/Macros/gooddraw_2d_hhodo.C rename to onlineGUI/Macros/HMS/HODO/gooddraw_2d_hhodo.C diff --git a/onlineGUI/Macros/rawdraw_2d_hhodo.C b/onlineGUI/Macros/HMS/HODO/rawdraw_2d_hhodo.C similarity index 100% rename from onlineGUI/Macros/rawdraw_2d_hhodo.C rename to onlineGUI/Macros/HMS/HODO/rawdraw_2d_hhodo.C diff --git a/onlineGUI/Macros/rawdraw_hhodo.C b/onlineGUI/Macros/HMS/HODO/rawdraw_hhodo.C similarity index 100% rename from onlineGUI/Macros/rawdraw_hhodo.C rename to onlineGUI/Macros/HMS/HODO/rawdraw_hhodo.C diff --git a/onlineGUI/Macros/SCALERS/plot_hms_scalers.C b/onlineGUI/Macros/SCALERS/plot_hms_scalers.C new file mode 100644 index 0000000000000000000000000000000000000000..ca9f5dd3149313af832478f8d47236fde205e81e --- /dev/null +++ b/onlineGUI/Macros/SCALERS/plot_hms_scalers.C @@ -0,0 +1,289 @@ +// UserScript.C +// +// Helper macro to build additional histograms + +void UserScript() +{ + // + const UInt_t NTRIGS = 6; + const TString trig_names[NTRIGS]={"S1X", "S1Y", "S1XS1Y", "S2X", "S2Y", "Trig"}; + TH1F* hScalTrig[NTRIGS]; + Double_t trig_scal[NTRIGS]; + Double_t trig_ave[NTRIGS]={0,0,0,0,0,0}; + TH1F* hAveTrig; + hAveTrig=new TH1F("AveTrig","Ave Trig Rates ",NTRIGS,0,NTRIGS); + // + const UInt_t NBCMS = 3; + const TString bcm_names[NBCMS] = {"BCM1", "BCM2","Unser"}; + TH1F* hScalBCM[NBCMS]; + TH1F* hCurBCM[NBCMS]; + TH1F* hAveCurBCM; + hAveCurBCM=new TH1F("AveCurBCM","Ave Current ",NBCMS,0,NBCMS); + TH1F* hAveRateBCM; + hAveRateBCM=new TH1F("AveRateBCM","Ave BCM Rate ",NBCMS,0,NBCMS); + Double_t bcm_scal[NBCMS]; + Double_t bcm_cur[NBCMS]; + Double_t bcm_ave_cur[NBCMS]={0.,0.,0.}; + Double_t bcm_ave_rate[NBCMS]={0.,0.,0.}; + Double_t bcm_offset[NBCMS]={250000,250000,393000}; + Double_t bcm_slope[NBCMS]={4500*1.15,4500,4000}; + // + const UInt_t NPLANES = 4; + const TString plane_names[NPLANES] = {"1x", "1y", "2x", "2y"}; + const UInt_t nbars[NPLANES] = {16, 10, 16, 10}; + const UInt_t nbars_low[NPLANES] = {1, 1, 1, 1}; + TH1F* hScalHodNegEv[NPLANES][16]; + TH1F* hScalHodPosEv[NPLANES][16]; + TH1F* hScalHodNeg[NPLANES]; + TH1F* hScalHodPos[NPLANES]; + Double_t hod_scalneg[NPLANES][16]; + Double_t hod_scalpos[NPLANES][16]; + Double_t hod_scalneg_rate[NPLANES][16]; + Double_t hod_scalpos_rate[NPLANES][16]; + Double_t good_bcm=0; + Double_t good_bcm_limit=265000.; + // + TTree *T=(TTree*)gDirectory->Get("TSH"); + Int_t totev=T->GetEntries(); + // totev=400; + // + TString i2dbarname;TString h2dttitle;TString h2dtname;TString list_name; + for(UInt_t ip = 0; ip < NTRIGS; ip++) { + h2dttitle= trig_names[ip]+"; Event Number ; Rate "; + h2dtname="uhScalTrig"+trig_names[ip]; + hScalTrig[ip]= new TH1F(h2dtname,h2dttitle,totev,0,totev); + list_name ="H."+trig_names[ip]+".scalerRate"; + T->SetBranchAddress(list_name,&trig_scal[ip]); + } + // + for(UInt_t ip = 0; ip < NBCMS; ip++) { + h2dttitle= bcm_names[ip]+"; Event Number ; Rate "; + h2dtname="uhScal"+bcm_names[ip]; + hScalBCM[ip]= new TH1F(h2dtname,h2dttitle,totev,0,totev); + h2dttitle= bcm_names[ip]+"; Event Number ; Current "; + h2dtname="uhCur"+bcm_names[ip]; + hCurBCM[ip]= new TH1F(h2dtname,h2dttitle,totev,0,totev); + list_name ="H."+bcm_names[ip]+".scalerRate"; + T->SetBranchAddress(list_name,&bcm_scal[ip]); + } + // + for(UInt_t ip = 0; ip < NPLANES; ip++) { + h2dttitle= "Beam On,Neg"+plane_names[ip]+"; Scintillator Bar ; Ave Rate "; + h2dtname="uhScalHodNeg"+plane_names[ip]; + hScalHodNeg[ip]= new TH1F(h2dtname,h2dttitle,nbars[ip],0.5,nbars[ip]+.5); + h2dttitle= "Beam on,Pos"+plane_names[ip]+"; Scintillator Bar ; Ave Rate "; + h2dtname="uhScalHodPos"+plane_names[ip]; + hScalHodPos[ip]= new TH1F(h2dtname,h2dttitle,nbars[ip],0.5,nbars[ip]+.5); + for(UInt_t ibar = nbars_low[ip]-1; ibar < nbars[ip]; ibar++) { + i2dbarname = Form("%02d",ibar+1); + h2dttitle= "Neg Hod"+plane_names[ip]+i2dbarname+"; Event Number ; Rate "; + h2dtname="uhScalEvHodNeg"+plane_names[ip]+"Pad"+i2dbarname; + hScalHodNegEv[ip][ibar]= new TH1F(h2dtname,h2dttitle,totev,0,totev); + h2dttitle= "Pos Hod"+plane_names[ip]+i2dbarname+"; Event Number ; Rate "; + h2dtname="uhScalEvHodPos"+plane_names[ip]+"Pad"+i2dbarname; + hScalHodPosEv[ip][ibar]= new TH1F(h2dtname,h2dttitle,totev,0,totev); + hod_scalneg_rate[ip][ibar]=0; + hod_scalpos_rate[ip][ibar]=0; + } + } + // + // + for(UInt_t ip = 0; ip < NPLANES; ip++) { + for(UInt_t ibar = nbars_low[ip]-1; ibar < nbars[ip]; ibar++) { + i2dbarname = Form("%d",ibar+1); + list_name ="H.hod."+plane_names[ip]+i2dbarname+".negScalerRate"; + T->SetBranchAddress(list_name,&hod_scalneg[ip][ibar]); + list_name ="H.hod."+plane_names[ip]+i2dbarname+".posScalerRate"; + T->SetBranchAddress(list_name,&hod_scalpos[ip][ibar]); + } + } + // Loop over the events, filling the histograms + // cout << " looping over data " << endl; + for(UInt_t iev = 0; iev < totev; iev++) { + // cout << " iev = " << iev << endl; + // cout << " get entry = " << iev << endl; + T->GetEntry(iev); + // + for(UInt_t ip = 0; ip < NTRIGS; ip++) { + hScalTrig[ip]->SetBinContent(iev,trig_scal[ip]); + if (bcm_scal[0] > good_bcm_limit) trig_ave[ip]+=trig_scal[ip]; + } + // + for(UInt_t ip = 0; ip < NBCMS; ip++) { + hScalBCM[ip]->SetBinContent(iev,bcm_scal[ip]); + bcm_cur[ip]=(bcm_scal[ip]-bcm_offset[ip])/bcm_slope[ip]; + hCurBCM[ip]->SetBinContent(iev,bcm_cur[ip]); + if (bcm_scal[0] > good_bcm_limit) bcm_ave_cur[ip]+=bcm_cur[ip]; + if (bcm_scal[0] > good_bcm_limit) bcm_ave_rate[ip]+=bcm_scal[ip]; + } + if (bcm_scal[0] > good_bcm_limit) good_bcm++; + // + for(UInt_t ip = 0; ip < NPLANES; ip++) { + for(UInt_t ibar = nbars_low[ip]-1; ibar < nbars[ip]; ibar++) { + hScalHodNegEv[ip][ibar]->SetBinContent(iev,hod_scalneg[ip][ibar]); + hScalHodPosEv[ip][ibar]->SetBinContent(iev,hod_scalpos[ip][ibar]); + if (bcm_scal[0] > good_bcm_limit) { + hod_scalneg_rate[ip][ibar]+=hod_scalneg[ip][ibar]; + hod_scalpos_rate[ip][ibar]+=hod_scalpos[ip][ibar]; + } + // cout << ip+1 << " " << ibar+1 << " " << hod_scalneg[ip][ibar]<< " " << hod_scalpos[ip][ibar] << endl; + } + } + // cout << " finish event = " << iev << endl; + } + cout << " Done " << endl; + // calculate average when beam-on + if (good_bcm >0) { + cout << " tot ev = " << totev << " Good BCm events = " << good_bcm << endl; + for(UInt_t ip = 0; ip < NBCMS; ip++) { + hAveCurBCM->SetBinContent(ip,bcm_ave_cur[ip]/good_bcm); + hAveRateBCM->SetBinContent(ip,bcm_ave_rate[ip]/good_bcm); + } + for(UInt_t ip = 0; ip < NTRIGS; ip++) { + hAveTrig->SetBinContent(ip,trig_ave[ip]/good_bcm); + } + for(UInt_t ip = 0; ip < NPLANES; ip++) { + for(UInt_t ibar = nbars_low[ip]-1; ibar < nbars[ip]; ibar++) { + hScalHodNeg[ip]->SetBinContent(ibar+1,hod_scalneg_rate[ip][ibar]/good_bcm); + hScalHodPos[ip]->SetBinContent(ibar+1,hod_scalpos_rate[ip][ibar]/good_bcm); + } + } + } + // + return; +} + + + +void plot_hms_scalers(TString histname,TString histname2) { + const UInt_t NTRIGS = 6; + const TString trig_names[NTRIGS]={"h1X","h1Y","h1Xh1y","h2X","h2Y","hTrig"}; + const UInt_t NPLANES = 4; + const TString plane_names[NPLANES] = {"1x", "1y", "2x", "2y"}; + const TString bar_names[16] = {"Pad01", "Pad02", "Pad03", "Pad04","Pad05", "Pad06", "Pad07", "Pad08","Pad09","Pad10","Pad11", "Pad12", "Pad13", "Pad14","Pad15", "Pad16"}; + const UInt_t nbars[NPLANES] = {16, 10, 16, 10}; + const UInt_t nbars_low[NPLANES] = {1, 1, 1, 1}; + TH1F* h; + TH1F* hh; + TH1F* htrig; + TH1F* hhtrig; + TText* htext; + TText* hhtext; + Double_t aveh=0,avehh=0; + h = (TH1F*) gDirectory->Get(histname); + hh = (TH1F*) gDirectory->Get(histname2); + if(!h) { + UserScript(); + h = (TH1F*) gDirectory->Get(histname); + if(!h) { + cout << "User histogram " << histname << " not found" << endl; + exit(1); + } + if (histname2!="none") { + hh = (TH1F*) gDirectory->Get(histname2); + if(!hh) { + cout << "User histogram " << histname2 << " not found" << endl; + exit(1); + } + } + } + if (histname.Contains("Trig")) { + htrig = (TH1F*) gDirectory->Get("AveTrig"); + } + if (histname2.Contains("Trig")) { + hhtrig = (TH1F*) gDirectory->Get("AveTrig"); + } + for (Int_t ip=0;ip<NTRIGS;ip++) { + if (histname.Contains(trig_names[ip])) aveh=htrig->GetBinContent(ip); + if (histname2.Contains(trig_names[ip])) avehh=hhtrig->GetBinContent(ip); + } + // cout << histname.Contains("adcpeak") << endl; + Double_t maxf=0,max1=0,max2=0; + h->SetStats(0); + h->GetXaxis()->SetTitleOffset(.6); + h->GetXaxis()->SetTitleSize(0.08); + h->GetYaxis()->SetTitleOffset(.6); + h->GetYaxis()->SetTitleSize(0.08); + h->SetMinimum(0); + max1=h->GetBinContent(h->GetMaximumBin()); + if (histname.Contains("uhScalHod")) { + TH1F* h1hod; + TH1F* h2hod; + TString h1title; + TString h2title; + UInt_t ipl_f1=0; + UInt_t ipl_f2=0; + for(UInt_t ipl = 0; ipl < NPLANES; ipl++) { + if (histname.Contains(plane_names[ipl]))ipl_f1 = ipl; + if (histname2.Contains(plane_names[ipl])) ipl_f2=ipl; + } + if (histname.Contains("Neg")) h1title="uhScalHodNeg"+plane_names[ipl_f1]; + if (histname.Contains("Pos")) h1title="uhScalHodPos"+plane_names[ipl_f1]; + if (histname2.Contains("Neg")) h2title="uhScalHodNeg"+plane_names[ipl_f2]; + if (histname2.Contains("Pos")) h2title="uhScalHodPos"+plane_names[ipl_f2]; + h1hod = (TH1F*) gDirectory->Get(h1title); + h2hod = (TH1F*) gDirectory->Get(h2title); + for(UInt_t ibar = nbars_low[ipl_f1]-1; ibar < nbars[ipl_f1]; ibar++) { + if (h1hod) aveh+=h1hod->GetBinContent(ibar+1); + } + for(UInt_t ibar = nbars_low[ipl_f2]-1; ibar < nbars[ipl_f2]; ibar++) { + if (h2hod) avehh+=h2hod->GetBinContent(ibar+1); + } + } + if (histname.Contains("EvHod")) { + TH1F* h1hod; + TH1F* h2hod; + TString h1title; + TString h2title; + TString i2barname; + for(UInt_t ipl = 0; ipl < NPLANES; ipl++) { + for(UInt_t ibar = nbars_low[ipl]-1; ibar < nbars[ipl]; ibar++) { + if (histname.Contains(plane_names[ipl]) && histname.Contains(bar_names[ibar])) { + if (histname.Contains("Neg")) h1title="uhScalHodNeg"+plane_names[ipl]; + if (histname.Contains("Pos")) h1title="uhScalHodPos"+plane_names[ipl]; + h1hod = (TH1F*) gDirectory->Get(h1title); + if (h1hod) aveh=h1hod->GetBinContent(ibar+1); + } + if (histname2.Contains(plane_names[ipl]) && histname2.Contains(bar_names[ibar])) { + if (histname2.Contains("Neg")) h2title="uhScalHodNeg"+plane_names[ipl]; + if (histname2.Contains("Pos")) h2title="uhScalHodPos"+plane_names[ipl]; + h2hod = (TH1F*) gDirectory->Get(h2title); + if (h2hod) avehh=h2hod->GetBinContent(ibar+1); + } + } + } + } + if (histname.Contains("BCM") || histname.Contains("Unser")) { + TH1F* hbcm; + if (histname.Contains("Cur") ) hbcm = (TH1F*) gDirectory->Get("AveCurBCM"); + if (histname.Contains("Scal") ) hbcm = (TH1F*) gDirectory->Get("AveRateBCM"); + if (histname.Contains("BCM1")) aveh=hbcm->GetBinContent(0); + if (histname.Contains("BCM2")) aveh=hbcm->GetBinContent(1); + if (histname.Contains("Unser")) aveh=hbcm->GetBinContent(2); + if (histname2!="none") { + if (histname2.Contains("BCM1")) avehh=hbcm->GetBinContent(0); + if (histname2.Contains("BCM2")) avehh=hbcm->GetBinContent(1); + if (histname2.Contains("Unser")) avehh=hbcm->GetBinContent(2); + } + } + if (hh) max2=hh->GetBinContent(hh->GetMaximumBin()); + maxf=max1*1.2; + if (hh && max2>max1) maxf=max2*1.2; + if (h && !histname.Contains("uhScalHod")) htext = new TText(2,maxf*.95,Form("%s Ave = %7.2f",h->GetTitle(),aveh)); + if (hh && !histname.Contains("uhScalHod")) hhtext = new TText(2,maxf*.90,Form("%s Ave = %7.2f",hh->GetTitle(),avehh)); + if (h && histname.Contains("uhScalHod")) htext = new TText(2,maxf*.95,Form("%s Integral = %7.2f",h->GetTitle(),aveh)); + if (hh && histname.Contains("uhScalHod")) hhtext = new TText(2,maxf*.90,Form("%s Integral = %7.2f",hh->GetTitle(),avehh)); + h->SetMaximum(maxf); + h->Draw("p"); + h->SetMarkerStyle(7); + h->SetMarkerColor(1); + htext->Draw(); + if (hh) { + hh->Draw("p same"); + hh->SetMarkerColor(2); + hh->SetMarkerStyle(7); + hhtext->Draw(); + hhtext->SetTextColor(2); + } +} + diff --git a/onlineGUI/Macros/SCALERS/plot_shms_scalers.C b/onlineGUI/Macros/SCALERS/plot_shms_scalers.C new file mode 100644 index 0000000000000000000000000000000000000000..904db1df62fb074d9fb8c772f443c030875e9c33 --- /dev/null +++ b/onlineGUI/Macros/SCALERS/plot_shms_scalers.C @@ -0,0 +1,288 @@ +// UserScript.C +// +// Helper macro to build additional histograms + +void UserScript() +{ + // + const UInt_t NTRIGS = 6; + const TString trig_names[NTRIGS]={"S1X","S1Y","S1XS1Y","S2X","S2Y","Trig"}; + TH1F* hScalTrig[NTRIGS]; + Double_t trig_scal[NTRIGS]; + Double_t trig_ave[NTRIGS]={0,0,0,0,0,0}; + TH1F* hAveTrig; + hAveTrig=new TH1F("AveTrig","Ave Trig Rates ",NTRIGS,0,NTRIGS); + // + const UInt_t NBCMS = 3; + const TString bcm_names[NBCMS] = {"BCM1", "BCM2","Unser"}; + TH1F* hScalBCM[NBCMS]; + TH1F* hCurBCM[NBCMS]; + TH1F* hAveCurBCM; + hAveCurBCM=new TH1F("AveCurBCM","Ave Current ",NBCMS,0,NBCMS); + TH1F* hAveRateBCM; + hAveRateBCM=new TH1F("AveRateBCM","Ave BCM Rate ",NBCMS,0,NBCMS); + Double_t bcm_scal[NBCMS]; + Double_t bcm_cur[NBCMS]; + Double_t bcm_ave_cur[NBCMS]={0.,0.,0.}; + Double_t bcm_ave_rate[NBCMS]={0.,0.,0.}; + Double_t bcm_offset[NBCMS]={250000,250000,393000}; + Double_t bcm_slope[NBCMS]={4500*1.15,4500,4000}; + // + const UInt_t NPLANES = 4; + const TString plane_names[NPLANES] = {"1x", "1y", "2x", "2y"}; + const UInt_t nbars[NPLANES] = {13, 13, 14, 16}; + const UInt_t nbars_low[NPLANES] = {1, 1, 1, 7}; + TH1F* hScalHodNegEv[NPLANES][16]; + TH1F* hScalHodPosEv[NPLANES][16]; + TH1F* hScalHodNeg[NPLANES]; + TH1F* hScalHodPos[NPLANES]; + Double_t hod_scalneg[NPLANES][16]; + Double_t hod_scalpos[NPLANES][16]; + Double_t hod_scalneg_rate[NPLANES][16]; + Double_t hod_scalpos_rate[NPLANES][16]; + Double_t good_bcm=0; + Double_t good_bcm_limit=260000.; + // + TTree *T=(TTree*)gDirectory->Get("TSP"); + Int_t totev=T->GetEntries(); + totev=400; + // + TString i2dbarname;TString h2dttitle;TString h2dtname;TString list_name; + for(UInt_t ip = 0; ip < NTRIGS; ip++) { + h2dttitle= trig_names[ip]+"; Event Number ; Rate "; + h2dtname="uhScalTrig"+trig_names[ip]; + hScalTrig[ip]= new TH1F(h2dtname,h2dttitle,totev,0,totev); + list_name ="P."+trig_names[ip]+".scalerRate"; + T->SetBranchAddress(list_name,&trig_scal[ip]); + } + // + for(UInt_t ip = 0; ip < NBCMS; ip++) { + h2dttitle= bcm_names[ip]+"; Event Number ; Rate "; + h2dtname="uhScal"+bcm_names[ip]; + hScalBCM[ip]= new TH1F(h2dtname,h2dttitle,totev,0,totev); + h2dttitle= bcm_names[ip]+"; Event Number ; Current "; + h2dtname="uhCur"+bcm_names[ip]; + hCurBCM[ip]= new TH1F(h2dtname,h2dttitle,totev,0,totev); + list_name ="P."+bcm_names[ip]+".scalerRate"; + T->SetBranchAddress(list_name,&bcm_scal[ip]); + } + // + for(UInt_t ip = 0; ip < NPLANES; ip++) { + h2dttitle= "Beam On,Neg"+plane_names[ip]+"; Scintillator Bar ; Ave Rate "; + h2dtname="uhScalHodNeg"+plane_names[ip]; + hScalHodNeg[ip]= new TH1F(h2dtname,h2dttitle,nbars[ip],0.5,nbars[ip]+.5); + h2dttitle= "Beam On,Pos"+plane_names[ip]+"; Scintillator Bar ; Ave Rate "; + h2dtname="uhScalHodPos"+plane_names[ip]; + hScalHodPos[ip]= new TH1F(h2dtname,h2dttitle,nbars[ip],0.5,nbars[ip]+.5); + for(UInt_t ibar = nbars_low[ip]-1; ibar < nbars[ip]; ibar++) { + i2dbarname = Form("%02d",ibar+1); + h2dttitle= "Neg Hod"+plane_names[ip]+i2dbarname+"; Event Number ; Rate "; + h2dtname="uhScalEvHodNeg"+plane_names[ip]+"Pad"+i2dbarname; + hScalHodNegEv[ip][ibar]= new TH1F(h2dtname,h2dttitle,totev,0,totev); + h2dttitle= "Pos Hod"+plane_names[ip]+i2dbarname+"; Event Number ; Rate "; + h2dtname="uhScalEvHodPos"+plane_names[ip]+"Pad"+i2dbarname; + hScalHodPosEv[ip][ibar]= new TH1F(h2dtname,h2dttitle,totev,0,totev); + hod_scalneg_rate[ip][ibar]=0; + hod_scalpos_rate[ip][ibar]=0; + } + } + // + // + for(UInt_t ip = 0; ip < NPLANES; ip++) { + for(UInt_t ibar = nbars_low[ip]-1; ibar < nbars[ip]; ibar++) { + i2dbarname = Form("%d",ibar+1); + list_name ="P.hod."+plane_names[ip]+i2dbarname+".negScalerRate"; + T->SetBranchAddress(list_name,&hod_scalneg[ip][ibar]); + list_name ="P.hod."+plane_names[ip]+i2dbarname+".posScalerRate"; + T->SetBranchAddress(list_name,&hod_scalpos[ip][ibar]); + } + } + // Loop over the events, filling the histograms + // cout << " looping over data " << endl; + for(UInt_t iev = 0; iev < totev; iev++) { + // cout << " iev = " << iev << endl; + // cout << " get entry = " << iev << endl; + T->GetEntry(iev); + // + for(UInt_t ip = 0; ip < NTRIGS; ip++) { + hScalTrig[ip]->SetBinContent(iev,trig_scal[ip]); + if (bcm_scal[0] > good_bcm_limit) trig_ave[ip]+=trig_scal[ip]; + } + // + for(UInt_t ip = 0; ip < NBCMS; ip++) { + hScalBCM[ip]->SetBinContent(iev,bcm_scal[ip]); + bcm_cur[ip]=(bcm_scal[ip]-bcm_offset[ip])/bcm_slope[ip]; + hCurBCM[ip]->SetBinContent(iev,bcm_cur[ip]); + if (bcm_scal[0] > good_bcm_limit) bcm_ave_cur[ip]+=bcm_cur[ip]; + if (bcm_scal[0] > good_bcm_limit) bcm_ave_rate[ip]+=bcm_scal[ip]; + } + if (bcm_scal[0] > good_bcm_limit) good_bcm++; + // + for(UInt_t ip = 0; ip < NPLANES; ip++) { + for(UInt_t ibar = nbars_low[ip]-1; ibar < nbars[ip]; ibar++) { + hScalHodNegEv[ip][ibar]->SetBinContent(iev,hod_scalneg[ip][ibar]); + hScalHodPosEv[ip][ibar]->SetBinContent(iev,hod_scalpos[ip][ibar]); + if (bcm_scal[0] > good_bcm_limit) { + hod_scalneg_rate[ip][ibar]+=hod_scalneg[ip][ibar]; + hod_scalpos_rate[ip][ibar]+=hod_scalpos[ip][ibar]; + } + // cout << ip+1 << " " << ibar+1 << " " << hod_scalneg[ip][ibar]<< " " << hod_scalpos[ip][ibar] << endl; + } + } + // cout << " finish event = " << iev << endl; + } + cout << " Done " << endl; + // calculate average when beam-on + if (good_bcm >0) { + for(UInt_t ip = 0; ip < NBCMS; ip++) { + hAveCurBCM->SetBinContent(ip,bcm_ave_cur[ip]/good_bcm); + hAveRateBCM->SetBinContent(ip,bcm_ave_rate[ip]/good_bcm); + } + for(UInt_t ip = 0; ip < NTRIGS; ip++) { + hAveTrig->SetBinContent(ip,trig_ave[ip]/good_bcm); + } + for(UInt_t ip = 0; ip < NPLANES; ip++) { + for(UInt_t ibar = nbars_low[ip]-1; ibar < nbars[ip]; ibar++) { + hScalHodNeg[ip]->SetBinContent(ibar+1,hod_scalneg_rate[ip][ibar]/good_bcm); + hScalHodPos[ip]->SetBinContent(ibar+1,hod_scalpos_rate[ip][ibar]/good_bcm); + } + } + } + // + return; +} + + + +void plot_shms_scalers(TString histname,TString histname2) { + const UInt_t NTRIGS = 6; + const TString trig_names[NTRIGS]={"s1X","s1Y","s1Xs1y","s2X","s2Y","sTrig"}; + const UInt_t NPLANES = 4; + const TString plane_names[NPLANES] = {"1x", "1y", "2x", "2y"}; + const TString bar_names[16] = {"Pad01", "Pad02", "Pad03", "Pad04","Pad05", "Pad06", "Pad07", "Pad08","Pad09","Pad10","Pad11", "Pad12", "Pad13", "Pad14","Pad15", "Pad16"}; + const UInt_t nbars[NPLANES] = {13, 13, 14, 16}; + const UInt_t nbars_low[NPLANES] = {1, 1, 1, 7}; + TH1F* h; + TH1F* hh; + TH1F* htrig; + TH1F* hhtrig; + TText* htext; + TText* hhtext; + Double_t aveh=0,avehh=0; + h = (TH1F*) gDirectory->Get(histname); + hh = (TH1F*) gDirectory->Get(histname2); + if(!h) { + UserScript(); + h = (TH1F*) gDirectory->Get(histname); + if(!h) { + cout << "User histogram " << histname << " not found" << endl; + exit(1); + } + if (histname2!="none") { + hh = (TH1F*) gDirectory->Get(histname2); + if(!hh) { + cout << "User histogram " << histname2 << " not found" << endl; + exit(1); + } + } + } + if (histname.Contains("Trig")) { + htrig = (TH1F*) gDirectory->Get("AveTrig"); + } + if (histname2.Contains("Trig")) { + hhtrig = (TH1F*) gDirectory->Get("AveTrig"); + } + for (Int_t ip=0;ip<NTRIGS;ip++) { + if (histname.Contains(trig_names[ip])) aveh=htrig->GetBinContent(ip); + if (histname2.Contains(trig_names[ip])) avehh=hhtrig->GetBinContent(ip); + } + // cout << histname.Contains("adcpeak") << endl; + Double_t maxf=0,max1=0,max2=0; + h->SetStats(0); + h->GetXaxis()->SetTitleOffset(.6); + h->GetXaxis()->SetTitleSize(0.08); + h->GetYaxis()->SetTitleOffset(.6); + h->GetYaxis()->SetTitleSize(0.08); + h->SetMinimum(0); + max1=h->GetBinContent(h->GetMaximumBin()); + if (histname.Contains("uhScalHod")) { + TH1F* h1hod; + TH1F* h2hod; + TString h1title; + TString h2title; + UInt_t ipl_f1=0; + UInt_t ipl_f2=0; + for(UInt_t ipl = 0; ipl < NPLANES; ipl++) { + if (histname.Contains(plane_names[ipl]))ipl_f1 = ipl; + if (histname2.Contains(plane_names[ipl])) ipl_f2=ipl; + } + if (histname.Contains("Neg")) h1title="uhScalHodNeg"+plane_names[ipl_f1]; + if (histname.Contains("Pos")) h1title="uhScalHodPos"+plane_names[ipl_f1]; + if (histname2.Contains("Neg")) h2title="uhScalHodNeg"+plane_names[ipl_f2]; + if (histname2.Contains("Pos")) h2title="uhScalHodPos"+plane_names[ipl_f2]; + h1hod = (TH1F*) gDirectory->Get(h1title); + h2hod = (TH1F*) gDirectory->Get(h2title); + for(UInt_t ibar = nbars_low[ipl_f1]-1; ibar < nbars[ipl_f1]; ibar++) { + if (h1hod) aveh+=h1hod->GetBinContent(ibar+1); + } + for(UInt_t ibar = nbars_low[ipl_f2]-1; ibar < nbars[ipl_f2]; ibar++) { + if (h2hod) avehh+=h2hod->GetBinContent(ibar+1); + } + } + if (histname.Contains("EvHod")) { + TH1F* h1hod; + TH1F* h2hod; + TString h1title; + TString h2title; + TString i2barname; + for(UInt_t ipl = 0; ipl < NPLANES; ipl++) { + for(UInt_t ibar = nbars_low[ipl]-1; ibar < nbars[ipl]; ibar++) { + if (histname.Contains(plane_names[ipl]) && histname.Contains(bar_names[ibar])) { + if (histname.Contains("Neg")) h1title="uhScalHodNeg"+plane_names[ipl]; + if (histname.Contains("Pos")) h1title="uhScalHodPos"+plane_names[ipl]; + h1hod = (TH1F*) gDirectory->Get(h1title); + if (h1hod) aveh=h1hod->GetBinContent(ibar+1); + } + if (histname2.Contains(plane_names[ipl]) && histname2.Contains(bar_names[ibar])) { + if (histname2.Contains("Neg")) h2title="uhScalHodNeg"+plane_names[ipl]; + if (histname2.Contains("Pos")) h2title="uhScalHodPos"+plane_names[ipl]; + h2hod = (TH1F*) gDirectory->Get(h2title); + if (h2hod) avehh=h2hod->GetBinContent(ibar+1); + } + } + } + } + if (histname.Contains("BCM") || histname.Contains("Unser")) { + TH1F* hbcm; + if (histname.Contains("Cur") ) hbcm = (TH1F*) gDirectory->Get("AveCurBCM"); + if (histname.Contains("Scal") ) hbcm = (TH1F*) gDirectory->Get("AveRateBCM"); + if (histname.Contains("BCM1")) aveh=hbcm->GetBinContent(0); + if (histname.Contains("BCM2")) aveh=hbcm->GetBinContent(1); + if (histname.Contains("Unser")) aveh=hbcm->GetBinContent(2); + if (histname2!="none") { + if (histname2.Contains("BCM1")) avehh=hbcm->GetBinContent(0); + if (histname2.Contains("BCM2")) avehh=hbcm->GetBinContent(1); + if (histname2.Contains("Unser")) avehh=hbcm->GetBinContent(2); + } + } + if (hh) max2=hh->GetBinContent(hh->GetMaximumBin()); + maxf=max1*1.2; + if (hh && max2>max1) maxf=max2*1.2; + if (h && !histname.Contains("uhScalHod")) htext = new TText(2,maxf*.95,Form("%s Ave = %7.2f",h->GetTitle(),aveh)); + if (hh && !histname.Contains("uhScalHod")) hhtext = new TText(2,maxf*.90,Form("%s Ave = %7.2f",hh->GetTitle(),avehh)); + if (h && histname.Contains("uhScalHod")) htext = new TText(2,maxf*.95,Form("%s Integral = %7.2f",h->GetTitle(),aveh)); + if (hh && histname.Contains("uhScalHod")) hhtext = new TText(2,maxf*.90,Form("%s Integral = %7.2f",hh->GetTitle(),avehh)); + h->SetMaximum(maxf); + h->Draw("p"); + h->SetMarkerStyle(7); + h->SetMarkerColor(1); + htext->Draw(); + if (hh) { + hh->Draw("p same"); + hh->SetMarkerColor(2); + hh->SetMarkerStyle(7); + hhtext->Draw(); + hhtext->SetTextColor(2); + } +} + diff --git a/onlineGUI/Macros/cer_2d_ratio.C b/onlineGUI/Macros/SHMS/CER/cer_2d_ratio.C similarity index 100% rename from onlineGUI/Macros/cer_2d_ratio.C rename to onlineGUI/Macros/SHMS/CER/cer_2d_ratio.C diff --git a/onlineGUI/Macros/gooddraw_2d_phodo.C b/onlineGUI/Macros/SHMS/HODO/gooddraw_2d_phodo.C similarity index 100% rename from onlineGUI/Macros/gooddraw_2d_phodo.C rename to onlineGUI/Macros/SHMS/HODO/gooddraw_2d_phodo.C diff --git a/onlineGUI/Macros/rawdraw_2d_phodo.C b/onlineGUI/Macros/SHMS/HODO/rawdraw_2d_phodo.C similarity index 100% rename from onlineGUI/Macros/rawdraw_2d_phodo.C rename to onlineGUI/Macros/SHMS/HODO/rawdraw_2d_phodo.C diff --git a/onlineGUI/Macros/rawdraw_phodo.C b/onlineGUI/Macros/SHMS/HODO/rawdraw_phodo.C similarity index 100% rename from onlineGUI/Macros/rawdraw_phodo.C rename to onlineGUI/Macros/SHMS/HODO/rawdraw_phodo.C diff --git a/onlineGUI/Macros/plot_hms_scalers.C b/onlineGUI/Macros/plot_hms_scalers.C deleted file mode 100644 index b7c79fa79469ace96d2845a7667dfef6122396dd..0000000000000000000000000000000000000000 --- a/onlineGUI/Macros/plot_hms_scalers.C +++ /dev/null @@ -1,289 +0,0 @@ -// UserScript.C -// -// Helper macro to build additional histograms - -void UserScript() -{ - // - const UInt_t NTRIGS = 6; - const TString trig_names[NTRIGS]={"h1X","h1Y","h1Xh1y","h2X","h2Y","hTrig"}; - TH1F* hScalTrig[NTRIGS]; - Double_t trig_scal[NTRIGS]; - Double_t trig_ave[NTRIGS]={0,0,0,0,0,0}; - TH1F* hAveTrig; - hAveTrig=new TH1F("AveTrig","Ave Trig Rates ",NTRIGS,0,NTRIGS); - // - const UInt_t NBCMS = 3; - const TString bcm_names[NBCMS] = {"BCM1", "BCM2","Unser"}; - TH1F* hScalBCM[NBCMS]; - TH1F* hCurBCM[NBCMS]; - TH1F* hAveCurBCM; - hAveCurBCM=new TH1F("AveCurBCM","Ave Current ",NBCMS,0,NBCMS); - TH1F* hAveRateBCM; - hAveRateBCM=new TH1F("AveRateBCM","Ave BCM Rate ",NBCMS,0,NBCMS); - Double_t bcm_scal[NBCMS]; - Double_t bcm_cur[NBCMS]; - Double_t bcm_ave_cur[NBCMS]={0.,0.,0.}; - Double_t bcm_ave_rate[NBCMS]={0.,0.,0.}; - Double_t bcm_offset[NBCMS]={250000,250000,393000}; - Double_t bcm_slope[NBCMS]={4500*1.15,4500,4000}; - // - const UInt_t NPLANES = 4; - const TString plane_names[NPLANES] = {"1x", "1y", "2x", "2y"}; - const UInt_t nbars[NPLANES] = {16, 10, 16, 10}; - const UInt_t nbars_low[NPLANES] = {1, 1, 1, 1}; - TH1F* hScalHodNegEv[NPLANES][16]; - TH1F* hScalHodPosEv[NPLANES][16]; - TH1F* hScalHodNeg[NPLANES]; - TH1F* hScalHodPos[NPLANES]; - Double_t hod_scalneg[NPLANES][16]; - Double_t hod_scalpos[NPLANES][16]; - Double_t hod_scalneg_rate[NPLANES][16]; - Double_t hod_scalpos_rate[NPLANES][16]; - Double_t good_bcm=0; - Double_t good_bcm_limit=265000.; - // - TTree *T=(TTree*)gDirectory->Get("TSHS"); - Int_t totev=T->GetEntries(); - // totev=400; - // - TString i2dbarname;TString h2dttitle;TString h2dtname;TString list_name; - for(UInt_t ip = 0; ip < NTRIGS; ip++) { - h2dttitle= trig_names[ip]+"; Event Number ; Rate "; - h2dtname="uhScalTrig"+trig_names[ip]; - hScalTrig[ip]= new TH1F(h2dtname,h2dttitle,totev,0,totev); - list_name ="HS"+trig_names[ip]+"r"; - T->SetBranchAddress(list_name,&trig_scal[ip]); - } - // - for(UInt_t ip = 0; ip < NBCMS; ip++) { - h2dttitle= bcm_names[ip]+"; Event Number ; Rate "; - h2dtname="uhScal"+bcm_names[ip]; - hScalBCM[ip]= new TH1F(h2dtname,h2dttitle,totev,0,totev); - h2dttitle= bcm_names[ip]+"; Event Number ; Current "; - h2dtname="uhCur"+bcm_names[ip]; - hCurBCM[ip]= new TH1F(h2dtname,h2dttitle,totev,0,totev); - list_name ="HS"+bcm_names[ip]+"r"; - T->SetBranchAddress(list_name,&bcm_scal[ip]); - } - // - for(UInt_t ip = 0; ip < NPLANES; ip++) { - h2dttitle= "Beam On,Neg"+plane_names[ip]+"; Scintillator Bar ; Ave Rate "; - h2dtname="uhScalHodNeg"+plane_names[ip]; - hScalHodNeg[ip]= new TH1F(h2dtname,h2dttitle,nbars[ip],0.5,nbars[ip]+.5); - h2dttitle= "Beam on,Pos"+plane_names[ip]+"; Scintillator Bar ; Ave Rate "; - h2dtname="uhScalHodPos"+plane_names[ip]; - hScalHodPos[ip]= new TH1F(h2dtname,h2dttitle,nbars[ip],0.5,nbars[ip]+.5); - for(UInt_t ibar = nbars_low[ip]-1; ibar < nbars[ip]; ibar++) { - i2dbarname = Form("%02d",ibar+1); - h2dttitle= "Neg Hod"+plane_names[ip]+i2dbarname+"; Event Number ; Rate "; - h2dtname="uhScalEvHodNeg"+plane_names[ip]+"Pad"+i2dbarname; - hScalHodNegEv[ip][ibar]= new TH1F(h2dtname,h2dttitle,totev,0,totev); - h2dttitle= "Pos Hod"+plane_names[ip]+i2dbarname+"; Event Number ; Rate "; - h2dtname="uhScalEvHodPos"+plane_names[ip]+"Pad"+i2dbarname; - hScalHodPosEv[ip][ibar]= new TH1F(h2dtname,h2dttitle,totev,0,totev); - hod_scalneg_rate[ip][ibar]=0; - hod_scalpos_rate[ip][ibar]=0; - } - } - // - // - for(UInt_t ip = 0; ip < NPLANES; ip++) { - for(UInt_t ibar = nbars_low[ip]-1; ibar < nbars[ip]; ibar++) { - i2dbarname = Form("%d",ibar+1); - list_name ="HShhod"+plane_names[ip]+i2dbarname+"Mr"; - T->SetBranchAddress(list_name,&hod_scalneg[ip][ibar]); - list_name ="HShhod"+plane_names[ip]+i2dbarname+"Pr"; - T->SetBranchAddress(list_name,&hod_scalpos[ip][ibar]); - } - } - // Loop over the events, filling the histograms - // cout << " looping over data " << endl; - for(UInt_t iev = 0; iev < totev; iev++) { - // cout << " iev = " << iev << endl; - // cout << " get entry = " << iev << endl; - T->GetEntry(iev); - // - for(UInt_t ip = 0; ip < NTRIGS; ip++) { - hScalTrig[ip]->SetBinContent(iev,trig_scal[ip]); - if (bcm_scal[0] > good_bcm_limit) trig_ave[ip]+=trig_scal[ip]; - } - // - for(UInt_t ip = 0; ip < NBCMS; ip++) { - hScalBCM[ip]->SetBinContent(iev,bcm_scal[ip]); - bcm_cur[ip]=(bcm_scal[ip]-bcm_offset[ip])/bcm_slope[ip]; - hCurBCM[ip]->SetBinContent(iev,bcm_cur[ip]); - if (bcm_scal[0] > good_bcm_limit) bcm_ave_cur[ip]+=bcm_cur[ip]; - if (bcm_scal[0] > good_bcm_limit) bcm_ave_rate[ip]+=bcm_scal[ip]; - } - if (bcm_scal[0] > good_bcm_limit) good_bcm++; -// - for(UInt_t ip = 0; ip < NPLANES; ip++) { - for(UInt_t ibar = nbars_low[ip]-1; ibar < nbars[ip]; ibar++) { - hScalHodNegEv[ip][ibar]->SetBinContent(iev,hod_scalneg[ip][ibar]); - hScalHodPosEv[ip][ibar]->SetBinContent(iev,hod_scalpos[ip][ibar]); - if (bcm_scal[0] > good_bcm_limit) { - hod_scalneg_rate[ip][ibar]+=hod_scalneg[ip][ibar]; - hod_scalpos_rate[ip][ibar]+=hod_scalpos[ip][ibar]; - } - // cout << ip+1 << " " << ibar+1 << " " << hod_scalneg[ip][ibar]<< " " << hod_scalpos[ip][ibar] << endl; - } - } - // cout << " finish event = " << iev << endl; -} - cout << " Done " << endl; -// calculate average when beam-on -if (good_bcm >0) { - cout << " tot ev = " << totev << " Good BCm events = " << good_bcm << endl; - for(UInt_t ip = 0; ip < NBCMS; ip++) { - hAveCurBCM->SetBinContent(ip,bcm_ave_cur[ip]/good_bcm); - hAveRateBCM->SetBinContent(ip,bcm_ave_rate[ip]/good_bcm); - } - for(UInt_t ip = 0; ip < NTRIGS; ip++) { - hAveTrig->SetBinContent(ip,trig_ave[ip]/good_bcm); - } - for(UInt_t ip = 0; ip < NPLANES; ip++) { - for(UInt_t ibar = nbars_low[ip]-1; ibar < nbars[ip]; ibar++) { - hScalHodNeg[ip]->SetBinContent(ibar+1,hod_scalneg_rate[ip][ibar]/good_bcm); - hScalHodPos[ip]->SetBinContent(ibar+1,hod_scalpos_rate[ip][ibar]/good_bcm); - } - } -} - // - return; -} - - - -void plot_hms_scalers(TString histname,TString histname2) { - const UInt_t NTRIGS = 6; - const TString trig_names[NTRIGS]={"h1X","h1Y","h1Xh1y","h2X","h2Y","hTrig"}; - const UInt_t NPLANES = 4; - const TString plane_names[NPLANES] = {"1x", "1y", "2x", "2y"}; - const TString bar_names[16] = {"Pad01", "Pad02", "Pad03", "Pad04","Pad05", "Pad06", "Pad07", "Pad08","Pad09","Pad10","Pad11", "Pad12", "Pad13", "Pad14","Pad15", "Pad16"}; - const UInt_t nbars[NPLANES] = {16, 10, 16, 10}; - const UInt_t nbars_low[NPLANES] = {1, 1, 1, 1}; - TH1F* h; - TH1F* hh; - TH1F* htrig; - TH1F* hhtrig; - TText* htext; - TText* hhtext; - Double_t aveh=0,avehh=0; - h = (TH1F*) gDirectory->Get(histname); - hh = (TH1F*) gDirectory->Get(histname2); - if(!h) { - UserScript(); - h = (TH1F*) gDirectory->Get(histname); - if(!h) { - cout << "User histogram " << histname << " not found" << endl; - exit(1); - } - if (histname2!="none") { - hh = (TH1F*) gDirectory->Get(histname2); - if(!hh) { - cout << "User histogram " << histname2 << " not found" << endl; - exit(1); - } - } - } - if (histname.Contains("Trig")) { - htrig = (TH1F*) gDirectory->Get("AveTrig"); - } - if (histname2.Contains("Trig")) { - hhtrig = (TH1F*) gDirectory->Get("AveTrig"); - } - for (Int_t ip=0;ip<NTRIGS;ip++) { - if (histname.Contains(trig_names[ip])) aveh=htrig->GetBinContent(ip); - if (histname2.Contains(trig_names[ip])) avehh=hhtrig->GetBinContent(ip); - } - // cout << histname.Contains("adcpeak") << endl; - Double_t maxf=0,max1=0,max2=0; - h->SetStats(0); - h->GetXaxis()->SetTitleOffset(.6); - h->GetXaxis()->SetTitleSize(0.08); - h->GetYaxis()->SetTitleOffset(.6); - h->GetYaxis()->SetTitleSize(0.08); - h->SetMinimum(0); - max1=h->GetBinContent(h->GetMaximumBin()); - if (histname.Contains("uhScalHod")) { - TH1F* h1hod; - TH1F* h2hod; - TString h1title; - TString h2title; - UInt_t ipl_f1=0; - UInt_t ipl_f2=0; - for(UInt_t ipl = 0; ipl < NPLANES; ipl++) { - if (histname.Contains(plane_names[ipl]))ipl_f1 = ipl; - if (histname2.Contains(plane_names[ipl])) ipl_f2=ipl; - } - if (histname.Contains("Neg")) h1title="uhScalHodNeg"+plane_names[ipl_f1]; - if (histname.Contains("Pos")) h1title="uhScalHodPos"+plane_names[ipl_f1]; - if (histname2.Contains("Neg")) h2title="uhScalHodNeg"+plane_names[ipl_f2]; - if (histname2.Contains("Pos")) h2title="uhScalHodPos"+plane_names[ipl_f2]; - h1hod = (TH1F*) gDirectory->Get(h1title); - h2hod = (TH1F*) gDirectory->Get(h2title); - for(UInt_t ibar = nbars_low[ipl_f1]-1; ibar < nbars[ipl_f1]; ibar++) { - if (h1hod) aveh+=h1hod->GetBinContent(ibar+1); - } - for(UInt_t ibar = nbars_low[ipl_f2]-1; ibar < nbars[ipl_f2]; ibar++) { - if (h2hod) avehh+=h2hod->GetBinContent(ibar+1); - } - } - if (histname.Contains("EvHod")) { - TH1F* h1hod; - TH1F* h2hod; - TString h1title; - TString h2title; - TString i2barname; - for(UInt_t ipl = 0; ipl < NPLANES; ipl++) { - for(UInt_t ibar = nbars_low[ipl]-1; ibar < nbars[ipl]; ibar++) { - if (histname.Contains(plane_names[ipl]) && histname.Contains(bar_names[ibar])) { - if (histname.Contains("Neg")) h1title="uhScalHodNeg"+plane_names[ipl]; - if (histname.Contains("Pos")) h1title="uhScalHodPos"+plane_names[ipl]; - h1hod = (TH1F*) gDirectory->Get(h1title); - if (h1hod) aveh=h1hod->GetBinContent(ibar+1); - } - if (histname2.Contains(plane_names[ipl]) && histname2.Contains(bar_names[ibar])) { - if (histname2.Contains("Neg")) h2title="uhScalHodNeg"+plane_names[ipl]; - if (histname2.Contains("Pos")) h2title="uhScalHodPos"+plane_names[ipl]; - h2hod = (TH1F*) gDirectory->Get(h2title); - if (h2hod) avehh=h2hod->GetBinContent(ibar+1); - } - } - } - } - if (histname.Contains("BCM") || histname.Contains("Unser")) { - TH1F* hbcm; - if (histname.Contains("Cur") ) hbcm = (TH1F*) gDirectory->Get("AveCurBCM"); - if (histname.Contains("Scal") ) hbcm = (TH1F*) gDirectory->Get("AveRateBCM"); - if (histname.Contains("BCM1")) aveh=hbcm->GetBinContent(0); - if (histname.Contains("BCM2")) aveh=hbcm->GetBinContent(1); - if (histname.Contains("Unser")) aveh=hbcm->GetBinContent(2); - if (histname2!="none") { - if (histname2.Contains("BCM1")) avehh=hbcm->GetBinContent(0); - if (histname2.Contains("BCM2")) avehh=hbcm->GetBinContent(1); - if (histname2.Contains("Unser")) avehh=hbcm->GetBinContent(2); - } - } - if (hh) max2=hh->GetBinContent(hh->GetMaximumBin()); - maxf=max1*1.2; - if (hh && max2>max1) maxf=max2*1.2; - if (h && !histname.Contains("uhScalHod")) htext = new TText(2,maxf*.95,Form("%s Ave = %7.2f",h->GetTitle(),aveh)); - if (hh && !histname.Contains("uhScalHod")) hhtext = new TText(2,maxf*.90,Form("%s Ave = %7.2f",hh->GetTitle(),avehh)); - if (h && histname.Contains("uhScalHod")) htext = new TText(2,maxf*.95,Form("%s Integral = %7.2f",h->GetTitle(),aveh)); - if (hh && histname.Contains("uhScalHod")) hhtext = new TText(2,maxf*.90,Form("%s Integral = %7.2f",hh->GetTitle(),avehh)); - h->SetMaximum(maxf); - h->Draw("p"); - h->SetMarkerStyle(7); - h->SetMarkerColor(1); - htext->Draw(); - if (hh) { - hh->Draw("p same"); - hh->SetMarkerColor(2); - hh->SetMarkerStyle(7); - hhtext->Draw(); - hhtext->SetTextColor(2); - } -} - diff --git a/onlineGUI/Macros/plot_shms_scalers.C b/onlineGUI/Macros/plot_shms_scalers.C deleted file mode 100644 index 5259e871f97220cf8a2d7191ff15d739daca69ae..0000000000000000000000000000000000000000 --- a/onlineGUI/Macros/plot_shms_scalers.C +++ /dev/null @@ -1,288 +0,0 @@ -// UserScript.C -// -// Helper macro to build additional histograms - -void UserScript() -{ - // - const UInt_t NTRIGS = 6; - const TString trig_names[NTRIGS]={"s1X","s1Y","s1Xs1y","s2X","s2Y","sTrig"}; - TH1F* hScalTrig[NTRIGS]; - Double_t trig_scal[NTRIGS]; - Double_t trig_ave[NTRIGS]={0,0,0,0,0,0}; - TH1F* hAveTrig; - hAveTrig=new TH1F("AveTrig","Ave Trig Rates ",NTRIGS,0,NTRIGS); - // - const UInt_t NBCMS = 3; - const TString bcm_names[NBCMS] = {"BCM1", "BCM2","Unser"}; - TH1F* hScalBCM[NBCMS]; - TH1F* hCurBCM[NBCMS]; - TH1F* hAveCurBCM; - hAveCurBCM=new TH1F("AveCurBCM","Ave Current ",NBCMS,0,NBCMS); - TH1F* hAveRateBCM; - hAveRateBCM=new TH1F("AveRateBCM","Ave BCM Rate ",NBCMS,0,NBCMS); - Double_t bcm_scal[NBCMS]; - Double_t bcm_cur[NBCMS]; - Double_t bcm_ave_cur[NBCMS]={0.,0.,0.}; - Double_t bcm_ave_rate[NBCMS]={0.,0.,0.}; - Double_t bcm_offset[NBCMS]={250000,250000,393000}; - Double_t bcm_slope[NBCMS]={4500*1.15,4500,4000}; - // - const UInt_t NPLANES = 4; - const TString plane_names[NPLANES] = {"1x", "1y", "2x", "2y"}; - const UInt_t nbars[NPLANES] = {13, 13, 14, 16}; - const UInt_t nbars_low[NPLANES] = {1, 1, 1, 7}; - TH1F* hScalHodNegEv[NPLANES][16]; - TH1F* hScalHodPosEv[NPLANES][16]; - TH1F* hScalHodNeg[NPLANES]; - TH1F* hScalHodPos[NPLANES]; - Double_t hod_scalneg[NPLANES][16]; - Double_t hod_scalpos[NPLANES][16]; - Double_t hod_scalneg_rate[NPLANES][16]; - Double_t hod_scalpos_rate[NPLANES][16]; - Double_t good_bcm=0; - Double_t good_bcm_limit=260000.; - // - TTree *T=(TTree*)gDirectory->Get("TSPS"); - Int_t totev=T->GetEntries(); - totev=400; - // - TString i2dbarname;TString h2dttitle;TString h2dtname;TString list_name; - for(UInt_t ip = 0; ip < NTRIGS; ip++) { - h2dttitle= trig_names[ip]+"; Event Number ; Rate "; - h2dtname="uhScalTrig"+trig_names[ip]; - hScalTrig[ip]= new TH1F(h2dtname,h2dttitle,totev,0,totev); - list_name ="PS"+trig_names[ip]+"r"; - T->SetBranchAddress(list_name,&trig_scal[ip]); - } - // - for(UInt_t ip = 0; ip < NBCMS; ip++) { - h2dttitle= bcm_names[ip]+"; Event Number ; Rate "; - h2dtname="uhScal"+bcm_names[ip]; - hScalBCM[ip]= new TH1F(h2dtname,h2dttitle,totev,0,totev); - h2dttitle= bcm_names[ip]+"; Event Number ; Current "; - h2dtname="uhCur"+bcm_names[ip]; - hCurBCM[ip]= new TH1F(h2dtname,h2dttitle,totev,0,totev); - list_name ="PS"+bcm_names[ip]+"r"; - T->SetBranchAddress(list_name,&bcm_scal[ip]); - } - // - for(UInt_t ip = 0; ip < NPLANES; ip++) { - h2dttitle= "Beam On,Neg"+plane_names[ip]+"; Scintillator Bar ; Ave Rate "; - h2dtname="uhScalHodNeg"+plane_names[ip]; - hScalHodNeg[ip]= new TH1F(h2dtname,h2dttitle,nbars[ip],0.5,nbars[ip]+.5); - h2dttitle= "Beam On,Pos"+plane_names[ip]+"; Scintillator Bar ; Ave Rate "; - h2dtname="uhScalHodPos"+plane_names[ip]; - hScalHodPos[ip]= new TH1F(h2dtname,h2dttitle,nbars[ip],0.5,nbars[ip]+.5); - for(UInt_t ibar = nbars_low[ip]-1; ibar < nbars[ip]; ibar++) { - i2dbarname = Form("%02d",ibar+1); - h2dttitle= "Neg Hod"+plane_names[ip]+i2dbarname+"; Event Number ; Rate "; - h2dtname="uhScalEvHodNeg"+plane_names[ip]+"Pad"+i2dbarname; - hScalHodNegEv[ip][ibar]= new TH1F(h2dtname,h2dttitle,totev,0,totev); - h2dttitle= "Pos Hod"+plane_names[ip]+i2dbarname+"; Event Number ; Rate "; - h2dtname="uhScalEvHodPos"+plane_names[ip]+"Pad"+i2dbarname; - hScalHodPosEv[ip][ibar]= new TH1F(h2dtname,h2dttitle,totev,0,totev); - hod_scalneg_rate[ip][ibar]=0; - hod_scalpos_rate[ip][ibar]=0; - } - } - // - // - for(UInt_t ip = 0; ip < NPLANES; ip++) { - for(UInt_t ibar = nbars_low[ip]-1; ibar < nbars[ip]; ibar++) { - i2dbarname = Form("%d",ibar+1); - list_name ="PSshod"+plane_names[ip]+i2dbarname+"Mr"; - T->SetBranchAddress(list_name,&hod_scalneg[ip][ibar]); - list_name ="PSshod"+plane_names[ip]+i2dbarname+"Pr"; - T->SetBranchAddress(list_name,&hod_scalpos[ip][ibar]); - } - } - // Loop over the events, filling the histograms - // cout << " looping over data " << endl; - for(UInt_t iev = 0; iev < totev; iev++) { - // cout << " iev = " << iev << endl; - // cout << " get entry = " << iev << endl; - T->GetEntry(iev); - // - for(UInt_t ip = 0; ip < NTRIGS; ip++) { - hScalTrig[ip]->SetBinContent(iev,trig_scal[ip]); - if (bcm_scal[0] > good_bcm_limit) trig_ave[ip]+=trig_scal[ip]; - } - // - for(UInt_t ip = 0; ip < NBCMS; ip++) { - hScalBCM[ip]->SetBinContent(iev,bcm_scal[ip]); - bcm_cur[ip]=(bcm_scal[ip]-bcm_offset[ip])/bcm_slope[ip]; - hCurBCM[ip]->SetBinContent(iev,bcm_cur[ip]); - if (bcm_scal[0] > good_bcm_limit) bcm_ave_cur[ip]+=bcm_cur[ip]; - if (bcm_scal[0] > good_bcm_limit) bcm_ave_rate[ip]+=bcm_scal[ip]; - } - if (bcm_scal[0] > good_bcm_limit) good_bcm++; -// - for(UInt_t ip = 0; ip < NPLANES; ip++) { - for(UInt_t ibar = nbars_low[ip]-1; ibar < nbars[ip]; ibar++) { - hScalHodNegEv[ip][ibar]->SetBinContent(iev,hod_scalneg[ip][ibar]); - hScalHodPosEv[ip][ibar]->SetBinContent(iev,hod_scalpos[ip][ibar]); - if (bcm_scal[0] > good_bcm_limit) { - hod_scalneg_rate[ip][ibar]+=hod_scalneg[ip][ibar]; - hod_scalpos_rate[ip][ibar]+=hod_scalpos[ip][ibar]; - } - // cout << ip+1 << " " << ibar+1 << " " << hod_scalneg[ip][ibar]<< " " << hod_scalpos[ip][ibar] << endl; - } - } - // cout << " finish event = " << iev << endl; -} - cout << " Done " << endl; -// calculate average when beam-on -if (good_bcm >0) { - for(UInt_t ip = 0; ip < NBCMS; ip++) { - hAveCurBCM->SetBinContent(ip,bcm_ave_cur[ip]/good_bcm); - hAveRateBCM->SetBinContent(ip,bcm_ave_rate[ip]/good_bcm); - } - for(UInt_t ip = 0; ip < NTRIGS; ip++) { - hAveTrig->SetBinContent(ip,trig_ave[ip]/good_bcm); - } - for(UInt_t ip = 0; ip < NPLANES; ip++) { - for(UInt_t ibar = nbars_low[ip]-1; ibar < nbars[ip]; ibar++) { - hScalHodNeg[ip]->SetBinContent(ibar+1,hod_scalneg_rate[ip][ibar]/good_bcm); - hScalHodPos[ip]->SetBinContent(ibar+1,hod_scalpos_rate[ip][ibar]/good_bcm); - } - } -} - // - return; -} - - - -void plot_shms_scalers(TString histname,TString histname2) { - const UInt_t NTRIGS = 6; - const TString trig_names[NTRIGS]={"s1X","s1Y","s1Xs1y","s2X","s2Y","sTrig"}; - const UInt_t NPLANES = 4; - const TString plane_names[NPLANES] = {"1x", "1y", "2x", "2y"}; - const TString bar_names[16] = {"Pad01", "Pad02", "Pad03", "Pad04","Pad05", "Pad06", "Pad07", "Pad08","Pad09","Pad10","Pad11", "Pad12", "Pad13", "Pad14","Pad15", "Pad16"}; - const UInt_t nbars[NPLANES] = {13, 13, 14, 16}; - const UInt_t nbars_low[NPLANES] = {1, 1, 1, 7}; - TH1F* h; - TH1F* hh; - TH1F* htrig; - TH1F* hhtrig; - TText* htext; - TText* hhtext; - Double_t aveh=0,avehh=0; - h = (TH1F*) gDirectory->Get(histname); - hh = (TH1F*) gDirectory->Get(histname2); - if(!h) { - UserScript(); - h = (TH1F*) gDirectory->Get(histname); - if(!h) { - cout << "User histogram " << histname << " not found" << endl; - exit(1); - } - if (histname2!="none") { - hh = (TH1F*) gDirectory->Get(histname2); - if(!hh) { - cout << "User histogram " << histname2 << " not found" << endl; - exit(1); - } - } - } - if (histname.Contains("Trig")) { - htrig = (TH1F*) gDirectory->Get("AveTrig"); - } - if (histname2.Contains("Trig")) { - hhtrig = (TH1F*) gDirectory->Get("AveTrig"); - } - for (Int_t ip=0;ip<NTRIGS;ip++) { - if (histname.Contains(trig_names[ip])) aveh=htrig->GetBinContent(ip); - if (histname2.Contains(trig_names[ip])) avehh=hhtrig->GetBinContent(ip); - } - // cout << histname.Contains("adcpeak") << endl; - Double_t maxf=0,max1=0,max2=0; - h->SetStats(0); - h->GetXaxis()->SetTitleOffset(.6); - h->GetXaxis()->SetTitleSize(0.08); - h->GetYaxis()->SetTitleOffset(.6); - h->GetYaxis()->SetTitleSize(0.08); - h->SetMinimum(0); - max1=h->GetBinContent(h->GetMaximumBin()); - if (histname.Contains("uhScalHod")) { - TH1F* h1hod; - TH1F* h2hod; - TString h1title; - TString h2title; - UInt_t ipl_f1=0; - UInt_t ipl_f2=0; - for(UInt_t ipl = 0; ipl < NPLANES; ipl++) { - if (histname.Contains(plane_names[ipl]))ipl_f1 = ipl; - if (histname2.Contains(plane_names[ipl])) ipl_f2=ipl; - } - if (histname.Contains("Neg")) h1title="uhScalHodNeg"+plane_names[ipl_f1]; - if (histname.Contains("Pos")) h1title="uhScalHodPos"+plane_names[ipl_f1]; - if (histname2.Contains("Neg")) h2title="uhScalHodNeg"+plane_names[ipl_f2]; - if (histname2.Contains("Pos")) h2title="uhScalHodPos"+plane_names[ipl_f2]; - h1hod = (TH1F*) gDirectory->Get(h1title); - h2hod = (TH1F*) gDirectory->Get(h2title); - for(UInt_t ibar = nbars_low[ipl_f1]-1; ibar < nbars[ipl_f1]; ibar++) { - if (h1hod) aveh+=h1hod->GetBinContent(ibar+1); - } - for(UInt_t ibar = nbars_low[ipl_f2]-1; ibar < nbars[ipl_f2]; ibar++) { - if (h2hod) avehh+=h2hod->GetBinContent(ibar+1); - } - } - if (histname.Contains("EvHod")) { - TH1F* h1hod; - TH1F* h2hod; - TString h1title; - TString h2title; - TString i2barname; - for(UInt_t ipl = 0; ipl < NPLANES; ipl++) { - for(UInt_t ibar = nbars_low[ipl]-1; ibar < nbars[ipl]; ibar++) { - if (histname.Contains(plane_names[ipl]) && histname.Contains(bar_names[ibar])) { - if (histname.Contains("Neg")) h1title="uhScalHodNeg"+plane_names[ipl]; - if (histname.Contains("Pos")) h1title="uhScalHodPos"+plane_names[ipl]; - h1hod = (TH1F*) gDirectory->Get(h1title); - if (h1hod) aveh=h1hod->GetBinContent(ibar+1); - } - if (histname2.Contains(plane_names[ipl]) && histname2.Contains(bar_names[ibar])) { - if (histname2.Contains("Neg")) h2title="uhScalHodNeg"+plane_names[ipl]; - if (histname2.Contains("Pos")) h2title="uhScalHodPos"+plane_names[ipl]; - h2hod = (TH1F*) gDirectory->Get(h2title); - if (h2hod) avehh=h2hod->GetBinContent(ibar+1); - } - } - } - } - if (histname.Contains("BCM") || histname.Contains("Unser")) { - TH1F* hbcm; - if (histname.Contains("Cur") ) hbcm = (TH1F*) gDirectory->Get("AveCurBCM"); - if (histname.Contains("Scal") ) hbcm = (TH1F*) gDirectory->Get("AveRateBCM"); - if (histname.Contains("BCM1")) aveh=hbcm->GetBinContent(0); - if (histname.Contains("BCM2")) aveh=hbcm->GetBinContent(1); - if (histname.Contains("Unser")) aveh=hbcm->GetBinContent(2); - if (histname2!="none") { - if (histname2.Contains("BCM1")) avehh=hbcm->GetBinContent(0); - if (histname2.Contains("BCM2")) avehh=hbcm->GetBinContent(1); - if (histname2.Contains("Unser")) avehh=hbcm->GetBinContent(2); - } - } - if (hh) max2=hh->GetBinContent(hh->GetMaximumBin()); - maxf=max1*1.2; - if (hh && max2>max1) maxf=max2*1.2; - if (h && !histname.Contains("uhScalHod")) htext = new TText(2,maxf*.95,Form("%s Ave = %7.2f",h->GetTitle(),aveh)); - if (hh && !histname.Contains("uhScalHod")) hhtext = new TText(2,maxf*.90,Form("%s Ave = %7.2f",hh->GetTitle(),avehh)); - if (h && histname.Contains("uhScalHod")) htext = new TText(2,maxf*.95,Form("%s Integral = %7.2f",h->GetTitle(),aveh)); - if (hh && histname.Contains("uhScalHod")) hhtext = new TText(2,maxf*.90,Form("%s Integral = %7.2f",hh->GetTitle(),avehh)); - h->SetMaximum(maxf); - h->Draw("p"); - h->SetMarkerStyle(7); - h->SetMarkerColor(1); - htext->Draw(); - if (hh) { - hh->Draw("p same"); - hh->SetMarkerColor(2); - hh->SetMarkerStyle(7); - hhtext->Draw(); - hhtext->SetTextColor(2); - } -} -