// $Id: PmtSignal.cc,v 1.7 2005/02/24 11:00:28 pesce Exp $
// Description of a PMT analog signal
// M. Pallavicini - created
//
#include <math.h>
#include <iostream>
#include "euso.hh"
#include "PmtSignal.hh"
ClassImp(PmtSignal)
Int_t PmtSignal::gSigCounter = 0;
//______________________________________________________________________________
PmtSignal::PmtSignal(Double_t t, Double_t c, Double_t s,Int_t pmt,Int_t ch)
: fTime(t),fCharge(c),fWidth(s),fPmt(pmt),fCh(ch) {
// ctor
fId = gSigCounter++;
SetMadeCount( kFALSE );
SetMadeFastOR( kFALSE );
}
//______________________________________________________________________________
PmtSignal::~PmtSignal() {
// dtor
}
//______________________________________________________________________________
Double_t PmtSignal::Current(Double_t t) const {
// compute the current at time t
// signal shape assumed to be a gaussian
Double_t b = ( t - fTime);
b /= fWidth;
b *= b;
b /= 2.;
if (b>20.) return 0.;
Double_t a = fCharge / ( sqrt( 2. * pi ) * fWidth );
a *= 1.e9; // sigma is in ns, I want Amperes
return a*exp(-b);
}
//______________________________________________________________________________
// voltage over a resistor R (Ohm)
Double_t PmtSignal::Voltage(Double_t t, Double_t R) const {
return R*Current(t);
}
//______________________________________________________________________________
void PmtSignal::Dump() const {
// dump on stdout
fprintf(stdout,"PmtSignal: Charge=%6.2f Time=%6.2f Sigma=%6.2f Peak=%6.2fn",
Charge(),Time(),Sigma(),Current(Time()));
}
//______________________________________________________________________________
Bool_t operator < ( PmtSignal& s1, PmtSignal& s2 ) {
// comparison operator
// used by SortVector function
return (s1.Time() < s2.Time());
}
//______________________________________________________________________________
ostream& operator << (ostream& os, PmtSignal& s) {
// dump on stream
os << "PmtSignal in Pmt=" << s.Pmt() << " Channel="<< s.Ch() << endl;
os << "Charge="<<(s.Charge()*1.0E12)<<" pC Time="<<s.Time()<<" ns ";
os << "Peak Current="<< (s.Current(s.Time())*1.e9) << " nA" << endl;
return os;
}