"MarlinReco"  1.32.0
TPCDigiProcessor.h
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 
3 /*
4 Evolved version of TPCDigi that provides additional functionality to deal with background. Couple to the Mokka Sensitive Detector Driver TPCSD03.cc
5 
6 SJA:FIXME: Still needs to be tidied up for production release.
7 
8 Three cases can be consider in the treatment of SimTrackerHits
9 i) A clean isolated hit; this will be smeared according to the parametric point resolution and converted to a TrackerHit
10 ii) Two or Three hits which are considered to be closer than the double hit resolution and which therefore cannot be viewed as seperable hits. These will be merged and be assigned a large associated measurement error.
11 iii) A continuous set of hits within one pad row which cannot be resolved as single hits, these are condidered to be charaterisable as background hits created by extremely low pt charged particles (pt < 10MeV) and therefore are removed from the hit collection.
12 
13 The Driver has been modified to take an additional collection of SimTrackerHits which are produced by the Mokka TPC Sensitive Driver TPCSD03.cc. These hits are produced for particles which have very low pt and often do not move outside of the dimensions of a single pad row. These hits need to be treated differently as they do not cross any geometric boundaries in a Padrow based TPC Geometry. This negates the need to voxalise the TPC in Geant4 which has proved in the past to be prohibitive in terms of processing time due to the vastly increased number of geometric volumes.
14 
15 Steve Aplin 26 June 2009 (DESY)
16 
17 */
18 
19 #ifndef TPCDigiProcessor_h
20 #define TPCDigiProcessor_h 1
21 
22 #include <marlin/Processor.h>
23 #include <lcio.h>
24 
25 
26 #include <string>
27 #include <gsl/gsl_rng.h>
28 
29 #ifdef MARLIN_USE_AIDA
30 
31 #include <marlin/AIDAProcessor.h>
32 #include <AIDA/IHistogramFactory.h>
33 #include <AIDA/ICloud1D.h>
34 //#include <AIDA/IHistogram1D.h>
35 
36 
37 
38 //#define DIGIPLOTS
39 
40 
41 
42 #ifdef DIGIPLOTS
43 // includes all AIDA header files
44 #include <AIDA/AIDA.h>
45 #endif
46 
47 #endif
48 
49 #include <vector>
50 #include <map>
51 
52 #include <EVENT/LCCollection.h>
53 #include <IMPL/LCCollectionVec.h>
54 #include <EVENT/MCParticle.h>
55 #include <EVENT/SimTrackerHit.h>
56 #include <IMPL/TrackerHitImpl.h>
57 #include <UTIL/CellIDEncoder.h>
58 
59 #include "CLHEP/Vector/TwoVector.h"
60 class Voxel_tpc;
61 
62 
63 
64 
65 using namespace lcio ;
66 using namespace marlin ;
67 #ifdef MARLIN_USE_AIDA
68 using namespace AIDA ;
69 #endif
70 
71 
72 
117 class TPCDigiProcessor : public Processor {
118 
119 public:
120 
121  TPCDigiProcessor(const TPCDigiProcessor&) = delete;
122  TPCDigiProcessor& operator=(const TPCDigiProcessor&) = delete;
123 
124  virtual Processor* newProcessor() { return new TPCDigiProcessor ; }
125 
126 
127  TPCDigiProcessor() ;
128 
132  virtual void init() ;
133 
136  virtual void processRunHeader( LCRunHeader* run ) ;
137 
140  virtual void processEvent( LCEvent * evt ) ;
141 
142 
143  virtual void check( LCEvent * evt ) ;
144 
145 
148  virtual void end() ;
149 
150  void writeVoxelToHit( Voxel_tpc* aVoxel) ;
151  void writeMergedVoxelsToHit( std::vector <Voxel_tpc*>* hitList ) ;
152  void plotHelixHitResidual(MCParticle *mcp, CLHEP::Hep3Vector *thisPointRPhi);
153  double getPadPhi( CLHEP::Hep3Vector* thisPointRPhi, CLHEP::Hep3Vector* firstPointRPhi, CLHEP::Hep3Vector* middlePointRPhi, CLHEP::Hep3Vector* lastPointRPhi);
154  double getPadTheta( CLHEP::Hep3Vector* firstPointRPhi, CLHEP::Hep3Vector* middlePointRPhi, CLHEP::Hep3Vector* lastPointRPhi );
155 
156 protected:
157 
160  std::string _padRowHitColName{};
161  std::string _spacePointColName{};
162  std::string _lowPtHitscolName{};
163 
164 
167  std::string _TPCTrackerHitsCol{};
168  std::string _outRelColName{};
169 
170  bool _use_raw_hits_to_store_simhit_pointer{};
171 
172  int _rejectCellID0{};
173  float _padWidth{};
174 
175  int _nRun{};
176  int _nEvt{};
177 
178  EVENT::MCParticle* _mcp{};
179  EVENT::MCParticle* _previousMCP{};
180  EVENT::MCParticle* _nextMCP{};
181  EVENT::MCParticle* _nMinus2MCP{};
182  EVENT::MCParticle* _nPlus2MCP{};
183 
184  SimTrackerHit* _SimTHit{};
185  SimTrackerHit* _previousSimTHit{};
186  SimTrackerHit* _nextSimTHit{};
187  SimTrackerHit* _nPlus2SimHit{};
188  SimTrackerHit* _nMinus2SimHit{};
189 
190  // gsl random number generator
191  gsl_rng * _random{};
192 
193  bool _dontEncodeSide{};
194 
195  float _pointResoRPhi0{}; // Coefficient for RPhi point res independant of drift length
196  float _pointResoPadPhi{}; // Coefficient for the point res dependance on relative phi angle to the pad verticle
197  float _diffRPhi{}; // Coefficient for the rphi point res dependance on diffusion
198  int _nEff{}; // number of effective electrons
199 
200 
201  float _pointResoZ0{}; // Coefficient Z point res independant of drift length
202  float _diffZ{}; // Coefficient for the Z point res dependance on diffusion
203 
204  float _binningZ{};
205  float _binningRPhi{};
206  float _doubleHitResZ{};
207  float _doubleHitResRPhi{};
208  int _maxMerge{};
209 
210  int _nRechits{};
211 
212  std::vector< std::vector <Voxel_tpc *> > _tpcRowHits{};
213  std::map< Voxel_tpc *,SimTrackerHit *> _tpcHitMap{};
214  std::vector<float> _length{};
215  int lenpos{};
216 
217  LCCollectionVec* _trkhitVec{};
218  LCCollectionVec* _relCol{};
219  CellIDEncoder<TrackerHitImpl>* _cellid_encoder{};
220 
221  int _NSimTPCHits{};
222  int _NBackgroundSimTPCHits{};
223  int _NPhysicsSimTPCHits{};
224  int _NPhysicsAbove02GeVSimTPCHits{};
225  int _NPhysicsAbove1GeVSimTPCHits{};
226  int _NRecTPCHits{};
227 
228  int _NLostPhysicsTPCHits{};
229  int _NLostPhysicsAbove02GeVPtTPCHits{};
230  int _NLostPhysicsAbove1GeVPtTPCHits{};
231  int _NRevomedHits{};
232 
233 
234 #ifdef DIGIPLOTS
235  IAnalysisFactory * _AF{};
236  ITreeFactory * _TRF{};
237  ITree * _TREE{};
238  IHistogramFactory * _HF{};
239  IHistogram1D * _phiDiffHisto{};
240  IHistogram1D * _thetaDiffHisto{};
241  IHistogram1D * _phiRelHisto{};
242  IHistogram1D * _thetaRelHisto{};
243 
244  IHistogram1D * _phiDistHisto{};
245  IHistogram1D * _rPhiPullHisto{};
246  IHistogram1D * _rPhiDiffHisto{};
247  IHistogram1D * _zDiffHisto{};
248  IHistogram1D * _zPullHisto{};
249  IHistogram2D * _zSigmaVsZHisto{};
250  IHistogram1D * _zSigmaHisto{};
251  IHistogram1D * _rPhiSigmaHisto{};
252  IHistogram1D * _radiusCheckHisto{};
253  IHistogram1D * _ResidualsRPhiHisto{};
254 
255  IHistogram1D * _NSimTPCHitsHisto{};
256  IHistogram1D * _NBackgroundSimTPCHitsHisto{};
257  IHistogram1D * _NPhysicsSimTPCHitsHisto{};
258  IHistogram1D * _NPhysicsAbove02GeVSimTPCHitsHisto{};
259  IHistogram1D * _NPhysicsAbove1GeVSimTPCHitsHisto{};
260  IHistogram1D * _NRecTPCHitsHisto{};
261 
262  IHistogram1D * _NLostPhysicsTPCHitsHisto{};
263  IHistogram1D * _NLostPhysicsAbove02GeVPtTPCHitsHisto{};
264  IHistogram1D * _NLostPhysicsAbove1GeVPtTPCHitsHisto{};
265  IHistogram1D * _NRevomedHitsHisto{};
266 
267  IHistogram1D * _NKeptPhysicsTPCHitsHistoPercent{};
268  IHistogram1D * _NKeptPhysicsAbove02GeVPtTPCHitsHistoPercent{};
269  IHistogram1D * _NKeptPhysicsAbove1GeVPtTPCHitsHistoPercent{};
270 
271 #endif
272 
273 
274 } ;
275 
276 
277 
278 
279 #endif
====== TPCDigiProcessor ======
Definition: TPCDigiProcessor.h:117
Definition: voxel.h:11