CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2_patch1/src/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixMaxof2.cc

Go to the documentation of this file.
00001 #include <SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixMaxof2.h>
00002 
00003 
00004 // global type definitions for class implementation in source file defined by Tag entries in ArgoUML
00005 // Result: typedef <typedef_global_source> <tag_value>;
00006 EcalFenixMaxof2::EcalFenixMaxof2(int maxNrSamples, int nbMaxStrips) : nbMaxStrips_(nbMaxStrips)
00007 {
00008   std::vector<int> vec(maxNrSamples,0);
00009   for (int i2strip =0;i2strip<nbMaxStrips_-1;++i2strip)
00010     sumby2_.push_back(vec);
00011 }
00012   
00013 EcalFenixMaxof2::~EcalFenixMaxof2(){
00014 }
00015   
00016 void EcalFenixMaxof2::process(std::vector<std::vector <int> > &bypasslinout, int nstrip, int bitMask,std::vector<int> &output)
00017 {
00018   int mask = (1<<bitMask)-1;
00019   for (int i2strip =0;i2strip<nstrip-1;++i2strip)
00020     for (unsigned int i=0;i<output.size();i++)      sumby2_[i2strip][i]=0; 
00021   for (unsigned int i=0;i<output.size();i++) output[i] = 0;
00022   
00023   for (unsigned int i=0;i<output.size();i++){
00024     if (nstrip-1==0){
00025       output[i]=((bypasslinout[0][i])&mask);
00026     }else {
00027       for ( int i2strip=0; i2strip< nstrip-1;++i2strip){ 
00028         sumby2_[i2strip][i]= ((bypasslinout[i2strip][i])&mask)+((bypasslinout[i2strip+1][i])&mask);
00029         if (sumby2_[i2strip][i]>output[i]){
00030           output[i]=sumby2_[i2strip][i];
00031         }
00032       }
00033     }
00034   }
00035   return;
00036 }
00037 
00038