Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include <SimCalorimetry/EcalEBTrigPrimAlgos/interface/EcalEBPhase2TPFormatter.h>
0002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0003 #include <iostream>
0004 
0005 EcalEBPhase2TPFormatter::EcalEBPhase2TPFormatter(bool debug) : debug_(debug) {}
0006 
0007 EcalEBPhase2TPFormatter::~EcalEBPhase2TPFormatter() {}
0008 
0009 void EcalEBPhase2TPFormatter::process(std::vector<int> &amp,
0010                                       std::vector<int64_t> &time,
0011                                       std::vector<int> &outEt,
0012                                       std::vector<int64_t> &outTime) {
0013   unsigned int size = amp.size();
0014   outEt.resize(size);
0015   outTime.resize(size);
0016 
0017   for (unsigned int i = 0; i < size; ++i) {
0018     outEt[i] = amp[i];
0019     outTime[i] = time[i];
0020   }
0021 
0022   for (unsigned int i = 0; i < size; ++i) {
0023     // this is the energy compression to 12 bits to go in the DF. To be done as last thing before building the TP
0024     //Bit shift by 1 to go from 13 bits to 12
0025     outEt[i] = outEt[i] >> 1;
0026     if (outEt[i] > 0xFFF)
0027       outEt[i] = 0xFFF;
0028   }
0029 
0030   for (unsigned int i = 0; i < size; ++i) {
0031     // this is the time compression to 5 bits to go in the DF.
0032     outTime[i] = outTime[i] >> 6;
0033     if (outTime[i] > 0xf)
0034       outTime[i] = 0xf;
0035     else if (outTime[i] < -0x10)
0036       outTime[i] = -0x10;
0037   }
0038 }