|
|
Go to the documentation of this file.
16 produces<EcalTrigPrimDigiCollection>();
17 produces<EcalTrigPrimDigiCollection>(
"formatTCP");
23 static int current_bx = -1;
30 std::cout <<
"[EcalFEtoDigi::produce] producing event " << current_bx << std::endl;
35 std::vector<TCCinput>::const_iterator it;
37 for (
int i = 0;
i <
N_SM;
i++) {
44 else if (
debug_ && (*it).input != 0)
46 <<
"\tsupermodule:" <<
sm_ <<
"\tevent: " << current_bx <<
"\tbx: " << (*it).bunchCrossing
47 <<
"\tvalue:0x" << std::setfill(
'0') << std::setw(4) << std::hex << (*it).input << std::setfill(
' ')
71 e_tpdigis->push_back(*e_digi);
78 e_tpdigisTcp->push_back(*e_digiTcp);
81 outfile << (*it).tower <<
'\t' << (*it).bunchCrossing <<
'\t' << std::setfill(
'0') << std::hex <<
"0x"
82 << std::setw(4) << (*it).input <<
'\t' <<
"0" <<
std::dec << std::setfill(
' ') << std::endl;
85 if (
debug_ && (*it).input != 0)
87 <<
"\tieta: " << e_digi->
id().
ieta() <<
"\tiphi: " << e_digi->
id().
iphi()
88 <<
"\tsize: " << e_digi->
size() <<
"\tfg: " << (e_digi->
fineGrain() ? 1 : 0) << std::hex <<
"\tEt: 0x"
89 << e_digi->
compressedEt() <<
" (0x" << (*it).get_energy() <<
")"
101 if (e_tpdigis->empty()) {
102 std::cout <<
"[EcalFEtoDigi] creating empty collection for the event!\n";
104 e_tpdigis->push_back(*e_digi);
114 std::cout <<
"\n[EcalFEtoDigi::readInput] Reading input data\n";
124 for (
int i = 0;
i <
N_SM;
i++) {
130 std::ifstream
f(
s.str().c_str());
133 std::cout <<
" opening " <<
s.str().c_str() <<
"..." << std::endl;
164 printf(
"\treading tower:%d bx:%d input:0x%x dummy:%2d\n",
tt,
bx,
val,
dummy);
174 std::cout <<
"[EcalFEtoDigi::readInput] Done reading." << std::endl;
182 static const int kTowersInPhi = 4;
184 int iTT =
data.tower;
188 int jtower = iTT - 1;
189 int etaTT = jtower / kTowersInPhi + 1;
192 phiTT = (SMid - 19) * kTowersInPhi + jtower % kTowersInPhi;
194 phiTT = (SMid - 1) * kTowersInPhi + kTowersInPhi - (jtower % kTowersInPhi) - 1;
206 "[EcalFEtoDigi] Creating EcalTrigTowerDetId "
207 "(SMid,itt)=(%d,%d)->(eta,phi)=(%d,%d) \n",
221 int Et =
data.get_energy();
222 bool tt_fg =
data.get_fg();
228 unsigned int lut_[1024];
232 for (
int i = 0;
i < 1024;
i++)
236 int lut_out = lut_[Et];
237 int ttFlag = (lut_out & 0x700) >> 8;
238 int cEt = (lut_out & 0xff);
243 "[EcalFEtoDigi] Creating sample; input:0x%X (Et:0x%x) cEt:0x%x "
244 "fg:%d ttflag:0x%x \n",
259 int Et =
data.get_energy();
260 bool tt_fg =
data.get_fg();
263 unsigned int lut_[1024];
267 for (
int i = 0;
i < 1024;
i++)
270 int lut_out = lut_[Et];
271 int ttFlag = (lut_out & 0x700) >> 8;
272 int tcpdata = ((ttFlag & 0x7) << 11) | ((tt_fg & 0x1) << 10) | (Et & 0x3ff);
283 if (
sm_ != -1 && (sm_ < 1 || sm_ > 36))
284 throw cms::Exception(
"EcalFEtoDigiInvalidDetId") <<
"EcalFEtoDigi: Adapt SM numbering convention.\n";
308 uint32_t lutGrp = 999;
309 if (itgrp != lutGrpMap.end())
310 lutGrp = itgrp->second;
316 if (itLut != lutMap.end()) {
317 const unsigned int *theLut = (itLut->second).getLut();
318 for (
unsigned int i = 0;
i < 1024;
i++)
EcalTriggerPrimitiveSample create_TPSample(TCCinput, const edm::EventSetup &)
create EcalTriggerPrimitiveSample from input data (line)
T const * product() const
int iphi() const
get the tower iphi
std::map< uint32_t, EcalTPGLut > EcalTPGLutMap
std::map< uint32_t, uint32_t >::const_iterator EcalTPGGroupsMapItr
EcalTrigTowerDetId create_TTDetId(TCCinput)
create EcalTrigTowerDetId from input data (line)
T getUntrackedParameter(std::string const &, T const &) const
int SMidToTCCid(const int) const
translate input supermodule id into TCC id (barrel)
int ttFlag() const
get the Trigger tower Flag of interesting sample
void getLUT(unsigned int *lut, const int towerId, const edm::EventSetup &) const
return the LUT from eventSetup
unsigned towerId(DetId const &, EcalElectronicsMapping const *)
TCCInputData inputdata_[N_SM]
void clear(HadCaloObj &c)
void readInput()
open and read in input (flat) data file
void setSample(int i, const EcalTriggerPrimitiveSample &sam)
void produce(edm::Event &, const edm::EventSetup &) override
method called to produce the data
const EcalTPGGroupsMap & getMap() const
int ieta() const
get the tower ieta
EcalFEtoDigi(const edm::ParameterSet &)
void beginJob() override
method called once each job just before starting event loop
constexpr uint32_t rawId() const
get the raw id
const EcalTrigTowerDetId & id() const
EcalTriggerPrimitiveSample create_TPSampleTcp(TCCinput, const edm::EventSetup &)
create EcalTriggerPrimitiveSample in tcp format (uncomrpessed energy)
std::map< uint32_t, EcalTPGLut >::const_iterator EcalTPGLutMapItr
int compressedEt() const
get the encoded/compressed Et of interesting sample
char data[epos_bytes_allocation]
void endJob() override
method called once each job just after ending the event loop
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
bool fineGrain() const
get the fine-grain bit of interesting sample
std::map< uint32_t, uint32_t > EcalTPGGroupsMap