34 #include "CLHEP/Random/RandFlat.h"
35 #include "CLHEP/Random/RandGaussQ.h"
74 data = (std::auto_ptr<T>)(const_cast<T*>(emul.
product()));
77 template <>
inline void
81 for(col_cit it = emul->begin(); it!=emul->end(); it++) {
83 int iphi = it->id().iphi();
84 bool reset = (iphi>18 && iphi<39);
85 for(
int s=0;
s<5;
s++) {
86 uint16_t sample = it->sample(
s).raw();
87 if(sample==0)
continue;
88 uint16_t
tmp = reset?0:sample;
93 std::cout <<
"[emulbias] etp " << *it <<
"\t sample: " <<
s <<
" "
94 << std::hex << sample <<
" -> " << col.
sample(
s).
raw()
95 << std::dec << std::endl;
101 template <>
inline void
105 for(col_cit it = emul->begin(); it!=emul->end(); it++) {
107 int iphi = it->id().iphi();
108 bool reset = (iphi>18 && iphi<27);
109 for(
int s=0;
s<5;
s++) {
110 uint16_t sample = it->sample(
s).raw();
111 if(sample==0)
continue;
112 uint16_t
tmp = reset?0:sample;
117 data->push_back(col);
121 template <>
inline void
124 typedef L1CaloEmCollection::const_iterator col_cit;
125 for(col_cit it = emul->begin(); it!=emul->end(); it++) {
126 unsigned crate = it->rctCrate();
127 unsigned raw = it->raw();
128 bool iso = it->isolated();
129 unsigned rdata =
raw;
130 if(crate<4*rndFlat_->fire())
132 L1CaloEmCand cand(rdata,crate,iso,it->index(),it->bx(),
false);
133 data->push_back(cand);
140 template <>
inline void
143 typedef L1CaloRegionCollection::const_iterator col_cit;
144 for(col_cit it = emul->begin(); it!=emul->end(); it++) {
145 unsigned crate = it->rctCrate();
146 unsigned raw = it->et();
147 uint16_t rdata =
raw;
148 if(crate<4*rndFlat_->fire())
150 L1CaloRegion cand(rdata,it->gctEta(),it->gctPhi(),it->bx());
151 data->push_back(cand);
157 template <>
inline void
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*
rndFlat_->fire())
167 data->push_back(cand);
173 template <>
inline void
176 typedef L1GctJetCandCollection::const_iterator col_cit;
177 for(col_cit it = emul->begin(); it!=emul->end(); it++) {
178 unsigned raw = it->raw();
179 uint16_t rdata =
raw;
180 if(it->phiIndex()<4*
rndFlat_->fire())
183 data->push_back(cand);
188 template <>
inline void
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)
201 data->push_back(cand);
225 template <>
inline void
229 typedef TrackContainer::const_iterator col_cit;
230 TrackContainer* tracks_in = emul->getContainer();
232 for(col_cit it = tracks_in->begin(); it!=tracks_in->end(); it++) {
235 unsigned pt = it->pt_packed();
236 unsigned qua = it->quality();
241 tracks.push_back(cand);
243 data->setContainer(tracks);
255 template <>
inline void
258 typedef std::vector<L1MuDTChambPhDigi> Phi_Container;
259 typedef Phi_Container::const_iterator col_it;
260 Phi_Container* tracks_in = emul->getContainer();
261 Phi_Container
tracks(tracks_in->size());
263 for(col_it it=tracks_in->begin(); it!=tracks_in->end(); it++) {
265 uqua = (uqua<2?uqua+1:uqua);
267 cand(it->bxNum(),it->whNum(),it->scNum(),it->stNum(),
268 it->phi(),it->phiB(),uqua,it->Ts2Tag(),it->BxCnt() );
271 data->setContainer(
tracks);
274 template <>
inline void
277 typedef std::vector<L1MuDTChambThDigi> Thi_Container;
278 typedef Thi_Container::const_iterator col_cit;
279 Thi_Container* tracks_in = emul->getContainer();
280 Thi_Container
tracks(tracks_in->size());
282 for(col_cit it=tracks_in->begin(); it!=tracks_in->end(); it++) {
283 for(
int j=0;
j<7;
j++) {
284 uos[
j]=(it->position(
j)?0:1);
285 uqa[
j]=(it->quality (
j)?0:1);
287 int stnum = it->stNum();
288 stnum = (stnum>2?stnum-1:stnum);
290 cand(it->bxNum(),it->whNum(),it->scNum(),stnum,uos,uqa);
293 data->setContainer(
tracks);
296 template <>
inline void
299 typedef std::vector<LTCDigi>::const_iterator col_cit;
300 for(col_cit it=emul->begin(); it!=emul->end(); it++) {
301 data->push_back(*it);
307 template <>
inline void
311 typedef std::vector<L1MuGMTCand>::const_iterator col_cit;
312 for(col_cit it=emul->begin(); it!=emul->end(); it++) {
313 float phiv = it->phiValue();
314 unsigned dword = it->getDataWord();
315 if(phiv>2. && phiv<4.)
318 data->push_back(cand);
324 template <>
inline void
327 typedef std::vector<L1MuGMTReadoutRecord>::const_iterator col_cit;
328 std::vector<L1MuGMTReadoutRecord> col = emul->getRecords();
329 for(col_cit it = col.begin(); it!=col.end(); it++) {
332 rec.setEvNr (it->getEvNr ());
333 rec.setBCERR(it->getBCERR());
345 typedef L1MuRegionalCandCollection::const_iterator ait;
346 for(ait it = old_dttf.begin(); it!=old_dttf.end(); it++) {
351 new_dttf->push_back(cand);
353 for(ait it = old_rpcb.begin(); it!=old_rpcb.end(); it++) {
358 new_rpcb->push_back(cand);
360 for(ait it = old_csc.begin(); it!=old_csc.end(); it++) {
365 new_csc->push_back(cand);
367 for(ait it = old_rpcf.begin(); it!=old_rpcf.end(); it++) {
372 new_rpcf->push_back(cand);
375 for(
unsigned i=0;
i<old_dttf.size();
i++)
376 rec.setInputCand(
i ,new_dttf->at(
i));
377 for(
unsigned i=0;
i<old_rpcb.size();
i++)
378 rec.setInputCand(
i+ 4,new_rpcb->at(
i));
379 for(
unsigned i=0;
i<old_csc .size();
i++)
380 rec.setInputCand(
i+ 8,new_csc ->at(
i));
381 for(
unsigned i=0;
i<old_rpcf.size();
i++)
382 rec.setInputCand(
i+12,new_rpcf->at(
i));
384 data->addRecord(rec);
389 template <>
inline void
396 for (mapIt mit = emul->begin(); mit != emul->end(); mit++) {
403 for (vecIt vit = emul->get((*mit).first).first;
404 vit != emul->get((*mit).first).second; vit++) {
415 data->insertDigi(did,dg);
422 typedef L1CSCTrackCollection::const_iterator col_cit;
430 for(col_cit tcit=emul->begin(); tcit!=emul->end(); tcit++) {
440 for (mapIt mit = ldc.begin(); mit != ldc.end(); mit++) {
446 for (vecIt vit = ldc.get((*mit).first).first;
447 vit != ldc.get((*mit).first).second; vit++) {
452 dgcoll->insertDigi(did,dg);
455 L1CSCTrack l1csctrk = std::make_pair(l1trk,*dgcoll);
456 data->push_back(l1csctrk);
void setSample(int i, const HcalTriggerPrimitiveSample &sam)
bool m_doSys[dedefs::DEnsys]
std::vector< T >::const_iterator const_iterator
Level-1 Trigger jet candidate.
void ModifyCollection(std::auto_ptr< T > &data, const edm::Handle< T > emul)
Level-1 Region Calorimeter Trigger EM candidate.
CLHEP::RandFlat * rndFlat_
L1EmulBias(const edm::ParameterSet &)
Level-1 Trigger EM candidate at output of GCT.
uint16_t raw() const
get the raw word
CLHEP::RandGaussQ * rndGaus_
std::vector< TrackWithHistory * > TrackContainer
virtual void produce(edm::Event &, const edm::EventSetup &)
virtual void endJob(void)
const EcalTriggerPrimitiveSample & sample(int i) const
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]
void setPtPacked(unsigned pt)
Set Pt: 0..31.
std::vector< CSCCorrelatedLCTDigi > CSCCorrelatedLCTDigiCollection_
void setSampleValue(int i, uint16_t value)
std::vector< DigiType >::const_iterator const_iterator
unsigned int quality() const
return quality
void setBxNr(int bxnr)
set counters
T const * product() const
std::vector< std::vector< double > > tmp
void setQualityPacked(unsigned qual)
Set Quality: 0..7.
virtual void beginJob(void)
std::pair< csc::L1Track, CSCCorrelatedLCTDigiCollection > L1CSCTrack
A calorimeter trigger region (sum of 4x4 trigger towers)
unsigned pt_packed() const
return pt packed as in hardware
void reset(double vett[256])
unsigned type_idx() const
return type: 0 DT, 1 bRPC, 2 CSC, 3 fRPC