CMS 3D CMS Logo

DTConfigPedestals.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: DTConfigPedestals
4 //
5 // Description: Take the time pedestals for trigger emulation
6 //
7 //
8 // Author List:
9 // C.Battilana, M.Meneghelli
10 //
11 // Modifications:
12 //
13 //-----------------------------------------------------------------------
14 
15 //-----------------------
16 // This Class's Header --
17 //-----------------------
19 
20 //---------------
21 // C++ Headers --
22 //---------------
23 #include <string>
24 #include <iostream>
25 
26 //-------------------------------
27 // Collaborating Class Headers --
28 //-------------------------------
29 
30 //----------------
31 // Constructors --
32 //----------------
33 
34 DTConfigPedestals::DTConfigPedestals() : my_debug(false), my_useT0(false), my_tpgParams(nullptr), my_t0i(nullptr) {
35  //my_tpgParams = 0; // CB check that it could be done outside this
36  //my_t0i = 0;
37 }
38 
39 //--------------
40 // Destructor --
41 //--------------
42 
44 
45 //--------------
46 // Operations --
47 //--------------
48 
49 void DTConfigPedestals::setES(DTTPGParameters const *tpgParams, DTT0 const *t0Params) {
50  my_tpgParams = tpgParams;
51 
52  if (useT0())
53  my_t0i = t0Params;
54 }
55 
57  int nc = 0;
58  float ph = 0.;
59 
60  //float coarse = my_tpgParams.totalTime(wire.chamberId(),DTTimeUnits::ns); // CB ask for this to be fixed
61  my_tpgParams->get(wire.chamberId(), nc, ph, DTTimeUnits::ns);
62  float pedestal = 25. * nc + ph;
63 
64  float t0mean = 0.;
65  float t0rms = 0.;
66 
67  if (useT0()) {
68  my_t0i->get(wire, t0mean, t0rms, DTTimeUnits::ns);
69  pedestal += t0mean;
70  }
71 
72  if (debug()) {
73  std::cout << "DTConfigPedestals::getOffset :" << std::endl;
74  std::cout << "\t# of counts (BX): " << nc << " fine corr (ns) : " << ph << std::endl;
75  std::cout << "\tt0i subtraction : ";
76  if (useT0()) {
77  std::cout << "enabled. t0i for wire " << wire << " : " << t0mean << std::endl;
78  } else {
79  std::cout << "disabled" << std::endl;
80  }
81  }
82 
83  return pedestal;
84 }
85 
87  std::cout << "******************************************************************************" << std::endl;
88  std::cout << "* DT ConfigPedestals *" << std::endl;
89  std::cout << "******************************************************************************" << std::endl;
90  std::cout << "* *" << std::endl;
91  std::cout << "Debug flag : " << debug() << std::endl;
92  std::cout << "Use t0i flag : " << useT0() << std::endl;
93 
94  for (int wh = -2; wh <= 2; ++wh) {
95  for (int sec = 1; sec <= 14; ++sec) {
96  for (int st = 1; st <= 4; ++st) {
97  if (sec > 12 && st != 4)
98  continue;
99 
100  int ncount = 0;
101  float fine = 0.;
102  DTChamberId chId = DTChamberId(wh, st, sec);
103  my_tpgParams->get(chId, ncount, fine, DTTimeUnits::ns);
104 
105  std::cout << chId << "\t# counts (BX) : " << ncount << "\tfine adj : " << fine << std::endl;
106  }
107  }
108  }
109 
110  std::cout << "******************************************************************************" << std::endl;
111 }
DTConfigPedestals()
Default Constructor.
DTTPGParameters const * my_tpgParams
void setES(DTTPGParameters const *tpgParams, DTT0 const *t0Params=nullptr)
Set parameters from ES.
Definition: DTT0.h:48
int get(int wheelId, int stationId, int sectorId, int &nc, float &ph, DTTimeUnits::type unit) const
get content
bool useT0() const
Use t0i.
void print() const
Print the setup.
float getOffset(const DTWireId &wire) const
Get wire by wire delay.
int get(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, float &t0mean, float &t0rms, DTTimeUnits::type unit) const
Definition: DTT0.cc:48
int debug() const
Debug flag.
~DTConfigPedestals() override
Destructor.