CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_2_9_HLT1_bphpatch4/src/L1TriggerConfig/DTTPGConfig/src/DTConfigPedestals.cc

Go to the documentation of this file.
00001 //-------------------------------------------------
00002 //
00003 //   Class: DTConfigPedestals
00004 //
00005 //   Description: Take the time pedestals for trigger emulation
00006 //
00007 //
00008 //   Author List:
00009 //                      C.Battilana, M.Meneghelli
00010 //
00011 //   Modifications:
00012 //   
00013 //-----------------------------------------------------------------------
00014 
00015 //-----------------------
00016 // This Class's Header --
00017 //-----------------------
00018 #include "L1TriggerConfig/DTTPGConfig/interface/DTConfigPedestals.h"
00019 
00020 //---------------
00021 // C++ Headers --
00022 //---------------
00023 #include <string>  
00024 #include <iostream>
00025                
00026 //-------------------------------
00027 // Collaborating Class Headers --
00028 //-------------------------------
00029 
00030 //----------------
00031 // Constructors --
00032 //----------------
00033 
00034 DTConfigPedestals::DTConfigPedestals() : my_debug(false) , my_useT0(false) ,
00035                                          my_tpgParams(0) , my_t0i(0) {
00036 
00037   //my_tpgParams = 0;       // CB check that it could be done  outside this
00038   //my_t0i = 0;
00039 
00040 }
00041 
00042 //--------------
00043 // Destructor --
00044 //--------------
00045 
00046 DTConfigPedestals::~DTConfigPedestals() {}
00047 
00048 
00049 //--------------
00050 // Operations --
00051 //--------------
00052 
00053 void DTConfigPedestals::setES(DTTPGParameters const *tpgParams,
00054                               DTT0 const *t0Params) {
00055   
00056   my_tpgParams = tpgParams;
00057 
00058   if (useT0())
00059     my_t0i = t0Params;
00060   
00061 }
00062 
00063 
00064 float DTConfigPedestals::getOffset(const DTWireId& wire){
00065 
00066   int   nc = 0;
00067   float ph = 0.;
00068 
00069   //float coarse = my_tpgParams.totalTime(wire.chamberId(),DTTimeUnits::ns); // CB ask for this to be fixed
00070   my_tpgParams->get(wire.chamberId(),nc,ph,DTTimeUnits::ns);
00071   float pedestal = 25.*nc + ph;  
00072   
00073   float t0mean = 0.;
00074   float t0rms  = 0.;
00075 
00076   if( useT0() ) {
00077 
00078     my_t0i->get(wire,t0mean,t0rms,DTTimeUnits::ns);
00079     pedestal += t0mean;
00080 
00081   }
00082   
00083   if( debug() ){
00084     std::cout << "DTConfigPedestals::getOffset :" << std::endl;
00085     std::cout << "\t# of counts (BX): " << nc <<" fine corr (ns) : "<< ph << std::endl; 
00086     std::cout << "\tt0i subtraction : "; 
00087     if ( useT0() ) {
00088       std::cout  << "enabled. t0i for wire " << wire << " : " << t0mean << std::endl;
00089     } else {
00090       std::cout  << "disabled" << std::endl;
00091     }
00092   }
00093   
00094   return  pedestal;
00095   
00096 }
00097 
00098 
00099 void DTConfigPedestals::print() const {
00100 
00101   std::cout << "******************************************************************************" << std::endl;
00102   std::cout << "*                             DT ConfigPedestals                             *" << std::endl;
00103   std::cout << "******************************************************************************" << std::endl;
00104   std::cout << "*                                                                            *" << std::endl;
00105   std::cout << "Debug flag : "   << debug() << std::endl;
00106   std::cout << "Use t0i flag : " << useT0() << std::endl;
00107 
00108   for (int wh=-2 ; wh<=2; ++wh) {
00109     for (int sec=1 ; sec<=14; ++sec) {
00110       for (int st=1 ; st<=4; ++st) {
00111 
00112         if (sec>12 && st!=4) continue;
00113         
00114         int ncount = 0;
00115         float fine = 0.;
00116         DTChamberId chId = DTChamberId(wh,st,sec);
00117         my_tpgParams->get(chId,ncount,fine,DTTimeUnits::ns);
00118         
00119         std::cout << chId << "\t# counts (BX) : " << ncount
00120                   << "\tfine adj : " << fine << std::endl;
00121         
00122       }
00123     }
00124   }
00125 
00126   std::cout << "******************************************************************************" << std::endl;
00127 
00128 }