CMS 3D CMS Logo

EcalFenixTcp.cc

Go to the documentation of this file.
00001 #include <SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixTcp.h>
00002 #include <SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixTcpFormat.h>
00003 
00004 #include "CondFormats/EcalObjects/interface/EcalTPGFineGrainEBGroup.h"
00005 #include "CondFormats/EcalObjects/interface/EcalTPGLutGroup.h"
00006 #include "CondFormats/EcalObjects/interface/EcalTPGLutIdMap.h"
00007 #include "CondFormats/EcalObjects/interface/EcalTPGFineGrainEBIdMap.h"
00008 #include "CondFormats/EcalObjects/interface/EcalTPGFineGrainTowerEE.h"
00009 
00010 #include "FWCore/Framework/interface/ESHandle.h"
00011 
00012 #include <vector>
00013 //----------------------------------------------------------------------------------------
00014 EcalFenixTcp::EcalFenixTcp(const edm::EventSetup& setup,bool tcpFormat, bool debug,bool famos, int binOfMax, int maxNrSamples, int nbMaxStrips): debug_(debug),nbMaxStrips_(nbMaxStrips)
00015  { 
00016     bypasslin_.resize(nbMaxStrips_);
00017     for (int i=0;i<nbMaxStrips_;i++) bypasslin_[i] = new EcalFenixBypassLin();
00018     adder_= new EcalFenixEtTot();
00019     maxOf2_=new EcalFenixMaxof2(maxNrSamples,nbMaxStrips_);
00020     formatter_= new EcalFenixTcpFormat(tcpFormat, debug_, famos, binOfMax);
00021     fgvbEB_= new EcalFenixFgvbEB(maxNrSamples);
00022     fgvbEE_= new EcalFenixTcpFgvbEE(maxNrSamples);
00023 
00024     // permanent data structures
00025     bypasslin_out_.resize(nbMaxStrips_);
00026     std::vector<int> vec(maxNrSamples,0);
00027     for (int i=0;i<nbMaxStrips_;i++) bypasslin_out_[i]=vec;
00028     adder_out_.resize(maxNrSamples);
00029     maxOf2_out_.resize(maxNrSamples);
00030     fgvb_out_.resize(maxNrSamples);
00031 
00032   }
00033 //-----------------------------------------------------------------------------------------  
00034   EcalFenixTcp::~EcalFenixTcp() {
00035     for (int i=0;i<nbMaxStrips_;i++) delete bypasslin_[i];
00036     delete adder_; 
00037     delete maxOf2_;
00038     delete formatter_;
00039     delete fgvbEB_;
00040     delete fgvbEE_;
00041   }
00042 //-----------------------------------------------------------------------------------------  
00043 
00044 void EcalFenixTcp::process(const edm::EventSetup& setup,
00045                            std::vector <EBDataFrame> &bid,             //dummy argument for template call 
00046                            std::vector<std::vector<int> > & tpframetow, int nStr,
00047                            std::vector< EcalTriggerPrimitiveSample> & tptow,
00048                            std::vector< EcalTriggerPrimitiveSample> & tptow2,
00049                            bool isInInnerRing, EcalTrigTowerDetId towid) 
00050 {
00051 
00052   int bitMask=12; 
00053   process_part1(tpframetow,nStr,bitMask);
00054 
00055   process_part2_barrel(tpframetow,nStr,ecaltpgFgEBGroup_,ecaltpgLutGroup_,ecaltpgLut_,ecaltpgFineGrainEB_,tptow,tptow2,towid);
00056 }
00057  
00058 //-----------------------------------------------------------------------------------------  
00059 void EcalFenixTcp::process(const edm::EventSetup& setup,
00060                            std::vector <EEDataFrame> &bid,  //dummy argument for template call 
00061                            std::vector<std::vector<int> > & tpframetow, int nStr,
00062                            std::vector< EcalTriggerPrimitiveSample> & tptow,
00063                            std::vector< EcalTriggerPrimitiveSample> & tptow2,
00064                            bool isInInnerRing, EcalTrigTowerDetId towid) 
00065 {
00066   int bitMask=10;
00067   process_part1(tpframetow,nStr,bitMask);
00068   process_part2_endcap(tpframetow,nStr,bitMask,ecaltpgLutGroup_,ecaltpgLut_,ecaltpgFineGrainTowerEE_,tptow,tptow2,isInInnerRing, towid);
00069 }
00070 //----------------------------------------------------------------------------------------- 
00071 void EcalFenixTcp::process_part1(std::vector<std::vector<int> > &tpframetow, int nStr, int bitMask)
00072 {
00073 //  //call bypasslin
00074 //     for (int istrip=0;istrip<nStr;istrip ++){
00075 //       this->getBypasslin(istrip)->process(tpframetow[istrip],bypasslin_out_[istrip]);
00076 //     }
00077 //     //this is a test
00078 //     if (debug_) {
00079 //       std::cout<<"bypasslinout = "<<std::endl;
00080 //       for (int istrip=0;istrip<nStr;istrip ++){
00081 //      std::vector<int> stripin= bypasslin_out_[istrip];
00082 //      for (unsigned int is=0;is<stripin.size();is++){
00083 //        std::cout<<stripin[is]<<" ";
00084 //      }
00085 //      std::cout<<std::endl;
00086 //       }
00087 //     }
00088 
00089 //     //call adder
00090 //     this->getAdder()->process(bypasslin_out_, nStr, bitMask,adder_out_);
00091      this->getAdder()->process(tpframetow, nStr, bitMask,adder_out_);
00092     //this is a test:
00093     if (debug_) {
00094       std::cout<< "output of adder is a vector of size: "<<adder_out_.size()<<std::endl; 
00095       std::cout<< "value : "<<std::endl;
00096       for (unsigned int i =0; i<adder_out_.size();i++){
00097         std::cout <<" "<<adder_out_[i];
00098       }    
00099       std::cout<<std::endl;
00100     }
00101     //    return adder_out;
00102     return;
00103     
00104 }
00105 //-----------------------------------------------------------------------------------------
00106 void EcalFenixTcp::process_part2_barrel(std::vector<std::vector<int> > & bypasslinout, int nStr,
00107                                         const EcalTPGFineGrainEBGroup *ecaltpgFgEBGroup,
00108                                         const EcalTPGLutGroup *ecaltpgLutGroup,
00109                                         const EcalTPGLutIdMap *ecaltpgLut,
00110                                         const EcalTPGFineGrainEBIdMap *ecaltpgFineGrainEB,
00111                                         std::vector< EcalTriggerPrimitiveSample> & tcp_out,
00112                                         std::vector< EcalTriggerPrimitiveSample> & tcp_outTcc,
00113                                         EcalTrigTowerDetId towid)
00114 {
00115   //call maxof2
00116   //  this->getMaxOf2()->process(bypasslin_out_,nStr,maxOf2_out_);
00117   this->getMaxOf2()->process(bypasslinout,nStr,maxOf2_out_);
00118   // this is a test:
00119   if (debug_) {
00120     std::cout<< "output of maxof2 is a vector of size: "<<maxOf2_out_.size()<<std::endl; 
00121     std::cout<< "value : "<<std::endl;
00122     for (unsigned int i =0; i<maxOf2_out_.size();i++){
00123       std::cout <<" "<<std::dec<<maxOf2_out_[i];
00124     }    
00125     std::cout<<std::endl;
00126   }
00127    
00128   //call fgvb
00129 
00130   this->getFGVBEB()->setParameters(towid.rawId(),ecaltpgFgEBGroup,ecaltpgFineGrainEB );
00131   this->getFGVBEB()->process(adder_out_,maxOf2_out_,fgvb_out_);
00132   //this is a test:
00133   if (debug_) {
00134     std::cout<< "output of fgvb is a vector of size: "<<fgvb_out_.size()<<std::endl; 
00135     std::cout<< "value : "<<std::endl;
00136     for (unsigned int i =0; i<fgvb_out_.size();i++){
00137       std::cout <<" "<<std::dec<<fgvb_out_[i];
00138     }    
00139     std::cout<<std::endl;
00140   }
00141 
00142   // call formatter
00143   int eTTotShift=2;
00144  
00145   this->getFormatter()->setParameters(towid.rawId(),ecaltpgLutGroup,ecaltpgLut);
00146   this->getFormatter()->process(adder_out_,fgvb_out_,eTTotShift,tcp_out,tcp_outTcc,false);
00147   //this is a test:
00148   if (debug_) {
00149     std::cout<< "output of TCP formatter Barrel is a vector of size: "<<std::dec<<tcp_out.size()<<std::endl; 
00150     std::cout<< "value : "<<std::endl;
00151     for (unsigned int i =0; i<tcp_out.size();i++){
00152       std::cout <<" "<<i<<" "<<std::dec<<tcp_out[i];
00153     }    
00154     std::cout<<std::endl;
00155   }
00156     
00157   return;
00158 }
00159 //-----------------------------------------------------------------------------------------
00160 void EcalFenixTcp::process_part2_endcap(std::vector<std::vector<int> > & bypasslinout, int nStr, int bitMask,
00161                                         const EcalTPGLutGroup *ecaltpgLutGroup,
00162                                         const EcalTPGLutIdMap *ecaltpgLut,
00163                                         const EcalTPGFineGrainTowerEE *ecaltpgFineGrainTowerEE,
00164                                         std::vector< EcalTriggerPrimitiveSample> & tcp_out,
00165                                         std::vector< EcalTriggerPrimitiveSample> & tcp_outTcc,bool isInInnerRings,                                      EcalTrigTowerDetId towid)
00166 
00167 {
00168   //call fgvb
00169   this->getFGVBEE()->setParameters(towid.rawId(),ecaltpgFineGrainTowerEE);
00170   //  fgvbEE_->process(bypasslin_out_,nStr,bitMask,fgvb_out_);
00171   fgvbEE_->process(bypasslinout,nStr,bitMask,fgvb_out_);
00172 
00173   //call formatter
00174   int eTTotShift=0;
00175 
00176   this->getFormatter()->setParameters(towid.rawId(),ecaltpgLutGroup,ecaltpgLut);
00177 
00178   this->getFormatter()->process(adder_out_,fgvb_out_,eTTotShift,tcp_out,tcp_outTcc,isInInnerRings);
00179   //this is a test:
00180   if (debug_) {
00181     std::cout<< "output of TCP formatter(endcap) is a vector of size: "<<std::dec<<tcp_out.size()<<std::endl; 
00182     std::cout<< "value : "<<std::endl;
00183     for (unsigned int i =0; i<tcp_out.size();i++){
00184       std::cout <<" "<<i<<" "<<std::dec<<tcp_out[i]<<std::endl;
00185     }    
00186     std::cout<<std::endl;
00187   }
00188   return;
00189 }

Generated on Tue Jun 9 17:46:18 2009 for CMSSW by  doxygen 1.5.4