FairRoot/PandaRoot
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
PndMQTopixHitProducer Class Reference

#include <PndMQTopixHitProducer.h>

Public Member Functions

 PndMQTopixHitProducer ()
 
 PndMQTopixHitProducer (double dimX, double dimY, int maxcol, int maxrow)
 
virtual ~PndMQTopixHitProducer ()
 
PndSdsHit GetHit (std::vector< PndSdsDigiTopix4 > pixelArray)
 

Protected Member Functions

TGeoHMatrix GetTransformation (Int_t sensorID)
 
TVector3 GetSensorDimensions (Int_t sensorID)
 

Private Attributes

double fx
 
double fy
 
int fcol
 
int frow
 

Detailed Description

Definition at line 19 of file PndMQTopixHitProducer.h.

Constructor & Destructor Documentation

PndMQTopixHitProducer::PndMQTopixHitProducer ( )
PndMQTopixHitProducer::PndMQTopixHitProducer ( double  dimX,
double  dimY,
int  maxcol,
int  maxrow 
)

Definition at line 19 of file PndMQTopixHitProducer.cxx.

PndMQTopixHitProducer::~PndMQTopixHitProducer ( )
virtual

Definition at line 23 of file PndMQTopixHitProducer.cxx.

23  {
24 }

Member Function Documentation

PndSdsHit PndMQTopixHitProducer::GetHit ( std::vector< PndSdsDigiTopix4 pixelArray)

Definition at line 26 of file PndMQTopixHitProducer.cxx.

References col, count, Double_t, fcol, frow, fx, fy, GetSensorDimensions(), hit(), i, offset(), pos, row, sqrt(), and t.

Referenced by PndMQTopix4DigiToHit::Run().

27 {
28 // LOG(INFO) << "PrintHits for " << hits.size() << " hits";
29 // for (auto iter : hits){
30 // LOG(INFO) << iter;
31 // LOG(INFO) << iter.GetTimeStamp();
32 // }
33 //
34 // PndSdsHit theHit;
35 // return theHit;
36 
37  Double_t col = 0, row = 0, charge = 0;
38  Double_t tempCol = 0, tempRow = 0;
39  std::vector<Double_t> timeValues;
40  std::vector<Double_t> timeValueErrors;
41 
42  Int_t count = 0, mcindex=-1;
43  //Double_t local[2], master[2];
44  //TODO: Get away from default 10 Frontends per column?
45 // LOG(INFO) << "GetHit:";
46  if (pixelArray.size() == 1){
47  //LOG(INFO) << "SingleHitCluster";
48  col = pixelArray[0].GetPixelColumn() + ((Int_t)(pixelArray[0].GetFE()%10)) * fcol;
49  if (col < 0){
50  col -= 0.5;
51  col += frow / 2;
52  }
53  else col += 0.5;
54  row = pixelArray[0].GetPixelRow()+ (pixelArray[0].GetFE()/10) * frow;
55  if (row < 0){
56  row -= 0.5;
57  row += fx /2;
58  }
59  else row += 0.5;
60  // if (fVerbose > 1)
61  // LOG(INFO) << "GetCluster:col/row " << col << " " << row << std::endl;
62  count = 1;
63  charge = pixelArray[0].GetCharge();
64  PndSdsDigiTopix4 hit = pixelArray[0];
65 // LOG(INFO) << "SingleDigi: " << pixelArray[0];
66 // LOG(INFO) << "TimeStamp: " << pixelArray[0].GetCharge() << " " << pixelArray[0].GetTimeStamp();
67 // LOG(INFO) << "TimeStamp: " << hit.GetTimeStamp();
68 // LOG(INFO) << "SingleDigi: " << pixelArray[0];
69  timeValues.push_back(pixelArray[0].GetTimeStamp());
70  timeValueErrors.push_back(pixelArray[0].GetTimeStampError());
71 
72  }
73  else {
74 // LOG(INFO) << "Multiple Hits!";
75  for (UInt_t i = 0; i < pixelArray.size(); i++){
76  //cout << "ActCol / Row" << col << " " << row << " added Col/Row " << pixelArray[i].GetPixelColumn() << " " << pixelArray[i].GetPixelRow() << endl;
77  PndSdsDigiTopix4 hit = pixelArray[i];
78 // LOG(INFO) << i << " : Digi : " << pixelArray[i];
79 // LOG(INFO) << i << " : Digi : " << pixelArray[i].GetTimeStamp();
80 // LOG(INFO) << i << " : Digi : " << hit.GetTimeStamp();
81  tempCol = pixelArray[i].GetPixelColumn() + (Int_t)(pixelArray[0].GetFE()%10) * fcol;
82  tempRow = pixelArray[i].GetPixelRow() + pixelArray[0].GetFE()/10 * frow;
83  col += (tempCol*pixelArray[i].GetCharge());
84  row += (tempRow*pixelArray[i].GetCharge());
85  charge += pixelArray[i].GetCharge();
86  timeValues.push_back(pixelArray[i].GetTimeStamp());
87  timeValueErrors.push_back(pixelArray[i].GetTimeStampError());
88  count++;
89  }
90  if (count > 0){
91  if (charge > 0){
92  col /= charge;
93  row /= charge;
94  }
95  col += 0.5;
96  row += 0.5;
97  }
98  else col = row = 0;
99  }
100 
101  TVector3 offset = GetSensorDimensions(pixelArray[0].GetSensorID());
102  TVector3 locpos( col*fx - offset.X(), row*fy - offset.Y(), 0);
103  TVector3 pos = locpos;
104  pos.SetZ(6 * pixelArray[0].GetSensorID() + 10);
105 
106 // LOG(INFO) << "Calculated Position: " << col << "/" << row << " : " << pos.X() << "/" << pos.Y();
107 
108  Double_t errZ = 2.*GetSensorDimensions(pixelArray[0].GetSensorID()).Z();
109  TMatrixD locCov(3,3);
110  locCov[0][0]=fx*fx/12.;
111  locCov[1][1]=fy*fy/12.;
112  locCov[2][2]=errZ*errZ/12;
113  TMatrixD hitCov=locCov;
114  TVector3 dpos(sqrt(hitCov[0][0]),sqrt(hitCov[1][1]),sqrt(hitCov[2][2]));
115 // LOG(INFO) << "-I- PndMvdTopixHitProducer Error DPos: " << dpos.x() << " " << dpos.y() << " " << dpos.z() << std::endl;
116 
117  Double_t meanTime = 0;
118  //Double_t meanTimeError = 0;
119  Double_t sumVar = 0;
120 
121 // LOG(INFO) << "TimeCalculation:";
122  for (UInt_t t = 0; t < timeValues.size(); t++){
123 // LOG(INFO) << t << " : " << timeValues[t];
124  meanTime += timeValues[t] / (timeValueErrors[t] * timeValueErrors[t]);
125  sumVar += 1/(timeValueErrors[t] * timeValueErrors[t]);
126  }
127 
128  if (sumVar > 0)
129  meanTime /= sumVar;
130 
131 // LOG(INFO) << "MeanTime: " << meanTime;
132 
133 
134  PndSdsHit thehit(pixelArray[0].GetDetID(),pixelArray[0].GetSensorID(), pos, dpos, -1, charge, pixelArray.size(),mcindex);
135  //thehit.SetCov(hitCov);
136  thehit.SetTimeStamp(meanTime);
137  thehit.SetTimeStampError(1/sumVar);
138  //LOG(INFO) << "-I- PndMvdTopixHitProducer TimeStamp: " << tempTime/count << std::endl;
139  return thehit;
140 }
int row
Definition: anaLmdDigi.C:67
TVector3 pos
Int_t i
Definition: run_full.C:25
Data class to store the digi output of a pixel module.
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
Int_t GetPixelColumn() const
int col
Definition: anaLmdDigi.C:67
TVector3 offset(2, 0, 0)
Double_t
TVector3 GetSensorDimensions(Int_t sensorID)
int hit(Int_t nEvents=0, TString inFile="sim.root", TString parFile="par.root", TString inDigi="digi.root", TString outFile="hit.root", Int_t timeBased=0)
Definition: hit.C:1
TTree * t
Definition: bump_analys.C:13
int count
TMatrixT< double > TMatrixD
Definition: PndLmdDim.h:52
TVector3 PndMQTopixHitProducer::GetSensorDimensions ( Int_t  sensorID)
protected

Definition at line 153 of file PndMQTopixHitProducer.cxx.

Referenced by GetHit().

154 {
155  TVector3 result(0.2/2, 0.32/2,0.1/2);
156  return result;
157 }
TGeoHMatrix PndMQTopixHitProducer::GetTransformation ( Int_t  sensorID)
protected

Definition at line 142 of file PndMQTopixHitProducer.cxx.

References Double_t, and vec.

143 {
144 
145  TGeoHMatrix transMat;
146  Double_t vec[3];
147  vec[0] = 0.;
148  vec[1] = 0.;
149  vec[2] = sensorID * 6 + 10;
150  return transMat;
151 }
Double_t
dble_vec_t vec[12]
Definition: ranlxd.cxx:380

Member Data Documentation

int PndMQTopixHitProducer::fcol
private

Definition at line 32 of file PndMQTopixHitProducer.h.

Referenced by GetHit().

int PndMQTopixHitProducer::frow
private

Definition at line 32 of file PndMQTopixHitProducer.h.

Referenced by GetHit().

double PndMQTopixHitProducer::fx
private

Definition at line 31 of file PndMQTopixHitProducer.h.

Referenced by GetHit().

double PndMQTopixHitProducer::fy
private

Definition at line 31 of file PndMQTopixHitProducer.h.

Referenced by GetHit().


The documentation for this class was generated from the following files: