Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hallc_replay
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Melanie Cardona
hallc_replay
Commits
9ddece14
Commit
9ddece14
authored
8 years ago
by
Jure Bericic
Browse files
Options
Downloads
Patches
Plain Diff
Cleaned up demo replay script.
parent
7ebea813
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
SCRIPTS/replay_hms.C
+106
-101
106 additions, 101 deletions
SCRIPTS/replay_hms.C
with
106 additions
and
101 deletions
SCRIPTS/replay_hms.C
+
106
−
101
View file @
9ddece14
void
replay_hms
(
Int_t
RunNumber
=
0
,
Int_t
MaxEvent
=
0
)
{
void
replay_hms
(
Int_t
RunNumber
=
0
,
Int_t
MaxEvent
=
0
)
{
//
// Get RunNumber and MaxEvent if not provided.
//
if
(
RunNumber
==
0
)
{
if
(
RunNumber
==
0
)
{
cout
<<
"Enter a Run Number (-1 to exit): "
;
cout
<<
"Enter a Run Number (-1 to exit): "
;
cin
>>
RunNumber
;
cin
>>
RunNumber
;
if
(
RunNumber
<=
0
)
break
;
if
(
RunNumber
<=
0
)
break
;
}
}
if
(
MaxEvent
==
0
)
{
if
(
MaxEvent
==
0
)
{
cout
<<
"
\n
Number of Events to analyze: "
;
cout
<<
"
\n
Number of Events to analyze: "
;
cin
>>
MaxEvent
;
cin
>>
MaxEvent
;
if
(
MaxEvent
==
0
)
{
if
(
MaxEvent
==
0
)
{
cerr
<<
"...Invalid entry
\n
"
;
cerr
<<
"...Invalid entry
\n
"
;
exit
;
exit
;
}
}
}
}
// Create file name patterns.
char
*
RunFileNamePattern
=
"raw/test_%d.dat"
;
char
*
RunFileNamePattern
=
"raw/test_%d.dat"
;
const
char
*
ROOTFileNamePattern
=
"ROOTfiles/hms1190_%d.root"
;
const
char
*
ROOTFileNamePattern
=
"ROOTfiles/hms1190_%d.root"
;
//
// Add variables to global list.
gHcParms
->
Define
(
"gen_run_number"
,
"Run Number"
,
RunNumber
);
gHcParms
->
Define
(
"gen_run_number"
,
"Run Number"
,
RunNumber
);
gHcParms
->
AddString
(
"g_ctp_database_filename"
,
"DBASE/standard.database"
);
gHcParms
->
AddString
(
"g_ctp_database_filename"
,
"DBASE/standard.database"
);
gHcParms
->
Load
(
gHcParms
->
GetString
(
"g_ctp_database_filename"
),
RunNumber
);
// 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
// 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_kinematics_filename"
),
RunNumber
);
gHcParms
->
Load
(
gHcParms
->
GetString
(
"g_ctp_parm_filename"
));
gHcParms
->
Load
(
gHcParms
->
GetString
(
"g_ctp_parm_filename"
));
// Generate db_cratemap to correspond to map file contents via Pearl script.
// Generate db_cratemap to correspond to map file contents
//char command[100];
//char command[100];
// sprintf(command,"MAPS/make_cratemap.pl < %s > db_cratemap.dat",gHcParms->GetString("g_decode_map_filename"));
//sprintf(
// command,
// "MAPS/make_cratemap.pl < %s > MAPS/db_cratemap.dat",
// gHcParms->GetString("g_decode_map_filename")
//);
//system(command);
//system(command);
// for now used pre made crate map
// Load the Hall C style detector map
// Load the Hall C style detector map
gHcDetectorMap
=
new
THcDetectorMap
();
gHcDetectorMap
=
new
THcDetectorMap
();
gHcDetectorMap
->
Load
(
gHcParms
->
GetString
(
"g_decode_map_filename"
));
gHcDetectorMap
->
Load
(
gHcParms
->
GetString
(
"g_decode_map_filename"
));
// Set up the equipment to be analyzed.
// Set up the equipment to be analyzed.
THaApparatus
*
HMS
=
new
THcHallCSpectrometer
(
"H"
,
"HMS"
);
THaApparatus
*
HMS
=
new
THcHallCSpectrometer
(
"H"
,
"HMS"
);
gHaApps
->
Add
(
HMS
);
gHaApps
->
Add
(
HMS
);
HMS
->
AddDetector
(
new
THcDC
(
"dc"
,
"Drift Chambers"
));
// HMS->AddDetector( new THcHodoscope("hod", "Hodoscope" ));
//HMS->AddDetector( new THcShower("cal", "Shower" ));
// Additional detectors:
//THcCherenkov* cherenkov = new THcCherenkov("cher", "Gas Cerenkov" );
//HMS->AddDetector(new THcHodoscope("hod", "Hodoscope"));
// HMS->AddDetector( cherenkov );
//HMS->AddDetector(new THcShower("cal", "Shower"));
HMS
->
AddDetector
(
new
THcDC
(
"dc"
,
"Drift Chambers"
));
//
//THcAerogel* aerogel = new THcAerogel("aero", "Aerogel Cerenkov" );
//THcCherenkov* cherenkov = new THcCherenkov("cher", "Gas Cerenkov");
//HMS->AddDetector( aerogel );
//HMS->AddDetector(cherenkov);
//
//THcAerogel* aerogel = new THcAerogel("aero", "Aerogel Cerenkov");
//THcScalerEvtHandler *hscaler = new THcScalerEvtHandler("HS","HC scaler event type 0");
//HMS->AddDetector(aerogel);
// hscaler->SetDebugFile("HScaler.txt");
//
//gHaEvtHandlers->Add (hscaler);
//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,
// Set up the analyzer - we use the standard one,
// but this could be an experiment-specific one as well.
// but this could be an experiment-specific one as well.
// The Analyzer controls the reading of the data, executes
// The Analyzer controls the reading of the data, executes
// tests/cuts, loops over Acpparatus's and PhysicsModules,
// tests/cuts, loops over Acpparatus's and PhysicsModules,
// and executes the output routines.
// and executes the output routines.
THcAnalyzer
*
analyzer
=
new
THcAnalyzer
;
THcAnalyzer
*
analyzer
=
new
THcAnalyzer
;
// A simple event class to be output to the resulting tree.
// A simple event class to be output to the resulting tree.
// Creating your own descendant of THaEvent is one way of
// Creating your own descendant of THaEvent is one way of
// defining and controlling the output.
// defining and controlling the output.
THaEvent
*
event
=
new
THaEvent
;
THaEvent
*
event
=
new
THaEvent
;
// Define the run(s) that we want to analyze.
// Define the run(s) that we want to analyze.
// We just set up one, but this could be many.
// We just set up one, but this could be many.
char
RunFileName
[
100
];
char
RunFileName
[
100
];
sprintf
(
RunFileName
,
RunFileNamePattern
,
RunNumber
);
sprintf
(
RunFileName
,
RunFileNamePattern
,
RunNumber
);
THaRun
*
run
=
new
THaRun
(
RunFileName
);
THaRun
*
run
=
new
THaRun
(
RunFileName
);
// Eventually need to learn to skip over, or properly analyze
// Eventually need to learn to skip over, or properly analyze
// the pedestal events
// the pedestal events
run
->
SetEventRange
(
1
,
MaxEvent
);
// Physics Event number, does not
run
->
SetEventRange
(
1
,
MaxEvent
);
// Physics Event number, does not
// include scaler or control events.
// include scaler or control events
run
->
SetNscan
(
1
);
run
->
SetNscan
(
1
);
run
->
SetDataRequired
(
0x7
);
run
->
SetDataRequired
(
0x7
);
run
->
Print
();
run
->
Print
();
// Define the analysis parameters
// Define the analysis parameters
TString
ROOTFileName
=
Form
(
ROOTFileNamePattern
,
RunNumber
);
TString
ROOTFileName
=
Form
(
ROOTFileNamePattern
,
RunNumber
);
analyzer
->
SetCountMode
(
2
);
// 0 = counter is # of physics triggers
analyzer
->
SetCountMode
(
2
);
// 0 = counter is # of physics triggers
// 1 = counter is # of all decode reads
//1 = counter is # of all decode reads
// 2 = counter is event number
//2= counter is event number
analyzer
->
SetEvent
(
event
);
analyzer
->
SetEvent
(
event
);
analyzer
->
SetOutFile
(
ROOTFileName
.
Data
());
analyzer
->
SetOutFile
(
ROOTFileName
.
Data
()
);
analyzer
->
SetOdefFile
(
"DEF-files/hdcana.def"
);
analyzer
->
SetOdefFile
(
"DEF-files/hdcana.def"
);
analyzer
->
SetCutFile
(
"DEF-files/hdcana_cuts.def"
);
// optional
analyzer
->
SetCutFile
(
"DEF-files/hdcana_cuts.def"
);
// optional
// File to record cuts accounting information
//analyzer->SetSummaryFile("summary_example.log"); // optional
// File to record cuts accounting information
// analyzer->SetSummaryFile("summary_example.log"); // optional
// Start the actual analysis.
analyzer
->
Process
(
run
);
analyzer
->
Process
(
run
);
// start the actual analysis
// Create report file from template.
// analyzer->PrintReport("TEMPLATES/dcana.template",Form("REPORT_OUTPUT/replay_hms_%05d.report",RunNumber));
//analyzer->PrintReport( // optional
// "TEMPLATES/dcana.template",
// Form("REPORT_OUTPUT/replay_hms_%05d.report", RunNumber)
//);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment