IntegralRatioAPGenerator Class Reference

#include <IntegralRatioAPGenerator.h>

Inheritance diagram for IntegralRatioAPGenerator:
TVAnalysedPulseGenerator

List of all members.

Public Member Functions

 IntegralRatioAPGenerator (TAPGeneratorOptions *opts)
virtual ~IntegralRatioAPGenerator ()
virtual int ProcessPulses (const PulseIslandList &, AnalysedPulseList &)
 This method is called on each vector of pulses from a MIDAS event.
virtual bool MayDivideTPIs ()
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

bool fStartTailAsFraction
double fStartIntegral
double fStopIntegral
double fStartTail
double fPedestal
double fPolarity
Algorithm::IntegralRatio fIntegralRatioAlgo
const Algorithm::MaxBinAmplitude fMaxBinAmplitude

Friends

class MakeAnalysedPulses

Detailed Description

Definition at line 9 of file IntegralRatioAPGenerator.h.


Constructor & Destructor Documentation

IntegralRatioAPGenerator::IntegralRatioAPGenerator ( TAPGeneratorOptions opts  ) 

Definition at line 15 of file IntegralRatioAPGenerator.cpp.

00015                                                                            :
00016     TVAnalysedPulseGenerator("IntegralRatio",opts),
00017         fStartTailAsFraction(opts->GetBool("start_tail_as_fraction",false)),
00018         fStartIntegral(opts->GetInt("start_int","x>=0")),
00019         fStopIntegral(opts->GetInt("stop_int","x>=0")),
00020         fStartTail(opts->GetDouble("start_tail",
00021                                   fStartTailAsFraction?
00022                                   "x<1 && x>0":
00023                                   Form("x>%g",fStartIntegral))),
00024         //fPedestal(GetChannel().isFast()?900:2728),
00025         fPedestal(SetupNavigator::Instance()->GetPedestal(GetChannel())),
00026         //fPolarity(GetChannel().isFast()?1:-1),
00027         fPolarity(TSetupData::Instance()->GetTriggerPolarity(TSetupData::Instance()->GetBankName(GetChannel().str()))),
00028         fIntegralRatioAlgo( fStartIntegral, fStartTail, fStopIntegral,  fPolarity,fPedestal),
00029         fMaxBinAmplitude(fPedestal,fPolarity) 
00030 {
00031 }

IntegralRatioAPGenerator::~IntegralRatioAPGenerator (  )  [virtual]

Definition at line 33 of file IntegralRatioAPGenerator.cpp.

00033 {}


Member Function Documentation

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

Definition at line 23 of file TVAnalysedPulseGenerator.cpp.

References TVAnalysedPulseGenerator::fAdcToEnergyGain, TVAnalysedPulseGenerator::fAdcToEnergyOffset, and TVAnalysedPulseGenerator::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, inherited]
std::string TVAnalysedPulseGenerator::GetBank (  )  const [inline, inherited]

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

Definition at line 85 of file TVAnalysedPulseGenerator.h.

References TVAnalysedPulseGenerator::fBankName.

00085 {return fBankName;};

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

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 TVAnalysedPulseGenerator::fSource.

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

00094 {return fSource;};

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

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, inherited]

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 TVAnalysedPulseGenerator::fPulseList, and TVAnalysedPulseGenerator::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 IntegralRatioAPGenerator::MayDivideTPIs (  )  [inline, virtual]
Todo:
Document this

Implements TVAnalysedPulseGenerator.

Definition at line 22 of file IntegralRatioAPGenerator.h.

00022 {return false;};

int IntegralRatioAPGenerator::ProcessPulses ( const PulseIslandList pil,
AnalysedPulseList apl 
) [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.

Implements TVAnalysedPulseGenerator.

Definition at line 35 of file IntegralRatioAPGenerator.cpp.

References TVAnalysedPulseGenerator::Debug(), fIntegralRatioAlgo, fMaxBinAmplitude, fStartTail, fStartTailAsFraction, Algorithm::MaxBinAmplitude::GetAmplitude(), TVAnalysedPulseGenerator::GetChannel(), Algorithm::IntegralRatio::GetRatio(), TVAnalysedPulseGenerator::GetSource(), Algorithm::IntegralRatio::GetTail(), Algorithm::MaxBinAmplitude::GetTime(), Algorithm::IntegralRatio::GetTotal(), TAnalysedPulse::SetAmplitude(), TAnalysedPulse::SetIntegral(), TIntegralRatioAnalysedPulse::SetIntegralRatio(), TIntegralRatioAnalysedPulse::SetIntegralSmall(), Algorithm::IntegralRatio::SetPedestalToMinimum(), Algorithm::IntegralRatio::SetTailStart(), TAnalysedPulse::SetTime(), IDs::channel::str(), and IDs::source::str().

00037                                         {
00038 
00039     // Loop over all the TPIs given to us
00040     int start_tail;
00041     TIntegralRatioAnalysedPulse* tap;
00042     for (PulseIslandList::const_iterator tpi=pulseList.begin();
00043             tpi!=pulseList.end(); tpi++){
00044 
00045         if(fStartTailAsFraction){
00046            start_tail=fStartTail*(*tpi)->GetPulseLength();
00047            fIntegralRatioAlgo.SetTailStart(start_tail);
00048         }
00049 
00050         // Analyse each TPI
00051         try{
00052             fIntegralRatioAlgo.SetPedestalToMinimum(*tpi);
00053             fIntegralRatioAlgo(*tpi);
00054         }catch(std::out_of_range& e){
00055             continue;
00056         }
00057         fMaxBinAmplitude(*tpi);
00058 
00059         // Now that we've found the information we were looking for make a TAP to
00060         // hold it.  This method makes a TAP and sets the parent TPI info.  It needs
00061         // the index of the parent TPI in the container as an argument
00062         tap = MakeNewTAP<TIntegralRatioAnalysedPulse>(tpi-pulseList.begin());
00063         tap->SetIntegral(fIntegralRatioAlgo.GetTotal());
00064         tap->SetIntegralSmall(fIntegralRatioAlgo.GetTail());
00065         tap->SetIntegralRatio(fIntegralRatioAlgo.GetRatio());
00066         tap->SetAmplitude(fMaxBinAmplitude.GetAmplitude());
00067         tap->SetTime(fMaxBinAmplitude.GetTime());
00068 
00069         // Finally add the new TAP to the output list
00070         analysedList.push_back(tap);
00071     }
00072 
00073     // Generators have a Debug method similar to modules
00074     if(Debug()){
00075         // They also have a unique ID, retrievable by GetSource and
00076         // a GetChannel method to get the ID of just the channel
00077         cout<<"Now running source: "<<GetSource().str()<<" which looks for TAPs on "
00078             "channel: "<<GetChannel().str()<<'\n';
00079     }
00080 
00081     // returning 0 tells the caller that we were successful, return non-zero if not
00082     return 0;
00083 }

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

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(), TVAnalysedPulseGenerator::fBankName, TVAnalysedPulseGenerator::fSource, SetupNavigator::GetBank(), and SetupNavigator::Instance().

Referenced by TVAnalysedPulseGenerator::TVAnalysedPulseGenerator().

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

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

Definition at line 44 of file TVAnalysedPulseGenerator.h.

References TVAnalysedPulseGenerator::fPulseList.

00044 {fPulseList=list;};

const char * IntegralRatioAPGenerator::TapType (  )  [static]

Reimplemented from TVAnalysedPulseGenerator.

Definition at line 85 of file IntegralRatioAPGenerator.cpp.

00085                                               {
00086     return TIntegralRatioAnalysedPulse::Class()->GetName();
00087 }


Friends And Related Function Documentation

friend class MakeAnalysedPulses [friend, inherited]

Definition at line 101 of file TVAnalysedPulseGenerator.h.


Member Data Documentation

Definition at line 30 of file IntegralRatioAPGenerator.h.

Referenced by ProcessPulses().

Definition at line 31 of file IntegralRatioAPGenerator.h.

Referenced by ProcessPulses().

Definition at line 28 of file IntegralRatioAPGenerator.h.

Definition at line 29 of file IntegralRatioAPGenerator.h.

Definition at line 25 of file IntegralRatioAPGenerator.h.

Definition at line 27 of file IntegralRatioAPGenerator.h.

Referenced by ProcessPulses().

Definition at line 22 of file IntegralRatioAPGenerator.h.

Referenced by ProcessPulses().

Definition at line 26 of file IntegralRatioAPGenerator.h.


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

Generated on 15 Jun 2016 for AlcapDAQ by  doxygen 1.6.1