15 #include "FairRootManager.h"
16 #include "FairRunAna.h"
17 #include "FairRuntimeDb.h"
19 #include "TClonesArray.h"
20 #include "TStopwatch.h"
31 fWaveformArray(NULL), fDigiArray(NULL), fEnergyDigiThreshold(0), fDigiPosMethod(
""), fEmcDigiRescaleFactor(0.), fEmcDigiPositionDepthPWO(0), fEmcDigiPositionDepthShashlyk(0), fHighgainPSA(NULL), fLowgainPSA(NULL), fHighLowPSA(verbose), fCalibrator(NULL), fDigiPar(NULL), fRecoPar(NULL), fGeoPar(NULL),
fVerbose(verbose), fTimeOrderedDigi(kFALSE)
58 FairRootManager* ioman = FairRootManager::Instance();
61 cout <<
"-E- PndEmcFWEndcapDigi::Init: "
62 <<
"RootManager not instantiated!" << endl;
67 fWaveformArray = (TClonesArray*) ioman->GetObject(
"EmcMultiWaveform");
72 cout <<
"-W- PndEmcFWEndcapDigi::Init: "
73 <<
"No PndEmcWaveform array containing multi waveforms!" << endl;
80 cout <<
"-E- PndEmcFWEndcapTimebasedWaveforms::Init: "
81 <<
"no DigiPar containter found" << endl;
103 cout <<
"-W- PndEmcFWEndcapDigi::Init: " <<
"Unknown digi position method!" << endl;
111 std::cout <<
"-W in PndEmcFWEndcapDigi::Init: Lowgain PSA already set. Skipping default initialization" << std::endl;
117 TF1 R_thres(
"R_thres_Low", rparas->GetEntriesFast()>0 ? rparas->UncheckedAt(0)->GetName() :
"", 1, TMath::Power(2,
fDigiPar->
GetNBits()));
118 TF1 R_mean(
"R_mean_Low", rparas->GetEntriesFast()>1 ? rparas->UncheckedAt(1)->GetName() :
"", 1, TMath::Power(2,
fDigiPar->
GetNBits()));
127 std::cerr <<
"-E in PndEmcFWEndcapDigi::Init could not find PSA of type: " <<
fDigiPar->
GetPsaTypeLow() << std::endl;
134 std::cout <<
"-W in PndEmcFWEndcapDigi::Init: Highgain PSA already set. Skipping default initialization" << std::endl;
140 TF1 R_thres(
"R_thres_High", rparas->GetEntriesFast()>0 ? rparas->UncheckedAt(0)->GetName() :
"", 1, TMath::Power(2,
fDigiPar->
GetNBits()));
141 TF1 R_mean(
"R_mean_High", rparas->GetEntriesFast()>1 ? rparas->UncheckedAt(1)->GetName() :
"", 1, TMath::Power(2,
fDigiPar->
GetNBits()));
149 std::cerr <<
"-E in PndEmcFWEndcapDigi::Init could not find PSA of type: " <<
fDigiPar->
GetPsaTypeHigh() << std::endl;
157 std::cerr <<
"-E- PndEmcFWEndcapDigi::Init " <<
"No highgain and/or lowgain psa" << std::endl;
163 std::cout <<
"-W in PndEmcFWEndcapDigi::Init: Calibrator already set. Skipping default initialization" << std::endl;
166 for(Int_t imod=1; imod<=5; ++imod) {
178 cout <<
"-I- PndEmcFWEndcapDigi: Intialization successfull" << endl;
211 for (Int_t iWaveform=0; iWaveform<nWaveforms; iWaveform++) {
222 for(Int_t iHit=0; iHit<
nHits; ++iHit) {
232 digi_time/=sampleRate;
236 Double_t timestamp=theWaveform->GetTimeStamp() + digi_time;
240 myDigi->ResetLinks();
241 myDigi->AddLinks(theWaveform->GetLinksWithType(FairRootManager::Instance()->GetBranchId(
"EmcHit")));
259 cout <<
"PndEmcFWEndcapDigi, Real time " << rtime <<
" s, CPU time " << ctime <<
" s" << endl;
266 FairRun*
run = FairRun::Instance();
267 if ( ! run ) Fatal(
"SetParContainers",
"No analysis run");
269 FairRuntimeDb* db = run->GetRuntimeDb();
270 if ( ! db ) Fatal(
"SetParContainers",
"No runtime database");
const TString & GetPsaTypeHigh()
virtual void GetHit(Int_t i, Double_t &energy, Double_t &time)
Get energy and time of hit.
Double_t GetSignalOverflowHigh()
Double_t GetEmcDigiPositionDepthShashlyk()
static void selectDigiPositionMethod(PositionMethod, double positionDepthPWO=0., double positionDepthShahslyk=0., double rescaleFactor=1.)
virtual void Exec(Option_t *opt)
Runs the task.
represents the reconstructed hit of one emc crystal
virtual InitStatus Init()
Init Task.
Double_t val[nBoxes][nFEBox]
const TArrayD & GetPsaParLow()
void SetPersistency(Bool_t val=kTRUE)
virtual void SetVerbose(Int_t verbose=0)
PndEmcFWEndcapDigi(Int_t verbose=0, Bool_t storedigis=kTRUE)
Task to create digis from waveforms.
virtual void Init(PndEmcPSAFPGASampleAnalyser *highgainPSA, PndEmcPSAFPGASampleAnalyser *lowgainPSA, Double_t overflowThreshold, Int_t highgainWfIndex=0, Int_t lowgainWfIndex=1)
PndEmcFWEndcapDigiPar * fDigiPar
Digitisation parameter container.
virtual void SetParContainers()
parameter set for the FWEndcap variant of waveform simulation
PndEmcPSAFPGASampleAnalyser * fLowgainPSA
virtual void SetCalibration(Int_t ModId, Double_t cal, Int_t SignalNr=1, Double_t overflow=-1)
Set Calibration for a Module.
Double_t fEmcDigiPositionDepthShashlyk
PndEmcHighLowPSA fHighLowPSA
Class to simulate a Calibration.
TClonesArray * fWaveformArray
const TString & GetRValueParLow()
virtual Int_t Process(const PndEmcWaveform *waveform)
Find Hits in Waveform.
const TString & GetRValueParHigh()
Double_t fEnergyDigiThreshold
virtual CalibrationStatus_t Calibrate(Double_t &Energy, Long_t DetId, Int_t SignalNr=1)
Apply CrystalCalibration to Energy of Crystal derId.
Double_t fEmcDigiPositionDepthPWO
Double_t GetEnergyDigiThreshold()
Double_t fEmcDigiRescaleFactor
virtual Bool_t Init()
Init.
virtual Int_t GetWaveformIdx(Int_t i)
PndEmcRecoPar * fRecoPar
Reconstruction parameter container.
virtual ~PndEmcFWEndcapDigi()
static PndEmcStructure * Instance()
const TString & GetPsaTypeLow()
const TArrayD & GetPsaParHigh()
virtual void Init(const std::vector< Double_t > ¶ms, TF1 *R_thres, TF1 *R_mean, float extBaselineValue=0)
PndEmcPSAFPGASampleAnalyser * fHighgainPSA
Parameter set for Emc Reco.
TClonesArray * fDigiArray
PndEmcSimCrystalCalibrator * fCalibrator
void SetStorageOfData(Bool_t val)
PndEmcGeoPar * fGeoPar
Digitisation parameter container.
Double_t GetEmcDigiPositionDepthPWO()