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
00232 int numberOfValidStripLayersWithMonoAndStereo ()
00233 const;
00234
00235 uint32_t getTrackerLayerCase(uint32_t substr, uint32_t layer) const;
00236 uint32_t getTrackerMonoStereo (uint32_t substr, uint32_t layer) const;
00237
00238 int trackerLayersWithMeasurement() const;
00239 int pixelLayersWithMeasurement() const;
00240 int stripLayersWithMeasurement() const;
00241 int pixelBarrelLayersWithMeasurement() const;
00242 int pixelEndcapLayersWithMeasurement() const;
00243 int stripTIBLayersWithMeasurement() const;
00244 int stripTIDLayersWithMeasurement() const;
00245 int stripTOBLayersWithMeasurement() const;
00246 int stripTECLayersWithMeasurement() const;
00247 int trackerLayersWithoutMeasurement() const;
00248 int pixelLayersWithoutMeasurement() const;
00249 int stripLayersWithoutMeasurement() const;
00250 int pixelBarrelLayersWithoutMeasurement() const;
00251 int pixelEndcapLayersWithoutMeasurement() const;
00252 int stripTIBLayersWithoutMeasurement() const;
00253 int stripTIDLayersWithoutMeasurement() const;
00254 int stripTOBLayersWithoutMeasurement() const;
00255 int stripTECLayersWithoutMeasurement() const;
00256 int trackerLayersTotallyOffOrBad() const;
00257 int pixelLayersTotallyOffOrBad() const;
00258 int stripLayersTotallyOffOrBad() const;
00259 int pixelBarrelLayersTotallyOffOrBad() const;
00260 int pixelEndcapLayersTotallyOffOrBad() const;
00261 int stripTIBLayersTotallyOffOrBad() const;
00262 int stripTIDLayersTotallyOffOrBad() const;
00263 int stripTOBLayersTotallyOffOrBad() const;
00264 int stripTECLayersTotallyOffOrBad() const;
00265 int trackerLayersNull() const;
00266 int pixelLayersNull() const;
00267 int stripLayersNull() const;
00268 int pixelBarrelLayersNull() const;
00269 int pixelEndcapLayersNull() const;
00270 int stripTIBLayersNull() const;
00271 int stripTIDLayersNull() const;
00272 int stripTOBLayersNull() const;
00273 int stripTECLayersNull() const;
00274
00275
00276
00278 int muonStations(int subdet, int hitType) const ;
00279
00280 int muonStationsWithValidHits() const ;
00281 int muonStationsWithBadHits() const ;
00282 int muonStationsWithAnyHits() const ;
00283 int dtStationsWithValidHits() const ;
00284 int dtStationsWithBadHits() const ;
00285 int dtStationsWithAnyHits() const ;
00286 int cscStationsWithValidHits() const ;
00287 int cscStationsWithBadHits() const ;
00288 int cscStationsWithAnyHits() const ;
00289 int rpcStationsWithValidHits() const ;
00290 int rpcStationsWithBadHits() const ;
00291 int rpcStationsWithAnyHits() const ;
00292
00294 int innermostMuonStationWithHits(int hitType) const ;
00295 int innermostMuonStationWithValidHits() const ;
00296 int innermostMuonStationWithBadHits() const ;
00297 int innermostMuonStationWithAnyHits() const ;
00298
00300 int outermostMuonStationWithHits(int hitType) const ;
00301 int outermostMuonStationWithValidHits() const ;
00302 int outermostMuonStationWithBadHits() const ;
00303 int outermostMuonStationWithAnyHits() const ;
00304
00305 int numberOfDTStationsWithRPhiView() const ;
00306 int numberOfDTStationsWithRZView() const ;
00307 int numberOfDTStationsWithBothViews() const ;
00308 private:
00309
00310
00311 const static unsigned short PatternSize = 25;
00312
00313
00314 const static unsigned short HitSize = 11;
00315
00316
00317 const static unsigned short SubDetectorOffset = 10;
00318 const static unsigned short SubDetectorMask = 0x1;
00319
00320
00321 const static unsigned short SubstrOffset = 7;
00322 const static unsigned short SubstrMask = 0x7;
00323
00324
00325 const static unsigned short LayerOffset = 3;
00326 const static unsigned short LayerMask = 0xF;
00327
00328
00329 const static unsigned short SideOffset = 2;
00330 const static unsigned short SideMask = 0x1;
00331
00332
00333 const static unsigned short HitTypeOffset = 0;
00334 const static unsigned short HitTypeMask = 0x3;
00335
00336
00337 uint32_t hitPattern_[ PatternSize ];
00338
00339
00340 void setHitPattern(int position, uint32_t pattern);
00341
00342
00343 void set(const TrackingRecHitRef & ref, unsigned int i) { set(* ref, i); }
00344
00345
00346 static uint32_t isStereo (DetId);
00347 };
00348 }
00349
00350 #endif