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

PndSdsChargedWeightedPixelMapping: Gets a vector of DigiHits and calculates the cluster center weighted with the charge params: Number of columns in FE, Number of rows in FE, Pixel dimension in x, Pixel dimension in y params are taken from parameter database. More...

#include <PndMQSdsChargeWeightedPixelMapping.h>

Inheritance diagram for PndMQSdsChargeWeightedPixelMapping:
PndMQSdsPixelBackMapping PndMQMvdChargeWeightedPixelMapping

Public Member Functions

 PndMQSdsChargeWeightedPixelMapping ()
 
virtual ~PndMQSdsChargeWeightedPixelMapping ()
 
 PndMQSdsChargeWeightedPixelMapping (PndGeoHandling *geo)
 
PndSdsHit GetCluster (std::vector< PndSdsDigiPixel * > &pixelArray)
 Main function of class to calculate the PndSdsHit out of the given PndSdsDigis. More...
 
void SetVerbose (Int_t level)
 
virtual void SetGeoHandling (PndGeoHandling *geo)
 

Public Attributes

PndGeoHandlingfGeoH
 
Int_t fVerbose
 

Protected Attributes

PndSdsChargeConversionfChargeConverter
 
Double_t flx
 
Double_t fly
 
Int_t fcols
 
Int_t frows
 

Private Member Functions

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

Detailed Description

PndSdsChargedWeightedPixelMapping: Gets a vector of DigiHits and calculates the cluster center weighted with the charge params: Number of columns in FE, Number of rows in FE, Pixel dimension in x, Pixel dimension in y params are taken from parameter database.

PndMQSdsChargeWeightedPixelMapping.h

Author
T.Stockmanns t.sto.nosp@m.ckma.nosp@m.nns@f.nosp@m.z-ju.nosp@m.elich.nosp@m..de

Definition at line 15 of file PndMQSdsChargeWeightedPixelMapping.h.

Constructor & Destructor Documentation

PndMQSdsChargeWeightedPixelMapping::PndMQSdsChargeWeightedPixelMapping ( )
virtual PndMQSdsChargeWeightedPixelMapping::~PndMQSdsChargeWeightedPixelMapping ( )
inlinevirtual

Definition at line 19 of file PndMQSdsChargeWeightedPixelMapping.h.

19 {};
PndMQSdsChargeWeightedPixelMapping::PndMQSdsChargeWeightedPixelMapping ( PndGeoHandling geo)

Member Function Documentation

PndSdsHit PndMQSdsChargeWeightedPixelMapping::GetCluster ( std::vector< PndSdsDigiPixel * > &  pixelArray)
virtual

Main function of class to calculate the PndSdsHit out of the given PndSdsDigis.

Implements PndMQSdsPixelBackMapping.

Definition at line 15 of file PndMQSdsChargeWeightedPixelMapping.cxx.

References col, count, PndSdsChargeConversion::DigiValueToCharge(), Double_t, fChargeConverter, fcols, PndMQSdsPixelBackMapping::fGeoH, flx, fly, frows, PndMQSdsPixelBackMapping::fVerbose, GetSensorDimensions(), PndGeoHandling::GetSensorDimensionsShortId(), i, PndGeoHandling::LocalToMasterErrorsShortId(), PndGeoHandling::LocalToMasterShortId(), offset(), pos, row, PndSdsHit::SetCov(), sqrt(), and t.

Referenced by PndMQMvdPixelDigiProcessorBursts::ProcessData(), and PndMQFileSinkBursts::Run().

16 {
17  Double_t col = 0, row = 0, charge = 0;
18  Double_t tempCol = 0, tempRow = 0;
19  std::vector<Double_t> timeValues;
20  std::vector<Double_t> timeValueErrors;
21 
22  Int_t count = 0, mcindex=-1;
23  //Double_t local[2], master[2];
24  //TODO: Get away from default 10 Frontends per column?
25 
26  if (pixelArray.size() == 1){
27  if (fChargeConverter->DigiValueToCharge(*pixelArray[0]) > 0){
28  col = pixelArray[0]->GetPixelColumn() + ((Int_t)(pixelArray[0]->GetFE()%10)) * fcols;
29  if (col < 0){
30  col -= 0.5;
31  col += frows / 2;
32  }
33  else col += 0.5;
34  row = pixelArray[0]->GetPixelRow()+ (pixelArray[0]->GetFE()/10) * frows;
35  if (row < 0){
36  row -= 0.5;
37  row += flx /2;
38  }
39  else row += 0.5;
40  if (fVerbose > 1)
41  std::cout << "GetCluster:col/row " << col << " " << row << std::endl;
42  count = 1;
43  charge = fChargeConverter->DigiValueToCharge(*pixelArray[0]);
44  for(Int_t mcI = 0; mcI<pixelArray[0]->GetNIndices();mcI++){
45  if (pixelArray[0]->GetIndex(mcI) > -1) {
46  mcindex = pixelArray[0]->GetIndex(mcI);
47  break;
48  }
49  }
50  timeValues.push_back(pixelArray[0]->GetTimeStamp());
51  timeValueErrors.push_back(pixelArray[0]->GetTimeStampError());
52  }
53  }
54  else {
55  //cout << "Multiple Hits!" << std::endl;
56  for (UInt_t i = 0; i < pixelArray.size(); i++){
57  //cout << "ActCol / Row" << col << " " << row << " added Col/Row " << pixelArray[i].GetPixelColumn() << " " << pixelArray[i].GetPixelRow() << endl;
58  if (fChargeConverter->DigiValueToCharge(*pixelArray[i]) > 0){
59  tempCol = pixelArray[i]->GetPixelColumn() + (Int_t)(pixelArray[0]->GetFE()%10) * fcols;
60  tempRow = pixelArray[i]->GetPixelRow() + pixelArray[0]->GetFE()/10 * frows;
61  col += (tempCol*fChargeConverter->DigiValueToCharge(*pixelArray[i]));
62  row += (tempRow*fChargeConverter->DigiValueToCharge(*pixelArray[i]));
63  charge += fChargeConverter->DigiValueToCharge(*pixelArray[i]);
64  timeValues.push_back(pixelArray[i]->GetTimeStamp());
65  timeValueErrors.push_back(pixelArray[i]->GetTimeStampError());
66  count++;
67  if(mcindex < 0){
68  for(Int_t mcI = 0; mcI<pixelArray[i]->GetNIndices();mcI++){
69  if (pixelArray[i]->GetIndex(mcI) > -1) {
70  mcindex = pixelArray[i]->GetIndex(mcI);
71  break;
72  }
73  }
74  }//mcindex
75 
76  }
77  }
78  if (count > 0){
79  if (charge > 0){
80  col /= charge;
81  row /= charge;
82  }
83  col += 0.5;
84  row += 0.5;
85  }
86  else col = row = 0;
87  }
88  if (fVerbose > 1){
89  std::cout << "Col: " << col << " Row: " << row << std::endl;
90  }
91 
92  TVector3 offset = GetSensorDimensions(pixelArray[0]->GetSensorID());
93  TVector3 locpos( col*flx - offset.X(), row*fly - offset.Y(), 0);
94  TVector3 pos = fGeoH->LocalToMasterShortId(locpos,pixelArray[0]->GetSensorID());
95 
96  Double_t errZ = 2.*fGeoH->GetSensorDimensionsShortId(pixelArray[0]->GetSensorID()).Z();
97  TMatrixD locCov(3,3);
98  locCov[0][0]=flx*flx/12.;
99  locCov[1][1]=fly*fly/12.;
100  locCov[2][2]=errZ*errZ/12;
101  TMatrixD hitCov=fGeoH->LocalToMasterErrorsShortId(locCov,pixelArray[0]->GetSensorID());
102  TVector3 dpos(sqrt(hitCov[0][0]),sqrt(hitCov[1][1]),sqrt(hitCov[2][2]));
103  //std::cout << "-I- PndMQSdsChargeWeightedPixelMapping Error DPos: " << dpos.x() << " " << dpos.y() << " " << dpos.z() << std::endl;
104 
105  Double_t meanTime = 0;
106  //Double_t meanTimeError = 0;
107  Double_t sumVar = 0;
108 
109  for (UInt_t t = 0; t < timeValues.size(); t++){
110  meanTime += timeValues[t] / (timeValueErrors[t] * timeValueErrors[t]);
111  sumVar += 1/(timeValueErrors[t] * timeValueErrors[t]);
112  }
113 
114  if (sumVar > 0)
115  meanTime /= sumVar;
116 
117 
118 
119  PndSdsHit thehit(pixelArray[0]->GetDetID(),pixelArray[0]->GetSensorID(), pos, dpos, -1, charge, pixelArray.size(),mcindex);
120  thehit.SetCov(hitCov);
121  thehit.SetTimeStamp(meanTime);
122  thehit.SetTimeStampError(1/sumVar);
123  //std::cout << "-I- PndMQSdsChargeWeightedPixelMapping TimeStamp: " << tempTime/count << std::endl;
124  return thehit;
125 }
int row
Definition: anaLmdDigi.C:67
TVector3 pos
Int_t i
Definition: run_full.C:25
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
int col
Definition: anaLmdDigi.C:67
TVector3 offset(2, 0, 0)
virtual Double_t DigiValueToCharge(Double_t digi)=0
Converts a given digitized charge into charge in electrons.
TVector3 GetSensorDimensionsShortId(Int_t shortId)
TMatrixD LocalToMasterErrorsShortId(const TMatrixD &local, const Int_t &shortId)
Double_t
TVector3 LocalToMasterShortId(const TVector3 &local, const Int_t &shortId)
TTree * t
Definition: bump_analys.C:13
int count
void SetCov(TMatrixD cov)
Definition: PndSdsHit.cxx:70
TMatrixT< double > TMatrixD
Definition: PndLmdDim.h:52
TVector3 PndMQSdsChargeWeightedPixelMapping::GetSensorDimensions ( Int_t  sensorID)
private

Definition at line 136 of file PndMQSdsChargeWeightedPixelMapping.cxx.

References PndMQSdsPixelBackMapping::fGeoH, PndGeoHandling::GetPath(), and gGeoManager.

Referenced by GetCluster().

137 {
138  gGeoManager->cd(fGeoH->GetPath(sensorID));
139  TGeoVolume* actVolume = gGeoManager->GetCurrentVolume();
140  TGeoBBox* actBox = (TGeoBBox*)(actVolume->GetShape());
141  TVector3 result;
142  result.SetX(actBox->GetDX());
143  result.SetY(actBox->GetDY());
144  result.SetZ(actBox->GetDZ());
145 
146  //result.Dump();
147 
148  return result;
149 }
TGeoManager * gGeoManager
TString GetPath(Int_t shortID)
for a given shortID the path is returned
TGeoHMatrix PndMQSdsChargeWeightedPixelMapping::GetTransformation ( Int_t  sensorID)
private

Definition at line 127 of file PndMQSdsChargeWeightedPixelMapping.cxx.

References PndMQSdsPixelBackMapping::fGeoH, PndMQSdsPixelBackMapping::fVerbose, PndGeoHandling::GetPath(), and gGeoManager.

128 {
129  gGeoManager->cd(fGeoH->GetPath(sensorID));
130  TGeoHMatrix* transMat = gGeoManager->GetCurrentMatrix();
131  if (fVerbose > 2)
132  transMat->Print("");
133  return *transMat;
134 }
TGeoManager * gGeoManager
TString GetPath(Int_t shortID)
for a given shortID the path is returned
virtual void PndMQSdsPixelBackMapping::SetGeoHandling ( PndGeoHandling geo)
inlinevirtualinherited
void PndMQSdsPixelBackMapping::SetVerbose ( Int_t  level)
inlineinherited

Member Data Documentation

PndSdsChargeConversion* PndMQSdsChargeWeightedPixelMapping::fChargeConverter
protected
Int_t PndMQSdsChargeWeightedPixelMapping::fcols
protected
PndGeoHandling* PndMQSdsPixelBackMapping::fGeoH
inherited
Double_t PndMQSdsChargeWeightedPixelMapping::flx
protected
Double_t PndMQSdsChargeWeightedPixelMapping::fly
protected
Int_t PndMQSdsChargeWeightedPixelMapping::frows
protected
Int_t PndMQSdsPixelBackMapping::fVerbose
inherited

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