30 inputLUT_(nluts,
Lut(INPUT_LUT_SIZE, 0)),
31 gain_(nluts, 0.), ped_ (nluts, 0.){
35 throw cms::Exception(
"PROBLEM: This method should never be invoked!");
45 return iphi + 72 * ((ieta + 41) + 83 * (depth + 3 * detid)) - 7777;
62 std::vector<HcalSubdetector> subdet;
66 std::getline(file, buffer);
67 std::getline(file, buffer);
69 unsigned int index = buffer.find(
"H", 0);
70 while (index < buffer.length()){
72 if (subdetStr ==
"HB") subdet.push_back(
HcalBarrel);
73 else if (subdetStr ==
"HE") subdet.push_back(
HcalEndcap);
74 else if (subdetStr ==
"HF") subdet.push_back(
HcalForward);
78 index = buffer.find(
"H", index);
82 size_t nCol = subdet.size();
85 std::vector<int> ietaU;
86 std::vector<int> ietaL;
87 std::vector<int> iphiU;
88 std::vector<int> iphiL;
89 std::vector<int> depU;
90 std::vector<int> depL;
91 std::vector< Lut > lutFromFile(nCol);
94 for (
size_t i=0;
i<nCol; ++
i) {
97 ietaL.push_back(ieta);
100 for (
size_t i=0;
i<nCol; ++
i) {
103 ietaU.push_back(ieta);
106 for (
size_t i=0;
i<nCol; ++
i) {
109 iphiL.push_back(iphi);
112 for (
size_t i=0;
i<nCol; ++
i) {
115 iphiU.push_back(iphi);
118 for (
size_t i=0;
i<nCol; ++
i) {
124 for (
size_t i=0;
i<nCol; ++
i) {
131 for (
size_t i=0; file >> lutValue;
i = (
i+1) % nCol){
132 lutFromFile[
i].push_back(lutValue);
138 for (
size_t i=0;
i<nCol; ++
i){
139 for (
int ieta = ietaL[
i]; ieta <= ietaU[
i]; ++ieta){
140 for (
int iphi = iphiL[
i]; iphi <= iphiU[
i]; ++iphi){
144 if (!theTopo.
valid(
id))
continue;
167 for (
int ieta=-41; ieta<=41; ++ieta){
168 for (
int iphi=1; iphi<=72; ++iphi){
170 for (
int isub=0; isub<3; ++isub){
172 if (!theTopo.
valid(detid))
continue;
175 if (lut==0)
throw cms::Exception(
"PROBLEM: No inputLUT_ in xml file for ") << detid << std::endl;
176 if (lut->size()!=128)
throw cms::Exception (
"PROBLEM: Wrong inputLUT_ size in xml file for ") << detid << std::endl;
193 std::map<int, float> cosh_ieta;
196 double eta1 = etas.first;
197 double eta2 = etas.second;
198 cosh_ieta[
i] = cosh((eta1 + eta2)/2.);
202 for (
int isub = 0; isub < 3; ++isub){
204 for (
int ieta = -41; ieta <= 41; ++ieta){
205 for (
int iphi = 1; iphi <= 72; ++iphi){
208 if (!metadata->
topo()->
valid(cell))
continue;
223 for (
int capId = 0; capId < 4; ++capId){
224 ped += calibrations.
pedestal(capId);
243 bool isMasked = ( (status &
bitToMask_) > 0 );
256 coder.
adc2fC(frame,samples);
257 float adc2fC = samples[0];
270 coder.
adc2fC(frame,samples);
271 float adc2fC = samples[0];
285 for (
int i=0;
i<df.
size();
i++){
286 ics[
i] = (lut.at(df[
i].
adc()) & 0x3FF);
293 for (
int i=0;
i<df.
size();
i++){
294 ics[
i] = (lut.at(df[
i].
adc()) & 0x3FF);
300 return ((
inputLUT_.at(lutId)).at(sample.
adc()) & 0x3FF);
305 return ped_.at(lutId);
310 return gain_.at(lutId);
319 msb.resize(df.
size());
320 for (
int i=0;
i<df.
size(); ++
i)
327 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
int getLUTId(uint32_t rawid) const
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
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
std::pair< double, double > etaRange(HcalSubdetector subdet, int ieta) const
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_