Examples
Basic example
Here we check which hec and emec cells are connected. We then create
and fill a histogram of Cell 27 of the hec. We also demonstrate how to
iterate over an STL multimap.
UserAlg.h
UserAlg.cxx
Producing noise files using NoiseAlg and using RunStatisticsAlg
In this example, the systemAlg NoiseAlg is used to obtain the (digital
filtering) noise of each channel for a given data run. The results
are printed out and stored in files, one for the hec and one for the
emec. A 2D plot of the log10 of the noise is also generated for each
detector layer, showing how to use one of the noise access methods.
The systemAlg RunStatisticsAlg is also used to generate useful run
statistics: notice in UserAlg.cxx how easy it is to use.
UserAlg.h
UserAlg.cxx
Accessing noise files using NoiseAlg
In this example, the systemAlg NoiseAlg is used to compute the
fractional (digital filtering) noise difference between the noise
obtained from two different runs. The corresponding noise files are
assumed to exist. The fractional noise differences are histogrammed
and plotted. A 2D plot of the fractional noise difference is also
generated for the hec and the emec.
You do not need to specify data files to run this.
UserAlg.h
UserAlg.cxx
Producing occupancy files using OccupancyAlg and using RunStatisticsAlg
In this example, the systemAlg OccupancyAlg is used to obtain the
occupancy of each channel for a given data run. The results are
printed out and stored in files, one for the hec and one for the emec.
A 2D plot of the occupancy is also generated for the hec and the emec,
and well as their occupancy distribution.
UserAlg.h
UserAlg.cxx
Accessing occupancy files using OccupancyAlg and using RunStatisticsAlg
In this example the systemAlg OccupancyAlg is used to read occupancy
files (which are assumed to exist). TBRootAna can be run with no data files at all
for this example. A febno keyed
map is then made of the channels with occupancy greater than a value
(occCut = 0.1) and the corresponding 2D plots are drawn. All this is
done in initialize().
UserAlg.h
UserAlg.cxx
Using ClusteringAlg and CanvasManagerAlg
In this example the systemAlg ClusteringAlg and CanvasManagerAlg are used.
An event is chosen for display, before and after clustering.
Energy in clusters are summed and the total energy is histogrammed.
The UserAlg.cxx is set for 2d clustering, with the seed cell list in decreasing order of E/sigma for the first iteration only.
UserAlg.h
UserAlg.cxx
You can find the histograms produced in the example in the following files:
2d clustering (ps)
3d clustering (ps)
The clustering algorithm goes as follows (see ClusteringAlg.h):
Steps 1 to 3 are done in one loop over all cells
1) if cell above seed threshold (E > 4 sigma);
put in list C (cell above seed threshold list)
and associate it to a cluster
2) else if cell above neighbor threshold (|E| > 3 sigma);
put in list B (cell above neighbor threshold list)
3) else if cell above cell threshold (|E| > 2 sigma);
put in list A (cell above cell threshold list)
At this point, lists A, B and C are mutually exclusive
4) create an empty list D (seed cell list);
create list F (next seed cell list) and set it to list C
sort list F in decreasing order of E/sigma
While there are cells in list F:
5) swap lists D and F, then clear list F;
optionally sort list D in decreasing order of E/sigma
6) loop over the seed cells in list D;
these cells are each associated to a cluster
7) look up the seed cell neighbors;
loop over the seed cell neighbors
8) if neighbor in list A;
if neighbor not associated to a cluster then add to cluster
9) else if neighbor in list B
if neighbor not associated to a cluster
then add to cluster and add to list F
else if neighbor associated to a different cluster
then merge clusters
10) else if neighbor in list C;
if neighbor associated to a different cluster then merge clusters
If there are cells in list F, then go back to step 5)
Click here for a graphical example of clusters.