00001 /************************************************************************************************ 00002 ** Authors: Dario Menasce, Stefano Terzo 00003 ** 00004 ** I.N.F.N. Milan-Bicocca 00005 ** Piazza della Scienza 3, Edificio U2 00006 ** Milano, 20126 00007 ** 00008 ** 00009 ** This is the header of the event class. An event is basically a collection of the following 00010 ** quantities: 00011 ** 00012 ** 1] raw data hits (identified by row/column on a plaquette in the telescope) 00013 ** 2] the corresponding cluster coordinates (obtained by collapsing clusters of adjacent raw 00014 ** data hits into a single x/y pair of coordinates by appliying a charge sharing algorithm) 00015 ** 3] fitted tracks (obtained by fitting strings of aligned cluster-hits to a straight line in 00016 ** space: these strings are identified by a road-search algorithm with a user defined 00017 * tolerance in the x/y projections). 00018 ** 4] unconstrained fit residuals, chi2 and covariances of the reconstructed tracks 00019 ** 00020 ** Below is a description of the basic data structures which are made persistent to disk by 00021 ** compiling the C++ code derived by this header with rootcint. 00022 ** 00023 ** ---------------------------------------------------------------------------------------------- 00024 ** The raw data produced by each plaquette 00025 ** 00026 ** map<string, vector<map<string , int> > > theRawData_ 00027 ** | | | | 00028 ** | | | +--------------> value 00029 ** | | +---------------------> row | col | adc 00030 ** | +---------------------------------> vector of hits 00031 ** +----------------------------------------> plaquette ID 00032 ** 00033 ** ---------------------------------------------------------------------------------------------- 00034 ** The cluster hit coordinates/errors computed for each plaquette by using the charge sharing 00035 ** wheighting. The x/y coordinates are computed in the local plaquette reference frame. 00036 ** 00037 ** map<string, map<int, map<string, double> > > clusters_ 00038 ** | | | | 00039 ** | | | +------------> value 00040 ** | | +--------------------> x | y | xErr | yErr | charge 00041 ** | +------------------------------> cluster ID number 00042 ** +----------------------------------------> plaquette ID 00043 ** 00044 ** ---------------------------------------------------------------------------------------------- 00045 ** The clusters found for each plaquette: each cluster (an assembly of contiguous hits). 00046 ** To get the corresponding coordinates (after charge sharing has been applyed), use the 00047 ** clusters_ container above using the "cluster ID number" to match. 00048 ** 00049 ** map<string, map<int, vector<map<string, int > > > > clustersHits_ 00050 ** | | | | | 00051 ** | | | | +------> value 00052 ** | | | +------------> row | col | adc | charge | size 00053 ** | | +------------------------> vector of row/column hits 00054 ** | +------------------------------> cluster ID number 00055 ** +----------------------------------------> plaquette ID 00056 ** 00057 ** ---------------------------------------------------------------------------------------------- 00058 ** A vector (parallel to trackCandidates_) containing the chi2 of the fit 00059 ** 00060 ** vector<double> fittedTracksChi2_ 00061 ** | 00062 ** +-------------------------------------> value 00063 ** 00064 ** ---------------------------------------------------------------------------------------------- 00065 ** The vector of fitted tracks: for each plaquette the coordinates/errors of the cluster hits 00066 ** used for the final fit are provided in the laboratory reference frame. Additionally it is 00067 ** possible to gain access to the cluster used to perform the fit by means of the "cluster ID" 00068 ** 00069 ** vector<map<string, map<string, double> > > trackCandidates_ 00070 ** | | | | 00071 ** | | | +--------------> value 00072 ** | | +----------------------> x | y | z | xErr | yErr | errZ | size | cluster ID 00073 ** | +----------------------------------> plaquette ID 00074 ** +---------------------------------------------> vector of track candidates 00075 ** 00076 ** ---------------------------------------------------------------------------------------------- 00077 ** The unconstrained residuals of the fitted tracks on the two projections. This vector is 00078 ** strictly parallel to fittedTrackDeviations_. 00079 ** 00080 ** map<unsigned int, map<string, pair<double, double> > > fittedTrackResiduals_ 00081 ** | | | | 00082 ** | | | +--> xRes 00083 ** | | +----------> yRes 00084 ** | +----------------------> plaquette ID 00085 ** +----------------------------------------> a progressive number (an ID) 00086 ** 00087 ** ---------------------------------------------------------------------------------------------- 00088 ** The constrained residuals of the fitted tracks on the two projections. 00089 ** 00090 ** map<unsigned int, map<string, pair<double, double> > > fittedTrackDeviations_ 00091 ** | | | | 00092 ** | | | | 00093 ** | | | +--> xRes 00094 ** | | +----------> yRes 00095 ** | +----------------------> plaquette ID 00096 ** +----------------------------------------> a progressive number (an ID) 00097 ** 00098 ** ---------------------------------------------------------------------------------------------- 00099 ** The vector of the slope/intercept parameters of the fitted tracks. This vector is strictly 00100 ** parallel to fittedTrackResiduals_. 00101 ** 00102 ** vector<SVector<double,4> > fittedTracks_ 00103 ** | | 00104 ** | +------------------------------> slope/intercept on x and y projections 00105 ** +--------------------------------------------> vector of track parameters 00106 ** 00107 ** ---------------------------------------------------------------------------------------------- 00108 ** The vector of the covariance matrix of the fitted tracks. This vector is strictly 00109 ** parallel to fittedTrackResiduals_. 00110 ** 00111 ** vector< SMatrix<double,4,4> > fittedTracksCovariance_ 00112 ** | | 00113 ** | +-----------------------------> covariance matrix of track fit 00114 ** +--------------------------------------------> vector of tracks covariance matrix 00115 ** 00116 ** ---------------------------------------------------------------------------------------------- 00117 ** The vector of the slope/intercept parameters of the unconstrained fitted tracks. This vector is strictly 00118 ** parallel to fittedTracks_. The point excluded from the fit is on the plaquette ID 00119 ** 00120 ** vector< map<string, SVector<double,4> > > unconstrainedFittedTracks_ 00121 ** | | | 00122 ** | | +---------------------------> slope/intercept on x and y projections 00123 ** | +----------------------------------> plaquette ID 00124 ** +--------------------------------------------> vector of track parameters 00125 ** 00126 ** ---------------------------------------------------------------------------------------------- 00127 ** The vector of the covariance matrix of the unconstrained fitted tracks. This vector is strictly 00128 ** parallel to unconstrainedFittedTrackResiduals_. 00129 ** 00130 ** vector< map<string, < SMatrix<double,4,4> > > fittedTracksCovariance_ 00131 ** | | 00132 ** | +-----------------------------> covariance matrix of track fit 00133 ** +--------------------------------------------> vector of tracks covariance matrix 00134 ** 00135 **=====================================================================================*/ 00136 00137 #ifndef __EVENT__ 00138 #define __EVENT__ 00139 00140 00141 #include <map> 00142 #include <string> 00143 #include <TH2I.h> 00144 #include <vector> 00145 #include <TMatrix.h> 00146 #include <TObject.h> 00147 00148 #include <Math/SMatrix.h> 00149 #include <Math/SVector.h> 00150 00151 #include "MessageTools.h" 00152 namespace monicelli 00153 { 00154 class Event : public TObject 00155 { 00156 public: 00157 typedef ROOT::Math::SMatrix<double,4,4> matrixDef ; 00158 typedef ROOT::Math::SVector<double,4> vectorDef ; 00159 typedef std::map<std::string, int> aHitDef ; 00160 typedef std::vector<aHitDef> hitsDef ; 00161 typedef std::map<std::string, hitsDef> plaqMapDef ; 00162 typedef std::map<std::string, double> aClusterDef ; 00163 typedef std::map<int, aClusterDef> aClusterMapDef ; 00164 typedef std::map<int, hitsDef> aClusterHitsMapDef ; 00165 typedef std::map<std::string, aClusterMapDef> clustersMapDef ; 00166 typedef std::map<std::string, aClusterHitsMapDef> clustersHitsMapDef ; 00167 typedef std::map<std::string, double> clusterCoordinateDef ; 00168 typedef std::map<std::string, clusterCoordinateDef> alignedHitsCandidateMapDef ; 00169 typedef std::vector<alignedHitsCandidateMapDef> trackCandidatesDef ; 00170 typedef std::pair<double, double> xyResiduePairDef ; 00171 typedef std::map<std::string, xyResiduePairDef> trackResidualsMapDef ; 00172 typedef std::map<unsigned int, trackResidualsMapDef> residualsMapDef ; 00173 typedef std::vector<vectorDef> fittedTracksDef ; 00174 typedef std::vector<matrixDef> fittedTracksCovarianceDef ; 00175 typedef std::vector<double> chi2VectorDef ; 00176 typedef std::vector<std::map<std::string, vectorDef> > unconstrainedFittedTracksDef; 00177 typedef std::vector<std::map<std::string, matrixDef> > unconstrainedFittedTracksCovarianceDef; 00178 typedef std::vector<std::map<std::string, double> > unconstrainedChi2VectorDef ; 00179 00180 Event(void) ; 00181 ~Event(void); 00182 00183 void clear (void ); 00184 00185 unconstrainedFittedTracksDef & getUnconstrainedFittedTracks (void ){return unconstrainedFittedTracks_ ;} 00186 unconstrainedFittedTracksCovarianceDef& getUnconstrainedFittedTracksCovariance(void ){return unconstrainedFittedTracksCovariance_;} 00187 unconstrainedChi2VectorDef & getUnconstrainedFittedTracksChi2 (void ){return unconstrainedFittedTracksChi2_ ;} 00188 clustersMapDef & getClusters (void ){return clusters_ ;} 00189 clustersHitsMapDef & getClustersHits (void ){return clustersHits_ ;} 00190 plaqMapDef & getRawData (void ){return theRawData_ ;} 00191 trackCandidatesDef & getTrackCandidates (void ){return trackCandidates_ ;} 00192 residualsMapDef & getFittedTrackDeviations (void ){return fittedTrackDeviations_ ;} 00193 residualsMapDef & getFittedTrackResiduals (void ){return fittedTrackResiduals_ ;} 00194 residualsMapDef & getFittedTrackPulls (void ){return fittedTrackPulls_ ;} 00195 fittedTracksDef & getFittedTracks (void ){return fittedTracks_ ;} 00196 fittedTracksCovarianceDef& getFittedTracksCovariance (void ){return fittedTracksCovariance_ ;} 00197 chi2VectorDef & getFittedTracksChi2 (void ){return fittedTracksChi2_ ;} 00198 int getTrigger (void ){return trig_ ;} 00199 long long getUTC (void ){return utc_ ;} 00200 unsigned int getTimestamp (void ){return timestamp_ ;} 00201 bool getBubbleSignal (void ){return bubbleSignal_ ;} 00202 bool getBubbleAltSignal (void ){return bubbleAltSignal_ ;} 00203 00204 void setRawData (int trig, 00205 const plaqMapDef& theRawData ); 00206 void setClustersHits (const clustersHitsMapDef& clustersHits ); 00207 void setClusters (const clustersMapDef& clusters ); 00208 00209 void addUnconstrainedFittedTrack(unsigned int trackN, 00210 std::string detector, 00211 const vectorDef& fittedTrack, 00212 const matrixDef& covarianceMatrix, 00213 double fittedTrackChi2); 00214 00215 residualsMapDef makeFittedTrackDeviations (int trackNumber = -1); 00216 00217 // void setTrackCandidates (const trackCandidatesDef& trackCandidates ){trackCandidates_ = trackCandidates ;} 00218 void setFittedTrackResiduals (const residualsMapDef& residuals ){fittedTrackResiduals_ = residuals ;} 00219 void setFittedTrackDeviations (const residualsMapDef& residuals ){fittedTrackDeviations_ = residuals ;} 00220 void setFittedTrackPulls (const residualsMapDef& pulls ){fittedTrackPulls_ = pulls ;} 00221 void setTrigger (int trigger ){trig_ = trigger ;} 00222 void setUTC (long long utc ){utc_ = utc ;} 00223 void setTimestamp (unsigned int timestamp ){timestamp_ = timestamp ;} 00224 void setBubbleSignal (bool bubbleSignal ){bubbleSignal_ = bubbleSignal ;} 00225 void setBubbleAltSignal (bool bubbleSignal ){bubbleAltSignal_ = bubbleSignal ;} 00226 00227 00228 //plaqMapDef & getTelescopeHits(void) ; 00229 //hitsDef & getPlaquetteHits(std::string) ; 00230 00231 private: 00232 00233 void makeSingleTrackDeviations ( int trackNum ); 00234 00235 int trig_ ; 00236 plaqMapDef theRawData_ ; 00237 clustersMapDef clusters_ ; 00238 clustersHitsMapDef clustersHits_ ; 00239 trackCandidatesDef trackCandidates_ ; 00240 residualsMapDef fittedTrackResiduals_ ; 00241 residualsMapDef fittedTrackDeviations_ ; 00242 residualsMapDef fittedTrackPulls_ ; 00243 fittedTracksDef fittedTracks_ ; 00244 fittedTracksCovarianceDef fittedTracksCovariance_ ; 00245 chi2VectorDef fittedTracksChi2_ ; 00246 unconstrainedFittedTracksDef unconstrainedFittedTracks_ ; 00247 unconstrainedFittedTracksCovarianceDef unconstrainedFittedTracksCovariance_; 00248 unconstrainedChi2VectorDef unconstrainedFittedTracksChi2_ ; 00249 long long utc_ ; 00250 unsigned int timestamp_ ; 00251 bool bubbleSignal_ ; 00252 bool bubbleAltSignal_ ; 00253 //std::stringstream ss_ ; //! temporary state value 00254 00255 ClassDef(Event,6); 00256 00257 } ; 00258 } 00259 #endif