Skip to content
Snippets Groups Projects
Commit 4764ec8d authored by Mark Jones's avatar Mark Jones
Browse files

Merge branch 'compare' of github.com:buddhiniw/hcana into buddhiniw-compare

parents 3636678c 285ceede
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,12 @@
g_ctp_parm_filename ="PARAM/general.param"
g_decode_map_filename ="MAPS/raster_jun04.map"
g_ctp_kinematics_filename ="DBASE/jan05.kinematics"
52947
g_ctp_parm_filename ="PARAM/general.param"
g_decode_map_filename ="MAPS/raster_jun04.map"
g_ctp_kinematics_filename ="DBASE/jan05.kinematics"
52426
g_ctp_parm_filename ="DBASE/52426.param"
g_decode_map_filename ="HCANA_MAPS/july04.map"
......
......@@ -1980,17 +1980,18 @@ Slot= 5 ! ADC Second set of tubes on first two layers
!
detector= 18 ! RASTER
!
! buddhini-w :To make things easier and consistent between detectors, we now use the plane and signal to identify the different raster signals 02-12-2014
! buddhini-w :To make things easier and consistent between detectors,
! we now use the plane and signal to identify the different raster signals 02-12-2014
!..............................................................................
! For raster : 0-->ADC X-sync
! 1-->ADC Y-signal
! 2-->ADC Y-sync
! 3-->ADC Y-signal
12, 1, 1, 0 !ADC ROC#1 Sl#13 Ch#12 Fast Raster X-sync
12, 2, 1, 0 !ADC ROC#1 Sl#13 Ch#12 Fast Raster X-sync
13, 2, 1, 1 !ADC ROC#1 Sl#13 Ch#13 Fast Raster X-signal
14, 3, 1, 2 !ADC ROC#1 Sl#13 Ch#14 Fast Raster Y-sync
15, 4, 1, 3 !ADC ROC#1 Sl#13 Ch#15 Fast Raster Y-signal
14, 2, 1, 2 !ADC ROC#1 Sl#13 Ch#14 Fast Raster Y-sync
15, 2, 1, 3 !ADC ROC#1 Sl#13 Ch#15 Fast Raster Y-signal
!
detector= 6 ! GMISC
!
......
......@@ -83,7 +83,3 @@ sdc_fix_propcorr = 0
# Total number of PMTs in Gas Cherenkov detector.
hcer_tot_pmts = 2
# parameter list for the raster
# Maybe we can add this to geabm.param later ?
rraster_signal_names = "xsync xsig ysync ysig"
#!/usr/bin/perl
# Rewrite a Hall C style MAP file so that the Raster and BPM
# are separate detector types instead of being part of the
# MISC detector
#
# 08.04.2014 (saw) Modify just raster entries for now
use POSIX qw(strftime);
$RASTERID=18;
$BCMID=19;
$SWAPRASTERXY=1;
$thedate = strftime( '%b %e, %Y', localtime );
$ifile = $ARGV[0];
$ofile = $ARGV[1];
open(IFILE,"<$ifile");
open(OFILE,">$ofile");
print OFILE "! $ofile Automatically generated $thedate\n";
print OFILE "! from $ifile by $0\n";
# Insert comments defining the raster and BCM detector IDS
$ininiddefs=0;
while(<IFILE>) {
chomp;
$line = $_;
if($line=~/_ID/) {
$iniddefs=1;
} elsif ($iniddefs) {
if(not $line=~/_ID/ and not $line=~/:/) {
print OFILE "! RASTER_ID=$RASTERID ADC\n";
print OFILE "! BCM_ID=$RASTERID ADC\n";
print OFILE "$line\n";
last;
}
}
print OFILE "$line\n";
}
# Copy the rest of the file, looking for the specific channels to
# edit
$detector=0;
while(<IFILE>) {
chomp;
$line = $_;
if($line=~/^\s*DETECTOR=\s*(\d*)/i) {
$detector=$1;
print "$detector\n";
print OFILE "$line\n";
} elsif ($line=~/^\s*(\d*)\s*,\s*(\d*)\s*,\s*(\d*),\s*(\d*)\s*(.*)/) {
$comment = $5;
$channel = $1;
$plane = $2;
$element = $3;
$signal = $4;
if($comment=~"Fast Raster") {
$signal = -1;
if($comment=~"X-sync") {
$signal = 0;
} elsif ($comment=~"X-signal") {
$signal = 1;
} elsif ($comment=~"Y-sync") {
$signal = 2;
} elsif ($comment=~"Y-signal") {
$signal = 3;
}
if($signal>=0) {
if ($SWAPRASTERXY) {
$signal = ($signal+2) % 4;
}
print OFILE "detector=$RASTERID ! RASTER\n";
print OFILE "!$line\n";
print OFILE "$channel, 1, 1, $signal $comment\n";
print OFILE "detector=$detector ! RASTER\n";
} else {
print OFILE "$line\n";
}
} else {
print OFILE "$line\n";
}
} else {
print OFILE "$line\n";
}
}
exit;
%crates=();
$crate = 0;
$nsubadd = 0;
$bsub = 0;
$modtype = 0;
$slot = 0;
while(<>) {
$line=chomp;
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;
}
}
......@@ -175,7 +175,9 @@ 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
TH1F frx_raw_adc 'Raster X Raw ADC' RB.raster.frx_raw_adc 1200 3200 4400
TH1F fry_raw_adc 'Raster Y Raw ADC' RB.raster.fry_raw_adc 1200 3200 4400
TH1F frx_adc 'Raster X ADC' RB.raster.frx_adc 1000 -500 500
TH1F fry_adc 'Raster Y ADC' RB.raster.fry_adc 1000 -500 500
TH1F frx 'Raster X Position' RB.raster.frx 100 -0.5 0.5
TH1F fry 'Raster Y Position' RB.raster.fry 100 -0.5 0.5
......@@ -5,9 +5,9 @@
// Steering script to test raster signal decoding
//
Int_t RunNumber=50017;
char* RunFileNamePattern="daq04_%d.log.0";
Int_t RunNumber=52947;
char* RunFileNamePattern="/cache/mss/hallc/daq04/raw/daq04_52947.log.0";
// Open the database
//
......@@ -90,7 +90,7 @@
// Define the analysis parameters
//
analyzer->SetEvent(event);
analyzer->SetOutFile("raster_test.root");
analyzer->SetOutFile("raster_compare_52947.root");
analyzer->SetOdefFile("output_bpw.def");
analyzer->SetCutFile("hodtest_cuts.def"); // optional
analyzer->SetCountMode(2);// Counter event number same as gen_event_ID_number
......
......@@ -40,6 +40,8 @@ THcRaster::THcRaster( const char* name, const char* description,
fAnalyzePedestals = 0;
fNPedestalEvents = 0;
fRawXADC = 0;
fRawYADC = 0;
fXADC = 0;
fYADC = 0;
fXpos = 0;
......@@ -58,29 +60,19 @@ THcRaster::THcRaster( const char* name, const char* description,
//_____________________________________________________________________________
THcRaster::~THcRaster()
{
// delete [] fPedADC;
// delete [] fAvgPedADC;
delete [] fPedADC;
delete [] fAvgPedADC;
}
//____________________________________________________________________________// _
// void THcRaster::InitializeReconstruction()
// {
// }
//_____________________________________________________________________________
Int_t THcRaster::ReadDatabase( const TDatime& date )
{
// Read parameters such as calibration factor, of this detector from the database.
// static const char* const here = "THcRaster::ReadDatabase";
// InitializeReconstruction();
cout << "THcRaster::ReadDatabase()" << endl;
char prefix[2];
......@@ -121,10 +113,12 @@ Int_t THcRaster::DefineVariables( EMode mode )
// Register variables in global list
RVarDef vars[] = {
{"xcurrent", "Raster X current", "fXADC"},
{"ycurrent", "Raster Y current", "fYADC"},
{"xpos", "Raster X position", "fXpos"},
{"ypos", "Raster Y position", "fYpos"},
{"frx_raw_adc", "Raster X raw ADC", "fRawXADC"},
{"fry_raw_adc", "Raster Y raw ADC", "fRawYADC"},
{"frx_adc", "Raster X ADC", "fXADC"},
{"fry_adc", "Raster Y ADC", "fYADC"},
{"frx", "Raster X position", "fXpos"},
{"fry", "Raster Y position", "fYpos"},
{ 0 }
};
......@@ -258,13 +252,13 @@ Int_t THcRaster::Decode( const THaEvData& evdata )
THcRasterRawHit* hit = (THcRasterRawHit *) fRawHitList->At(ihit);
if(hit->fADC_xsig>0) {
fRawADC[0] = hit->fADC_xsig;
// std::cout<<" Raw X = "<<fRawADC[0]<<std::endl;
fRawXADC = hit->fADC_xsig;
//std::cout<<" Raw X ADC = "<<fRawXADC<<std::endl;
}
if(hit->fADC_ysig>0) {
fRawADC[1] = hit->fADC_ysig;
// std::cout<<" Raw Y ADC = "<<fRawADC[1]<<std::endl;
fRawYADC = hit->fADC_ysig;
//std::cout<<" Raw Y ADC = "<<fRawYADC<<std::endl;
}
ihit++;
}
......@@ -280,8 +274,7 @@ Int_t THcRaster::Decode( const THaEvData& evdata )
//_____________________________________________________________________________
Int_t THcRaster::Process( ){
Double_t tmp = 0;
Double_t eBeam = 0;
Double_t eBeam = 0.001;
/*
calculate raster position from ADC value.
From ENGINE/g_analyze_misc.f -
......@@ -291,8 +284,8 @@ Int_t THcRaster::Process( ){
*/
// calculate the raster currents
fXADC = fRawADC[0]-fAvgPedADC[0];
fYADC = fRawADC[1]-fAvgPedADC[1];
fXADC = fRawXADC-fAvgPedADC[0];
fYADC = fRawYADC-fAvgPedADC[1];
//std::cout<<" Raw X ADC = "<<fXADC<<" Raw Y ADC = "<<fYADC<<std::endl;
/*
......@@ -301,14 +294,10 @@ Int_t THcRaster::Process( ){
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.
eBeam=0.0001;
if(gHcParms->Find("gpbeam")){
eBeam=*(Double_t *)gHcParms->Find("gpbeam")->GetValuePointer();
}
// cout <<"e Beam = "<< eBeam << " " << fgpbeam << endl;
// eBeam = 4.02187;
fXpos = (fXADC/fFrXADCperCM)*(fFrCalMom/eBeam);
fYpos = (fYADC/fFrYADCperCM)*(fFrCalMom/eBeam);
......
......@@ -40,14 +40,16 @@ class THcRaster : public THaBeamDet, public THcHitList {
Int_t ReadDatabase( const TDatime& date );
Int_t DefineVariables( EMode mode );
Double_t fgpbeam; //
Double_t fgpbeam; //beam momentum
Double_t fXADC; // X current
Double_t fYADC; // Y current
Double_t fRawXADC; // X raw ADC
Double_t fRawYADC; // Y raw ADC
Double_t fXADC; // X ADC
Double_t fYADC; // Y ADC
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
......
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