ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/L1RpcTriggerAnalysis/interface/RPCDetIdUtil.h
Revision: 1.2
Committed: Wed Feb 8 07:18:44 2012 UTC (13 years, 2 months ago) by konec
Content type: text/plain
Branch: MAIN
CVS Tags: Mikolaj_cmssw533, Mikolaj_cmssw52x
Changes since 1.1: +32 -3 lines
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 konec 1.1 #ifndef L1RpcTriggerAnalysis_RPCDetIdUtil_H
2     #define L1RpcTriggerAnalysis_RPCDetIdUtil_H
3    
4     #include "DataFormats/MuonDetId/interface/RPCDetId.h"
5     #include <iostream>
6    
7     class RPCDetIdUtil{
8     public:
9     RPCDetIdUtil( const RPCDetId & rpcDet) : theRpcDet(rpcDet) { }
10    
11     bool isBarrel() const { return (theRpcDet.region()==0); }
12    
13 konec 1.2 unsigned int barrelLayer() const {
14     return theRpcDet.station() <=2 ?
15     2*( theRpcDet.station()-1)+ theRpcDet.layer()
16     : theRpcDet.station()+2;
17     }
18     unsigned int endcapLayer() const {
19     return theRpcDet.station();
20     }
21 konec 1.1 unsigned int layer() const {
22 konec 1.2 return isBarrel() ? barrelLayer() : endcapLayer();
23     }
24    
25     unsigned int layer(float eta) const {
26     if (fabs(eta) < 0.83) {
27     return barrelLayer();
28     } else if ( fabs(eta) < 0.93) {
29     if ( isBarrel() && (barrelLayer() < 6)) return barrelLayer();
30     } else if ( fabs(eta) < 1.04) {
31     if ( isBarrel() && (barrelLayer()==1)) return 1;
32     if ( isBarrel() && (barrelLayer()==2)) return 2;
33     if ( isBarrel() && (barrelLayer()==3)) return 3;
34     if ( isBarrel() && (barrelLayer()==4)) return 4;
35     // if ( isBarrel() && (barrelLayer()==5)) return 5;
36     if (!isBarrel() && endcapLayer()==1 ) return 5;
37     } else if ( fabs(eta)<1.14) {
38     if ( isBarrel() && (barrelLayer() < 3)) return barrelLayer();
39     if (!isBarrel() && endcapLayer()==1) return 3;
40     if (!isBarrel() && endcapLayer()==2) return 4;
41     } else if ( fabs(eta)<1.24) {
42     if ( isBarrel() && (barrelLayer() == 1)) return 1;
43     if (!isBarrel()) return endcapLayer();
44     } else return theRpcDet.station();
45     return 0;
46 konec 1.1 }
47    
48     int part() {
49     return isBarrel() ? theRpcDet.ring() :
50     (theRpcDet.region()==1 ? theRpcDet.ring()+1 : -theRpcDet.ring()-1);
51     }
52    
53     RPCDetId rpdDetIt() { return theRpcDet; }
54    
55     void print() {
56     std::cout <<"DetId: "<<theRpcDet.rawId()
57     <<" region: "<<theRpcDet.region()
58     <<" layer: "<<layer()
59     <<" ring/wheel: "<<theRpcDet.ring() << std::endl; }
60    
61     private:
62     RPCDetId theRpcDet;
63     };
64     #endif