CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2/src/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixFgvbEB.cc

Go to the documentation of this file.
00001 #include <SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixFgvbEB.h>
00002 #include "CondFormats/EcalObjects/interface/EcalTPGFineGrainEBGroup.h"
00003 #include "CondFormats/EcalObjects/interface/EcalTPGFineGrainEBIdMap.h"
00004 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00005 
00006 EcalFenixFgvbEB::EcalFenixFgvbEB(int maxNrSamples)
00007  {
00008    add_out_8_.resize(maxNrSamples); 
00009 }
00010 
00011 EcalFenixFgvbEB::~EcalFenixFgvbEB(){
00012 }
00013 
00014 void EcalFenixFgvbEB::process( std::vector<int> &add_out, std::vector<int> &maxof2_out, std::vector<int> &output) {
00015 
00016     int Elow, Ehigh, Tlow, Thigh, lut;
00017     int ERatLow,ERatHigh;
00018     //    std::vector<int> add_out_8(add_out.size());
00019     int COMP3, COMP2, COMP1, COMP0;
00020    
00021    //  Elow = (*params_)[1024];
00022 //     Ehigh = (*params_)[1025];
00023 //     Tlow = (*params_)[1026];
00024 //     Thigh = (*params_)[1027];
00025 //     lut = (*params_)[1028];
00026 
00027     Elow = ETlow_;
00028     Ehigh = EThigh_;
00029     Tlow = Ratlow_;
00030     Thigh = Rathigh_;
00031     lut = lut_;
00032 
00033     
00034     if (Tlow > 127) Tlow=Tlow-128;
00035     if (Thigh > 127) Thigh=Thigh-128;
00036    
00037     for (unsigned int i =0;i<add_out.size();i++) {
00038       
00039       ERatLow=add_out[i]*Tlow>>7;
00040       if (ERatLow>0xFFF) ERatLow=0xFFF;
00041       ERatHigh=add_out[i]*Thigh>>7;
00042       if (ERatHigh>0xFFF) ERatHigh=0xFFF;
00043       if (add_out[i] >0XFF) add_out_8_[i]=0xFF; else add_out_8_[i]=add_out[i];
00044 
00045       if( maxof2_out[i] >= ERatLow)  COMP3=1; else COMP3=0;
00046       if( maxof2_out[i] >= ERatHigh) COMP2=1; else COMP2=0;
00047       if( add_out_8_[i]  >= Elow)     COMP1=1; else COMP1=0;
00048       if( add_out_8_[i]  >= Ehigh)    COMP0=1; else COMP0=0;
00049 
00050       int ilut= (COMP3<<3) + (COMP2<<2) + (COMP1<<1) + COMP0;
00051       int mask = 1<<(ilut);
00052       output[i]= (lut) & (mask);
00053       if (output[i]>0) output[i]=1;
00054     }
00055     return;
00056   }
00057 
00058 void  EcalFenixFgvbEB::setParameters(uint32_t towid,const EcalTPGFineGrainEBGroup *ecaltpgFgEBGroup,const EcalTPGFineGrainEBIdMap *ecaltpgFineGrainEB ){
00059 
00060   const EcalTPGGroups::EcalTPGGroupsMap &groupmap = ecaltpgFgEBGroup -> getMap();
00061   EcalTPGGroups::EcalTPGGroupsMapItr it= groupmap.find(towid);
00062   if (it!=groupmap.end()) {
00063 //     uint32_t fgid =(*it).second;
00064 //     const EcalTPGFineGrainEBIdMap::EcalTPGFineGrainEBMap fgmap = ecaltpgFineGrainEB -> getMap();
00065 //     EcalTPGFineGrainEBIdMap::EcalTPGFineGrainEBMapItr itfg = fgmap.find(fgid);
00066 //     (*itfg).second.getValues( ETlow_,  EThigh_,  Ratlow_,  Rathigh_, lut_);
00067      EcalTPGFineGrainEBIdMap::EcalTPGFineGrainEBMapItr itfg = (ecaltpgFineGrainEB -> getMap()).find((*it).second);
00068      (*itfg).second.getValues( ETlow_,  EThigh_,  Ratlow_,  Rathigh_, lut_);
00069   }
00070   else edm::LogWarning("EcalTPG")<<" could not find EcalTPGGroupsMap entry for "<<towid;
00071  
00072 }