Skip to content
Snippets Groups Projects
Commit 0126a691 authored by Stephen A. Wood's avatar Stephen A. Wood Committed by Stephen Wood
Browse files

Examples script to study slippage of FADC trigger times.

  Usual trigger time offsets for the 3 FADC crates are set
  in slipstudy.C
parent af10f36b
No related branches found
No related tags found
No related merge requests found
...@@ -53,6 +53,8 @@ examples/db_cratemap.dat ...@@ -53,6 +53,8 @@ examples/db_cratemap.dat
examples/report.out examples/report.out
examples/periodic.out examples/periodic.out
examples/HScaler.txt examples/HScaler.txt
examples/raw
examples/cache
# Working directory # Working directory
work work
# 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
==== 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
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();
}
# Empty Output def file
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