Anp::FillNPlane Class Reference

#include <FillNPlane.h>

Inheritance diagram for Anp::FillNPlane:
Anp::AlgSnarl Anp::AlgEvent Anp::Base Anp::Base

List of all members.

Public Member Functions

 FillNPlane ()
virtual ~FillNPlane ()
bool Run (Record &record)
bool Run (Event &event, const Record &record, const bool pass)
void Config (const Registry &reg)

Private Attributes

int fKeyBase
double fMinStripAdc

Detailed Description

Definition at line 25 of file FillNPlane.h.


Constructor & Destructor Documentation

Anp::FillNPlane::FillNPlane (  ) 

Definition at line 21 of file FillNPlane.cxx.

00022    :fKeyBase(4900),
00023     fMinStripAdc(200.0)
00024 {
00025 }

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

Definition at line 28 of file FillNPlane.cxx.

00029 {
00030 }


Member Function Documentation

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

Reimplemented from Anp::AlgEvent.

Definition at line 145 of file FillNPlane.cxx.

References fKeyBase, fMinStripAdc, Registry::Get(), and Registry::KeyExists().

00146 {
00147    //
00148    // Configure self
00149    //
00150 
00151    reg.Get("FillNPlaneKeyBase",     fKeyBase);
00152    reg.Get("FillNPlaneMinStripAdc", fMinStripAdc);
00153 
00154    if(reg.KeyExists("PrintConfig"))
00155    {
00156       cout << "FillNPlane::Config" << endl
00157            << "   KeyBase = " << fKeyBase << endl
00158            << "   MinStripAdc = " << fMinStripAdc << endl;
00159    }
00160 }

bool Anp::FillNPlane::Run ( Event event,
const Record record,
const bool  pass 
) [virtual]

Implements Anp::AlgEvent.

Definition at line 44 of file FillNPlane.cxx.

References Anp::Event::EventIndex(), find(), fKeyBase, fMinStripAdc, Anp::Record::StripBeg(), and Anp::Record::StripEnd().

00045 { 
00046    //
00047    // Count number of planes above pulse height cut
00048    //
00049    if(!pass) return true;
00050 
00051    //
00052    // First loop: collect maximum strip pulse height in each plane
00053    //
00054    vector<DataNPlane> dvec;
00055 
00056    double dsum = 0.0, asum = 0.0;
00057    for(StripIter istrip = record.StripBeg(); istrip != record.StripEnd(); ++istrip)
00058    {
00059       if(!istrip -> MatchEvt(event.EventIndex()))
00060       {
00061          continue;
00062       }
00063       
00064       asum += istrip -> SigCor();
00065 
00066       if(istrip -> SigCor() > fMinStripAdc)
00067       {
00068          dvec.push_back(Anp::DataNPlane(*istrip));
00069          dsum += istrip -> SigCor();
00070       }
00071    }
00072    
00073    //
00074    // No strips above threshold found
00075    //
00076    if(dvec.empty())
00077    {
00078       event.Add(fKeyBase + 2, static_cast<float>(0.0));
00079       event.Add(fKeyBase + 3, static_cast<float>(0.0));
00080       event.Add(fKeyBase + 4, static_cast<float>(0.0));
00081       event.Add(fKeyBase + 5, static_cast<float>(0.0));
00082       event.Add(fKeyBase + 6, static_cast<float>(0.0));
00083       return true;
00084    }
00085 
00086    //
00087    // Sort data by plane number
00088    //
00089    std::sort(dvec.begin(), dvec.end());
00090 
00091    double min_time = dvec.front().time;
00092    double max_time = dvec.front().time;
00093    vector<short> pvec;
00094 
00095    for(vector<DataNPlane>::const_iterator idata = dvec.begin(); idata != dvec.end(); ++idata)
00096    {
00097       min_time = min<double>(min_time, idata -> time);
00098       max_time = max<double>(max_time, idata -> time);
00099       
00100       if(std::find(pvec.begin(), pvec.end(), idata -> plane) == pvec.end())
00101       {
00102          pvec.push_back(idata -> plane);
00103       }
00104    }
00105    
00106    //
00107    // Sort plane numbers
00108    //
00109    std::sort(pvec.begin(), pvec.end());
00110 
00111    short icount = 1, ncount = 1, nsize = pvec.size();
00112    for(int i = 1; i < nsize; ++i)
00113    {
00114       if(pvec[i-1] + 1 == pvec[i])
00115       {
00116          ++icount;
00117       }
00118       else
00119       {
00120          ncount = std::max<short>(ncount, icount);
00121          icount = 1;
00122       }
00123    }
00124 
00125    //
00126    // Maximum number of contiguous planes
00127    //
00128    ncount = std::max<short>(ncount, icount);
00129    
00130    event.Add(fKeyBase + 1, static_cast<float>(1.0e9*(max_time - min_time)));
00131    event.Add(fKeyBase + 2, static_cast<float>(dvec.size()));
00132    event.Add(fKeyBase + 3, static_cast<float>(dsum));
00133    event.Add(fKeyBase + 4, static_cast<float>(pvec.size()));
00134    event.Add(fKeyBase + 5, static_cast<float>(ncount));
00135 
00136    if(asum > 0.0)
00137    {
00138       event.Add(fKeyBase + 6, static_cast<float>(dsum/asum));
00139    }
00140 
00141    return true;
00142 }

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

Implements Anp::AlgSnarl.

Definition at line 33 of file FillNPlane.cxx.

References Anp::Record::EventBegIterator(), and Anp::Record::EventEndIterator().

00034 {
00035    for(EventIterator ievent = record.EventBegIterator(); ievent != record.EventEndIterator(); ++ievent)
00036    {
00037       FillNPlane::Run(*ievent, record, true);
00038    }
00039 
00040    return true;
00041 }


Member Data Documentation

Definition at line 40 of file FillNPlane.h.

Referenced by Config(), and Run().

Definition at line 41 of file FillNPlane.h.

Referenced by Config(), and Run().


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

Generated on 19 Jan 2018 for loon by  doxygen 1.6.1