23 #include "TClonesArray.h"
27 #include "Riostream.h"
63 ,fWaveformLength(waveform_length)
65 ,fSignalError(waveform_length,0.)
67 ,fSampleRate(sampleRate)
70 if(hitIndex>=0) SetLink(FairLink(-1, FairRootManager::Instance()->GetEntryNr(),
"EmcHit", hitIndex));
76 fWaveformLength(signal.size()),
80 if(hitIndex>=0) SetLink(FairLink(-1, FairRootManager::Instance()->GetEntryNr(),
"EmcHit", hitIndex));
86 fWaveformLength(signal.size()),
160 newWaveform.
UpdateWaveform(gevHit, 0,
false, 1., 0., sampleRate, pulseshape);
175 ,
Bool_t usePhotonStatistic
185 MakeWaveform(energy, time, pePerMeV, usePhotonStatistic, excessNoiseFactor, firstADCBinTime, sampleRate, pulseshape, EnergyError);
193 ,
Bool_t usePhotonStatistic
202 if (usePhotonStatistic)
204 Double_t crystalPhotonsMeV = 1.0e3 * energy * pePerMeV;
205 photonStatFactor = gRandom->Gaus(1,
sqrt(excessNoiseFactor/crystalPhotonsMeV));
212 amplitude = energy*photonStatFactor;
215 Double_t time_offset=firstADCBinTime;
222 local_time =
i/sampleRate;
223 fSignal[
i]+=(pulseshape->
value(local_time,amplitude,time_offset));
227 Double_t Coff = EnergyError*sumCharge/sumChargeErr;
242 ran_noise=gRandom->Gaus(0,1)*width;
266 Double_t ran_noise=gRandom->Gaus(0,1)*noise_width;
278 Double_t Coff = EnergyError*sumCharge/sumChargeErr;
283 static Int_t baseline_length =100;
284 for(Int_t j=0;j<baseline_length;++j){
299 Double_t ran_noise=gRandom->Gaus(0,1)*noise_width;
300 fSignal[
i] += pulseshape->
value(t,ran_noise,firstADCBinTime);
309 Double_t Coff = EnergyError*sumCharge/sumChargeErr;
314 static Int_t baseline_length =100;
315 for(Int_t j=0;j<baseline_length;++j){
317 Double_t ran_noise=gRandom->Gaus(0,1)*noise_width;
360 if(GetTimeStamp() < otherWave.GetTimeStamp())
361 return otherWave.GetTimeStamp() >
GetActiveTime() - overlapped_time;
363 return GetTimeStamp() > otherWave.
GetActiveTime() - overlapped_time;
382 if(GetTimeStamp()> otherWave.GetTimeStamp())
384 std::cerr<<
"Please make sure the eariler waveform += the later waveform"<<std::endl;
389 const std::vector<Int_t>& evtList = otherWave.
GetEvtList();
390 for(
size_t i=0;
i< evtList.size();++
i){
397 if((GetTimeStamp() + IDX/
fSampleRate*1.0e9) < otherWave.GetTimeStamp()){
419 TGraphErrors*
g =
new TGraphErrors(
fSignal.size());
friend F32vec4 sqrt(const F32vec4 &a)
stores crystal index coordinates (x,y) or (theta,phi)
PndEmcTwoCoordIndex * GetTCI(Int_t DetectorId)
virtual double value(const double t, const double amp, const double toffset) const
virtual Double_t GetEnergy() const
virtual void SetEnergy(Double32_t energy)
friend F32vec4 fabs(const F32vec4 &a)
represents the deposited energy of one emc crystal from simulation
int hit(Int_t nEvents=0, TString inFile="sim.root", TString parFile="par.root", TString inDigi="digi.root", TString outFile="hit.root", Int_t timeBased=0)
virtual void SetTime(Double32_t time)
static PndEmcMapper * Instance()