diff --git a/.gitignore b/.gitignore index 978a324145b5e9a2b5f02322b5bf6e005eeb00fd..c4b01637788274d42f8911b0c838491331b9e33b 100644 --- a/.gitignore +++ b/.gitignore @@ -53,6 +53,8 @@ examples/db_cratemap.dat examples/report.out examples/periodic.out examples/HScaler.txt +examples/raw +examples/cache # Working directory work diff --git a/examples/DBASE/slip.database b/examples/DBASE/slip.database new file mode 100644 index 0000000000000000000000000000000000000000..f24cb1fddd07c12c19b8c7417531e658416949e8 --- /dev/null +++ b/examples/DBASE/slip.database @@ -0,0 +1,13 @@ +# ENGINE style parameter vs. run number database +# Define some things to keep analyzer happy +1-1000000 +g_ctp_parm_filename="PARAM/general.param" +g_decode_map_filename="MAPS/raster_jun04.map" +# Values taken from Logbook. Not necessarily official. +gpbeam = 4.015 +hpcentral = 2.074 +htheta_lab = 19.99 +spcentral = 1.73 +stheta_lab = -32.32 +hpartmass = 0.13957 +spartmass = 0.00051099 diff --git a/examples/slip_db_cratemap.dat b/examples/slip_db_cratemap.dat new file mode 100644 index 0000000000000000000000000000000000000000..6c2d18594368d471993c4f318b6058369c07e317 --- /dev/null +++ b/examples/slip_db_cratemap.dat @@ -0,0 +1,87 @@ +==== Crate 1 type vme Bank Decoding +# slot model bank + 2 1190 1190 + 3 250 250 + 4 250 250 + 5 250 250 + 6 250 250 + 7 250 250 + 8 250 250 + 9 250 250 + 10 250 250 + 13 250 250 + 14 250 250 + 15 250 250 + 16 250 250 + 17 250 250 + 18 250 250 + 19 250 250 + 20 1190 1190 + + +==== Crate 2 type vme Bank Decoding +# slot model bank + 3 250 250 + 4 250 250 + 5 250 250 + 6 250 250 + 7 250 250 + 8 250 250 + 9 250 250 + 10 250 250 + 13 250 250 + 14 250 250 + 18 1190 1190 + 19 1190 1190 + 20 1190 1190 + +==== Crate 3 type vme Bank Decoding +# slot model bank + 2 1190 1190 + 4 1190 1190 + 5 1190 1190 + 7 1190 1190 + 8 1190 1190 + 10 1190 1190 + 13 1190 1190 + 14 1190 1190 + 16 1190 1190 + 17 1190 1190 + + +==== Crate 4 type vme Bank Decoding +# slot model bank + 3 250 250 + 4 250 250 + 5 250 250 + 6 250 250 + 7 250 250 + 8 250 250 + 9 250 250 + 10 250 250 + 13 250 250 + 14 250 250 + 15 250 250 + 16 250 250 + 17 250 250 + 18 250 250 + 19 250 250 + 20 250 250 + +==== Crate 5 type vme Bank Decoding +# slot model bank + +==== Crate 6 type vme Bank Decoding +# slot model bank + 6 1190 1190 + 7 1190 1190 + 8 1190 1190 + 9 1190 1190 + 10 1190 1190 + 11 1190 1190 + 12 1190 1190 + 13 1190 1190 + 14 1190 1190 + 15 1190 1190 + + diff --git a/examples/slipstudy.C b/examples/slipstudy.C new file mode 100644 index 0000000000000000000000000000000000000000..5c54bcb32279c99c883c6b73ce879973c25d3a34 --- /dev/null +++ b/examples/slipstudy.C @@ -0,0 +1,94 @@ +void slipstudy(TString Spec="", Int_t RunNumber = 0, Int_t MaxEvent = 0) { + + char RunFileNamePattern[100]=""; + if(Spec.Length()==0) { + cout << "Enter \"shms\", \"hms\", or \"coin\": "; + cin >> RunFileNamePattern; + } else { + strcpy(RunFileNamePattern, Spec.Data()); + } + // Get RunNumber and MaxEvent if not provided. + if(RunNumber == 0) { + cout << "\nEnter 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. + strcat(RunFileNamePattern, "_all_%05d.dat"); + vector<TString> pathList; + pathList.push_back("."); + pathList.push_back("./raw"); + pathList.push_back("./raw/../raw.copiedtotape"); + pathList.push_back("./cache"); + + cout << RunFileNamePattern << endl; + + gHcParms->Define("gen_run_number", "Run Number", RunNumber); + gHcParms->AddString("g_ctp_database_filename", "DBASE/slip.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"); + system("cp slip_db_cratemap.dat db_cratemap.dat"); + + THcTimeSyncEvtHandler* fadcsynccheck = new THcTimeSyncEvtHandler("SYNC","Synchronization test"); + fadcsynccheck->AddExpectedOffset(1, -6); + fadcsynccheck->AddExpectedOffset(2, -7); + fadcsynccheck->AddExpectedOffset(4, -6); + fadcsynccheck->AddEvtType(1); + fadcsynccheck->AddEvtType(2); + fadcsynccheck->AddEvtType(3); + fadcsynccheck->AddEvtType(4); + fadcsynccheck->AddEvtType(5); + fadcsynccheck->AddEvtType(6); + fadcsynccheck->AddEvtType(7); + gHaEvtHandlers->Add(fadcsynccheck); + + // 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. + THcRun* run = new THcRun( pathList, Form(RunFileNamePattern, RunNumber) ); + run->SetRunParamClass("THcRunParameters"); + +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 + 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->SetOutFile("slipstudy.root"); + analyzer->SetOdefFile("slipstudy.def"); + analyzer->Process(run); + fadcsynccheck->PrintStats(); +} diff --git a/examples/slipstudy.def b/examples/slipstudy.def new file mode 100644 index 0000000000000000000000000000000000000000..323bc8dceb6967735d6111b1c418838bc72fd0c0 --- /dev/null +++ b/examples/slipstudy.def @@ -0,0 +1 @@ +# Empty Output def file