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

Comparing UserCode/L1RpcTriggerAnalysis/interface/GoldenPattern.h (file contents):
Revision 1.3 by konec, Fri May 24 16:47:50 2013 UTC vs.
Revision 1.6 by akalinow, Fri Jun 28 08:31:12 2013 UTC

# Line 15 | Line 15 | public:
15    //
16    // where
17    //
18 <  enum PosBenCase { POSRPC=1, POSCSC=2, BENCSC=3, POSDT=4, BENDT=5 };
18 >  enum PosBenCase { POSRPC=0, POSCSC=1, BENCSC=2, POSDT=3, BENDT=4 };
19  
20    //
21    // Key
22    //
23    struct Key {
24 <    Key(uint32_t det=0, double pt=0, int charge= 0, double phi=0) : theDet(det), theCharge(charge) {
24 >    Key(uint32_t det=0, float pt=0, int charge= 0, float phi=0) : theDet(det), theCharge(charge) {
25        thePtCode = L1RpcTriggerAnalysisEfficiencyUtilities::PtScale().ptCode(pt);
26 <      while  (phi < 0) { phi+=2*M_PI; }
27 <      thePhiCode = int( phi * 3000.);
28 <    }
29 <    bool operator< (const Key & o) const {
26 >      //while  (phi < 0) { phi+=2*M_PI; }
27 >      //thePhiCode = int( phi * 3000.);
28 >      thePhiCode = phi;
29 >    }
30 >    inline bool operator< (const Key & o) const {
31        if (theCharge*thePtCode < o.theCharge*o.thePtCode) return true;
32        else if (theCharge*thePtCode==o.theCharge*o.thePtCode && thePhiCode < o.thePhiCode) return true;
33        else if (theCharge*thePtCode==o.theCharge*o.thePtCode && thePhiCode==o.thePhiCode && theDet<o.theDet) return true;
34        else return false;
35      }
36      bool operator==(const Key& o) const {
37 <      return theDet==o.theDet && thePtCode==o.thePtCode && thePhiCode==o.thePhiCode && theCharge==o.theCharge;
37 >      return !(theDet!=o.theDet || thePtCode!=o.thePtCode || thePhiCode!=o.thePhiCode || theCharge!=o.theCharge);
38      }
39 <    double ptValue() const { return  L1RpcTriggerAnalysisEfficiencyUtilities::PtScale().ptValue( thePtCode); }
40 <    double phiValue() const { return (double)thePhiCode/3000.; }
39 >    float ptValue() const { return  L1RpcTriggerAnalysisEfficiencyUtilities::PtScale().ptValue( thePtCode); }
40 >    float phiValue() const { return thePhiCode;}//(float)thePhiCode/3000.; }
41 >    float etaValue() const { return 6*(theDet==637602109) +
42 >                                            7*(theDet==637634877) +
43 >                                            8*(theDet==637599914) +
44 >                                            9*(theDet==637632682); }
45      uint32_t     theDet;
46      unsigned int thePtCode;
47      unsigned int thePhiCode;
# Line 52 | Line 57 | public:
57    //
58    class Result {
59    public:
60 <    Result() : checkMe(true), theValue(0.),
61 <               nMatchedPosRpc(0), nMatchedPosCsc(0), nMatchedPosDt(0), nMatchedBenCsc(0), nMatchedBenDt(0),
62 <               hasStation1(false), hasStation2(false) {}
60 >    Result() : checkMe(true), theValue(0.),
61 >               hasStation1(false), hasStation2(false) {
62 >      nMatchedPoints[GoldenPattern::POSRPC] = 0;
63 >      nMatchedPoints[GoldenPattern::POSDT] = 0;
64 >      nMatchedPoints[GoldenPattern::POSCSC] = 0;
65 >      nMatchedPoints[GoldenPattern::BENDT] = 0;
66 >      nMatchedPoints[GoldenPattern::BENCSC] = 0;      
67 >    }
68      bool operator<( const Result & o) const;
69      operator bool() const;
70 <    double value() const;
70 >    float value() const;
71      unsigned int nMatchedTot() const;
72      bool hasRpcDet(uint32_t rawId) {
73 <      for (auto it=posRpcResult.begin(); it != posRpcResult.end(); it++) {
73 >      for (auto it=myResults[GoldenPattern::POSRPC].cbegin();
74 >           it != myResults[GoldenPattern::POSRPC].cend(); ++it) {
75          if (it->first == rawId && it->second > 0. && it->second < 1.) return true;
76        }
77        return false;
# Line 68 | Line 79 | public:
79    private:
80      void run() const { if (checkMe) {checkMe=false; runNoCheck(); } }
81      void runNoCheck() const;
82 <    double norm(PosBenCase where, double whereInDist) const;
82 >    float norm(PosBenCase where, float whereInDist) const;
83    private:
84      mutable bool checkMe;
85 <    mutable double theValue;
86 <    mutable unsigned int nMatchedPosRpc, nMatchedPosCsc, nMatchedPosDt, nMatchedBenCsc, nMatchedBenDt;
85 >    mutable float theValue;
86 >    mutable std::map<GoldenPattern::PosBenCase, unsigned int> nMatchedPoints;
87 >  
88      bool hasStation1, hasStation2;
89 <    std::vector< std::pair<uint32_t, double > > posRpcResult;
78 <    std::vector< std::pair<uint32_t, double > > posCscResult;
79 <    std::vector< std::pair<uint32_t, double > > benCscResult;
80 <    std::vector< std::pair<uint32_t, double > > posDtResult;
81 <    std::vector< std::pair<uint32_t, double > > benDtResult;
89 >    mutable std::map<GoldenPattern::PosBenCase, std::vector< std::pair<uint32_t, float > > > myResults;
90      friend std::ostream & operator << (std::ostream &out, const Result& o);
91      friend class GoldenPattern;
92    };
# Line 95 | Line 103 | public:
103  
104   private:
105  
106 +  ///Pattern kinematical identification (eta,phi,pt)
107    Key theKey;
99  typedef  std::map<int, unsigned int> MFreq;
100  typedef  std::map<uint32_t, MFreq > DetFreq;
108  
109 <  DetFreq posRpc;
109 >  ///Distribution in given DetUnit.
110 >  typedef  std::map<int, unsigned int> MFreq;
111  
112 <  DetFreq posCsc;
113 <  DetFreq bendingCsc;
112 >  ///Ditribution in DetUnits. For given measuremnt type, one can have
113 >  ///measurementd in many layers(=DetUnits)
114 >  typedef  std::map<uint32_t, MFreq > DetFreq;
115 >  
116 >  ///Set of distributions for all measurement types (DT position, DT bending, RPC, etc)
117 >  typedef  std::map<GoldenPattern::PosBenCase, DetFreq > SystFreq;
118  
119 <  DetFreq posDt;
108 <  DetFreq bendingDt;
119 >  SystFreq PattCore;
120  
121   private:
122  
123 <  void purge();
124 <  double whereInDistribution(int obj, const MFreq & m) const;
123 >  bool purge();
124 >  float whereInDistribution(int obj, const MFreq & m) const;
125    friend std::ostream & operator << (std::ostream &out, const GoldenPattern & o);
126    friend class PatternManager;
127   };

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines