Skip to content
Snippets Groups Projects
Commit 49064b4b authored by Buddhini Waidyawansa's avatar Buddhini Waidyawansa Committed by Stephen A. Wood
Browse files

THcRaster minor changse, files prefixed with raster_ for testing.

  Files with the prefix raster_ are coppies of original *.database,
  and *.param files which now includes changes nessacery for
  decoding raster data. I created seperate files for these because I
  need to merge this code upstream before I can compare the raster
  decoding results with that of the analyzer. For e.g. the map files are
  different from the original map files. So Steve needs to create a perl
  script that can propgate these changes in the map files to the map
  file of the analyzer inorder for me to do the analyzer hcana
  comparision. Once the comparision is done and we are satisifies with
  the results, we will merge the changes with the original files and
  remove the files with the prefix raster_*.

  gbeam.param now included by general.param.  No need to load
  a separate parameter set to test raster/BPM code.

  examples/MAPS/raster_jun04.map adds new detector IDs for the raster
  and BPMs as follows:

Add the following IDs to the misc elements,
BEAM
 RASTER_ID= 18          ADC
 BPM_ID= 19             ADC

In the channel section did the following modification:
 sub , plane, counter, sig
  14, 1, 13, 1 !ADC ROC#1 Sl#15 Ch#14 Fast Raster X-sync
  15, 1, 14, 2 !ADC ROC#1 Sl#15 Ch#15 Fast Raster X-signal
  12, 1, 15, 3 !ADC ROC#1 Sl#15 Ch#12 Fast Raster Y-sync
  13, 1, 16, 4 !ADC ROC#1 Sl#15 Ch#13 Fast Raster Y-signal
parent bd295b0b
No related branches found
No related tags found
No related merge requests found
# ENGINE style parameter vs. run number database
# buddhini - coppied from test.database to setup the raster decoding.
#
50017
g_ctp_parm_filename="PARAM/general.param"
g_decode_map_filename="MAPS/raster_jun04.map"
# Values taken from Logbook. Not necessarily official.
gpbeam = 4.015
hpcentral = 2.074
htheta_lab = 10.99
hpartmass = 0.13957
52949
g_ctp_parm_filename="PARAM/52949/general.param"
g_decode_map_filename="MAPS/july04.map"
# From DBASE/online04.kinematics_online.
gpbeam = 1.2048
hpcentral = 0.811
htheta_lab = 55.
hpartmass = 0.00051099
47000-48000
g_ctp_parm_filename="PARAM/general.param"
g_decode_map_filename="MAPS/jan03.map"
This diff is collapsed.
......@@ -13,6 +13,7 @@ raddeg=3.14159265/180
#include "PARAM/stracking.param"
#include "PARAM/gtarget.param"
#include "PARAM/gbeam.param"
; Can't quite handle this one
#include "PARAM/hdc_offsets.param"
#include "PARAM/hdc.pos"
......
# See $ANALYZER/examples/output_example.def for examples
#
block H.dc.*
block H.hod.*
block H.cal.*
block H.aero.*
block H.cher.*
block H.tr.*
block RB.*
block g.evtyp
# TDC hits per paddle
TH1F hpostdc1 'HMS s1x+ TDC hits' H.hod.1x.postdchits 16 0.5 16.5
TH1F hnegtdc1 'HMS s1x- TDC hits' H.hod.1x.negtdchits 16 0.5 16.5
TH1F hpostdc2 'HMS s1y+ TDC hits' H.hod.1y.postdchits 10 0.5 10.5
TH1F hnegtdc2 'HMS s1y- TDC hits' H.hod.1y.negtdchits 10 0.5 10.5
TH1F hpostdc3 'HMS s2x+ TDC hits' H.hod.2x.postdchits 16 0.5 16.5
TH1F hnegtdc3 'HMS s2x- TDC hits' H.hod.2x.negtdchits 16 0.5 16.5
TH1F hpostdc4 'HMS s2y+ TDC hits' H.hod.2y.postdchits 10 0.5 10.5
TH1F hnegtdc4 'HMS s2y- TDC hits' H.hod.2y.negtdchits 10 0.5 10.5
# ADC hits per paddle
TH1F hposadc1 'HMS s1x+ ADC hits' H.hod.1x.posadchits 16 0.5 16.5
TH1F hnegadc1 'HMS s1x- ADC hits' H.hod.1x.negadchits 16 0.5 16.5
TH1F hposadc2 'HMS s1y+ ADC hits' H.hod.1y.posadchits 10 0.5 10.5
TH1F hnegadc2 'HMS s1y- ADC hits' H.hod.1y.negadchits 10 0.5 10.5
TH1F hposadc3 'HMS s2x+ ADC hits' H.hod.2x.posadchits 16 0.5 16.5
TH1F hnegadc3 'HMS s2x- ADC hits' H.hod.2x.negadchits 16 0.5 16.5
TH1F hposadc4 'HMS s2y+ ADC hits' H.hod.2y.posadchits 10 0.5 10.5
TH1F hnegadc4 'HMS s2y- ADC hits' H.hod.2y.negadchits 10 0.5 10.5
# ADC hits per Calorimeter layer
TH1F chposadc1 'HMS Cal A+ ADC hits' H.cal.1pr.posadchits 13 0.5 13.5
TH1F chnegadc1 'HMS Cal A- ADC hits' H.cal.1pr.negadchits 13 0.5 13.5
TH1F chposadc2 'HMS Cal B+ ADC hits' H.cal.2ta.posadchits 13 0.5 13.5
TH1F chnegadc2 'HMS Cal B- ADC hits' H.cal.2ta.negadchits 13 0.5 13.5
TH1F chposadc3 'HMS Cal C+ ADC hits' H.cal.3ta.posadchits 13 0.5 13.5
TH1F chposadc4 'HMS Cal D+ ADC hits' H.cal.4ta.posadchits 13 0.5 13.5
#Calorimeter ADC channels
TH1F hcaladc_A1p 'HMS Cal ADC A1p - PED' H.cal.1pr.apos_p[0] 150 50 500
TH1F hcaladc_A2p 'HMS Cal ADC A2p - PED' H.cal.1pr.apos_p[1] 150 50 500
TH1F hcaladc_A3p 'HMS Cal ADC A3p - PED' H.cal.1pr.apos_p[2] 150 50 500
TH1F hcaladc_A4p 'HMS Cal ADC A4p - PED' H.cal.1pr.apos_p[3] 150 50 500
TH1F hcaladc_A5p 'HMS Cal ADC A5p - PED' H.cal.1pr.apos_p[4] 150 50 500
TH1F hcaladc_A6p 'HMS Cal ADC A6p - PED' H.cal.1pr.apos_p[5] 150 50 500
TH1F hcaladc_A7p 'HMS Cal ADC A7p - PED' H.cal.1pr.apos_p[6] 150 50 500
TH1F hcaladc_A8p 'HMS Cal ADC A8p - PED' H.cal.1pr.apos_p[7] 150 50 500
TH1F hcaladc_A9p 'HMS Cal ADC A9p - PED' H.cal.1pr.apos_p[8] 150 50 500
TH1F hcaladc_A10p 'HMS Cal ADC A10p - PED' H.cal.1pr.apos_p[9] 150 50 500
TH1F hcaladc_A11p 'HMS Cal ADC A11p - PED' H.cal.1pr.apos_p[10] 150 50 500
TH1F hcaladc_A12p 'HMS Cal ADC A12p - PED' H.cal.1pr.apos_p[11] 150 50 500
TH1F hcaladc_A13p 'HMS Cal ADC A13p - PED' H.cal.1pr.apos_p[12] 150 50 500
TH1F hcaladc_B1p 'HMS Cal ADC B1p - PED' H.cal.2ta.apos_p[0] 150 50 500
TH1F hcaladc_B2p 'HMS Cal ADC B2p - PED' H.cal.2ta.apos_p[1] 150 50 500
TH1F hcaladc_B3p 'HMS Cal ADC B3p - PED' H.cal.2ta.apos_p[2] 150 50 500
TH1F hcaladc_B4p 'HMS Cal ADC B4p - PED' H.cal.2ta.apos_p[3] 150 50 500
TH1F hcaladc_B5p 'HMS Cal ADC B5p - PED' H.cal.2ta.apos_p[4] 150 50 500
TH1F hcaladc_B6p 'HMS Cal ADC B6p - PED' H.cal.2ta.apos_p[5] 150 50 500
TH1F hcaladc_B7p 'HMS Cal ADC B7p - PED' H.cal.2ta.apos_p[6] 150 50 500
TH1F hcaladc_B8p 'HMS Cal ADC B8p - PED' H.cal.2ta.apos_p[7] 150 50 500
TH1F hcaladc_B9p 'HMS Cal ADC B9p - PED' H.cal.2ta.apos_p[8] 150 50 500
TH1F hcaladc_B10p 'HMS Cal ADC B10p - PED' H.cal.2ta.apos_p[9] 150 50 500
TH1F hcaladc_B11p 'HMS Cal ADC B11p - PED' H.cal.2ta.apos_p[10] 150 50 500
TH1F hcaladc_B12p 'HMS Cal ADC B12p - PED' H.cal.2ta.apos_p[11] 150 50 500
TH1F hcaladc_B13p 'HMS Cal ADC B13p - PED' H.cal.2ta.apos_p[12] 150 50 500
TH1F hcaladc_C1p 'HMS Cal ADC C1p - PED' H.cal.3ta.apos_p[0] 150 50 500
TH1F hcaladc_C2p 'HMS Cal ADC C2p - PED' H.cal.3ta.apos_p[1] 150 50 500
TH1F hcaladc_C3p 'HMS Cal ADC C3p - PED' H.cal.3ta.apos_p[2] 150 50 500
TH1F hcaladc_C4p 'HMS Cal ADC C4p - PED' H.cal.3ta.apos_p[3] 150 50 500
TH1F hcaladc_C5p 'HMS Cal ADC C5p - PED' H.cal.3ta.apos_p[4] 150 50 500
TH1F hcaladc_C6p 'HMS Cal ADC C6p - PED' H.cal.3ta.apos_p[5] 150 50 500
TH1F hcaladc_C7p 'HMS Cal ADC C7p - PED' H.cal.3ta.apos_p[6] 150 50 500
TH1F hcaladc_C8p 'HMS Cal ADC C8p - PED' H.cal.3ta.apos_p[7] 150 50 500
TH1F hcaladc_C9p 'HMS Cal ADC C9p - PED' H.cal.3ta.apos_p[8] 150 50 500
TH1F hcaladc_C10p 'HMS Cal ADC C10p - PED' H.cal.3ta.apos_p[9] 150 50 500
TH1F hcaladc_C11p 'HMS Cal ADC C11p - PED' H.cal.3ta.apos_p[10] 150 50 500
TH1F hcaladc_C12p 'HMS Cal ADC C12p - PED' H.cal.3ta.apos_p[11] 150 50 500
TH1F hcaladc_C13p 'HMS Cal ADC C13p - PED' H.cal.3ta.apos_p[12] 150 50 500
TH1F hcaladc_D1p 'HMS Cal ADC D1p - PED' H.cal.4ta.apos_p[0] 150 50 500
TH1F hcaladc_D2p 'HMS Cal ADC D2p - PED' H.cal.4ta.apos_p[1] 150 50 500
TH1F hcaladc_D3p 'HMS Cal ADC D3p - PED' H.cal.4ta.apos_p[2] 150 50 500
TH1F hcaladc_D4p 'HMS Cal ADC D4p - PED' H.cal.4ta.apos_p[3] 150 50 500
TH1F hcaladc_D5p 'HMS Cal ADC D5p - PED' H.cal.4ta.apos_p[4] 150 50 500
TH1F hcaladc_D6p 'HMS Cal ADC D6p - PED' H.cal.4ta.apos_p[5] 150 50 500
TH1F hcaladc_D7p 'HMS Cal ADC D7p - PED' H.cal.4ta.apos_p[6] 150 50 500
TH1F hcaladc_D8p 'HMS Cal ADC D8p - PED' H.cal.4ta.apos_p[7] 150 50 500
TH1F hcaladc_D9p 'HMS Cal ADC D9p - PED' H.cal.4ta.apos_p[8] 150 50 500
TH1F hcaladc_D10p 'HMS Cal ADC D10p - PED' H.cal.4ta.apos_p[9] 150 50 500
TH1F hcaladc_D11p 'HMS Cal ADC D11p - PED' H.cal.4ta.apos_p[10] 150 50 500
TH1F hcaladc_D12p 'HMS Cal ADC D12p - PED' H.cal.4ta.apos_p[11] 150 50 500
TH1F hcaladc_D13p 'HMS Cal ADC D13p - PED' H.cal.4ta.apos_p[12] 150 50 500
TH1F hcaladc_A1n 'HMS Cal ADC A1n - PED' H.cal.1pr.aneg_p[0] 150 50 500
TH1F hcaladc_A2n 'HMS Cal ADC A2n - PED' H.cal.1pr.aneg_p[1] 150 50 500
TH1F hcaladc_A3n 'HMS Cal ADC A3n - PED' H.cal.1pr.aneg_p[2] 150 50 500
TH1F hcaladc_A4n 'HMS Cal ADC A4n - PED' H.cal.1pr.aneg_p[3] 150 50 500
TH1F hcaladc_A5n 'HMS Cal ADC A5n - PED' H.cal.1pr.aneg_p[4] 150 50 500
TH1F hcaladc_A6n 'HMS Cal ADC A6n - PED' H.cal.1pr.aneg_p[5] 150 50 500
TH1F hcaladc_A7n 'HMS Cal ADC A7n - PED' H.cal.1pr.aneg_p[6] 150 50 500
TH1F hcaladc_A8n 'HMS Cal ADC A8n - PED' H.cal.1pr.aneg_p[7] 150 50 500
TH1F hcaladc_A9n 'HMS Cal ADC A9n - PED' H.cal.1pr.aneg_p[8] 150 50 500
TH1F hcaladc_A10n 'HMS Cal ADC A10n - PED' H.cal.1pr.aneg_p[9] 150 50 500
TH1F hcaladc_A11n 'HMS Cal ADC A11n - PED' H.cal.1pr.aneg_p[10] 150 50 500
TH1F hcaladc_A12n 'HMS Cal ADC A12n - PED' H.cal.1pr.aneg_p[11] 150 50 500
TH1F hcaladc_A13n 'HMS Cal ADC A13n - PED' H.cal.1pr.aneg_p[12] 150 50 500
TH1F hcaladc_B1n 'HMS Cal ADC B1n - PED' H.cal.2ta.aneg_p[0] 150 50 500
TH1F hcaladc_B2n 'HMS Cal ADC B2n - PED' H.cal.2ta.aneg_p[1] 150 50 500
TH1F hcaladc_B3n 'HMS Cal ADC B3n - PED' H.cal.2ta.aneg_p[2] 150 50 500
TH1F hcaladc_B4n 'HMS Cal ADC B4n - PED' H.cal.2ta.aneg_p[3] 150 50 500
TH1F hcaladc_B5n 'HMS Cal ADC B5n - PED' H.cal.2ta.aneg_p[4] 150 50 500
TH1F hcaladc_B6n 'HMS Cal ADC B6n - PED' H.cal.2ta.aneg_p[5] 150 50 500
TH1F hcaladc_B7n 'HMS Cal ADC B7n - PED' H.cal.2ta.aneg_p[6] 150 50 500
TH1F hcaladc_B8n 'HMS Cal ADC B8n - PED' H.cal.2ta.aneg_p[7] 150 50 500
TH1F hcaladc_B9n 'HMS Cal ADC B9n - PED' H.cal.2ta.aneg_p[8] 150 50 500
TH1F hcaladc_B10n 'HMS Cal ADC B10n - PED' H.cal.2ta.aneg_p[9] 150 50 500
TH1F hcaladc_B11n 'HMS Cal ADC B11n - PED' H.cal.2ta.aneg_p[10] 150 50 500
TH1F hcaladc_B12n 'HMS Cal ADC B12n - PED' H.cal.2ta.aneg_p[11] 150 50 500
TH1F hcaladc_B13n 'HMS Cal ADC B13n - PED' H.cal.2ta.aneg_p[12] 150 50 500
#TH1F hdcrawtdc
#TH1F hdccuttdc
# Can we use variables for the constants. In CTP we used hdc_nwire(i)
#
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
# Drift Time and Drift Distance Spectra
TH1F hdc1x1_dt 'HDC 1X1 Drift Time' H.dc.1x1.time 200 -100 300
TH1F hdc1y1_dt 'HDC 1Y1 Drift Time' H.dc.1y1.time 200 -100 300
TH1F hdc1u1_dt 'HDC 1U1 Drift Time' H.dc.1u1.time 200 -100 300
TH1F hdc1v1_dt 'HDC 1V1 Drift Time' H.dc.1v1.time 200 -100 300
TH1F hdc1y2_dt 'HDC 1Y2 Drift Time' H.dc.1y2.time 200 -100 300
TH1F hdc1x2_dt 'HDC 1X2 Drift Time' H.dc.1x2.time 200 -100 300
TH1F hdc2x1_dt 'HDC 2X1 Drift Time' H.dc.2x1.time 200 -100 300
TH1F hdc2y1_dt 'HDC 2Y1 Drift Time' H.dc.2y1.time 200 -100 300
TH1F hdc2u1_dt 'HDC 2U1 Drift Time' H.dc.2u1.time 200 -100 300
TH1F hdc2v1_dt 'HDC 2V1 Drift Time' H.dc.2v1.time 200 -100 300
TH1F hdc2y2_dt 'HDC 2Y2 Drift Time' H.dc.2y2.time 200 -100 300
TH1F hdc2x2_dt 'HDC 2X2 Drift Time' H.dc.2x2.time 200 -100 300
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
# Focal Plane times
TH1F hs1xfptime 'HODO s1x fptime' H.hod.1x.fptime 80 0 80 H.hod.hgoodstarttime
TH1F hs1yfptime 'HODO s1y fptime' H.hod.1y.fptime 80 0 80 H.hod.hgoodstarttime
TH1F hs2xfptime 'HODO s2x fptime' H.hod.2x.fptime 80 0 80 H.hod.hgoodstarttime
TH1F hs2yfptime 'HODO s2y fptime' H.hod.2y.fptime 80 0 80 H.hod.hgoodstarttime
TH1F starttime 'HODO start time' H.hod.starttime 80 0 80 H.hod.hgoodstarttime
# Beam related ADC channels. eg. raster
TH1F rstrx_i 'Raster X Current' RB.raster.xcurrent 4000 -2000 2000
TH1F rstry_i 'Raster Y Current' RB.raster.ycurrent 4000 -2000 2000
TH1F rstrx_p 'Raster X Position' RB.raster.xpos 40 -20 20
TH1F rstry_p 'Raster Y Position' RB.raster.ypos 40 -20 20
......@@ -12,7 +12,7 @@
// Open the database
//
gHcParms->Define("gen_run_number", "Run Number", RunNumber);
gHcParms->AddString("g_ctp_database_filename", "DBASE/test.database");
gHcParms->AddString("g_ctp_database_filename", "DBASE/raster_test.database");
gHcParms->Load(gHcParms->GetString("g_ctp_database_filename"), RunNumber);
......@@ -52,7 +52,7 @@
// Beamline and its detectors
THaApparatus * BEAM = new THcRasteredBeam("rb","Beamline");
THaApparatus * BEAM = new THcRasteredBeam("RB","Rastered Beamline");
gHaApps->Add( BEAM );
......@@ -83,15 +83,15 @@
// Eventually need to learn to skip over, or properly analyze
// the pedestal events
//
run->SetEventRange(1,2);// Physics Event number, does not
run->SetEventRange(1,2000);// Physics Event number, does not
// include scaler or control events
// Define the analysis parameters
//
analyzer->SetEvent(event);
analyzer->SetOutFile("raster_test.root");
analyzer->SetOdefFile("output.def");
// analyzer->SetCutFile("rastertest_cuts.def"); // optional
analyzer->SetOdefFile("output_bpw.def");
analyzer->SetCutFile("hodtest_cuts.def"); // optional
analyzer->SetCountMode(2);// Counter event number same as gen_event_ID_number
// File to record cuts accounting information
......
......@@ -37,32 +37,39 @@ THcRaster::THcRaster( const char* name, const char* description,
THaApparatus* apparatus ) :
THaBeamDet(name,description,apparatus)
{
fAnalyzePedestals = 0;
fRawPos[0]=0;
fRawPos[1]=0;
// fRasterXADC = new TClonesArray("THcSignalHit",16);
// fRasterYADC = new TClonesArray("THcSignalHit",16);
fAnalyzePedestals = 0;
fNPedestalEvents = 0;
fXADC = 0;
fYADC = 0;
fXpos = 0;
fYpos = 0;
fFrCalMom = 0;
fFrXADCperCM = 0;
fFrXADCperCM = 0;
for(Int_t i=0;i<2;i++){
fPedADC[i] = 0;
fAvgPedADC[i] = 0;
}
}
//_____________________________________________________________________________
THcRaster::~THcRaster()
{
// Distructor
delete [] fPedADC;
delete [] fAvgPedADC;
}
//_____________________________________________________________________________
void THcRaster::ClearEvent(){
// nothing for now
}
//_____________________________________________________________________________
void THcRaster::InitializeReconstruction()
{
//____________________________________________________________________________// _
// void THcRaster::InitializeReconstruction()
// {
}
// }
......@@ -75,72 +82,52 @@ Int_t THcRaster::ReadDatabase( const TDatime& date )
// InitializeReconstruction();
// char prefix[2];
// cout << " THcRaster::ReadDatabase GetName() called " << GetName() << endl;
char prefix[2];
// prefix[0]=tolower(GetName()[0]);
// prefix[1]='\0';
//cout << " THcRaster::ReadDatabase GetName() called " << GetName() << endl;
// prefix[0]=tolower(GetName()[0]);
// bpw- The prefix is hardcoded so that we don't have to change the gbeam.param file. o/w to get the following variables, we need to change to parameter names to rfr_cal_mom, etc where "r" comes from prefix[0]=tolower(GetName()[0]).
prefix[0]='g';
prefix[1]='\0';
// string names;
// DBRequest list[]={
// {"raster_channel_name",&names,kString},
// {"raster_channel_number",&names,kString},
// {0}
// };
// // get the channel assignments from the parameter file
// gHcParms->LoadParmValues((DBRequest*)&list,prefix);
// std::cout <<"Raster channel no : " << std::endl;
// std::cout <<" X signal channel = "<<fChNO[0]<<std::endl;
// std::cout <<" Y signal channel = "<<fChNO[1]<<std::endl;
// std::vector<string> channel_names = vsplit(names);
// Int_t NChannels = channel_names.size();
// for(Int_t i=0;i<NChannels;i++) {
// // fPlaneNames[i] = new char[plane_names[i].length()];
// // strcpy(fPlaneNames[i], plane_names[i].c_str());
// //std::cout<<" channel = "<<channel_names.at(i)<<std::endl;
// std::cout<<" Channel numbers = "<<
// }
DBRequest list[]={
{"fr_cal_mom",&fFrCalMom, kDouble},
{"frx_adcpercm",&fFrXADCperCM, kDouble},
{"fry_adcpercm",&fFrYADCperCM, kDouble},
{0}
};
// Read the detector map file
// get the calibration factors from gbeam.param file
gHcParms->LoadParmValues((DBRequest*)&list,prefix);
// Based on the ungly method used in THaRaster class. I have no idea
// how to do this more elegantly.
// Buddhini
// const int LEN=100;
// char buf[LEN];
// FILE* fi = OpenFile( date );
// if( !fi ) return kFileError;
// fDetMap->Clear();
// int first_chan, crate, dummy, slot, first, last, modulid;
// std::cout<<"$$$$$$$$$$$$ THcRaster detmap"<<std::endl;
// do {
// fgets( buf, LEN, fi);
// sscanf(buf,"%d %d %d %d %d %d %d",&first_chan, &crate, &dummy, &slot, &first, &last, &modulid);
return kOK;
// std::cout<<"$$$$$$$$$$$$ "<<crate<<std::endl;
}
// // if (first_chan>=0) {
// // if ( fDetMap->AddModule (crate, slot, first, last, first_chan )<0) {
// // Error( Here(here), "Couldnt add Raster to DetMap!");
// // fclose(fi);
// // return kInitError;
// // }
// // }
// } while (first_chan>=0);
//_____________________________________________________________________________
Int_t THcRaster::DefineVariables( EMode mode )
{
// Initialize global variables for histogramming and tree
cout << "THcRaster::DefineVariables called " << GetName() << endl;
if( mode == kDefine && fIsSetup ) return kOK;
fIsSetup = ( mode == kDefine );
// Register variables in global list
return kOK;
RVarDef vars[] = {
{"xcurrent", "Raster X current", "fXADC"},
{"ycurrent", "Raster Y current", "fYADC"},
{"xpos", "Raster X position", "fXpos"},
{"ypos", "Raster Y position", "fYpos"},
{ 0 }
};
return DefineVarsFromList( vars, mode );
}
//_____________________________________________________________________________
......@@ -170,8 +157,42 @@ THaAnalysisObject::EStatus THcRaster::Init( const TDatime& date )
//_____________________________________________________________________________
void THcRaster::AccumulatePedestals(TClonesArray* rawhits)
{
// Extract data from the hit list, accumulating into arrays for
// calculating pedestals
/*
Extract data from the hit list, accumulating into arrays for
calculating pedestals.
From ENGINE/g_analyze_misc.f -
* JRA: Code to check FR pedestals. Since the raster is a fixed frequency
* and the pedestals come at a fixed rate, it is possible to keep getting
* the same value for each pedestal event, and get the wrong zero value.
* (see HCLOG #28325). So calculate pedestal from first 1000 REAL
* events and compare to value from pedestal events. Error on each
* measurement is RMS/sqrt(1000), error on diff is *sqrt(2), so 3 sigma
* check is 3*sqrt(2)*RMS/sqrt(1000) = .13*RMS
!
! Can't use RMS, since taking sum of pedestal**2 for these signals
! gives rollover for integer*4. Just assume signal is +/-2000
! channels, gives sigma of 100 channels, so check for diff>130.
!
*/
Int_t nrawhits = rawhits->GetLast()+1;
Int_t ihit=0;
while(ihit<nrawhits) {
THcRasterRawHit* hit = (THcRasterRawHit *) fRawHitList->At(ihit);
if(hit->fADC_xsig>0) {
fPedADC[0] += hit->fADC_xsig;
//std::cout<<" raster x pedestal collect "<<fPedADC[0]<<std::endl;
}
if(hit->fADC_ysig>0) {
fPedADC[1] += hit->fADC_ysig;
//std::cout<<" raster y pedestal collect "<<fPedADC[1]<<std::endl;
}
ihit++;
}
}
......@@ -179,69 +200,76 @@ void THcRaster::AccumulatePedestals(TClonesArray* rawhits)
//_____________________________________________________________________________
void THcRaster::CalculatePedestals( )
{
// Use the accumulated pedestal data to calculate pedestals
/*
Use the accumulated pedestal data to calculate pedestals
From ENGINE/g_analyze_misc.f -
if (numfr.eq.1000) then
avefrx = sumfrx / float(numfr)
avefry = sumfry / float(numfr)
if (abs(avefrx-gfrx_adc_ped).gt.130.) then
write(6,*) 'FRPED: peds give <frx>=',gfrx_adc_ped,
$ ' realevents give <frx>=',avefrx
endif
if (abs(avefry-gfry_adc_ped).gt.130.) then
write(6,*) 'FRPED: peds give <fry>=',gfry_adc_ped,
$ ' realevents give <fry>=',avefry
endif
endif
*/
for(Int_t i=0;i<2;i++){
fAvgPedADC[i] = fPedADC[i]/ fNPedestalEvents;
// std::cout<<" raster pedestal "<<fAvgPedADC[i]<<std::endl;
}
}
//_____________________________________________________________________________
Int_t THcRaster::Decode( const THaEvData& evdata )
{
cout << "THcRaster::Decode()" << endl;
// clears the event structure
// loops over all channels defined in the detector map
// copies raw data into local variables
// performs pedestal subtraction
ClearEvent();
// Get the Hall C style hitlist (fRawHitList) for this event
Int_t fNhits = THcHitList::DecodeToHitList(evdata);
std::cout<<"$$$$ Hits.."<<fNhits<<std::endl;
// // Get the pedestals
// if(gHaCuts->Result("Pedestal_event")) {
// Int_t nexthit = 0;
// AccumulatePedestals(fRawHitList);
// fAnalyzePedestals = 1; // Analyze pedestals first normal events
// return(0);
// }
// if(fAnalyzePedestals) {
// CalculatePedestals();
// fAnalyzePedestals = 0; // Don't analyze pedestals next event
// }
// Get the pedestals from the first 1000 events
//if(fNPedestalEvents < 10)
if((gHaCuts->Result("Pedestal_event")) & (fNPedestalEvents < 1000)){
AccumulatePedestals(fRawHitList);
fAnalyzePedestals = 1; // Analyze pedestals first normal events
fNPedestalEvents++;
return(0);
}
if(fAnalyzePedestals) {
CalculatePedestals();
fAnalyzePedestals = 0; // Don't analyze pedestals next event
}
Int_t ihit = 0;
std::cout<<"$$$$ Hits.."<<fNhits<<std::endl;
while(ihit < fNhits) {
//std::cout<<"Get raw hit.."<<std::endl;
THcRasterRawHit* hit = (THcRasterRawHit *) fRawHitList->At(ihit);
fRawADC[0] = hit->fADC_xsig;
fRawADC[1] = hit->fADC_ysig;
for(Int_t i=0;i<2;i++){
fRawPos[i] = fRawADC[i]-fPedADC[i];
// std::cout<<" Raw ADC = "<<fRawADC[i]
// <<" ped = "<<fPedADC[i]
// <<" corrected ="<<fRawPos[i]<<std::endl;
if(hit->fADC_xsig>0) {
fRawADC[0] = hit->fADC_xsig;
// std::cout<<" Raw X = "<<fRawADC[0]<<std::endl;
}
}
for(Int_t ihit = 0; ihit < fNhits ; ihit++) {
THcRasterRawHit* hit = (THcRasterRawHit *) fRawHitList->At(ihit);
cout << ihit << " : " << hit->fPlane << ":" << hit->fCounter << " : "
<< hit->fADC_xsig << " " << hit->fADC_ysig << " " << hit->fADC_xsync
<< " " << hit->fADC_ysync << endl;
}
cout << endl;
//Get X and Y ADC values
if(hit->fADC_ysig>0) {
fRawADC[1] = hit->fADC_ysig;
// std::cout<<" Raw Y ADC = "<<fRawADC[1]<<std::endl;
}
ihit++;
}
return 0;
}
......@@ -251,23 +279,38 @@ Int_t THcRaster::Decode( const THaEvData& evdata )
//_____________________________________________________________________________
Int_t THcRaster::Process( ){
/* From ENGINE/g_analyze_misc.f
Fast Raster Signals:
===================
Double_t tmp = 0;
Double_t eBeam = 0;
/*
calculate raster position from ADC value.
From ENGINE/g_analyze_misc.f -
gfrx_adc = gfrx_raw_adc - gfrx_adc_ped
gfry_adc = gfry_raw_adc - gfry_adc_ped
*/
gfrx_raw_adc = gmisc_dec_data(14,2)
gfry_raw_adc = gmisc_dec_data(16,2)
// calculate the raster currents
fXADC = fRawADC[0]-fAvgPedADC[0];
fYADC = fRawADC[1]-fAvgPedADC[1];
//std::cout<<" Raw X ADC = "<<fXADC<<" Raw Y ADC = "<<fYADC<<std::endl;
calculate raster position from ADC value.
gfrx_adc = gfrx_raw_adc - gfrx_adc_ped
gfry_adc = gfry_raw_adc - gfry_adc_ped
/*
calculate the raster positions
gfrx = (gfrx_adc/gfrx_adcpercm)*(gfr_cal_mom/ebeam)
gfry = (gfry_adc/gfry_adcpercm)*(gfr_cal_mom/ebeam)
*/
// bpw- Iam not sure how to access the global variables. the below code doesnt work. so for now, hard code the beam energy.
if(gHcParms->Find("ebeam")){
tmp=*(Double_t *)gHcParms->Find("ebeam")->GetValuePointer();
cout <<"e Beam = "<< tmp << endl;
}
eBeam = 4.02187;
fXpos = (fXADC/fFrXADCperCM)*(fFrCalMom/eBeam);
fYpos = (fYADC/fFrYADCperCM)*(fFrCalMom/eBeam);
// empty for now while I work on reading the channel map.
// std::cout<<" X = "<<fXpos<<" Y = "<<fYpos<<std::endl;
return 0;
}
......
......@@ -35,26 +35,33 @@ class THcRaster : public THaBeamDet, public THcHitList {
protected:
void InitializeReconstruction();
void ClearEvent();
/* void InitializeReconstruction(); */
Int_t ReadDatabase( const TDatime& date );
Int_t DefineVariables( EMode mode );
Double_t fXADC; // X current
Double_t fYADC; // Y current
Double_t fXpos; // X position
Double_t fYpos; // Y position
Double_t fRawADC[2]; // raw ADC values
Double_t fPedADC[2]; // ADC poedestals
Double_t fAvgPedADC[2]; // Avergage ADC poedestals
Double_t fRawPos[2]; // current in Raster ADCs for position
TVector3 fPosition[2]; // Beam position at 1st, 2nd BPM or at the target (meters)
TVector3 fPosPed[2]; // pedestals
TVector3 fDirection; // Beam angle at the target (meters)
TVector3 fDirection;
private:
Bool_t fAnalyzePedestals;
Int_t fNPedestalEvents;
Double_t fFrCalMom;
Double_t fFrXADCperCM;
Double_t fFrYADCperCM;
// Array to store channel numbers corresponding to X and Ysignals. 0 - X, 1 - Y.
Double_t fChN0[2];
private:
Bool_t fAnalyzePedestals;
void CalculatePedestals();
void AccumulatePedestals(TClonesArray* rawhits);
void CalculatePedestals();
void AccumulatePedestals(TClonesArray* rawhits);
ClassDef(THcRaster, 0); // add THcRaster to ROOT library
};
......
......@@ -32,9 +32,16 @@ void THcRasterRawHit::SetData(Int_t signal, Int_t data) {
} else if (signal==3) {
fADC_ysig = data;
}
// std::cout<<" xsync = "<<fADC_xsync
// <<" xsig = "<<fADC_xsig
// <<" ysync = "<<fADC_ysync
// <<" ysig = "<<fADC_ysig << std::endl;
}
Int_t THcRasterRawHit::GetData(Int_t signal) {
if(signal==1) {
return(fADC_xsync);
} else if (signal==2) {
......@@ -44,7 +51,7 @@ Int_t THcRasterRawHit::GetData(Int_t signal) {
} else if (signal==4) {
return(fADC_ysig);
}
return(-1); // Actually should throw exception
return(-1);
}
// Int_t THcRasterRawHit::Compare(const TObject* obj) const
......
......@@ -27,7 +27,6 @@ class THcRasterRawHit : public THcRawHit {
void SetData(Int_t signal, Int_t data);
Int_t GetData(Int_t signal);
//Int_t Compare(TObject* obj);
// signals
Int_t fADC_xsig;
......
......@@ -21,7 +21,7 @@
THcRasteredBeam::THcRasteredBeam( const char* name, const char* description ) :
THaBeam( name, description )
{
AddDetector( new THcRaster("Raster","raster",this) );
AddDetector( new THcRaster("raster","raster",this) );
}
......
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