3 #ifndef BSEMCEXTRACTDIGISFROMWAVEFORMS_HH 4 #define BSEMCEXTRACTDIGISFROMWAVEFORMS_HH 12 #include "TClonesArray.h" 13 #include "TStopwatch.h" 15 #include "FairLogger.h" 16 #include "FairRootManager.h" 17 #include "FairRunAna.h" 18 #include "FairRuntimeDb.h" 39 template <
class ParSet>
52 if (
fPSA !=
nullptr) {
71 LOG(debug) <<
"BSEmcExtractDigisFromWaveforms<ParSet>::Init";
80 FairRootManager *ioman = FairRootManager::Instance();
81 if (ioman ==
nullptr) {
82 LOG(error) <<
"BSEmcExtractDigisFromWaveforms<ParSet>::Init: " 83 <<
"RootManager not instantiated!";
92 LOG(debug) <<
"BSEmcExtractDigisFromWaveforms<ParSet>::Init: Registered " <<
fDigiBranchName;
99 LOG(error) <<
"BSEmcExtractDigisFromWaveforms<ParSet>::Init: " 100 <<
"No BSEmcWaveform array containing multi waveforms!";
106 if (
fPSA ==
nullptr) {
107 LOG(error) <<
"No PSA was defined. Aborting!";
113 LOG(debug) <<
"BSEmcExtractDigisFromWaveforms: Intialization successfull";
135 Double_t energy = NAN;
136 Double_t digi_time = NAN;
142 for (Int_t iWaveform = 0; iWaveform < nWaveforms; iWaveform++) {
149 for (Int_t iDeposit = 0; iDeposit < nDeposits; ++iDeposit) {
153 Double_t timestamp =
GetTimeStamp(theWaveform, digi_time);
157 myDigi->ResetLinks();
158 myDigi->AddLinks(theWaveform->GetLinksWithType(FairRootManager::Instance()->GetBranchId(
fMCDepositBranchName)));
159 FairMultiLinkedData mcdeplinks = myDigi->GetLinksWithType(FairRootManager::Instance()->GetBranchId(
fMCDepositBranchName));
160 for (
const FairLink &link : mcdeplinks.GetLinks()) {
163 LOG(debug) <<
"BSEmcExtractDigisFromWaveforms for " <<
fDetectorName <<
" created Digi(detId: " << detId <<
", energy: " << energy <<
", timestamp: " << timestamp
164 <<
") and has " << myDigi->GetLinksWithType(FairRootManager::Instance()->GetBranchId(
fMCDepositBranchName)).GetNLinks() <<
" links to EmcMCDeposits";
170 Double_t rtime = timer.RealTime();
171 Double_t ctime = timer.CpuTime();
172 LOG(debug) <<
"BSEmcExtractDigisFromWaveforms, Real time " << rtime <<
" s, CPU time " << ctime <<
" s";
188 FairRun *run = FairRun::Instance();
189 if (run ==
nullptr) {
190 Fatal(
"SetParContainers",
"No analysis run");
192 FairRuntimeDb *db = run->GetRuntimeDb();
194 Fatal(
"SetParContainers",
"No runtime database");
197 fDigiPar =
dynamic_cast<ParSet *
>(db->getContainer(ParSet::fgParameterName.c_str()));
203 t_digi_time /= sampleRate;
205 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