| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

EsIdealFeeTool.h

Go to the documentation of this file.
00001 
00020 #ifndef ESIDEALFEETOOL_H
00021 #define ESIDEALFEETOOL_H 1
00022 
00023 #include "ElecSim/IEsFrontEndTool.h"
00024 #include "GaudiAlg/GaudiTool.h"
00025 #include "Conventions/Electronics.h"
00026 #include "Event/ElecPulseCollection.h"
00027 #include "GaudiKernel/IRndmGenSvc.h"
00028 #include "GaudiKernel/RndmGenerators.h"
00029 #include "DataSvc/ICableSvc.h"
00030 #include "DataSvc/ISimDataSvc.h"
00031 
00032 namespace DayaBay{
00033   class ElecCrate;
00034   class ElecFeeCrate;
00035   class ElecFeeChannel;
00036   class ElecPmtPulse;
00037 }
00038 
00039 class EsIdealFeeTool : public GaudiTool , virtual public IEsFrontEndTool
00040 {
00041  public:  
00042   
00043     EsIdealFeeTool(const std::string& type,
00044                    const std::string& name,
00045                    const IInterface* parent);
00046                  
00047     virtual ~EsIdealFeeTool();
00048 
00049     virtual StatusCode generateSignals(DayaBay::ElecPulseCollection*,
00050                                        DayaBay::ElecCrate*);
00051     virtual StatusCode initialize();
00052     virtual StatusCode finalize();
00053 
00054  private:
00055     StatusCode loadResponse();
00056     StatusCode mapPulsesByChannel(
00057                     const DayaBay::ElecPulseCollection::PulseContainer& pulses,
00058                     std::map<DayaBay::ElecChannelId,
00059                     std::vector<DayaBay::ElecPmtPulse*> >& pulseMap,
00060                     int* hitCountSlices);
00061     StatusCode updateBoardSignals(DayaBay::ElecFeeCrate* crate);
00062     StatusCode updateEsumSignals(DayaBay::ElecFeeCrate* crate);
00063 
00064  private:
00065     virtual StatusCode generateOneChannel(const DayaBay::FeeChannelId&,
00066                                           std::vector<DayaBay::ElecPmtPulse*>&,
00067                                           DayaBay::ElecFeeChannel&,
00068                                           double simTime,
00069                                           const ServiceMode&);
00070     int convertClock(int clock, int inputFrequency, int outputFrequency);
00071     DayaBay::ESumComp::ESumComp_t boardEsumType(int boardId);
00072     void convolve(const DayaBay::AnalogSignal& signal,
00073                   const DayaBay::AnalogSignal& response,
00074                   DayaBay::AnalogSignal& output); 
00075     void shape(const DayaBay::AnalogSignal& rawSignal,
00076                   DayaBay::AnalogSignal& shapedSignal, 
00077                   const DayaBay::AnalogSignal& response, 
00078                   std::map<int,int> convolutionWindows); 
00079     void digitize(const DayaBay::AnalogSignal& signal,
00080                   DayaBay::DigitalSignal& output,
00081                   double range, int bits, double offset);
00082     void discriminate(const DayaBay::AnalogSignal& signal,
00083                       double threshold,
00084                       std::vector<int>& output,
00085                       DayaBay::Threshold::Threshold_t mode);
00086     double pmtPulse(double deltaT, int nPulse, bool addOvershoot);
00087     double overshoot(double deltaT, int nPulse);
00088     double ringing(double deltaT, double pulseMax);
00089     double satFactor(double amp);
00090     double pulseShaping(double deltaT);
00091     double esumShaping(double deltaT);
00092     double getPulseWidth(int nPulse);
00093     double getPulseForm(int nPulse);
00094     double getPulseShift(int nPulse);
00095     double getOvershootAmp(int nPulse);
00096     double noise();
00097     void sample(const DayaBay::AnalogSignal& signal,
00098                 DayaBay::AnalogSignal& output,
00099                 int inputFrequency, int outputFrequency);
00100  private:
00101     // Property CableSvcName - Name of the cable service
00102     std::string m_cableSvcName;
00103     // Property CableSvcName - Service name for electronics sim properties
00104     std::string m_simDataSvcName;
00105     // CableSvc
00106     ICableSvc *m_cableSvc;
00107     // CableSvc
00108     ISimDataSvc *m_simDataSvc;
00109     // Trigger Window Cycles
00110     int m_triggerWindowCycles;
00111     // Mean PMT gain (in units of 10^7)
00112     double m_gainFactor;
00113     // Simulation Frequency (in Hz)
00114     int m_simFrequency;
00115     // Esum Frequency (in Hz)
00116     int m_eSumFrequency;
00117     // Bool to turn on (true) or off (false) all nonlinear effects
00118     bool m_enableNonlinearity;
00119     // Bool to turn on (true) or off (false) high pass filter before discriminator
00120     bool m_enableAcCoupling;
00121     // Maximum number of pulses before nonlinear effects begin
00122     unsigned int m_linearityThreshold;
00123     
00124     // Bool to turn on (true) or off (false) pretrigger
00125     bool m_enablePretrigger;
00126     // Thresholds as set in TrigSim
00127     double m_eSumTriggerThreshold;
00128     int m_nHitTriggerThreshold;
00129     // Pretrigger threshold
00130     int m_pretriggerThreshold;
00131     // Bool to individually turn on (true) or off (false) noise
00132     bool m_enableNoise;
00133     // Bool to individually turn on (true) or off (false) dynamic single p.e. waveform model
00134     bool m_enableDynamicWaveform;
00135     // Bool to individually turn on (true) or off (false) saturation
00136     bool m_enableSaturation;
00137     // Bool to individually turn on (true) or off (false) ringing
00138     bool m_enableRinging;
00139     // Bool to individually turn on (true) or off (false) overshoot
00140     bool m_enableOvershoot;
00141     // Bool to turn on( true) or off (false) simulation of ESum waveforms
00142     bool m_enableESumTotal;
00143     bool m_enableESumH;
00144     bool m_enableESumL;
00145     // Bool to turn on (true) or off (false) fast simulation mode
00146     bool m_enableFastSimMode;
00147     // Pulse counting time slot width.
00148     double m_pulseCountSlotWidth;
00149     // Number of counted slots before and after the pulse.
00150     int m_pulseCountWindow;
00151     // Voltage amplitude of noise.
00152     double m_noiseAmp;
00153     // Spe pulse height in V at 1e7 gain
00154     double m_speAmp;
00155     // Factor to scale all channels' discriminator threshold
00156     double m_discThreshScale;
00157     
00158     double m_adcRange;
00159     double m_adcBits;
00160     double m_adcOffset;
00161     // Ideal PMT pulse shape.
00162     DayaBay::AnalogSignal m_pmtPulse;
00163     // Ideal PMT pulse shape without overshoot
00164     DayaBay::AnalogSignal m_pmtPulse_noOvershoot;
00165     // Ideal CR-(RC)^4 shaped PMT pulse including overshoot.
00166     DayaBay::AnalogSignal m_shapedPmtPulse;
00167     // Ideal CR-(RC)^4 shaped PMT pulse with no overshoot.
00168     DayaBay::AnalogSignal m_shapedPmtPulse_noOvershoot;
00169     // Single P.E. Ringing shape.
00170     DayaBay::AnalogSignal m_ringing;
00171     // Single P.E. Ringing shape, after CR-(RC)^4 shaping
00172     DayaBay::AnalogSignal m_shapedRinging;
00173     //ESum response after RC shaping
00174     DayaBay::AnalogSignal m_esumResponse;
00175     // CR-(RC)^4 shaping response.
00176     DayaBay::AnalogSignal m_shapingResponse;
00177     // Area of ideal CR-(RC)^4 shaped PMT pulse.
00178     double m_shapingSum;
00179     //Area of shaped ESum pulse
00180     double m_esumShapingSum;
00181     // PMT pulse peak amplitude.
00182     double m_pulseMax;
00183     
00184     // Random numbers.
00185     Rndm::Numbers m_gauss;
00186     // Transient buffers for signal processing
00187     DayaBay::AnalogSignal m_rawSignal;
00188     DayaBay::AnalogSignal m_esumL;
00189     DayaBay::AnalogSignal m_esumH;
00190     DayaBay::AnalogSignal m_esumTotal;
00191     DayaBay::DigitalSignal m_shapedEsumADC;
00192     DayaBay::AnalogSignal m_shapedEsumH;
00193     DayaBay::AnalogSignal m_shapedEsumL;
00194     DayaBay::AnalogSignal m_shapedEsumTotal;
00195     DayaBay::AnalogSignal m_discriminatorSignal;
00196     DayaBay::AnalogSignal m_shapedSignal;
00197     DayaBay::AnalogSignal m_tdcSignal;
00198     DayaBay::AnalogSignal m_adcAnalogSignal;
00199     DayaBay::DigitalSignal m_hitSignal;
00200     DayaBay::DigitalSignal m_adcHighGain;
00201     DayaBay::DigitalSignal m_adcLowGain;
00202     DayaBay::AnalogSignal m_energySignal;
00203     DayaBay::DigitalSignal m_hitSync;
00204     DayaBay::DigitalSignal m_hitHold;
00205     std::map<int,int> m_adcConvolutionWindows;
00206     std::map<int,int> m_esumConvolutionWindows;
00207 };
00208 
00209 #endif // ESIDEALFEETOOL_H
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:49:26 2011 for ElecSim by doxygen 1.4.7