32 #include "CLHEP/Random/RandomEngine.h"
33 #include "CLHEP/Random/RandGaussQ.h"
67 data = (std::unique_ptr<T>)(const_cast<T*>(emul.
product()));
73 CLHEP::HepRandomEngine*) {
75 for (col_cit it = emul->
begin(); it != emul->
end(); it++) {
77 int iphi = it->id().iphi();
79 for (
int s = 0;
s < 5;
s++) {
80 uint16_t
sample = it->sample(
s).raw();
88 std::cout <<
"[emulbias] etp " << *it <<
"\t sample: " <<
s <<
" " << std::hex <<
sample <<
" -> "
98 CLHEP::HepRandomEngine*) {
100 for (col_cit it = emul->
begin(); it != emul->
end(); it++) {
102 int iphi = it->id().iphi();
104 for (
int s = 0;
s < 5;
s++) {
105 uint16_t
sample = it->sample(
s).raw();
120 CLHEP::HepRandomEngine* engine) {
121 typedef L1CaloEmCollection::const_iterator col_cit;
122 for (col_cit it = emul->begin(); it != emul->end(); it++) {
123 unsigned crate = it->rctCrate();
124 unsigned raw = it->raw();
125 bool iso = it->isolated();
126 unsigned rdata = raw;
127 if (crate < 4 * engine->flat())
139 CLHEP::HepRandomEngine* engine) {
140 typedef L1CaloRegionCollection::const_iterator col_cit;
141 for (col_cit it = emul->begin(); it != emul->end(); it++) {
142 unsigned crate = it->rctCrate();
143 unsigned raw = it->et();
144 uint16_t rdata = raw;
145 if (crate < 4 * engine->flat())
157 CLHEP::HepRandomEngine* engine) {
158 typedef L1GctEmCandCollection::const_iterator col_cit;
159 for (col_cit it = emul->begin(); it != emul->end(); it++) {
160 unsigned raw = it->raw();
161 uint16_t rdata = raw;
162 if (it->phiIndex() < 4 * engine->flat())
174 CLHEP::HepRandomEngine* engine) {
175 typedef L1GctJetCandCollection::const_iterator col_cit;
176 for (col_cit it = emul->begin(); it != emul->end(); it++) {
177 unsigned raw = it->raw();
178 uint16_t rdata = raw;
179 if (it->phiIndex() < 4 * engine->flat())
190 CLHEP::HepRandomEngine* engine) {
191 typedef L1MuRegionalCandCollection::const_iterator col_cit;
192 for (col_cit it = emul->begin(); it != emul->end(); it++) {
195 unsigned phi = it->phi_packed();
196 if (
phi > 90 &&
phi < 110)
197 cand.setPtPacked((it->pt_packed()) >> 1);
228 CLHEP::HepRandomEngine* engine) {
230 typedef TrackContainer::const_iterator col_cit;
233 for (col_cit it = tracks_in->begin(); it != tracks_in->end(); it++) {
235 cand.setType(it->type_idx());
236 unsigned pt = it->pt_packed();
237 unsigned qua = it->quality();
239 cand.setPtPacked((
pt >> 2) & 0x1f);
240 cand.setQualityPacked((qua << 1) & 0x07);
259 CLHEP::HepRandomEngine* engine) {
260 typedef std::vector<L1MuDTChambPhDigi> Phi_Container;
261 typedef Phi_Container::const_iterator col_it;
263 Phi_Container
tracks(tracks_in->size());
265 for (col_it it = tracks_in->begin(); it != tracks_in->end(); it++) {
267 uqua = (uqua < 2 ? uqua + 1 : uqua);
269 it->bxNum(), it->whNum(), it->scNum(), it->stNum(), it->phi(), it->phiB(), uqua, it->Ts2Tag(), it->BxCnt());
278 CLHEP::HepRandomEngine*) {
279 typedef std::vector<L1MuDTChambThDigi> Thi_Container;
280 typedef Thi_Container::const_iterator col_cit;
282 Thi_Container
tracks(tracks_in->size());
284 for (col_cit it = tracks_in->begin(); it != tracks_in->end(); it++) {
285 for (
int j = 0;
j < 7;
j++) {
286 uos[
j] = (it->position(
j) ? 0 : 1);
287 uqa[
j] = (it->quality(
j) ? 0 : 1);
289 int stnum = it->stNum();
290 stnum = (stnum > 2 ? stnum - 1 : stnum);
300 CLHEP::HepRandomEngine*) {
301 typedef std::vector<LTCDigi>::const_iterator col_cit;
302 for (col_cit it = emul->begin(); it != emul->end(); it++) {
303 data->push_back(*it);
312 CLHEP::HepRandomEngine*) {
314 typedef std::vector<L1MuGMTCand>::const_iterator col_cit;
315 for (col_cit it = emul->begin(); it != emul->end(); it++) {
316 float phiv = it->phiValue();
317 unsigned dword = it->getDataWord();
318 if (phiv > 2. && phiv < 4.)
330 CLHEP::HepRandomEngine*) {
331 typedef std::vector<L1MuGMTReadoutRecord>::const_iterator col_cit;
333 for (col_cit it =
col.begin(); it !=
col.end(); it++) {
336 rec.setEvNr(it->getEvNr());
337 rec.setBCERR(it->getBCERR());
349 typedef L1MuRegionalCandCollection::const_iterator ait;
350 for (ait it = old_dttf.begin(); it != old_dttf.end(); it++) {
352 if (it->quality() < 4)
353 cand.setPtPacked((it->pt_packed() >> 2) & 0x1f);
354 cand.setType(it->type_idx());
355 new_dttf->push_back(
cand);
357 for (ait it = old_rpcb.begin(); it != old_rpcb.end(); it++) {
359 if (it->quality() < 4)
360 cand.setPtPacked((it->pt_packed() >> 2) & 0x1f);
361 cand.setType(it->type_idx());
362 new_rpcb->push_back(
cand);
364 for (ait it = old_csc.begin(); it != old_csc.end(); it++) {
366 if (it->quality() < 4)
367 cand.setPtPacked((it->pt_packed() >> 2) & 0x1f);
368 cand.setType(it->type_idx());
369 new_csc->push_back(
cand);
371 for (ait it = old_rpcf.begin(); it != old_rpcf.end(); it++) {
373 if (it->quality() < 4)
374 cand.setPtPacked((it->pt_packed() >> 2) & 0x1f);
375 cand.setType(it->type_idx());
376 new_rpcf->push_back(
cand);
379 for (
unsigned i = 0;
i < old_dttf.size();
i++)
380 rec.setInputCand(
i, new_dttf->at(
i));
381 for (
unsigned i = 0;
i < old_rpcb.size();
i++)
382 rec.setInputCand(
i + 4, new_rpcb->at(
i));
383 for (
unsigned i = 0;
i < old_csc.size();
i++)
384 rec.setInputCand(
i + 8, new_csc->at(
i));
385 for (
unsigned i = 0;
i < old_rpcf.size();
i++)
386 rec.setInputCand(
i + 12, new_rpcf->at(
i));
388 data->addRecord(rec);
396 CLHEP::HepRandomEngine*) {
401 for (mapIt mit = emul->begin(); mit != emul->end(); mit++) {
408 for (vecIt vit = emul->get((*mit).first).first; vit != emul->get((*mit).first).second; vit++) {
420 data->insertDigi(did, dg);
428 CLHEP::HepRandomEngine*) {
429 typedef L1CSCTrackCollection::const_iterator col_cit;
437 for (col_cit tcit = emul->begin(); tcit != emul->end(); tcit++) {
447 for (mapIt mit = ldc.begin(); mit != ldc.end(); mit++) {
453 for (vecIt vit = ldc.get((*mit).first).first; vit != ldc.get((*mit).first).second; vit++) {
459 dgcoll->insertDigi(did, dg);
462 L1CSCTrack l1csctrk = std::make_pair(l1trk, *dgcoll);
463 data->push_back(l1csctrk);