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 |
//typedef std::vector< std::pair <uint32_t, unsigned int > > DataType;
|
14 |
typedef std::map<uint32_t, unsigned int > DataType;
|
15 |
|
16 |
Pattern() {}
|
17 |
|
18 |
//is not empty
|
19 |
operator bool() const { return theData.size() > 0; }
|
20 |
|
21 |
bool add(std::pair<uint32_t, unsigned int > aData) { return !addOrCopy(aData); }
|
22 |
|
23 |
static void add( std::vector<Pattern> & vpat, std::pair<uint32_t, unsigned int > aData);
|
24 |
|
25 |
unsigned int size() const { return theData.size(); }
|
26 |
operator const DataType & () const { return theData; }
|
27 |
|
28 |
bool operator==(const Pattern& o) const;
|
29 |
|
30 |
private:
|
31 |
|
32 |
// try to add data from raw id to this pattern. if the data from detUnit
|
33 |
// is already assigned to this patterns return a copy of this pattern with
|
34 |
// modified (from aData) data attached to detUnit. Otherwise add data from detUnit
|
35 |
// to this pattern and return an empty pattern;
|
36 |
Pattern addOrCopy ( std::pair<uint32_t, unsigned int > aData);
|
37 |
|
38 |
private:
|
39 |
DataType theData;
|
40 |
friend std::ostream & operator << (std::ostream &out, const Pattern &o);
|
41 |
};
|
42 |
#endif
|
43 |
|
44 |
|