CbmRoot
CbmMvdSensorFindHitTask.h
Go to the documentation of this file.
1 // -------------------------------------------------------------------------
2 // ----- CbmMvdSensorFindHitTask header file -----
3 // ----- Created 11/09/13 P.Sitzmann -----
4 // -------------------------------------------------------------------------
5 
6 
7 #ifndef CBMMVDSENSORFINDHITTASK_H
8 #define CBMMVDSENSORFINDHITTASK_H 1
9 
10 #include "CbmMvdDigi.h"
11 #include "CbmMvdPoint.h"
12 #include "FairTask.h"
13 
14 #include "TArrayS.h"
15 #include "TCanvas.h"
16 #include "TObjArray.h"
17 #include "TRefArray.h"
18 
19 
20 #include "TH1.h"
21 #include "TH1F.h"
22 #include "TH2.h"
23 #include "TMath.h"
24 #include "TRandom3.h"
25 #include "TStopwatch.h"
26 #include "TString.h"
27 #include <list>
28 #include <map>
29 #include <utility>
30 #include <vector>
31 
32 #include "CbmMvdSensor.h"
33 #include "CbmMvdSensorTask.h"
34 
35 class TClonesArray;
36 class TRandom3;
38 
40 
41 public:
44 
45 
50  CbmMvdSensorFindHitTask(Int_t mode);
51 
52 
54  virtual ~CbmMvdSensorFindHitTask();
55 
56 
58  void ExecChain();
59  void Exec();
60 
62  void InitTask(CbmMvdSensor* mySensor);
63 
64  virtual void SetInputDigi(CbmMvdDigi* digi) {
65  new ((*fInputBuffer)[fInputBuffer->GetEntriesFast()])
66  CbmMvdDigi(*((CbmMvdDigi*) digi));
67  inputSet = kTRUE;
68  }
69 
71  //Double_t GetSigmaX() const { return fSigmaX; };
72 
74  void SetSigmaNoise(Double_t sigmaNoise, Bool_t addNoise) {
75  fSigmaNoise = sigmaNoise;
76  fAddNoise = addNoise;
77  }
78  void SetSeedThreshold(Double_t seedCharge) { fSeedThreshold = seedCharge; }
79  void SetNeighbourThreshold(Double_t neighCharge) {
80  fNeighThreshold = neighCharge;
81  }
96  void SetAdcDynamic(Int_t adcDynamic) { fAdcDynamic = adcDynamic; };
97  void SetAdcOffset(Int_t adcOffset) { fAdcOffset = adcOffset; };
98  void SetAdcBits(Int_t adcBits) { fAdcBits = adcBits; };
99  Int_t GetAdcCharge(Float_t charge);
100 
103  void SetHitPosErrX(Double_t errorX) { fHitPosErrX = errorX; }
104  void SetHitPosErrY(Double_t errorY) { fHitPosErrY = errorY; }
105  void SetHitPosErrZ(Double_t errorZ) { fHitPosErrZ = errorZ; }
107 
108 
109  //protected:
110 protected:
111  // ---------- Protected data members ------------------------------------
112 
113  Int_t fAdcDynamic;
114  Int_t fAdcOffset;
115  Int_t fAdcBits;
116  Int_t fAdcSteps;
117  Float_t fAdcStepSize;
118 
119  TClonesArray* fDigis;
120  TClonesArray* fHits;
121  TClonesArray* fClusters;
122 
123 
124  TObjArray* fPixelChargeHistos;
126 
127  // Debug Histograms
135  Float_t* fGausArray;
138 
139  std::map<std::pair<Int_t, Int_t>, Int_t> fDigiMap;
140  std::map<std::pair<Int_t, Int_t>, Int_t>::iterator fDigiMapIt;
141 
142 
143  TH2F* h;
144  TH2F* h3;
145  TH1F* h1;
146  TH1F* h2;
147  TH1F* Qseed;
149 
150  TCanvas* c1;
151 
152 private:
153  Int_t fNEvent;
154  Int_t fMode;
155  Int_t fCounter;
156  Double_t fSigmaNoise;
157  Double_t fSeedThreshold;
158  Double_t fNeighThreshold;
160  Bool_t fUseMCInfo;
161  Bool_t inputSet;
162 
163 
164  Double_t fLayerRadius;
166  Double_t fLayerPosZ;
167  Double_t fHitPosX;
168  Double_t fHitPosY;
169  Double_t fHitPosZ;
170  Double_t fHitPosErrX;
171  Double_t fHitPosErrY;
172  Double_t fHitPosErrZ;
173 
174  TString fBranchName;
175 
177  static const Short_t fChargeArraySize =
178  7; //must be an odd number >3, recommended numbers= 5 or 7
179 
180  Bool_t fAddNoise;
181 
183 
185 
186  // ----- Private methods ---------------------------------------------
187 
188 
190  void Reset();
191 
193  void Finish();
194 
195 
197  InitStatus ReInit();
198 
199 
203  Int_t GetMvdGeometry();
204 
205 
206  void SetMvdGeometry(Int_t detId);
207  void AddNoiseToDigis(CbmMvdDigi* digi);
208  // void GenerateFakeDigis(Double_t pixelSizeX, Double_t pixelSizeY);
209  void CheckForNeighbours(std::vector<Int_t>* clusterArray,
210  Int_t clusterDigi,
211  TArrayS* pixelUsed);
212 
213  void
214  CreateHit(std::vector<Int_t>* clusterArray, TVector3& pos, TVector3& dpos);
215  void ComputeCenterOfGravity(std::vector<Int_t>* clusterArray,
216  TVector3& pos,
217  TVector3& dpos);
218  void UpdateDebugHistos(std::vector<Int_t>* clusterArray,
219  Int_t seedIndexX,
220  Int_t seedIndexY);
221 
222 private:
225 
227 };
228 
229 
230 #endif
231 
232 /* fGausArray=new Float_t[fGausArrayLimit];
233  for(Int_t i=0;i<fGausArrayLimit;i++){fGausArray[i]=gRandom->Gaus(0, fSigmaNoise);};
234  fGausArrayIt=0;
235 */
CbmMvdSensorFindHitTask::fGausArray
Float_t * fGausArray
Definition: CbmMvdSensorFindHitTask.h:135
CbmMvdSensorFindHitTask::SetHitPosErrZ
void SetHitPosErrZ(Double_t errorZ)
Definition: CbmMvdSensorFindHitTask.h:105
CbmMvdSensorFindHitTask::fMode
Int_t fMode
Definition: CbmMvdSensorFindHitTask.h:154
CbmMvdSensorFindHitTask::ComputeCenterOfGravity
void ComputeCenterOfGravity(std::vector< Int_t > *clusterArray, TVector3 &pos, TVector3 &dpos)
Definition: CbmMvdSensorFindHitTask.cxx:796
CbmMvdSensorFindHitTask::fResolutionHistoCleanY
TH1F * fResolutionHistoCleanY
Definition: CbmMvdSensorFindHitTask.h:131
CbmMvdSensorFindHitTask::fHitPosErrX
Double_t fHitPosErrX
Definition: CbmMvdSensorFindHitTask.h:170
CbmMvdSensorFindHitTask::CheckForNeighbours
void CheckForNeighbours(std::vector< Int_t > *clusterArray, Int_t clusterDigi, TArrayS *pixelUsed)
Definition: CbmMvdSensorFindHitTask.cxx:481
CbmMvdSensorFindHitTask::fAdcBits
Int_t fAdcBits
Definition: CbmMvdSensorFindHitTask.h:115
CbmMvdSensorFindHitTask::GetAdcCharge
Int_t GetAdcCharge(Float_t charge)
Definition: CbmMvdSensorFindHitTask.cxx:982
CbmMvdSensorFindHitTask::fHits
TClonesArray * fHits
Definition: CbmMvdSensorFindHitTask.h:120
CbmMvdPileupManager
Definition: CbmMvdPileupManager.h:28
CbmMvdSensorFindHitTask::fDigis
TClonesArray * fDigis
Definition: CbmMvdSensorFindHitTask.h:119
CbmMvdDigi.h
CbmMvdSensorFindHitTask::fNEvent
Int_t fNEvent
Definition: CbmMvdSensorFindHitTask.h:153
CbmMvdSensorFindHitTask::GetMvdGeometry
Int_t GetMvdGeometry()
CbmMvdSensorFindHitTask::fHitPosErrZ
Double_t fHitPosErrZ
Definition: CbmMvdSensorFindHitTask.h:172
CbmMvdSensorFindHitTask::fUseMCInfo
Bool_t fUseMCInfo
Definition: CbmMvdSensorFindHitTask.h:160
CbmMvdSensorFindHitTask::fBranchName
TString fBranchName
Definition: CbmMvdSensorFindHitTask.h:174
CbmMvdSensor.h
CbmMvdSensorFindHitTask::fSeedThreshold
Double_t fSeedThreshold
Definition: CbmMvdSensorFindHitTask.h:157
CbmMvdSensorFindHitTask::Qseed
TH1F * Qseed
Definition: CbmMvdSensorFindHitTask.h:147
CbmMvdSensorFindHitTask::fLayerRadiusInner
Double_t fLayerRadiusInner
Definition: CbmMvdSensorFindHitTask.h:165
CbmMvdSensorFindHitTask::fCounter
Int_t fCounter
Definition: CbmMvdSensorFindHitTask.h:155
CbmMvdSensorFindHitTask::SetSigmaNoise
void SetSigmaNoise(Double_t sigmaNoise, Bool_t addNoise)
Definition: CbmMvdSensorFindHitTask.h:74
CbmMvdSensorFindHitTask::fHitPosY
Double_t fHitPosY
Definition: CbmMvdSensorFindHitTask.h:168
CbmMvdSensorFindHitTask::CbmMvdSensorFindHitTask
CbmMvdSensorFindHitTask()
Definition: CbmMvdSensorFindHitTask.cxx:60
CbmMvdSensorFindHitTask::fHitPosZ
Double_t fHitPosZ
Definition: CbmMvdSensorFindHitTask.h:169
CbmMvdSensorFindHitTask::ShowDebugHistograms
void ShowDebugHistograms()
Definition: CbmMvdSensorFindHitTask.h:106
CbmMvdSensorFindHitTask::fLayerPosZ
Double_t fLayerPosZ
Definition: CbmMvdSensorFindHitTask.h:166
CbmMvdSensorFindHitTask::AddNoiseToDigis
void AddNoiseToDigis(CbmMvdDigi *digi)
Definition: CbmMvdSensorFindHitTask.cxx:413
CbmMvdSensorFindHitTask::c1
TCanvas * c1
Definition: CbmMvdSensorFindHitTask.h:150
CbmMvdSensorFindHitTask::fResolutionHistoX
TH1F * fResolutionHistoX
Definition: CbmMvdSensorFindHitTask.h:128
CbmMvdSensorFindHitTask::fDigiMapIt
std::map< std::pair< Int_t, Int_t >, Int_t >::iterator fDigiMapIt
Definition: CbmMvdSensorFindHitTask.h:140
CbmMvdSensorTask
Definition: CbmMvdSensorTask.h:26
CbmMvdSensorFindHitTask::fLayerRadius
Double_t fLayerRadius
Definition: CbmMvdSensorFindHitTask.h:164
CbmMvdSensorFindHitTask::fNeighThreshold
Double_t fNeighThreshold
Definition: CbmMvdSensorFindHitTask.h:158
CbmMvdSensorFindHitTask::InitTask
void InitTask(CbmMvdSensor *mySensor)
Definition: CbmMvdSensorFindHitTask.cxx:191
CbmMvdPoint.h
CbmMvdSensorFindHitTask::~CbmMvdSensorFindHitTask
virtual ~CbmMvdSensorFindHitTask()
Definition: CbmMvdSensorFindHitTask.cxx:171
CbmMvdSensor
Definition: CbmMvdSensor.h:40
dpos
TVector3 dpos
Definition: CbmMvdSensorDigiToHitTask.cxx:61
CbmMvdSensorFindHitTask::fBadHitHisto
TH2F * fBadHitHisto
Definition: CbmMvdSensorFindHitTask.h:134
CbmMvdSensorFindHitTask::fGausArrayIt
Int_t fGausArrayIt
Definition: CbmMvdSensorFindHitTask.h:136
CbmMvdSensorFindHitTask::SetSeedThreshold
void SetSeedThreshold(Double_t seedCharge)
Definition: CbmMvdSensorFindHitTask.h:78
CbmMvdSensorFindHitTask::operator=
CbmMvdSensorFindHitTask operator=(const CbmMvdSensorFindHitTask &)
CbmMvdSensorFindHitTask
Definition: CbmMvdSensorFindHitTask.h:39
CbmMvdSensorFindHitTask::ReInit
InitStatus ReInit()
Definition: CbmMvdSensorFindHitTask.cxx:223
CbmMvdSensorFindHitTask::fAdcOffset
Int_t fAdcOffset
Definition: CbmMvdSensorFindHitTask.h:114
CbmMvdSensorFindHitTask::Reset
void Reset()
Definition: CbmMvdSensorFindHitTask.cxx:996
CbmMvdSensorFindHitTask::SetHitPosErrX
void SetHitPosErrX(Double_t errorX)
Definition: CbmMvdSensorFindHitTask.h:103
CbmMvdSensorFindHitTask::Finish
void Finish()
Definition: CbmMvdSensorFindHitTask.cxx:897
CbmMvdSensorFindHitTask::fShowDebugHistos
Bool_t fShowDebugHistos
Definition: CbmMvdSensorFindHitTask.h:159
CbmMvdSensorFindHitTask::h
TH2F * h
Definition: CbmMvdSensorFindHitTask.h:143
CbmMvdSensorFindHitTask::fResolutionHistoY
TH1F * fResolutionHistoY
Definition: CbmMvdSensorFindHitTask.h:129
CbmMvdSensorFindHitTask::fAddNoise
Bool_t fAddNoise
Definition: CbmMvdSensorFindHitTask.h:180
CbmMvdSensorFindHitTask::fTotalChargeInNpixelsArray
TObjArray * fTotalChargeInNpixelsArray
Definition: CbmMvdSensorFindHitTask.h:125
CbmMvdSensorFindHitTask::fResolutionHistoMergedY
TH1F * fResolutionHistoMergedY
Definition: CbmMvdSensorFindHitTask.h:133
CbmMvdSensorFindHitTask::fResolutionHistoCleanX
TH1F * fResolutionHistoCleanX
Definition: CbmMvdSensorFindHitTask.h:130
CbmMvdSensorFindHitTask::fAdcDynamic
Int_t fAdcDynamic
Definition: CbmMvdSensorFindHitTask.h:113
CbmMvdSensorFindHitTask::SetInputDigi
virtual void SetInputDigi(CbmMvdDigi *digi)
Definition: CbmMvdSensorFindHitTask.h:64
CbmMvdSensorFindHitTask::fClusters
TClonesArray * fClusters
Definition: CbmMvdSensorFindHitTask.h:121
CbmMvdSensorFindHitTask::fDigiMap
std::map< std::pair< Int_t, Int_t >, Int_t > fDigiMap
Definition: CbmMvdSensorFindHitTask.h:139
CbmMvdSensorFindHitTask::Exec
void Exec()
Definition: CbmMvdSensorFindHitTask.cxx:235
CbmMvdSensorFindHitTask::SetAdcBits
void SetAdcBits(Int_t adcBits)
Definition: CbmMvdSensorFindHitTask.h:98
CbmMvdSensorFindHitTask::fFullClusterHisto
TH1F * fFullClusterHisto
Definition: CbmMvdSensorFindHitTask.h:148
CbmMvdSensorFindHitTask::SetHitPosErrY
void SetHitPosErrY(Double_t errorY)
Definition: CbmMvdSensorFindHitTask.h:104
CbmMvdSensorFindHitTask::ExecChain
void ExecChain()
Definition: CbmMvdSensorFindHitTask.cxx:231
CbmMvdSensorFindHitTask::CreateHit
void CreateHit(std::vector< Int_t > *clusterArray, TVector3 &pos, TVector3 &dpos)
Definition: CbmMvdSensorFindHitTask.cxx:545
CbmMvdSensorTask::fInputBuffer
TClonesArray * fInputBuffer
Definition: CbmMvdSensorTask.h:53
CbmMvdSensorFindHitTask::fPixelChargeHistos
TObjArray * fPixelChargeHistos
Definition: CbmMvdSensorFindHitTask.h:124
CbmMvdSensorFindHitTask::fChargeArraySize
static const Short_t fChargeArraySize
Definition: CbmMvdSensorFindHitTask.h:177
CbmMvdSensorFindHitTask::SetNeighbourThreshold
void SetNeighbourThreshold(Double_t neighCharge)
Definition: CbmMvdSensorFindHitTask.h:79
CbmMvdSensorFindHitTask::fGausArrayLimit
Int_t fGausArrayLimit
Definition: CbmMvdSensorFindHitTask.h:137
CbmMvdSensorFindHitTask::fSigmaNoise
Double_t fSigmaNoise
Definition: CbmMvdSensorFindHitTask.h:156
CbmMvdSensorFindHitTask::h3
TH2F * h3
Definition: CbmMvdSensorFindHitTask.h:144
CbmMvdSensorFindHitTask::fHitPosErrY
Double_t fHitPosErrY
Definition: CbmMvdSensorFindHitTask.h:171
CbmMvdSensorFindHitTask::SetAdcDynamic
void SetAdcDynamic(Int_t adcDynamic)
Definition: CbmMvdSensorFindHitTask.h:96
CbmMvdSensorFindHitTask::fHitPosX
Double_t fHitPosX
Definition: CbmMvdSensorFindHitTask.h:167
CbmMvdSensorFindHitTask::SetMvdGeometry
void SetMvdGeometry(Int_t detId)
CbmMvdSensorFindHitTask::UpdateDebugHistos
void UpdateDebugHistos(std::vector< Int_t > *clusterArray, Int_t seedIndexX, Int_t seedIndexY)
Definition: CbmMvdSensorFindHitTask.cxx:652
CbmMvdSensorFindHitTask::fAdcStepSize
Float_t fAdcStepSize
Definition: CbmMvdSensorFindHitTask.h:117
CbmMvdDigi
Definition: CbmMvdDigi.h:21
CbmMvdSensorFindHitTask::fDigisInCluster
Int_t fDigisInCluster
Definition: CbmMvdSensorFindHitTask.h:176
pos
TVector3 pos
Definition: CbmMvdSensorDigiToHitTask.cxx:60
CbmMvdSensorFindHitTask::SetAdcOffset
void SetAdcOffset(Int_t adcOffset)
Definition: CbmMvdSensorFindHitTask.h:97
CbmMvdSensorFindHitTask::inputSet
Bool_t inputSet
Definition: CbmMvdSensorFindHitTask.h:161
CbmMvdSensorFindHitTask::ClassDef
ClassDef(CbmMvdSensorFindHitTask, 1)
CbmMvdSensorTask.h
CbmMvdSensorFindHitTask::h1
TH1F * h1
Definition: CbmMvdSensorFindHitTask.h:145
CbmMvdSensorFindHitTask::h2
TH1F * h2
Definition: CbmMvdSensorFindHitTask.h:146
CbmMvdSensorFindHitTask::CbmMvdSensorFindHitTask
CbmMvdSensorFindHitTask(const CbmMvdSensorFindHitTask &)
CbmMvdSensorFindHitTask::fAdcSteps
Int_t fAdcSteps
Definition: CbmMvdSensorFindHitTask.h:116
CbmMvdSensorFindHitTask::fResolutionHistoMergedX
TH1F * fResolutionHistoMergedX
Definition: CbmMvdSensorFindHitTask.h:132