/////////////////////////////////////////////////////////////////////////////
//
// EEezTower
//
// Author: Jason C. Webb <jwebb@iucf.indiana.edu>
//
// The EEezTower class is the main access point for getting
// information about EEMC detector response. It provides member
// functions for accessing the tower energy response, and the
// energy response of the pre- and postshower layers. It also
// provides methods which return pointers to neighboring towers,
// and the SMD strips which are contained within the fiducial
// volume of the tower.
//
/////////////////////////////////////////////////////////////////////////////
#include "EEezTower.h"
#include <iostream>
#include <TString.h>
/////////////////////////////////////////////////////////////////////////////
ClassImp(EEezTower);
EEezTower::EEezTower()
{
// Constructor of the EEezTower class.
mUMin = 999;
mUMax = -999;
mVMin = 999;
mVMax = -999;
}
/////////////////////////////////////////////////////////////////////////////
void EEezTower::clear()
{
//
// Clears the list of neighboring seed towers and zeros out
// the energy and ADC values of the tower.
//
////////////////////////////////////////////
// Clear out list of neighboring seeds
m_NeighborSeeds.clear();
// Clear out energies
for ( Int_t i = 0; i < 4; i++ ) {
m_Adc[i] = 0.;
m_RawAdc[i] = 0.;
m_Energy[i] = 0.;
}
////////////////////////////////////////////
}
/////////////////////////////////////////////////////////////////////////////
void EEezTower::setSeed()
{
//
// Sets this tower as a seed tower by adding this tower
// to the list of neighboring seed towers of all of its
// neighbors.
//
////////////////////////////////////////////
// Flags this tower as a seed tower.
// Each tower keeps a list of its neighbors,
// and a list of which of those neighbors
// happen to be a seed tower.
// Loop over all neighbors, and and this
// tower to the neighbor's list of
// adjacent seed towers.
EEezTowerPtrVecIter_t iter = m_Neighbors.begin();
while ( iter != m_Neighbors.end() ) {
// Add this tower to each neighboring
// towers list of adjacent seed towers
(*iter) -> addNeighborSeed( this );
iter++;
}
////////////////////////////////////////////
}
/////////////////////////////////////////////////////////////////////////////
void EEezTower::printNeighbors()
{
//
// Print method for verifying that the pointers to neighboring
// towers are properly initialized.
//
EEezTowerPtrVecIter_t iter = m_Neighbors.begin();
Int_t in=0;
std::cout << "-------------------------------------------------------"
<< std::endl;
std::cout << "tower "
<< " sec= " << ( m_Index / 12 ) / 5
<< " sub= " << ( m_Index / 12 ) % 5
<< " eta= " << ( m_Index % 12 )
<< std::endl;
while ( iter != m_Neighbors.end() ) {
Int_t n_Index = (*iter) -> getIndex();
std::cout << " neighbor " << in++
<< " sec= " << ( n_Index / 12 ) / 5
<< " sub= " << ( n_Index / 12 ) % 5
<< " eta= " << ( n_Index % 12 )
<< std::endl;
iter++;
}
}
/////////////////////////////////////////////////////////////////////////////
Float_t EEezTower::getSumNeighbors( Int_t split )
{
// Loop over all neighboring towers and sum their energies.
//
// The variable split is used to indicated whether or not
// the energy of a neighboring tower should be divided
// between adjacent seed towers, and which mode to use
// in dividing.
//
// split = 0 indicates no division of energy, used when SMD data available
// split = 1 indicates equal division of energy
// split = 2 indicates energy-weighted division of energy (not implemented)
//
// This code was used in early versions of the pi0 finder, but will
// probably be discontinued in the near future.
//
// Iterate over neighbors
EEezTowerPtrVecIter_t iter = m_Neighbors.begin();
Float_t eSum = 0.;
Float_t eSumW = 0.;
if ( split == 0 ) {
while ( iter != m_Neighbors.end() ) {
eSum += (*iter)->getEnergy();
iter++;
}
return eSum;
}
else if ( split == 1 ) {
Float_t weight = 0.;
while ( iter != m_Neighbors.end() ) {
Float_t weight = getEnergy(0) / (*iter)->getSumNeighborSeeds();
eSum += (*iter)->getEnergy(0) * weight;
eSumW += weight;
}
return ( weight>0 ) ? eSum / weight : 0.;
}
assert(0);
return -1.0;
}
Float_t EEezTower::getSumNeighborSeeds()
{
//
// Sums the energies of neighboring seed towers
Float_t eSum = 0.;
EEezTowerPtrVecIter_t iter = m_NeighborSeeds. begin();
while ( iter != m_NeighborSeeds. end() ) {
eSum += (*iter)->getEnergy();
iter++;
}
return eSum;
}
/////////////////////////////////////////////////////////////////////////////
void EEezTower::removeFrom( EEezTowerPtrVec_t *towers )
{
//
// Removes this tower from a specified list (vector) of towers
//
// Iterate over towers until we find one which matches
// this tower. Then remove it.
EEezTowerPtrVecIter_t iter = towers -> begin();
while ( iter != towers -> end() ) {
if ( (*iter)->getIndex() == m_Index ) {
iter = towers -> erase(iter);
return;
}
iter++;
}
return;
}
/////////////////////////////////////////////////////////////////////////////
void EEezTower::print()
{
// Print out the tower's ADC and energy response, and it's neighbor's
std::cout << "Tower " << m_Index << " ";
printLine();
std::cout << " neighbors: ";
EEezTowerPtrVecIter_t iter = m_Neighbors.begin();
while ( iter != m_Neighbors.end() ) {
(*iter)->printLine();
iter++;
}
std::cout << std::endl;
}
void EEezTower::printLine()
{
// Single line printout of tower name, adc and energy
std::cout << getName() << " "
<< getAdc(0) << " "
<< getEnergy(0) << " ";
}
const Char_t *EEezTower::getName()
{
//
// Returns the name of the tower. Would be better to make
// this class a descendant of TNamed
//
return m_Name.Data();
}
void EEezTower::setIndex ( Int_t index ) {
m_Index = index;
Int_t sec = ( m_Index / 12 ) / 5 + 1;
Int_t sub = ( m_Index / 12 ) % 5 + (Int_t)'A';
Int_t eta = ( m_Index % 12 ) + 1;
m_Name = "";
if ( sec < 10 ) m_Name += "0";
m_Name += sec;
m_Name += "T";
m_Name += (Char_t)sub;
if ( eta < 10 ) m_Name += "0";
m_Name += eta;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//
// SMD strip accessor methods
//
void EEezTower::addUStrip ( EEezStrip *strip )
{
// Permanently associate the specified strip with this tower.
// Any request for information about the SMD strips associated
// with this tower will include the response of the given strip.
Int_t index = strip -> getIndex();
if ( index < mUMin ) mUMin = index;
if ( index > mUMax ) mUMax = index;
m_UStrips.push_back(strip);
}
void EEezTower::addVStrip ( EEezStrip *strip )
{
// Permanently associate the specified strip with this tower.
// Any request for information about the SMD strips associated
// with this tower will include the response of the given strip.
Int_t index = strip -> getIndex();
if ( index < mVMin ) mVMin = index;
if ( index > mVMax ) mVMax = index;
m_VStrips.push_back(strip);
}
EEezStripPtrVec_t *EEezTower::getUStrips()
{
// Return a pointer to the vector of SMD-U strips which fall
// within the fiducial volume of this tower.
return &m_UStrips;
}
EEezStripPtrVec_t *EEezTower::getVStrips()
{
// Return a pointer to the vector of SMD-V strips which fall
// within the fiducial volume of this tower.
return &m_VStrips;
}
Int_t EEezTower::getNUStrips()
{ // Return the number of SMD-U strips which fall within the
// fiducial volume of this tower.
return (Int_t)m_UStrips.size();
}
Int_t EEezTower::getNVStrips()
{
// Return the number of SMD-V strips which fall within the
// fiducial volume of this tower.
return (Int_t)m_VStrips.size();
}
EEezStrip *EEezTower::getUStrip( Int_t i )
{
// Return a pointer to the ith SMD-U strip within the fiducial
// volume of this tower. 0 <= i < getNUStrips().
assert( i < getNUStrips() );
return m_UStrips[i];
}
EEezStrip *EEezTower::getVStrip( Int_t i )
{
// Return a pointer to the ith SMD-V strip within the fiducial
// volume of this tower. 0 <= i < getNVStrips().
assert( i < getNVStrips() );
return m_VStrips[i];
}
Float_t EEezTower::getSumMipU()
{
// Returns the total number of MIPs detected in the SMD-U plane
Float_t sum = 0.;
EEezStripPtrVecIter_t iter = getUStrips()->begin();
while ( iter != getUStrips()->end() ) {
sum += (*iter)->getNumMips();
iter++;
}
return sum;
}
Float_t EEezTower::getSumMipV()
{
// Returns the total number of MIPs detected in the SMD-V plane
Float_t sum = 0.;
EEezStripPtrVecIter_t iter = getVStrips()->begin();
while ( iter != getVStrips()->end() ) {
sum += (*iter)->getNumMips();
iter++;
}
return sum;
}
Float_t EEezTower::getMeanU()
{
// Returns the energy-weighted mean U position for the SMD response
// beneath the tower. Note that the accuracy of this method is
// compromised by high-multiplicity events.
Float_t sumw = 0.;
Float_t sum = 0.;
EEezStripPtrVecIter_t iter = getUStrips()->begin();
while ( iter != getUStrips()->end() ) {
sum += (*iter)->getNumMips() * (*iter)->getIndex();
sumw += (*iter)->getNumMips();
iter++;
}
if ( sumw > 0. )
return sum / sumw;
return -1.0;
}
Float_t EEezTower::getMeanV()
{
// Returns the energy-weighted mean V position for the SMD response
// beneath the tower. Note that the accuracy of this method is
// compromised by high-multiplicity events.
Float_t sumw = 0.;
Float_t sum = 0.;
EEezStripPtrVecIter_t iter = getVStrips()->begin();
while ( iter != getVStrips()->end() ) {
sum += (*iter)->getNumMips() * (*iter)->getIndex();
sumw += (*iter)->getNumMips();
iter++;
}
if ( sumw > 0. )
return sum / sumw;
return -1.0;
}
Float_t EEezTower::getMomentU( Int_t n )
{
// Returns the Nth moment of the SMD distribution beneath the
// tower. EEezTower::getMomentU(0) will return the equivalent
// number of MIPs in the SMD.
Float_t sum = 0.;
EEezStripPtrVecIter_t iter = getUStrips()->begin();
while ( iter != getUStrips()->end() ) {
sum += TMath::Power( (*iter)->getNumMips(), (Float_t)n ) * (*iter)->getIndex();
iter++;
}
return sum;
}
Float_t EEezTower::getMomentV( Int_t n )
{
// Returns the Nth moment of the SMD distribution beneath the
// tower. EEezTower::getMomentV(0) will return the equivalent
// number of MIPs in the SMD.
Float_t sum = 0.;
EEezStripPtrVecIter_t iter = getVStrips()->begin();
while ( iter != getVStrips()->end() ) {
sum += TMath::Power( (*iter)->getNumMips(), (Float_t)n ) * (*iter)->getIndex();
iter++;
}
return sum;
}
Int_t EEezTower::getNUHitStrips()
{
// Returns the number of hit U strips beneath the tower.
Int_t sum = 0;
EEezStripPtrVecIter_t iter = getUStrips()->begin();
while ( iter != getUStrips()->end() ) {
if ( (*iter)->getNumMips() > 0. ) sum++;
iter++;
}
return sum;
}
Int_t EEezTower::getNVHitStrips()
{
// Returns the number of hit V strips beneath the tower.
Int_t sum = 0;
EEezStripPtrVecIter_t iter = getVStrips()->begin();
while ( iter != getVStrips()->end() ) {
if ( (*iter)->getNumMips() > 0. ) sum++;
iter++;
}
return sum;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
Float_t EEezTower::getAdc( Int_t det )
{
// Returns ADC-ped for the selected detector. 0=T, 1=P, 2=Q, 3=R.
return m_Adc[det];
}
Float_t EEezTower::getRawAdc( Int_t det )
{
// Returns raw ADC for the selected detector. 0=T, 1=P, 2=Q, 3=R.
return m_RawAdc[det];
}
Float_t EEezTower::getEnergy( Int_t det )
{
// Returns calibrated energy response, (ADC-ped)/gain, for the
// selected detector. 0=T, 1=P, 2=Q, 3=R.
return m_Energy[det];
}
EEezTowerPtrVec_t EEezTower::getNeighbors()
{
// Returns an EEezTowerPtrVec_t (std::vector) containing pointers to
// neighboring towers (other EEezTower objects).
return m_Neighbors;
}
EEezTowerPtrVec_t EEezTower::getNeighborSeeds()
{
// Returns an EEezTowerPtrVec_t (std::vector) containing pointers to
// neighboring towers (other EEezTower objects) which exceed the
// seed threshold.
return m_NeighborSeeds;
}
Int_t EEezTower::getNNeighborSeeds()
{
// Returns the number of neighboring towers which exceed the seed
// threshold.
return (Int_t)m_NeighborSeeds.size();
}
Int_t EEezTower::getNNeighbors()
{
// Returns the number of neighboring towers (hit or not).
return m_Neighbors.size();
}
EEezTower *EEezTower::getNeighbor(Int_t n)
{
// Returns a pointer to the nth neighboring tower.
return m_Neighbors[n];
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
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.