CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
35  my_tpgParams(0) , my_t0i(0) {
36 
37  //my_tpgParams = 0; // CB check that it could be done outside this
38  //my_t0i = 0;
39 
40 }
41 
42 //--------------
43 // Destructor --
44 //--------------
45 
47 
48 
49 //--------------
50 // Operations --
51 //--------------
52 
54  DTT0 const *t0Params) {
55 
56  my_tpgParams = tpgParams;
57 
58  if (useT0())
59  my_t0i = t0Params;
60 
61 }
62 
63 
65 
66  int nc = 0;
67  float ph = 0.;
68 
69  //float coarse = my_tpgParams.totalTime(wire.chamberId(),DTTimeUnits::ns); // CB ask for this to be fixed
71  float pedestal = 25.*nc + ph;
72 
73  float t0mean = 0.;
74  float t0rms = 0.;
75 
76  if( useT0() ) {
77 
78  my_t0i->get(wire,t0mean,t0rms,DTTimeUnits::ns);
79  pedestal += t0mean;
80 
81  }
82 
83  if( debug() ){
84  std::cout << "DTConfigPedestals::getOffset :" << std::endl;
85  std::cout << "\t# of counts (BX): " << nc <<" fine corr (ns) : "<< ph << std::endl;
86  std::cout << "\tt0i subtraction : ";
87  if ( useT0() ) {
88  std::cout << "enabled. t0i for wire " << wire << " : " << t0mean << std::endl;
89  } else {
90  std::cout << "disabled" << std::endl;
91  }
92  }
93 
94  return pedestal;
95 
96 }
97 
98 
100 
101  std::cout << "******************************************************************************" << std::endl;
102  std::cout << "* DT ConfigPedestals *" << std::endl;
103  std::cout << "******************************************************************************" << std::endl;
104  std::cout << "* *" << std::endl;
105  std::cout << "Debug flag : " << debug() << std::endl;
106  std::cout << "Use t0i flag : " << useT0() << std::endl;
107 
108  for (int wh=-2 ; wh<=2; ++wh) {
109  for (int sec=1 ; sec<=14; ++sec) {
110  for (int st=1 ; st<=4; ++st) {
111 
112  if (sec>12 && st!=4) continue;
113 
114  int ncount = 0;
115  float fine = 0.;
116  DTChamberId chId = DTChamberId(wh,st,sec);
117  my_tpgParams->get(chId,ncount,fine,DTTimeUnits::ns);
118 
119  std::cout << chId << "\t# counts (BX) : " << ncount
120  << "\tfine adj : " << fine << std::endl;
121 
122  }
123  }
124  }
125 
126  std::cout << "******************************************************************************" << std::endl;
127 
128 }
int debug() const
Debug flag.
DTConfigPedestals()
Default Constructor.
DTChamberId chamberId() const
Return the corresponding ChamberId.
DTTPGParameters const * my_tpgParams
void print() const
Print the setup.
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:69
Definition: DTT0.h:52
float getOffset(const DTWireId &wire)
Get wire by wire delay.
void setES(DTTPGParameters const *tpgParams, DTT0 const *t0Params=0)
Set parameters from ES.
bool useT0() const
Use t0i.
tuple cout
Definition: gather_cfg.py:121
int get(int wheelId, int stationId, int sectorId, int &nc, float &ph, DTTimeUnits::type unit) const
get content
~DTConfigPedestals()
Destructor.