CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/src/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixStripFgvbEE.cc

Go to the documentation of this file.
00001 #include <SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixStripFgvbEE.h>
00002 #include <DataFormats/EcalDigi/interface/EEDataFrame.h>
00003 #include <CondFormats/EcalObjects/interface/EcalTPGFineGrainStripEE.h>
00004 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00005 #include <iostream>
00006 
00007 EcalFenixStripFgvbEE::EcalFenixStripFgvbEE()
00008 {
00009   identif_=0;
00010   flagBadStripMiss_=false;
00011 }
00012 
00013 EcalFenixStripFgvbEE::~EcalFenixStripFgvbEE(){
00014 }
00015 
00016 void EcalFenixStripFgvbEE::process( std::vector<std::vector<int> > &linout ,std::vector<int> & output)
00017 {
00018   std::vector<int> indexLut(output.size());
00019 
00020   for (unsigned int i=0;i<output.size();i++) {
00021     output[i]=0;
00022     indexLut[i]=0;
00023     for (unsigned int ixtal=0;ixtal<linout.size();ixtal++) {
00024       int adc=linout[ixtal][i];
00025       int res = (((adc & 0xffff) > threshold_fg_) || ((adc & 0x30000) != 0x0)) ? 1 : 0;
00026       indexLut[i] = indexLut[i] | (res << ixtal);
00027     }
00028     int mask = 1<<(indexLut[i]);
00029     output[i]= ((lut_fg_ & mask) == 0x0) ? 0 : 1;
00030     if(i > 0) output[i-1] = output[i]; // Delay one clock
00031   }
00032   return;
00033 }  
00034 
00035 void EcalFenixStripFgvbEE::setParameters(int identif, uint32_t id,const EcalTPGFineGrainStripEE * ecaltpgFgStripEE)
00036 {
00037   const EcalTPGFineGrainStripEEMap &fgmap = ecaltpgFgStripEE -> getMap();
00038   EcalTPGFineGrainStripEEMapIterator it=fgmap.find(id);
00039   if (it!=fgmap.end()){
00040      threshold_fg_ = it->second.threshold;
00041      lut_fg_ = it->second.lut;
00042   }
00043   else
00044   {
00045      if (identif == false){
00046        edm::LogWarning("EcalTPG")<<" could not find EcalTPGFineGrainStripEEMap entry for at least one stripId";
00047        flagBadStripMiss_ = true;
00048      }
00049      
00050      // Use the FENIX power-up values
00051      threshold_fg_ = 65535;
00052      lut_fg_ = 0x0;
00053   }
00054 
00055 }