CMS 3D CMS Logo

DTConfigTrivialProducer.cc
Go to the documentation of this file.
5 #include <ostream>
6 
7 using std::cout;
8 using std::endl;
9 using std::unique_ptr;
10 using std::vector;
11 
12 //
13 // constructors and destructor
14 //
16  setWhatProduced(this);
17 
18  // get and store parameter set
19  m_ps = ps;
20  m_manager = new DTConfigManager();
22 
23  // set debug
24  edm::ParameterSet conf_ps = m_ps.getParameter<edm::ParameterSet>("DTTPGParameters");
25  m_debug = conf_ps.getUntrackedParameter<bool>("Debug");
26 
27  if (m_debug)
28  cout << "DTConfigTrivialProducer::DTConfigTrivialProducer()" << endl;
29 
31 
32  // DB specific requests
33  bool tracoLutsFromDB = m_ps.getParameter<bool>("TracoLutsFromDB");
34  bool useBtiAcceptParam = m_ps.getParameter<bool>("UseBtiAcceptParam");
35 
36  // set specific DB requests
37  m_manager->setLutFromDB(tracoLutsFromDB);
38  m_manager->setUseAcceptParam(useBtiAcceptParam); // CB Are these needed here???
39 }
40 
42  if (m_debug)
43  cout << "DTConfigTrivialProducer::~DTConfigTrivialProducer()" << endl;
44 }
45 
46 //
47 // member functions
48 //
49 
50 std::unique_ptr<DTConfigManager> DTConfigTrivialProducer::produce(const DTConfigManagerRcd &iRecord) {
51  if (m_debug)
52  cout << "DTConfigTrivialProducer::produce()" << endl;
53 
54  using namespace edm::es;
55  buildManager();
56 
57  // m_manager->getDTConfigPedestals()->print();
58 
59  std::unique_ptr<DTConfigManager> dtConfig = std::unique_ptr<DTConfigManager>(m_manager);
60 
61  return dtConfig;
62 }
63 
65  if (m_debug)
66  cout << "DTConfigTrivialProducer::buildManager()" << endl;
67 
68  // create config classes&C.
69  edm::ParameterSet conf_ps = m_ps.getParameter<edm::ParameterSet>("DTTPGParameters");
71  DTConfigSectColl sectcollconf(conf_ps.getParameter<edm::ParameterSet>("SectCollParameters"));
72  edm::ParameterSet tups = conf_ps.getParameter<edm::ParameterSet>("TUParameters");
73  DTConfigBti bticonf(tups.getParameter<edm::ParameterSet>("BtiParameters"));
74  DTConfigTraco tracoconf(tups.getParameter<edm::ParameterSet>("TracoParameters"));
75  DTConfigLUTs lutconf(tups.getParameter<edm::ParameterSet>("LutParameters"));
76  DTConfigTSTheta tsthetaconf(tups.getParameter<edm::ParameterSet>("TSThetaParameters"));
77  DTConfigTSPhi tsphiconf(tups.getParameter<edm::ParameterSet>("TSPhiParameters"));
78  DTConfigTrigUnit trigunitconf(tups);
79 
80  for (int iwh = -2; iwh <= 2; ++iwh) {
81  for (int ist = 1; ist <= 4; ++ist) {
82  for (int ise = 1; ise <= 12; ++ise) {
83  DTChamberId chambid(iwh, ist, ise);
84  vector<int> nmap = conf_map.getUntrackedParameter<vector<int>>(mapEntryName(chambid).c_str());
85 
86  if (m_debug) {
87  std::cout << " Filling configuration for chamber : wh " << chambid.wheel() << ", st " << chambid.station()
88  << ", se " << chambid.sector() << endl;
89  }
90 
91  // fill the bti map
92  for (int isl = 1; isl <= 3; isl++) {
93  int ncell = nmap[isl - 1];
94  // std::cout << ncell <<" , ";
95  for (int ibti = 0; ibti < ncell; ibti++) {
96  m_manager->setDTConfigBti(DTBtiId(chambid, isl, ibti + 1), bticonf);
97  if (m_debug)
98  std::cout << "Filling BTI config for chamber : wh " << chambid.wheel() << ", st " << chambid.station()
99  << ", se " << chambid.sector() << "... sl " << isl << ", bti " << ibti + 1 << endl;
100  }
101  }
102 
103  // fill the traco map
104  int ntraco = nmap[3];
105  // std::cout << ntraco << " }" << std::endl;
106  for (int itraco = 0; itraco < ntraco; itraco++) {
107  m_manager->setDTConfigTraco(DTTracoId(chambid, itraco + 1), tracoconf);
108  if (m_debug)
109  std::cout << "Filling TRACO config for chamber : wh " << chambid.wheel() << ", st " << chambid.station()
110  << ", se " << chambid.sector() << ", traco " << itraco + 1 << endl;
111  }
112 
113  // fill TS & TrigUnit
114  m_manager->setDTConfigTSTheta(chambid, tsthetaconf);
115  m_manager->setDTConfigTSPhi(chambid, tsphiconf);
116  m_manager->setDTConfigTrigUnit(chambid, trigunitconf);
117 
118  // fill LUTs
119  m_manager->setDTConfigLUTs(chambid, lutconf);
120  m_manager->setLutFromDB(false); // 110204 SV to be sure to compute luts from geometry
121  }
122  }
123  }
124 
125  for (int iwh = -2; iwh <= 2; ++iwh) {
126  for (int ise = 13; ise <= 14; ++ise) {
127  int ist = 4;
128  DTChamberId chambid(iwh, ist, ise);
129  vector<int> nmap = conf_map.getUntrackedParameter<vector<int>>(mapEntryName(chambid).c_str());
130 
131  if (m_debug) {
132  std::cout << " Filling configuration for chamber : wh " << chambid.wheel() << ", st " << chambid.station()
133  << ", se " << chambid.sector() << endl;
134  }
135 
136  // fill the bti map
137  for (int isl = 1; isl <= 3; isl++) {
138  int ncell = nmap[isl - 1];
139  // std::cout << ncell <<" , ";
140  for (int ibti = 0; ibti < ncell; ibti++) {
141  m_manager->setDTConfigBti(DTBtiId(chambid, isl, ibti + 1), bticonf);
142  if (m_debug)
143  std::cout << "Filling BTI config for chamber : wh " << chambid.wheel() << ", st " << chambid.station()
144  << ", se " << chambid.sector() << "... sl " << isl << ", bti " << ibti + 1 << endl;
145  }
146  }
147 
148  // fill the traco map
149  int ntraco = nmap[3];
150  // std::cout << ntraco << " }" << std::endl;
151  for (int itraco = 0; itraco < ntraco; itraco++) {
152  m_manager->setDTConfigTraco(DTTracoId(chambid, itraco + 1), tracoconf);
153  if (m_debug)
154  std::cout << "Filling TRACO config for chamber : wh " << chambid.wheel() << ", st " << chambid.station()
155  << ", se " << chambid.sector() << ", traco " << itraco + 1 << endl;
156  }
157 
158  // fill TS & TrigUnit
159  m_manager->setDTConfigTSTheta(chambid, tsthetaconf);
160  m_manager->setDTConfigTSPhi(chambid, tsphiconf);
161  m_manager->setDTConfigTrigUnit(chambid, trigunitconf);
162 
163  // fill LUTs
164  m_manager->setDTConfigLUTs(chambid, lutconf);
165  m_manager->setLutFromDB(false); // 110204 SV to be sure to compute luts from geometry
166  }
167  }
168 
169  // loop on Sector Collectors
170  for (int wh = -2; wh <= 2; wh++)
171  for (int se = 1; se <= 12; se++)
172  m_manager->setDTConfigSectColl(DTSectCollId(wh, se), sectcollconf);
173 
174  // fake collection of pedestals
176 }
177 
179  int counts = m_ps.getParameter<int>("bxOffset");
180  float fine = m_ps.getParameter<double>("finePhase");
181 
182  if (m_debug)
183  cout << "DTConfigTrivialProducer::buildPedestals()" << endl;
184 
185  // DTTPGParameters tpgParams;
186  for (int iwh = -2; iwh <= 2; ++iwh) {
187  for (int ist = 1; ist <= 4; ++ist) {
188  for (int ise = 1; ise <= 14; ++ise) {
189  if (ise > 12 && ist != 4)
190  continue;
191 
192  DTChamberId chId(iwh, ist, ise);
193  m_tpgParams->set(chId, counts, fine, DTTimeUnits::ns);
194  }
195  }
196  }
197 
198  DTConfigPedestals tpgPedestals;
199  tpgPedestals.setUseT0(false);
200  tpgPedestals.setES(m_tpgParams);
201 
202  return tpgPedestals;
203 }
204 
206  int iwh = chambid.wheel();
207  std::ostringstream os;
208  os << "wh";
209  if (iwh < 0) {
210  os << 'm' << -iwh;
211  } else {
212  os << iwh;
213  }
214  os << "st" << chambid.station() << "se" << chambid.sector();
215  return os.str();
216 }
DTTPGParameters::set
int set(int wheelId, int stationId, int sectorId, int nc, float ph, DTTimeUnits::type unit)
Definition: DTTPGParameters.cc:123
DTTracoId
Definition: DTTracoId.h:34
DTConfigSectColl
Definition: DTConfigSectColl.h:37
DTConfigTraco
Definition: DTConfigTraco.h:37
DTLayerId.h
DTConfigManager::setDTConfigLUTs
void setDTConfigLUTs(DTChamberId chambid, DTConfigLUTs conf)
Set DTConfigLUTs for desired chamber.
Definition: DTConfigManager.h:129
gather_cfg.cout
cout
Definition: gather_cfg.py:144
DTConfigTrivialProducer::m_ps
edm::ParameterSet m_ps
Definition: DTConfigTrivialProducer.h:62
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
DTConfigManager::setDTConfigPedestals
void setDTConfigPedestals(DTConfigPedestals pedestals)
Set DTConfigPedestals configuration.
Definition: DTConfigManager.h:135
DTConfigBti
Definition: DTConfigBti.h:36
DTConfigTrivialProducer::buildManager
void buildManager()
Build Config Manager.
Definition: DTConfigTrivialProducer.cc:64
DTConfigTrivialProducer.h
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
DTConfigTrivialProducer::buildTrivialPedestals
DTConfigPedestals buildTrivialPedestals()
Build Config Pedestals.
Definition: DTConfigTrivialProducer.cc:178
DTConfigPedestals::setES
void setES(DTTPGParameters const *tpgParams, DTT0 const *t0Params=nullptr)
Set parameters from ES.
Definition: DTConfigPedestals.cc:49
DTConfigTrivialProducer::m_tpgParams
DTTPGParameters * m_tpgParams
Definition: DTConfigTrivialProducer.h:64
DTConfigManager::setDTConfigTSTheta
void setDTConfigTSTheta(DTChamberId chambid, DTConfigTSTheta conf)
Set DTConfigTSTheta for desired chip.
Definition: DTConfigManager.h:120
DTConfigManager::setDTConfigTSPhi
void setDTConfigTSPhi(DTChamberId chambid, DTConfigTSPhi conf)
Set DTConfigTSPhi for desired chip.
Definition: DTConfigManager.h:123
DTConfigManager::setDTConfigTrigUnit
void setDTConfigTrigUnit(DTChamberId chambid, DTConfigTrigUnit conf)
Set DTConfigTrigUnit for desired chamber.
Definition: DTConfigManager.h:126
DTConfigTrigUnit
Definition: DTConfigTrigUnit.h:36
DTConfigManager::setDTTPGDebug
void setDTTPGDebug(bool debug)
SetGlobalDebug flag.
Definition: DTConfigManager.h:138
DTConfigManager::setUseAcceptParam
void setUseAcceptParam(bool acceptparam)
Set the use of Bti acceptance parameters (LL,LH,CL,CH,RL,RH)
Definition: DTConfigManager.h:144
DTConfigPedestals::setUseT0
void setUseT0(bool useT0)
Set t0i subtraction.
Definition: DTConfigPedestals.h:51
DTTimeUnits::ns
Definition: DTTimeUnits.h:32
DTSectCollId
Definition: DTSectCollId.h:18
DTConfigTrivialProducer::~DTConfigTrivialProducer
~DTConfigTrivialProducer() override
destructor
Definition: DTConfigTrivialProducer.cc:41
DTChamberId.h
DTConfigManager::setDTConfigTraco
void setDTConfigTraco(DTTracoId, DTConfigTraco)
Set DTConfigTraco for desired chip.
Definition: DTConfigManager.cc:183
DTConfigManagerRcd
Definition: DTConfigManagerRcd.h:31
DTConfigManager::setDTConfigBti
void setDTConfigBti(DTBtiId, DTConfigBti)
Set DTConfigBti for desired chip.
Definition: DTConfigManager.cc:178
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DTConfigManager::setLutFromDB
void setLutFromDB(bool lutFromDB)
Set lut from DB flag.
Definition: DTConfigManager.h:141
edm::ParameterSet
Definition: ParameterSet.h:47
DTConfigTrivialProducer::mapEntryName
std::string mapEntryName(const DTChamberId &chambid) const
Definition: DTConfigTrivialProducer.cc:205
DTConfigTrivialProducer::m_manager
DTConfigManager * m_manager
Definition: DTConfigTrivialProducer.h:63
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
DTBtiId
Definition: DTBtiId.h:32
DTConfigManager::setDTConfigSectColl
void setDTConfigSectColl(DTSectCollId sectcollid, DTConfigSectColl conf)
Set DTConfigSectColl for desired chip.
Definition: DTConfigManager.h:132
DTConfigTSPhi
Definition: DTConfigTSPhi.h:36
DTConfigManager
Definition: DTConfigManager.h:49
cms::cuda::device::unique_ptr
std::unique_ptr< T, impl::DeviceDeleter > unique_ptr
Definition: device_unique_ptr.h:33
DTConfigTrivialProducer::DTConfigTrivialProducer
DTConfigTrivialProducer(const edm::ParameterSet &)
Constructor.
Definition: DTConfigTrivialProducer.cc:15
DTConfigPedestals
Definition: DTConfigPedestals.h:36
DTChamberId::sector
int sector() const
Definition: DTChamberId.h:49
DTConfigTSTheta
Definition: DTConfigTSTheta.h:35
L1DTConfigParams_cff.DTTPGParameters
DTTPGParameters
Definition: L1DTConfigParams_cff.py:12
dqmiodumpmetadata.counts
counts
Definition: dqmiodumpmetadata.py:25
edm::es
Definition: es_Label.h:33
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
DTConfigTrivialProducer::produce
std::unique_ptr< DTConfigManager > produce(const DTConfigManagerRcd &)
ES produce method.
Definition: DTConfigTrivialProducer.cc:50
DTChamberId
Definition: DTChamberId.h:14
DTSuperLayerId.h
DTConfigLUTs
Definition: DTConfigLUTs.h:36
DTConfigTrivialProducer::m_debug
bool m_debug
Definition: DTConfigTrivialProducer.h:61
DTChamberId::wheel
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:39
DTChamberId::station
int station() const
Return the station number.
Definition: DTChamberId.h:42