00001 #ifndef TVANALYSEDPULSEGENERATOR_H__ 00002 #define TVANALYSEDPULSEGENERATOR_H__ 00003 00004 #include <vector> 00005 #include <string> 00006 #include <stdexcept> 00007 #include "definitions.h" 00008 #include "TAPGeneratorOptions.h" 00009 #include "TAnalysedPulse.h" 00010 #include "SetupNavigator.h" 00011 00012 #include <TClass.h> 00013 00014 class TPulseIsland; 00015 00028 class TVAnalysedPulseGenerator { 00029 00030 public: 00031 TVAnalysedPulseGenerator(const char* name, TAPGeneratorOptions* opts); 00032 virtual ~TVAnalysedPulseGenerator(){}; 00033 00034 public: 00040 virtual int ProcessPulses(const PulseIslandList& pil, AnalysedPulseList& apl)=0; 00042 virtual bool MayDivideTPIs()=0; 00043 00044 void SetPulseList(PulseIslandList* list){fPulseList=list;}; 00070 template <typename TypeOfTAP> 00071 TypeOfTAP* MakeNewTAP(int parent_index)const; 00072 00073 TAnalysedPulse* MakeNewTAP(int parent_index)const{ 00074 return MakeNewTAP<TAnalysedPulse>(parent_index); 00075 } 00076 00077 bool Debug()const{return fDebug;}; 00078 00081 IDs::channel GetChannel()const {return fSource.Channel();}; 00082 00085 std::string GetBank()const {return fBankName;}; 00086 00094 const IDs::source& GetSource()const {return fSource;}; 00095 00096 static const char* TapType(){return TAnalysedPulse::Class()->GetName();} 00097 00098 virtual void CalibratePulses( AnalysedPulseList& theAnalysedPulses)const; 00099 00100 protected: 00101 friend class MakeAnalysedPulses; 00102 00108 virtual void SetChannel(const std::string& det){ 00109 fSource.Channel()=det; 00110 fBankName= SetupNavigator::Instance()->GetBank(det); 00111 }; 00112 00113 00114 private: 00118 IDs::source fSource; 00121 std::string fBankName; 00125 bool fDebug; 00128 PulseIslandList* fPulseList; 00129 00131 bool fCanCalibrate; 00133 double fAdcToEnergyGain, fAdcToEnergyOffset; 00134 }; 00135 00136 template <typename TypeOfTAP> 00137 inline TypeOfTAP* TVAnalysedPulseGenerator::MakeNewTAP(int parent_index)const{ 00138 TypeOfTAP* pulse=NULL; 00139 TPulseIsland* parent = fPulseList->at(parent_index); 00140 pulse=new TypeOfTAP(GetSource(),parent_index,parent); 00141 return pulse; 00142 } 00143 00144 #endif // TVANALYSEDPULSEGENERATOR_H__