Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:29:29

0001 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0002 #include <CondFormats/EcalObjects/interface/EcalTPGFineGrainStripEE.h>
0003 #include <DataFormats/EcalDigi/interface/EEDataFrame.h>
0004 #include <SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixStripFgvbEE.h>
0005 #include <iostream>
0006 
0007 EcalFenixStripFgvbEE::EcalFenixStripFgvbEE() {
0008   identif_ = 0;
0009   flagBadStripMiss_ = false;
0010 }
0011 
0012 EcalFenixStripFgvbEE::~EcalFenixStripFgvbEE() {}
0013 
0014 void EcalFenixStripFgvbEE::process(std::vector<std::vector<int>> &linout, std::vector<int> &output) {
0015   std::vector<int> indexLut(output.size());
0016 
0017   for (unsigned int i = 0; i < output.size(); i++) {
0018     output[i] = 0;
0019     indexLut[i] = 0;
0020     for (unsigned int ixtal = 0; ixtal < linout.size(); ixtal++) {
0021       int adc = linout[ixtal][i];
0022       int res = (((adc & 0xffff) > threshold_fg_) || ((adc & 0x30000) != 0x0)) ? 1 : 0;
0023       indexLut[i] = indexLut[i] | (res << ixtal);
0024     }
0025     int mask = 1 << (indexLut[i]);
0026     output[i] = ((lut_fg_ & mask) == 0x0) ? 0 : 1;
0027     if (i > 0)
0028       output[i - 1] = output[i];  // Delay one clock
0029   }
0030   return;
0031 }
0032 
0033 void EcalFenixStripFgvbEE::setParameters(int identif, uint32_t id, const EcalTPGFineGrainStripEE *ecaltpgFgStripEE) {
0034   const EcalTPGFineGrainStripEEMap &fgmap = ecaltpgFgStripEE->getMap();
0035   EcalTPGFineGrainStripEEMapIterator it = fgmap.find(id);
0036   if (it != fgmap.end()) {
0037     threshold_fg_ = it->second.threshold;
0038     lut_fg_ = it->second.lut;
0039   } else {
0040     if (identif == false) {
0041       edm::LogWarning("EcalTPG") << " could not find EcalTPGFineGrainStripEEMap entry for at least "
0042                                     "one stripId";
0043       flagBadStripMiss_ = true;
0044     }
0045 
0046     // Use the FENIX power-up values
0047     threshold_fg_ = 65535;
0048     lut_fg_ = 0x0;
0049   }
0050 }