Skip to content
Snippets Groups Projects
Commit e57d0611 authored by Hall C Online Analyzer User's avatar Hall C Online Analyzer User Committed by Eric Pooser
Browse files

Spring 2018 ver3 (#362)

* Include Dipangkar ep coin work

* Add coincidence scaler infrastructure

* Move EDTM cuts to decode block

* General updates
parent d15407b5
No related branches found
No related tags found
No related merge requests found
Showing
with 1113 additions and 23 deletions
0-99999
g_ctp_parm_filename ="DBASE/COIN/GEN/general.param"
g_ctp_kinematics_filename ="DBASE/COIN/STD/ep.kinematics"
g_ctp_calib_filename ="DBASE/COIN/GEN/default_det_calib_files.param"
#
# Need to set htheta_lab to a NEGATIVE value
# Need to set ptheta_lab to a POSITIVE value
# 1H gtargmass_amu = 1.00794
# 12C gtargmass_amu = 12.0107
# 27Al gtargmass_amu = 26.98
#
0-99999
gpbeam = 6.4
gtargmass_amu=12.0107
htheta_lab = -15.
ptheta_lab = 15.
hpcentral = 3.
ppcentral = 3.
hpartmass = 0.00051099
ppartmass = 0.00051099
1711-1721
gpbeam=2.221
hpartmass = 0.938272
ppartmass = 0.00051099
1722
gpbeam=2.221
hpartmass = 0.00051099
ppartmass = 0.938272
1711-1712
hpcentral = 0.957
ppcentral = 1.816
htheta_lab = -53.33
ptheta_lab = 25.01
1711
gtargmass_amu = 1.00794
1712
gtargmass_amu = 26.98
1713-1716
hpcentral = 1.136
ppcentral = 1.816
htheta_lab = -47.9
ptheta_lab = 30.0
1713
gtargmass_amu = 1.00794
1714-1715
gtargmass_amu = 26.98
1716
gtargmass_amu = 1.00794
1717-1718
hpcentral = 1.136
ppcentral = 1.686
htheta_lab = -47.9
ptheta_lab = 30.0
1717
gtargmass_amu = 26.98
1718
gtargmass_amu = 1.00794
1719-1720
hpcentral = 1.136
ppcentral = 1.555
htheta_lab = -47.9
ptheta_lab = 30.0
1719
gtargmass_amu = 1.00794
1720
gtargmass_amu = 26.98
1721-1722
hpcentral = 0.936
ppcentral = 2.012
htheta_lab = -65.1
ptheta_lab = 25.0
1721
gtargmass_amu = 26.98
1722
gtargmass_amu = 1.00794
1851-1867
gpbeam=6.405
hpartmass = 0.938272
ppartmass = 0.00051099
gtargmass_amu=1.00794
htheta_lab = -27.5
ptheta_lab = 27.5
hpcentral = 3.609
ppcentral = 3.609
1869-9999
gpbeam=6.405
ppartmass = 0.938272
hpartmass = 0.00051099
gtargmass_amu=1.00794
htheta_lab = -27.5
ptheta_lab = 27.5
hpcentral = 3.609
ppcentral = 3.609
......@@ -84,12 +84,32 @@ gtargmass_amu = 26.98
1722
gtargmass_amu = 1.00794
1851-1855
1851-1867
gpbeam = 6.405
gtargmass_amu = 1.00794
htheta_lab = -27.5
ptheta_lab = 27.6
hpcentral = 3.609
ppcentral = 3.609
ppcentral = 3.609*0.985
hpartmass = 0.93827231
ppartmass = 0.00051099
1884-1892
gpbeam = 6.405
gtargmass_amu = 1.00794
htheta_lab = -20.0
ptheta_lab = 20.0
hpcentral = 3.609
ppcentral = 2.5*0.985
ppartmass = 0.93827231
hpartmass = 0.00051099
1893-1910
gpbeam = 6.405
gtargmass_amu = 1.00794
htheta_lab = -27.54
ptheta_lab = 27.50
hpcentral = 3.609
ppcentral = 3.609*0.985
hpartmass = 0.93827231
ppartmass = 0.00051099
block T.coin.*
begin epics
IBC3H00CRCUR4
hac_bcm_average
ibcm1
ibcm2
iunser
itov3out
itov4out
end epics
block T.coin.hTRIG*
block T.coin.pTRIG*
block H.cer.npe*
block H.cal.e*
block H.hod.*time
block H.hod.*Time
block H.gtr.*
block H.kin.*
block P.hgcer.npe*
block P.cal.e*
block P.hod.*time
block P.hod.*Time
block P.gtr.*
block P.kin.*
begin epics
IBC3H00CRCUR4
hac_bcm_average
ibcm1
ibcm2
iunser
itov3out
itov4out
end epics
#include "DEF-files/COIN/PRODUCTION/GTR/coin_gtr_histos.def"
#include "DEF-files/COIN/PRODUCTION/KIN/coin_pElec_hProt_kin_histos.def"
#include "DEF-files/COIN/PRODUCTION/TRIG/coin_trig_histos.def"
#include "DEF-files/HMS/PRODUCTION/hstackana_production_cuts.def"
#include "DEF-files/SHMS/PRODUCTION/pstackana_production_cuts.def"
Block: RawDecode
Pedestal_event g.evtyp == 99
SHMS_event g.evtyp == 1
HMS_event g.evtyp == 2
BOTH_SINGLES_event g.evtyp == 3
COIN_ONLY_event g.evtyp == 4
SHMS_COIN_event g.evtyp == 5
HMS_COIN_event g.evtyp == 6
COIN_ALL_event g.evtyp == 7
ALL_events SHMS_event || HMS_event || BOTH_SINGLES_event || COIN_ONLY_event || COIN_ALL_event
RawDecode_master ALL_events
Block: Decode
goodctime ALL_events #LOOSE CUT AROUND COINTIME PEAK (3 beam buckets)
tightctime ALL_events #TIGHT CUT AROUND COINTIME PEAK (1 beam buckets)
ranctime ALL_events #CUT AWAY FROM COINTIME PEAK (4 beam buckets)
Decode_master ALL_events
Block: CoarseTracking
CoarseTracking_master ALL_events
Block: CoarseReconstruct
CoarseReconstruct_master ALL_events
Block: Tracking
Tracking_master ALL_events
Block: Reconstruct
Reconstruct_master ALL_events
hcleantrack H.gtr.index > -1
pcleantrack P.gtr.index > -1
ccleantrack hcleantrack && pcleantrack
coincut ccleantrack && goodctime
tight_coin ccleantrack && tightctime
ran_coincut ccleantrack && ranctime
e_cut_cal P.cal.etottracknorm > 0.6 && P.cal.etottracknorm < 2.0
e_cut_cer P.hgcer.npeSum > 5.0 && P.ngcer.npeSum > 15.0
select_e_cut e_cut_cal && e_cut_cer
betacut_proton H.gtr.beta > 0.6 && H.gtr.beta < 0.8
coincut_ep ccleantrack && select_e_cut && betacut_proton
block T.coin.*
block T.coin.hTRIG*
block T.coin.pTRIG*
block H.cer.*
block H.dc.*
......
# Report file for SHMS stack
Block: RawDecode
Pedestal_event g.evtyp == 99
SHMS_event g.evtyp == 1
HMS_event g.evtyp == 2
COIN_event g.evtyp >= 4&&g.evtyp<8
SHMS_Pretrig pTRIG1_ROC2 || pTRIG2_ROC2 || pTRIG3_ROC2
HMS_Pretrig pTRIG4_ROC2
COIN_Pretrig pTRIG6_ROC2
RawDecode_master 1
Block: Decode
pTRIG1_ROC2 T.coin.pTRIG1_ROC2_tdcTimeRaw > 0
pTRIG2_ROC2 T.coin.pTRIG2_ROC2_tdcTimeRaw > 0
pTRIG3_ROC2 T.coin.pTRIG3_ROC2_tdcTimeRaw > 0
pTRIG4_ROC2 T.coin.pTRIG4_ROC2_tdcTimeRaw > 0
pTRIG5_ROC2 T.coin.pTRIG5_ROC2_tdcTimeRaw > 0
pTRIG6_ROC2 T.coin.pTRIG6_ROC2_tdcTimeRaw > 0
pTRIG1_ROC1 T.coin.pTRIG1_ROC1_tdcTimeRaw > 0
pTRIG2_ROC1 T.coin.pTRIG2_ROC1_tdcTimeRaw > 0
pTRIG3_ROC1 T.coin.pTRIG3_ROC1_tdcTimeRaw > 0
pTRIG4_ROC1 T.coin.pTRIG4_ROC1_tdcTimeRaw > 0
pTRIG5_ROC1 T.coin.pTRIG5_ROC1_tdcTimeRaw > 0
pTRIG6_ROC1 T.coin.pTRIG6_ROC1_tdcTimeRaw > 0
shms_trigs SHMS_event
SHMS_edtm_accepted T.coin.pEDTM_tdcTime != 0.0
SHMS_physics_accepted T.coin.pEDTM_tdcTime == 0.0
HMS_edtm_accepted T.coin.hEDTM_tdcTime != 0.0
HMS_physics_accepted T.coin.hEDTM_tdcTime == 0.0
Decode_master 1
Block: CoarseTracking
CoarseTracking_master 1
Block: CoarseReconstruct
CoarseReconstruct_master 1
Block: Tracking
Tracking_master 1
Block: Reconstruct
Reconstruct_master 1
Block: Physics
Physics_master 1
\ No newline at end of file
......@@ -12,6 +12,10 @@ HMS_COIN_event g.evtyp == 6
COIN_ALL_event g.evtyp == 7
ALL_events SHMS_event || HMS_event || BOTH_SINGLES_event || COIN_ONLY_event || COIN_ALL_event
RawDecode_master 1
Block: Decode
hcut_TRIG1 T.hms.hTRIG1_tdcTimeRaw > 0
hcut_TRIG2 T.hms.hTRIG2_tdcTimeRaw > 0
hcut_TRIG3 T.hms.hTRIG3_tdcTimeRaw > 0
......@@ -21,10 +25,6 @@ hms_trigs HMS_event
hcut_edtm_accepted T.hms.hEDTM_tdcTime != 0.0
hcut_physics_accepted T.hms.hEDTM_tdcTime == 0.0
RawDecode_master 1
Block: Decode
Decode_master ALL_events
Block: CoarseTracking
......
......@@ -7,6 +7,12 @@ HMS_event g.evtyp == 2
SHMS_event g.evtyp == 1
COIN_event g.evtyp == 4
RawDecode_master 1
Block: Decode
Decode_master HMS_event
TRIG1 T.hms.hTRIG1_tdcTimeRaw > 0
TRIG2 T.hms.hTRIG2_tdcTimeRaw > 0
TRIG3 T.hms.hTRIG3_tdcTimeRaw > 0
......@@ -16,12 +22,6 @@ hms_trigs HMS_event
edtm_accepted T.hms.hEDTM_tdcTime != 0.0
physics_accepted T.hms.hEDTM_tdcTime == 0.0
RawDecode_master 1
Block: Decode
Decode_master HMS_event
Block: CoarseTracking
CoarseTracking_master HMS_event
......
......@@ -12,6 +12,10 @@ HMS_COIN_event g.evtyp == 6
COIN_ALL_event g.evtyp == 7
ALL_events SHMS_event || HMS_event || BOTH_SINGLES_event || COIN_ONLY_event || COIN_ALL_event
RawDecode_master 1
Block: Decode
pcut_TRIG1 T.shms.pTRIG1_tdcTimeRaw > 0
pcut_TRIG2 T.shms.pTRIG2_tdcTimeRaw > 0
pcut_TRIG3 T.shms.pTRIG3_tdcTimeRaw > 0
......@@ -21,10 +25,6 @@ shms_trigs SHMS_event
pcut_edtm_accepted T.shms.pEDTM_tdcTime != 0.0
pcut_physics_accepted T.shms.pEDTM_tdcTime == 0.0
RawDecode_master 1
Block: Decode
pcut_good_S1_time T.shms.p1T_tdcTime > 241 && T.shms.p1T_tdcTime < 243
pcut_good_S2X_time T.shms.p2X_tdcTime > 180 && T.shms.p2X_tdcTime < 220
pcut_good_S1_S2X_time pcut_good_S1_time && pcut_good_S2X_time
......
......@@ -7,6 +7,10 @@ SHMS_event g.evtyp == 1
HMS_event g.evtyp == 2
COIN_event g.evtyp == 4
RawDecode_master 1
Block: Decode
TRIG1 T.shms.pTRIG1_tdcTimeRaw > 0
TRIG2 T.shms.pTRIG2_tdcTimeRaw > 0
TRIG3 T.shms.pTRIG3_tdcTimeRaw > 0
......@@ -16,10 +20,6 @@ shms_trigs SHMS_event
edtm_accepted T.shms.pEDTM_tdcTime != 0.0
physics_accepted T.shms.pEDTM_tdcTime == 0.0
RawDecode_master 1
Block: Decode
Decode_master SHMS_event
Block: CoarseTracking
......
void replay_production_ep (Int_t RunNumber = 0, Int_t MaxEvent = 0) {
// Get RunNumber and MaxEvent if not provided.
if(RunNumber == 0) {
cout << "Enter a Run Number (-1 to exit): ";
cin >> RunNumber;
if( RunNumber<=0 ) return;
}
if(MaxEvent == 0) {
cout << "\nNumber of Events to analyze: ";
cin >> MaxEvent;
if(MaxEvent == 0) {
cerr << "...Invalid entry\n";
exit;
}
}
// Create file name patterns.
const char* RunFileNamePattern = "coin_all_%05d.dat";
vector<TString> pathList;
pathList.push_back(".");
pathList.push_back("./raw");
pathList.push_back("./raw/../raw.copiedtotape");
pathList.push_back("./cache");
//const char* RunFileNamePattern = "raw/coin_all_%05d.dat";
const char* ROOTFileNamePattern = "ROOTfiles/ep_%d.root";
// Load global parameters
// Add variables to global list.
gHcParms->Define("gen_run_number", "Run Number", RunNumber);
gHcParms->AddString("g_ctp_database_filename", "DBASE/COIN/STD/ep.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 SHMS trigger configuration
gHcParms->Load("PARAM/TRIG/tcoin.param");
// Load the Hall C detector map
gHcDetectorMap = new THcDetectorMap();
gHcDetectorMap->Load("MAPS/COIN/DETEC/coin.map");
gHcParms->Load("PARAM/SHMS/GEN/p_fadc_debug.param");
gHcParms->Load("PARAM/HMS/GEN/h_fadc_debug.param");
//=:=:=:=
// SHMS
//=:=:=:=
// Set up the equipment to be analyzed.
THcHallCSpectrometer* SHMS = new THcHallCSpectrometer("P", "SHMS");
SHMS->SetEvtType(1);
SHMS->AddEvtType(4);
SHMS->AddEvtType(5);
SHMS->AddEvtType(6);
SHMS->AddEvtType(7);
gHaApps->Add(SHMS);
// Add Noble Gas Cherenkov to SHMS apparatus
THcCherenkov* pngcer = new THcCherenkov("ngcer", "Noble Gas Cherenkov");
SHMS->AddDetector(pngcer);
// Add drift chambers to SHMS apparatus
THcDC* pdc = new THcDC("dc", "Drift Chambers");
SHMS->AddDetector(pdc);
// Add hodoscope to SHMS apparatus
THcHodoscope* phod = new THcHodoscope("hod", "Hodoscope");
SHMS->AddDetector(phod);
// Add Heavy Gas Cherenkov to SHMS apparatus
THcCherenkov* phgcer = new THcCherenkov("hgcer", "Heavy Gas Cherenkov");
SHMS->AddDetector(phgcer);
// Add Aerogel Cherenkov to SHMS apparatus
THcAerogel* paero = new THcAerogel("aero", "Aerogel");
SHMS->AddDetector(paero);
// Add calorimeter to SHMS apparatus
THcShower* pcal = new THcShower("cal", "Calorimeter");
SHMS->AddDetector(pcal);
// Include golden track information
THaGoldenTrack* pgtr = new THaGoldenTrack("P.gtr", "SHMS Golden Track", "P");
gHaPhysics->Add(pgtr);
// Add Rastered Beam Apparatus
THaApparatus* pbeam = new THcRasteredBeam("P.rb", "SHMS Rastered Beamline");
gHaApps->Add(pbeam);
THaReactionPoint* prp= new THaReactionPoint("P.react"," SHMS reaction point","P","P.rb");
gHaPhysics->Add(prp);
THcExtTarCor* pext = new THcExtTarCor("P.extcor"," HMS extended target corrections","P","P.react");
gHaPhysics->Add(pext);
// Add Physics Module to calculate primary (scattered) beam kinematics
THcPrimaryKine* pkin_primary = new THcPrimaryKine("P.kin.primary", "SHMS Single Arm Kinematics", "P", "P.rb");
gHaPhysics->Add(pkin_primary);
THcHodoEff* peff = new THcHodoEff("phodeff"," SHMS hodo efficiency","P.hod");
gHaPhysics->Add(peff);
// Add Physics Module to calculate secondary (scattered) beam kinematics
// THcSecondaryKine* pkin_secondary = new THcSecondaryKine("P.kin.secondary", "SHMS Single Arm Kinematics", "P", "H.kin.primary");
// gHaPhysics->Add(pkin_secondary);
// Add event handler for scaler events
// THcScalerEvtHandler* pscaler = new THcScalerEvtHandler("P", "Hall C scaler event type 1");
//pscaler->AddEvtType(1);
//pscaler->AddEvtType(4);
//pscaler->AddEvtType(5);
//pscaler->AddEvtType(6);
//pscaler->AddEvtType(7);
//pscaler->AddEvtType(129);
//pscaler->SetDelayedType(129);
//pscaler->SetUseFirstEvent(kTRUE);
//gHaEvtHandlers->Add(pscaler);
//=:=:=
// HMS
//=:=:=
// Set up the equipment to be analyzed.
THcHallCSpectrometer* HMS = new THcHallCSpectrometer("H", "HMS");
HMS->SetEvtType(2);
HMS->AddEvtType(4);
HMS->AddEvtType(5);
HMS->AddEvtType(6);
HMS->AddEvtType(7);
gHaApps->Add(HMS);
// Add drift chambers to HMS apparatus
THcDC* hdc = new THcDC("dc", "Drift Chambers");
HMS->AddDetector(hdc);
// Add hodoscope to HMS apparatus
THcHodoscope* hhod = new THcHodoscope("hod", "Hodoscope");
HMS->AddDetector(hhod);
// Add Cherenkov to HMS apparatus
THcCherenkov* hcer = new THcCherenkov("cer", "Heavy Gas Cherenkov");
HMS->AddDetector(hcer);
// Add Aerogel Cherenkov to HMS apparatus
//THcAerogel* aero = new THcAerogel("aero", "Aerogel");
//HMS->AddDetector(aero);
// Add calorimeter to HMS apparatus
THcShower* hcal = new THcShower("cal", "Calorimeter");
HMS->AddDetector(hcal);
// Include golden track information
THaGoldenTrack* hgtr = new THaGoldenTrack("H.gtr", "HMS Golden Track", "H");
gHaPhysics->Add(hgtr);
// Add Rastered Beam Apparatus
THaApparatus* hbeam = new THcRasteredBeam("H.rb", "HMS Rastered Beamline");
gHaApps->Add(hbeam);
THaReactionPoint* hrp= new THaReactionPoint("H.react"," HMS reaction point","H","H.rb");
gHaPhysics->Add(hrp);
THcExtTarCor* hext = new THcExtTarCor("H.extcor"," HMS extended target corrections","H","H.react");
gHaPhysics->Add(hext);
// Add Physics Module to calculate primary (scattered) beam kinematics
// THcPrimaryKine* hkin_primary = new THcPrimaryKine("H.kin.primary", "HMS Single Arm Kinematics", "H", "H.rb");
// gHaPhysics->Add(hkin_primary);
// Add Physics Module to calculate secondary (scattered) beam kinematics
THcSecondaryKine* hkin_secondary = new THcSecondaryKine("H.kin.secondary", "HMS Single Arm Kinematics", "H", "P.kin.primary");
gHaPhysics->Add(hkin_secondary);
THcHodoEff* heff = new THcHodoEff("hhodeff"," HMS hodo efficiency","H.hod");
gHaPhysics->Add(heff);
// Add event handler for scaler events
//THcScalerEvtHandler *hscaler = new THcScalerEvtHandler("H", "Hall C scaler event type 4");
//hscaler->AddEvtType(2);
//hscaler->AddEvtType(4);
//pscaler->AddEvtType(5);
//pscaler->AddEvtType(6);
//pscaler->AddEvtType(7);
//hscaler->AddEvtType(129);
//hscaler->SetDelayedType(129);
//hscaler->SetUseFirstEvent(kTRUE);
//gHaEvtHandlers->Add(hscaler);
//=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
// Global Objects & Event Handlers
//=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
// Add trigger apparatus
THaApparatus* TRG = new THcTrigApp("T", "TRG");
gHaApps->Add(TRG);
// Add trigger detector to trigger apparatus
THcTrigDet* coin = new THcTrigDet("coin", "Coincidence Trigger Information");
// Suppress missing reference time warnings for these event types
coin->SetEvtType(1);
coin->AddEvtType(2);
TRG->AddDetector(coin);
// Add event handler for prestart event 125.
THcConfigEvtHandler* ev125 = new THcConfigEvtHandler("HC", "Config Event type 125");
gHaEvtHandlers->Add(ev125);
// Add event handler for EPICS events
THaEpicsEvtHandler* hcepics = new THaEpicsEvtHandler("epics", "HC EPICS event type 180");
gHaEvtHandlers->Add(hcepics);
// Set up the analyzer - we use the standard one,
// but this could be an experiment-specific one as well.
// The Analyzer controls the reading of the data, executes
// tests/cuts, loops over Acpparatus's and PhysicsModules,
// and executes the output routines.
THcAnalyzer* analyzer = new THcAnalyzer;
// A simple event class to be output to the resulting tree.
// Creating your own descendant of THaEvent is one way of
// defining and controlling the output.
THaEvent* event = new THaEvent;
// Define the run(s) that we want to analyze.
// We just set up one, but this could be many.
THcRun* run = new THcRun( pathList, Form(RunFileNamePattern, RunNumber) );
// Set to read in Hall C run database parameters
run->SetRunParamClass("THcRunParameters");
// Eventually need to learn to skip over, or properly analyze
// the pedestal events
run->SetEventRange(1, MaxEvent); // Physics Event number, does not
// include scaler or control events.
run->SetNscan(1);
run->SetDataRequired(0x7);
run->Print();
// Define the analysis parameters
TString ROOTFileName = Form(ROOTFileNamePattern, RunNumber, MaxEvent);
analyzer->SetCountMode(2); // 0 = counter is # of physics triggers
// 1 = counter is # of all decode reads
// 2 = counter is event number
analyzer->SetEvent(event);
// Set EPICS event type
analyzer->SetEpicsEvtType(180);
// Define crate map
analyzer->SetCrateMapFileName("MAPS/db_cratemap.dat");
// Define output ROOT file
analyzer->SetOutFile(ROOTFileName.Data());
// Define DEF-file+
analyzer->SetOdefFile("DEF-files/COIN/PRODUCTION/coin_production_ep.def");
// Define cuts file
analyzer->SetCutFile("DEF-files/COIN/PRODUCTION/coin_production_ep_cuts.def"); // optional
// File to record accounting information for cuts
analyzer->SetSummaryFile(Form("REPORT_OUTPUT/COIN/PRODUCTION/summary_production_ep_%d.report", RunNumber)); // optional
// Start the actual analysis.
analyzer->Process(run);
// Create report file from template
analyzer->PrintReport("TEMPLATES/COIN/PRODUCTION/coin_production_ep.template",
Form("REPORT_OUTPUT/COIN/PRODUCTION/replay_coin_production_ep_%d.report", RunNumber)); // optional
}
void replay_coin_scalers (Int_t RunNumber = 0, Int_t MaxEvent = 0) {
// Get RunNumber and MaxEvent if not provided.
if(RunNumber == 0) {
cout << "Enter a Run Number (-1 to exit): ";
cin >> RunNumber;
if( RunNumber<=0 ) return;
}
if(MaxEvent == 0) {
cout << "\nNumber of Events to analyze: ";
cin >> MaxEvent;
if(MaxEvent == 0) {
cerr << "...Invalid entry\n";
exit;
}
}
// Create file name patterns.
const char* RunFileNamePattern = "coin_all_%05d.dat";
vector<TString> pathList;
pathList.push_back(".");
pathList.push_back("./raw");
pathList.push_back("./raw/../raw.copiedtotape");
pathList.push_back("./cache");
const char* ROOTFileNamePattern = "ROOTfiles/coin_replay_scalers_%d_%d.root";
// Load global parameters
// Add variables to global list.
gHcParms->Define("gen_run_number", "Run Number", RunNumber);
gHcParms->AddString("g_ctp_database_filename", "DBASE/COIN/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 SHMS coin configuration
gHcParms->Load("PARAM/TRIG/tcoin.param");
// Load the Hall C detector map
gHcDetectorMap = new THcDetectorMap();
gHcDetectorMap->Load("MAPS/COIN/DETEC/coin.map");
gHcParms->Load("PARAM/SHMS/GEN/p_fadc_debug.param");
gHcParms->Load("PARAM/HMS/GEN/h_fadc_debug.param");
// Add trigger apparatus
THaApparatus* TRG = new THcTrigApp("T", "TRG");
gHaApps->Add(TRG);
// Add trigger detector to trigger apparatus
THcTrigDet* coin = new THcTrigDet("coin", "Coincidence Trigger Information");
// Suppress missing reference time warnings for these event types
coin->SetEvtType(1);
coin->AddEvtType(2);
TRG->AddDetector(coin);
THcHallCSpectrometer* SHMS = new THcHallCSpectrometer("P", "SHMS");
SHMS->SetEvtType(1);
SHMS->AddEvtType(4);
SHMS->AddEvtType(5);
SHMS->AddEvtType(6);
SHMS->AddEvtType(7);
gHaApps->Add(SHMS);
THcHallCSpectrometer* HMS = new THcHallCSpectrometer("H", "HMS");
HMS->SetEvtType(2);
HMS->AddEvtType(4);
HMS->AddEvtType(5);
HMS->AddEvtType(6);
HMS->AddEvtType(7);
gHaApps->Add(HMS);
// Add handler for EPICS events
THaEpicsEvtHandler *hcepics = new THaEpicsEvtHandler("epics", "HC EPICS event type 180");
gHaEvtHandlers->Add(hcepics);
// Add handler for scaler events
THcScalerEvtHandler *pscaler = new THcScalerEvtHandler("P","Hall C scaler event type 1");
pscaler->AddEvtType(1);
pscaler->AddEvtType(2);
pscaler->AddEvtType(4);
pscaler->AddEvtType(5);
pscaler->AddEvtType(6);
pscaler->AddEvtType(7);
pscaler->AddEvtType(129);
pscaler->SetDelayedType(129);
pscaler->SetUseFirstEvent(kTRUE);
gHaEvtHandlers->Add(pscaler);
// Add handler for scaler events
THcScalerEvtHandler *hscaler = new THcScalerEvtHandler("H","Hall C scaler event type 1");
hscaler->AddEvtType(1);
hscaler->AddEvtType(2);
hscaler->AddEvtType(4);
hscaler->AddEvtType(5);
hscaler->AddEvtType(6);
hscaler->AddEvtType(7);
hscaler->AddEvtType(129);
hscaler->SetDelayedType(129);
hscaler->SetUseFirstEvent(kTRUE);
gHaEvtHandlers->Add(hscaler);
// Add event handler for DAQ configuration event
THcConfigEvtHandler *pconfig = new THcConfigEvtHandler("pconfig", "Hall C configuration event handler");
gHaEvtHandlers->Add(pconfig);
// Set up the analyzer - we use the standard one,
// but this could be an experiment-specific one as well.
// The Analyzer controls the reading of the data, executes
// tests/cuts, loops over Acpparatus's and PhysicsModules,
// and executes the output routines.
THcAnalyzer* analyzer = new THcAnalyzer;
// A simple event class to be output to the resulting tree.
// Creating your own descendant of THaEvent is one way of
// defining and controlling the output.
THaEvent* event = new THaEvent;
// Define the run(s) that we want to analyze.
// We just set up one, but this could be many.
THcRun* run = new THcRun( pathList, Form(RunFileNamePattern, RunNumber) );
// Eventually need to learn to skip over, or properly analyze
// the pedestal events
run->SetEventRange(1, MaxEvent); // Physics Event number, does not
// include scaler or control events.
run->SetNscan(1);
run->SetDataRequired(0x7);
run->Print();
// Define the analysis parameters
TString ROOTFileName = Form(ROOTFileNamePattern, RunNumber, MaxEvent);
analyzer->SetCountMode(2); // 0 = counter is # of physics triggers
// 1 = counter is # of all decode reads
// 2 = counter is event number
analyzer->SetEvent(event);
// Set EPICS event type
analyzer->SetEpicsEvtType(180);
// Define crate map
analyzer->SetCrateMapFileName("MAPS/db_cratemap.dat");
// Define output ROOT file
analyzer->SetOutFile(ROOTFileName.Data());
// Define DEF-file
analyzer->SetOdefFile("DEF-files/COIN/EPICS/epics_short.def");
// Define cuts file
analyzer->SetCutFile("DEF-files/COIN/SCALERS/coinscaler_cuts.def"); // optional
// File to record accounting information for cuts
analyzer->SetSummaryFile(Form("REPORT_OUTPUT/COIN/SCALERS/summary_scalers_%d_%d.report", RunNumber, MaxEvent)); // optional
// Start the actual analysis.
analyzer->Process(run);
// Create report file from template
analyzer->PrintReport("TEMPLATES/COIN/SCALERS/coinscalers.template",
Form("REPORT_OUTPUT/COIN/SCALERS/replay_coin_scalers_%d_%d.report", RunNumber, MaxEvent)); // optional
}
Run #: {gen_run_number}
1 MhZ Pulses : {P.1Mhz.scaler}
Run Length : {P.1Mhz.scalerTime:%.3f} sec
***********
* Beamline
***********
BCM1 Current: {P.BCM1.scalerCurrent:%.3f} uA
BCM2 Current: {P.BCM2.scalerCurrent:%.3f} uA
Unser Current: {P.Unser.scalerCurrent:%.3f} uA
With no cuts on BCM{gBCM_Current_threshold_index+1}.
BCM1 Counts: {P.BCM1.scaler} Total Charge: {P.BCM1.scalerCharge:%.3f} uC
BCM2 Counts: {P.BCM2.scaler} Total Charge: {P.BCM2.scalerCharge:%.3f} uC
Unser Counts: {P.Unser.scaler} Total Charge: {P.Unser.scalerCharge:%.3f} uC
Cut on BCM{gBCM_Current_threshold_index+1} current of {gBCM_Current_threshold} uA. Beam over threshold for {P.1Mhz.scalerTimeCut:%.3f}s, or {((P.1Mhz.scalerTimeCut/P.1Mhz.scalerTime)*100.):%.3f}% of total run time.
BCM1 Counts: {P.BCM1.scalerCut} Total Charge: {P.BCM1.scalerChargeCut:%.3f} uC
BCM2 Counts: {P.BCM2.scalerCut} Total Charge: {P.BCM2.scalerChargeCut:%.3f} uC
Unser Counts: {P.Unser.scalerCut} Total Charge: {P.Unser.scalerChargeCut:%.3f} uC
HMS Singles Triggers : {HMS_event.npassed}
SHMS Singles Triggers : {SHMS_event.npassed}
Coincidence Triggers : {COIN_event.npassed}
All triggers : {ALL_events.npassed}
\ No newline at end of file
This diff is collapsed.
protorootfile ../ROOTfiles/shms_replay_scalers_XXXXX_10000.root
protorootfile ../ROOTfiles/shms_coin_replay_production_XXXXX_50000.root
guicolor orange
canvassize 1600 800
canvassize 800 800
newpage 2 3
title Trig rates
macro UTIL/SHMS/SCALERS/plot_shms_scalers.C("uhScalTrigS1X","none")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment