source: JEM-EUSO/esaf_cc_at_lal/packages/simulation/detector/electronics/src/PmtSignal.cc @ 114

Last change on this file since 114 was 114, checked in by moretto, 11 years ago

actual version of ESAF at CCin2p3

File size: 2.3 KB
Line 
1// $Id: PmtSignal.cc 2136 2005-10-02 14:18:08Z thea $
2// Description of a PMT analog signal
3// M. Pallavicini - created
4//
5#include <math.h>
6#include <iostream>
7#include <TMath.h>
8#include "euso.hh"
9#include "PmtSignal.hh"
10
11using namespace TMath;
12
13ClassImp(PmtSignal)
14
15Int_t PmtSignal::gSigCounter = 0;
16
17//______________________________________________________________________________
18PmtSignal::PmtSignal(Double_t t, Double_t c, Double_t s,Int_t pmt,Int_t ch) 
19  : fTime(t),fCharge(c),fWidth(s),fPmt(pmt),fCh(ch) {
20    // ctor
21     
22    fId = gSigCounter++;
23    SetMadeCount( kFALSE );
24    SetMadeFastOR( kFALSE );
25}
26
27//______________________________________________________________________________
28PmtSignal::~PmtSignal() {
29    // dtor
30
31}
32
33//______________________________________________________________________________
34Double_t PmtSignal::Current(Double_t t) const {
35    // compute the current at time t
36    // signal shape assumed to be a gaussian
37
38    Double_t b = ( t - fTime);
39    b /= fWidth;
40    b *= b;
41    b /= 2.;
42    if (b>20.) return 0.;
43    Double_t a = fCharge / ( sqrt( 2. * Pi() ) * fWidth );
44    a *= 1.e9;                // sigma is in ns, I want Amperes
45    return a*exp(-b);
46}
47
48//______________________________________________________________________________
49// voltage over a resistor R (Ohm)
50Double_t PmtSignal::Voltage(Double_t t, Double_t R) const {
51    return R*Current(t);
52}
53
54//______________________________________________________________________________
55void PmtSignal::Dump() const {
56    // dump on stdout
57
58    fprintf(stdout,"PmtSignal: Charge=%6.2f Time=%6.2f Sigma=%6.2f Peak=%6.2f\n",
59          Charge(),Time(),Sigma(),Current(Time()));
60}
61
62//______________________________________________________________________________
63Bool_t operator < ( PmtSignal& s1, PmtSignal& s2 ) {
64    // comparison operator
65    // used by SortVector function
66
67    return (s1.Time() < s2.Time());
68}
69
70//______________________________________________________________________________
71ostream& operator << (ostream& os, PmtSignal& s) {
72    // dump on stream
73
74    os << "PmtSignal in Pmt=" << s.Pmt() << "  Channel="<< s.Ch() << endl;
75    os << "Charge="<<(s.Charge()*1.0E12)<<" pC  Time="<<s.Time()<<" ns  ";
76    os << "Peak Current="<< (s.Current(s.Time())*1.e9) << " nA" << endl;
77    return os;
78}
Note: See TracBrowser for help on using the repository browser.