ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/PixelHit.h
Revision: 1.4
Committed: Tue Nov 17 21:14:33 2009 UTC (15 years, 5 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_032, Mit_031, Mit_025c_branch2, Mit_025c_branch1, Mit_030, Mit_029c, Mit_029b, Mit_030_pre1, Mit_029a, Mit_029, Mit_029_pre1, Mit_028a, Mit_025c_branch0, Mit_028, Mit_027a, Mit_027, Mit_026, Mit_025e, Mit_025d, Mit_025c, Mit_025b, Mit_025a, Mit_025, Mit_025pre2, Mit_024b, Mit_025pre1, Mit_024a, Mit_024, Mit_023, Mit_022a, Mit_022, Mit_020d, TMit_020d, Mit_020c, Mit_021, Mit_021pre2, Mit_021pre1, Mit_020b, Mit_020a, Mit_020, Mit_020pre1, Mit_018, Mit_017, Mit_017pre3, Mit_017pre2, Mit_017pre1, Mit_016, Mit_015b, Mit_015a, Mit_015, Mit_014e, Mit_014d, Mit_014c, Mit_014b, Mit_014a, Mit_014, Mit_014pre3, Mit_014pre2, Mit_014pre1, Mit_013d, Mit_013c, Mit_013b, Mit_013a, Mit_013, Mit_013pre1, Mit_012i, Mit_012h, Mit_012g, Mit_012f, Mit_012e, Mit_012d, Mit_012c, Mit_012b, HEAD
Branch point for: Mit_025c_branch
Changes since 1.3: +33 -27 lines
Log Message:
Added additional quality flag.

File Contents

# User Rev Content
1 loizides 1.1 //--------------------------------------------------------------------------------------------------
2 loizides 1.4 // $Id: PixelHit.h,v 1.3 2009/11/05 10:30:29 loizides Exp $
3 loizides 1.1 //
4     // PixelHit
5     //
6     // PixelHit class implemented as a point in space holding fit error and additional information.
7     //
8     // Authors: C.Loizides
9     //--------------------------------------------------------------------------------------------------
10    
11     #ifndef MITANA_DATATREE_PIXELHIT_H
12     #define MITANA_DATATREE_PIXELHIT_H
13    
14     #include "MitCommon/DataFormats/interface/Vect3.h"
15     #include "MitAna/DataTree/interface/DataObject.h"
16 loizides 1.2 #include <TMath.h>
17 loizides 1.1
18     namespace mithep
19     {
20     class PixelHit : public DataObject
21     {
22     public:
23     enum EType {
24     kUnknown=0,
25     kBLayer1=1,
26     kBLayer2=2,
27     kBLayer3=3,
28     kFNegDisk1=-11,
29     kFPosDisk1=+11,
30     kFNegDisk2=-12,
31     kFPosDisk2=+12
32     };
33 loizides 1.2
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 loizides 1.1
101 loizides 1.4 PixelHit() : fType(0), fQuality(0), fCharge(0), fSizeX(0), fSizeY(0),fIsAnyPixelOnEdge(kFALSE) {}
102 loizides 1.1 PixelHit(Double_t x, Double_t y, Double_t z) :
103 loizides 1.4 fPosition(x,y,z), fType(0), fQuality(0), fCharge(0), fSizeX(0), fSizeY(0), fIsAnyPixelOnEdge(kFALSE) {}
104 loizides 1.1 PixelHit(const ThreeVector &pos) :
105 loizides 1.4 fPosition(pos), fType(0), fQuality(0), fCharge(0), fSizeX(0), fSizeY(0), fIsAnyPixelOnEdge(kFALSE) {}
106 loizides 1.1
107 loizides 1.4 UInt_t Charge() const { return fCharge; }
108     Bool_t IsAnyPixelOnEdge() const { return fIsAnyPixelOnEdge; }
109     Bool_t IsOnEdge() const;
110     Bool_t HasBadPixels() const;
111     EObjType ObjType() const { return kPixelHit; }
112     const ThreeVector Position() const { return fPosition.V(); }
113     UInt_t Quality() const { return fQuality; }
114     void SetAnyPixelIsOnEdge(Bool_t e) { fIsAnyPixelOnEdge = e; }
115     void SetCharge(UInt_t u) { fCharge = u; }
116     void SetPosition(const ThreeVector &pos) { fPosition = pos; }
117 loizides 1.1 void SetPosition(Double_t x, Double_t y, Double_t z);
118 loizides 1.4 void SetQuality(UInt_t u) { fQuality = u; }
119     void SetType(Char_t t) { fType = t; }
120     void SetSizeX(UInt_t u) { fSizeX = u; }
121     void SetSizeY(UInt_t u) { fSizeY = u; }
122     UInt_t SizeX() const { return fSizeX; }
123     UInt_t SizeY() const { return fSizeY; }
124     Bool_t SpansTwoROCs() const;
125     EType Type() const
126 loizides 1.2 { return static_cast<EType>(fType); }
127 loizides 1.4 Double_t X() const { return fPosition.X(); }
128     Double_t Y() const { return fPosition.Y(); }
129     Double_t Z() const { return fPosition.Z(); }
130 loizides 1.1
131     protected:
132 loizides 1.4 Vect3 fPosition; //point in space
133     Char_t fType; //pixel type
134     UInt_t fQuality; //quality word as defined by SiPixelRecHitQuality
135     UInt_t fCharge; //charge of assigned cluster
136     UInt_t fSizeX; //size in local x of assigned cluster
137     UInt_t fSizeY; //size in local y of assigned cluster
138     Bool_t fIsAnyPixelOnEdge; //=true if one pixel is on edge
139     static Packing fPacking; //!the (un)packing helper class
140 loizides 1.1
141     ClassDef(PixelHit, 1) // PixelHit class
142     };
143     }
144    
145     //--------------------------------------------------------------------------------------------------
146 loizides 1.2 inline Bool_t mithep::PixelHit::IsOnEdge() const
147     {
148     // Return true if pixel hit is on edge.
149    
150     return fPacking.IsOnEdge(fQuality);
151     }
152    
153     //--------------------------------------------------------------------------------------------------
154     inline Bool_t mithep::PixelHit::HasBadPixels() const
155     {
156     // Return true if pixel hit contains bad pixels.
157    
158     return fPacking.HasBadPixels(fQuality);
159     }
160    
161     //--------------------------------------------------------------------------------------------------
162 loizides 1.1 inline void mithep::PixelHit::SetPosition(Double_t x, Double_t y, Double_t z)
163     {
164     // Set pixel hit position.
165    
166     fPosition.SetXYZ(x,y,z);
167     }
168 loizides 1.2
169     //--------------------------------------------------------------------------------------------------
170     inline Bool_t mithep::PixelHit::SpansTwoROCs() const
171     {
172     // Return true if pixel hit spans two rocs (ie is large).
173    
174     return fPacking.SpansTwoROCs(fQuality);
175     }
176 loizides 1.1 #endif