/////////////////////////////////////////////////////////////////////////////
//
// EEezClAnalysis
//
// Author: Jason C. Webb <jwebb@iucf.indiana.edu>
//
// EEMC cluster finder. This cluster finder takes as input an instance
// of EEezAnalysis, but would be just as hapy with a vector of EEezTower s.
// Thus, this cluster finder could be easily generalized to other
// geometries, since few assumptions about the geometry of the endcap
// have been made here. All of the geometric relationships between
// detectors are encoded in the EEezTower class.
//
/////////////////////////////////////////////////////////////////////////////
#include "EEezClAnalysis.h"
#include "EEezAnalysis.h"
#include "TH1F.h"
#include "TH2F.h"
#include <iostream>
#define DEBUG 0
ClassImp(EEezClAnalysis);
/////////////////////////////////////////////////////////////////////////////
EEezClAnalysis::EEezClAnalysis()
{
//
// Class constructor. Initializes cuts.
//
setEnergyCut(0.); // Default
setShapeLimit(0.7); // Requires 70% of cluster energy to be in seed tower
}
/////////////////////////////////////////////////////////////////////////////
void EEezClAnalysis::Clear( Option_t *opts )
{
//
// Clear our array of clusters for the next event
//
for ( Int_t i = 0; i < 12; i++ ) m_NumClusters[i] = 0;
m_Clusters.clear();
}
/////////////////////////////////////////////////////////////////////////////
Int_t EEezClAnalysis::Make( EEezAnalysis *analysis )
{
//
// Takes as input an instance of the EEezAnalysis class,
// and produces clusters from the seed towers found in
// the analysis class.
//
// Get _copies_ of seed towers and hit towers
m_SeedTowers = *analysis -> getSeedTowers();
m_HitTowers = *analysis -> getHitTowers();
// Make a single cluster based around the most
// energetic seed tower left in our list... the
// seed tower and all neighboring seed towers
// are removed from the list as we process the
// cluster.
Int_t nclust = 0;
// std::cout << " Building clusters..." << std::endl;
while ( m_SeedTowers.size() > 0 ) {
nclust += MakeCluster();
}
// std::cout << "Found nclust = " << nclust << std::endl;
return 1;
}
/////////////////////////////////////////////////////////////////////////////
Int_t EEezClAnalysis::MakeCluster()
{
// Search the list of clusters for the most energetic cluster. Once
// we have found it, perform clustering. Essentially, just call
// the EEezCluster::buildCluster() method with the seed we just
// found. Then remove the seed tower and any of its neighboring
// towers which happen to be seed towers from our list of seed
// towers.
///////////////////////////////////////////////////////
// Loop over all entries in the list of seed towers
// to find the most energetic seed.
EEezTowerPtrVecIter_t maxSeedIter = m_SeedTowers.begin();
Float_t eSeed = -999.;
Int_t nmax = 0;
for ( UInt_t i = 0; i < m_SeedTowers.size(); i++ ) {
if ( m_SeedTowers.at(i) -> getEnergy() > eSeed ) {
eSeed = m_SeedTowers.at(i)->getEnergy();
nmax = i;
}
}
// If no seeds are found, return 0 (nothing left to do)
if ( eSeed < 0 ) return 0;
// Increment to the new position
maxSeedIter += nmax;
// Pointer to the seed tower
EEezTower *seed = (*maxSeedIter);
#if DEBUG
// Print out the seed tower and it's neighbors
std::cout << "SEED: ";
seed->print();
#endif
///////////////////////////////////////////////////////
// Remove the seed tower from the list of seed towers
maxSeedIter = m_SeedTowers.erase(maxSeedIter);
// Get list of neighboring seeds towers to the max
// energy seed tower
EEezTowerPtrVec_t neighbors = seed -> getNeighborSeeds();
EEezTowerPtrVecIter_t iter = neighbors.begin();
// Iterate over it, removing any occurence of a
// neighboring seed from the list of seeds available
// to form a cluster.
while ( iter != neighbors.end() ) {
(*iter)->removeFrom( &m_SeedTowers );
iter++;
}
// What is done above is now implemented within the
// cluster storage class itself... except for the removal
// of seed towers when they are adjacent to a more-
// energetic seed. Here we create a new cluster on the heap.
// We must remember to delete this when we are done with it,...
// see Clear().
EEezCluster cluster;
cluster.setEnergyCut(m_EnergyCut);
#if DEBUG
std::cout << "Building cluster via buildCluster(seec)" << std::endl;
#endif
// Build the cluster around the specified seed tower
cluster.buildCluster( seed );
// Verify that the cluster satisfies the "shape limit"
eSeed = cluster.getSeedTower() -> getEnergy(0);
Float_t eCluster = cluster.getEnergy();
assert( eCluster > 0. ); // otherwise,... Houston, we have a problem
// Check if the cluster satisfies the shape-limit. If
// not, signify by returning "0".
if ( eSeed / eCluster < m_ShapeLimit ) {
return 0;
}
// Cluster has satisfied all of our cuts and we're ready
// to add it to our list of clusters.
m_Clusters.push_back( cluster );
m_NumClusters [ cluster.getSector() ]++;
return 1;
}
/////////////////////////////////////////////////////////////////////////////
Int_t EEezClAnalysis::Init()
{
//
// Code initialization
//
// Initialize # of clusters in each sector to 0
for ( Int_t i = 0; i < 12; i++ ) m_NumClusters[i] = 0;
return 1;
}
/////////////////////////////////////////////////////////////////////////////
void EEezClAnalysis::Save ( EEezClAnalysis *clusters, // Cluster analysis to save
EEezAnalysis *target // Analysis to mirror in clusters
)
{
// Save() currently does nothing, and will likely be removed.
}
ROOT page - Class index - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.