Anp::FillSnarl Class Reference

#include <FillSnarl.h>

Inheritance diagram for Anp::FillSnarl:
Anp::AlgSnarl Anp::Base

List of all members.

Public Member Functions

 FillSnarl ()
virtual ~FillSnarl ()
bool Run (Record &record)
void Config (const Registry &reg)

Private Attributes

bool fData
int fBase
int fJump
int fStep
int fStop
unsigned int fOver

Detailed Description

Definition at line 18 of file FillSnarl.h.


Constructor & Destructor Documentation

Anp::FillSnarl::FillSnarl (  ) 

Definition at line 18 of file FillSnarl.cxx.

00019    :fData(true),
00020     fBase(1000),
00021     fJump(80),
00022     fStep(40),
00023     fStop(400),
00024     fOver(8)
00025 {
00026 }

Anp::FillSnarl::~FillSnarl (  )  [virtual]

Definition at line 29 of file FillSnarl.cxx.

00030 {
00031 }


Member Function Documentation

void Anp::FillSnarl::Config ( const Registry reg  )  [virtual]

Reimplemented from Anp::AlgSnarl.

Definition at line 143 of file FillSnarl.cxx.

References fBase, fData, fJump, fOver, fStep, fStop, Registry::Get(), Registry::KeyExists(), and Anp::Read().

00144 {
00145    //
00146    // Configure self
00147    //
00148 
00149    //
00150    // Fill snarl strip data
00151    //
00152    Anp::Read(reg, "FillSnarlData", fData);
00153 
00154    //
00155    // Snarl strip data base key
00156    //
00157    reg.Get("FillSnarlBase", fBase);
00158    reg.Get("FillSnarlJump", fJump);
00159    reg.Get("FillSnarlStep", fStep);
00160    reg.Get("FillSnarlStop", fStop);
00161 
00162    int value_int = 0;
00163    if(reg.Get("FillSnarlOver", value_int) && value_int > 0)
00164    {
00165       fOver = static_cast<unsigned int>(value_int);
00166    }
00167 
00168    assert(fJump >= 0 && fStep > 0 && fStop >= 0 && "wrong input parameters");
00169 
00170    if(reg.KeyExists("PrintConfig"))
00171    {
00172       cout << "FillSnarl::Config" << endl
00173            << "   Data = " << fData << endl
00174            << "   Base = " << fBase << endl
00175            << "   Jump = " << fJump << endl
00176            << "   Step = " << fStep << endl
00177            << "   Stop = " << fStop << endl
00178            << "   Over = " << fOver << endl;
00179    }
00180 }

bool Anp::FillSnarl::Run ( Record record  )  [virtual]

Implements Anp::AlgSnarl.

Definition at line 34 of file FillSnarl.cxx.

References Anp::Record::Add(), count, fBase, find(), fJump, fOver, fStep, fStop, Anp::CountAboveBelow::GetMeanAbove(), Anp::CountAboveBelow::GetMeanBelow(), Anp::CountAboveBelow::GetNAbove(), Anp::CountAboveBelow::GetNBelow(), Anp::Record::GetNStrips(), VHS::GetPlane(), Anp::GetStrip(), it, Munits::second, Anp::Record::StripBeg(), and Anp::Record::StripEnd().

00035 {
00036    //
00037    // Count various strips in this snarl and then add counts to record
00038    //
00039      
00040    //
00041    // Count each strip frequency in this snarl
00042    //
00043    vector<CountPlaneStrip> cvec;
00044 
00045    for(StripIter istrip = record.StripBeg(); istrip != record.StripEnd(); ++istrip)
00046    {
00047       //
00048       // Make counting object
00049       //
00050       CountPlaneStrip count(istrip -> GetPlane(), istrip -> GetStrip());
00051       
00052       //
00053       // Count once each plane number and strip number combination
00054       //
00055       if(std::find(cvec.begin(), cvec.end(), count) == cvec.end())
00056       {
00057          cvec.push_back(std::for_each(record.StripBeg(), record.StripEnd(), count));
00058       }
00059    }
00060 
00061    //
00062    // Record frequency count
00063    //
00064 
00065    vector<pair<short,short> > ignorevec;
00066    map<unsigned int, unsigned int> cmap;
00067 
00068    for(vector<CountPlaneStrip>::const_iterator cit = cvec.begin(); cit != cvec.end(); ++cit)
00069    {
00070       //
00071       // fOver is maximum count for overflow
00072       //
00073       const unsigned int count = std::min<unsigned int>(cit -> GetCount(), fOver);
00074 
00075       map<unsigned int, unsigned int>::iterator it = 
00076          cmap.insert(map<unsigned int, unsigned int>::value_type(count, 0)).first;
00077       
00078       ++(it -> second);
00079 
00080       if(cit -> GetCount() >= fOver)
00081       {
00082          ignorevec.push_back(std::pair<short, short>(cit -> GetPlane(), cit -> GetStrip()));
00083       }
00084    }
00085  
00086    for(map<unsigned int, unsigned int>::const_iterator it = cmap.begin(); it != cmap.end(); ++it)
00087    {
00088       record.Add(fBase + it -> first, static_cast<float>(it -> second));
00089    }
00090 
00091    //
00092    // Add total number of strips in this snarl
00093    //
00094    record.Add(fBase, static_cast<float>(record.GetNStrips()));
00095 
00096    //
00097    // Count strips above and below series of sigcor thresholds
00098    //
00099 
00100    for(int istep = fJump; istep <= fStop; istep += fStep)
00101    {
00102       CountAboveBelow count(static_cast<float>(istep), ignorevec);
00103       
00104       count = std::for_each(record.StripBeg(), record.StripEnd(), count);
00105 
00106       record.Add(fBase + istep + 1, static_cast<float>(count.GetNBelow()));
00107       record.Add(fBase + istep + 2, static_cast<float>(count.GetNAbove()));
00108 
00109       record.Add(fBase + istep + 3, static_cast<float>(count.GetMeanBelow()));
00110       record.Add(fBase + istep + 4, static_cast<float>(count.GetMeanAbove()));
00111    }
00112 
00113    
00114    //
00115    // Fill mean pulse height of ignored strips
00116    //
00117    double asum = 0.0, acount = 0.0;
00118    double isum = 0.0, icount = 0.0;
00119    
00120    for(StripIter istrip = record.StripBeg(); istrip != record.StripEnd(); ++istrip)
00121    {
00122       const pair<short, short> plane_strip(istrip -> GetPlane(), istrip -> GetStrip());
00123       
00124       if(std::find(ignorevec.begin(), ignorevec.end(), plane_strip) == ignorevec.end())
00125       {
00126          asum   += istrip -> SigCor();
00127          acount += 1.0;
00128       }
00129       else          
00130       {
00131          isum   += istrip -> SigCor();
00132          icount += 1.0;
00133       }
00134    }
00135    
00136    if(icount > 0.0) record.Add(fBase + fOver + 1, static_cast<float>(isum/icount));
00137    if(acount > 0.0) record.Add(fBase + fOver + 2, static_cast<float>(asum/acount));
00138 
00139    return true;
00140 }


Member Data Documentation

int Anp::FillSnarl::fBase [private]

Definition at line 32 of file FillSnarl.h.

Referenced by Config(), and Run().

bool Anp::FillSnarl::fData [private]

Definition at line 31 of file FillSnarl.h.

Referenced by Config().

int Anp::FillSnarl::fJump [private]

Definition at line 33 of file FillSnarl.h.

Referenced by Config(), and Run().

unsigned int Anp::FillSnarl::fOver [private]

Definition at line 37 of file FillSnarl.h.

Referenced by Config(), and Run().

int Anp::FillSnarl::fStep [private]

Definition at line 34 of file FillSnarl.h.

Referenced by Config(), and Run().

int Anp::FillSnarl::fStop [private]

Definition at line 35 of file FillSnarl.h.

Referenced by Config(), and Run().


The documentation for this class was generated from the following files:

Generated on 3 Oct 2018 for loon by  doxygen 1.6.1