ATTPCROOT  0.3.0-alpha
A ROOT-based framework for analyzing data from active target detectors
AtPSAIterDeconv.cxx
Go to the documentation of this file.
1 #include "AtPSAIterDeconv.h"
2 
3 #include "AtPad.h"
4 #include "AtPadArray.h"
5 #include "AtPadBase.h" // for AtPadBase
6 #include "AtPadFFT.h"
7 
8 #include <Math/Point3D.h>
9 #include <Math/Point3Dfwd.h> // for XYZPoint
10 #include <TVirtualFFT.h>
11 
12 #include <memory>
13 #include <utility> // for move, pair
14 
16 
17 // AtPSAIterDeconv::AtPSAIterDeconv() : AtPSADeconv() {};
18 
20 {
21  RunPad(pad);
22 
23  // If saving the charge from the iterations to a different augment, make that augment
24  if (fQName != "Qreco") {
25  auto charge = std::make_unique<AtPadArray>();
26  // Fill the charge pad
27  for (int i = 0; i < 512; ++i)
28  charge->SetArray(i, dynamic_cast<AtPadArray *>(pad->GetAugment("Qreco"))->GetArray(i));
29  pad->AddAugment(fQName, std::move(charge));
30  }
31 
32  auto respPad = GetResponse(pad->GetPadNum());
33  auto diffPad = std::make_unique<AtPad>(pad->GetPadNum());
34 
35  for (int i = 0; i < fIterations; i++) {
36  for (int r = 0; r < 512; r++) {
37  double reconSig = 0;
38  for (int a = 0; a < r + 1; a++) {
39  reconSig += dynamic_cast<AtPadArray *>(pad->GetAugment(fQName))->GetArray(a) * respPad.GetADC(r - a);
40  }
41  diffPad->SetADC(r, pad->GetADC(r) - reconSig);
42  }
43  auto testPad = std::make_unique<AtPad>(pad->GetPadNum());
44  testPad->SetADC(diffPad->GetADC());
45  RunPad(testPad.get());
46 
47  for (int r = 0; r < 512; r++) {
48  auto charge = dynamic_cast<AtPadArray *>(pad->GetAugment(fQName))->GetArray(r);
49  charge += dynamic_cast<AtPadArray *>(testPad->GetAugment("Qreco"))->GetArray(r);
50  dynamic_cast<AtPadArray *>(pad->GetAugment(fQName))->SetArray(r, charge);
51  }
52  }
53 
54  return chargeToHits(*pad, fQName);
55 }
56 
58 {
59  // If this pad does not contains FFT information, then add FFT data to this pad.
60  if (dynamic_cast<AtPadFFT *>(pad->GetAugment("fft")) == nullptr) {
61  fFFT->SetPoints(pad->GetADC().data());
62  fFFT->Transform();
63  pad->AddAugment("fft", AtPadFFT::CreateFromFFT(fFFT.get()));
64  }
65 
66  // Now process the pad
67  AnalyzeFFTpad(*pad);
68 }
AtPad.h
AtPadFFT::CreateFromFFT
static std::unique_ptr< AtPadFFT > CreateFromFFT(const TVirtualFFT *fft)
Definition: AtPadFFT.cxx:112
AtPadArray::GetArray
const traceDouble & GetArray() const
Definition: AtPadArray.h:37
AtPSAIterDeconv::AnalyzePad
virtual HitVector AnalyzePad(AtPad *pad) override
Definition: AtPSAIterDeconv.cxx:19
AtPSADeconv::chargeToHits
virtual HitVector chargeToHits(AtPad &charge, std::string qName)
Definition: AtPSADeconv.cxx:235
AtPSADeconv::fFFT
std::unique_ptr< TVirtualFFT > fFFT
Definition: AtPSADeconv.h:59
AtPSA::HitVector
std::vector< std::unique_ptr< AtHit > > HitVector
Definition: AtPSA.h:50
AtPSADeconv::GetResponse
AtPad & GetResponse(int padNum)
Get the AtPad describing the response of the electronics.
Definition: AtPSADeconv.cxx:70
XYZPoint
ROOT::Math::XYZPoint XYZPoint
Definition: AtPatternCircle2D.h:18
AtPadArray.h
XYZPoint
ROOT::Math::XYZPoint XYZPoint
Definition: AtPSAIterDeconv.cxx:15
AtPadFFT
Definition: AtPadFFT.h:19
AtPSAIterDeconv::RunPad
void RunPad(AtPad *pad)
Definition: AtPSAIterDeconv.cxx:57
AtPad::GetAugment
AtPadBase * GetAugment(std::string name)
Definition: AtPad.cxx:82
AtPad::GetPadNum
Int_t GetPadNum() const
Definition: AtPad.h:96
AtPad::GetADC
const trace & GetADC() const
Definition: AtPad.cxx:97
AtPSAIterDeconv.h
AtPadArray
Holds an addition array of doubles for an AtPad.
Definition: AtPadArray.h:24
AtPadFFT.h
AtPad
Container class for AtPadBase objects.
Definition: AtPad.h:38
AtPadBase.h
AtPSADeconv::AnalyzeFFTpad
HitVector AnalyzeFFTpad(AtPad &pad)
Assumes that the pad has it's fourier transform information filled.
Definition: AtPSADeconv.cxx:176
AtPad::AddAugment
AtPadBase * AddAugment(std::string name, std::unique_ptr< AtPadBase > augment)
Definition: AtPad.cxx:63