-
Notifications
You must be signed in to change notification settings - Fork 12
/
replay_both.C
106 lines (86 loc) · 4.28 KB
/
replay_both.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
THcAnalyzer* analyzer = new THcAnalyzer;
void replay_both(Int_t RunNumber=52949, Int_t FirstToReplay=1, Int_t MaxEventToReplay=11000) {
//
// Steering script to test hodoscope decoding
//
//Int_t RunNumber=52949;
if (RunNumber == 50017) {
char* RunFileNamePattern="daq04_%d.log.0";
} else {
// char* RunFileNamePattern="/group/hallc/gabriel/work/daq03_%d.log.0";
char* RunFileNamePattern="/cache/mss/hallc/daq04/raw/daq04_%d.log.0";
// char* RunFileNamePattern="/home/zahmed/fAnalyzer/analysis/replay/RawData/daq04_%d.log.0";
}
gHcParms->Define("gen_run_number", "Run Number", RunNumber);
gHcParms->AddString("g_ctp_database_filename", "jan05.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_kinematics_filename"), RunNumber);
gHcParms->Load(gHcParms->GetString("g_ctp_parm_filename"));
gHcParms->Load("hcana.param");
// Constants not in ENGINE PARAM files that we want to be
// configurable
//gHcParms->Load(Form("PARAM/%05d/general.param",RunNumber));
// 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 );
HMS->AddDetector( new THcHodoscope("hod", "Hodoscope" ));
HMS->AddDetector( new THcShower("cal", "Shower" ));
THcCherenkov* cherenkov = new THcCherenkov("cher", "Gas Cerenkov" );
HMS->AddDetector( cherenkov );
HMS->AddDetector( new THcDC("dc", "Drift Chambers" ));
THcAerogel* aerogel = new THcAerogel("aero", "Aerogel Cerenkov" );
HMS->AddDetector( aerogel );
//
THaApparatus* SOS = new THcHallCSpectrometer("S","SOS");
gHaApps->Add( SOS );
// Add detectors
SOS->AddDetector( new THcHodoscope("hod", "Hodoscope" ));
SOS->AddDetector( new THcShower("cal", "Shower" ));
SOS->AddDetector( new THcCherenkov("cher", "Gas Cerenkov" ));
SOS->AddDetector( new THcDC("dc", "Drift Chambers" ));
// Beamline and its detectors
THaApparatus * BEAM = new THcRasteredBeam("RB","Rastered Beamline");
gHaApps->Add( BEAM );
// setup physics
gHaPhysics->Add( new THaGoldenTrack( "H.gold", "HMS Golden Track", "H" ));
gHaPhysics->Add( new THaGoldenTrack( "S.gold", "SOSS Golden Track", "S" ));
// 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(FirstToReplay,MaxEventToReplay);// Physics Event number, does not
// include scaler or control events
// 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(Form("Rootfiles/replay_both_%05d.root",RunNumber));
analyzer->SetOdefFile("output_replay_both.def");
analyzer->SetCutFile("cuts_replay_both.def"); // optional
// File to record cuts accounting information
// analyzer->SetSummaryFile("summary_example.log"); // optional
analyzer->Process(run); // start the actual analysis
analyzer->PrintReport("report.template",Form("replay_both_%05d.report",RunNumber));
}