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
c3fe25a8
Commit
c3fe25a8
authored
13 years ago
by
Stephen A. Wood
Browse files
Options
Downloads
Patches
Plain Diff
Parse detector map and think about hit list
parent
5d786977
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
+66
-16
66 additions, 16 deletions
src/THcDetectorMap.cxx
src/THcRawHitList.cxx
+7
-0
7 additions, 0 deletions
src/THcRawHitList.cxx
src/THcRawHitList.h
+9
-1
9 additions, 1 deletion
src/THcRawHitList.h
with
82 additions
and
17 deletions
src/THcDetectorMap.cxx
+
66
−
16
View file @
c3fe25a8
...
...
@@ -9,10 +9,19 @@
// Will need method to retrieve all map entries for a given
// detector id.
//
// Not sure we will keep this class, but still need the parsing of the map file
//
//////////////////////////////////////////////////////////////////////////
#include
"THcDetectorMap.h"
#include
"TObjArray.h"
#include
"TObjString.h"
#include
<iostream>
#include
<fstream>
#include
<cstdlib>
using
namespace
std
;
ClassImp
(
THcDetectorMap
)
...
...
@@ -32,7 +41,7 @@ void THcDetectorMap::Load(const char *fname)
ifstream
ifile
;
ifile
.
open
(
fname
);
if
(
!
ifile
.
is_open
)
{
if
(
!
ifile
.
is_open
()
)
{
Error
(
here
,
"error opening detector map file %s"
,
fname
);
return
;
// Need a success/failure argument?
}
...
...
@@ -45,33 +54,74 @@ void THcDetectorMap::Load(const char *fname)
Int_t
detector
=
0
;
Int_t
slot
=
0
;
string
::
size_type
start
,
pos
=
0
;
char
varname
[
100
];
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 << "MAPA: " << line << endl;
// Remove comment from line
while
((
pos
=
line
.
find_first_of
(
"!"
,
pos
+
1
))
!=
string
::
npos
)
{
if
(
IsComment
(
line
,
pos
))
{
line
.
erase
(
pos
);
break
;
}
}
// Get rid of all white space
while
((
pos
=
line
.
find_first_of
(
whtspc
))
!=
string
::
npos
)
{
line
.
erase
(
pos
,
1
);
}
}
cout
<<
"MAPB: "
<<
line
<<
endl
;
//
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
if
((
pos
=
line
.
find_first_of
(
"="
))
!=
string
::
npos
)
{
// Setting parameter
strcpy
(
varname
,
(
line
.
substr
(
0
,
pos
)).
c_str
());
Int_t
valuestartpos
=
pos
+
1
;
Int_t
value
=
atoi
(
line
.
substr
(
valuestartpos
).
c_str
());
// Some if statements
if
(
strcasecmp
(
varname
,
"detector"
)
==
0
)
{
detector
=
value
;
}
else
if
(
strcasecmp
(
varname
,
"roc"
)
==
0
)
{
roc
=
value
;
}
else
if
(
strcasecmp
(
varname
,
"nsubadd"
)
==
0
)
{
nsubadd
=
value
;
}
else
if
(
strcasecmp
(
varname
,
"mask"
)
==
0
)
{
mask
=
value
;
}
else
if
(
strcasecmp
(
varname
,
"bsub"
)
==
0
)
{
bsub
=
value
;
}
else
if
(
strcasecmp
(
varname
,
"slot"
)
==
0
)
{
slot
=
value
;
}
}
else
{
// Assume channel definition
TString
values
(
line
.
c_str
());
TObjArray
*
vararr
=
values
.
Tokenize
(
","
);
Int_t
nvals
=
vararr
->
GetLast
()
+
1
;
if
(
nvals
<
2
||
nvals
>
4
)
{
cout
<<
"Map file: Invalid value count: "
<<
line
<<
endl
;
continue
;
}
Int_t
channel
=
((
TObjString
*
)
vararr
->
At
(
0
))
->
GetString
().
Atoi
();
Int_t
plane
=
((
TObjString
*
)
vararr
->
At
(
1
))
->
GetString
().
Atoi
();
Int_t
counter
=
((
TObjString
*
)
vararr
->
At
(
2
))
->
GetString
().
Atoi
();
Int_t
signal
=
0
;
if
(
nvals
==
4
)
{
signal
=
((
TObjString
*
)
vararr
->
At
(
3
))
->
GetString
().
Atoi
();
}
cout
<<
channel
<<
" "
<<
plane
<<
" "
<<
counter
<<
" "
<<
signal
<<
endl
;
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/THcRawHitList.cxx
+
7
−
0
View file @
c3fe25a8
...
...
@@ -21,6 +21,13 @@ THcRawHitList::~THcRawHitList() {
delete
fHits
;
}
Int_t
THcRawHitList
::
Fill
(
const
THaEvData
&
evdata
,
const
THcDetectorMap
&
dmap
)
{
// Zero out hit list
// Interate over list of channels belonging to detector, retrieving
// data that belongs to the detector
}
void
THcRawHitList
::
Clear
(
Option_t
*
)
{
fHits
->
Clear
();
...
...
This diff is collapsed.
Click to expand it.
src/THcRawHitList.h
+
9
−
1
View file @
c3fe25a8
...
...
@@ -9,6 +9,8 @@
#include
"TClonesArray.h"
#include
"THcRawHit.h"
#include
"THcDetectorMap.h"
#include
"THaEvData.h"
#include
<cassert>
class
THcRawHitList
{
...
...
@@ -18,9 +20,12 @@ class THcRawHitList {
THcRawHitList
(
const
char
*
classname
,
Int_t
detectorid
,
Int_t
size
);
virtual
~
THcRawHitList
();
Int_t
Fill
(
const
THaEvData
&
evdata
,
const
THcDetectorMap
&
dmap
);
// Should detector map be a member variable too?
TClonesArray
*
fHits
;
Int_t
fMaxhit
;
Int_t
fDetectorid
;
Int_t
GetNHits
()
const
{
return
fHits
->
GetLast
()
+
1
;
}
TClonesArray
*
GetHits
()
const
{
return
fHits
;
}
...
...
@@ -35,6 +40,9 @@ class THcRawHitList {
void
Clear
(
Option_t
*
);
protected
:
Int_t
fDetectorid
;
private
:
ClassDef
(
THcRawHitList
,
0
);
// Raw hit class
};
...
...
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