diff --git a/DEF-files/HMS/GEN/hstackana.def b/DEF-files/HMS/GEN/hstackana.def new file mode 100644 index 0000000000000000000000000000000000000000..3e849f4aa25a24008e66eee37bde95fac58f2a16 --- /dev/null +++ b/DEF-files/HMS/GEN/hstackana.def @@ -0,0 +1,22 @@ +# See $ANALYZER/examples/output_example.def for examples +# +#block T.hms.* +block H.dc.* +block H.tr.* +#block H.hod.* +#block H.cer.* +#block H.cal.* +block H.gtr.* + +TH1D hhdc_resid_1 '' H.dc.residual[0] 200 -1.0 1.0 +TH1D hhdc_resid_2 '' H.dc.residual[1] 200 -1.0 1.0 +TH1D hhdc_resid_3 '' H.dc.residual[2] 200 -1.0 1.0 +TH1D hhdc_resid_4 '' H.dc.residual[3] 200 -1.0 1.0 +TH1D hhdc_resid_5 '' H.dc.residual[4] 200 -1.0 1.0 +TH1D hhdc_resid_6 '' H.dc.residual[5] 200 -1.0 1.0 +TH1D hhdc_resid_7 '' H.dc.residual[6] 200 -1.0 1.0 +TH1D hhdc_resid_8 '' H.dc.residual[7] 200 -1.0 1.0 +TH1D hhdc_resid_9 '' H.dc.residual[8] 200 -1.0 1.0 +TH1D hhdc_resid_10 '' H.dc.residual[9] 200 -1.0 1.0 +TH1D hhdc_resid_11 '' H.dc.residual[10] 200 -1.0 1.0 +TH1D hhdc_resid_12 '' H.dc.residual[11] 200 -1.0 1.0 \ No newline at end of file diff --git a/DEF-files/HMS/GEN/hstackana_cuts.def b/DEF-files/HMS/GEN/hstackana_cuts.def new file mode 100644 index 0000000000000000000000000000000000000000..3af34a5e9835ac62bdbfcc30004dda336ed171d9 --- /dev/null +++ b/DEF-files/HMS/GEN/hstackana_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/DEF-files/SHMS/GEN/pstackana.def b/DEF-files/SHMS/GEN/pstackana.def new file mode 100644 index 0000000000000000000000000000000000000000..cc748cdb862f8e07aa40a5c639bbc9eef2ae6749 --- /dev/null +++ b/DEF-files/SHMS/GEN/pstackana.def @@ -0,0 +1,25 @@ +# See $ANALYZER/examples/output_example.def for examples +# +block T.shms.* +block P.ngcer.* +block P.dc.* +block P.tr.* +block P.hod.* +block P.hgcer.* +block P.aero.* +block P.cal.* +block P.gtr.* + +TH1F hptrig2_minus_p1x 'SHMS Trigger 2 - p1X TDC; TDC Time (ns); Counts / 1 ns' (T.shms.pT2_tdcTime-T.shms.p1X_tdcTime[0])*0.1 150 0 150 T.shms.pT2_tdcMultiplicity==1 +TH1F hptrig2_minus_p1y 'SHMS Trigger 2 - p1Y TDC; TDC Time (ns); Counts / 1 ns' (T.shms.pT2_tdcTime-T.shms.p1Y_tdcTime[0])*0.1 150 0 150 T.shms.pT2_tdcMultiplicity==1 +TH1F hptrig2_minus_p2x 'SHMS Trigger 2 - p2X TDC; TDC Time (ns); Counts / 1 ns' (T.shms.pT2_tdcTime-T.shms.p2X_tdcTime[0])*0.1 150 0 150 T.shms.pT2_tdcMultiplicity==1 +TH1F hptrig2_minus_p2y 'SHMS Trigger 2 - p2Y TDC; TDC Time (ns); Counts / 1 ns' (T.shms.pT2_tdcTime-T.shms.p2Y_tdcTime[0])*0.1 150 0 150 T.shms.pT2_tdcMultiplicity==1 +TH1F hptrig2_minus_ps1 'SHMS Trigger 2 - pS1 TDC; TDC Time (ns); Counts / 1 ns' (T.shms.pT2_tdcTime-T.shms.p1T_tdcTime[0])*0.1 150 0 150 T.shms.pT2_tdcMultiplicity==1 +TH1F hptrig2_minus_ps2 'SHMS Trigger 2 - pS2 TDC; TDC Time (ns); Counts / 1 ns' (T.shms.pT2_tdcTime-T.shms.p2T_tdcTime[0])*0.1 150 0 150 T.shms.pT2_tdcMultiplicity==1 + +TH1F hptrig3_minus_p1x 'SHMS Trigger 3 - p1X TDC; TDC Time (ns); Counts / 1 ns' (T.shms.pT3_tdcTime-T.shms.p1X_tdcTime[0])*0.1 150 0 150 T.shms.pT3_tdcMultiplicity==1 +TH1F hptrig3_minus_p1y 'SHMS Trigger 3 - p1Y TDC; TDC Time (ns); Counts / 1 ns' (T.shms.pT3_tdcTime-T.shms.p1Y_tdcTime[0])*0.1 150 0 150 T.shms.pT3_tdcMultiplicity==1 +TH1F hptrig3_minus_p2x 'SHMS Trigger 3 - p2X TDC; TDC Time (ns); Counts / 1 ns' (T.shms.pT3_tdcTime-T.shms.p2X_tdcTime[0])*0.1 150 0 150 T.shms.pT3_tdcMultiplicity==1 +TH1F hptrig3_minus_p2y 'SHMS Trigger 3 - p2Y TDC; TDC Time (ns); Counts / 1 ns' (T.shms.pT3_tdcTime-T.shms.p2Y_tdcTime[0])*0.1 150 0 150 T.shms.pT3_tdcMultiplicity==1 +TH1F hptrig2_minus_ps1 'SHMS Trigger 3 - pS1 TDC; TDC Time (ns); Counts / 1 ns' (T.shms.pT3_tdcTime-T.shms.p1T_tdcTime[0])*0.1 150 0 150 T.shms.pT3_tdcMultiplicity==1 +TH1F hptrig2_minus_ps2 'SHMS Trigger 3 - pS2 TDC; TDC Time (ns); Counts / 1 ns' (T.shms.pT3_tdcTime-T.shms.p2T_tdcTime[0])*0.1 150 0 150 T.shms.pT3_tdcMultiplicity==1 \ No newline at end of file diff --git a/DEF-files/SHMS/GEN/pstackana_cuts.def b/DEF-files/SHMS/GEN/pstackana_cuts.def new file mode 100644 index 0000000000000000000000000000000000000000..3af34a5e9835ac62bdbfcc30004dda336ed171d9 --- /dev/null +++ b/DEF-files/SHMS/GEN/pstackana_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/PARAM/HMS/GEN/hgoldtrack.param b/PARAM/HMS/GEN/hgoldtrack.param new file mode 100644 index 0000000000000000000000000000000000000000..48f62c1f26d5a0a487940a1ac8fb1c9555eb25a2 --- /dev/null +++ b/PARAM/HMS/GEN/hgoldtrack.param @@ -0,0 +1,23 @@ + +hmin_hit = 4, 4 + +hmin_combos = 3, 3 + +hstub_max_xpdiff = 0.5 + +hsingle_stub = 1 + +hxloscin = 1, 1 +hxhiscin = 16, 16 +hyloscin = 1, 1 +hyhiscin = 10, 10 + +htrack_eff_test_num_scin_planes = 2 + +hdc_tdc_min_win = -55000,-55000,-55000,-55000,-55000,-55000 + -55000,-55000,-55000,-55000,-55000,-55000 + +hdc_tdc_max_win = 55000,55000,55000,55000,55000,55000 + 55000,55000,55000,55000,55000,55000 + + diff --git a/PARAM/HMS/GEN/htracking.param b/PARAM/HMS/GEN/htracking.param index 99b502a69f6dcf31d4ff079ffe72c0f887f10e34..e56b394c9416fa6229598a47e546edd6ac85770d 100644 --- a/PARAM/HMS/GEN/htracking.param +++ b/PARAM/HMS/GEN/htracking.param @@ -1,26 +1,25 @@ -; hms pattern recognition and tracking code parameters -; hmax_pr_hits is the maximum number of decoded hits allowed in a chamber for -; pattern recognition to proceed. This protexts against unusual -; kami kaze events which hang the analyzer to a long time. -; - hmax_pr_hits = 35, 35 -; maximum number of possible focal plane tracks, must be <= 20 - hntracks_max_fp = 10 -; if h_remove_sppt_if_one_y_plane=1 then remove space point if space point -; contains only one y plane. -; Recommend h_remove_sppt_if_one_y_plane=0. - h_remove_sppt_if_one_y_plane=0 -; hminhit(i) minimum number of hits in each space point (one for each chamber) - hmin_hit = 5, 5 -; hmin_combos(i) minimum number of pairs in each space point ( one per chamber) -; should be 3/3 for 4/6 tracking, and 4/4 for 5/6 tracking (JRA) - hmin_combos = 4, 4 -; hspace_point_criterion(i) minimum separation of distinct space points -; recommended value for hspace_point_criterion ( based on meeting -; Feb 2003) - hspace_point_criterion = 1.0, 1.0 +; Maximum number of hits allowed in chambers for pattern recognition to proceed (one for each chamber) +hmax_pr_hits = 35, 35 + +; Maximum number of possible focal plane tracks, must be <= 20 +hntracks_max_fp = 10 + +; Remove space point if space point contains only one y plane (0 recommended) +h_remove_sppt_if_one_y_plane = 0 + +; Minimum number of hits in each space point (one per chamber) +hmin_hit = 5, 5 + +; Minimum number of pairs in each space point (one per chamber) +; Should be 3/3 for 4/6 tracking, and 4/4 for 5/6 tracking +hmin_combos = 4, 4 + +; Minimum separation of distinct space points +hspace_point_criterion = 1.0, 1.0 + +; Maximum difference between xp returned by stub and expected xp +hstub_max_xpdiff = .05 - hstub_max_xpdiff = .05 ; ; The following four criteria are applied to the stub fit results at the ; focal plane position to link stubs to tracks diff --git a/SCRIPTS/HMS/replay_hms.C b/SCRIPTS/HMS/replay_hms.C new file mode 100644 index 0000000000000000000000000000000000000000..4bd644d32480aba66a199831437f0cd9625f423e --- /dev/null +++ b/SCRIPTS/HMS/replay_hms.C @@ -0,0 +1,116 @@ +void replay_hms(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_%05d.dat"; + const char* ROOTFileNamePattern = "ROOTfiles/hms_replay_%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 params for HMS trigger configuration + gHcParms->Load("PARAM/TRIG/thms.param"); + + // Load custom tracking params + gHcParms->Load("PARAM/HMS/GEN/hgoldtrack.param"); + + // Load the Hall C style detector map + gHcDetectorMap = new THcDetectorMap(); + gHcDetectorMap->Load("MAPS/HMS/DETEC/hms_stack.map"); + + // 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); + + // 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 Cherenkov to HMS apparatus + THcCherenkov* cer = new THcCherenkov("cer", "Heavy Gas Cherenkov"); + HMS->AddDetector(cer); + // Add calorimeter to HMS apparatus + THcShower* cal = new THcShower("cal", "Calorimeter"); + HMS->AddDetector(cal); + + // Include golden track information + THaGoldenTrack* gtr = new THaGoldenTrack("H.gtr", "HMS Golden Track", "H"); + gHaPhysics->Add(gtr); + + // 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/GEN/hstackana.def"); + analyzer->SetCutFile("DEF-files/HMS/GEN/hstackana_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/SHMS/replay_shms.C b/SCRIPTS/SHMS/replay_shms.C new file mode 100644 index 0000000000000000000000000000000000000000..017649963c702e616da4445eb9974e9b2e0a57b1 --- /dev/null +++ b/SCRIPTS/SHMS/replay_shms.C @@ -0,0 +1,122 @@ +void replay_shms(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/shms_all_%05d.dat"; + const char* ROOTFileNamePattern = "ROOTfiles/shms_replay_%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 params for SHMS trigger configuration + gHcParms->Load("PARAM/TRIG/tshms.param"); + + // Load custom tracking params + //gHcParms->Load("PARAM/SHMS/GEN/hgoldtrack.param"); + + // Load the Hall C style detector map + gHcDetectorMap = new THcDetectorMap(); + gHcDetectorMap->Load("MAPS/SHMS/DETEC/shms_stack.map"); + + // Add trigger apparatus + THaApparatus* TRG = new THcTrigApp("T", "TRG"); + gHaApps->Add(TRG); + // Add trigger detector to trigger apparatus + THcTrigDet* shms = new THcTrigDet("shms", "SHMS Trigger Information"); + TRG->AddDetector(shms); + + // Set up the equipment to be analyzed. + THaApparatus* SHMS = new THcHallCSpectrometer("P", "SHMS"); + gHaApps->Add(SHMS); + // Add Noble Gas Cherenkov to SHMS apparatus + THcCherenkov* ngcer = new THcCherenkov("ngcer", "Noble Gas Cherenkov"); + SHMS->AddDetector(ngcer); + // Add drift chambers to SHMS apparatus + THcDC* dc = new THcDC("dc", "Drift Chambers"); + SHMS->AddDetector(dc); + // Add hodoscope to SHMS apparatus + THcHodoscope* hod = new THcHodoscope("hod", "Hodoscope"); + SHMS->AddDetector(hod); + // Add Heavy Gas Cherenkov to SHMS apparatus + THcCherenkov* hgcer = new THcCherenkov("hgcer", "Heavy Gas Cherenkov"); + SHMS->AddDetector(hgcer); + // Add Heavy Gas Cherenkov to SHMS apparatus + THcAerogel* aero = new THcAerogel("aero", "Aerogel"); + SHMS->AddDetector(aero); + // Add calorimeter to SHMS apparatus + THcShower* cal = new THcShower("cal", "Calorimeter"); + SHMS->AddDetector(cal); + + // Include golden track information + THaGoldenTrack* gtr = new THaGoldenTrack("P.gtr", "SHMS Golden Track", "P"); + gHaPhysics->Add(gtr); + + // 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/SHMS/GEN/pstackana.def"); + analyzer->SetCutFile("DEF-files/SHMS/GEN/pstackana_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_shms_%05d.report", RunNumber) + //); +} diff --git a/onlineGUI/Config/kpp.cfg b/onlineGUI/Config/kpp.cfg new file mode 100644 index 0000000000000000000000000000000000000000..3f6fbe6a37027a67a72a0bbe9454f8b856c90bf2 --- /dev/null +++ b/onlineGUI/Config/kpp.cfg @@ -0,0 +1,6 @@ +protorootfile ../ROOTfiles/shms_replay_XXXXX.root +guicolor lightblue +canvassize 800 800 +newpage 4 4 +title Test +macro Macros/kpp_analysis("h_p1T_tdc") \ No newline at end of file diff --git a/onlineGUI/Macros/kpp_analysis.C b/onlineGUI/Macros/kpp_analysis.C new file mode 100644 index 0000000000000000000000000000000000000000..4b4dbb0360fff2ab62011e4c980a065be55efbcf --- /dev/null +++ b/onlineGUI/Macros/kpp_analysis.C @@ -0,0 +1,46 @@ + +void UserScript() { + + UInt_t num_p1T; + + Double_t p1T_tdc[128]; + + TH1F *h_p1T_tdc; + + TTree *T = (TTree*) gDirectory->Get("T"); + + T->SetBranchAddress("T.shms.p1T_tdcMultiplicity", &num_p1T); + T->SetBranchAddress("T.shms.p1T_tdcTime", &p1T_tdc); + + h_p1T_tdc = new TH1F("h_p1T_tdc", "p1T; TDC Time (ns); Counts / 1 ns", 200, 0, 200); + + for(UInt_t iev = 0, N = T->GetEntries(); iev < N; iev++) { + T->GetEntry(iev); + + for (Uint_t ihit = 0; i < nump1T; ihit++) { + + Double_t p1T_tdc_data = p1T_tdc[ihit++]; + + h_p1T_tdc->Fill(p1T_tdc); + + } + + } // Entries loop + +} + + +void kpp_analysis(TString histname) { + + TH1F* h; + h = (TH1F*) gDirectory->Get(histname); + if(!h) { + UserScript(); + h = (TH1F*) gDirectory->Get(histname); + if(!h) { + cout << "User histogram " << histname << " not found" << endl; + exit(1); + } + } + h->Draw(); +}