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
32d761ae
Commit
32d761ae
authored
12 years ago
by
Stephen A. Wood
Browse files
Options
Downloads
Patches
Plain Diff
Get detector name -> ID mapping from the map file comments
parent
5f0ea19f
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/THcDetectorMap.cxx
+34
-21
34 additions, 21 deletions
src/THcDetectorMap.cxx
src/THcDetectorMap.h
+7
-0
7 additions, 0 deletions
src/THcDetectorMap.h
src/THcHodoscope.cxx
+1
-1
1 addition, 1 deletion
src/THcHodoscope.cxx
with
42 additions
and
22 deletions
src/THcDetectorMap.cxx
+
34
−
21
View file @
32d761ae
...
@@ -33,7 +33,7 @@ inline static bool IsComment( const string& s, string::size_type pos )
...
@@ -33,7 +33,7 @@ inline static bool IsComment( const string& s, string::size_type pos )
}
}
//_____________________________________________________________________________
//_____________________________________________________________________________
THcDetectorMap
::
THcDetectorMap
()
:
fNchans
(
0
)
THcDetectorMap
::
THcDetectorMap
()
:
fNchans
(
0
)
,
fNIDs
(
0
)
{
{
}
}
...
@@ -64,25 +64,18 @@ Int_t THcDetectorMap::FillMap(THaDetMap *detmap, const char *detectorname)
...
@@ -64,25 +64,18 @@ Int_t THcDetectorMap::FillMap(THaDetMap *detmap, const char *detectorname)
// Translate detector name into and ID
// Translate detector name into and ID
// For now just long if then else. Could get it from the comments
// For now just long if then else. Could get it from the comments
// at the beginning of the map file.
// at the beginning of the map file.
Int_t
did
;
Int_t
did
=-
1
;
if
(
strcasecmp
(
detectorname
,
"HDC"
)
==
0
)
{
for
(
Int_t
i
=
0
;
i
<
fNIDs
;
i
++
)
{
did
=
1
;
if
(
strcasecmp
(
detectorname
,
fIDMap
[
i
].
name
)
==
0
)
{
}
else
if
(
strcasecmp
(
detectorname
,
"HSCIN"
)
==
0
)
{
did
=
fIDMap
[
i
].
id
;
did
=
2
;
break
;
}
else
if
(
strcasecmp
(
detectorname
,
"HCER"
)
==
0
)
{
}
did
=
3
;
}
}
else
if
(
strcasecmp
(
detectorname
,
"HCAL"
)
==
0
)
{
if
(
did
<
0
)
{
did
=
4
;
cout
<<
"FillMap Error: No detector ID registered for "
<<
detectorname
<<
endl
;
}
else
if
(
strcasecmp
(
detectorname
,
"HMISC"
)
==
0
)
{
cout
<<
" Using detector id of 0"
<<
endl
;
did
=
5
;
}
else
if
(
strcasecmp
(
detectorname
,
"GMISC"
)
==
0
)
{
did
=
6
;
}
else
if
(
strcasecmp
(
detectorname
,
"HAERO"
)
==
0
)
{
did
=
7
;
}
else
{
did
=
0
;
did
=
0
;
}
}
// Start SHMS with S? What about SOS?
mlist
.
clear
();
mlist
.
clear
();
// cout << "fNchans=" << fNchans << endl;
// cout << "fNchans=" << fNchans << endl;
...
@@ -207,10 +200,24 @@ void THcDetectorMap::Load(const char *fname)
...
@@ -207,10 +200,24 @@ void THcDetectorMap::Load(const char *fname)
while
(
getline
(
ifile
,
line
))
{
while
(
getline
(
ifile
,
line
))
{
// BLank line or comment
// BLank line or comment
if
(
line
.
empty
()
if
(
line
.
empty
())
continue
;
||
(
start
=
line
.
find_first_not_of
(
whtspc
))
==
string
::
npos
if
((
start
=
line
.
find_first_not_of
(
whtspc
))
==
string
::
npos
)
continue
;
||
IsComment
(
line
,
start
)
)
if
(
IsComment
(
line
,
start
))
{
// Check for ID assignments
// Get rid of all white space
while
((
pos
=
line
.
find_first_of
(
whtspc
))
!=
string
::
npos
)
{
line
.
erase
(
pos
,
1
);
}
line
.
erase
(
0
,
1
);
// Erase "!"
if
(
!
((
pos
=
line
.
find
(
"_ID="
))
==
string
::
npos
))
{
fIDMap
[
fNIDs
].
name
=
new
char
[
pos
+
1
];
strncpy
(
fIDMap
[
fNIDs
].
name
,
line
.
c_str
(),
pos
);
fIDMap
[
fNIDs
].
name
[
pos
]
=
'\0'
;
start
=
(
pos
+=
4
);
// Move to after "="
while
(
isdigit
(
line
.
at
(
pos
++
)));
fIDMap
[
fNIDs
++
].
id
=
atoi
(
line
.
substr
(
start
,
pos
).
c_str
());
}
continue
;
continue
;
}
// cout << "MAPA: " << line << endl;
// cout << "MAPA: " << line << endl;
...
@@ -294,6 +301,12 @@ void THcDetectorMap::Load(const char *fname)
...
@@ -294,6 +301,12 @@ void THcDetectorMap::Load(const char *fname)
fNchans
++
;
fNchans
++
;
}
}
}
}
cout
<<
endl
<<
" Detector ID Map"
<<
endl
<<
endl
;
for
(
Int_t
i
=
0
;
i
<
fNIDs
;
i
++
)
{
cout
<<
i
<<
" "
;
cout
<<
fIDMap
[
i
].
name
<<
" "
<<
fIDMap
[
i
].
id
<<
endl
;
}
cout
<<
endl
;
}
}
This diff is collapsed.
Click to expand it.
src/THcDetectorMap.h
+
7
−
0
View file @
32d761ae
...
@@ -49,6 +49,13 @@ class THcDetectorMap : public TObject {
...
@@ -49,6 +49,13 @@ class THcDetectorMap : public TObject {
};
};
std
::
list
<
ModChanList
>
mlist
;
std
::
list
<
ModChanList
>
mlist
;
struct
IDMap
{
char
*
name
;
Int_t
id
;
};
IDMap
fIDMap
[
50
];
Int_t
fNIDs
;
/* Number of detector IDs */
bool
compare
(
const
ChaninMod
*
first
,
const
ChaninMod
*
second
);
bool
compare
(
const
ChaninMod
*
first
,
const
ChaninMod
*
second
);
protected
:
protected
:
...
...
This diff is collapsed.
Click to expand it.
src/THcHodoscope.cxx
+
1
−
1
View file @
32d761ae
...
@@ -71,7 +71,7 @@ THaAnalysisObject::EStatus THcHodoscope::Init( const TDatime& date )
...
@@ -71,7 +71,7 @@ THaAnalysisObject::EStatus THcHodoscope::Init( const TDatime& date )
// appropriate detector ID in the FillMap call
// appropriate detector ID in the FillMap call
if
(
gHcDetectorMap
->
FillMap
(
fDetMap
,
"HSCIN"
)
<
0
)
{
if
(
gHcDetectorMap
->
FillMap
(
fDetMap
,
"HSCIN"
)
<
0
)
{
Error
(
Here
(
here
),
"Error filling detectormap for %s."
,
Error
(
Here
(
here
),
"Error filling detectormap for %s."
,
"
detectorname
"
);
"
HSCIN
"
);
return
kInitError
;
return
kInitError
;
}
}
...
...
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