diff --git a/examples/PARAM/hcana.param b/examples/PARAM/hcana.param index e437cdfb4e56c3aa9468c98c6eec7e5e5b970938..3251627742752e0ec2a1a48c32a92cf9ed1ea3ee 100644 --- a/examples/PARAM/hcana.param +++ b/examples/PARAM/hcana.param @@ -81,3 +81,6 @@ 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 ? +graster_channels = "xsync xsig ysync ysig" diff --git a/examples/raster_test.C b/examples/raster_test.C new file mode 100644 index 0000000000000000000000000000000000000000..b15f5298ddbdcd0a4f614e8642a8f7b71f9e7b73 --- /dev/null +++ b/examples/raster_test.C @@ -0,0 +1,83 @@ + +{ + + // + // 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"); +} diff --git a/src/THcRaster.cxx b/src/THcRaster.cxx index 2a214b8a18f7d7d4a51e386f272850ba5728b922..b81396e01710c39e210ff67bd67ff9c520ece21b 100644 --- a/src/THcRaster.cxx +++ b/src/THcRaster.cxx @@ -6,31 +6,35 @@ // THcRaster // // // // 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 <cstdio> #include <cstdlib> #include <iostream> -#include "THcRaster.h" using namespace std; //_____________________________________________________________________________ THcRaster::THcRaster( const char* name, const char* description, THaApparatus* apparatus ) : - THaNonTrackingDetector(name,description,apparatus) + THaBeamDet(name,description,apparatus) { - // Initializing channels - fRasterXRaw = new TClonesArray("THcSignalHit",16); - fRasterYRaw = new TClonesArray("THcSignalHit",16); + // // Initializing channels + // fRasterXADC = new TClonesArray("THcSignalHit",16); + // fRasterYADC = new TClonesArray("THcSignalHit",16); } //_____________________________________________________________________________ THcRaster::THcRaster( ) : - THaNonTrackingDetector() + THaBeamDet() { // Default constructor } @@ -41,6 +45,67 @@ THcRaster::~THRaster() // 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) diff --git a/src/THcRaster.h b/src/THcRaster.h index f73128b6d6c8c4f964b2c4c3934ab240e78e85b4..b50e2ec51a8a71e494c141a78d61910d869f1ce4 100644 --- a/src/THcRaster.h +++ b/src/THcRaster.h @@ -1,36 +1,49 @@ #ifndef ROOT_THcRaster #define ROOT_THcRaster -#include "THcRawHit.h" -class THcRaster : public THcRawHit { +/////////////////////////////////////////////////////////////////////////////// +// // +// THcRaster // +// // +/////////////////////////////////////////////////////////////////////////////// + +#include "THaBeamDet.h" + +class THcRaster : public THaBeamDet { public: - THcHodoscopeHit(Int_t plane=0, Int_t counter=0) : THcRawHit(plane, counter), - fADC_pos(-1), fADC_neg(-1), - fTDC_pos(-1), fTDC_neg(-1) { - } - THcHodoscopeHit& operator=( const THcHodoscopeHit& ); - virtual ~THcHodoscopeHit() {} + THcRaster( const char* name, const char* description ="" , + THaApparatus* a = NULL ); - virtual void Clear( Option_t* opt="" ) - { fADC_pos = -1; fADC_neg = -1; fTDC_pos = -1; fTDC_neg = -1; } + virtual ~THaRaster(); - void SetData(Int_t signal, Int_t data); - Int_t GetData(Int_t signal); + virtual Int_t Decode( const THaEvData& ); + virtual Int_t Process(); - // virtual Bool_t IsSortable () const {return kTRUE; } - // virtual Int_t Compare(const TObject* obj) const; + virtual TVector3 GetPosition() const { return fPosition[2]; } + virtual TVector3 GetDirection() const { return NULL; } // Hall C we don't use raster direction yet. - Int_t fADC_pos; - Int_t fADC_neg; + Double_t GetCurrentX() { return fRawPos(0); } + Double_t GetCurrentY() { return fRawPos(1); } 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: ClassDef(THcRaster, 0); // add THcRaster to ROOT library }; +//////////////////////////////////////////////////////////////////////////////// + + #endif