Skip to content
Snippets Groups Projects
Commit 6565a90b authored by Eric Pooser's avatar Eric Pooser Committed by GitHub
Browse files

Coincidence setup (#193)

* First hack at setting up coincidence replay

* Add coincidence trigger map

* Update merge list for example purposes

* Add coincidence map

* Create coincidence replay script
parent 52e37147
No related branches found
No related tags found
No related merge requests found
Showing
with 4215 additions and 5 deletions
#real raddeg
raddeg=3.14159265/180
#real cminch
cminch=2.54
; General Hall-C parameter files
#include "PARAM/GEN/genflags.param"
#include "PARAM/GEN/gdebug.param"
#include "PARAM/GEN/gtarget.param"
#include "PARAM/GEN/gbeam.param"
; General HMS parameter files
; Note: hmsflags.param includes spectrometer offsets and options.
#include "PARAM/HMS/GEN/hcana.param"
#include "PARAM/HMS/GEN/hdebug.param"
#include "PARAM/HMS/GEN/hmsflags.param"
#include "PARAM/HMS/GEN/htracking.param"
; HMS default geometry parameter files
#include "PARAM/HMS/CER/GEOM/hcer_geom.param"
#include "PARAM/HMS/DC/GEOM/hdc_geom_6gev.param"
#include "PARAM/HMS/HODO/GEOM/hhodo_geom.param"
#include "PARAM/HMS/AERO/GEOM/haero_geom.param"
#include "PARAM/HMS/CAL/GEOM/hcal_geom.param"
; HMS default cut parameter files
#include "PARAM/HMS/CER/CUTS/hcer_cuts.param"
#include "PARAM/HMS/DC/CUTS/hdc_cuts_6gev.param"
#include "PARAM/HMS/HODO/CUTS/hhodo_cuts.param"
#include "PARAM/HMS/AERO/CUTS/haero_cuts.param"
#include "PARAM/HMS/CAL/CUTS/hcal_cuts.param"
; HMS default calibration parameter files
#include "PARAM/HMS/CER/CALIB/hcer_calib.param"
#include "PARAM/HMS/DC/CALIB/hdc_calib_6gev.param"
#include "PARAM/HMS/HODO/CALIB/hhodo_calib.param"
#include "PARAM/HMS/AERO/CALIB/haero_calib.param"
#include "PARAM/HMS/CAL/CALIB/hcal_calib.param"
; General SHMS parameter files
; Note: shmsflags.param includes spectrometer offsets and options.
#include "PARAM/SHMS/GEN/pcana.param"
#include "PARAM/SHMS/GEN/pdebug.param"
#include "PARAM/SHMS/GEN/shmsflags.param"
#include "PARAM/SHMS/GEN/ptracking.param"
; SHMS default geometry parameter files
#include "PARAM/SHMS/NGCER/GEOM/pngcer_geom.param"
#include "PARAM/SHMS/DC/GEOM/pdc_geom.param"
#include "PARAM/SHMS/HODO/GEOM/phodo_geom.param"
#include "PARAM/SHMS/HGCER/GEOM/phgcer_geom.param"
#include "PARAM/SHMS/AERO/GEOM/paero_geom.param"
#include "PARAM/SHMS/CAL/GEOM/pcal_geom.param"
; SHMS default cut parameter files
#include "PARAM/SHMS/NGCER/CUTS/pngcer_cuts.param"
#include "PARAM/SHMS/DC/CUTS/pdc_cuts.param"
#include "PARAM/SHMS/HODO/CUTS/phodo_cuts.param"
#include "PARAM/SHMS/HGCER/CUTS/phgcer_cuts.param"
#include "PARAM/SHMS/AERO/CUTS/paero_cuts.param"
#include "PARAM/SHMS/CAL/CUTS/pcal_cuts.param"
; SHMS default calibration parameter files
#include "PARAM/SHMS/NGCER/CALIB/pngcer_calib.param"
#include "PARAM/SHMS/DC/CALIB/pdc_calib.param"
#include "PARAM/SHMS/DC/CALIB/pdc_tzero_per_wire.param"
#include "PARAM/SHMS/HODO/CALIB/phodo_calib.param"
#include "PARAM/SHMS/HGCER/CALIB/phgcer_calib.param"
#include "PARAM/SHMS/AERO/CALIB/paero_calib.param"
#include "PARAM/SHMS/CAL/CALIB/pcal_calib.param"
\ No newline at end of file
0-99999
g_ctp_parm_filename ="DBASE/COIN/GEN/general.param"
g_ctp_kinematics_filename ="DBASE/COIN/STD/standard.kinematics"
\ No newline at end of file
0-99999
gpbeam = 6.4
gtarg_num = 1
htheta_lab = 15.
ptheta_lab = 15.
hpcentral = 3.
ppcentral = 3.
hpartmass = 0.00051099
ppartmass = 0.00051099
htargmass_amu = 12.0
ptargmass_amu = 12.0
\ No newline at end of file
#********************
# Block Definitions *
#********************
block T.coin.*
block H.cer.*
block H.dc.*
block H.tr.*
block H.hod.*
block H.cal.*
block H.gtr.*
block H.kin.*
block P.ngcer.*
block P.dc.*
block P.tr.*
block P.hod.*
block P.hgcer.*
block P.aero.*
block P.cal.*
block P.gtr.*
block P.kin.*
begin epics
IBC3H00CRCUR4
hac_bcm_average
ibcm1
ibcm2
iunser
itov3out
itov4out
end epics
Block: RawDecode
Pedestal_event g.evtyp == 4
scalar_event g.evtyp == 0
HMS_event g.evtyp == 1
SHMS_event g.evtyp == 1
coin_event g.evtyp == 3
tr4_event g.evtyp == 4
tr5_event g.evtyp == 5
tr6_event g.evtyp == 6
misc_event g.evtyp >= 10
hmscoin_event g.evtyp == 1 || g.evtyp == 3
shmscoin_event g.evtyp == 2 || g.evtyp == 3
all_event g.evtyp == 1 || g.evtyp == 2 || g.evtyp == 3
RawDecode_master 1
Block: Decode
all_trigs HMS_event || SHMS_event || coin_event
hms_coin_trig HMS_event || coin_event
shms_coin_trig SHMS_event || coin_event
hms_trig HMS_event
shms_trig SHMS_event
coin_trig coin_event
Decode_master SHMS_event
Block: CoarseTracking
CoarseTracking_master SHMS_event
Block: CoarseReconstruct
CoarseReconstruct_master SHMS_event
Block: Tracking
Tracking_master SHMS_event
Block: Reconstruct
Reconstruct_master SHMS_event
\ No newline at end of file
# Demo cuts for hodtest
#
# Report file for HMS stack
Block: RawDecode
......
==== Crate 1 type vme Bank Decoding
# slot model bank
2 1190 1190
3 250 250
4 250 250
5 250 250
6 250 250
7 250 250
8 250 250
9 250 250
10 250 250
13 250 250
14 250 250
15 250 250
16 250 250
17 250 250
18 250 250
19 250 250
20 1190 1190
==== Crate 2 type vme Bank Decoding
# slot model bank
3 250 250
4 250 250
5 250 250
6 250 250
7 250 250
8 250 250
9 250 250
10 250 250
13 250 250
14 250 250
18 1190 1190
19 1190 1190
20 1190 1190
\ No newline at end of file
==== Crate 3 type vme Bank Decoding
# slot model bank
4 1190 1190
5 1190 1190
7 1190 1190
8 1190 1190
10 1190 1190
13 1190 1190
14 1190 1190
16 1190 1190
17 1190 1190
==== Crate 4 type vme Bank Decoding
# slot model bank
3 250 250
4 250 250
5 250 250
6 250 250
7 250 250
8 250 250
9 250 250
10 250 250
13 250 250
14 250 250
15 250 250
16 250 250
17 250 250
18 250 250
19 250 250
20 250 250
\ No newline at end of file
==== Crate 5 type vme Bank Decoding
# slot model bank
\ No newline at end of file
==== Crate 6 type vme Bank Decoding
# slot model bank
6 1190 1190
7 1190 1190
8 1190 1190
9 1190 1190
10 1190 1190
11 1190 1190
12 1190 1190
13 1190 1190
14 1190 1190
15 1190 1190
! TCOIN_ID=30 :: ADC
DETECTOR=30
!=:=:=:
! HMS
!=:=:=:
ROC=1
!F250 module
SLOT=17
! chan plane bar sig
8, 1, 1, 0! hASUM
9, 1, 2, 0! hBSUM
10, 1, 3, 0! hCSUM
11, 1, 4, 0! hDSUM
12, 1, 5, 0! hPSHWR
13, 1, 6, 0! hSHWR
14, 1, 7, 0! hAERSUM
15, 1, 8, 0! hCERSUM
SLOT=18
! chan plane bar sig
12, 1, 9, 0! hFRXA
13, 1, 10, 0! hFRYA
14, 1, 11, 0! hFRXB
15, 1, 12, 0! hFRYB
!CAEN1190 module
SLOT=2
REFINDEX=0
! A0
! chan plane bar sig
0, 2, 1, 1! h1X
1, 2, 2, 1! h1Y
2, 2, 3, 1! h2X
3, 2, 4, 1! h2Y
4, 2, 5, 1! h1T
5, 2, 6, 1! h2T
6, 1000, 0, 0 ! hTref
7, 2, 8, 1! hASUM
8, 2, 9, 1! hBSUM
9, 2, 10, 1! hCSUM
10, 2, 11, 1! hDSUM
11, 2, 12, 1! hPSHWRLO
12, 2, 13, 1! hPSHWRHI
13, 2, 14, 1! hSHWR
14, 2, 15, 1! hAERSUM
15, 2, 16, 1! hCERSUM
!CAEN1190 module
SLOT=20
! D1
! chan plane bar sig
127, 2, 17, 1! hT2
ROC=3
!CAEN1190 module
SLOT=5
! chan plane bar sig
111, 2, 18, 1! hDCREF1
SLOT=8
! chan plane bar sig
127, 2, 19, 1! hDCREF2
SLOT=10
! chan plane bar sig
127, 2, 20, 1! hDCREF3
SLOT=17
! chan plane bar sig
127, 2, 21, 1! hDCREF4
!=:=:=:
! SHMS
!=:=:=:
ROC=2
SLOT=14
0, 1, 1, 0 ! pAERSUM
1, 1, 2, 0 ! pHGCERSUM
2, 1, 3, 0 ! pNGCERSUM
12, 1, 4, 0 ! FR-XA
13, 1, 5, 0 ! FR-YA
14, 1, 6, 0 ! FR-XB
15, 1, 7, 0 ! FR-YB
SLOT=20
15, 2, 1, 1 ! pT1
SLOT=19
REFINDEX=0
31, 1000, 0, 0 ! pTRef
32, 2, 3, 1 ! p1X
33, 2, 4, 1 ! p1Y
34, 2, 5, 1 ! p2X
35, 2, 6, 1 ! p2Y
36, 2, 7, 1 ! p1T
37, 2, 8, 1 ! p2T
38, 2, 9, 1 ! pT3
39, 2, 10, 1 ! pAERSUM
40, 2, 11, 1 ! pHGCERSUM
41, 2, 12, 1 ! pNGCERSUM
ROC=6
SLOT=6
79, 2, 13, 1 ! pDCREF1
SLOT=7
79, 2, 14, 1 ! pDCREF2
SLOT=8
79, 2, 15, 1 ! pDCREF3
SLOT=9
79, 2, 16, 1 ! pDCREF4
SLOT=10
79, 2, 17, 1 ! pDCREF5
SLOT=11
47, 2, 18, 1 ! pDCREF6
SLOT=12
47, 2, 19, 1 ! pDCREF7
SLOT=13
47, 2, 20, 1 ! pDCREF8
SLOT=14
15, 2, 21, 1 ! pDCREF9
SLOT=15
47, 2, 22, 1 ! pDCREF10
\ No newline at end of file
This diff is collapsed.
!HMS:
! HRASTER_ID=16 ADC
! Plane = 1 >> ADC Only
detector=16
ROC=1
!F250 module
SLOT=18
! chan plane bar sig
12, 1, 1, 0! FR-XA
13, 1, 2, 0! FR-XB
14, 1, 3, 0! FR-YA
15, 1, 4, 0! FR-YB
!SHMS:
! PRASTER_ID=27 ADC
! Plane = 1 >> ADC Only
detector=27
ROC=2
!F250 module
SLOT=14
! chan plane bar sig
12, 1, 1, 0! FR-XA
13, 1, 2, 0! FR-XB
14, 1, 3, 0! FR-YA
15, 1, 4, 0! FR-YB
SHMS/DETEC/TRIG/ptrig.map
HMS/DETEC/DC/hdc_6gev.map
HMS/DETEC/HODO/hhodo.map
HMS/DETEC/CER/hcer.map
HMS/DETEC/CAL/hcal.map
HMS/DETEC/RASTER/hraster.map
SHMS/DETEC/NGCER/pngcer.map
SHMS/DETEC/DC/pdc.map
SHMS/DETEC/HODO/phodo.map
SHMS/DETEC/HGCER/phgcer.map
SHMS/DETEC/NGCER/pngcer.map
SHMS/DETEC/CAL/pcal.map
SHMS/DETEC/AERO/paero.map
SHMS/DETEC/CAL/pcal.map
SHMS/DETEC/RASTER/praster.map
COIN/DETEC/TRIG/cointrig.map
t_coin_numAdc = 19
t_coin_numTdc = 43
t_coin_tdcoffset = -300.
t_coin_tdcchanperns = 0.1
; bar num: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
t_coin_adcNames = "pAERSUM pHGCSUM pNGCSUM pFRXA pFRYA pFRXB pFRYB hASUM hBSUM hCSUM hDSUM hPSHWR hSHWR hAERSUM hCERSUM hFRXA hFRYA hFRXB hFRYB"
; bar num: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
t_coin_tdcNames = "pT1 pT2 p1X p1Y p2X p2Y p1T p2T pT3 pAERSUM pHGCSUM pNGCSUM pDCREF1 pDCREF2 pDCREF3 pDCREF4 pDCREF5 pDCREF6 pDCREF7 pDCREF8 pDCREF9 pDCREF10 h1X h1Y h2X h2Y h1T h2T hT1 hASUM hBSUM hCSUM hDSUM hPSHWRLO hPSHWRHI hSHWR hAERSUM hCERSUM hT2 hDCREF1 hDCREF2 hDCREF3 hDCREF4"
\ No newline at end of file
void replay_production_coin (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 = "raw/shms_all_%05d.dat";
//const char* RunFileNamePattern = "raw/coin_all_%05d.dat";
const char* ROOTFileNamePattern = "ROOTfiles/coin_replay_production_%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 trigger configuration
gHcParms->Load("PARAM/TRIG/tcoin.param");
// Load the Hall C detector map
gHcDetectorMap = new THcDetectorMap();
gHcDetectorMap->Load("MAPS/COIN/DETEC/coin.map");
//=:=:=
// HMS
//=:=:=
// Set up the equipment to be analyzed.
THaApparatus* HMS = new THcHallCSpectrometer("H", "HMS");
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 Physics Module to calculate primary (scattered) beam kinematics
THcPrimaryKine* hkin_primary = new THcPrimaryKine("H.kin.primary", "HMS Single Arm Kinematics", "H", "IB");
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", "IB");
// gHaPhysics->Add(hkin_secondary);
// Add event handler for scaler events
THcScalerEvtHandler *hscaler = new THcScalerEvtHandler("H", "Hall C scaler event type 1");
hscaler->AddEvtType(1);
hscaler->SetUseFirstEvent(kTRUE);
gHaEvtHandlers->Add(hscaler);
//=:=:=:=
// SHMS
//=:=:=:=
// Set up the equipment to be analyzed.
THaApparatus* SHMS = new THcHallCSpectrometer("P", "SHMS");
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* gtr = new THaGoldenTrack("P.gtr", "SHMS Golden Track", "P");
gHaPhysics->Add(gtr);
// Add Physics Module to calculate primary (scattered) beam kinematics
THcPrimaryKine* pkin_primary = new THcPrimaryKine("P.kin.primary", "SHMS Single Arm Kinematics", "P", "IB");
gHaPhysics->Add(pkin_primary);
// // Add Physics Module to calculate secondary (scattered) beam kinematics
// THcSecondaryKine* pkin_secondary = new THcSecondaryKine("P.kin.secondary", "SHMS Single Arm Kinematics", "P", "IB");
// 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->SetUseFirstEvent(kTRUE);
gHaEvtHandlers->Add(pscaler);
//=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
// 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");
TRG->AddDetector(coin);
// Add Ideal Beam Apparatus
THaApparatus* beam = new THaIdealBeam("IB", "Ideal Beamline");
gHaApps->Add(beam);
// 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.
char RunFileName[100];
sprintf(RunFileName, RunFileNamePattern, RunNumber);
THaRun* run = new THaRun(RunFileName);
// 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.def");
// Define cuts file
analyzer->SetCutFile("DEF-files/COIN/PRODUCTION/coin_production_cuts.def"); // optional
// File to record accounting information for cuts
analyzer->SetSummaryFile(Form("REPORT_OUTPUT/COIN/PRODUCTION/summary_production_%d_%d.report", RunNumber, MaxEvent)); // optional
// Start the actual analysis.
analyzer->Process(run);
// Create report file from template
analyzer->PrintReport("TEMPLATES/COIN/PRODUCTION/coin_production.template",
Form("REPORT_OUTPUT/COIN/PRODUCTION/replay_coin_production_%d_%d.report", RunNumber, MaxEvent)); // optional
}
Run #: {gen_run_number}
Run Time : {P.1Mhz.scaler} {P.1Mhz.scaler/1000000.} sec
BCM1 : {(P.BCM1.scalerRate-250000)/(4673):%3.3f} uA Total charge = {(P.BCM1.scalerRate-250000) / (4673)*P.1Mhz.scaler/1000000.:%7.3f} uC
BCM2 : {(P.BCM2.scalerRate-250000)/(3954):%3.3f} uA Total charge = {(P.BCM2.scalerRate-250000) / (3954)*P.1Mhz.scaler/1000000.:%7.3f} uC
Unser : {(P.Unser.scalerRate-393000)/(4000):%3.3f} uA Total charge = {(P.Unser.scalerRate-393000) / (4000)*P.1Mhz.scaler/1000000.:%7.3f} uC
All triggers : {all_trigs.npassed}
\ No newline at end of file
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