32 #include "CLHEP/Random/RandomEngine.h"
33 #include "CLHEP/Random/RandGaussQ.h"
69 data = (std::auto_ptr<T>)(const_cast<T*>(emul.
product()));
72 template <>
inline void
75 CLHEP::HepRandomEngine*) {
77 for(col_cit it = emul->begin(); it!=emul->end(); it++) {
79 int iphi = it->id().iphi();
80 bool reset = (iphi>18 && iphi<39);
81 for(
int s=0;
s<5;
s++) {
82 uint16_t
sample = it->sample(
s).raw();
83 if(sample==0)
continue;
89 std::cout <<
"[emulbias] etp " << *it <<
"\t sample: " <<
s <<
" "
90 << std::hex << sample <<
" -> " << col.
sample(
s).
raw()
91 << std::dec << std::endl;
97 template <>
inline void
100 CLHEP::HepRandomEngine*) {
102 for(col_cit it = emul->begin(); it!=emul->end(); it++) {
104 int iphi = it->id().iphi();
105 bool reset = (iphi>18 && iphi<27);
106 for(
int s=0;
s<5;
s++) {
107 uint16_t
sample = it->sample(
s).raw();
108 if(sample==0)
continue;
114 data->push_back(col);
118 template <>
inline void
121 CLHEP::HepRandomEngine* engine) {
122 typedef L1CaloEmCollection::const_iterator col_cit;
123 for(col_cit it = emul->begin(); it!=emul->end(); it++) {
124 unsigned crate = it->rctCrate();
125 unsigned raw = it->raw();
126 bool iso = it->isolated();
127 unsigned rdata = raw;
128 if(crate<4*engine->flat())
130 L1CaloEmCand cand(rdata,crate,iso,it->index(),it->bx(),
false);
131 data->push_back(cand);
138 template <>
inline void
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())
149 L1CaloRegion cand(rdata,it->gctEta(),it->gctPhi(),it->bx());
150 data->push_back(cand);
156 template <>
inline void
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())
167 data->push_back(cand);
173 template <>
inline void
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())
184 data->push_back(cand);
189 template <>
inline void
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)
203 data->push_back(cand);
227 template <>
inline void
230 CLHEP::HepRandomEngine* engine) {
232 typedef TrackContainer::const_iterator col_cit;
233 TrackContainer
const* tracks_in = emul->getContainer();
235 for(col_cit it = tracks_in->begin(); it!=tracks_in->end(); it++) {
238 unsigned pt = it->pt_packed();
239 unsigned qua = it->quality();
244 tracks.push_back(cand);
246 data->setContainer(tracks);
258 template <>
inline void
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 cand(it->bxNum(),it->whNum(),it->scNum(),it->stNum(),
272 it->phi(),it->phiB(),uqua,it->Ts2Tag(),it->BxCnt() );
275 data->setContainer(
tracks);
278 template <>
inline void
281 CLHEP::HepRandomEngine*) {
282 typedef std::vector<L1MuDTChambThDigi> Thi_Container;
283 typedef Thi_Container::const_iterator col_cit;
284 Thi_Container
const* tracks_in = emul->getContainer();
285 Thi_Container
tracks(tracks_in->size());
287 for(col_cit it=tracks_in->begin(); it!=tracks_in->end(); it++) {
288 for(
int j=0;
j<7;
j++) {
289 uos[
j]=(it->position(
j)?0:1);
290 uqa[
j]=(it->quality (
j)?0:1);
292 int stnum = it->stNum();
293 stnum = (stnum>2?stnum-1:stnum);
295 cand(it->bxNum(),it->whNum(),it->scNum(),stnum,uos,uqa);
298 data->setContainer(
tracks);
301 template <>
inline void
304 CLHEP::HepRandomEngine*) {
305 typedef std::vector<LTCDigi>::const_iterator col_cit;
306 for(col_cit it=emul->begin(); it!=emul->end(); it++) {
307 data->push_back(*it);
313 template <>
inline void
316 CLHEP::HepRandomEngine*) {
318 typedef std::vector<L1MuGMTCand>::const_iterator col_cit;
319 for(col_cit it=emul->begin(); it!=emul->end(); it++) {
320 float phiv = it->phiValue();
321 unsigned dword = it->getDataWord();
322 if(phiv>2. && phiv<4.)
325 data->push_back(cand);
331 template <>
inline void
334 CLHEP::HepRandomEngine*) {
335 typedef std::vector<L1MuGMTReadoutRecord>::const_iterator col_cit;
336 std::vector<L1MuGMTReadoutRecord>
col = emul->getRecords();
337 for(col_cit it = col.begin(); it!=col.end(); it++) {
340 rec.setEvNr (it->getEvNr ());
341 rec.setBCERR(it->getBCERR());
353 typedef L1MuRegionalCandCollection::const_iterator ait;
354 for(ait it = old_dttf.begin(); it!=old_dttf.end(); it++) {
359 new_dttf->push_back(cand);
361 for(ait it = old_rpcb.begin(); it!=old_rpcb.end(); it++) {
366 new_rpcb->push_back(cand);
368 for(ait it = old_csc.begin(); it!=old_csc.end(); it++) {
373 new_csc->push_back(cand);
375 for(ait it = old_rpcf.begin(); it!=old_rpcf.end(); it++) {
380 new_rpcf->push_back(cand);
383 for(
unsigned i=0;
i<old_dttf.size();
i++)
384 rec.setInputCand(
i ,new_dttf->at(
i));
385 for(
unsigned i=0;
i<old_rpcb.size();
i++)
386 rec.setInputCand(
i+ 4,new_rpcb->at(
i));
387 for(
unsigned i=0;
i<old_csc .size();
i++)
388 rec.setInputCand(
i+ 8,new_csc ->at(
i));
389 for(
unsigned i=0;
i<old_rpcf.size();
i++)
390 rec.setInputCand(
i+12,new_rpcf->at(
i));
392 data->addRecord(rec);
397 template <>
inline void
400 CLHEP::HepRandomEngine*) {
405 for (mapIt mit = emul->begin(); mit != emul->end(); mit++) {
412 for (vecIt vit = emul->get((*mit).first).first;
413 vit != emul->get((*mit).first).second; vit++) {
424 data->insertDigi(did,dg);
431 CLHEP::HepRandomEngine*) {
432 typedef L1CSCTrackCollection::const_iterator col_cit;
440 for(col_cit tcit=emul->begin(); tcit!=emul->end(); tcit++) {
450 for (mapIt mit = ldc.begin(); mit != ldc.end(); mit++) {
456 for (vecIt vit = ldc.get((*mit).first).first;
457 vit != ldc.get((*mit).first).second; vit++) {
462 dgcoll->insertDigi(did,dg);
465 L1CSCTrack l1csctrk = std::make_pair(l1trk,*dgcoll);
466 data->push_back(l1csctrk);
void setSample(int i, const HcalTriggerPrimitiveSample &sam)
bool m_doSys[dedefs::DEnsys]
std::vector< EcalTriggerPrimitiveDigi >::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.
uint16_t raw() const
get the raw word
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 ModifyCollection(std::auto_ptr< T > &data, const edm::Handle< T > emul, CLHEP::HepRandomEngine *)
void setPtPacked(unsigned pt)
Set Pt: 0..31.
std::vector< CSCCorrelatedLCTDigi > CSCCorrelatedLCTDigiCollection_
void setSampleValue(int i, uint16_t value)
std::vector< CSCCorrelatedLCTDigi >::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.
char data[epos_bytes_allocation]
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