34 #include "CLHEP/Random/RandomEngine.h" 35 #include "CLHEP/Random/RandGaussQ.h" 69 data = (std::unique_ptr<T>)(const_cast<T*>(
emul.product()));
75 CLHEP::HepRandomEngine*) {
77 for (col_cit it =
emul->begin(); it !=
emul->end(); it++) {
79 int iphi = it->id().iphi();
81 for (
int s = 0;
s < 5;
s++) {
82 uint16_t
sample = it->sample(
s).raw();
90 std::cout <<
"[emulbias] etp " << *it <<
"\t sample: " <<
s <<
" " << std::hex <<
sample <<
" -> " 100 CLHEP::HepRandomEngine*) {
102 for (col_cit it =
emul->begin(); it !=
emul->end(); it++) {
104 int iphi = it->id().iphi();
106 for (
int s = 0;
s < 5;
s++) {
107 uint16_t
sample = it->sample(
s).raw();
122 CLHEP::HepRandomEngine* engine) {
123 typedef L1CaloEmCollection::const_iterator col_cit;
124 for (col_cit it =
emul->begin(); it !=
emul->end(); it++) {
125 unsigned crate = it->rctCrate();
126 unsigned raw = it->raw();
127 bool iso = it->isolated();
128 unsigned rdata = raw;
129 if (crate < 4 * engine->flat())
141 CLHEP::HepRandomEngine* engine) {
142 typedef L1CaloRegionCollection::const_iterator col_cit;
143 for (col_cit it =
emul->begin(); it !=
emul->end(); it++) {
144 unsigned crate = it->rctCrate();
145 unsigned raw = it->et();
146 uint16_t rdata = raw;
147 if (crate < 4 * engine->flat())
159 CLHEP::HepRandomEngine* engine) {
160 typedef L1GctEmCandCollection::const_iterator col_cit;
161 for (col_cit it =
emul->begin(); it !=
emul->end(); it++) {
162 unsigned raw = it->raw();
163 uint16_t rdata = raw;
164 if (it->phiIndex() < 4 * engine->flat())
176 CLHEP::HepRandomEngine* engine) {
177 typedef L1GctJetCandCollection::const_iterator col_cit;
178 for (col_cit it =
emul->begin(); it !=
emul->end(); it++) {
179 unsigned raw = it->raw();
180 uint16_t rdata = raw;
181 if (it->phiIndex() < 4 * engine->flat())
192 CLHEP::HepRandomEngine* engine) {
193 typedef L1MuRegionalCandCollection::const_iterator col_cit;
194 for (col_cit it =
emul->begin(); it !=
emul->end(); it++) {
197 unsigned phi = it->phi_packed();
198 if (
phi > 90 &&
phi < 110)
199 cand.setPtPacked((it->pt_packed()) >> 1);
230 CLHEP::HepRandomEngine* engine) {
232 typedef TrackContainer::const_iterator col_cit;
235 for (col_cit it = tracks_in->begin(); it != tracks_in->end(); it++) {
237 cand.setType(it->type_idx());
238 unsigned pt = it->pt_packed();
239 unsigned qua = it->quality();
241 cand.setPtPacked((
pt >> 2) & 0x1f);
242 cand.setQualityPacked((qua << 1) & 0x07);
261 CLHEP::HepRandomEngine* engine) {
262 typedef std::vector<L1MuDTChambPhDigi> Phi_Container;
263 typedef Phi_Container::const_iterator col_it;
264 Phi_Container
const* tracks_in =
emul->getContainer();
265 Phi_Container
tracks(tracks_in->size());
267 for (col_it it = tracks_in->begin(); it != tracks_in->end(); it++) {
269 uqua = (uqua < 2 ? uqua + 1 : uqua);
271 it->bxNum(), it->whNum(), it->scNum(), it->stNum(), it->phi(), it->phiB(), uqua, it->Ts2Tag(), it->BxCnt());
280 CLHEP::HepRandomEngine*) {
281 typedef std::vector<L1MuDTChambThDigi> Thi_Container;
282 typedef Thi_Container::const_iterator col_cit;
283 Thi_Container
const* tracks_in =
emul->getContainer();
284 Thi_Container
tracks(tracks_in->size());
286 for (col_cit it = tracks_in->begin(); it != tracks_in->end(); it++) {
287 for (
int j = 0;
j < 7;
j++) {
288 uos[
j] = (it->position(
j) ? 0 : 1);
289 uqa[
j] = (it->quality(
j) ? 0 : 1);
291 int stnum = it->stNum();
292 stnum = (stnum > 2 ? stnum - 1 : stnum);
302 CLHEP::HepRandomEngine*) {
303 typedef std::vector<LTCDigi>::const_iterator col_cit;
304 for (col_cit it =
emul->begin(); it !=
emul->end(); it++) {
305 data->push_back(*it);
314 CLHEP::HepRandomEngine*) {
316 typedef std::vector<L1MuGMTCand>::const_iterator col_cit;
317 for (col_cit it =
emul->begin(); it !=
emul->end(); it++) {
318 float phiv = it->phiValue();
319 unsigned dword = it->getDataWord();
320 if (phiv > 2. && phiv < 4.)
332 CLHEP::HepRandomEngine*) {
333 typedef std::vector<L1MuGMTReadoutRecord>::const_iterator col_cit;
334 std::vector<L1MuGMTReadoutRecord>
col =
emul->getRecords();
335 for (col_cit it =
col.begin(); it !=
col.end(); it++) {
338 rec.setEvNr(it->getEvNr());
339 rec.setBCERR(it->getBCERR());
351 typedef L1MuRegionalCandCollection::const_iterator ait;
352 for (ait it = old_dttf.begin(); it != old_dttf.end(); it++) {
354 if (it->quality() < 4)
355 cand.setPtPacked((it->pt_packed() >> 2) & 0x1f);
356 cand.setType(it->type_idx());
357 new_dttf->push_back(
cand);
359 for (ait it = old_rpcb.begin(); it != old_rpcb.end(); it++) {
361 if (it->quality() < 4)
362 cand.setPtPacked((it->pt_packed() >> 2) & 0x1f);
363 cand.setType(it->type_idx());
364 new_rpcb->push_back(
cand);
366 for (ait it = old_csc.begin(); it != old_csc.end(); it++) {
368 if (it->quality() < 4)
369 cand.setPtPacked((it->pt_packed() >> 2) & 0x1f);
370 cand.setType(it->type_idx());
371 new_csc->push_back(
cand);
373 for (ait it = old_rpcf.begin(); it != old_rpcf.end(); it++) {
375 if (it->quality() < 4)
376 cand.setPtPacked((it->pt_packed() >> 2) & 0x1f);
377 cand.setType(it->type_idx());
378 new_rpcf->push_back(
cand);
381 for (
unsigned i = 0;
i < old_dttf.size();
i++)
382 rec.setInputCand(
i, new_dttf->at(
i));
383 for (
unsigned i = 0;
i < old_rpcb.size();
i++)
384 rec.setInputCand(
i + 4, new_rpcb->at(
i));
385 for (
unsigned i = 0;
i < old_csc.size();
i++)
386 rec.setInputCand(
i + 8, new_csc->at(
i));
387 for (
unsigned i = 0;
i < old_rpcf.size();
i++)
388 rec.setInputCand(
i + 12, new_rpcf->at(
i));
390 data->addRecord(rec);
398 CLHEP::HepRandomEngine*) {
403 for (mapIt mit =
emul->begin(); mit !=
emul->end(); mit++) {
410 for (vecIt vit =
emul->get((*mit).first).first; vit !=
emul->get((*mit).first).second; vit++) {
422 data->insertDigi(did, dg);
430 CLHEP::HepRandomEngine*) {
431 typedef L1CSCTrackCollection::const_iterator col_cit;
439 for (col_cit tcit =
emul->begin(); tcit !=
emul->end(); tcit++) {
449 for (mapIt mit = ldc.begin(); mit != ldc.end(); mit++) {
455 for (vecIt vit = ldc.get((*mit).first).first; vit != ldc.get((*mit).first).second; vit++) {
461 dgcoll->insertDigi(did, dg);
464 L1CSCTrack l1csctrk = std::make_pair(l1trk, *dgcoll);
465 data->push_back(l1csctrk);
void endJob(void) override
void ModifyCollection(std::unique_ptr< T > &data, const edm::Handle< T > emul, CLHEP::HepRandomEngine *)
bool m_doSys[dedefs::DEnsys]
std::pair< csc::L1Track, CSCCorrelatedLCTDigiCollection > L1CSCTrack
unsigned pt_packed() const
return pt packed as in hardware
unsigned int quality() const
return quality
std::vector< T >::const_iterator const_iterator
Level-1 Trigger jet candidate.
Level-1 Region Calorimeter Trigger EM candidate.
L1EmulBias(const edm::ParameterSet &)
Level-1 Trigger EM candidate at output of GCT.
std::vector< TrackWithHistory * > TrackContainer
void setType(unsigned type)
Set Type: 0 DT, 1 bRPC, 2 CSC, 3 fRPC.
edm::InputTag m_DEsource[dedefs::DEnsys][2]
std::vector< L1MuRegionalCand > L1MuRegionalCandCollection
std::string instName[dedefs::DEnsys][5]
auto const & tracks
cannot be loose
void setPtPacked(unsigned pt)
Set Pt: 0..31.
std::vector< CSCCorrelatedLCTDigi > CSCCorrelatedLCTDigiCollection_
void produce(edm::Event &, const edm::EventSetup &) override
std::vector< DigiType >::const_iterator const_iterator
void setBxNr(int bxnr)
set counters
char data[epos_bytes_allocation]
A calorimeter trigger region (sum of 4x4 trigger towers)
void reset(double vett[256])
void beginJob(void) override
unsigned type_idx() const
return type: 0 DT, 1 bRPC, 2 CSC, 3 fRPC