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

Pooser workshop (#153)

* Add summer 2017 software analysis workshop example

* Add summer 2017 software analysis workshop example for real this time
parent e377706a
No related branches found
No related tags found
No related merge requests found
......@@ -22,5 +22,6 @@ CALIBRATION/shms_cal_calib/calibrated.deb
CALIBRATION/hms_cal_calib/calibrated.deb
CALIBRATION/hms_cal_calib/hcal_calib_cpp_ACLiC_dict_rdict.pcm
CALIBRATION/shms_cal_calib/pcal_calib_cpp_ACLiC_dict_rdict.pcm
onlineGUI/onlineGUI_v1.2.1/onlineDict_rdict.pcm
# Block variable definitions
block T.shms.*
block P.dc.*
block P.hod.*
block P.hgcer.*
block P.gtr.*
# Hodoscope 1x+ ADC 1D histograms
TH1F phodo_1x_pos_rawpa 'SHMS 1X+ Raw Pulse Amplitude; Raw Pulse Amplitude; Number of Entries / 10 ADC Channels' P.hod.1x.posAdcPulseAmpRaw 410 0 4100
TH1F phodo_1x_pos_pa 'SHMS 1X+ Pulse Amplitude; Pulse Amplitude; Number of Entries / 10 ADC Channels' P.hod.1x.posAdcPulseAmp 410 0 4100
TH1F phodo_1x_pos_pt 'SHMS 1X+ Raw Pulse Time; Raw Pulse Time; Number of Entried / 100 ADC Channels' P.hod.1x.posAdcPulseTimeRaw 640 0 6400
# Hodoscope 1x+ ADC cut 1D histogram
TH1F phodo_1x_pos_pa_ntrack_cut 'SHMS 1X+ Pulse Amplitude NTrack = 1 Cut; Pulse Amplitude; Number of Entries / 10 ADC Channels' P.hod.1x.posAdcPulseAmp 410 0 4100 P.dc.ntrack==1
# Hodoscope 1x+ ADC 2D histograms
TH2F phodo_1x_pos_rawpa_vs_pmt 'SHMS 1X+ Raw Pulse Amplitude vs PMT; PMT Number; Raw Pulse Amplitude / 10 ADC Channels' P.hod.1x.posAdcCounter P.hod.1x.posAdcPulseAmpRaw 13 0.5 13.5 410 0 4100
TH2F phodo_1x_pos_pa_vs_pmt 'SHMS 1X+ Pulse Amplitude vs PMT; PMT Number; Pulse Amplitude / 10 ADC Channels' P.hod.1x.posAdcCounter P.hod.1x.posAdcPulseAmp 13 0.5 13.5 410 0 4100
TH2F phodo_1x_pos_pt_vs_pmt 'SHMS 1X+ Raw Pulse Time vs PMT; PMT Number; Raw Pulse Time / 100 ADC Channels' P.hod.1x.posAdcCounter P.hod.1x.posAdcPulseTimeRaw 13 0.5 13.5 640 0 6400
# DC TDC 2D histograms
TH2F pdc_1x1_raw_tdc 'SHMS 1X1 Raw TDC vs. Wire Number; Wire Number; Raw TDC Value/ 10 TDC Units' P.dc.1x1.wirenum P.dc.1u1.rawtdc 79 0.5 79.5 5000 -25000 25000
# Heavy gas 2D histograms
# Vector of histograms
TH2F phgc_good_pt_vs_pa_pmt_ 'SHMS HGCER Good Pulse Time vs. Good Pulse Amplitude; Good Pulse Amplitude / 10 ADC Channels; Good Pulse Time / 100 ADC Channels' P.hgcer.goodAdcPulseAmp P.hgcer.goodAdcPulseTime 410 0 4100 250 0 2500
# Scalar histogram
sTH2F phgc_good_pt_vs_pa_all 'SHMS HGCER Good Pulse Time vs. Good Pulse Amplitude; Good Pulse Amplitude / 10 ADC Channels; Good Pulse Time / 100 ADC Channels' P.hgcer.goodAdcPulseAmp P.hgcer.goodAdcPulseTime 410 0 4100 250 0 2500
# Eye histogram
TH1F phgc_good_pi_pmt_3 'SHMS HGCER Good Pulse Integral; Good Pulse Integral; Number of Entries / 100 ADC Channels' P.hgcer.goodAdcPulseInt[2] 300 0 30000
TH2F phgc_good_pi_vs_pmt 'SHMS HGCER Good Pulse Integral vs. PMT; PMT Number; Good Pulse Integral / 100 ADC Channels' [I+1] P.hgcer.goodAdcPulseInt 4 0.5 4.5 300 0 30000 P.hgcer.goodAdcPulseInt>0.0
\ No newline at end of file
void replay_workshop_example(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* ROOTFileNamePattern = "ROOTfiles/shms_replay_%d_%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 SHMS trigger configuration
gHcParms->Load("PARAM/TRIG/tshms.param");
// Load the Hall C style detector map
gHcDetectorMap = new THcDetectorMap();
gHcDetectorMap->Load("MAPS/SHMS/DETEC/shms_stack.map");
// Add trigger apparatus
THaApparatus* TRG = new THcTrigApp("T", "TRG");
gHaApps->Add(TRG);
// Add trigger detector to trigger apparatus
THcTrigDet* shms = new THcTrigDet("shms", "SHMS Trigger Information");
TRG->AddDetector(shms);
// Set up the equipment to be analyzed.
THaApparatus* SHMS = new THcHallCSpectrometer("P", "SHMS");
gHaApps->Add(SHMS);
// Add drift chambers to SHMS apparatus
THcDC* dc = new THcDC("dc", "Drift Chambers");
SHMS->AddDetector(dc);
// Add hodoscope to SHMS apparatus
THcHodoscope* hod = new THcHodoscope("hod", "Hodoscope");
SHMS->AddDetector(hod);
// Add Heavy Gas Cherenkov to SHMS apparatus
THcCherenkov* hgcer = new THcCherenkov("hgcer", "Heavy Gas Cherenkov");
SHMS->AddDetector(hgcer);
// Include golden track information
THaGoldenTrack* gtr = new THaGoldenTrack("P.gtr", "SHMS Golden Track", "P");
gHaPhysics->Add(gtr);
// Add handler for prestart event 125.
THcConfigEvtHandler* ev125 = new THcConfigEvtHandler("HC", "Config Event type 125");
gHaEvtHandlers->Add(ev125);
// 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, 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);
analyzer->SetCrateMapFileName("MAPS/db_cratemap.dat");
analyzer->SetOutFile(ROOTFileName.Data());
analyzer->SetOdefFile("DEF-files/SHMS/GEN/workshop_example.def");
analyzer->SetCutFile("DEF-files/SHMS/GEN/pstackana_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_shms_%05d.report", RunNumber)
//);
}
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