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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
#ifndef CondFormats_SiPixelObjects_SiPixelGainCalibrationForHLT_h
#define CondFormats_SiPixelObjects_SiPixelGainCalibrationForHLT_h
// -*- C++ -*-
//
// Package: SiPixelObjects
// Class: SiPixelGainCalibrationForHLT
//
/**\class SiPixelGainCalibrationForHLT SiPixelGainCalibrationForHLT.h CondFormats/SiPixelObjects/src/SiPixelGainCalibrationForHLT.cc
Description: Gain calibration object for the Silicon Pixel detector for use at HLT. Stores only average gain and average pedestal per column.
Implementation:
<Notes on implementation>
*/
//
// Original Author: Vincenzo Chiochia
// Created: Tue 8 12:31:25 CEST 2007
// Modified: Evan Friis
// $Id: SiPixelGainCalibrationForHLT.h,v 1.5 2009/02/10 17:25:58 rougny Exp $
//
//
#include "CondFormats/Serialization/interface/Serializable.h"
#include <vector>
#include <map>
#include <iostream>
#include <cstdint>
class SiPixelGainCalibrationForHLT {
public:
struct DecodingStructure {
unsigned int gain : 8;
unsigned int ped : 8;
};
struct DetRegistry {
uint32_t detid;
uint32_t ibegin;
uint32_t iend;
int ncols;
COND_SERIALIZABLE;
};
class StrictWeakOrdering {
public:
bool operator()(const DetRegistry& p, const uint32_t& i) const { return p.detid < i; }
};
typedef std::vector<char>::const_iterator ContainerIterator;
typedef std::pair<ContainerIterator, ContainerIterator> Range;
typedef std::vector<DetRegistry> Registry;
typedef Registry::const_iterator RegistryIterator;
// Constructors
SiPixelGainCalibrationForHLT();
SiPixelGainCalibrationForHLT(float minPed, float maxPed, float minGain, float maxGain);
~SiPixelGainCalibrationForHLT() {}
void initialize();
bool put(const uint32_t& detID, Range input, const int& nCols);
const Range getRange(const uint32_t& detID) const;
void getDetIds(std::vector<uint32_t>& DetIds_) const;
const int getNCols(const uint32_t& detID) const;
const std::pair<const Range, const int> getRangeAndNCols(const uint32_t& detID) const;
unsigned int getNumberOfRowsToAverageOver() const { return numberOfRowsToAverageOver_; }
float getGainLow() const { return minGain_; }
float getGainHigh() const { return maxGain_; }
float getPedLow() const { return minPed_; }
float getPedHigh() const { return maxPed_; }
std::vector<char> const& data() const { return v_pedestals; }
std::vector<DetRegistry> const& getIndexes() const { return indexes; }
// Set and get public methods
void setData(
float ped, float gain, std::vector<char>& vped, bool thisColumnIsDead = false, bool thisColumnIsNoisy = false);
void setDeadColumn(const int& nRows, std::vector<char>& vped) {
setData(0, 0 /*dummy values, not used*/, vped, true, false);
}
void setNoisyColumn(const int& nRows, std::vector<char>& vped) {
setData(0, 0 /*dummy values, not used*/, vped, false, true);
}
std::pair<float, float> getPedAndGain(const int& col,
const int& row,
const Range& range,
const int& nCols,
bool& isDeadColumn,
bool& isNoisyColumn) const;
float getPed(const int& col,
const int& row,
const Range& range,
const int& nCols,
bool& isDeadColumn,
bool& isNoisyColumn) const;
float getGain(const int& col,
const int& row,
const Range& range,
const int& nCols,
bool& isDeadColumn,
bool& isNoisyColumn) const;
private:
float encodeGain(const float& gain);
float encodePed(const float& ped);
float decodeGain(unsigned int gain) const { return float(gain) * gainPrecision + minGain_; }
float decodePed(unsigned int ped) const { return float(ped) * pedPrecision + minPed_; }
std::vector<char> v_pedestals; //@@@ blob streaming doesn't work with uint16_t and with classes
std::vector<DetRegistry> indexes;
float minPed_, maxPed_, minGain_, maxGain_;
float pedPrecision, gainPrecision;
//THIS WILL BE HARDCODED TO 80 (all rows in a ROC) DON'T CHANGE UNLESS YOU KNOW WHAT YOU ARE DOING!
unsigned int numberOfRowsToAverageOver_;
unsigned int nBinsToUseForEncoding_;
unsigned int deadFlag_;
unsigned int noisyFlag_;
COND_SERIALIZABLE;
};
#endif
|