20 #include "FairEventHeader.h"
30 #include "FairRootManager.h"
31 #include "FairRunAna.h"
33 #include "FairRuntimeDb.h"
36 #include "TStopwatch.h"
38 #include "TClonesArray.h"
56 fHitArray(0), fWaveformArray(0), fDataBuffer(0), fTimeOrderedWaveform(kFALSE), fOneBitResolution(0), fOneBitResolutionBW(0), fOneBitResolutionPMT(0), fNBits(0), fDetectedPhotonsPerMeV(0), fDetectedPhotonsPerMeV_PMT(0), fNPhotoElectronsPerMeVAPDBarrel(0), fNPhotoElectronsPerMeVAPDBWD(0), fNPhotoElectronsPerMeVVPT(0), fNPhotoElectronsPerMeVPMT(0), fSensitiveAreaAPD(0), fSensitiveAreaVPT(0), fQuantumEfficiencyAPD(0), fQuantumEfficiencyVPT(0), fQuantumEfficiencyPMT(0), fExcessNoiseFactorAPD(0), fExcessNoiseFactorVPT(0), fExcessNoiseFactorPMT(0), fIncoherent_elec_noise_width_GeV_APD(0), fIncoherent_elec_noise_width_GeV_VPT(0), fEnergyRange(0), fEnergyRangeBW(0), fFirstSamplePhase(0), fNumber_of_samples_in_waveform(0), fNumber_of_samples_in_waveform_pmt(0), fASIC_Shaping_int_time(0), fPMT_Shaping_int_time(0), fPMT_Shaping_diff_time(0), fCrystal_time_constant(0), fShashlyk_time_constant(0), fShashlykSamplingFactor(0), fSampleRate(0), fSampleRate_PMT(0), fUse_shaped_noise(0), fUse_photon_statistic(0), fNoiseAllChannels(0), fMapVersion(0), fFirstADCBinTime(0), fGevPeakAnalogue(0), fGevPeakAnalogue_PMT(0), fDigiPar(new
PndEmcDigiPar()), fGeoPar(new
PndEmcGeoPar()),
fVerbose(verbose)
89 FairRootManager* ioman = FairRootManager::Instance();
92 cout <<
"-E- PndEmcHitsToWaveform::Init: "
93 <<
"RootManager not instantiated!" << endl;
98 fHitArray = (TClonesArray*) ioman->GetObject(
"EmcHit");
100 cout <<
"-W- PndEmcHitsToWaveform::Init: "
101 <<
"No EmcHit array!" << endl;
109 ioman->RegisterWriteoutBuffer(
"EmcWaveform",
fDataBuffer);
117 cout <<
"-I- PndEmcHitsToWaveform: Intialization successfull" << endl;
155 cout<<
"EMC digitisation parameters "<<endl;
156 cout<<
" nBits "<<
fNBits<<endl;
265 if ( !
fDataBuffer ) Fatal(
"Exec",
"No Waveform Data Buffer");
271 Double_t EventTime = FairRootManager::Instance()->GetEventTime();
273 Int_t evtNo = FairRun::Instance()->GetEventHeader()->GetMCEntryNumber();
275 cout<<
"**************************************"<<endl;
276 cout<<
"Event No. #"<<evtNo<<
", EvtTime #"<<EventTime<<std::endl;
277 cout<<
"PndEmcHitsToWaveform:: Hit array contains "<<nHits<<
" hits"<<endl;
279 cout<<
"**************************************"<<endl;
286 std::set<Int_t> waveformInd;
301 Int_t detId, module, MCTrackID;
304 for (Int_t iHit=0; iHit<
nHits; iHit++)
310 std::cout<<
" UpdateWaveform: Unknown module number "<<module<<
" in EMC digitization. Detector ID = "<<detId<<std::endl;
313 detId=theHit->GetDetectorID();
315 TimeError = gRandom->Gaus(0, 0.55 + 5.5*TMath::Exp(-27.7*theHit->
GetEnergy()));
317 const std::vector<Int_t>& mcTrack = theHit->
GetMcList();
318 MCTrackID = mcTrack.size() > 0 ? mcTrack[0] : -1;
321 waveformInd.insert(detId);
325 }
else if(module == 3){
332 WaveformTimeStamp = EventTime + theHit->
GetTime()*1.0e9 ;
333 theWaveform =
AddWaveform(detId,iHit,NumOfSamples, WaveformTimeStamp, sampleRate, MCTrackID);
334 theWaveform->
AddEvt(evtNo);
335 theWaveform->SetTimeStampError(TimeError);
338 if(theWaveform->GetTimeStamp() > TimeMax) TimeMax = theWaveform->GetTimeStamp();
339 if(theWaveform->GetTimeStamp() < TimeMin) TimeMin = theWaveform->GetTimeStamp();
397 std::cout<<
" UpdateWaveform: Unknown module number "<<module<<
" in EMC digitization. Detector ID = "<<detId<<std::endl;
408 Int_t detId_tmp, modId_tmp;
410 for(std::map<Int_t,PndEmcTwoCoordIndex* >::iterator iter = intTwoCoordMap.begin();
411 iter != intTwoCoordMap.end(); ++iter){
412 detId_tmp=(*iter).first;
413 modId_tmp = detId_tmp/100000000;
417 }
else if(modId_tmp == 3){
425 if (waveformInd.insert(detId_tmp).second){
426 WaveformTimeStamp = gRandom->Uniform(TimeMin, TimeMax);
427 theWaveform =
AddWaveform(detId_tmp,-1,NumOfSamples, WaveformTimeStamp, sampleRate, -1);
475 std::cout<<
" UpdateWaveform: Unknown module number "<<modId_tmp<<
" in EMC digitization. Detector ID = "<<detId_tmp<<std::endl;
557 cout <<
"PndEmcHitsToWaveform, Real time " << rtime <<
" s, CPU time " << ctime <<
" s" << endl;
564 FairRun*
run = FairRun::Instance();
565 if ( ! run ) Fatal(
"SetParContainers",
"No analysis run");
567 FairRuntimeDb* db = run->GetRuntimeDb();
568 if ( ! db ) Fatal(
"SetParContainers",
"No runtime database");
604 thisWave =
new PndEmcWaveform(MCTrackID,detID,sampleRate, numOfSamples, iHit, timeStamp);
607 Int_t size = clref.GetEntriesFast();
608 thisWave =
new(clref[size])
PndEmcWaveform(MCTrackID,detID,sampleRate, numOfSamples,iHit, timeStamp);
628 std::cout<<
"==================================================="<<std::endl;
629 std::cout<<
"PndEmcHitsToWaveform::FinishTask"<<std::endl;
630 std::cout<<
"***************************************************"<<std::endl;
631 std::cout<<
"Read Hits# "<<
HowManyHit<<std::endl;
633 std::cout<<
"***************************************************"<<std::endl;
Double_t GetQuantumEfficiencyVPT()
Int_t GetUse_photon_statistic()
Double_t GetPMT_Shaping_diff_time()
Double_t GetQuantumEfficiencyPMT()
Double_t GetIncoherent_elec_noise_width_GeV_VPT()
Int_t GetUse_shaped_noise()
Int_t GetNumber_of_samples_in_waveform()
Double_t GetQuantumEfficiencyAPD()
friend F32vec4 sqrt(const F32vec4 &a)
Double_t val[nBoxes][nFEBox]
const std::map< Int_t, PndEmcTwoCoordIndex * > & GetTciMap()
Double_t GetIncoherent_elec_noise_width_GeV_APD()
Double_t GetEnergyRangeBW()
Double_t GetCrystal_time_constant()
Double_t GetFirstSamplePhase()
void SetPersistency(Bool_t val=kTRUE)
Double_t GetASIC_Shaping_int_time()
Pulseshape from an CRRC-Shaper.
Double_t GetSampleRate_FWD()
Double_t GetShashlykSamplingFactor()
Double_t GetSensitiveAreaAPD()
const std::vector< Int_t > & GetMcList()
Pulseshape from an APFEL ASIC preamplifier shaper.
virtual Double_t GetEnergy() const
parameter set of Emc digitisation
Double_t GetFWD_Shaping_int_time()
Double_t GetEnergyRange()
virtual void SetEnergy(Double32_t energy)
Double_t GetDetectedPhotonsPerMeV()
Int_t GetNumber_of_samples_in_waveform_fwd()
virtual Double_t GetTime() const
represents the deposited energy of one emc crystal from simulation
Double_t GetExcessNoiseFactorVPT()
Double_t GetDetectedPhotonsPerMeV_PMT()
Double_t GetExcessNoiseFactorAPD()
Double_t GetFWD_time_constant()
Double_t GetSampleRate_PMT()
static PndEmcStructure * Instance()
Short_t GetModule() const
Double_t GetShashlyk_time_constant()
static PndEmcMapper * Instance()
Int_t GetNumber_of_samples_in_waveform_pmt()
Double_t GetPMT_Shaping_int_time()
Double_t GetSensitiveAreaVPT()
Double_t GetExcessNoiseFactorPMT()
Int_t GetNoiseAllChannels()