1 |
konec |
1.1 |
#ifndef UserCode_L1RpcTriggerAnalysis_PatternCreator_H
|
2 |
|
|
#define UserCode_L1RpcTriggerAnalysis_PatternCreator_H
|
3 |
|
|
|
4 |
|
|
#include "FWCore/ParameterSet/interface/ParameterSet.h"
|
5 |
|
|
#include <vector>
|
6 |
|
|
#include <utility>
|
7 |
|
|
#include <ostream>
|
8 |
akalinow |
1.5 |
#include <map>
|
9 |
konec |
1.1 |
|
10 |
|
|
|
11 |
|
|
class Pattern {
|
12 |
|
|
public:
|
13 |
akalinow |
1.7 |
|
14 |
akalinow |
1.6 |
typedef std::map<uint32_t, unsigned int > DataType;
|
15 |
konec |
1.1 |
|
16 |
|
|
Pattern() {}
|
17 |
konec |
1.3 |
|
18 |
akalinow |
1.7 |
|
19 |
|
|
static uint32_t rotateDetId(uint32_t rawId, int step);
|
20 |
|
|
Pattern getRotated(int step) const;
|
21 |
|
|
|
22 |
|
|
|
23 |
konec |
1.3 |
//is not empty
|
24 |
|
|
operator bool() const { return theData.size() > 0; }
|
25 |
|
|
|
26 |
akalinow |
1.5 |
bool add(std::pair<uint32_t, unsigned int > aData) { return !addOrCopy(aData); }
|
27 |
konec |
1.3 |
|
28 |
|
|
static void add( std::vector<Pattern> & vpat, std::pair<uint32_t, unsigned int > aData);
|
29 |
|
|
|
30 |
konec |
1.1 |
unsigned int size() const { return theData.size(); }
|
31 |
|
|
operator const DataType & () const { return theData; }
|
32 |
konec |
1.2 |
|
33 |
konec |
1.4 |
bool operator==(const Pattern& o) const;
|
34 |
|
|
|
35 |
konec |
1.3 |
private:
|
36 |
|
|
|
37 |
|
|
// try to add data from raw id to this pattern. if the data from detUnit
|
38 |
|
|
// is already assigned to this patterns return a copy of this pattern with
|
39 |
|
|
// modified (from aData) data attached to detUnit. Otherwise add data from detUnit
|
40 |
akalinow |
1.5 |
// to this pattern and return an empty pattern;
|
41 |
konec |
1.3 |
Pattern addOrCopy ( std::pair<uint32_t, unsigned int > aData);
|
42 |
konec |
1.1 |
|
43 |
|
|
private:
|
44 |
|
|
DataType theData;
|
45 |
|
|
friend std::ostream & operator << (std::ostream &out, const Pattern &o);
|
46 |
|
|
};
|
47 |
|
|
#endif
|
48 |
|
|
|
49 |
|
|
|