1 #ifndef L1_DUMMY_PRODUCER_H
2 #define L1_DUMMY_PRODUCER_H
34 #include "CLHEP/Random/RandomEngine.h"
35 #include "CLHEP/Random/RandGaussQ.h"
72 template <
class T>
void
77 template <>
inline void
81 std::cout <<
"L1DummyProducer::SimpleDigi<EcalTrigPrimDigiCollection>....\n" << std::flush;
82 int side = (engine->flat()>0.5)?-1:1;
83 int ieta = (int) (1 + 17*engine->flat());
84 int iphi = (int) (1 + 72*engine->flat());
88 bool fg = (engine->flat()>0.5);
89 int ttf = (int)(8*engine->flat());
93 data->push_back(e_digi);
97 std::cout <<
"L1DummyProducer::SimpleDigi<EcalTrigPrimDigiCollection> end.\n" << std::flush;
100 template <>
inline void
104 std::cout <<
"L1DummyProducer::SimpleDigi<HcalTrigPrimDigiCollection>....\n" << std::flush;
105 int side = (engine->flat()>0.5)?-1:1;
106 int ieta = (int) (1 + 17*engine->flat());
107 int iphi = (int) (1 + 72*engine->flat());
114 data->push_back(h_digi);
118 std::cout <<
"L1DummyProducer::SimpleDigi<HcalTrigPrimDigiCollection> end.\n" << std::flush;
121 template <>
inline void
125 std::cout <<
"L1DummyProducer::SimpleDigi<L1CaloEmCollection>....\n" << std::flush;
127 unsigned rank = energy & 0x3f;
128 unsigned region= (engine->flat()>0.5?0:1);
129 unsigned card = (unsigned)(7*engine->flat());
130 unsigned crate = (unsigned)(18*engine->flat());
131 bool iso = (engine->flat()>0.4);
132 uint16_t
index = (unsigned)(4*engine->flat());
134 L1CaloEmCand cand(rank, region, card, crate, iso, index, bx);
135 data->push_back(cand);
138 std::cout <<
"L1DummyProducer::SimpleDigi<L1CaloEmCollection> end.\n" << std::flush;
141 template <>
inline void
145 std::cout <<
"L1DummyProducer::SimpleDigi<L1CaloRegionCollection>....\n" << std::flush;
147 unsigned et = energy & 0x3ff;
152 unsigned crate= (unsigned)(18*engine->flat());
153 unsigned card = (unsigned)(7*engine->flat());
154 unsigned rgn = crate%2;
155 L1CaloRegion cand( et, overFlow, tauVeto, mip, quiet, crate, card, rgn );
156 data->push_back(cand);
159 std::cout <<
"L1DummyProducer::SimpleDigi<L1CaloRegionCollection> end.\n" << std::flush;
162 template <>
inline void
166 std::cout <<
"L1DummyProducer::SimpleDigi<L1GctEmCandCollection>....\n" << std::flush;
177 <<
"L1DummyProducer::SimpleDigi production of L1GctEmCandCollection "
178 <<
" invalid type: " << type << std::endl;
181 unsigned rank = energy & 0x3f;
182 unsigned phi = (unsigned)(18*engine->flat());
183 unsigned eta = (unsigned)( 7*engine->flat());
184 if(engine->flat()>0.5)
185 eta = (eta&0x7) + (0x1<<3);
187 data->push_back(cand);
191 std::cout <<
"L1DummyProducer::SimpleDigi<L1GctEmCandCollection> end.\n" << std::flush;
194 template <>
inline void
198 std::cout <<
"L1DummyProducer::SimpleDigi<L1GctJetCandCollection>....\n" << std::flush;
215 <<
"L1DummyProducer::SimpleDigi production of L1GctJetCandCollection "
216 <<
" invalid type: " << type << std::endl;
220 unsigned rank = energy & 0x3f;
221 unsigned phi = (unsigned)(18*engine->flat());
222 unsigned eta = (unsigned)( 7*engine->flat());
223 if(engine->flat()>0.5)
224 eta = (eta&0x7) + (0x1<<3);
226 data->push_back(cand);
229 std::cout <<
"L1DummyProducer::SimpleDigi<L1GctJetCandCollection> end.\n" << std::flush;
232 template <>
inline void
236 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuRegionalCandCollection>....\n" << std::flush;
238 assert(type>=0 && type<4);
239 unsigned type_idx=
type;
241 unsigned phi,
eta,
pt, charge, ch_valid, finehalo, quality;
242 float phiv(0.), etav(0.), ptv(0.);
243 for(
int i=0;
i<4;
i++) {
244 phi = (int)(144*engine->flat());
245 eta = (int)( 63*engine->flat());
247 etav = 2.5*(-1+2*eta/63.);
248 pt = ((int)(32*engine->flat())) & 0x1f;
250 charge = (engine->flat()>0.5?0:1);;
253 quality = (int)(8*engine->flat());
255 ch_valid, finehalo, quality, bx);
259 data->push_back(cand);
264 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuRegionalCandCollection> end.\n" << std::flush;
267 template <>
inline void
273 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuDTTrackContainer>....\n" << std::flush;
276 typedef std::vector<L1MuDTTrackCand> L1MuDTTrackCandCollection;
277 std::auto_ptr<L1MuDTTrackCandCollection> tracksd (
new L1MuDTTrackCandCollection());
278 for(L1MuRegionalCandCollection::const_iterator it=tracks->begin(); it!=tracks->end(); it++) {
281 cnd->
setBx(it->bx());
283 tracksd->push_back(*cnd);
285 data->setContainer(*tracksd);
287 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuDTTrackContainer> end.\n" << std::flush;
293 template <>
inline void
297 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuDTChambPhContainer>....\n" << std::flush;
298 typedef std::vector<L1MuDTChambPhDigi> Phi_Container;
300 Phi_Container
tracks(ntrk);
301 int ubx, uwh, usc, ust,uphr, uphb, uqua, utag, ucnt;
302 for (
int i=0;
i<ntrk;
i++) {
312 uwh = (int)(-2+5*engine->flat());
313 usc = (int)( 12*engine->flat());
314 ust = (int)(1.+4*engine->flat());
315 uqua= (int)( 8*engine->flat());
317 tracks.push_back(cand);
319 data->setContainer(tracks);
323 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuDTChambPhContainer> end.\n" << std::flush;
326 template <>
inline void
330 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuDTChambThContainer>....\n" << std::flush;
331 typedef std::vector<L1MuDTChambThDigi> The_Container;
333 The_Container
tracks(ntrk);
334 int ubx, uwh, usc, ust, uos[7], uqa[7];
335 for (
int i=0;
i<ntrk;
i++) {
337 uwh = (int)(-2+5*engine->flat());
338 usc = (int)( 12*engine->flat());
339 ust = (int)(1.+4*engine->flat());
340 for(
int j=0;
j<7;
j++) {
341 uos[
j]=(engine->flat()>0.5?0:1);
342 uqa[
j]=(engine->flat()>0.5?0:1);
345 tracks.push_back(cand);
347 data->setContainer(tracks);
352 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuDTChambThContainer> end.\n" << std::flush;
355 template <>
inline void
359 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuGMTCandCollection>....\n" << std::flush;
371 double eng =
EBase_+
ESigm_*CLHEP::RandGaussQ::shoot(engine);
373 double eta = 2.5*(-1+2*engine->flat());
377 unsigned engp = (unsigned)(
EBase_ +
ESigm_*CLHEP::RandGaussQ::shoot(engine));
378 unsigned phip = (unsigned)(255*engine->flat());
379 unsigned etap = (unsigned)( 63*engine->flat());
383 double r = engine->flat();
388 data->push_back(cand);
390 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuGMTCandCollection> end.\n" << std::flush;
394 template <>
inline void
398 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuGMTReadoutCollection>....\n" << std::flush;
412 for(
int i=0;
i<4;
i++) {
418 for(
int nr=0; nr<4; nr++) {
419 int eng = (int)(
EBase_ +
ESigm_*CLHEP::RandGaussQ::shoot(engine));
423 int eta = (int)(14*engine->flat());
424 int phi = (int)(18*engine->flat());
428 data->addRecord(rec);
439 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuGMTReadoutCollection> end.\n" << std::flush;
442 template <>
inline void
446 std::cout <<
"L1DummyProducer::SimpleDigi<LTCDigiCollection>....\n" << std::flush;
474 std::cout <<
"L1DummyProducer::SimpleDigi<LTCDigiCollection> end.\n" << std::flush;
480 std::cout <<
"L1DummyProducer::SimpleDigi<CSCCorrelatedLCTDigiCollection>....\n" << std::flush;
487 enum eMinNum{ MIN_ENDCAP=1, MIN_STATION=1, MIN_RING=1, MIN_CHAMBER= 1, MIN_LAYER=1 };
488 enum eMaxNum{ MAX_ENDCAP=2, MAX_STATION=4, MAX_RING=4, MAX_CHAMBER=36, MAX_LAYER=6 };
489 float rnd = engine->flat();
490 int ec = (int)( MIN_ENDCAP + (MAX_ENDCAP -MIN_ENDCAP )*rnd +1);
491 int st = (int)( MIN_STATION + (MAX_STATION-MIN_STATION)*rnd +1);
492 int rg = (int)( MIN_RING + (MAX_RING -MIN_RING )*rnd +1);
493 int ch = (int)( MIN_CHAMBER + (MAX_CHAMBER-MIN_CHAMBER)*rnd +1);
494 int lr = (int)( MIN_LAYER + (MAX_LAYER -MIN_LAYER )*rnd +1);
498 data->insertDigi(did,dg);
500 std::cout <<
"L1DummyProducer::SimpleDigi<CSCCorrelatedLCTDigiCollection> end.\n" << std::flush;
506 std::cout <<
"L1DummyProducer::SimpleDigi<L1CSCTrackCollection>...\n" << std::flush;
518 L1CSCTrack l1csctrk = std::make_pair(l1trk,*dgcoll);
519 data->push_back(l1csctrk);
525 std::cout <<
"L1DummyProducer::SimpleDigi<L1CSCTrackCollection> end.\n" << std::flush;
void setPtPacked(unsigned pt)
set packed pt-code of muon candidate
void setBxInEvent(int bxie)
void setSample(int i, const HcalTriggerPrimitiveSample &sam)
bool m_doSys[dedefs::DEnsys]
void setMIP(bool mip)
set min ionizing bit for muon candidate
float etaValue() const
get eta-value of muon candidate
void setGMTBrlCand(int nr, L1MuGMTExtendedCand const &cand)
set GMT barrel candidate
virtual void beginJob(void)
Level-1 Trigger jet candidate.
void setGMTFwdCand(int nr, L1MuGMTExtendedCand const &cand)
set GMT forward candidate
Level-1 Region Calorimeter Trigger EM candidate.
void setInputCand(int nr, unsigned data)
set Input muon
void setPtValue(float ptVal)
Set Pt Value.
Level-1 Trigger EM candidate at output of GCT.
void setQuietbit(int eta, int phi)
set Quiet bit
void setMIPbit(int eta, int phi)
set MIP bit
void setBx(int bx)
Set Bunch Crossing.
float ptValue() const
get pt-value of muon candidate in GeV
void setPhiValue(float phiVal)
Set Phi Value.
void setDataWord(unsigned dataword)
Set data word.
void setSample(int i, const EcalTriggerPrimitiveSample &sam)
void setPhiValue(float phiVal)
Setters for physical values.
unsigned getDataWord() const
return data word
void setEtaValue(float etaVal)
Set Eta Value (need to set type, first)
std::string instName[dedefs::DEnsys][5]
void setBx(int bx)
set bunch crossing identifier
L1DummyProducer(const edm::ParameterSet &)
float phiValue() const
get phi-value of muon candidate in radians (low edge of bin)
std::vector< L1MuRegionalCand > L1MuRegionalCandCollection
void setChargePacked(unsigned ch)
set packed charge/synchronization word of muon candidate (0=POS, 1=NEG, 2=UNDEF, 3=SYNC) ...
virtual void produce(edm::Event &, const edm::EventSetup &)
void setEtaPacked(unsigned eta)
set packed eta-code of muon candidate
void setEtaValue(float etaVal)
Set Eta Value (need to set type, first)
void setBxNr(int bxnr)
set counters
int bx() const
return bunch crossing identifier
char data[epos_bytes_allocation]
std::pair< csc::L1Track, CSCCorrelatedLCTDigiCollection > L1CSCTrack
A calorimeter trigger region (sum of 4x4 trigger towers)
void setGMTCand(int nr, L1MuGMTExtendedCand const &cand)
set GMT candidate (does not store rank)
void SimpleDigi(CLHEP::HepRandomEngine *, std::auto_ptr< T > &data, int type=0)
void setPtValue(float ptVal)
Set Pt Value.
void setPhiPacked(unsigned phi)
set packed phi-code of muon candidate
void setIsolation(bool isol)
set isolation of muon candidate
bool isTau(const Candidate &part)