ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/PixelHit.h
(Generate patch)

Comparing UserCode/MitAna/DataTree/interface/PixelHit.h (file contents):
Revision 1.1 by loizides, Fri Sep 25 08:39:10 2009 UTC vs.
Revision 1.2 by loizides, Mon Sep 28 14:15:34 2009 UTC

# Line 13 | Line 13
13  
14   #include "MitCommon/DataFormats/interface/Vect3.h"
15   #include "MitAna/DataTree/interface/DataObject.h"
16 + #include <TMath.h>
17  
18   namespace mithep
19   {
# Line 29 | Line 30 | namespace mithep
30          kFNegDisk2=-12,
31          kFPosDisk2=+12
32        };
33 +
34 +      class Packing { //adapted from SiPixelRecHitQuality
35 +        public:
36 +          Packing();
37 +          typedef UInt_t QualWordType;
38 +
39 +          inline Bool_t   IsOnEdge(QualWordType qualWord)      const {
40 +            return (qualWord >> fEdge_shift) & fEdge_mask;
41 +          }
42 +          inline Bool_t   HasBadPixels(QualWordType qualWord)  const {
43 +            return (qualWord >> fBad_shift) & fBad_mask;
44 +          }
45 +          inline Bool_t   HasFilledProb(QualWordType qualWord) const {
46 +            return (qualWord >> fHasFilledProb_shift) & fHasFilledProb_mask;
47 +          }
48 +          inline Float_t  ProbabilityX(QualWordType qualWord)  const {
49 +            Int_t raw = (qualWord >> fProbX_shift) & fProbX_mask;
50 +            assert(raw>=0 && raw <=2047);
51 +            Float_t prob = 0;
52 +            if   (raw==2047) prob = 0;
53 +            else             prob = TMath::Power(fProbX_units,-raw) ;
54 +            return prob;
55 +          }
56 +          inline Float_t  ProbabilityY(QualWordType qualWord)  const {
57 +            Int_t raw = (qualWord >> fProbY_shift) & fProbY_mask;
58 +            assert(raw>=0 && raw <=2047);
59 +            Float_t prob = 0;
60 +            if   (raw==2047) prob = 0;
61 +            else             prob = TMath::Power(fProbY_units,-raw) ;
62 +            return prob;
63 +          }
64 +          inline Int_t    QBin(QualWordType qualWord)          const {
65 +            Int_t qbin = (qualWord >> fQBin_shift) & fQBin_mask;
66 +            assert(qbin>=0 && qbin <=7);
67 +            return qbin;
68 +          }
69 +          inline Bool_t   SpansTwoROCs(QualWordType qualWord)  const {
70 +            return (qualWord >> fTwoROC_shift) & fTwoROC_mask;
71 +          }
72 +        protected:
73 +          QualWordType    fProbX_mask;
74 +          Int_t           fProbX_shift;
75 +          Float_t         fProbX_units;
76 +          Double_t        fProbX_1_over_log_units;
77 +          Char_t          fProbX_width;
78 +          QualWordType    fProbY_mask;
79 +          Int_t           fProbY_shift;
80 +          Float_t         fProbY_units;
81 +          Double_t        fProbY_1_over_log_units;
82 +          Char_t          fProbY_width;
83 +          QualWordType    fQBin_mask;
84 +          Int_t           fQBin_shift;
85 +          Char_t          fQBin_width;
86 +          QualWordType    fEdge_mask;
87 +          Int_t           fEdge_shift;
88 +          Char_t          fEdge_width;
89 +          QualWordType    fBad_mask;
90 +          Int_t           fBad_shift;
91 +          Char_t          fBad_width;
92 +          QualWordType    fTwoROC_mask;
93 +          Int_t           fTwoROC_shift;
94 +          Char_t          fTwoROC_width;
95 +          QualWordType    fHasFilledProb_mask;
96 +          Int_t           fHasFilledProb_shift;
97 +          Char_t          fHasFilledProb_width;
98 +          Char_t          fSpare_width;
99 +      };
100  
101        PixelHit() : fType(0), fQuality(0), fCharge(0), fSize(0) {}
102        PixelHit(Double_t x, Double_t y, Double_t z) :
# Line 36 | Line 104 | namespace mithep
104        PixelHit(const ThreeVector &pos) :
105          fPosition(pos),  fType(0), fQuality(0), fCharge(0), fSize(0) {}
106  
107 +      Bool_t              IsOnEdge()           const;
108 +      Bool_t              HasBadPixels()       const;
109        const ThreeVector   Position()           const          { return fPosition.V(); }
110        EObjType            ObjType()            const          { return kPixelHit;     }
111        void                SetCharge(UInt_t u)                 { fCharge = u;          }
# Line 44 | Line 114 | namespace mithep
114        void                SetQuality(UInt_t u)                { fQuality = u;         }
115        void                SetType(Char_t t)                   { fType = t;            }
116        void                SetSize(UInt_t u)                   { fSize = u;            }
117 +      Bool_t              SpansTwoROCs()       const;
118 +      EType               Type()               const
119 +                            { return static_cast<EType>(fType); }
120        Double_t            X()                  const          { return fPosition.X(); }
121        Double_t            Y()                  const          { return fPosition.Y(); }
122        Double_t            Z()                  const          { return fPosition.Z(); }
123              
124      protected:
125 <      Vect3               fPosition; //point in space
125 >      Vect3               fPosition;   //point in space
126        Char_t              fType;       //pixel type
127        UInt_t              fQuality;    //quality word as defined by SiPixelRecHitQuality
128        UInt_t              fCharge;     //charge of assigned cluster
129        UInt_t              fSize;       //size of assigned cluster
130 +      static Packing      fPacking;    //!the (un)packing helper class
131  
132      ClassDef(PixelHit, 1) // PixelHit class
133    };
134   }
135  
136   //--------------------------------------------------------------------------------------------------
137 + inline Bool_t mithep::PixelHit::IsOnEdge() const
138 + {
139 +  // Return true if pixel hit is on edge.
140 +
141 +  return fPacking.IsOnEdge(fQuality);
142 + }
143 +
144 + //--------------------------------------------------------------------------------------------------
145 + inline Bool_t mithep::PixelHit::HasBadPixels() const
146 + {
147 +  // Return true if pixel hit contains bad pixels.
148 +
149 +  return fPacking.HasBadPixels(fQuality);
150 + }
151 +
152 + //--------------------------------------------------------------------------------------------------
153   inline void mithep::PixelHit::SetPosition(Double_t x, Double_t y, Double_t z)
154   {
155    // Set pixel hit position.
156  
157    fPosition.SetXYZ(x,y,z);
158   }
159 +
160 + //--------------------------------------------------------------------------------------------------
161 + inline Bool_t mithep::PixelHit::SpansTwoROCs() const
162 + {
163 +  // Return true if pixel hit spans two rocs (ie is large).
164 +
165 +  return fPacking.SpansTwoROCs(fQuality);
166 + }
167   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines