Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:31:04

0001 //-------------------------------------------------
0002 //
0003 //   Class: DTConfigPedestals
0004 //
0005 //   Description: Take the time pedestals for trigger emulation
0006 //
0007 //
0008 //   Author List:
0009 //              C.Battilana, M.Meneghelli
0010 //
0011 //   Modifications:
0012 //
0013 //-----------------------------------------------------------------------
0014 
0015 //-----------------------
0016 // This Class's Header --
0017 //-----------------------
0018 #include "L1TriggerConfig/DTTPGConfig/interface/DTConfigPedestals.h"
0019 
0020 //---------------
0021 // C++ Headers --
0022 //---------------
0023 #include <string>
0024 #include <iostream>
0025 
0026 //-------------------------------
0027 // Collaborating Class Headers --
0028 //-------------------------------
0029 
0030 //----------------
0031 // Constructors --
0032 //----------------
0033 
0034 DTConfigPedestals::DTConfigPedestals() : my_debug(false), my_useT0(false), my_tpgParams(nullptr), my_t0i(nullptr) {
0035   //my_tpgParams = 0;       // CB check that it could be done  outside this
0036   //my_t0i = 0;
0037 }
0038 
0039 //--------------
0040 // Destructor --
0041 //--------------
0042 
0043 DTConfigPedestals::~DTConfigPedestals() {}
0044 
0045 //--------------
0046 // Operations --
0047 //--------------
0048 
0049 void DTConfigPedestals::setES(DTTPGParameters const *tpgParams, DTT0 const *t0Params) {
0050   my_tpgParams = tpgParams;
0051 
0052   if (useT0())
0053     my_t0i = t0Params;
0054 }
0055 
0056 float DTConfigPedestals::getOffset(const DTWireId &wire) const {
0057   int nc = 0;
0058   float ph = 0.;
0059 
0060   //float coarse = my_tpgParams.totalTime(wire.chamberId(),DTTimeUnits::ns); // CB ask for this to be fixed
0061   my_tpgParams->get(wire.chamberId(), nc, ph, DTTimeUnits::ns);
0062   float pedestal = 25. * nc + ph;
0063 
0064   float t0mean = 0.;
0065   float t0rms = 0.;
0066 
0067   if (useT0()) {
0068     my_t0i->get(wire, t0mean, t0rms, DTTimeUnits::ns);
0069     pedestal += t0mean;
0070   }
0071 
0072   if (debug()) {
0073     std::cout << "DTConfigPedestals::getOffset :" << std::endl;
0074     std::cout << "\t# of counts (BX): " << nc << " fine corr (ns) : " << ph << std::endl;
0075     std::cout << "\tt0i subtraction : ";
0076     if (useT0()) {
0077       std::cout << "enabled. t0i for wire " << wire << " : " << t0mean << std::endl;
0078     } else {
0079       std::cout << "disabled" << std::endl;
0080     }
0081   }
0082 
0083   return pedestal;
0084 }
0085 
0086 void DTConfigPedestals::print() const {
0087   std::cout << "******************************************************************************" << std::endl;
0088   std::cout << "*                             DT ConfigPedestals                             *" << std::endl;
0089   std::cout << "******************************************************************************" << std::endl;
0090   std::cout << "*                                                                            *" << std::endl;
0091   std::cout << "Debug flag : " << debug() << std::endl;
0092   std::cout << "Use t0i flag : " << useT0() << std::endl;
0093 
0094   for (int wh = -2; wh <= 2; ++wh) {
0095     for (int sec = 1; sec <= 14; ++sec) {
0096       for (int st = 1; st <= 4; ++st) {
0097         if (sec > 12 && st != 4)
0098           continue;
0099 
0100         int ncount = 0;
0101         float fine = 0.;
0102         DTChamberId chId = DTChamberId(wh, st, sec);
0103         my_tpgParams->get(chId, ncount, fine, DTTimeUnits::ns);
0104 
0105         std::cout << chId << "\t# counts (BX) : " << ncount << "\tfine adj : " << fine << std::endl;
0106       }
0107     }
0108   }
0109 
0110   std::cout << "******************************************************************************" << std::endl;
0111 }