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;
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()){
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();
86 std::vector<int> ietaU;
87 std::vector<int> ietaL;
88 std::vector<int> iphiU;
89 std::vector<int> iphiL;
90 std::vector<int> depU;
91 std::vector<int> depL;
92 std::vector< Lut > lutFromFile(nCol);
95 for (
size_t i=0;
i<nCol; ++
i) {
98 ietaL.push_back(ieta);
101 for (
size_t i=0;
i<nCol; ++
i) {
104 ietaU.push_back(ieta);
107 for (
size_t i=0;
i<nCol; ++
i) {
110 iphiL.push_back(iphi);
113 for (
size_t i=0;
i<nCol; ++
i) {
116 iphiU.push_back(iphi);
119 for (
size_t i=0;
i<nCol; ++
i) {
125 for (
size_t i=0;
i<nCol; ++
i) {
132 for (
size_t i=0; file >> lutValue;
i = (
i+1) % nCol){
133 lutFromFile[
i].push_back(lutValue);
139 for (
size_t i=0;
i<nCol; ++
i){
140 for (
int ieta = ietaL[
i]; ieta <= ietaU[
i]; ++ieta){
141 for (
int iphi = iphiL[
i]; iphi <= iphiU[
i]; ++iphi){
145 if (!theTopo.
valid(
id))
continue;
168 for (
int ieta=-41; ieta<=41; ++ieta){
169 for (
int iphi=1; iphi<=72; ++iphi){
171 for (
int isub=0; isub<3; ++isub){
173 if (!theTopo.
valid(detid))
continue;
176 if (lut==0)
throw cms::Exception(
"PROBLEM: No inputLUT_ in xml file for ") << detid << std::endl;
177 if (lut->size()!=128)
throw cms::Exception (
"PROBLEM: Wrong inputLUT_ size in xml file for ") << detid << std::endl;
194 std::map<int, float> cosh_ieta;
195 for (
int i = 0;
i < 13; ++
i)
199 for (
int isub = 0; isub < 3; ++isub){
201 for (
int ieta = -41; ieta <= 41; ++ieta){
202 for (
int iphi = 1; iphi <= 72; ++iphi){
205 if (!metadata->
topo()->
valid(cell))
continue;
220 for (
int capId = 0; capId < 4; ++capId){
221 ped += calibrations.
pedestal(capId);
240 bool isMasked = ( (status &
bitToMask_) > 0 );
253 coder.
adc2fC(frame,samples);
254 float adc2fC = samples[0];
265 float one_adc2fC = 0.0;
266 for (
int capId = 0; capId < 4; ++capId)
267 one_adc2fC += channelCoder->
charge(*shape, 1, capId) - channelCoder->
charge(*shape, 0, capId);
270 float offset = (
abs(ieta) >= 33 &&
abs(ieta) <= 36) ? one_adc2fC : 0;
274 coder.
adc2fC(frame,samples);
275 float adc2fC = samples[0];
289 for (
int i=0;
i<df.
size();
i++){
290 ics[
i] = (lut.at(df[
i].
adc()) & 0x3FF);
297 for (
int i=0;
i<df.
size();
i++){
298 ics[
i] = (lut.at(df[
i].
adc()) & 0x3FF);
309 return ped_.at(lutId);
314 return gain_.at(lutId);
323 msb.resize(df.
size());
324 for (
int i=0;
i<df.
size(); ++
i)
331 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 ~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
const Item * getValues(DetId fId, bool throwOnFail=true) const
unsigned short LutElement
void update(const HcalDbService &conditions)
virtual float getLUTPedestal(HcalDetId id) const
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
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
Abs< T >::type abs(const T &t)
std::vector< unsigned short > getLinearizationLUTWithMSB(const HcalDetId &id) const
const HcalLutMetadata * getHcalLutMetadata() const
void updateXML(const char *filename, const HcalTopology &)
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
virtual bool valid(const DetId &id) const
const HcalQIEShape * getHcalShape(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
tuple size
Write out results.
static XMLProcessor * getInstance()
const HcalTopology * topo() const
std::vector< Lut > inputLUT_
float charge(const HcalQIEShape &fShape, unsigned fAdc, unsigned fCapId) const
ADC [0..127] + capid [0..3] -> fC conversion.