"MarlinReco"  1.16.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  virtual Processor* newProcessor() { return new TPCDigiProcessor ; }
122 
123 
124  TPCDigiProcessor() ;
125 
129  virtual void init() ;
130 
133  virtual void processRunHeader( LCRunHeader* run ) ;
134 
137  virtual void processEvent( LCEvent * evt ) ;
138 
139 
140  virtual void check( LCEvent * evt ) ;
141 
142 
145  virtual void end() ;
146 
147  void writeVoxelToHit( Voxel_tpc* aVoxel) ;
148  void writeMergedVoxelsToHit( std::vector <Voxel_tpc*>* hitList ) ;
149  void plotHelixHitResidual(MCParticle *mcp, CLHEP::Hep3Vector *thisPointRPhi);
150  double getPadPhi( CLHEP::Hep3Vector* thisPointRPhi, CLHEP::Hep3Vector* firstPointRPhi, CLHEP::Hep3Vector* middlePointRPhi, CLHEP::Hep3Vector* lastPointRPhi);
151  double getPadTheta( CLHEP::Hep3Vector* firstPointRPhi, CLHEP::Hep3Vector* middlePointRPhi, CLHEP::Hep3Vector* lastPointRPhi );
152 
153 protected:
154 
157  std::string _padRowHitColName ;
158  std::string _spacePointColName ;
159  std::string _lowPtHitscolName ;
160 
161 
164  std::string _TPCTrackerHitsCol ;
165  std::string _outRelColName ;
166 
167  bool _use_raw_hits_to_store_simhit_pointer;
168 
169  int _rejectCellID0;
170  float _padWidth;
171 
172  int _nRun ;
173  int _nEvt ;
174 
175  EVENT::MCParticle* _mcp;
176  EVENT::MCParticle* _previousMCP;
177  EVENT::MCParticle* _nextMCP;
178  EVENT::MCParticle* _nMinus2MCP;
179  EVENT::MCParticle* _nPlus2MCP;
180 
181  SimTrackerHit* _SimTHit;
182  SimTrackerHit* _previousSimTHit;
183  SimTrackerHit* _nextSimTHit;
184  SimTrackerHit* _nPlus2SimHit;
185  SimTrackerHit* _nMinus2SimHit;
186 
187  // gsl random number generator
188  gsl_rng * _random ;
189 
190  bool _dontEncodeSide ;
191 
192  float _pointResoRPhi0; // Coefficient for RPhi point res independant of drift length
193  float _pointResoPadPhi; // Coefficient for the point res dependance on relative phi angle to the pad verticle
194  float _diffRPhi; // Coefficient for the rphi point res dependance on diffusion
195  int _nEff; // number of effective electrons
196 
197 
198  float _pointResoZ0; // Coefficient Z point res independant of drift length
199  float _diffZ; // Coefficient for the Z point res dependance on diffusion
200 
201  float _binningZ;
202  float _binningRPhi;
203  float _doubleHitResZ;
204  float _doubleHitResRPhi;
205  int _maxMerge;
206 
207  int _nRechits;
208 
209  std::vector< std::vector <Voxel_tpc *> > _tpcRowHits;
210  std::map< Voxel_tpc *,SimTrackerHit *> _tpcHitMap;
211  std::vector<float> _length;
212  int lenpos;
213 
214  LCCollectionVec* _trkhitVec;
215  LCCollectionVec* _relCol;
216  CellIDEncoder<TrackerHitImpl>* _cellid_encoder ;
217 
218  int _NSimTPCHits;
219  int _NBackgroundSimTPCHits;
220  int _NPhysicsSimTPCHits;
221  int _NPhysicsAbove02GeVSimTPCHits;
222  int _NPhysicsAbove1GeVSimTPCHits;
223  int _NRecTPCHits;
224 
225  int _NLostPhysicsTPCHits;
226  int _NLostPhysicsAbove02GeVPtTPCHits;
227  int _NLostPhysicsAbove1GeVPtTPCHits;
228  int _NRevomedHits;
229 
230 
231 #ifdef DIGIPLOTS
232  IAnalysisFactory * _AF;
233  ITreeFactory * _TRF;
234  ITree * _TREE;
235  IHistogramFactory * _HF;
236  IHistogram1D * _phiDiffHisto;
237  IHistogram1D * _thetaDiffHisto;
238  IHistogram1D * _phiRelHisto;
239  IHistogram1D * _thetaRelHisto;
240 
241  IHistogram1D * _phiDistHisto;
242  IHistogram1D * _rPhiPullHisto;
243  IHistogram1D * _rPhiDiffHisto;
244  IHistogram1D * _zDiffHisto;
245  IHistogram1D * _zPullHisto;
246  IHistogram2D * _zSigmaVsZHisto;
247  IHistogram1D * _zSigmaHisto;
248  IHistogram1D * _rPhiSigmaHisto;
249  IHistogram1D * _radiusCheckHisto;
250  IHistogram1D * _ResidualsRPhiHisto;
251 
252  IHistogram1D * _NSimTPCHitsHisto;
253  IHistogram1D * _NBackgroundSimTPCHitsHisto;
254  IHistogram1D * _NPhysicsSimTPCHitsHisto;
255  IHistogram1D * _NPhysicsAbove02GeVSimTPCHitsHisto;
256  IHistogram1D * _NPhysicsAbove1GeVSimTPCHitsHisto;
257  IHistogram1D * _NRecTPCHitsHisto;
258 
259  IHistogram1D * _NLostPhysicsTPCHitsHisto;
260  IHistogram1D * _NLostPhysicsAbove02GeVPtTPCHitsHisto;
261  IHistogram1D * _NLostPhysicsAbove1GeVPtTPCHitsHisto;
262  IHistogram1D * _NRevomedHitsHisto;
263 
264  IHistogram1D * _NKeptPhysicsTPCHitsHistoPercent;
265  IHistogram1D * _NKeptPhysicsAbove02GeVPtTPCHitsHistoPercent;
266  IHistogram1D * _NKeptPhysicsAbove1GeVPtTPCHitsHistoPercent;
267 
268 #endif
269 
270 
271 } ;
272 
273 
274 
275 
276 #endif
277 
278 
279 
std::string _padRowHitColName
Input collection name.
Definition: TPCDigiProcessor.h:157
std::string _TPCTrackerHitsCol
Output collection name.
Definition: TPCDigiProcessor.h:164
====== TPCDigiProcessor ======
Definition: TPCDigiProcessor.h:117
Definition: voxel.h:11