The heart of FARFALLA is its extensibility - programmers may define new classes to manage their data, and incorporate nodes of the new class onto FARFALLA trees with nodes of other types. However, many FARFALLA programmers will only use FARFALLA node types created by others and do not need to understand everything in this section.
In C++ , class definitions are kept in header files called classname.h. You will want to create a header file for every class you create. The header file should contain several things.
The file erpNode.h is included here for reference. Each element will be discussed individually in the following sections.
static F_NodeType erpType = "Erp ";
class erpNode : public F_Node {
public:
erpNode() { type = erpType; version = 0;}
unsigned char version;
short boxnum; // ERP BOX
short adc0u; // ADC 0 side Unattenuated
short adc1u; // ADC 1 side Unattenuated
short tdc0h; // TDC 0 side high
short tdc1h; // TDC 1 side high
short adc0a; // ADC 0 side attenuated
short adc1a; // ADC 1 side attenuated
short tdc0l; // TDC 0 side low
short tdc1l; // TDC 1 side low
float energy; // ERP Energy
float time; // Time of BOX hit rel. to stop
float posh; // Box position from tdch
virtual inline void print(ostream& o)
{
o << "Erp Node v" << (short) version << endl << endl;
o << "Box Num: " << boxnum << endl;
o << "ADC0u: " << adc0u << endl;
o << "ADC1u: " << adc1u << endl;
o << "ADC0a: " << adc0a << endl;
o << "ADC1a: " << adc1a << endl;
o << "TDC0h: " << tdc0h << endl;
o << "TDC1h: " << tdc1h << endl;
o << "TDC0l: " << tdc0l << endl;
o << "TDC1l: " << tdc1l << endl;
o << "Energy: " << energy << endl;
o << "Time: " << time << endl;
o << "Pos High:" << posh << endl << endl;
}
virtual inline void info(ostream& o)
{
o << "Box " << boxnum << "; Energy " << energy << "; Time " << time <<
"; Posh " << posh << endl;
}
protected:
virtual inline void IOData(iostream& file, F_inout choice,
F_length& nodeLength)
{
F_IORec(file,version,choice,nodeLength);
F_IORec(file,boxnum,choice,nodeLength);
F_IORec(file,adc0u,choice,nodeLength);
F_IORec(file,adc1u,choice,nodeLength);
F_IORec(file,tdc0h,choice,nodeLength);
F_IORec(file,tdc1h,choice,nodeLength);
F_IORec(file,adc0a,choice,nodeLength);
F_IORec(file,adc1a,choice,nodeLength);
F_IORec(file,tdc0l,choice,nodeLength);
F_IORec(file,tdc1l,choice,nodeLength);
F_IORec(file,energy,choice,nodeLength);
F_IORec(file,time,choice,nodeLength);
F_IORec(file,posh,choice,nodeLength);
}
};
inline F_Node* newErpNode() {return new erpNode;}
static F_classDeclare declareErp(erpType,newErpNode);