All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
SiStripClus.h
Go to the documentation of this file.
1 // //////////////////////////////////////////////////////////////////////// //
2 // //
3 // SiStripClus - Marlin Processor - provides clustering in Si strip sensors //
4 // //
5 // //////////////////////////////////////////////////////////////////////// //
6 
7 #ifndef SISTRIPCLUS_H
8 #define SISTRIPCLUS_H 1
9 
10 // Define ROOT output if needed
11 //#define ROOT_OUTPUT
12 
13 #include <vector>
14 #include <queue>
15 
16 // Include CLHEP header files
17 #include <CLHEP/Vector/ThreeVector.h>
18 
19 // Include Clus header files
20 #include "StripCluster.h"
21 #include "SiStripDigi.h"
22 #include "SiStripGeom.h"
23 
24 // Include LCIO header files
25 #include <lcio.h>
26 #include <EVENT/LCCollection.h>
27 #include <UTIL/LCRelationNavigator.h>
28 #include <IMPL/TrackerPulseImpl.h>
29 
30 // Include Marlin
31 #include <marlin/Global.h>
32 #include <marlin/Processor.h>
33 
34 // ROOT classes
35 #ifdef ROOT_OUTPUT
36 #include <TFile.h>
37 #include <TTree.h>
38 #endif
39 
40 // Namespaces
41 using namespace lcio;
42 using namespace marlin;
43 
44 /**
45 \addtogroup SiStripDigi SiStripDigi
46 @{
47 */
48 
49 namespace sistrip {
50 
51 // Typedefs
52 typedef const std::vector< std::string > ConstStringVec;
53 typedef std::vector< StripCluster * > ClsVec;
54 typedef std::vector< double * > DoubleVec;
55 typedef std::vector< LCCollection *> LCCollectionVec;
56 typedef std::vector< std::string > StringVec;
57 typedef std::queue < std::string > StringQue;
58 
59 /**
60 \addtogroup SiStripClus SiStripClus
61 \ingroup SiStripDigi
62 @{
63 Marlin processor intended for cluster finding - uses digitized data worked out with SiStripDigi.
64 //!
65 //! @author Z. Drasal, Charles University Prague
66 //!
67 */
68 
69 class SiStripClus : public Processor
70 {
71  public:
72 
73  //!Method that returns a new instance of this processor
74  virtual Processor * newProcessor() { return new SiStripClus(); }
75 
76  //!Constructor - set processor description and register processor parameters
77  SiStripClus();
78 
79  //!Method called at the beginning of data processing - used for initialization
80  virtual void init();
81 
82  //!Method called for each run - used for run header processing
83  virtual void processRunHeader(LCRunHeader * run);
84 
85  //!Method called for each event - used for event data processing
86  virtual void processEvent(LCEvent * event);
87 
88  //!Method called after each event - used for data checking
89  virtual void check(LCEvent * event);
90 
91  //!Method called after all data processing
92  virtual void end();
93 
94  protected:
95  // MAIN CLUSTER METHOD
96 
97  //!Method searching for clusters - first, strips above _SNseed threshold, so-called seed
98  //!strips, are defined. Then the strips adjacent to the seeds and above _SNadjacent
99  //!threshold are extracted. Finally, clusters taken as Gaussian are calculated (if total
100  //!charge is above _SNtotal threshold) and their mean positions and sigmas are saved in either
101  //!R-Phi or Z. Finally, they are mixed into 3D cluster. (input parameter: sensor map
102  //!of strips with total integrated charge, output parameter: sensor map of clusters
103  //!found by this algorithm)
104  ClsVec findClus(SensorStripMap & sensorMap);
105 
106  // OTHER METHODS
107  //!Method calculating hits from given clusters
108  void calcHits(ClsVec & clsVec, IMPL::LCCollectionVec * colOfTrkHits);
109 
110  //!Method calculating hit resolution, i.e. covariance matrix
111  float * calcResolution(const int & layerID, const double & hitTheta,
112  const double & posZ);
113 
114  //!Method to update and store the Sensor strip map
115  void updateMap(TrackerPulseImpl * pulse,
116  SensorStripMap & sensorMap );
117  //!Method to release memory of the SensorStripMap
118  void releaseMap(SensorStripMap & sensorMap);
119 
120  // PRINT METHODS
121  //!Method printing processor parameters
122  void printProcessorParams() const;
123 
124  //!Method printing hit info
125  void printHitInfo(const StripCluster * pCluster) const;
126 
127  // VARIABLES
128 
129  // Collection names
130  std::string _inColName; //!< LCIO input collection name
131  std::string _outColName; //!< LCIO output collection name
132  std::string _relColNamePlsToSim; //!< LCIO input relation collection name - TrackerPulse <-> SimTrkHit
133 
134  // ClusterFinder parameters - set by users
135  float _CMSnoise; //!< Common mode subtracted noise, set in ENC
136  float _SNseed; //!< Signal to noise ratio cut for seed strips
137  float _SNadjacent; //!< Signal to noise ratio cut for adjacent strips
138  float _SNtotal; //!< Signal to noise ratio cut for total cluster
139 
140  // Compensate Lorentz shift - set by users
141  //float _TanOfAvgELorentzShift; //!< Tangent of electrons' average Lorentz shift
142  float _TanOfAvgHLorentzShift; //!< Tangent of holes' average Lorentz shift
143 
144  // Geometry parameters
145  bool _floatStripsRPhi; //!< Is every even strip floating in R-Phi?
146  bool _floatStripsZ; //!< Is every even strip floating in Z?
147  SiStripGeom * _geometry; //!< All geometry information from Gear xml file
148 
149  // SVD resolution
150  std::vector<float> _resSVDFirstInRPhi; //!< Mean strip resolution in RPhi - 1st layer; in [mm]
151  std::vector<float> _resSVDOtherInRPhi; //!< Mean strip resolution in RPhi - other layers; in [mm]
152  std::vector<float> _resSVDFirstInZ; //!< Mean strip resolution in Z - 1st layer; in [mm]
153  std::vector<float> _resSVDOtherInZ; //!< Mean strip resolution in Z - other layers; in [mm]
154 
155  // Relation navigators
156  LCRelationNavigator * _navigatorPls;
157 
158  // Pitch
159  double _pitchFront; //!< Pitch in the middle of the front sensor
160  double _pitchRear; //!< Pitch in the middle of the rear sensor
161 
162  std::string _subdetector; //!< Name of the subdetector to be clusterize
163 
164  // Root output
165 #ifdef ROOT_OUTPUT
166 
167  TFile * _rootFile;
168  TTree * _rootTree;
169 
170  int _rootEvtNum; //!< Event number to which the hit belongs
171 
172  int _rootLayerID;
173  int _rootLadderID;
174  int _rootSensorID;
175 
176  // In R-Phi
177  double _rootSimRPhi; //!< Simulated hit position in R-Phi (SimTrackerHit with heighest weight taken)
178  double _rootRecRPhi; //!< Reconstructed hit position in R-Phi
179  double _rootClsSizeRPhi; //!< Cluster size in R-Phi
180  int _rootMCPDGRPhi; //!< PDG of particle which created current hit in R-Phi (MC Particle with highest weight)
181 
182  // Residuals
183  double _rootResRPhi; //!< Residual RPhi direction
184  double _rootResR; //!< Residual R direction
185  double _rootResModule; //!< Residual Module (distance between
186  //! simHit and recHit in the sensor plane)
187 
188  // In Z
189  double _rootSimZ; //!< Simulated hit position in Z (SimTrackerHit with heighest weight taken)
190  double _rootRecZ; //!< Reconstructed hit position in Z
191  double _rootClsSizeZ; //!< Cluster size in Z
192  int _rootMCPDGZ; //!< PDG of particle which created current hit in Z (MC Particle with highest weight)
193 #endif
194 
195 
196  private:
197 
198  int _nRun; //!< Run number
199  int _nEvent; //!< Event number
200 
201  //
202  //! Calculated and stored the hits adjacents
203  template<class It>
204  StripChargeMap & storeHitsAdjacents( StripChargeMap & clsStripsIn,
205  It schmap, const It & endIt, StripChargeMap & cM);
206 };
207 /** @} */
208 
209 } // Namespace
210 
211 /** @} */
212 
213 #endif //SISTRIPCLUS_H
double _pitchRear
Pitch in the middle of the rear sensor.
Definition: SiStripClus.h:160
std::vector< double * > DoubleVec
Definition: SiStripClus.h:54
float _SNtotal
Signal to noise ratio cut for total cluster.
Definition: SiStripClus.h:138
This class holds all information about strip clusters, where the strip cluster is defined as a bunch ...
Definition: StripCluster.h:24
float _TanOfAvgHLorentzShift
Tangent of holes&#39; average Lorentz shift.
Definition: SiStripClus.h:142
bool _floatStripsZ
Is every even strip floating in Z?
Definition: SiStripClus.h:146
std::string _outColName
LCIO output collection name.
Definition: SiStripClus.h:131
std::vector< float > _resSVDOtherInZ
Mean strip resolution in Z - other layers; in [mm].
Definition: SiStripClus.h:153
std::vector< float > _resSVDFirstInRPhi
Mean strip resolution in RPhi - 1st layer; in [mm].
Definition: SiStripClus.h:150
Gear geometry class - holds all geometry information about silicon strip sensors. ...
Definition: SiStripGeom.h:59
std::map< int, StripChargeMap * > SensorStripMap
Definition: SiStripDigi.h:142
std::string _relColNamePlsToSim
LCIO input relation collection name - TrackerPulse &lt;-&gt; SimTrkHit.
Definition: SiStripClus.h:132
float _SNadjacent
Signal to noise ratio cut for adjacent strips.
Definition: SiStripClus.h:137
const std::vector< std::string > ConstStringVec
Definition: SiStripClus.h:52
std::vector< float > _resSVDOtherInRPhi
Mean strip resolution in RPhi - other layers; in [mm].
Definition: SiStripClus.h:151
std::vector< float > _resSVDFirstInZ
Mean strip resolution in Z - 1st layer; in [mm].
Definition: SiStripClus.h:152
int _nRun
Run number.
Definition: SiStripClus.h:198
SiStripGeom * _geometry
All geometry information from Gear xml file.
Definition: SiStripClus.h:147
float _CMSnoise
Common mode subtracted noise, set in ENC.
Definition: SiStripClus.h:135
bool _floatStripsRPhi
Is every even strip floating in R-Phi?
Definition: SiStripClus.h:145
std::queue< std::string > StringQue
Definition: SiStripClus.h:57
int _nEvent
Event number.
Definition: SiStripClus.h:199
virtual Processor * newProcessor()
Method that returns a new instance of this processor.
Definition: SiStripClus.h:74
std::vector< LCCollection * > LCCollectionVec
Definition: SiStripClus.h:55
std::string _inColName
LCIO input collection name.
Definition: SiStripClus.h:130
std::vector< StripCluster * > ClsVec
Definition: SiStripClus.h:53
std::map< int, Signal * > StripChargeMap
Definition: SiStripDigi.h:141
double _pitchFront
Pitch in the middle of the front sensor.
Definition: SiStripClus.h:159
LCRelationNavigator * _navigatorPls
Definition: SiStripClus.h:156
float _SNseed
Signal to noise ratio cut for seed strips.
Definition: SiStripClus.h:136
std::vector< std::string > StringVec
Definition: SiStripClus.h:56
std::string _subdetector
Name of the subdetector to be clusterize.
Definition: SiStripClus.h:162