Skip to content
Snippets Groups Projects
Commit 31c6c131 authored by Mark K Jones's avatar Mark K Jones Committed by GitHub
Browse files

Merge pull request #1 from MarkKJones/master

Initial files
parents 01ed9b77 a0324628
No related branches found
No related tags found
No related merge requests found
0-99999 0-99999
g_ctp_parm_filename ="PARAM/general.param" g_ctp_parm_filename ="DBASE/general.param"
g_decode_map_filename ="MAPS/hms.map" g_decode_map_filename ="MAPS/hmschambers.map"
g_ctp_kinematics_filename ="DBASE/standard.kinematics" g_ctp_kinematics_filename ="DBASE/standard.kinematics"
1-99999
gpbeam=999
gtarg_num = 999
htheta_lab = 999
stheta_lab = 999
hpcentral = 999
spcentral = 999
hpartmass = 0.00051099
spartmass = 0.00051099
# See $ANALYZER/examples/output_example.def for examples
#
block H.dc.*
#block H.scin.*
TH1F hdc1x1_wm 'HDC 1X1 Wiremap' H.dc.1x1.tdchits 113 0.5 113.5
TH1F hdc1y1_wm 'HDC 1Y1 Wiremap' H.dc.1y1.tdchits 52 0.5 52.5
TH1F hdc1u1_wm 'HDC 1U1 Wiremap' H.dc.1u1.tdchits 107 0.5 107.5
TH1F hdc1v1_wm 'HDC 1V1 Wiremap' H.dc.1v1.tdchits 107 0.5 107.5
TH1F hdc1y2_wm 'HDC 1Y2 Wiremap' H.dc.1y2.tdchits 52 0.5 52.5
TH1F hdc1x2_wm 'HDC 1X2 Wiremap' H.dc.1x2.tdchits 113 0.5 113.5
TH1F hdc2x1_wm 'HDC 2X1 Wiremap' H.dc.2x1.tdchits 113 0.5 113.5
TH1F hdc2y1_wm 'HDC 2Y1 Wiremap' H.dc.2y1.tdchits 52 0.5 52.5
TH1F hdc2u1_wm 'HDC 2U1 Wiremap' H.dc.2u1.tdchits 107 0.5 107.5
TH1F hdc2v1_wm 'HDC 2V1 Wiremap' H.dc.2v1.tdchits 107 0.5 107.5
TH1F hdc2y2_wm 'HDC 2Y2 Wiremap' H.dc.2y2.tdchits 52 0.5 52.5
TH1F hdc2x2_wm 'HDC 2X2 Wiremap' H.dc.2x2.tdchits 113 0.5 113.5
TH1F hdc1x1_dd 'HDC 1X1 Drift Distance' H.dc.1x1.dist 300 -0.1 0.6
TH1F hdc1y1_dd 'HDC 1Y1 Drift Distance' H.dc.1y1.dist 300 -0.1 0.6
TH1F hdc1u1_dd 'HDC 1U1 Drift Distance' H.dc.1u1.dist 300 -0.1 0.6
TH1F hdc1v1_dd 'HDC 1V1 Drift Distance' H.dc.1v1.dist 300 -0.1 0.6
TH1F hdc1y2_dd 'HDC 1Y2 Drift Distance' H.dc.1y2.dist 300 -0.1 0.6
TH1F hdc1x2_dd 'HDC 1X2 Drift Distance' H.dc.1x2.dist 300 -0.1 0.6
TH1F hdc2x1_dd 'HDC 2X1 Drift Distance' H.dc.2x1.dist 300 -0.1 0.6
TH1F hdc2y1_dd 'HDC 2Y1 Drift Distance' H.dc.2y1.dist 300 -0.1 0.6
TH1F hdc2u1_dd 'HDC 2U1 Drift Distance' H.dc.2u1.dist 300 -0.1 0.6
TH1F hdc2v1_dd 'HDC 2V1 Drift Distance' H.dc.2v1.dist 300 -0.1 0.6
TH1F hdc2y2_dd 'HDC 2Y2 Drift Distance' H.dc.2y2.dist 300 -0.1 0.6
TH1F hdc2x2_dd 'HDC 2X2 Drift Distance' H.dc.2x2.dist 300 -0.1 0.6
Block: RawDecode
Pedestal_event 0
RawDecode_master 1
Block: Decode
Decode_master 1
Block: CoarseTracking
CoarseTracking_master 1
Block: CoarseReconstruct
CourseReconstruct 0
This diff is collapsed.
#!/usr/bin/perl
# Read a Hall C style MAP file and output a
# Hall A style crate map DB file.
#
# 22.03.2012 (saw)
# 11.04.2014 (saw) Perl cleanup
%crates=();
$crate = 0;
$nsubadd = 0;
$bsub = 0;
$modtype = 0;
$slot = 0;
while(<>) {
chomp($line=$_);
if($line=~/^\s*ROC=\s*(\d*)/i) {
$i++;
$crate = $1;
if(not $crates{$crate}) {
$slotlist={};
$crates{$crate} = $slotlist;
}
$modtype = 0;
$slot = 0;
} elsif ($line=~/^\s*nsubadd=\s*(\d*)/i) {
$nsubadd = $1;
$modtype = 0;
} elsif ($line=~/^\s*bsub=\s*(\d*)/i) {
$bsub = $1;
$modtype = 0;
} elsif ($line=~/^\s*slot=\s*(\d*)/i) {
$slot = $1;
$modtype = 0;
} elsif ($line=~/^\s*(\d*)\s*,\s*(\d*)\s*,\s*(\d*)/) {
if($modtype == 0) { # Slot not yet registered
if($nsubadd == 96) {
$modtype = 1877;
} elsif($nsubadd == 64) {
if($bsub == 16) {
$modtype = 1875;
} elsif($bsub == 17) {
$modtype = 1881;
}
}
if($modtype == 0) {
print "Unknown module Crate $crate, Slot $slot\n";
}
$crates{$crate}{$slot} = $modtype;
# print "$crate $slot $modtype\n";
}
}
}
print "# Hall C Crate map\n";
foreach $crate (sort {$a <=> $b} keys %crates) {
print "==== Crate $crate type fastbus\n";
print "# slot model clear header mask nchan ndata\n";
foreach $slot (sort {$a <=> $b} keys %{ $crates{$crate}}) {
$modtype = $crates{$crate}{$slot};
if($modtype == 1877) {
$ndata = 256;
} else {
$ndata = 64;
}
printf " %2d %d 1 0x0 0x0 %3d %d\n"
,$slot,$modtype,$nsubadd, $ndata;
}
}
...@@ -2,6 +2,11 @@ ...@@ -2,6 +2,11 @@
; Parameters that were built into Fortran analyzer that we want ; Parameters that were built into Fortran analyzer that we want
; to pass as parameters so that the resulting code can be more generic. ; to pass as parameters so that the resulting code can be more generic.
; ;
; Scintillator parameters
href_npaddles = 0
href_nsperchan = 0.1
href_offset = 0.0
;
hhodo_num_planes = 4 hhodo_num_planes = 4
hhodo_plane_names = "1x 1y 2x 2y" hhodo_plane_names = "1x 1y 2x 2y"
...@@ -29,7 +34,6 @@ hdc_plane_names = "1x1 1y1 1u1 1v1 1y2 1x2 2x1 2y1 2u1 2v1 2y2 2x2" ...@@ -29,7 +34,6 @@ hdc_plane_names = "1x1 1y1 1u1 1v1 1y2 1x2 2x1 2y1 2u1 2v1 2y2 2x2"
# The following were defined in REPLAY.PARAM # The following were defined in REPLAY.PARAM
h_recon_coeff_filename = 'DATFILES/hms_recon_coeff.dat' ;hms optics matrix h_recon_coeff_filename = 'DATFILES/hms_recon_coeff.dat' ;hms optics matrix
s_recon_coeff_filename = 'DATFILES/sos_recon_coeff.dat' ;SOs optics matrix
# The following are set to zero to replicate historical ENGINE behavior # The following are set to zero to replicate historical ENGINE behavior
# For new analyses they should be set to 1. If not defined here, # For new analyses they should be set to 1. If not defined here,
...@@ -42,44 +46,3 @@ hdc_fix_lr = 0 ...@@ -42,44 +46,3 @@ hdc_fix_lr = 0
# appears in a space point. (Which means the correction accumulates) # appears in a space point. (Which means the correction accumulates)
hdc_fix_propcorr = 0 hdc_fix_propcorr = 0
# SOS parameters
shodo_num_planes = 4
shodo_plane_names = "1x 1y 2x 2y"
scal_num_layers = 4
sdbg_init_cal=0
# Exclusion band width for the calorimeter's fiducial volume.
# (saw) Don't know what this should be. Copied it from HMS.
scal_fv_delta = 5.
# Constants for the coordiante correction of the calorimeter energy depositions
scal_a_cor = 400.
scal_b_cor = 12000.
scal_c_cor = -87.1628, -100. # The positive side constants reproduce
scal_d_cor = 1.65054, 3. # correction in Engine to accuracy better 0.005.
scal_layer_names = "1pr 2ta 3ta 4ta"
# Names of planes so that parameter names can be constructed
sdc_plane_names = "1u1 1u2 1x1 1x2 1v1 1v2 2u1 2u2 2x1 2x2 2v1 2v2"
# The following were defined in REPLAY.PARAM
# Fortran ENGINE only had this as a parameter for HMS. Need it here
# because same code used for both spectrometers
sntracks_max_fp = 10
# The following are set to zero to replicate historical ENGINE behavior
# For new analyses they should be set to 1. If not defined here,
# hcana will default 1, the new and correct behaviour.
# If 1, Let a hit have different L/R assignment for different space points
# instead of L/R assignment from first sp it appears in.
sdc_fix_lr = 0
# If 1, don't do the the propagation along the wire each time the hit
# appears in a space point. (Which means the correction accumulates)
sdc_fix_propcorr = 0
# Total number of PMTs in Gas Cherenkov detector.
scer_tot_pmts = 4
;---------------------------------------------------------------------
; HMS_TRACKING
; CTP parameter file containing all tracking parameters for the HMS
;----------------------------------------------------------------------
; sigma of wire chamber resolution for each plane
hdc_sigma = 0.020
0.020
0.020
0.020
0.020
0.020
0.020
0.020
0.020
0.020
0.020
0.020
hdc_tdc_min_win = 2000,2000,2000,2000,2000,2000
2000,2000,2000,2000,2000,2000
hdc_tdc_max_win = 5500,5000,5500,5500,5000,5500
5500,5000,5500,5500,5000,5500
; hms drift chamber tdc's time per channel
hdc_tdc_time_per_channel = 0.10
; hms zero time for drift chambers !DECREASING this number moves the hdtime plots to LOWER time.
hdc_plane_time_zero = -213.0,-213.0,-213.0,-213.0,-213.0,-213.0
-213.0,-213.0,-213.0,-213.0,-213.0,-213.0
; Dave Abbott's wire velocity correction
hdc_wire_velocity = 12.0
hdc_central_time = 7,9,3,4,6,5
7,5,3,4,6,6
; Lookup table
;number of bins in Meek's time to distance lookup table
hdriftbins=138
;number of 1st bin in Meek's table in ns
hdrift1stbin=-24
;bin size in ns of Meek's table
hdriftbinsz=2
hwc1x1fract=0.0000,0.0001,0.0001,0.0002,0.0003,0.0004,0.0004,0.0005 hwc1x1fract=0.0000,0.0001,0.0001,0.0002,0.0003,0.0004,0.0004,0.0005
0.0007,0.0008,0.0010,0.0012,0.0015,0.0020,0.0028,0.0041,0.0060,0.0086 0.0007,0.0008,0.0010,0.0012,0.0015,0.0020,0.0028,0.0041,0.0060,0.0086
0.0121,0.0167,0.0230,0.0311,0.0412,0.0529,0.0658,0.0800,0.0951,0.1114 0.0121,0.0167,0.0230,0.0311,0.0412,0.0529,0.0658,0.0800,0.0951,0.1114
......
void replay_hms(Int_t RunNumber=0, Int_t MaxEvent=0) {
//
//
if(RunNumber == 0) {
cout << "Enter a Run Number (-1 to exit): ";
cin >> RunNumber;
if( RunNumber<=0 ) break;
}
if(MaxEvent == 0) {
cout << "\nNumber of Events to analyze: ";
cin >> MaxEvent;
if(MaxEvent == 0) {
cerr << "...Invalid entry\n";
exit;
}
}
char* RunFileNamePattern="raw/test_%d.log.0";
const char* ROOTFileNamePattern = "ROOTfiles/hms1190_%d.root";
//
gHcParms->Define("gen_run_number", "Run Number", RunNumber);
gHcParms->AddString("g_ctp_database_filename", "DBASE/standard.database");
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"));
// Generate db_cratemap to correspond to map file contents
char command[100];
sprintf(command,"MAPS/make_cratemap.pl < %s > MAPS/db_cratemap.dat",gHcParms->GetString("g_decode_map_filename"));
system(command);
// Load the Hall C style detector map
gHcDetectorMap=new THcDetectorMap();
gHcDetectorMap->Load(gHcParms->GetString("g_decode_map_filename"));
// Set up the equipment to be analyzed.
THaApparatus* HMS = new THcHallCSpectrometer("H","HMS");
gHaApps->Add( HMS );
// HMS->AddDetector( new THcHodoscope("hod", "Hodoscope" ));
//HMS->AddDetector( new THcShower("cal", "Shower" ));
//THcCherenkov* cherenkov = new THcCherenkov("cher", "Gas Cerenkov" );
// HMS->AddDetector( cherenkov );
HMS->AddDetector( new THcDC("dc", "Drift Chambers" ));
//THcAerogel* aerogel = new THcAerogel("aero", "Aerogel Cerenkov" );
//HMS->AddDetector( aerogel );
//
//THcScalerEvtHandler *hscaler = new THcScalerEvtHandler("HS","HC scaler event type 0");
// hscaler->SetDebugFile("HScaler.txt");
//gHaEvtHandlers->Add (hscaler);
//
//
// 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
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->SetOutFile( ROOTFileName.Data() );
analyzer->SetOdefFile("Def-files/hdana.def");
analyzer->SetCutFile("Def-files/hdana_cuts.def"); // optional
// File to record cuts accounting information
// analyzer->SetSummaryFile("summary_example.log"); // optional
analyzer->Process(run); // start the actual analysis
analyzer->PrintReport("TEMPLATES/report.template",Form("REPORT_OUTPUT/replay_both_%05d.report",RunNumber));
}
void replay_hms(Int_t RunNumber=0, Int_t MaxEvent=0) {
//
//
if(RunNumber == 0) {
cout << "Enter a Run Number (-1 to exit): ";
cin >> RunNumber;
if( RunNumber<=0 ) break;
}
if(MaxEvent == 0) {
cout << "\nNumber of Events to analyze: ";
cin >> MaxEvent;
if(MaxEvent == 0) {
cerr << "...Invalid entry\n";
exit;
}
}
char* RunFileNamePattern="raw/test_%d.dat";
const char* ROOTFileNamePattern = "ROOTfiles/hms1190_%d.root";
//
gHcParms->Define("gen_run_number", "Run Number", RunNumber);
gHcParms->AddString("g_ctp_database_filename", "DBASE/standard.database");
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"));
// Generate db_cratemap to correspond to map file contents
//char command[100];
// sprintf(command,"MAPS/make_cratemap.pl < %s > db_cratemap.dat",gHcParms->GetString("g_decode_map_filename"));
//system(command);
// for now used pre made crate map
// Load the Hall C style detector map
gHcDetectorMap=new THcDetectorMap();
gHcDetectorMap->Load(gHcParms->GetString("g_decode_map_filename"));
// Set up the equipment to be analyzed.
THaApparatus* HMS = new THcHallCSpectrometer("H","HMS");
gHaApps->Add( HMS );
// HMS->AddDetector( new THcHodoscope("hod", "Hodoscope" ));
//HMS->AddDetector( new THcShower("cal", "Shower" ));
//THcCherenkov* cherenkov = new THcCherenkov("cher", "Gas Cerenkov" );
// HMS->AddDetector( cherenkov );
HMS->AddDetector( new THcDC("dc", "Drift Chambers" ));
//THcAerogel* aerogel = new THcAerogel("aero", "Aerogel Cerenkov" );
//HMS->AddDetector( aerogel );
//
//THcScalerEvtHandler *hscaler = new THcScalerEvtHandler("HS","HC scaler event type 0");
// hscaler->SetDebugFile("HScaler.txt");
//gHaEvtHandlers->Add (hscaler);
//
//
// 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->SetOutFile( ROOTFileName.Data() );
analyzer->SetOdefFile("DEF-files/hdcana.def");
analyzer->SetCutFile("DEF-files/hdcana_cuts.def"); // optional
// File to record cuts accounting information
// analyzer->SetSummaryFile("summary_example.log"); // optional
analyzer->Process(run); // start the actual analysis
// analyzer->PrintReport("TEMPLATES/dcana.template",Form("REPORT_OUTPUT/replay_hms_%05d.report",RunNumber));
}
Standalone drift chamber analysis report template
==== Crate 2 type vme
# slot model clear header mask nchan ndata
4 1190 1 0x40000004 0xff00001f 128 4096
5 1190 1 0x40000005 0xff00001f 128 4096
7 1190 1 0x40000007 0xff00001f 128 4096
8 1190 1 0x40000008 0xff00001f 128 4096
10 1190 1 0x4000000a 0xff00001f 128 4096
13 1190 1 0x4000000d 0xff00001f 128 4096
14 1190 1 0x4000000e 0xff00001f 128 4096
16 1190 1 0x40000010 0xff00001f 128 4096
17 1190 1 0x40000011 0xff00001f 128 4096
==== Crate 20 type vme
# slot model clear header mask nchan ndata
6 1190 1 0x40000006 0xff00001f 128 4096
7 1190 1 0x40000007 0xff00001f 128 4096
8 1190 1 0x40000008 0xff00001f 128 4096
9 1190 1 0x40000009 0xff00001f 128 4096
10 1190 1 0x4000000a 0xff00001f 128 4096
11 1190 1 0x4000000b 0xff00001f 128 4096
# d2n run database
--------[ 2015-01-01 01:00:00 ]
# 2015 SHMS Drift Chamber test sin ESB
ebeam = 6.0
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