diff --git a/DEF-files/HMS/CAL/hcalana.def b/DEF-files/HMS/CAL/hcalana.def new file mode 100644 index 0000000000000000000000000000000000000000..52c84478bb55e02e4c1c61328a925e3a25f39c2a --- /dev/null +++ b/DEF-files/HMS/CAL/hcalana.def @@ -0,0 +1,3 @@ +# See $ANALYZER/examples/output_example.def for examples +# +block H.cal.* \ No newline at end of file diff --git a/DEF-files/HMS/CAL/hcalana_cuts.def b/DEF-files/HMS/CAL/hcalana_cuts.def new file mode 100644 index 0000000000000000000000000000000000000000..3af34a5e9835ac62bdbfcc30004dda336ed171d9 --- /dev/null +++ b/DEF-files/HMS/CAL/hcalana_cuts.def @@ -0,0 +1,13 @@ +Block: RawDecode + +Pedestal_event 0 +RawDecode_master 1 + +Block: Decode +Decode_master 1 + +Block: CoarseTracking +CoarseTracking_master 1 + +Block: CoarseReconstruct +CourseReconstruct 0 diff --git a/SCRIPTS/HMS/replay_hcal_test_stand.C b/SCRIPTS/HMS/replay_hcal_test_stand.C new file mode 100644 index 0000000000000000000000000000000000000000..f4b42da6333147beb89091e1d9695d6e1bfe3ecc --- /dev/null +++ b/SCRIPTS/HMS/replay_hcal_test_stand.C @@ -0,0 +1,90 @@ +void replay_hcal_test_stand(Int_t RunNumber=0, Int_t MaxEvent=0) { + + // Get RunNumber and MaxEvent if not provided. + if(RunNumber == 0) { + cout << "Enter a Run Number (-1 to exit): "; + cin >> RunNumber; + if( RunNumber<=0 ) return; + } + if(MaxEvent == 0) { + cout << "\nNumber of Events to analyze: "; + cin >> MaxEvent; + if(MaxEvent == 0) { + cerr << "...Invalid entry\n"; + exit; + } + } + + // Create file name patterns. + const char* RunFileNamePattern = "raw/hms_all_000%d.dat"; + const char* ROOTFileNamePattern = "ROOTfiles/test_%d.root"; + // Add variables to global list. + gHcParms->Define("gen_run_number", "Run Number", RunNumber); + gHcParms->AddString("g_ctp_database_filename", "DBASE/standard.database"); + + // Load varibles from files to global list. + 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_kinematics_filename"), RunNumber); + gHcParms->Load(gHcParms->GetString("g_ctp_parm_filename")); + + // Load the Hall C style detector map + gHcDetectorMap = new THcDetectorMap(); + gHcDetectorMap->Load("MAPS/HMS/DETEC/hcal.map"); + + // Set up the equipment to be analyzed. + THaApparatus* HMS = new THcHallCSpectrometer("H", "HMS"); + gHaApps->Add(HMS); + // Add hodoscope to HMS apparatus + THcShower* cal = new THcShower("cal", "Calorimeter"); + HMS->AddDetector(cal); + + // 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, MaxEvent); // Physics Event number, does not + // include scaler or control events. + run->SetNscan(1); + run->SetDataRequired(0x7); + run->Print(); + + // Define the analysis parameters + TString ROOTFileName = Form(ROOTFileNamePattern, RunNumber); + analyzer->SetCountMode(2); // 0 = counter is # of physics triggers + // 1 = counter is # of all decode reads + // 2 = counter is event number + analyzer->SetEvent(event); + analyzer->SetCrateMapFileName("MAPS/db_cratemap.dat"); + analyzer->SetOutFile(ROOTFileName.Data()); + analyzer->SetOdefFile("DEF-files/HMS/CAL/hcalana.def"); + analyzer->SetCutFile("DEF-files/HMS/CAL/hcalana_cuts.def"); // optional + + // File to record cuts accounting information + //analyzer->SetSummaryFile("summary_example.log"); // optional + + // Start the actual analysis. + analyzer->Process(run); + // Create report file from template. + //analyzer->PrintReport( // optional + // "TEMPLATES/dcana.template", + // Form("REPORT_OUTPUT/replay_hms_%05d.report", RunNumber) + //); +} diff --git a/SCRIPTS/HMS/replay_hhodo_test_stand.C b/SCRIPTS/HMS/replay_hhodo_test_stand.C index 78f249d1a70250a8bc2006a026499cb69d35f2da..00f7e7882d93fc246a2ea2f133196dd340a65819 100644 --- a/SCRIPTS/HMS/replay_hhodo_test_stand.C +++ b/SCRIPTS/HMS/replay_hhodo_test_stand.C @@ -16,8 +16,6 @@ void replay_hhodo_test_stand(Int_t RunNumber=0, Int_t MaxEvent=0) { } // Create file name patterns. - //const char* RunFileNamePattern = "raw/test_%d.dat" - //const char* RunFileNamePattern = "raw/hms_dc_000%d.dat"; const char* RunFileNamePattern = "raw/hms_all_000%d.dat"; const char* ROOTFileNamePattern = "ROOTfiles/test_%d.root"; // Add variables to global list. @@ -31,50 +29,16 @@ void replay_hhodo_test_stand(Int_t RunNumber=0, Int_t MaxEvent=0) { gHcParms->Load(gHcParms->GetString("g_ctp_kinematics_filename"), RunNumber); gHcParms->Load(gHcParms->GetString("g_ctp_parm_filename")); - // Load params for HMS DC test stand configuration - // gHcParms->Load("PARAM/HMS/DC/hdc_test_stand.param"); - // gHcParms->Load("PARAM/TRIG/thms.param"); - // Load the Hall C style detector map gHcDetectorMap = new THcDetectorMap(); - //gHcDetectorMap->Load(gHcParms->GetString("g_decode_map_filename")); - // Load the HMS dc map - // gHcDetectorMap->Load("MAPS/HMS/DETEC/hdc.map"); - // Load the trigger map - // gHcDetectorMap->Load("MAPS/HMS/DETEC/htrig.map"); - // Load combined map - // gHcDetectorMap->Load("MAPS/hdc_htrig.map"); gHcDetectorMap->Load("MAPS/HMS/DETEC/hhodo.map"); // Set up the equipment to be analyzed. THaApparatus* HMS = new THcHallCSpectrometer("H", "HMS"); gHaApps->Add(HMS); - // Add drift chambers to HMS apparatus - // THcDC* dc = new THcDC("dc", "Drift Chambers"); - // HMS->AddDetector(dc); // Add hodoscope to HMS apparatus THcHodoscope* hod = new THcHodoscope("hod", "Hodoscope"); HMS->AddDetector(hod); - // // Add calorimeter to HMS apparatus - // THcShower* cal = new THcShower("cal", "Calorimeter"); - // HMS->AddDetector(cal); - // // Add cherenkov to HMS appratus - // THcCherenkov* cherenkov = new THcCherenkov("cher", "Gas Cerenkov"); - // HMS->AddDetector(cherenkov); - // // Add aerogel to HMS apparatus - // THcAerogel* aerogel = new THcAerogel("aero", "Aerogel Cerenkov"); - // HMS->AddDetector(aerogel); - - // Add trigger apparatus - // THaApparatus* TRG = new THcTrigApp("T", "TRG"); - // gHaApps->Add(TRG); - // Add trigger detector to trigger apparatus - // THcTrigDet* hms = new THcTrigDet("hms", "HMS Trigger Information"); - // TRG->AddDetector(hms); - - //THcScalerEvtHandler *hscaler = new THcScalerEvtHandler("HS", "HC scaler event type 0"); - //hscaler->SetDebugFile("HScaler.txt"); - //gHaEvtHandlers->Add(hscaler); // Set up the analyzer - we use the standard one, // but this could be an experiment-specific one as well. @@ -110,8 +74,6 @@ void replay_hhodo_test_stand(Int_t RunNumber=0, Int_t MaxEvent=0) { analyzer->SetEvent(event); analyzer->SetCrateMapFileName("MAPS/db_cratemap.dat"); analyzer->SetOutFile(ROOTFileName.Data()); - // analyzer->SetOdefFile("DEF-files/HMS/DC/hdcana.def"); - // analyzer->SetCutFile("DEF-files/HMS/DC/hdcana_cuts.def"); // optional analyzer->SetOdefFile("DEF-files/HMS/HODO/hhodoana.def"); analyzer->SetCutFile("DEF-files/HMS/HODO/hhodoana_cuts.def"); // optional diff --git a/SCRIPTS/HMS/replay_htrig_test_stand.C b/SCRIPTS/HMS/replay_htrig_test_stand.C index ea3326a968a1b703231857eba6e8566c8a724266..3c4a688042ec0aa270d4d4795ab216b1410d214f 100644 --- a/SCRIPTS/HMS/replay_htrig_test_stand.C +++ b/SCRIPTS/HMS/replay_htrig_test_stand.C @@ -16,8 +16,6 @@ void replay_htrig_test_stand(Int_t RunNumber=0, Int_t MaxEvent=0) { } // Create file name patterns. - //const char* RunFileNamePattern = "raw/test_%d.dat" - //const char* RunFileNamePattern = "raw/hms_dc_000%d.dat"; const char* RunFileNamePattern = "raw/hms_all_000%d.dat"; const char* ROOTFileNamePattern = "ROOTfiles/test_%d.root"; // Add variables to global list. @@ -32,38 +30,11 @@ void replay_htrig_test_stand(Int_t RunNumber=0, Int_t MaxEvent=0) { gHcParms->Load(gHcParms->GetString("g_ctp_parm_filename")); // Load params for HMS DC test stand configuration - // gHcParms->Load("PARAM/HMS/DC/hdc_test_stand.param"); gHcParms->Load("PARAM/TRIG/thms.param"); // Load the Hall C style detector map gHcDetectorMap = new THcDetectorMap(); - //gHcDetectorMap->Load(gHcParms->GetString("g_decode_map_filename")); - // Load the HMS dc map - // gHcDetectorMap->Load("MAPS/HMS/DETEC/hdc.map"); - // Load the trigger map - // gHcDetectorMap->Load("MAPS/HMS/DETEC/htrig.map"); - // Load combined map - // gHcDetectorMap->Load("MAPS/hdc_htrig.map"); - gHcDetectorMap->Load("MAPS/HMS/DETEC/hdc_hhodo_htrig.map"); - - // Set up the equipment to be analyzed. - // THaApparatus* HMS = new THcHallCSpectrometer("H", "HMS"); - // gHaApps->Add(HMS); - // Add drift chambers to HMS apparatus - // THcDC* dc = new THcDC("dc", "Drift Chambers"); - // HMS->AddDetector(dc); - // Add hodoscope to HMS apparatus - // THcHodoscope* hod = new THcHodoscope("hod", "Hodoscope"); - // HMS->AddDetector(hod); - // // Add calorimeter to HMS apparatus - // THcShower* cal = new THcShower("cal", "Calorimeter"); - // HMS->AddDetector(cal); - // // Add cherenkov to HMS appratus - // THcCherenkov* cherenkov = new THcCherenkov("cher", "Gas Cerenkov"); - // HMS->AddDetector(cherenkov); - // // Add aerogel to HMS apparatus - // THcAerogel* aerogel = new THcAerogel("aero", "Aerogel Cerenkov"); - // HMS->AddDetector(aerogel); + gHcDetectorMap->Load("MAPS/HMS/DETEC/htrig.map"); // Add trigger apparatus THaApparatus* TRG = new THcTrigApp("T", "TRG"); @@ -72,10 +43,6 @@ void replay_htrig_test_stand(Int_t RunNumber=0, Int_t MaxEvent=0) { THcTrigDet* hms = new THcTrigDet("hms", "HMS Trigger Information"); TRG->AddDetector(hms); - //THcScalerEvtHandler *hscaler = new THcScalerEvtHandler("HS", "HC scaler event type 0"); - //hscaler->SetDebugFile("HScaler.txt"); - //gHaEvtHandlers->Add(hscaler); - // 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