00001 #ifndef TVDETECTORPULSEGENERATOR_H__ 00002 #define TVDETECTORPULSEGENERATOR_H__ 00003 00004 #include "TSetupData.h" 00005 #include "TAnalysedPulse.h" 00006 #include "TDetectorPulse.h" 00007 #include "TDPGeneratorOptions.h" 00008 #include "definitions.h" 00009 00010 class TVDetectorPulseGenerator { 00011 public: 00012 00013 public: 00014 TVDetectorPulseGenerator(const char* name, TDPGeneratorOptions* opts): 00015 fDebug(false),fFastPulses(NULL),fSlowPulses(NULL){ 00016 fSource.Generator()=IDs::generator(name,opts->StringDescription()); 00017 } 00018 virtual ~TVDetectorPulseGenerator(){} 00019 00020 public: 00021 virtual int ProcessPulses( DetectorPulseList& output)=0; 00022 virtual bool ChecksForPileUp()const =0; 00023 00024 void SetPulseSources(const IDs::source& fast, const IDs::source& slow){ 00025 fFastSource=fast; 00026 fSlowSource=slow; 00027 } 00028 void SetPulseLists(const AnalysedPulseList* fast,const AnalysedPulseList* slow){ 00029 fFastPulses=fast; 00030 fSlowPulses=slow; 00031 } 00032 00033 void SetDebug(const bool& val=true){fDebug=val;}; 00034 bool Debug(){return fDebug;}; 00035 00036 TDetectorPulse* MakeTDP(int fast_parent, int slow_parent)const{ 00037 TDetectorPulse* pulse=NULL; 00038 const TAnalysedPulse* fast=NULL; 00039 if(fFastPulses && fast_parent>=0) fast=fFastPulses->at(fast_parent); 00040 const TAnalysedPulse* slow=NULL; 00041 if(fSlowPulses && slow_parent>=0) slow=fSlowPulses->at(slow_parent); 00042 if(fast || slow) { 00043 pulse=new TDetectorPulse(GetSource(),fast_parent,fast,slow_parent,slow); 00044 } 00045 return pulse; 00046 } 00047 IDs::source GetSource()const {return fSource;}; 00048 IDs::source GetFastSource()const {return fFastSource;}; 00049 IDs::source GetSlowSource()const {return fSlowSource;}; 00050 void SetChannel(const IDs::channel& ch){fSource.Channel()=ch;}; 00051 IDs::generator GetGeneratorID()const{return fSource.Generator();} 00052 00053 const AnalysedPulseList* FastPulseList()const{return fFastPulses;} 00054 const AnalysedPulseList* SlowPulseList()const{return fSlowPulses;} 00055 const AnalysedPulseList* PulseList(bool getFast)const{return getFast?fFastPulses:fSlowPulses;} 00056 00057 private: 00058 bool fDebug; 00059 IDs::source fFastSource, fSlowSource, fSource; 00060 const AnalysedPulseList *fFastPulses, *fSlowPulses; 00061 }; 00062 00063 #endif // TVDETECTORPULSEGENERATOR_H__