From 3fc90a89a24dbea10e041ef8f792127b6a282340 Mon Sep 17 00:00:00 2001 From: "Stephen A. Wood" <zviwood@gmail.com> Date: Sun, 18 Aug 2013 22:06:09 -0400 Subject: [PATCH] Restore hodtest.C and hcal.param. Fix compile errors. --- examples/PARAM/hcal.param | 120 +++++++++++++++++++++++++++++++++++++- examples/hodtest.C | 79 +++++++++++++++++++++++++ src/THcShowerHit.h | 2 +- 3 files changed, 199 insertions(+), 2 deletions(-) mode change 120000 => 100644 examples/PARAM/hcal.param create mode 100644 examples/hodtest.C diff --git a/examples/PARAM/hcal.param b/examples/PARAM/hcal.param deleted file mode 120000 index 71fec94..0000000 --- a/examples/PARAM/hcal.param +++ /dev/null @@ -1 +0,0 @@ -../../analyzer_mdual/replay/PARAM/hcal.param \ No newline at end of file diff --git a/examples/PARAM/hcal.param b/examples/PARAM/hcal.param new file mode 100644 index 0000000..614215e --- /dev/null +++ b/examples/PARAM/hcal.param @@ -0,0 +1,119 @@ +; Slop in x position. Allowed distance between track and edge of block (in cm) +; too tight djm hcal_slop = 7.5 +hcal_slop = 7.5 + +;Turn on HMS cal. fiducial volume cut. 0="no cut" +;Default hcal_fv_test=0 + +hcal_fv_test = 0 + +hcal_pos_cal_const =0.0005,0.0005,0.0005,0.0005,0.0005,0.0005,0.0005,0.0005,0.0005,0.0005,0.0005,0.0005,0.0005 + 0.0005,0.0005,0.0005,0.0005,0.0005,0.0005,0.0005,0.0005,0.0005,0.0005,0.0005,0.0005,0.0005 + 0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001 + 0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001 + +hcal_neg_cal_const =0.0005,0.0005,0.0005,0.0005,0.0005,0.0005,0.0005,0.0005,0.0005,0.0005,0.0005,0.0005,0.0005 + 0.0005,0.0005,0.0005,0.0005,0.0005,0.0005,0.0005,0.0005,0.0005,0.0005,0.0005,0.0005,0.0005 + 0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001 + 0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001 + +hcal_pos_gain_ini =1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000 + 1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000 + 1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000 + 1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000 + +hcal_neg_gain_ini =1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000 + 1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000 + 1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000 + 1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000 + +hcal_pos_gain_cur =1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000 + 1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000 + 1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000 + 1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000 + +hcal_neg_gain_cur =1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000 + 1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000 + 1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000 + 1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000 + +;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> + +hcal_pos_ped_limit =1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000 + 1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000 + 1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000 + 1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000 + +hcal_neg_ped_limit =1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000 + 1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000 + 1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000 + 1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000 + +;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> + +; Calibration constants for run 48816, 35730 events processed +; +;hcal_pos_gain_cor= 0.454, 0.272, 0.377, 0.437, 0.367, 0.471, 0.371, 0.480, 0.382, 0.453, 0.306, 0.337, 0.300, +; 0.264, 0.451, 0.324, 0.300, 0.356, 0.358, 0.331, 0.391, 0.319, 0.309, 0.401, 0.450, 0.263, +; 0.746, 0.743, 0.703, 0.881, 0.760, 0.720, 0.636, 0.671, 1.003, 0.791, 0.607, 0.696, 0.817, +; 1.147, 0.920, 0.753, 0.829, 0.869, 0.876, 0.915, 0.899, 0.983, 0.763, 0.806, 0.915, 0.663, +;hcal_neg_gain_cor= 0.413, 0.827, 0.455, 0.366, 0.368, 0.403, 0.463, 0.402, 0.364, 0.371, 0.352, 0.534, 0.372, +; 0.475, 0.365, 0.446, 0.552, 0.454, 0.445, 0.418, 0.427, 0.457, 0.365, 0.377, 0.395, 0.416, +; 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, +; 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, + +; Calibration constants for run 49064, 28202 events processed + +;hcal_pos_gain_cor= 0.374, 0.368, 0.364, 0.336, 0.298, 0.424, 0.395, 0.452, 0.415, 0.000, 0.000, 0.000, 0.000, +; 0.311, 0.275, 0.234, 0.263, 0.312, 0.316, 0.264, 0.292, 0.624, 0.000, 0.000, 0.000, 0.000, +; 0.938, 0.668, 0.617, 0.785, 0.634, 0.624, 0.501, 0.568, 1.060, 0.000, 0.000, 0.000, 0.000, +; 0.047, 0.759, 0.725, 0.785, 0.833, 0.881, 0.938, 0.920, 1.856, 0.000, 0.000, 0.000, 0.000, +;hcal_neg_gain_cor= 0.391, 0.328, 0.357, 0.367, 0.314, 0.243, 0.353, 0.328, 0.241, 0.000, 0.000, 0.000, 0.000, +; 0.364, 0.450, 0.484, 0.563, 0.436, 0.442, 0.402, 0.453, 0.104, 0.000, 0.000, 0.000, 0.000, +; 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, +; 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, + +; Calibration constants for run 49098, 23159 events processed + +;hcal_pos_gain_cor= 0.344, 0.427, 0.342, 0.355, 0.291, 0.568, 0.536, 0.387, 0.000, 0.000, 0.000, 0.000, 0.000, +; 0.292, 0.319, 0.228, 0.295, 0.372, 0.436, 0.220, 0.392, 0.586, 0.000, 0.000, 0.000, 0.000, +; 0.938, 0.648, 0.625, 0.808, 0.636, 0.659, 0.544, 0.533, 1.229, 0.000, 0.000, 0.000, 0.000, +; 0.033, 0.769, 0.720, 0.886, 0.823, 0.925, 0.880, 1.089, 0.000, 0.000, 0.000, 0.000, 0.000, +;hcal_neg_gain_cor= 0.454, 0.301, 0.380, 0.370, 0.341, 0.099, 0.246, 0.474, 0.000, 0.000, 0.000, 0.000, 0.000, +; 0.412, 0.430, 0.542, 0.606, 0.400, 0.355, 0.515, 0.378, 0.804, 0.000, 0.000, 0.000, 0.000, +; 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, +; 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, + + +; the following lines are from calibration file +; written by the perlscript mkcalpar.prl + +;hcal_pos_gain_cor= 0.000, 0.328, 0.240, 0.482, 0.202, 0.397, 0.279, 0.327, 0.270, 0.299, 0.297, 0.309, 0.000, +; 0.000, 0.375, 0.317, 0.389, 0.390, 0.171, 0.274, 0.383, 0.310, 0.323, 0.297, 0.606, 1.168, +; 0.000, 0.744, 0.618, 0.853, 0.732, 0.674, 0.532, 0.646, 0.710, 0.714, 0.484, 0.773, 0.000, +; 0.000, 0.000, 0.684, 0.596, 0.716, 0.692, 0.694, 0.595, 0.806, 0.640, 0.841, 0.000, 0.000, +;hcal_neg_gain_cor= 0.000, 0.167, 0.372, 0.317, 0.255, 0.279, 0.376, 0.338, 0.336, 0.315, 0.295, 0.277, 0.000, +; 0.000, 0.246, 0.366, 0.471, 0.359, 0.549, 0.435, 0.427, 0.399, 0.298, 0.313, 0.342, 0.000, +; 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, +; 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, + + +hcal_pos_gain_cor= 0.973,0.775,0.814,0.839,0.638,0.72,0.699,0.74,0.794,0.805,0.658,0.694,0.604 + 0.794,0.756,0.688,0.719,0.791,0.795,0.715,0.879,0.744,0.725,0.8,1.129,0.424 + 0.716,0.66,0.623,0.899,0.682,0.764,0.609,0.641,0.924,0.835,0.55,0.671,0.888 + 1.468,0.754,0.789,1.015,0.869,1.083,1.148,0.962,1.236,0.745,0.949,1.004,0.892 +hcal_neg_gain_cor= 0.864,0.672,0.749,0.755,0.657,0.600,1.056,0.996,0.693,0.876,0.717,0.726,0.662 + 0.694,0.826,0.818,1.009,0.829,0.781,0.848,0.796,0.779,0.668,0.762,0.742,0.842 + 0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000 + 0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000 +; +; Calibration constants for run 63504, 51956 events processed + +;hcal_pos_gain_cor= 0.335, 0.316, 0.367, 0.498, 0.366, 0.363, 0.408, 0.451, 0.380, 0.473, 0.369, 0.416, 0.287, +; 0.417, 0.388, 0.361, 0.363, 0.314, 0.384, 0.349, 0.411, 0.356, 0.339, 0.412, 0.591, 0.286, +; 0.677, 0.707, 0.675, 0.986, 0.793, 0.760, 0.649, 0.725, 0.748, 0.876, 0.611, 0.706, 0.989, +; 1.011, 0.648, 0.685, 0.871, 0.791, 0.939, 1.035, 0.865, 0.967, 0.758, 0.866, 0.856, 0.504, +;hcal_neg_gain_cor= 0.490, 0.429, 0.436, 0.402, 0.349, 0.249, 0.435, 0.455, 0.378, 0.408, 0.332, 0.299, 0.394, +; 0.415, 0.480, 0.446, 0.630, 0.555, 0.460, 0.497, 0.514, 0.487, 0.449, 0.408, 0.486, 0.348, +; 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, +; 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, diff --git a/examples/hodtest.C b/examples/hodtest.C new file mode 100644 index 0000000..982e284 --- /dev/null +++ b/examples/hodtest.C @@ -0,0 +1,79 @@ + +{ + + // + // Steering script to test hodoscope decoding + // + + Int_t RunNumber=50017; + char* RunFileNamePattern="daq04_%d.log.0"; + + gHcParms->Define("gen_run_number", "Run Number", RunNumber); + gHcParms->AddString("g_ctp_database_filename", "DBASE/test.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_parm_filename")); + + // Constants not in ENGINE PARAM files that we want to be + // configurable + gHcParms->Load("PARAM/hcana.param"); + + // Generate db_cratemap to correspond to map file contents + char command[100]; + sprintf(command,"./make_cratemap.pl < %s > 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 ); + + // Add hodoscope + HMS->AddDetector( new THcHodoscope("hod", "Hodoscope" )); + HMS->AddDetector( new THcShower("cal", "Shower" )); + HMS->AddDetector( new THcDC("dc", "Drift Chambers" )); + THcAerogel* aerogel = new THcAerogel("aero", "Aerogel Cerenkov" ); + HMS->AddDetector( aerogel ); + + // 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,2000);// Physics Event number, does not + // include scaler or control events + + // Define the analysis parameters + analyzer->SetEvent( event ); + analyzer->SetOutFile( "hodtest.root" ); + analyzer->SetOdefFile("output.def"); + analyzer->SetCutFile("hodtest_cuts.def"); // optional + + // File to record cuts accounting information + // analyzer->SetSummaryFile("summary_example.log"); // optional + + analyzer->Process(run); // start the actual analysis +} diff --git a/src/THcShowerHit.h b/src/THcShowerHit.h index 1437699..84a8aa5 100644 --- a/src/THcShowerHit.h +++ b/src/THcShowerHit.h @@ -60,7 +60,7 @@ class THcShowerHit { //HMS calorimeter hit class bool isNeighbour(THcShowerHit* hit1) { //Is hit1 neighbouring this hit? int dRow = fRow-(*hit1).fRow; int dCol = fCol-(*hit1).fCol; - return abs(dRow)<2 && abs(dCol)<2; + return TMath::Abs(dRow)<2 && TMath::Abs(dCol)<2; } //Print out hit information -- GitLab