otsdaq  v1_01_02
 All Classes Namespaces Functions
Event.h
1 /************************************************************************************************
2 ** Authors: Dario Menasce, Stefano Terzo
3 **
4 ** I.N.F.N. Milan-Bicocca
5 ** Piazza della Scienza 3, Edificio U2
6 ** Milano, 20126
7 **
8 **
9 ** This is the header of the event class. An event is basically a collection of the following
10 ** quantities:
11 **
12 ** 1] raw data hits (identified by row/column on a plaquette in the telescope)
13 ** 2] the corresponding cluster coordinates (obtained by collapsing clusters of adjacent raw
14 ** data hits into a single x/y pair of coordinates by appliying a charge sharing algorithm)
15 ** 3] fitted tracks (obtained by fitting strings of aligned cluster-hits to a straight line in
16 ** space: these strings are identified by a road-search algorithm with a user defined
17 * tolerance in the x/y projections).
18 ** 4] unconstrained fit residuals, chi2 and covariances of the reconstructed tracks
19 **
20 ** Below is a description of the basic data structures which are made persistent to disk by
21 ** compiling the C++ code derived by this header with rootcint.
22 **
23 ** ----------------------------------------------------------------------------------------------
24 ** The raw data produced by each plaquette
25 **
26 ** map<string, vector<map<string , int> > > theRawData_
27 ** | | | |
28 ** | | | +--------------> value
29 ** | | +---------------------> row | col | adc
30 ** | +---------------------------------> vector of hits
31 ** +----------------------------------------> plaquette ID
32 **
33 ** ----------------------------------------------------------------------------------------------
34 ** The cluster hit coordinates/errors computed for each plaquette by using the charge sharing
35 ** wheighting. The x/y coordinates are computed in the local plaquette reference frame.
36 **
37 ** map<string, map<int, map<string, double> > > clusters_
38 ** | | | |
39 ** | | | +------------> value
40 ** | | +--------------------> x | y | xErr | yErr | charge
41 ** | +------------------------------> cluster ID number
42 ** +----------------------------------------> plaquette ID
43 **
44 ** ----------------------------------------------------------------------------------------------
45 ** The clusters found for each plaquette: each cluster (an assembly of contiguous hits).
46 ** To get the corresponding coordinates (after charge sharing has been applyed), use the
47 ** clusters_ container above using the "cluster ID number" to match.
48 **
49 ** map<string, map<int, vector<map<string, int > > > > clustersHits_
50 ** | | | | |
51 ** | | | | +------> value
52 ** | | | +------------> row | col | adc | charge | size
53 ** | | +------------------------> vector of row/column hits
54 ** | +------------------------------> cluster ID number
55 ** +----------------------------------------> plaquette ID
56 **
57 ** ----------------------------------------------------------------------------------------------
58 ** A vector (parallel to trackCandidates_) containing the chi2 of the fit
59 **
60 ** vector<double> fittedTracksChi2_
61 ** |
62 ** +-------------------------------------> value
63 **
64 ** ----------------------------------------------------------------------------------------------
65 ** The vector of fitted tracks: for each plaquette the coordinates/errors of the cluster hits
66 ** used for the final fit are provided in the laboratory reference frame. Additionally it is
67 ** possible to gain access to the cluster used to perform the fit by means of the "cluster ID"
68 **
69 ** vector<map<string, map<string, double> > > trackCandidates_
70 ** | | | |
71 ** | | | +--------------> value
72 ** | | +----------------------> x | y | z | xErr | yErr | errZ | size | cluster ID
73 ** | +----------------------------------> plaquette ID
74 ** +---------------------------------------------> vector of track candidates
75 **
76 ** ----------------------------------------------------------------------------------------------
77 ** The unconstrained residuals of the fitted tracks on the two projections. This vector is
78 ** strictly parallel to fittedTrackDeviations_.
79 **
80 ** map<unsigned int, map<string, pair<double, double> > > fittedTrackResiduals_
81 ** | | | |
82 ** | | | +--> xRes
83 ** | | +----------> yRes
84 ** | +----------------------> plaquette ID
85 ** +----------------------------------------> a progressive number (an ID)
86 **
87 ** ----------------------------------------------------------------------------------------------
88 ** The constrained residuals of the fitted tracks on the two projections.
89 **
90 ** map<unsigned int, map<string, pair<double, double> > > fittedTrackDeviations_
91 ** | | | |
92 ** | | | |
93 ** | | | +--> xRes
94 ** | | +----------> yRes
95 ** | +----------------------> plaquette ID
96 ** +----------------------------------------> a progressive number (an ID)
97 **
98 ** ----------------------------------------------------------------------------------------------
99 ** The vector of the slope/intercept parameters of the fitted tracks. This vector is strictly
100 ** parallel to fittedTrackResiduals_.
101 **
102 ** vector<SVector<double,4> > fittedTracks_
103 ** | |
104 ** | +------------------------------> slope/intercept on x and y projections
105 ** +--------------------------------------------> vector of track parameters
106 **
107 ** ----------------------------------------------------------------------------------------------
108 ** The vector of the covariance matrix of the fitted tracks. This vector is strictly
109 ** parallel to fittedTrackResiduals_.
110 **
111 ** vector< SMatrix<double,4,4> > fittedTracksCovariance_
112 ** | |
113 ** | +-----------------------------> covariance matrix of track fit
114 ** +--------------------------------------------> vector of tracks covariance matrix
115 **
116 ** ----------------------------------------------------------------------------------------------
117 ** The vector of the slope/intercept parameters of the unconstrained fitted tracks. This vector is strictly
118 ** parallel to fittedTracks_. The point excluded from the fit is on the plaquette ID
119 **
120 ** vector< map<string, SVector<double,4> > > unconstrainedFittedTracks_
121 ** | | |
122 ** | | +---------------------------> slope/intercept on x and y projections
123 ** | +----------------------------------> plaquette ID
124 ** +--------------------------------------------> vector of track parameters
125 **
126 ** ----------------------------------------------------------------------------------------------
127 ** The vector of the covariance matrix of the unconstrained fitted tracks. This vector is strictly
128 ** parallel to unconstrainedFittedTrackResiduals_.
129 **
130 ** vector< map<string, < SMatrix<double,4,4> > > fittedTracksCovariance_
131 ** | |
132 ** | +-----------------------------> covariance matrix of track fit
133 ** +--------------------------------------------> vector of tracks covariance matrix
134 **
135 **=====================================================================================*/
136 
137 #ifndef __EVENT__
138 #define __EVENT__
139 
140 
141 #include <map>
142 #include <string>
143 #include <TH2I.h>
144 #include <vector>
145 #include <TMatrix.h>
146 #include <TObject.h>
147 
148 #include <Math/SMatrix.h>
149 #include <Math/SVector.h>
150 
151 #include "MessageTools.h"
152 namespace monicelli
153 {
154 class Event : public TObject
155 {
156 public:
157  typedef ROOT::Math::SMatrix<double,4,4> matrixDef ;
158  typedef ROOT::Math::SVector<double,4> vectorDef ;
159  typedef std::map<std::string, int> aHitDef ;
160  typedef std::vector<aHitDef> hitsDef ;
161  typedef std::map<std::string, hitsDef> plaqMapDef ;
162  typedef std::map<std::string, double> aClusterDef ;
163  typedef std::map<int, aClusterDef> aClusterMapDef ;
164  typedef std::map<int, hitsDef> aClusterHitsMapDef ;
165  typedef std::map<std::string, aClusterMapDef> clustersMapDef ;
166  typedef std::map<std::string, aClusterHitsMapDef> clustersHitsMapDef ;
167  typedef std::map<std::string, double> clusterCoordinateDef ;
168  typedef std::map<std::string, clusterCoordinateDef> alignedHitsCandidateMapDef ;
169  typedef std::vector<alignedHitsCandidateMapDef> trackCandidatesDef ;
170  typedef std::pair<double, double> xyResiduePairDef ;
171  typedef std::map<std::string, xyResiduePairDef> trackResidualsMapDef ;
172  typedef std::map<unsigned int, trackResidualsMapDef> residualsMapDef ;
173  typedef std::vector<vectorDef> fittedTracksDef ;
174  typedef std::vector<matrixDef> fittedTracksCovarianceDef ;
175  typedef std::vector<double> chi2VectorDef ;
176  typedef std::vector<std::map<std::string, vectorDef> > unconstrainedFittedTracksDef;
177  typedef std::vector<std::map<std::string, matrixDef> > unconstrainedFittedTracksCovarianceDef;
178  typedef std::vector<std::map<std::string, double> > unconstrainedChi2VectorDef ;
179 
180  Event(void) ;
181  ~Event(void);
182 
183  void clear (void );
184 
185  unconstrainedFittedTracksDef & getUnconstrainedFittedTracks (void ){return unconstrainedFittedTracks_ ;}
186  unconstrainedFittedTracksCovarianceDef& getUnconstrainedFittedTracksCovariance(void ){return unconstrainedFittedTracksCovariance_;}
187  unconstrainedChi2VectorDef & getUnconstrainedFittedTracksChi2 (void ){return unconstrainedFittedTracksChi2_ ;}
188  clustersMapDef & getClusters (void ){return clusters_ ;}
189  clustersHitsMapDef & getClustersHits (void ){return clustersHits_ ;}
190  plaqMapDef & getRawData (void ){return theRawData_ ;}
191  trackCandidatesDef & getTrackCandidates (void ){return trackCandidates_ ;}
192  residualsMapDef & getFittedTrackDeviations (void ){return fittedTrackDeviations_ ;}
193  residualsMapDef & getFittedTrackResiduals (void ){return fittedTrackResiduals_ ;}
194  residualsMapDef & getFittedTrackPulls (void ){return fittedTrackPulls_ ;}
195  fittedTracksDef & getFittedTracks (void ){return fittedTracks_ ;}
196  fittedTracksCovarianceDef& getFittedTracksCovariance (void ){return fittedTracksCovariance_ ;}
197  chi2VectorDef & getFittedTracksChi2 (void ){return fittedTracksChi2_ ;}
198  int getTrigger (void ){return trig_ ;}
199  long long getUTC (void ){return utc_ ;}
200  unsigned int getTimestamp (void ){return timestamp_ ;}
201  bool getBubbleSignal (void ){return bubbleSignal_ ;}
202  bool getBubbleAltSignal (void ){return bubbleAltSignal_ ;}
203 
204  void setRawData (int trig,
205  const plaqMapDef& theRawData );
206  void setClustersHits (const clustersHitsMapDef& clustersHits );
207  void setClusters (const clustersMapDef& clusters );
208 
209  void addUnconstrainedFittedTrack(unsigned int trackN,
210  std::string detector,
211  const vectorDef& fittedTrack,
212  const matrixDef& covarianceMatrix,
213  double fittedTrackChi2);
214 
215  residualsMapDef makeFittedTrackDeviations (int trackNumber = -1);
216 
217  // void setTrackCandidates (const trackCandidatesDef& trackCandidates ){trackCandidates_ = trackCandidates ;}
218  void setFittedTrackResiduals (const residualsMapDef& residuals ){fittedTrackResiduals_ = residuals ;}
219  void setFittedTrackDeviations (const residualsMapDef& residuals ){fittedTrackDeviations_ = residuals ;}
220  void setFittedTrackPulls (const residualsMapDef& pulls ){fittedTrackPulls_ = pulls ;}
221  void setTrigger (int trigger ){trig_ = trigger ;}
222  void setUTC (long long utc ){utc_ = utc ;}
223  void setTimestamp (unsigned int timestamp ){timestamp_ = timestamp ;}
224  void setBubbleSignal (bool bubbleSignal ){bubbleSignal_ = bubbleSignal ;}
225  void setBubbleAltSignal (bool bubbleSignal ){bubbleAltSignal_ = bubbleSignal ;}
226 
227 
228  //plaqMapDef & getTelescopeHits(void) ;
229  //hitsDef & getPlaquetteHits(std::string) ;
230 
231 private:
232 
233  void makeSingleTrackDeviations ( int trackNum );
234 
235  int trig_ ;
236  plaqMapDef theRawData_ ;
237  clustersMapDef clusters_ ;
238  clustersHitsMapDef clustersHits_ ;
239  trackCandidatesDef trackCandidates_ ;
240  residualsMapDef fittedTrackResiduals_ ;
241  residualsMapDef fittedTrackDeviations_ ;
242  residualsMapDef fittedTrackPulls_ ;
243  fittedTracksDef fittedTracks_ ;
244  fittedTracksCovarianceDef fittedTracksCovariance_ ;
245  chi2VectorDef fittedTracksChi2_ ;
246  unconstrainedFittedTracksDef unconstrainedFittedTracks_ ;
247  unconstrainedFittedTracksCovarianceDef unconstrainedFittedTracksCovariance_;
248  unconstrainedChi2VectorDef unconstrainedFittedTracksChi2_ ;
249  long long utc_ ;
250  unsigned int timestamp_ ;
251  bool bubbleSignal_ ;
252  bool bubbleAltSignal_ ;
253  //std::stringstream ss_ ; //! temporary state value
254 
255  ClassDef(Event,6);
256 
257 } ;
258 }
259 #endif