ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/L1RpcTriggerAnalysis/interface/RPCDetIdUtil.h
Revision: 1.3
Committed: Mon Oct 1 19:19:57 2012 UTC (12 years, 7 months ago) by konec
Content type: text/plain
Branch: MAIN
Changes since 1.2: +1 -0 lines
Log Message:
major changes,

File Contents

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