/////////////////////////////////////////////////////////////////////////////
//
// EEezSectorStats
//
// Author: Jason C. Webb <jwebb@iucf.indiana.edu>
//
// EEezSectorStats accumulates general statistics about the given sector,
// such as number of hits in pre/post shower detectors, towers, and SMD
// strips.  It inherits from TDirectory, so one could add histograms which
// monitor data quality, or could be used for calibrations (or both).
//
// One could also use this to accumulate statistics on trigger patches or
// other groupings of towers, since it is meant to be filled by an
// external object (such as EEezAnalysis).
//
// This class also keeps track of several event-by-event quantities.
// The numbers of hits for any set of detectors ( tower, pre and postshower
// and SMD planes), and the number of seed towers (towers which respond
// above a specified energy threshold, default of 0.7 GeV.)
//
/////////////////////////////////////////////////////////////////////////////

#include "EEezSectorStats.h"
#include "EEezTower.h"
#include "EEezStrip.h"

#include <iostream>

ClassImp(EEezSectorStats);

/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////

 EEezSectorStats::EEezSectorStats ( const Char_t *name, const Char_t *title ) 
  : TDirectory ( name, title ) 
{
  // Class constructor.  Class descends from TDirectory, takes a name
  // and an (optional) title.  Default title defined in header file.

  m_SeedEnergy = 0.7;

}

/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////

 Int_t EEezSectorStats::Init() 
{
  // Initialization code goes here.  Any histograms which need booking
  // should be done in this routine.

  // Start by changing to this directory
  cd();


  // Change back to previous directory
  cd("..");
  
  return 1;

}

/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////

 void EEezSectorStats::addHit ( EEezTower *tower, Int_t det ) 
{
  // Increment the specified detector element (0=T,1=P,2=Q,3=R) hit,
  // adc, and energy counts.

  m_Adc[det]    += tower -> getAdc(det);
  m_RawAdc[det] += tower -> getRawAdc(det);
  m_Energy[det] += tower -> getEnergy(det);
  // Others not implemented yet
  m_NumHits[det]++;
  if ( det == 0 && 
       tower -> getEnergy(det) > m_SeedEnergy ) m_NumSeed++;

}

 void EEezSectorStats::addHit ( EEezStrip *strip, Int_t uv ) 
{
  // Increment the specified strip/plane hit, adc, energy, etc...
  
  m_Adc[uv+4]    += strip -> getAdc();
  m_RawAdc[uv+4] += strip -> getRawAdc();
  m_Energy[uv+4] += strip -> getEnergy();
  m_Mips[uv+4]   += strip -> getNumMips();
  m_Npe[uv+4]    += strip -> getNumPhotoElectrons();
  m_NumHits[uv+4]++;

}

/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////

 void EEezSectorStats::Clear() 
{
  // Clears out event-by-event statistics
  m_NumSeed = 0;
  for ( Int_t i = 0; i < 6; i++ ) {
    m_NumHits[i] = 0;
    m_Adc[i] = 0;
    m_RawAdc[i] = 0;
    m_Energy[i] = 0;
    m_Mips[i] = 0;
    m_Npe[i] = 0;
  }
  
}

/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
 void EEezSectorStats::print() 
{
  // Prints out the cumulated statistics for this sector/group of towers.
  // Needs work.

  std::cout << "Cumulative statistics for " << GetName() << std::endl;
  
  const Char_t *detector[] = { "Tower", "Pre1", "Pre2", "Post", "SMD-U", "SMD-V" };

  for ( Int_t d = 0; d < 6; d++ ) std::cout << detector[d] << " sum ADC-ped = " << m_Adc[d] << std::endl;

}


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.