Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hcana
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
analyzer_software
hcana
Commits
5d786977
Commit
5d786977
authored
13 years ago
by
Stephen A. Wood
Browse files
Options
Downloads
Patches
Plain Diff
Start writing a Load method to read the detector map
parent
7d3b0f64
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
src/THcDetectorMap.cxx
+55
-0
55 additions, 0 deletions
src/THcDetectorMap.cxx
with
55 additions
and
0 deletions
src/THcDetectorMap.cxx
+
55
−
0
View file @
5d786977
...
@@ -17,7 +17,62 @@ using namespace std;
...
@@ -17,7 +17,62 @@ using namespace std;
ClassImp
(
THcDetectorMap
)
ClassImp
(
THcDetectorMap
)
inline
static
bool
IsComment
(
const
string
&
s
,
string
::
size_type
pos
)
{
return
(
pos
!=
string
::
npos
&&
pos
<
s
.
length
()
&&
(
s
[
pos
]
==
'!'
)
);
}
void
THcDetectorMap
::
Load
(
const
char
*
fname
)
void
THcDetectorMap
::
Load
(
const
char
*
fname
)
{
{
static
const
char
*
const
here
=
"THcDetectorMap::Load"
;
static
const
char
*
const
whtspc
=
"
\t
"
;
ifstream
ifile
;
ifile
.
open
(
fname
);
if
(
!
ifile
.
is_open
)
{
Error
(
here
,
"error opening detector map file %s"
,
fname
);
return
;
// Need a success/failure argument?
}
string
line
;
Int_t
roc
=
0
;
Int_t
nsubadd
=
0
;
Int_t
mask
=
0
;
Int_t
bsub
=
0
;
Int_t
detector
=
0
;
Int_t
slot
=
0
;
while
(
getline
(
ifile
,
line
))
{
// BLank line or comment
if
(
line
.
empty
()
||
(
start
=
line
.
find_first_not_of
(
whtspc
))
==
string
::
npos
||
IsComment
(
line
,
start
)
)
continue
;
}
// Get rid of trailing comments and leading and trailing whitespace
cout
<<
"MAPA: "
<<
line
<<
endl
;
while
((
pos
=
line
.
find_first_of
(
"!"
,
pos
+
1
))
!=
string
::
npos
)
{
if
(
IsComment
(
line
,
pos
))
{
line
.
erase
(
pos
);
break
;
}
}
cout
<<
"MAPB: "
<<
line
<<
endl
;
// Decide if line is ROC/NSUBADD/MASK/BSUB/DETECTOR/SLOT = something
// or chan, plane, counter[, signal]
if
((
pos
=
line
.
find_first_of
(
"="
))
!=
string
::
npos
)
{
// Setting parameter
char
varname
[
100
];
}
else
{
// Assume channel definition
}
}
}
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