ATTPCROOT  0.3.0-alpha
A ROOT-based framework for analyzing data from active target detectors
AtPSAHitPerTB.cxx
Go to the documentation of this file.
1 #include "AtPSAHitPerTB.h"
2 
3 #include "AtHit.h"
4 #include "AtPad.h" // for AtPad
5 
6 #include <FairLogger.h>
7 
8 #include <Math/Point2D.h> // for PositionVector2D
9 #include <Math/Point3D.h> // for PositionVector3D
10 #include <Math/Point3Dfwd.h> // for XYZPoint
11 
12 #include <array> // for array
13 #include <iostream> // for basic_ostream::operator<<, operator<<
14 #include <memory> // for allocator_traits<>::value_type
15 #include <utility> // for pair
16 #include <vector>
17 /*
18 #ifdef _OPENMP
19 #include <omp.h>
20 #endif
21 */
24 {
25  auto pos = pad->GetPadCoord();
26  if ((pos.X() < -9000 || pos.Y() < -9000) && pad->GetPadNum() != -1)
27  LOG(error) << " AtPSAHitPErTB::Analysis Warning! Wrong Coordinates for Pad : " << pad->GetPadNum() << std::endl;
28 
29  if (!(pad->IsPedestalSubtracted())) {
30  LOG(ERROR) << "Pedestal should be subtracted to use this class!";
31  // return;
32  }
33 
34  HitVector hits;
35  auto adc = pad->GetADC();
36  double traceIntegral = 0;
37  for (Int_t iTb = 0; iTb < fNumTbs; iTb++) {
38 
39  // We are above threshold, so create a hit
40  if (adc[iTb] > getThreshold(pad->GetSizeID())) {
41 
42  // This allows to constrain the calculation of the charge avoiding noisy timebuckets
43  if (iTb > fIniTB && iTb < fEndTB)
44  traceIntegral += adc[iTb];
45 
46  auto hit = std::make_unique<AtHit>(pad->GetPadNum(), XYZPoint(pos.X(), pos.Y(), CalculateZGeo(iTb)), adc[iTb]);
47  hit->SetTimeStamp(iTb);
48  hits.push_back(std::move(hit));
49  } // if Threshold
50  }
51 
52  // Loop through all hits and add traceIntegral
53  for (auto &hit : hits)
54  hit->SetTraceIntegral(traceIntegral);
55 
56  return hits;
57 }
58 
59 void AtPSAHitPerTB::SetTBLimits(std::pair<Int_t, Int_t> limits)
60 {
61  if (limits.first >= limits.second) {
62  std::cout << " Warning AtPSA::SetTBLimits - Wrong Time Bucket limits. Setting default limits (0,512) ... "
63  << "\n";
64  fIniTB = 0;
65  fEndTB = 512;
66 
67  } else {
68  fIniTB = limits.first;
69  fEndTB = limits.second;
70  }
71 }
72 
AtPad.h
AtPSA::CalculateZGeo
Double_t CalculateZGeo(Double_t peakIdx)
Definition: AtPSA.cxx:90
ClassImp
ClassImp(AtFindVertex)
AtPSAHitPerTB
Definition: AtPSAHitPerTB.h:16
AtPad::GetSizeID
Int_t GetSizeID() const
Definition: AtPad.h:98
AtPSA::HitVector
std::vector< std::unique_ptr< AtHit > > HitVector
Definition: AtPSA.h:50
AtPSA::fNumTbs
Int_t fNumTbs
Definition: AtPSA.h:44
XYZPoint
ROOT::Math::XYZPoint XYZPoint
Definition: AtPatternCircle2D.h:18
AtPSAHitPerTB::AnalyzePad
virtual HitVector AnalyzePad(AtPad *pad) override
Definition: AtPSAHitPerTB.cxx:23
AtPad::GetPadCoord
XYPoint GetPadCoord() const
Definition: AtPad.h:107
AtPSA::getThreshold
Double_t getThreshold(int padSize=-1)
Definition: AtPSA.cxx:179
AtHit.h
XYZPoint
ROOT::Math::XYZPoint XYZPoint
Definition: AtPSAHitPerTB.cxx:22
AtPSAHitPerTB.h
AtPad::GetPadNum
Int_t GetPadNum() const
Definition: AtPad.h:96
AtPad::GetADC
const trace & GetADC() const
Definition: AtPad.cxx:97
AtPad::IsPedestalSubtracted
Bool_t IsPedestalSubtracted() const
Definition: AtPad.h:94
AtPSAHitPerTB::fEndTB
Int_t fEndTB
Definition: AtPSAHitPerTB.h:19
AtPad
Container class for AtPadBase objects.
Definition: AtPad.h:38
AtPSAHitPerTB::SetTBLimits
void SetTBLimits(std::pair< Int_t, Int_t > limits)
Definition: AtPSAHitPerTB.cxx:59
AtPSAHitPerTB::fIniTB
Int_t fIniTB
Definition: AtPSAHitPerTB.h:18