31 inputLUT_(nluts,
Lut(INPUT_LUT_SIZE, 0)),
32 gain_(nluts, 0.), ped_ (nluts, 0.){
36 throw cms::Exception(
"PROBLEM: This method should never be invoked!");
46 return iphi + 72 * ((ieta + 41) + 83 * (depth + 3 * detid)) - 7777;
61 assert(file.is_open());
63 std::vector<HcalSubdetector> subdet;
67 std::getline(file, buffer);
68 std::getline(file, buffer);
70 unsigned int index = buffer.find(
"H", 0);
71 while (index < buffer.length()){
72 std::string subdetStr = buffer.substr(index, 2);
73 if (subdetStr ==
"HB") subdet.push_back(
HcalBarrel);
74 else if (subdetStr ==
"HE") subdet.push_back(
HcalEndcap);
75 else if (subdetStr ==
"HF") subdet.push_back(
HcalForward);
79 index = buffer.find(
"H", index);
83 size_t nCol = subdet.size();
84 std::vector<int> ietaU;
85 std::vector<int> ietaL;
86 std::vector<int> iphiU;
87 std::vector<int> iphiL;
88 std::vector<int> depU;
89 std::vector<int> depL;
90 std::vector< Lut > lutFromFile(nCol);
93 for (
size_t i=0;
i<nCol; ++
i) {
96 ietaL.push_back(ieta);
99 for (
size_t i=0;
i<nCol; ++
i) {
102 ietaU.push_back(ieta);
105 for (
size_t i=0;
i<nCol; ++
i) {
108 iphiL.push_back(iphi);
111 for (
size_t i=0;
i<nCol; ++
i) {
114 iphiU.push_back(iphi);
117 for (
size_t i=0;
i<nCol; ++
i) {
123 for (
size_t i=0;
i<nCol; ++
i) {
130 for (
size_t i=0; file >> lutValue;
i = (
i+1) % nCol){
131 lutFromFile[
i].push_back(lutValue);
137 for (
size_t i=0;
i<nCol; ++
i){
138 for (
int ieta = ietaL[
i]; ieta <= ietaU[
i]; ++ieta){
139 for (
int iphi = iphiL[
i]; iphi <= iphiU[
i]; ++iphi){
140 for (
int depth = depL[
i]; depth <= depU[
i]; ++depth){
165 for (
int ieta=-41; ieta<=41; ++ieta){
166 for (
int iphi=1; iphi<=72; ++iphi){
167 for (
int depth=1; depth<=3; ++depth){
168 for (
int isub=0; isub<3; ++isub){
170 if (!theTopo.
valid(detid))
continue;
171 int id =
getLUTId(subdet[isub], ieta, iphi, depth);
173 if (lut==0)
throw cms::Exception(
"PROBLEM: No inputLUT_ in xml file for ") << detid << std::endl;
174 if (lut->size()!=128)
throw cms::Exception (
"PROBLEM: Wrong inputLUT_ size in xml file for ") << detid << std::endl;
189 assert(metadata !=0);
192 std::map<int, float> cosh_ieta;
193 for (
int i = 0;
i < 13; ++
i)
197 for (
int isub = 0; isub < 3; ++isub){
199 for (
int ieta = -41; ieta <= 41; ++ieta){
200 for (
int iphi = 1; iphi <= 72; ++iphi){
201 for (
int depth = 1; depth <= 3; ++depth){
204 HcalDetId cell(subdet, ieta, iphi, depth);
210 int lutId =
getLUTId(subdet, ieta, iphi, depth);
217 for (
int capId = 0; capId < 4; ++capId){
218 ped += calibrations.
pedestal(capId);
237 bool isMasked = ( (status &
bitToMask_) > 0 );
250 coder.
adc2fC(frame,samples);
251 float adc2fC = samples[0];
262 float one_adc2fC = 0.0;
263 for (
int capId = 0; capId < 4; ++capId)
264 one_adc2fC += channelCoder->
charge(*shape, 1, capId) - channelCoder->
charge(*shape, 0, capId);
267 float offset = (
abs(ieta) >= 33 &&
abs(ieta) <= 36) ? one_adc2fC : 0;
271 coder.
adc2fC(frame,samples);
272 float adc2fC = samples[0];
286 for (
int i=0;
i<df.
size();
i++){
287 ics[
i] = (lut.at(df[
i].
adc()) & 0x3FF);
294 for (
int i=0;
i<df.
size();
i++){
295 ics[
i] = (lut.at(df[
i].
adc()) & 0x3FF);
306 return ped_.at(lutId);
311 return gain_.at(lutId);
320 msb.resize(df.
size());
321 for (
int i=0;
i<df.
size(); ++
i)
328 return (lut.at(adc) & 0x400);
int adc(sample_type sample)
get the ADC sample (12 bits)
float getPedestal() const
HcalSubdetector subdet() const
get the subdetector
virtual bool valid(const HcalDetId &id) const
virtual ~HcaluLUTTPGCoder()
const HcalChannelStatus * getHcalChannelStatus(const HcalGenericDetId &fId) const
int adc() const
get the ADC sample
int size() const
total number of samples in the digi
double pedestal(int fCapId) const
get pedestal for capid=0..3
static const float adc2fC[128]
static bool validDetId(HcalSubdetector subdet, int tower_ieta, int tower_iphi, int depth)
unsigned short LutElement
void update(const HcalDbService &conditions)
virtual float getLUTPedestal(HcalDetId id) const
void updateXML(const char *filename)
int depth() const
get the tower depth
void lookupMSB(const HBHEDataFrame &df, std::vector< bool > &msb) const
int getLUTId(HcalSubdetector id, int ieta, int iphi, int depth) const
float getRespGain() const
static std::string subdets[11]
const T & max(const T &a, const T &b)
void setSample(int i, const HcalQIESample &sam)
virtual void adc2fC(const HBHEDataFrame &df, CaloSamples &lf) const
const HcalL1TriggerObject * getHcalL1TriggerObject(const HcalGenericDetId &fId) const
int ieta() const
get the cell ieta
std::vector< unsigned short > getLinearizationLUTWithMSB(const HcalDetId &id) const
const HcalLutMetadata * getHcalLutMetadata() const
unsigned int offset(bool)
void setSample(int i, const HcalQIESample &sam)
virtual float getLUTGain(HcalDetId id) const
int iphi() const
get the cell iphi
double LUTrespcorrgain(int fCapId) const
get LUT corrected and response corrected gain for capid=0..3
std::vector< float > ped_
std::vector< float > gain_
int size() const
total number of samples in the digi
static const double theHFEtaBounds[]
const HcalQIESample & sample(int i) const
access a sample
const HcalQIECoder * getHcalCoder(const HcalGenericDetId &fId) const
std::vector< unsigned int > * getLutFast(uint32_t det_id)
static const size_t INPUT_LUT_SIZE
bool getMSB(const HcalDetId &id, int adc) const
const HcalDetId & id() const
virtual void adc2Linear(const HBHEDataFrame &df, IntegerCaloSamples &ics) const
const HcalDetId & id() const
uint32_t getValue() const
const HcalCalibrations & getHcalCalibrations(const HcalGenericDetId &fId) const
virtual void compress(const IntegerCaloSamples &ics, const std::vector< bool > &featureBits, HcalTriggerPrimitiveDigi &tp) const
const Item * getValues(DetId fId) const
tuple size
Write out results.
static XMLProcessor * getInstance()
const HcalQIEShape * getHcalShape() const
std::vector< Lut > inputLUT_
float charge(const HcalQIEShape &fShape, unsigned fAdc, unsigned fCapId) const
ADC [0..127] + capid [0..3] -> fC conversion.