Go to the documentation of this file.00001
00002 #ifndef TrackReco_HitPattern_h
00003 #define TrackReco_HitPattern_h
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111 #include <ostream>
00112 #include "DataFormats/DetId/interface/DetId.h"
00113 #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h"
00114 #include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
00115 #include "DataFormats/TrackingRecHit/interface/TrackingRecHitFwd.h"
00116
00117 namespace reco {
00118 class HitPattern {
00119 public:
00120 enum { MONO = 1, STEREO = 2 };
00121
00122
00123
00124 HitPattern() { for (int i=0; i<PatternSize; i++) hitPattern_[i] = 0; }
00125
00126
00127 template<typename I>
00128 HitPattern(const I & begin, const I & end) { set(begin, end); }
00129
00130
00131 template<typename C>
00132 HitPattern(const C & c) { set(c); }
00133
00134
00135
00136
00137 template<typename I>
00138 void set(const I & begin, const I & end) {
00139 for (int i=0; i<PatternSize; i++) hitPattern_[i] = 0;
00140 unsigned int counter = 0;
00141 for (I hit=begin; hit!=end && counter<32*PatternSize/HitSize;
00142 hit++, counter++)
00143 set(*hit, counter);
00144 }
00145
00146
00147 void printHitPattern (int position, std::ostream &stream) const;
00148 void print (std::ostream &stream = std::cout) const;
00149
00150
00151 void set(const TrackingRecHit &, unsigned int i);
00152
00153
00154 uint32_t getHitPattern(int position) const;
00155
00156 bool trackerHitFilter(uint32_t pattern) const;
00157 bool muonHitFilter(uint32_t pattern) const;
00158
00159 uint32_t getSubStructure(uint32_t pattern) const;
00160 bool pixelHitFilter(uint32_t pattern) const;
00161 bool pixelBarrelHitFilter(uint32_t pattern) const;
00162 bool pixelEndcapHitFilter(uint32_t pattern) const;
00163 bool stripHitFilter(uint32_t pattern) const;
00164 bool stripTIBHitFilter(uint32_t pattern) const;
00165 bool stripTIDHitFilter(uint32_t pattern) const;
00166 bool stripTOBHitFilter(uint32_t pattern) const;
00167 bool stripTECHitFilter(uint32_t pattern) const;
00168 bool muonDTHitFilter(uint32_t pattern) const;
00169 bool muonCSCHitFilter(uint32_t pattern) const;
00170 bool muonRPCHitFilter(uint32_t pattern) const;
00171
00172 uint32_t getLayer(uint32_t pattern) const;
00173 uint32_t getSubSubStructure(uint32_t pattern) const;
00174
00176 uint32_t getMuonStation(uint32_t pattern) const;
00178 uint32_t getDTSuperLayer(uint32_t pattern) const;
00180 uint32_t getCSCRing(uint32_t pattern) const ;
00182 uint32_t getRPCLayer(uint32_t pattern) const ;
00184 uint32_t getRPCregion(uint32_t pattern) const;
00185
00186 uint32_t getHitType(uint32_t pattern) const;
00187 bool validHitFilter(uint32_t pattern) const;
00188 bool type_1_HitFilter(uint32_t pattern) const;
00189 bool type_2_HitFilter(uint32_t pattern) const;
00190 bool type_3_HitFilter(uint32_t pattern) const;
00191
00192 static uint32_t getSide (uint32_t pattern);
00193
00194 bool hasValidHitInFirstPixelBarrel() const;
00195 bool hasValidHitInFirstPixelEndcap() const;
00196
00197 int numberOfHits() const;
00198 int numberOfValidHits() const;
00199 int numberOfValidTrackerHits() const;
00200 int numberOfValidMuonHits() const;
00201 int numberOfValidPixelHits() const;
00202 int numberOfValidPixelBarrelHits() const;
00203 int numberOfValidPixelEndcapHits() const;
00204 int numberOfValidStripHits() const;
00205 int numberOfValidStripTIBHits() const;
00206 int numberOfValidStripTIDHits() const;
00207 int numberOfValidStripTOBHits() const;
00208 int numberOfValidStripTECHits() const;
00209 int numberOfValidMuonDTHits() const;
00210 int numberOfValidMuonCSCHits() const;
00211 int numberOfValidMuonRPCHits() const;
00212 int numberOfLostHits() const;
00213 int numberOfLostTrackerHits() const;
00214 int numberOfLostMuonHits() const;
00215 int numberOfLostPixelHits() const;
00216 int numberOfLostPixelBarrelHits() const;
00217 int numberOfLostPixelEndcapHits() const;
00218 int numberOfLostStripHits() const;
00219 int numberOfLostStripTIBHits() const;
00220 int numberOfLostStripTIDHits() const;
00221 int numberOfLostStripTOBHits() const;
00222 int numberOfLostStripTECHits() const;
00223 int numberOfLostMuonDTHits() const;
00224 int numberOfLostMuonCSCHits() const;
00225 int numberOfLostMuonRPCHits() const;
00226 int numberOfBadHits() const;
00227 int numberOfBadMuonHits() const;
00228 int numberOfBadMuonDTHits() const;
00229 int numberOfBadMuonCSCHits() const;
00230 int numberOfBadMuonRPCHits() const;
00231 int numberOfInactiveHits() const;
00232 int numberOfInactiveTrackerHits() const;
00233
00234
00235 int numberOfValidStripLayersWithMonoAndStereo ()
00236 const;
00237
00238 uint32_t getTrackerLayerCase(uint32_t substr, uint32_t layer) const;
00239 uint32_t getTrackerMonoStereo (uint32_t substr, uint32_t layer) const;
00240
00241 int trackerLayersWithMeasurement() const;
00242 int pixelLayersWithMeasurement() const;
00243 int stripLayersWithMeasurement() const;
00244 int pixelBarrelLayersWithMeasurement() const;
00245 int pixelEndcapLayersWithMeasurement() const;
00246 int stripTIBLayersWithMeasurement() const;
00247 int stripTIDLayersWithMeasurement() const;
00248 int stripTOBLayersWithMeasurement() const;
00249 int stripTECLayersWithMeasurement() const;
00250 int trackerLayersWithoutMeasurement() const;
00251 int pixelLayersWithoutMeasurement() const;
00252 int stripLayersWithoutMeasurement() const;
00253 int pixelBarrelLayersWithoutMeasurement() const;
00254 int pixelEndcapLayersWithoutMeasurement() const;
00255 int stripTIBLayersWithoutMeasurement() const;
00256 int stripTIDLayersWithoutMeasurement() const;
00257 int stripTOBLayersWithoutMeasurement() const;
00258 int stripTECLayersWithoutMeasurement() const;
00259 int trackerLayersTotallyOffOrBad() const;
00260 int pixelLayersTotallyOffOrBad() const;
00261 int stripLayersTotallyOffOrBad() const;
00262 int pixelBarrelLayersTotallyOffOrBad() const;
00263 int pixelEndcapLayersTotallyOffOrBad() const;
00264 int stripTIBLayersTotallyOffOrBad() const;
00265 int stripTIDLayersTotallyOffOrBad() const;
00266 int stripTOBLayersTotallyOffOrBad() const;
00267 int stripTECLayersTotallyOffOrBad() const;
00268 int trackerLayersNull() const;
00269 int pixelLayersNull() const;
00270 int stripLayersNull() const;
00271 int pixelBarrelLayersNull() const;
00272 int pixelEndcapLayersNull() const;
00273 int stripTIBLayersNull() const;
00274 int stripTIDLayersNull() const;
00275 int stripTOBLayersNull() const;
00276 int stripTECLayersNull() const;
00277
00278
00279
00281 int muonStations(int subdet, int hitType) const ;
00282
00283 int muonStationsWithValidHits() const ;
00284 int muonStationsWithBadHits() const ;
00285 int muonStationsWithAnyHits() const ;
00286 int dtStationsWithValidHits() const ;
00287 int dtStationsWithBadHits() const ;
00288 int dtStationsWithAnyHits() const ;
00289 int cscStationsWithValidHits() const ;
00290 int cscStationsWithBadHits() const ;
00291 int cscStationsWithAnyHits() const ;
00292 int rpcStationsWithValidHits() const ;
00293 int rpcStationsWithBadHits() const ;
00294 int rpcStationsWithAnyHits() const ;
00295
00297 int innermostMuonStationWithHits(int hitType) const ;
00298 int innermostMuonStationWithValidHits() const ;
00299 int innermostMuonStationWithBadHits() const ;
00300 int innermostMuonStationWithAnyHits() const ;
00301
00303 int outermostMuonStationWithHits(int hitType) const ;
00304 int outermostMuonStationWithValidHits() const ;
00305 int outermostMuonStationWithBadHits() const ;
00306 int outermostMuonStationWithAnyHits() const ;
00307
00308 int numberOfDTStationsWithRPhiView() const ;
00309 int numberOfDTStationsWithRZView() const ;
00310 int numberOfDTStationsWithBothViews() const ;
00311 private:
00312
00313
00314 const static unsigned short PatternSize = 25;
00315
00316
00317 const static unsigned short HitSize = 11;
00318
00319
00320 const static unsigned short SubDetectorOffset = 10;
00321 const static unsigned short SubDetectorMask = 0x1;
00322
00323
00324 const static unsigned short SubstrOffset = 7;
00325 const static unsigned short SubstrMask = 0x7;
00326
00327
00328 const static unsigned short LayerOffset = 3;
00329 const static unsigned short LayerMask = 0xF;
00330
00331
00332 const static unsigned short SideOffset = 2;
00333 const static unsigned short SideMask = 0x1;
00334
00335
00336 const static unsigned short HitTypeOffset = 0;
00337 const static unsigned short HitTypeMask = 0x3;
00338
00339
00340 uint32_t hitPattern_[ PatternSize ];
00341
00342
00343 void setHitPattern(int position, uint32_t pattern);
00344
00345
00346 void set(const TrackingRecHitRef & ref, unsigned int i) { set(* ref, i); }
00347
00348
00349 static uint32_t isStereo (DetId);
00350 };
00351 }
00352
00353 #endif