FairRoot/PandaRoot
Public Member Functions | Public Attributes | Protected Attributes | Private Member Functions | List of all members
PndSdsChargeWeightedPixelMapping 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 <PndSdsChargeWeightedPixelMapping.h>

Inheritance diagram for PndSdsChargeWeightedPixelMapping:
PndSdsPixelBackMapping PndLmdChargeWeightedPixelMapping PndMvdChargeWeightedPixelMapping

Public Member Functions

 PndSdsChargeWeightedPixelMapping ()
 
 PndSdsChargeWeightedPixelMapping (const PndSdsChargeWeightedPixelMapping &other)
 
 PndSdsChargeWeightedPixelMapping (PndGeoHandling *geo)
 
virtual ~PndSdsChargeWeightedPixelMapping ()
 
PndSdsChargeWeightedPixelMappingoperator= (PndSdsChargeWeightedPixelMapping &other)
 
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)
 

Public Attributes

std::vector< PndSdsDigiPixelfDigiArray
 
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.

PndSdsChargeWeightedPixelMapping.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 PndSdsChargeWeightedPixelMapping.h.

Constructor & Destructor Documentation

PndSdsChargeWeightedPixelMapping::PndSdsChargeWeightedPixelMapping ( )
PndSdsChargeWeightedPixelMapping::PndSdsChargeWeightedPixelMapping ( const PndSdsChargeWeightedPixelMapping other)
inline
PndSdsChargeWeightedPixelMapping::PndSdsChargeWeightedPixelMapping ( PndGeoHandling geo)
virtual PndSdsChargeWeightedPixelMapping::~PndSdsChargeWeightedPixelMapping ( )
inlinevirtual

Definition at line 28 of file PndSdsChargeWeightedPixelMapping.h.

28 {};

Member Function Documentation

PndSdsHit PndSdsChargeWeightedPixelMapping::GetCluster ( std::vector< PndSdsDigiPixel pixelArray)
virtual

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

Implements PndSdsPixelBackMapping.

Definition at line 24 of file PndSdsChargeWeightedPixelMapping.cxx.

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

Referenced by PndSdsIdealClusterTask::Exec().

25 {
26 fDigiArray = pixelArray;
27  Double_t col = 0, row = 0, charge = 0;
28  Double_t tempCol = 0, tempRow = 0;
29  std::vector<Double_t> timeValues;
30  std::vector<Double_t> timeValueErrors;
31 
32  Int_t count = 0, mcindex=-1;
33  //Double_t local[2], master[2];
34  //TODO: Get away from default 10 Frontends per column?
35 
36  if (fDigiArray.size() == 1){
38  col = fDigiArray[0].GetPixelColumn() + ((Int_t)(fDigiArray[0].GetFE()%10)) * fcols;
39  if (col < 0){
40  col -= 0.5;
41  col += frows / 2;
42  }
43  else col += 0.5;
44  row = fDigiArray[0].GetPixelRow()+ (fDigiArray[0].GetFE()/10) * frows;
45  if (row < 0){
46  row -= 0.5;
47  row += flx /2;
48  }
49  else row += 0.5;
50  if (fVerbose > 1)
51  std::cout << "GetCluster:col/row " << col << " " << row << std::endl;
52  count = 1;
54  for(Int_t mcI = 0; mcI<fDigiArray[0].GetNIndices();mcI++){
55  if (fDigiArray[0].GetIndex(mcI) > -1) {
56  mcindex = fDigiArray[0].GetIndex(mcI);
57  break;
58  }
59  }
60  timeValues.push_back(fDigiArray[0].GetTimeStamp());
61  timeValueErrors.push_back(fDigiArray[0].GetTimeStampError());
62  }
63  }
64  else {
65  //cout << "Multiple Hits!" << std::endl;
66  for (UInt_t i = 0; i < fDigiArray.size(); i++){
67  //cout << "ActCol / Row" << col << " " << row << " added Col/Row " << fDigiArray[i].GetPixelColumn() << " " << fDigiArray[i].GetPixelRow() << endl;
69  tempCol = fDigiArray[i].GetPixelColumn() + (Int_t)(fDigiArray[0].GetFE()%10) * fcols;
70  tempRow = fDigiArray[i].GetPixelRow() + fDigiArray[0].GetFE()/10 * frows;
71  col += (tempCol*fChargeConverter->DigiValueToCharge(fDigiArray[i]));
74  timeValues.push_back(fDigiArray[i].GetTimeStamp());
75  timeValueErrors.push_back(fDigiArray[i].GetTimeStampError());
76  count++;
77  if(mcindex < 0){
78  for(Int_t mcI = 0; mcI<fDigiArray[i].GetNIndices();mcI++){
79  if (fDigiArray[i].GetIndex(mcI) > -1) {
80  mcindex = fDigiArray[i].GetIndex(mcI);
81  break;
82  }
83  }
84  }//mcindex
85 
86  }
87  }
88  if (count > 0){
89  if (charge > 0){
90  col /= charge;
91  row /= charge;
92  }
93  col += 0.5;
94  row += 0.5;
95  }
96  else col = row = 0;
97  }
98  if (fVerbose > 1){
99  std::cout << "Col: " << col << " Row: " << row << std::endl;
100  }
101 
102  TVector3 offset = GetSensorDimensions(fDigiArray[0].GetSensorID());
103  TVector3 locpos( col*flx - offset.X(), row*fly - offset.Y(), 0);
104  TVector3 pos = fGeoH->LocalToMasterShortId(locpos,fDigiArray[0].GetSensorID());
105 
106  Double_t errZ = 2.*fGeoH->GetSensorDimensionsShortId(fDigiArray[0].GetSensorID()).Z();
107  TMatrixD locCov(3,3);
108  locCov[0][0]=flx*flx/12.;
109  locCov[1][1]=fly*fly/12.;
110  locCov[2][2]=errZ*errZ/12;
111  TMatrixD hitCov=fGeoH->LocalToMasterErrorsShortId(locCov,fDigiArray[0].GetSensorID());
112  TVector3 dpos(sqrt(hitCov[0][0]),sqrt(hitCov[1][1]),sqrt(hitCov[2][2]));
113  //std::cout << "-I- PndSdsChargeWeightedPixelMapping Error DPos: " << dpos.x() << " " << dpos.y() << " " << dpos.z() << std::endl;
114 
115  Double_t meanTime = 0;
116  //Double_t meanTimeError = 0;
117  Double_t sumVar = 0;
118 
119  for (UInt_t t = 0; t < timeValues.size(); t++){
120  meanTime += timeValues[t] / (timeValueErrors[t] * timeValueErrors[t]);
121  sumVar += 1/(timeValueErrors[t] * timeValueErrors[t]);
122  }
123 
124  if (sumVar > 0)
125  meanTime /= sumVar;
126 
127 
128 
129  PndSdsHit thehit(fDigiArray[0].GetDetID(),fDigiArray[0].GetSensorID(), pos, dpos, -1, charge, fDigiArray.size(),mcindex);
130  thehit.SetCov(hitCov);
131  thehit.SetTimeStamp(meanTime);
132  thehit.SetTimeStampError(1/sumVar);
133  //std::cout << "-I- PndSdsChargeWeightedPixelMapping TimeStamp: " << tempTime/count << std::endl;
134  return thehit;
135 }
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
std::vector< PndSdsDigiPixel > fDigiArray
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 PndSdsChargeWeightedPixelMapping::GetSensorDimensions ( Int_t  sensorID)
private

Definition at line 146 of file PndSdsChargeWeightedPixelMapping.cxx.

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

Referenced by GetCluster().

147 {
148  gGeoManager->cd(fGeoH->GetPath(sensorID));
149  TGeoVolume* actVolume = gGeoManager->GetCurrentVolume();
150  TGeoBBox* actBox = (TGeoBBox*)(actVolume->GetShape());
151  TVector3 result;
152  result.SetX(actBox->GetDX());
153  result.SetY(actBox->GetDY());
154  result.SetZ(actBox->GetDZ());
155 
156  //result.Dump();
157 
158  return result;
159 }
TGeoManager * gGeoManager
TString GetPath(Int_t shortID)
for a given shortID the path is returned
TGeoHMatrix PndSdsChargeWeightedPixelMapping::GetTransformation ( Int_t  sensorID)
private

Definition at line 137 of file PndSdsChargeWeightedPixelMapping.cxx.

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

138 {
139  gGeoManager->cd(fGeoH->GetPath(sensorID));
140  TGeoHMatrix* transMat = gGeoManager->GetCurrentMatrix();
141  if (fVerbose > 2)
142  transMat->Print("");
143  return *transMat;
144 }
TGeoManager * gGeoManager
TString GetPath(Int_t shortID)
for a given shortID the path is returned
PndSdsChargeWeightedPixelMapping& PndSdsChargeWeightedPixelMapping::operator= ( PndSdsChargeWeightedPixelMapping other)
inline
void PndSdsPixelBackMapping::SetVerbose ( Int_t  level)
inlineinherited

Definition at line 28 of file PndSdsPixelBackMapping.h.

References PndSdsPixelBackMapping::fVerbose.

Referenced by PndSdsIdealClusterTask::Init().

28 {fVerbose = level;};

Member Data Documentation

PndSdsChargeConversion* PndSdsChargeWeightedPixelMapping::fChargeConverter
protected
Int_t PndSdsChargeWeightedPixelMapping::fcols
protected
std::vector<PndSdsDigiPixel> PndSdsPixelBackMapping::fDigiArray
inherited

Definition at line 31 of file PndSdsPixelBackMapping.h.

Referenced by GetCluster(), and PndSdsPixelBackMapping::operator=().

PndGeoHandling* PndSdsPixelBackMapping::fGeoH
inherited
Double_t PndSdsChargeWeightedPixelMapping::flx
protected
Double_t PndSdsChargeWeightedPixelMapping::fly
protected
Int_t PndSdsChargeWeightedPixelMapping::frows
protected
Int_t PndSdsPixelBackMapping::fVerbose
inherited

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