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
0e4285e0
Commit
0e4285e0
authored
12 years ago
by
Stephen A. Wood
Committed by
Stephen A. Wood
12 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Aerogel code with pedestals hit lists.
Added haero.param to general.param.
parent
eacd1a65
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/HallC_LinkDef.h
+2
-2
2 additions, 2 deletions
src/HallC_LinkDef.h
src/THcAerogel.cxx
+184
-40
184 additions, 40 deletions
src/THcAerogel.cxx
src/THcAerogel.h
+41
-8
41 additions, 8 deletions
src/THcAerogel.h
src/THcAerogelHit.h
+2
-2
2 additions, 2 deletions
src/THcAerogelHit.h
with
229 additions
and
52 deletions
src/HallC_LinkDef.h
+
2
−
2
View file @
0e4285e0
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
#pragma link C++ class THcShower+;
#pragma link C++ class THcShower+;
#pragma link C++ class THcShowerPlane+;
#pragma link C++ class THcShowerPlane+;
#pragma link C++ class THcShowerHit+;
#pragma link C++ class THcShowerHit+;
#pragma link C++ class THcAerogel;
#pragma link C++ class THcAerogel
+
;
#pragma link C++ class THcAerogelHit;
#pragma link C++ class THcAerogelHit
+
;
#endif
#endif
This diff is collapsed.
Click to expand it.
src/THcAerogel.cxx
+
184
−
40
View file @
0e4285e0
...
@@ -47,6 +47,23 @@ THcAerogel::THcAerogel( ) :
...
@@ -47,6 +47,23 @@ THcAerogel::THcAerogel( ) :
// Constructor
// Constructor
}
}
//_____________________________________________________________________________
void
THcAerogel
::
Setup
(
const
char
*
name
,
const
char
*
description
)
{
// Do we need this for the Aerogel? It is just one plane.
// static const char* const here = "Setup()";
// static const char* const message =
// "Must construct %s detector with valid name! Object construction failed.";
cout
<<
"In THcAerogel::Setup()"
<<
endl
;
// Base class constructor failed?
if
(
IsZombie
())
return
;
fDebug
=
1
;
// Keep this at one while we're working on the code
}
//_____________________________________________________________________________
//_____________________________________________________________________________
THaAnalysisObject
::
EStatus
THcAerogel
::
Init
(
const
TDatime
&
date
)
THaAnalysisObject
::
EStatus
THcAerogel
::
Init
(
const
TDatime
&
date
)
...
@@ -58,38 +75,92 @@ THaAnalysisObject::EStatus THcAerogel::Init( const TDatime& date )
...
@@ -58,38 +75,92 @@ THaAnalysisObject::EStatus THcAerogel::Init( const TDatime& date )
// Should probably put this in ReadDatabase as we will know the
// Should probably put this in ReadDatabase as we will know the
// maximum number of hits after setting up the detector map
// maximum number of hits after setting up the detector map
THcHitList
::
InitHitList
(
fDetMap
,
"THcAerogelHit"
,
100
);
THcHitList
::
InitHitList
(
fDetMap
,
"THcAerogelHit"
,
100
);
EStatus
status
;
EStatus
status
;
if
(
(
status
=
THaNonTrackingDetector
::
Init
(
date
))
)
if
(
(
status
=
THaNonTrackingDetector
::
Init
(
date
))
)
return
fStatus
=
status
;
return
fStatus
=
status
;
for
(
Int_t
ip
=
0
;
ip
<
fNLayers
;
ip
++
)
{
if
((
status
=
fPlanes
[
ip
]
->
Init
(
date
)))
{
return
fStatus
=
status
;
}
}
// Will need to determine which apparatus it belongs to and use the
// Will need to determine which apparatus it belongs to and use the
// appropriate detector ID in the FillMap call
// appropriate detector ID in the FillMap call
if
(
gHcDetectorMap
->
FillMap
(
fDetMap
,
"H
CAL
"
)
<
0
)
{
if
(
gHcDetectorMap
->
FillMap
(
fDetMap
,
"H
AERO
"
)
<
0
)
{
Error
(
Here
(
here
),
"Error filling detectormap for %s."
,
Error
(
Here
(
here
),
"Error filling detectormap for %s."
,
"H
CAL
"
);
"H
AERO
"
);
return
kInitError
;
return
kInitError
;
}
}
return
fStatus
=
kOK
;
return
fStatus
=
kOK
;
}
}
//_____________________________________________________________________________
Int_t
THcAerogel
::
ReadDatabase
(
const
TDatime
&
date
)
{
// This function is called by THaDetectorBase::Init() once at the beginning
// of the analysis.
char
prefix
[
2
];
// Pull values from THcParmList instead
prefix
[
0
]
=
tolower
(
GetApparatus
()
->
GetName
()[
0
]);
prefix
[
1
]
=
'\0'
;
fNelem
=
8
;
// Number of tube pairs // The ENGINE style parameter files don't define
// this. Probably need an additional parameter file
// that contains these fixed parameters.
fPosGain
=
new
Double_t
[
fNelem
];
fNegGain
=
new
Double_t
[
fNelem
];
fPosPedLimit
=
new
Int_t
[
fNelem
];
fNegPedLimit
=
new
Int_t
[
fNelem
];
DBRequest
list
[]
=
{
{
"aero_pos_gain"
,
fPosGain
,
kDouble
},
{
"aero_neg_gain"
,
fPosGain
,
kDouble
},
{
"aero_pos_ped_limit"
,
fPosPedLimit
,
kInt
},
{
"aero_neg_ped_limit"
,
fNegPedLimit
,
kInt
},
{
0
}
};
gHcParms
->
LoadParmValues
((
DBRequest
*
)
&
list
,
prefix
);
fIsInit
=
true
;
// Create arrays to hold pedestal results
InitializePedestals
();
return
kOK
;
}
//_____________________________________________________________________________
Int_t
THcAerogel
::
DefineVariables
(
EMode
mode
)
{
// Initialize global variables for histogramming and tree
cout
<<
"THcAerogel::DefineVariables called "
<<
GetName
()
<<
endl
;
if
(
mode
==
kDefine
&&
fIsSetup
)
return
kOK
;
fIsSetup
=
(
mode
==
kDefine
);
// Register variables in global list
RVarDef
vars
[]
=
{
{
"postdchits"
,
"List of Positive TDC hits"
,
"fPosTDCHits.THcSignalHit.GetPaddleNumber()"
},
{
"negtdchits"
,
"List of Negative TDC hits"
,
"fNegTDCHits.THcSignalHit.GetPaddleNumber()"
},
{
"posadchits"
,
"List of Positive ADC hits"
,
"fPosADCHits.THcSignalHit.GetPaddleNumber()"
},
{
"negadchits"
,
"List of Negative ADC hits"
,
"fNegADCHits.THcSignalHit.GetPaddleNumber()"
},
{
0
}
};
return
DefineVarsFromList
(
vars
,
mode
);
}
//_____________________________________________________________________________
//_____________________________________________________________________________
inline
inline
void
THcAerogel
::
Clear
(
Option_t
*
opt
)
void
THcAerogel
::
Clear
(
Option_t
*
opt
)
{
{
// Reset per-event data.
// Reset per-event data.
for
(
Int_t
ip
=
0
;
ip
<
fNLayers
;
ip
++
)
{
// fTrackProj->Clear();
fPlanes
[
ip
]
->
Clear
(
opt
);
}
// fTrackProj->Clear();
}
}
//_____________________________________________________________________________
//_____________________________________________________________________________
...
@@ -98,38 +169,21 @@ Int_t THcAerogel::Decode( const THaEvData& evdata )
...
@@ -98,38 +169,21 @@ Int_t THcAerogel::Decode( const THaEvData& evdata )
// Get the Hall C style hitlist (fRawHitList) for this event
// Get the Hall C style hitlist (fRawHitList) for this event
Int_t
nhits
=
THcHitList
::
DecodeToHitList
(
evdata
);
Int_t
nhits
=
THcHitList
::
DecodeToHitList
(
evdata
);
if
(
gHaCuts
->
Result
(
"Pedestal_event"
))
{
if
(
gHaCuts
->
Result
(
"Pedestal_event"
))
{
Int_t
nexthit
=
0
;
for
(
Int_t
ip
=
0
;
ip
<
fNLayers
;
ip
++
)
{
AccumulatePedestals
(
fRawHitList
);
nexthit
=
fPlanes
[
ip
]
->
AccumulatePedestals
(
fRawHitList
,
nexthit
);
//cout << "nexthit = " << nexthit << endl;
}
fAnalyzePedestals
=
1
;
// Analyze pedestals first normal events
fAnalyzePedestals
=
1
;
// Analyze pedestals first normal events
return
(
0
);
return
(
0
);
}
}
if
(
fAnalyzePedestals
)
{
if
(
fAnalyzePedestals
)
{
for
(
Int_t
ip
=
0
;
ip
<
fNLayers
;
ip
++
)
{
fPlanes
[
ip
]
->
CalculatePedestals
();
CalculatePedestals
();
}
fAnalyzePedestals
=
0
;
// Don't analyze pedestals next event
fAnalyzePedestals
=
0
;
// Don't analyze pedestals next event
}
Int_t
nexthit
=
0
;
for
(
Int_t
ip
=
0
;
ip
<
fNLayers
;
ip
++
)
{
nexthit
=
fPlanes
[
ip
]
->
ProcessHits
(
fRawHitList
,
nexthit
);
}
/*
// fRawHitList is TClones array of THcAerogelHit objects
for(Int_t ihit = 0; ihit < fNRawHits ; ihit++) {
THcAerogelHit* hit = (THcAerogelHit *) fRawHitList->At(ihit);
cout << ihit << " : " << hit->fPlane << ":" << hit->fCounter << " : "
<< hit->fADC_pos << " " << hit->fADC_neg << " " << endl;
}
}
cout << endl;
*/
return
nhits
;
return
nhits
;
}
}
...
@@ -155,6 +209,96 @@ Int_t THcAerogel::FineProcess( TClonesArray& tracks )
...
@@ -155,6 +209,96 @@ Int_t THcAerogel::FineProcess( TClonesArray& tracks )
return
0
;
return
0
;
}
}
//_____________________________________________________________________________
void
THcAerogel
::
InitializePedestals
(
)
{
fNPedestalEvents
=
0
;
fMinPeds
=
500
;
// In engine, this is set in parameter file
fPosPedSum
=
new
Int_t
[
fNelem
];
fPosPedSum2
=
new
Int_t
[
fNelem
];
fPosPedLimit
=
new
Int_t
[
fNelem
];
fPosPedCount
=
new
Int_t
[
fNelem
];
fNegPedSum
=
new
Int_t
[
fNelem
];
fNegPedSum2
=
new
Int_t
[
fNelem
];
fNegPedLimit
=
new
Int_t
[
fNelem
];
fNegPedCount
=
new
Int_t
[
fNelem
];
fPosPed
=
new
Double_t
[
fNelem
];
fNegPed
=
new
Double_t
[
fNelem
];
fPosThresh
=
new
Double_t
[
fNelem
];
fNegThresh
=
new
Double_t
[
fNelem
];
for
(
Int_t
i
=
0
;
i
<
fNelem
;
i
++
)
{
fPosPedSum
[
i
]
=
0
;
fPosPedSum2
[
i
]
=
0
;
fPosPedLimit
[
i
]
=
1000
;
// In engine, this are set in parameter file
fPosPedCount
[
i
]
=
0
;
fNegPedSum
[
i
]
=
0
;
fNegPedSum2
[
i
]
=
0
;
fNegPedLimit
[
i
]
=
1000
;
// In engine, this are set in parameter file
fNegPedCount
[
i
]
=
0
;
}
}
//_____________________________________________________________________________
void
THcAerogel
::
AccumulatePedestals
(
TClonesArray
*
rawhits
)
{
// Extract data from the hit list, accumulating into arrays for
// calculating pedestals
Int_t
nrawhits
=
rawhits
->
GetLast
()
+
1
;
Int_t
ihit
=
0
;
while
(
ihit
<
nrawhits
)
{
THcAerogelHit
*
hit
=
(
THcAerogelHit
*
)
rawhits
->
At
(
ihit
);
Int_t
element
=
hit
->
fCounter
-
1
;
Int_t
adcpos
=
hit
->
fADC_pos
;
Int_t
adcneg
=
hit
->
fADC_pos
;
if
(
adcpos
<=
fPosPedLimit
[
element
])
{
fPosPedSum
[
element
]
+=
adcpos
;
fPosPedSum2
[
element
]
+=
adcpos
*
adcpos
;
fPosPedCount
[
element
]
++
;
if
(
fPosPedCount
[
element
]
==
fMinPeds
/
5
)
{
fPosPedLimit
[
element
]
=
100
+
fPosPedSum
[
element
]
/
fPosPedCount
[
element
];
}
}
if
(
adcneg
<=
fNegPedLimit
[
element
])
{
fNegPedSum
[
element
]
+=
adcneg
;
fNegPedSum2
[
element
]
+=
adcneg
*
adcneg
;
fNegPedCount
[
element
]
++
;
if
(
fNegPedCount
[
element
]
==
fMinPeds
/
5
)
{
fNegPedLimit
[
element
]
=
100
+
fNegPedSum
[
element
]
/
fNegPedCount
[
element
];
}
}
ihit
++
;
}
fNPedestalEvents
++
;
return
;
}
//_____________________________________________________________________________
void
THcAerogel
::
CalculatePedestals
(
)
{
// Use the accumulated pedestal data to calculate pedestals
// Later add check to see if pedestals have drifted ("Danger Will Robinson!")
// cout << "Plane: " << fPlaneNum << endl;
for
(
Int_t
i
=
0
;
i
<
fNelem
;
i
++
)
{
// Positive tubes
fPosPed
[
i
]
=
((
Double_t
)
fPosPedSum
[
i
])
/
TMath
::
Max
(
1
,
fPosPedCount
[
i
]);
fPosThresh
[
i
]
=
fPosPed
[
i
]
+
15
;
// Negative tubes
fNegPed
[
i
]
=
((
Double_t
)
fNegPedSum
[
i
])
/
TMath
::
Max
(
1
,
fNegPedCount
[
i
]);
fNegThresh
[
i
]
=
fNegPed
[
i
]
+
15
;
// cout << i+1 << " " << fPosPed[i] << " " << fNegPed[i] << endl;
}
// cout << " " << endl;
}
ClassImp
(
THcAerogel
)
ClassImp
(
THcAerogel
)
...
...
This diff is collapsed.
Click to expand it.
src/THcAerogel.h
+
41
−
8
View file @
0e4285e0
#ifndef ROOT_THc
Hodoscope
#ifndef ROOT_THc
Aerogel
#define ROOT_THc
Hodoscope
#define ROOT_THc
Aerogel
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// //
// //
// THc
Hodoscope
//
// THc
Aerogel
//
// //
// //
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
...
@@ -12,24 +12,57 @@
...
@@ -12,24 +12,57 @@
#include
"THcHitList.h"
#include
"THcHitList.h"
#include
"THcAerogelHit.h"
#include
"THcAerogelHit.h"
class
THc
Hodoscope
:
public
THaNonTrackingDetector
,
public
THcHitList
{
class
THc
Aerogel
:
public
THaNonTrackingDetector
,
public
THcHitList
{
public:
public:
THc
Hodoscope
(
const
char
*
name
,
const
char
*
description
=
""
,
THc
Aerogel
(
const
char
*
name
,
const
char
*
description
=
""
,
THaApparatus
*
a
=
NULL
);
THaApparatus
*
a
=
NULL
);
virtual
~
THc
Hodoscope
()
;
virtual
~
THc
Aerogel
()
{}
;
virtual
void
Clear
(
Option_t
*
opt
=
""
);
virtual
void
Clear
(
Option_t
*
opt
=
""
);
virtual
Int_t
Decode
(
const
THaEvData
&
);
virtual
Int_t
Decode
(
const
THaEvData
&
);
virtual
EStatus
Init
(
const
TDatime
&
run_time
);
virtual
EStatus
Init
(
const
TDatime
&
run_time
);
virtual
Int_t
ReadDatabase
(
const
TDatime
&
date
);
virtual
Int_t
DefineVariables
(
EMode
mode
=
kDefine
);
virtual
Int_t
CoarseProcess
(
TClonesArray
&
tracks
);
virtual
Int_t
CoarseProcess
(
TClonesArray
&
tracks
);
virtual
Int_t
FineProcess
(
TClonesArray
&
tracks
);
virtual
Int_t
FineProcess
(
TClonesArray
&
tracks
);
virtual
void
AccumulatePedestals
(
TClonesArray
*
rawhits
);
virtual
void
CalculatePedestals
();
virtual
Int_t
ApplyCorrections
(
void
);
virtual
Int_t
ApplyCorrections
(
void
);
THcAerogel
();
// for ROOT I/O
protected
:
protected
:
Int_t
fAnalyzePedestals
;
ClassDef
(
THcHodoscope
,
0
)
// Generic hodoscope class
// Parameters
Double_t
*
fPosGain
;
Double_t
*
fNegGain
;
Int_t
fNPedestalEvents
;
Int_t
fMinPeds
;
Int_t
*
fPosPedSum
;
/* Accumulators for pedestals */
Int_t
*
fPosPedSum2
;
Int_t
*
fPosPedLimit
;
Int_t
*
fPosPedCount
;
Int_t
*
fNegPedSum
;
Int_t
*
fNegPedSum2
;
Int_t
*
fNegPedLimit
;
Int_t
*
fNegPedCount
;
Double_t
*
fPosPed
;
Double_t
*
fPosSig
;
Double_t
*
fPosThresh
;
Double_t
*
fNegPed
;
Double_t
*
fNegSig
;
Double_t
*
fNegThresh
;
void
Setup
(
const
char
*
name
,
const
char
*
description
);
virtual
void
InitializePedestals
(
);
ClassDef
(
THcAerogel
,
0
)
// Generic aerogel class
};
};
#endif
#endif
This diff is collapsed.
Click to expand it.
src/THcAerogelHit.h
+
2
−
2
View file @
0e4285e0
#ifndef ROOT_THcAerogelHit
#ifndef ROOT_THcAerogelHit
#define ROOT_THcAerogelHit
#define ROOT_THcAerogelHit
#include
"THc
Shower
Hit.h"
#include
"THc
Hodoscope
Hit.h"
class
THcAerogelHit
:
public
THc
Shower
Hit
{
class
THcAerogelHit
:
public
THc
Hodoscope
Hit
{
public:
public:
...
...
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