15 #ifndef BSEMCEXTRACTDIGISFROMWAVEFORMS_HH 16 #define BSEMCEXTRACTDIGISFROMWAVEFORMS_HH 24 #include "TClonesArray.h" 25 #include "TStopwatch.h" 27 #include "FairLogger.h" 28 #include "FairRootManager.h" 29 #include "FairRunAna.h" 30 #include "FairRuntimeDb.h" 51 template <
class ParSet>
64 if (
fPSA !=
nullptr) {
83 LOG(debug) <<
"BSEmcExtractDigisFromWaveforms<ParSet>::Init";
92 FairRootManager *ioman = FairRootManager::Instance();
93 if (ioman ==
nullptr) {
94 LOG(error) <<
"BSEmcExtractDigisFromWaveforms<ParSet>::Init: " 95 <<
"RootManager not instantiated!";
104 LOG(debug) <<
"BSEmcExtractDigisFromWaveforms<ParSet>::Init: Registered " <<
fDigiBranchName;
111 LOG(error) <<
"BSEmcExtractDigisFromWaveforms<ParSet>::Init: " 112 <<
"No BSEmcWaveform array containing multi waveforms!";
118 if (
fPSA ==
nullptr) {
119 LOG(error) <<
"No PSA was defined. Aborting!";
125 LOG(debug) <<
"BSEmcExtractDigisFromWaveforms: Intialization successfull";
147 Double_t energy = NAN;
148 Double_t digi_time = NAN;
154 for (Int_t iWaveform = 0; iWaveform < nWaveforms; iWaveform++) {
161 for (Int_t iDeposit = 0; iDeposit < nDeposits; ++iDeposit) {
165 Double_t timestamp =
GetTimeStamp(theWaveform, digi_time);
169 myDigi->ResetLinks();
170 myDigi->AddLinks(theWaveform->GetLinksWithType(FairRootManager::Instance()->GetBranchId(
fMCDepositBranchName)));
171 FairMultiLinkedData mcdeplinks = myDigi->GetLinksWithType(FairRootManager::Instance()->GetBranchId(
fMCDepositBranchName));
172 for (
const FairLink &link : mcdeplinks.GetLinks()) {
175 LOG(debug) <<
"BSEmcExtractDigisFromWaveforms for " <<
fDetectorName <<
" created Digi(detId: " << detId <<
", energy: " << energy <<
", timestamp: " << timestamp
176 <<
") and has " << myDigi->GetLinksWithType(FairRootManager::Instance()->GetBranchId(
fMCDepositBranchName)).GetNLinks() <<
" links to EmcMCDeposits";
182 Double_t rtime = timer.RealTime();
183 Double_t ctime = timer.CpuTime();
184 LOG(debug) <<
"BSEmcExtractDigisFromWaveforms, Real time " << rtime <<
" s, CPU time " << ctime <<
" s";
200 FairRun *run = FairRun::Instance();
201 if (run ==
nullptr) {
202 Fatal(
"SetParContainers",
"No analysis run");
204 FairRuntimeDb *db = run->GetRuntimeDb();
206 Fatal(
"SetParContainers",
"No runtime database");
209 fDigiPar =
dynamic_cast<ParSet *
>(db->getContainer(ParSet::fgParameterName.c_str()));
215 t_digi_time /= sampleRate;
217 return t_waveform->GetTimeStamp() + t_digi_time;
Baseclass for pulseshapeanalysis ( featureextraction )
const std::string fgMultiWaveformBranchName
virtual void GetHit(Int_t t_i, Double_t &t_energy, Double_t &t_time)=0
Get energy and time of hit.
void SetGainType(eGAIN t_type)
Input and Output Container implementation of PndMutableContainerI using an underlying TClonesArray...
void SetPersistency(Bool_t val=kTRUE)
void SetTCA(TClonesArray *t_tca)
Set the TClonesArray address.
virtual Int_t Process(const BSEmcWaveform *t_waveform)=0
Find Hits in Waveform.
virtual void Reset() final
Delete all elements.
represents the reconstructed hit of one emc crystal
void SetBranchName(const TString &t_branchname)
Set the Branch Name.
virtual T * CreateCopy(const T &t_element)
Create a copy of t_element in the TClonesArray and return a pointer to it.
const std::string fgDigiBranchName
const std::string fgMCDepositBranchName