1 |
#ifndef UserCode_1RpcTriggerAnalysis_RPCDigiSpec_H
|
2 |
#define UserCode_1RpcTriggerAnalysis_RPCDigiSpec_H
|
3 |
|
4 |
#include <ostream>
|
5 |
|
6 |
class RPCDigiSpec {
|
7 |
typedef unsigned int DigiType;
|
8 |
public:
|
9 |
|
10 |
RPCDigiSpec(uint32_t aRawId, unsigned int aFromStrip, unsigned int aToStrip)
|
11 |
: theRawId(aRawId), theCodedDigi( ((aFromStrip&0xFF) << 8) | (aToStrip&0xFF) )
|
12 |
{ }
|
13 |
|
14 |
RPCDigiSpec(uint32_t aRawId, DigiType aCodedDigi)
|
15 |
: theRawId(aRawId), theCodedDigi(aCodedDigi)
|
16 |
{ }
|
17 |
|
18 |
unsigned int fromStrip() const { return ((theCodedDigi >>8) & 0xFF); }
|
19 |
unsigned int toStrip() const { return (theCodedDigi&0xFF); }
|
20 |
unsigned int halfStrip() const { return fromStrip()+toStrip(); }
|
21 |
|
22 |
void setToStrip( unsigned int aToStrip) {
|
23 |
theCodedDigi = ( (theCodedDigi&(0xFF<<8)) | (aToStrip&0xFF) );
|
24 |
}
|
25 |
void setFromStrip( unsigned int aFromStrip) {
|
26 |
theCodedDigi = ((theCodedDigi&0xFF) | (((aFromStrip&0xFF) << 8)) );
|
27 |
}
|
28 |
|
29 |
uint32_t rawId() const { return theRawId; }
|
30 |
DigiType codedDigi() const { return theCodedDigi; }
|
31 |
|
32 |
private:
|
33 |
uint32_t theRawId;
|
34 |
DigiType theCodedDigi;
|
35 |
|
36 |
friend std::ostream & operator << (std::ostream &out, const RPCDigiSpec &o) {
|
37 |
out <<"RPC: "<<o.rawId()<< " halfStrip: "<<o.halfStrip()<<" ("<<o.fromStrip()<<":"<<o.toStrip()<<")";
|
38 |
return out;
|
39 |
}
|
40 |
};
|
41 |
#endif
|