1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
#ifndef SiStripApvGain_h
#define SiStripApvGain_h
#include "CondFormats/Serialization/interface/Serializable.h"
#include <vector>
#include <map>
#include <iostream>
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include <cstdint>
class TrackerTopology;
/**
* Stores the information of the gain for each apv using four vectors <br>
* A vector<unsigned int> (v_detids) stores the detId. <br>
* A vector<float> (v_gains) stores the value of the gain (more than one per detId). <br>
* Two vector<unsigned int> (v_ibegin and v_iend) store the correspondence of the v_detids
* and the ranges of values in v_gain. <br>
*
* The printSummary method uses SiStripDetSummary. See description therein. <br>
* The printDebug method prints the gain value for every apv of every detId. <br>
*/
class SiStripApvGain {
public:
typedef std::vector<float>::const_iterator ContainerIterator;
typedef std::pair<ContainerIterator, ContainerIterator> Range;
typedef std::vector<unsigned int> Registry;
typedef Registry::iterator RegistryIterator;
typedef Registry::const_iterator RegistryConstIterator;
typedef std::vector<float> InputVector;
struct RegistryPointers {
RegistryConstIterator detid_begin;
RegistryConstIterator detid_end;
RegistryConstIterator ibegin_begin;
RegistryConstIterator ibegin_end;
RegistryConstIterator iend_begin;
RegistryConstIterator iend_end;
ContainerIterator v_begin;
ContainerIterator v_end;
ContainerIterator getFirstElement(RegistryConstIterator& idet) {
return v_begin + *(ibegin_begin + (idet - detid_begin));
}
ContainerIterator getLastElement(RegistryConstIterator& idet) {
return v_begin + *(iend_begin + (idet - detid_begin));
}
};
SiStripApvGain() {}
~SiStripApvGain() {}
RegistryPointers getRegistryPointers() const {
RegistryPointers p;
p.detid_begin = v_detids.begin();
p.detid_end = v_detids.end();
p.ibegin_begin = v_ibegin.begin();
p.ibegin_end = v_ibegin.end();
p.iend_begin = v_iend.begin();
p.iend_end = v_iend.end();
p.v_begin = v_gains.begin();
p.v_end = v_gains.end();
return p;
}
bool put(const uint32_t& detID, Range input);
const Range getRange(const uint32_t detID) const;
Range getRangeByPos(unsigned short pos) const;
void getDetIds(std::vector<uint32_t>& DetIds_) const;
#ifdef EDM_ML_DEBUG
static float getStripGain(const uint16_t& strip, const Range& range);
static float getApvGain(const uint16_t& apv, const Range& range);
#else
static float getStripGain(uint16_t strip, const Range& range) {
uint16_t apv = strip / 128;
return *(range.first + apv);
}
static float getApvGain(uint16_t apv, const Range& range) { return *(range.first + apv); }
#endif
void printDebug(std::stringstream& ss, const TrackerTopology* trackerTopo) const;
void printSummary(std::stringstream& ss, const TrackerTopology* trackerTopo) const;
private:
std::vector<float> v_gains;
std::vector<unsigned int> v_detids;
std::vector<unsigned int> v_ibegin;
std::vector<unsigned int> v_iend;
COND_SERIALIZABLE;
};
#endif
|