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 |
#include <map>
|
9 |
|
10 |
|
11 |
class Pattern {
|
12 |
public:
|
13 |
|
14 |
typedef std::map<uint32_t, unsigned int > DataType;
|
15 |
|
16 |
Pattern() {}
|
17 |
|
18 |
|
19 |
static uint32_t rotateDetId(uint32_t rawId, int step);
|
20 |
Pattern getRotated(int step) const;
|
21 |
|
22 |
|
23 |
//is not empty
|
24 |
operator bool() const { return theData.size() > 0; }
|
25 |
|
26 |
bool add(std::pair<uint32_t, unsigned int > aData) { return !addOrCopy(aData); }
|
27 |
|
28 |
static void add( std::vector<Pattern> & vpat, std::pair<uint32_t, unsigned int > aData);
|
29 |
|
30 |
unsigned int size() const { return theData.size(); }
|
31 |
operator const DataType & () const { return theData; }
|
32 |
|
33 |
bool operator==(const Pattern& o) const;
|
34 |
|
35 |
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 |
// to this pattern and return an empty pattern;
|
41 |
Pattern addOrCopy ( std::pair<uint32_t, unsigned int > aData);
|
42 |
|
43 |
private:
|
44 |
DataType theData;
|
45 |
friend std::ostream & operator << (std::ostream &out, const Pattern &o);
|
46 |
};
|
47 |
#endif
|
48 |
|
49 |
|