From f4e884708d19c62775a50dcc52697c12c5ace80f Mon Sep 17 00:00:00 2001 From: Eric Pooser <pooser@jlab.org> Date: Thu, 2 Feb 2017 15:31:18 -0500 Subject: [PATCH] Include HMS Cherenkov into replay scripts. Add/Modify DEF-files for HMS. --- DEF-files/HMS/CER/hcerana.def | 15 ++++ DEF-files/HMS/CER/hcerana_cuts.def | 13 ++++ MAPS/HMS/DETEC/hcer_htrig.map | 61 ++++++++++++++++ SCRIPTS/HMS/replay_hcer_test_stand.C | 100 +++++++++++++++++++++++++++ 4 files changed, 189 insertions(+) create mode 100644 DEF-files/HMS/CER/hcerana.def create mode 100644 DEF-files/HMS/CER/hcerana_cuts.def create mode 100644 MAPS/HMS/DETEC/hcer_htrig.map create mode 100644 SCRIPTS/HMS/replay_hcer_test_stand.C diff --git a/DEF-files/HMS/CER/hcerana.def b/DEF-files/HMS/CER/hcerana.def new file mode 100644 index 00000000..644b2234 --- /dev/null +++ b/DEF-files/HMS/CER/hcerana.def @@ -0,0 +1,15 @@ +# See $ANALYZER/examples/output_example.def for examples +# +block H.cer.* +block T.hms.* + +TH1F hcer_occu 'HMS Cherenkov ADC Occupancy; PMT Number; Number of ADC Hits' H.cer.adcCounter 2 0.5 2.5 + +TH2F hcer_rawped 'HMS Cherenkov Raw Pulse Pedestal; PMT Number; Raw Pulse Pedestal / 10 ADC Units' H.cer.adcCounter H.cer.adcPedRaw 2 0.5 2.5 400 0 4000 +TH2F hcer_rawpint 'HMS Cherenkov Raw Pulse Integral; PMT Number; Raw Pulse Integral / 10 ADC Units' H.cer.adcCounter H.cer.adcPulseIntRaw 2 0.5 2.5 4000 0 40000 +TH2F hcer_rawpamp 'HMS Cherenkov Raw Pulse Amplitude; PMT Number; Raw Pulse Amplitude / 10 ADC Units' H.cer.adcCounter H.cer.adcPulseAmpRaw 2 0.5 2.5 410 0 4100 +TH2F hcer_rawptime 'HMS Cherenkov Raw Pulse Time; PMT Number; Raw Pulse Time / 10 ADC Units' H.cer.adcCounter H.cer.adcPulseTimeRaw 2 0.5 2.5 400 0 4000 + +TH2F hcer_ped 'HMS Cherenkov Pulse Pedestal; PMT Number; Pulse Pedestal / 10 ADC Units' H.cer.adcCounter H.cer.adcPed 2 0.5 2.5 400 0 4000 +TH2F hcer_pint 'HMS Cherenkov Pulse Integral; PMT Number; Pulse Pedestal / 10 ADC Units' H.cer.adcCounter H.cer.adcPulseInt 2 0.5 2.5 4000 0 40000 +TH2F hcer_pamp 'HMS Cherenkov Pulse Amplitude; PMT Number; Pulse Pedestal / 10 ADC Units' H.cer.adcCounter H.cer.adcPulseAmp 2 0.5 2.5 410 0 4100 \ No newline at end of file diff --git a/DEF-files/HMS/CER/hcerana_cuts.def b/DEF-files/HMS/CER/hcerana_cuts.def new file mode 100644 index 00000000..3af34a5e --- /dev/null +++ b/DEF-files/HMS/CER/hcerana_cuts.def @@ -0,0 +1,13 @@ +Block: RawDecode + +Pedestal_event 0 +RawDecode_master 1 + +Block: Decode +Decode_master 1 + +Block: CoarseTracking +CoarseTracking_master 1 + +Block: CoarseReconstruct +CourseReconstruct 0 diff --git a/MAPS/HMS/DETEC/hcer_htrig.map b/MAPS/HMS/DETEC/hcer_htrig.map new file mode 100644 index 00000000..f243f6d9 --- /dev/null +++ b/MAPS/HMS/DETEC/hcer_htrig.map @@ -0,0 +1,61 @@ +! THMS_ID=10 :: ADC,TDC +! HCER_ID=14 :: (TDC),ADC + + +DETECTOR=10 + +ROC=11 + +SLOT=17 + 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=2 + 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, 2, 7, 1 ! hT1 + 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 + +SLOT=20 + 127, 2, 17, 1 ! hT2 + +ROC=3 + +SLOT=5 + 111, 2, 18, 1 ! hDCREF1 + +SLOT=8 + 127, 2, 19, 1 ! hDCREF2 + +SLOT=10 + 127, 2, 20, 1 ! hDCREF3 + +SLOT=17 + 127, 2, 21, 1 ! hDCREF4 + + +DETECTOR=14 + +ROC=11 + +SLOT=17 + 14, 1, 1, 0 ! hCER01 + 15, 1, 2, 0 ! hCER02 diff --git a/SCRIPTS/HMS/replay_hcer_test_stand.C b/SCRIPTS/HMS/replay_hcer_test_stand.C new file mode 100644 index 00000000..3e3c3047 --- /dev/null +++ b/SCRIPTS/HMS/replay_hcer_test_stand.C @@ -0,0 +1,100 @@ +void replay_hcer_test_stand(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/hms_all_%05d.dat"; + const char* ROOTFileNamePattern = "ROOTfiles/hcer_replay_%d.root"; + // Add variables to global list. + gHcParms->Define("gen_run_number", "Run Number", RunNumber); + gHcParms->AddString("g_ctp_database_filename", "DBASE/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")); + + // Load params for HMS trigger configuration + gHcParms->Load("PARAM/TRIG/thms.param"); + + // Load the Hall C style detector map + gHcDetectorMap = new THcDetectorMap(); + gHcDetectorMap->Load("MAPS/HMS/DETEC/hcer_htrig.map"); + + // Set up the equipment to be analyzed. + THaApparatus* HMS = new THcHallCSpectrometer("H", "HMS"); + gHaApps->Add(HMS); + // Add hodoscope to HMS apparatus + THcCherenkov* cer = new THcCherenkov("cer", "Heavy Gas Cherenkov"); + HMS->AddDetector(cer); + + // Add trigger apparatus + THaApparatus* TRG = new THcTrigApp("T", "TRG"); + gHaApps->Add(TRG); + // Add trigger detector to trigger apparatus + THcTrigDet* hms = new THcTrigDet("hms", "HMS Trigger Information"); + TRG->AddDetector(hms); + + // 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); + + // 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); + analyzer->SetCountMode(2); // 0 = counter is # of physics triggers + // 1 = counter is # of all decode reads + // 2 = counter is event number + analyzer->SetEvent(event); + analyzer->SetCrateMapFileName("MAPS/db_cratemap.dat"); + analyzer->SetOutFile(ROOTFileName.Data()); + analyzer->SetOdefFile("DEF-files/HMS/CER/hcerana.def"); + analyzer->SetCutFile("DEF-files/HMS/CER/hcerana_cuts.def"); // optional + + // File to record cuts accounting information + //analyzer->SetSummaryFile("summary_example.log"); // optional + + // Start the actual analysis. + analyzer->Process(run); + // Create report file from template. + //analyzer->PrintReport( // optional + // "TEMPLATES/dcana.template", + // Form("REPORT_OUTPUT/replay_hms_%05d.report", RunNumber) + //); +} -- GitLab