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!";
89 LOG(debug) <<
"BSEmcExtractDigisFromWaveforms<ParSet>::Init: Registered " <<
fDigiBranchName;
96 LOG(error) <<
"BSEmcExtractDigisFromWaveforms<ParSet>::Init: " 97 <<
"No BSEmcWaveform array containing multi waveforms!";
103 if (
fPSA ==
nullptr) {
104 LOG(error) <<
"No PSA was defined. Aborting!";
110 LOG(debug) <<
"BSEmcExtractDigisFromWaveforms: Intialization successfull";
132 Double_t energy = NAN;
133 Double_t digi_time = NAN;
139 for (Int_t iWaveform = 0; iWaveform < nWaveforms; iWaveform++) {
146 for (Int_t iDeposit = 0; iDeposit < nDeposits; ++iDeposit) {
150 Double_t timestamp =
GetTimeStamp(theWaveform, digi_time);
154 myDigi->ResetLinks();
155 myDigi->AddLinks(theWaveform->GetLinksWithType(FairRootManager::Instance()->GetBranchId(
fMCDepositBranchName)));
156 FairMultiLinkedData mcdeplinks = myDigi->GetLinksWithType(FairRootManager::Instance()->GetBranchId(
fMCDepositBranchName));
157 for (
const FairLink &link : mcdeplinks.GetLinks()) {
160 LOG(debug) <<
"BSEmcExtractDigisFromWaveforms for " <<
fDetectorName <<
" created Digi(detId: " << detId <<
", energy: " << energy <<
", timestamp: " << timestamp
161 <<
") and has " << myDigi->GetLinksWithType(FairRootManager::Instance()->GetBranchId(
fMCDepositBranchName)).GetNLinks() <<
" links to EmcMCDeposits";
167 Double_t rtime = timer.RealTime();
168 Double_t ctime = timer.CpuTime();
169 LOG(debug) <<
"BSEmcExtractDigisFromWaveforms, Real time " << rtime <<
" s, CPU time " << ctime <<
" s";
185 FairRun *run = FairRun::Instance();
186 if (run ==
nullptr) {
187 Fatal(
"SetParContainers",
"No analysis run");
189 FairRuntimeDb *db = run->GetRuntimeDb();
191 Fatal(
"SetParContainers",
"No runtime database");
194 fDigiPar =
dynamic_cast<ParSet *
>(db->getContainer(ParSet::fgParameterName.c_str()));
200 t_digi_time /= sampleRate;
202 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