TVAnalysedPulseGenerator Class Reference
[rootana]

The intended ancestor of all TAnalysedPulse generators, used to create TAPs from TPIs. More...

#include <TVAnalysedPulseGenerator.h>

Inheritance diagram for TVAnalysedPulseGenerator:
CFTimeAPGenerator CFTimeMBAmpAPGenerator FirstCompleteAPGenerator GaussFitAPGenerator IntegralRatioAPGenerator LETimeAPGenerator MaxBinAPGenerator SimpIntAPGenerator TemplateConvolveAPGenerator TemplateFitAPGenerator

List of all members.

Public Member Functions

 TVAnalysedPulseGenerator (const char *name, TAPGeneratorOptions *opts)
virtual ~TVAnalysedPulseGenerator ()
virtual int ProcessPulses (const PulseIslandList &pil, AnalysedPulseList &apl)=0
 This method is called on each vector of pulses from a MIDAS event.
virtual bool MayDivideTPIs ()=0
void SetPulseList (PulseIslandList *list)
template<typename TypeOfTAP >
TypeOfTAP * MakeNewTAP (int parent_index) const
 The suggested method for constructing a new TAP.
TAnalysedPulseMakeNewTAP (int parent_index) const
bool Debug () const
IDs::channel GetChannel () const
std::string GetBank () const
const IDs::sourceGetSource () const
 Get the source id for this generator being used on the current channel.
virtual void CalibratePulses (AnalysedPulseList &theAnalysedPulses) const

Static Public Member Functions

static const char * TapType ()

Protected Member Functions

virtual void SetChannel (const std::string &det)
 Set the channel for this generator. Should NOT be called by user code.

Private Attributes

IDs::source fSource
 The source identifying the generator and detector being processed.
std::string fBankName
 The bankname in the MIDAS file used by this channel.
bool fDebug
 Debug flagged set from modules file. Used, for example, in deciding whether or not to print helpful messages.
PulseIslandListfPulseList
 The vector of TPIs being processed.
bool fCanCalibrate
 Flag if we have calibration constants for this generator.
double fAdcToEnergyGain
 Cache the calibration constants so we don't need to look up in the setup navigator each time.
double fAdcToEnergyOffset

Friends

class MakeAnalysedPulses

Detailed Description

The intended ancestor of all TAnalysedPulse generators, used to create TAPs from TPIs.

Author:
Ben Krikler

All TAP generators should be derived from this, and have their ProcessPulses and MayDivideTPIs methods defined.

Definition at line 28 of file TVAnalysedPulseGenerator.h.


Constructor & Destructor Documentation

TVAnalysedPulseGenerator::TVAnalysedPulseGenerator ( const char *  name,
TAPGeneratorOptions opts 
)

Definition at line 5 of file TVAnalysedPulseGenerator.cpp.

References TAPGeneratorOptions::Debug(), fAdcToEnergyGain, fAdcToEnergyOffset, fCanCalibrate, fDebug, fSource, IDs::source::Generator(), SetupNavigator::GetAdcToEnergyConstant(), SetupNavigator::GetAdcToEnergyGain(), GetChannel(), TAPGeneratorOptions::GetChannel(), modules::options::HasOption(), SetupNavigator::Instance(), SetChannel(), and modules::options::StringDescription().

00005                                                                                              :
00006    fAdcToEnergyGain(1), fAdcToEnergyOffset(0){
00007    if(opts){
00008        fDebug=( opts->HasOption("debug") || opts->Debug());
00009    }
00010    fSource.Generator()=IDs::generator(name,opts->StringDescription());
00011    SetChannel(opts->GetChannel());
00012    try{
00013       fAdcToEnergyGain  = SetupNavigator::Instance()->GetAdcToEnergyGain(    GetChannel());
00014       fAdcToEnergyOffset= SetupNavigator::Instance()->GetAdcToEnergyConstant(GetChannel());
00015       fCanCalibrate=true;
00016    } catch(Except::InvalidDetector& e){
00017       std::cout<<"TVAnalysedPulseGenerator: WARNING: No calibration data an be found for the '"<<GetChannel()<<"' channel."
00018                  "  Will continue, but TAPs will not have an energy value filled."<<std::endl;
00019       fCanCalibrate=false;
00020    }
00021 }

virtual TVAnalysedPulseGenerator::~TVAnalysedPulseGenerator (  )  [inline, virtual]

Definition at line 32 of file TVAnalysedPulseGenerator.h.

00032 {};


Member Function Documentation

void TVAnalysedPulseGenerator::CalibratePulses ( AnalysedPulseList theAnalysedPulses  )  const [virtual]

Definition at line 23 of file TVAnalysedPulseGenerator.cpp.

References fAdcToEnergyGain, fAdcToEnergyOffset, and fCanCalibrate.

00023                                                                                        {
00024    if(fCanCalibrate){
00025       for(AnalysedPulseList::iterator i_tap=theAnalysedPulses.begin(); i_tap != theAnalysedPulses.end(); ++i_tap){
00026          const double amplitude=(*i_tap)->GetAmplitude();
00027          (*i_tap)->SetEnergy(fAdcToEnergyGain * amplitude + fAdcToEnergyOffset);
00028       }
00029    }
00030 }

bool TVAnalysedPulseGenerator::Debug (  )  const [inline]
std::string TVAnalysedPulseGenerator::GetBank (  )  const [inline]

A convenience method for analysis to get the channel ID of the channel being analysed

Definition at line 85 of file TVAnalysedPulseGenerator.h.

References fBankName.

00085 {return fBankName;};

IDs::channel TVAnalysedPulseGenerator::GetChannel (  )  const [inline]
const IDs::source& TVAnalysedPulseGenerator::GetSource (  )  const [inline]

Get the source id for this generator being used on the current channel.

Useful for a generator to know the full source much like in the above GetChannel method, but this could also be useful for checking that this generator is the one that made a given TAP in later analysis by comparing this value to that stored in the TAP itself.

Definition at line 94 of file TVAnalysedPulseGenerator.h.

References fSource.

Referenced by MakeNewTAP(), and IntegralRatioAPGenerator::ProcessPulses().

00094 {return fSource;};

TAnalysedPulse* TVAnalysedPulseGenerator::MakeNewTAP ( int  parent_index  )  const [inline]

Definition at line 73 of file TVAnalysedPulseGenerator.h.

00073                                                          {
00074             return MakeNewTAP<TAnalysedPulse>(parent_index);
00075         }

template<typename TypeOfTAP >
TypeOfTAP * TVAnalysedPulseGenerator::MakeNewTAP ( int  parent_index  )  const [inline]

The suggested method for constructing a new TAP.

In the process of constructing TAP, information that isn't immediately obvious how to get needs to be passed to TAP. This method returns a pointer to a TAP construced for you, and all you need to pass it is the TPulseIslandID.

In the case where a generator wants to add extra information to the standard TAP information, we expect people to derive from TAnalysedPulse. If your generator is one of these, then use the template argument to produce the type of TAP you desire. Note that this forces the constructor of the specialised TAP to be the same as for TAnalysedPulse itself.

For example, for to make a specialied analysed pulse called TSpecialAnalysedPulse (original, huh?) you would do:

 TSpecialAnalysedPulse* tsap=MakeNewTAP<TSpecialAnalysedPulse>(parent_index);
Parameters:
[in] parent_index The TPulseIslandID of the TPI being used to make the new TAP.
Template Parameters:
in] TypeOfTAP The type of specialisation of TAnalysedPulse that you want to create.

Definition at line 137 of file TVAnalysedPulseGenerator.h.

References fPulseList, and GetSource().

Referenced by FirstCompleteAPGenerator::AnalyseOneTpi(), SimpIntAPGenerator::ProcessPulses(), MaxBinAPGenerator::ProcessPulses(), CFTimeMBAmpAPGenerator::ProcessPulses(), and CFTimeAPGenerator::ProcessPulses().

00137                                                                            {
00138     TypeOfTAP* pulse=NULL;
00139     TPulseIsland* parent = fPulseList->at(parent_index);
00140     pulse=new TypeOfTAP(GetSource(),parent_index,parent);
00141     return pulse;
00142 }

virtual bool TVAnalysedPulseGenerator::MayDivideTPIs (  )  [pure virtual]
virtual int TVAnalysedPulseGenerator::ProcessPulses ( const PulseIslandList pil,
AnalysedPulseList apl 
) [pure virtual]

This method is called on each vector of pulses from a MIDAS event.

Parameters:
[in] pil The vector of TPIs to produce TAPs from.
[out] apl The vector of TAPs to append the new TAPs to.

Implemented in CFTimeAPGenerator, CFTimeMBAmpAPGenerator, FirstCompleteAPGenerator, GaussFitAPGenerator, IntegralRatioAPGenerator, LETimeAPGenerator, MaxBinAPGenerator, SimpIntAPGenerator, TemplateConvolveAPGenerator, and TemplateFitAPGenerator.

virtual void TVAnalysedPulseGenerator::SetChannel ( const std::string &  det  )  [inline, protected, virtual]

Set the channel for this generator. Should NOT be called by user code.

Called by MakeAnalysedPulses to tell this generator what channel it is looking at.

Definition at line 108 of file TVAnalysedPulseGenerator.h.

References IDs::source::Channel(), fBankName, fSource, SetupNavigator::GetBank(), and SetupNavigator::Instance().

Referenced by TVAnalysedPulseGenerator().

00108                                                      {
00109            fSource.Channel()=det;
00110            fBankName= SetupNavigator::Instance()->GetBank(det);
00111          };

void TVAnalysedPulseGenerator::SetPulseList ( PulseIslandList list  )  [inline]

Definition at line 44 of file TVAnalysedPulseGenerator.h.

References fPulseList.

00044 {fPulseList=list;};

static const char* TVAnalysedPulseGenerator::TapType (  )  [inline, static]

Reimplemented in GaussFitAPGenerator, IntegralRatioAPGenerator, TemplateConvolveAPGenerator, and TemplateFitAPGenerator.

Definition at line 96 of file TVAnalysedPulseGenerator.h.

00096 {return TAnalysedPulse::Class()->GetName();}


Friends And Related Function Documentation

friend class MakeAnalysedPulses [friend]

Definition at line 101 of file TVAnalysedPulseGenerator.h.


Member Data Documentation

Cache the calibration constants so we don't need to look up in the setup navigator each time.

Definition at line 133 of file TVAnalysedPulseGenerator.h.

Referenced by CalibratePulses(), and TVAnalysedPulseGenerator().

Definition at line 133 of file TVAnalysedPulseGenerator.h.

Referenced by CalibratePulses(), and TVAnalysedPulseGenerator().

std::string TVAnalysedPulseGenerator::fBankName [private]

The bankname in the MIDAS file used by this channel.

Definition at line 121 of file TVAnalysedPulseGenerator.h.

Referenced by GetBank(), and SetChannel().

Flag if we have calibration constants for this generator.

Definition at line 131 of file TVAnalysedPulseGenerator.h.

Referenced by CalibratePulses(), and TVAnalysedPulseGenerator().

Debug flagged set from modules file. Used, for example, in deciding whether or not to print helpful messages.

Definition at line 125 of file TVAnalysedPulseGenerator.h.

Referenced by Debug(), and TVAnalysedPulseGenerator().

The vector of TPIs being processed.

Definition at line 128 of file TVAnalysedPulseGenerator.h.

Referenced by MakeNewTAP(), and SetPulseList().

The source identifying the generator and detector being processed.

Definition at line 111 of file TVAnalysedPulseGenerator.h.

Referenced by GetChannel(), GetSource(), SetChannel(), and TVAnalysedPulseGenerator().


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

Generated on 15 Jun 2016 for AlcapDAQ by  doxygen 1.6.1