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

Modified the raster class to derive from THaBeamDet instead of THaNonTracking.

Added coding for read parameters from the hcana.param file.

In the hcana.param file added the four raster channels
graster_channels = "xsync xsig ysync ysig"

Created raster_test.C script to run the analyzer for raster code testing purpose. This was coppied from the hodotest.C
parent cd8e806b
No related branches found
No related tags found
No related merge requests found
...@@ -81,3 +81,6 @@ sdc_fix_propcorr = 0 ...@@ -81,3 +81,6 @@ sdc_fix_propcorr = 0
# Total number of PMTs in Gas Cherenkov detector. # Total number of PMTs in Gas Cherenkov detector.
hcer_tot_pmts = 2 hcer_tot_pmts = 2
# parameter list for the raster
# Maybe we can add this to geabm.param later ?
graster_channels = "xsync xsig ysync ysig"
{
//
// 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 );
THcCherenkov* cherenkov = new THcCherenkov("cher", "Gas Cerenkov" );
HMS->AddDetector( cherenkov );
// 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,5000);// 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
analyzer->SetCountMode(2);// Counter event number same as gen_event_ID_number
// File to record cuts accounting information
// analyzer->SetSummaryFile("summary_example.log"); // optional
analyzer->Process(run); // start the actual analysis
analyzer->PrintReport("report.template","report.out");
}
...@@ -6,31 +6,35 @@ ...@@ -6,31 +6,35 @@
// THcRaster // // THcRaster //
// // // //
// A class to decode the fast raster signals. // // A class to decode the fast raster signals. //
// Measures the two magnet currents which are propotioanl to horizontal and //
// vertical beam position //
// // // //
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#include "THcRaster.h"
#include "THcHitList.h"
#include <cstring> #include <cstring>
#include <cstdio> #include <cstdio>
#include <cstdlib> #include <cstdlib>
#include <iostream> #include <iostream>
#include "THcRaster.h"
using namespace std; using namespace std;
//_____________________________________________________________________________ //_____________________________________________________________________________
THcRaster::THcRaster( const char* name, const char* description, THcRaster::THcRaster( const char* name, const char* description,
THaApparatus* apparatus ) : THaApparatus* apparatus ) :
THaNonTrackingDetector(name,description,apparatus) THaBeamDet(name,description,apparatus)
{ {
// Initializing channels // // Initializing channels
fRasterXRaw = new TClonesArray("THcSignalHit",16); // fRasterXADC = new TClonesArray("THcSignalHit",16);
fRasterYRaw = new TClonesArray("THcSignalHit",16); // fRasterYADC = new TClonesArray("THcSignalHit",16);
} }
//_____________________________________________________________________________ //_____________________________________________________________________________
THcRaster::THcRaster( ) : THcRaster::THcRaster( ) :
THaNonTrackingDetector() THaBeamDet()
{ {
// Default constructor // Default constructor
} }
...@@ -41,6 +45,67 @@ THcRaster::~THRaster() ...@@ -41,6 +45,67 @@ THcRaster::~THRaster()
// Distructor // Distructor
} }
//_____________________________________________________________________________
void THcRaster::ClearEvent(){
// do nothing for now
}
//_____________________________________________________________________________
// ReadDatabase: if detectors cant be added to detmap
Int_t THcRaster::ReadDatabase( const TDatime& date )
{
static const char* const here = "THcRaster::ReadDatabase";
InitializeReconstruction();
char prefix[2];
cout << " GetName() " << GetName() << endl;
prefix[0]=tolower(GetName()[0]);
prefix[1]='\0';
string channelNames;
DBRequest channellist[]={
{"graster_channels",&channelNames,kString},
{0}
};
// get the channel list from the parameter file
gHcParms->LoadParmValues((DBRequest*)&channellist,prefix);
std::cout << "Raster channel list : " << channellist << std::endl;
vector<string> channel_names = vsplit(channellist);
Int_t NChannels = channel_names.size_of();
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;
}
return kOK
}
//_____________________________________________________________________________
Int_t THcRaster::Decode( const THaEvData& evdata )
{
// Get the Hall C style hitlist (fRawHitList) for this event
// empty for now while I work on reading the channel map.
return 0;
}
//_____________________________________________________________________________
Int_t THaRaster::Process( ){
// empty for now while I work on reading the channel map.
return o;
}
ClassImp(THcRaster) ClassImp(THcRaster)
......
#ifndef ROOT_THcRaster #ifndef ROOT_THcRaster
#define ROOT_THcRaster #define ROOT_THcRaster
#include "THcRawHit.h"
class THcRaster : public THcRawHit { ///////////////////////////////////////////////////////////////////////////////
// //
// THcRaster //
// //
///////////////////////////////////////////////////////////////////////////////
#include "THaBeamDet.h"
class THcRaster : public THaBeamDet {
public: public:
THcHodoscopeHit(Int_t plane=0, Int_t counter=0) : THcRawHit(plane, counter), THcRaster( const char* name, const char* description ="" ,
fADC_pos(-1), fADC_neg(-1), THaApparatus* a = NULL );
fTDC_pos(-1), fTDC_neg(-1) {
}
THcHodoscopeHit& operator=( const THcHodoscopeHit& );
virtual ~THcHodoscopeHit() {}
virtual void Clear( Option_t* opt="" ) virtual ~THaRaster();
{ fADC_pos = -1; fADC_neg = -1; fTDC_pos = -1; fTDC_neg = -1; }
void SetData(Int_t signal, Int_t data); virtual Int_t Decode( const THaEvData& );
Int_t GetData(Int_t signal); virtual Int_t Process();
// virtual Bool_t IsSortable () const {return kTRUE; } virtual TVector3 GetPosition() const { return fPosition[2]; }
// virtual Int_t Compare(const TObject* obj) const; virtual TVector3 GetDirection() const { return NULL; } // Hall C we don't use raster direction yet.
Int_t fADC_pos; Double_t GetCurrentX() { return fRawPos(0); }
Int_t fADC_neg; Double_t GetCurrentY() { return fRawPos(1); }
protected: protected:
void ClearEvent();
virtual Int_t ReadDatabase( const TDatime& date );
TVector fRawPos[2]; // current in Raster ADCs for position
TVector3 fPosition[2]; // Beam position at 1st, 2nd BPM or at the target (meters)
TVector3 fPosOff[2]; // pedestals
private: private:
ClassDef(THcRaster, 0); // add THcRaster to ROOT library ClassDef(THcRaster, 0); // add THcRaster to ROOT library
}; };
////////////////////////////////////////////////////////////////////////////////
#endif #endif
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