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
Container Registry
Model registry
Operate
Environments
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
jlab
hallc
exp
polhe3
hallc_replay
Commits
ef5fa835
Commit
ef5fa835
authored
8 years ago
by
Carlos Yero
Browse files
Options
Downloads
Patches
Plain Diff
changed generic root file name read out to hms_replay_%d.root
parent
7f3bdf40
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
CALIBRATION/hms_dc_calib/scripts/get_hdc_time_histo_tzero_corrected.C
+27
-28
27 additions, 28 deletions
...hms_dc_calib/scripts/get_hdc_time_histo_tzero_corrected.C
with
27 additions
and
28 deletions
CALIBRATION/hms_dc_calib/scripts/get_hdc_time_histo_tzero_corrected.C
+
27
−
28
View file @
ef5fa835
...
@@ -5,18 +5,17 @@
...
@@ -5,18 +5,17 @@
void
get_hdc_time_histo_tzero_corrected
()
void
get_hdc_time_histo_tzero_corrected
()
{
{
//read run number from input file
//read run number from input file
int
run_NUM
;
int
run_NUM
;
TString
f0
=
"input_RUN.txt"
;
TString
f0
=
"input_RUN.txt"
;
ifstream
infile
(
f0
);
ifstream
infile
(
f0
);
infile
>>
run_NUM
;
infile
>>
run_NUM
;
TString
run
=
Form
(
"run%d"
,
run_NUM
);
TString
run
=
Form
(
"run%d"
,
run_NUM
);
//open file
//open file
TFile
*
f
=
new
TFile
(
Form
(
"../../../ROOTfiles/
test
_%d.root"
,
run_NUM
),
"READ"
);
TFile
*
f
=
new
TFile
(
Form
(
"../../../ROOTfiles/
hms_replay
_%d.root"
,
run_NUM
),
"READ"
);
//updates file
//updates file
TFile
*
g
=
new
TFile
(
Form
(
"../root_files/run%d/hms_dc_t0_corrected_%d.root"
,
run_NUM
,
run_NUM
),
"UPDATE"
);
// create new file to store histo
TFile
*
g
=
new
TFile
(
Form
(
"../root_files/run%d/hms_dc_t0_corrected_%d.root"
,
run_NUM
,
run_NUM
),
"UPDATE"
);
// create new file to store histo
...
@@ -33,42 +32,42 @@ void get_hdc_time_histo_tzero_corrected()
...
@@ -33,42 +32,42 @@ void get_hdc_time_histo_tzero_corrected()
//Declare Variables to Loop Over
//Declare Variables to Loop Over
Int_t
Ndata
[
NPLANES
];
Int_t
Ndata
[
NPLANES
];
Double_t
hdc_time
[
NPLANES
][
1000
];
Double_t
hdc_time
[
NPLANES
][
1000
];
//Declare Histogram array to store AVG drift times per plane
//Declare Histogram array to store AVG drift times per plane
TH1F
*
h
[
NPLANES
];
TH1F
*
h
[
NPLANES
];
g
->
cd
();
g
->
cd
();
//Loop over each plane
//Loop over each plane
for
(
Int_t
ip
=
0
;
ip
<
NPLANES
;
ip
++
){
for
(
Int_t
ip
=
0
;
ip
<
NPLANES
;
ip
++
){
TString
base_name
=
SPECTROMETER
+
"."
+
DETECTOR
+
"."
+
plane_names
[
ip
];
TString
base_name
=
SPECTROMETER
+
"."
+
DETECTOR
+
"."
+
plane_names
[
ip
];
TString
ndata_name
=
"Ndata."
+
base_name
+
".time"
;
TString
ndata_name
=
"Ndata."
+
base_name
+
".time"
;
TString
drift_time
=
base_name
+
".time"
;
TString
drift_time
=
base_name
+
".time"
;
TString
drift_time_histo
=
"hdc"
+
plane_names
[
ip
]
+
"_time: t0_corr"
;
TString
drift_time_histo
=
"hdc"
+
plane_names
[
ip
]
+
"_time: t0_corr"
;
TString
title
=
"hdc"
+
plane_names
[
ip
]
+
"_drifttime: t0-corrected"
;
TString
title
=
"hdc"
+
plane_names
[
ip
]
+
"_drifttime: t0-corrected"
;
//Set Branch Address
//Set Branch Address
tree
->
SetBranchAddress
(
drift_time
,
hdc_time
[
ip
]);
tree
->
SetBranchAddress
(
drift_time
,
hdc_time
[
ip
]);
tree
->
SetBranchAddress
(
ndata_name
,
&
Ndata
[
ip
]);
/* Ndata represents number of triggers vs number of hits that each trigger produced.
tree
->
SetBranchAddress
(
ndata_name
,
&
Ndata
[
ip
]);
/* Ndata represents number of triggers vs number of hits that each trigger produced.
A hit is refer to as when a trigger(traversing particle), ionizes the WC gas and ionized
A hit is refer to as when a trigger(traversing particle), ionizes the WC gas and ionized
electrons reach the rearest sense wire, producing a detectable signal in the O'scope */
electrons reach the rearest sense wire, producing a detectable signal in the O'scope */
//Create Histograms
//Create Histograms
h
[
ip
]
=
new
TH1F
(
drift_time_histo
,
title
,
200
,
-
50
,
350
);
//set time to 400 ns/200 bins = 2ns/bin
h
[
ip
]
=
new
TH1F
(
drift_time_histo
,
title
,
200
,
-
50
,
350
);
//set time to 400 ns/200 bins = 2ns/bin
}
}
//open and read tzero data file
//open and read tzero data file
ifstream
ifs
;
ifstream
ifs
;
ifs
.
open
(
"../data_files/"
+
run
+
"/tzero.dat"
);
ifs
.
open
(
"../data_files/"
+
run
+
"/tzero.dat"
);
double
t_zero_offsets
[
NPLANES
];
double
t_zero_offsets
[
NPLANES
];
for
(
ip
=
0
;
ip
<
12
;
ip
++
)
{
for
(
ip
=
0
;
ip
<
12
;
ip
++
)
{
ifs
>>
t_zero_offsets
[
ip
];
//add tzero offsets to array
ifs
>>
t_zero_offsets
[
ip
];
//add tzero offsets to array
}
}
//Declare number of entries in the tree
//Declare number of entries in the tree
Long64_t
nentries
=
tree
->
GetEntries
();
//number of triggers (particles that passed through all 4 hodo planes)
Long64_t
nentries
=
tree
->
GetEntries
();
//number of triggers (particles that passed through all 4 hodo planes)
...
@@ -76,29 +75,29 @@ void get_hdc_time_histo_tzero_corrected()
...
@@ -76,29 +75,29 @@ void get_hdc_time_histo_tzero_corrected()
for
(
Long64_t
i
=
0
;
i
<
nentries
;
i
++
)
for
(
Long64_t
i
=
0
;
i
<
nentries
;
i
++
)
{
{
tree
->
GetEntry
(
i
);
tree
->
GetEntry
(
i
);
//Loop over number of hits for each trigger in each DC plane
//Loop over number of hits for each trigger in each DC plane
for
(
ip
=
0
;
ip
<
NPLANES
;
ip
++
){
for
(
ip
=
0
;
ip
<
NPLANES
;
ip
++
){
for
(
Int_t
j
=
0
;
j
<
Ndata
[
ip
];
j
++
){
for
(
Int_t
j
=
0
;
j
<
Ndata
[
ip
];
j
++
){
h
[
ip
]
->
Fill
(
hdc_time
[
ip
][
j
]
-
t_zero_offsets
[
ip
]);
//add t0 offset correction
h
[
ip
]
->
Fill
(
hdc_time
[
ip
][
j
]
-
t_zero_offsets
[
ip
]);
//add t0 offset correction
}
}
}
}
}
}
//Write histograms to file
//Write histograms to file
g
->
Write
();
g
->
Write
();
...
...
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