CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
EcalFEtoDigi Class Reference

#include <EcalFEtoDigi.h>

Inheritance diagram for EcalFEtoDigi:
edm::one::EDProducer<> edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 EcalFEtoDigi (const edm::ParameterSet &)
 
 ~EcalFEtoDigi () override
 
- Public Member Functions inherited from edm::one::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void beginJob () override
 method called once each job just before starting event loop More...
 
EcalTriggerPrimitiveSample create_TPSample (TCCinput, const edm::EventSetup &)
 create EcalTriggerPrimitiveSample from input data (line) More...
 
EcalTriggerPrimitiveSample create_TPSampleTcp (TCCinput, const edm::EventSetup &)
 create EcalTriggerPrimitiveSample in tcp format (uncomrpessed energy) More...
 
EcalTrigTowerDetId create_TTDetId (TCCinput)
 create EcalTrigTowerDetId from input data (line) More...
 
void endJob () override
 method called once each job just after ending the event loop More...
 
void getLUT (unsigned int *lut, const int towerId, const edm::EventSetup &) const
 return the LUT from eventSetup More...
 
void produce (edm::Event &, const edm::EventSetup &) override
 method called to produce the data More...
 
void readInput ()
 open and read in input (flat) data file More...
 
int SMidToTCCid (const int) const
 translate input supermodule id into TCC id (barrel) More...
 

Private Attributes

std::string basename_
 
bool debug_
 
int fileEventOffset_
 
TCCInputData inputdata_ [N_SM]
 
std::ofstream outfile
 
bool singlefile
 
int sm_
 
bool useIdentityLUT_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 36 of file EcalFEtoDigi.h.

Constructor & Destructor Documentation

◆ EcalFEtoDigi()

EcalFEtoDigi::EcalFEtoDigi ( const edm::ParameterSet iConfig)
explicit

Definition at line 7 of file EcalFEtoDigi.cc.

7  {
8  basename_ = iConfig.getUntrackedParameter<std::string>("FlatBaseName", "ecal_tcc_");
9  sm_ = iConfig.getUntrackedParameter<int>("SuperModuleId", -1);
10  fileEventOffset_ = iConfig.getUntrackedParameter<int>("FileEventOffset", 0);
11  useIdentityLUT_ = iConfig.getUntrackedParameter<bool>("UseIdentityLUT", false);
12  debug_ = iConfig.getUntrackedParameter<bool>("debugPrintFlag", false);
13 
14  singlefile = (sm_ == -1) ? false : true;
15 
16  produces<EcalTrigPrimDigiCollection>();
17  produces<EcalTrigPrimDigiCollection>("formatTCP");
18 }

References basename_, debug_, fileEventOffset_, edm::ParameterSet::getUntrackedParameter(), singlefile, sm_, AlCaHLTBitMon_QueryRunRegistry::string, and useIdentityLUT_.

◆ ~EcalFEtoDigi()

EcalFEtoDigi::~EcalFEtoDigi ( )
inlineoverride

Definition at line 39 of file EcalFEtoDigi.h.

39 {}

Member Function Documentation

◆ beginJob()

void EcalFEtoDigi::beginJob ( void  )
overrideprivatevirtual

method called once each job just before starting event loop

check SM numbering convetion: 1-38 [or -1 flag to indicate all sm's are to be read in]

debug: open file for recreating input copy

Reimplemented from edm::one::EDProducerBase.

Definition at line 280 of file EcalFEtoDigi.cc.

280  {
283  if (sm_ != -1 && (sm_ < 1 || sm_ > 36))
284  throw cms::Exception("EcalFEtoDigiInvalidDetId") << "EcalFEtoDigi: Adapt SM numbering convention.\n";
285 
287  if (debug_)
288  outfile.open("inputcopy.txt");
289 
290  readInput();
291 }

References debug_, Exception, outfile, readInput(), and sm_.

◆ create_TPSample()

EcalTriggerPrimitiveSample EcalFEtoDigi::create_TPSample ( TCCinput  data,
const edm::EventSetup evtSetup 
)
private

create EcalTriggerPrimitiveSample from input data (line)

setup look up table

compress energy 10 -> 8 bit

crate sample

Definition at line 219 of file EcalFEtoDigi.cc.

219  {
220  int tower = create_TTDetId(data).rawId();
221  int Et = data.get_energy();
222  bool tt_fg = data.get_fg();
223  // unsigned input = data.input;
224  // int Et = input & 0x3ff; //get bits 0-9
225  // bool tt_fg = input & 0x400; //get bit number 10
226 
228  unsigned int lut_[1024];
229  if (!useIdentityLUT_)
230  getLUT(lut_, tower, evtSetup);
231  else
232  for (int i = 0; i < 1024; i++)
233  lut_[i] = i; // identity lut!
234 
236  int lut_out = lut_[Et];
237  int ttFlag = (lut_out & 0x700) >> 8;
238  int cEt = (lut_out & 0xff);
239 
241  if (debug_ && data.get_energy() != 0)
242  printf(
243  "[EcalFEtoDigi] Creating sample; input:0x%X (Et:0x%x) cEt:0x%x "
244  "fg:%d ttflag:0x%x \n",
245  data.input,
246  Et,
247  cEt,
248  tt_fg,
249  ttFlag);
250 
251  EcalTriggerPrimitiveSample e_sample(cEt, tt_fg, ttFlag);
252 
253  return e_sample;
254 }

References create_TTDetId(), data, debug_, getLUT(), mps_fire::i, DetId::rawId(), hgcalTowerProducer_cfi::tower, and useIdentityLUT_.

Referenced by produce().

◆ create_TPSampleTcp()

EcalTriggerPrimitiveSample EcalFEtoDigi::create_TPSampleTcp ( TCCinput  data,
const edm::EventSetup evtSetup 
)
private

create EcalTriggerPrimitiveSample in tcp format (uncomrpessed energy)

setup look up table

Definition at line 257 of file EcalFEtoDigi.cc.

257  {
258  int tower = create_TTDetId(data).rawId();
259  int Et = data.get_energy();
260  bool tt_fg = data.get_fg();
261 
263  unsigned int lut_[1024];
264  if (!useIdentityLUT_)
265  getLUT(lut_, tower, evtSetup);
266  else
267  for (int i = 0; i < 1024; i++)
268  lut_[i] = i; // identity lut!
269 
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);
273 
274  EcalTriggerPrimitiveSample e_sample(tcpdata);
275 
276  return e_sample;
277 }

References create_TTDetId(), data, getLUT(), mps_fire::i, DetId::rawId(), hgcalTowerProducer_cfi::tower, and useIdentityLUT_.

Referenced by produce().

◆ create_TTDetId()

EcalTrigTowerDetId EcalFEtoDigi::create_TTDetId ( TCCinput  data)
private

create EcalTrigTowerDetId from input data (line)

construct the EcalTrigTowerDetId object

Definition at line 180 of file EcalFEtoDigi.cc.

180  {
181  // (EcalBarrel only)
182  static const int kTowersInPhi = 4;
183 
184  int iTT = data.tower;
185  int zside = (sm_ > 18) ? -1 : +1;
186  int SMid = sm_;
187 
188  int jtower = iTT - 1;
189  int etaTT = jtower / kTowersInPhi + 1;
190  int phiTT;
191  if (zside < 0)
192  phiTT = (SMid - 19) * kTowersInPhi + jtower % kTowersInPhi;
193  else
194  phiTT = (SMid - 1) * kTowersInPhi + kTowersInPhi - (jtower % kTowersInPhi) - 1;
195 
196  phiTT++;
197  // needed as phi=0 (iphi=1) is at middle of lower SMs (1 and 19), need shift
198  // by 2
199  phiTT = phiTT - 2;
200  if (phiTT <= 0)
201  phiTT = 72 + phiTT;
202 
204  if (debug_ && data.get_energy() != 0)
205  printf(
206  "[EcalFEtoDigi] Creating EcalTrigTowerDetId "
207  "(SMid,itt)=(%d,%d)->(eta,phi)=(%d,%d) \n",
208  SMid,
209  iTT,
210  etaTT,
211  phiTT);
212 
213  EcalTrigTowerDetId e_id(zside, EcalBarrel, etaTT, phiTT, 0);
214 
215  return e_id;
216 }

References data, debug_, EcalBarrel, sm_, and ecaldqm::zside().

Referenced by create_TPSample(), create_TPSampleTcp(), and produce().

◆ endJob()

void EcalFEtoDigi::endJob ( void  )
overrideprivatevirtual

method called once each job just after ending the event loop

Reimplemented from edm::one::EDProducerBase.

Definition at line 294 of file EcalFEtoDigi.cc.

294  {
295  if (outfile.is_open())
296  outfile.close();
297 }

References outfile.

◆ getLUT()

void EcalFEtoDigi::getLUT ( unsigned int *  lut,
const int  towerId,
const edm::EventSetup evtSetup 
) const
private

return the LUT from eventSetup

Definition at line 303 of file EcalFEtoDigi.cc.

303  {
304  edm::ESHandle<EcalTPGLutGroup> lutGrpHandle;
305  evtSetup.get<EcalTPGLutGroupRcd>().get(lutGrpHandle);
306  const EcalTPGGroups::EcalTPGGroupsMap &lutGrpMap = lutGrpHandle.product()->getMap();
307  EcalTPGGroups::EcalTPGGroupsMapItr itgrp = lutGrpMap.find(towerId);
308  uint32_t lutGrp = 999;
309  if (itgrp != lutGrpMap.end())
310  lutGrp = itgrp->second;
311 
312  edm::ESHandle<EcalTPGLutIdMap> lutMapHandle;
313  evtSetup.get<EcalTPGLutIdMapRcd>().get(lutMapHandle);
314  const EcalTPGLutIdMap::EcalTPGLutMap &lutMap = lutMapHandle.product()->getMap();
315  EcalTPGLutIdMap::EcalTPGLutMapItr itLut = lutMap.find(lutGrp);
316  if (itLut != lutMap.end()) {
317  const unsigned int *theLut = (itLut->second).getLut();
318  for (unsigned int i = 0; i < 1024; i++)
319  lut[i] = theLut[i];
320  }
321 }

References edm::eventsetup::EventSetupRecordImplementation< T >::get(), edm::EventSetup::get(), get, EcalTPGGroups::getMap(), mps_fire::i, edm::ESHandle< T >::product(), and ecaldqm::towerId().

Referenced by create_TPSample(), and create_TPSampleTcp().

◆ produce()

void EcalFEtoDigi::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

method called to produce the data

event counter

re-read input (needed in case of event-by-event input production)

create EcalTrigTowerDetId

create EcalTriggerPrimitiveDigi

create EcalTriggerPrimitiveSample

set sample

add to EcalTrigPrimDigiCollection

set sample (uncompressed format)

add to EcalTrigPrimDigiCollection (uncompressed format)

print & debug

in case no info was found for the event:need to create something

Implements edm::one::EDProducerBase.

Definition at line 21 of file EcalFEtoDigi.cc.

21  {
23  static int current_bx = -1;
24  current_bx++;
25 
27  // readInput();
28 
29  if (debug_)
30  std::cout << "[EcalFEtoDigi::produce] producing event " << current_bx << std::endl;
31 
32  std::unique_ptr<EcalTrigPrimDigiCollection> e_tpdigis(new EcalTrigPrimDigiCollection);
33  std::unique_ptr<EcalTrigPrimDigiCollection> e_tpdigisTcp(new EcalTrigPrimDigiCollection);
34 
35  std::vector<TCCinput>::const_iterator it;
36 
37  for (int i = 0; i < N_SM; i++) {
38  if (!singlefile)
39  sm_ = i + 1;
40 
41  for (it = inputdata_[i].begin(); it != inputdata_[i].end(); it++) {
42  if (!(*it).is_current(current_bx + fileEventOffset_))
43  continue;
44  else if (debug_ && (*it).input != 0)
45  std::cout << "[EcalFEtoDigi] "
46  << "\tsupermodule:" << sm_ << "\tevent: " << current_bx << "\tbx: " << (*it).bunchCrossing
47  << "\tvalue:0x" << std::setfill('0') << std::setw(4) << std::hex << (*it).input << std::setfill(' ')
48  << std::dec << std::endl;
49 
51  const EcalTrigTowerDetId e_id = create_TTDetId(*it);
52 
53  // EcalElectronicsMapping theMapping;
54  // const EcalTrigTowerDetId e_id
55  //= theMapping.getTrigTowerDetId(SMidToTCCid(sm_),(*it).tower);
56  // EcalElectronicsMapping::getTrigTowerDetId(int TCCid, int iTT)
57 
61 
63  EcalTriggerPrimitiveSample e_sample = create_TPSample(*it, iSetup);
64  EcalTriggerPrimitiveSample e_sampleTcp = create_TPSampleTcp(*it, iSetup);
65 
67  e_digi->setSize(1); // set sampleOfInterest to 0
68  e_digi->setSample(0, e_sample);
69 
71  e_tpdigis->push_back(*e_digi);
72 
74  e_digiTcp->setSize(1); // set sampleOfInterest to 0
75  e_digiTcp->setSample(0, e_sampleTcp);
76 
78  e_tpdigisTcp->push_back(*e_digiTcp);
79 
80  if (debug_)
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;
83 
85  if (debug_ && (*it).input != 0)
86  std::cout << "[EcalFEtoDigi] debug id: " << e_digi->id() << "\n\t" << std::dec
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() << ")"
90  << "\tttflag: 0x" << e_digi->ttFlag() << std::dec << std::endl;
91 
92  delete e_digi;
93  delete e_digiTcp;
94  }
95 
96  if (singlefile)
97  break;
98  }
99 
101  if (e_tpdigis->empty()) {
102  std::cout << "[EcalFEtoDigi] creating empty collection for the event!\n";
104  e_tpdigis->push_back(*e_digi);
105  }
106 
107  iEvent.put(std::move(e_tpdigis));
108  iEvent.put(std::move(e_tpdigisTcp), "formatTCP");
109 }

References EcalTriggerPrimitiveDigi::compressedEt(), gather_cfg::cout, create_TPSample(), create_TPSampleTcp(), create_TTDetId(), debug_, TauDecayModes::dec, fileEventOffset_, EcalTriggerPrimitiveDigi::fineGrain(), mps_fire::i, EcalTriggerPrimitiveDigi::id(), EcalTrigTowerDetId::ieta(), iEvent, inputdata_, EcalTrigTowerDetId::iphi(), eostools::move(), N_SM, outfile, EcalTriggerPrimitiveDigi::setSample(), EcalTriggerPrimitiveDigi::setSize(), singlefile, EcalTriggerPrimitiveDigi::size(), sm_, and EcalTriggerPrimitiveDigi::ttFlag().

◆ readInput()

void EcalFEtoDigi::readInput ( )
private

open and read in input (flat) data file

Definition at line 112 of file EcalFEtoDigi.cc.

112  {
113  if (debug_)
114  std::cout << "\n[EcalFEtoDigi::readInput] Reading input data\n";
115 
116  if (!singlefile)
117  sm_ = -1;
118  for (int i = 0; i < N_SM; i++)
119  inputdata_[i].clear();
120 
121  std::stringstream s;
122  int tcc;
123 
124  for (int i = 0; i < N_SM; i++) {
125  tcc = (sm_ == -1) ? SMidToTCCid(i + 1) : SMidToTCCid(sm_);
126 
127  s.str("");
128  s << basename_ << tcc << ".txt";
129 
130  std::ifstream f(s.str().c_str());
131 
132  if (debug_) {
133  std::cout << " opening " << s.str().c_str() << "..." << std::endl;
134  if (!f.good())
135  std::cout << " skipped!";
136  std::cout << std::endl;
137  }
138  // if (!f.good() || f.eof())
139  // throw cms::Exception("BadInputFile")
140  // << "EcalFEtoDigi: cannot open file " << s.str().c_str() << std::endl;
141 
142  int n_bx = 0;
143  int tt;
144  int bx;
145  unsigned val;
146  int dummy;
147 
148  while (f.good()) {
149  if (f.eof())
150  break;
151  tt = 0;
152  bx = -1;
153  val = 0x0;
154  dummy = 0;
155  f >> tt >> bx >> std::hex >> val >> std::dec >> dummy;
156  if (bx == -1 || bx < fileEventOffset_)
157  continue;
158  if (!n_bx || (bx != (inputdata_[i].back()).bunchCrossing))
159  n_bx++;
160  TCCinput ttdata(tt, bx, val);
161  inputdata_[i].push_back(ttdata);
162 
163  if (debug_ && val != 0)
164  printf("\treading tower:%d bx:%d input:0x%x dummy:%2d\n", tt, bx, val, dummy);
165  }
166 
167  f.close();
168 
169  if (sm_ != -1)
170  break;
171  }
172 
173  if (debug_)
174  std::cout << "[EcalFEtoDigi::readInput] Done reading." << std::endl;
175 
176  return;
177 }

References basename_, l1GtPatternGenerator_cfi::bx, clear(), gather_cfg::cout, debug_, TauDecayModes::dec, f, fileEventOffset_, mps_fire::i, inputdata_, N_SM, alignCSCRings::s, singlefile, sm_, SMidToTCCid(), groupFilesInBlocks::tt, and heppy_batch::val.

Referenced by beginJob().

◆ SMidToTCCid()

int EcalFEtoDigi::SMidToTCCid ( const int  smid) const
private

translate input supermodule id into TCC id (barrel)

Definition at line 300 of file EcalFEtoDigi.cc.

300 { return (smid <= 18) ? smid + 55 - 1 : smid + 37 - 19; }

Referenced by readInput().

Member Data Documentation

◆ basename_

std::string EcalFEtoDigi::basename_
private

Definition at line 55 of file EcalFEtoDigi.h.

Referenced by EcalFEtoDigi(), and readInput().

◆ debug_

bool EcalFEtoDigi::debug_
private

◆ fileEventOffset_

int EcalFEtoDigi::fileEventOffset_
private

Definition at line 60 of file EcalFEtoDigi.h.

Referenced by EcalFEtoDigi(), produce(), and readInput().

◆ inputdata_

TCCInputData EcalFEtoDigi::inputdata_[N_SM]
private

Definition at line 53 of file EcalFEtoDigi.h.

Referenced by produce(), and readInput().

◆ outfile

std::ofstream EcalFEtoDigi::outfile
private

Definition at line 62 of file EcalFEtoDigi.h.

Referenced by beginJob(), endJob(), and produce().

◆ singlefile

bool EcalFEtoDigi::singlefile
private

Definition at line 58 of file EcalFEtoDigi.h.

Referenced by EcalFEtoDigi(), produce(), and readInput().

◆ sm_

int EcalFEtoDigi::sm_
private

Definition at line 57 of file EcalFEtoDigi.h.

Referenced by beginJob(), create_TTDetId(), EcalFEtoDigi(), produce(), and readInput().

◆ useIdentityLUT_

bool EcalFEtoDigi::useIdentityLUT_
private

Definition at line 56 of file EcalFEtoDigi.h.

Referenced by create_TPSample(), create_TPSampleTcp(), and EcalFEtoDigi().

EcalFEtoDigi::create_TPSample
EcalTriggerPrimitiveSample create_TPSample(TCCinput, const edm::EventSetup &)
create EcalTriggerPrimitiveSample from input data (line)
Definition: EcalFEtoDigi.cc:219
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
EcalTriggerPrimitiveDigi::size
int size() const
Definition: EcalTriggerPrimitiveDigi.h:30
mps_fire.i
i
Definition: mps_fire.py:428
EcalTrigTowerDetId::iphi
int iphi() const
get the tower iphi
Definition: EcalTrigTowerDetId.h:52
EcalFEtoDigi::outfile
std::ofstream outfile
Definition: EcalFEtoDigi.h:62
EcalTPGLutIdMap::EcalTPGLutMap
std::map< uint32_t, EcalTPGLut > EcalTPGLutMap
Definition: EcalTPGLutIdMap.h:12
EcalTPGGroups::EcalTPGGroupsMapItr
std::map< uint32_t, uint32_t >::const_iterator EcalTPGGroupsMapItr
Definition: EcalTPGGroups.h:20
groupFilesInBlocks.tt
int tt
Definition: groupFilesInBlocks.py:144
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
ecaldqm::zside
int zside(DetId const &)
Definition: EcalDQMCommonUtils.cc:189
gather_cfg.cout
cout
Definition: gather_cfg.py:144
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
hgcalTowerProducer_cfi.tower
tower
Definition: hgcalTowerProducer_cfi.py:4
edm::SortedCollection
Definition: SortedCollection.h:49
EcalFEtoDigi::create_TTDetId
EcalTrigTowerDetId create_TTDetId(TCCinput)
create EcalTrigTowerDetId from input data (line)
Definition: EcalFEtoDigi.cc:180
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
EcalTrigTowerDetId
Definition: EcalTrigTowerDetId.h:14
EcalFEtoDigi::SMidToTCCid
int SMidToTCCid(const int) const
translate input supermodule id into TCC id (barrel)
Definition: EcalFEtoDigi.cc:300
EcalTriggerPrimitiveDigi::ttFlag
int ttFlag() const
get the Trigger tower Flag of interesting sample
Definition: EcalTriggerPrimitiveDigi.cc:36
EcalFEtoDigi::basename_
std::string basename_
Definition: EcalFEtoDigi.h:55
EcalBarrel
Definition: EcalSubdetector.h:10
EcalFEtoDigi::getLUT
void getLUT(unsigned int *lut, const int towerId, const edm::EventSetup &) const
return the LUT from eventSetup
Definition: EcalFEtoDigi.cc:303
ecaldqm::towerId
unsigned towerId(DetId const &, EcalElectronicsMapping const *)
Definition: EcalDQMCommonUtils.cc:77
TCCinput
Definition: TCCinput.h:12
alignCSCRings.s
s
Definition: alignCSCRings.py:92
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
EcalFEtoDigi::inputdata_
TCCInputData inputdata_[N_SM]
Definition: EcalFEtoDigi.h:53
edm::ESHandle
Definition: DTSurvey.h:22
EcalTriggerPrimitiveDigi::setSize
void setSize(int size)
Definition: EcalTriggerPrimitiveDigi.cc:60
clear
void clear(HadCaloObj &c)
Definition: data.h:124
EcalFEtoDigi::readInput
void readInput()
open and read in input (flat) data file
Definition: EcalFEtoDigi.cc:112
EcalTriggerPrimitiveDigi::setSample
void setSample(int i, const EcalTriggerPrimitiveSample &sam)
Definition: EcalTriggerPrimitiveDigi.h:36
iEvent
int iEvent
Definition: GenABIO.cc:224
EcalTPGGroups::getMap
const EcalTPGGroupsMap & getMap() const
Definition: EcalTPGGroups.h:25
N_SM
static const int N_SM
Definition: EcalFEtoDigi.h:34
get
#define get
EcalTrigTowerDetId::ieta
int ieta() const
get the tower ieta
Definition: EcalTrigTowerDetId.h:44
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EcalFEtoDigi::debug_
bool debug_
Definition: EcalFEtoDigi.h:61
EcalTPGLutIdMapRcd
Definition: EcalTPGLutIdMapRcd.h:5
heppy_batch.val
val
Definition: heppy_batch.py:351
eostools.move
def move(src, dest)
Definition: eostools.py:511
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
EcalTriggerPrimitiveDigi::id
const EcalTrigTowerDetId & id() const
Definition: EcalTriggerPrimitiveDigi.h:29
EcalFEtoDigi::create_TPSampleTcp
EcalTriggerPrimitiveSample create_TPSampleTcp(TCCinput, const edm::EventSetup &)
create EcalTriggerPrimitiveSample in tcp format (uncomrpessed energy)
Definition: EcalFEtoDigi.cc:257
EcalTriggerPrimitiveDigi
Definition: EcalTriggerPrimitiveDigi.h:16
Exception
Definition: hltDiff.cc:245
EcalTPGLutIdMap::EcalTPGLutMapItr
std::map< uint32_t, EcalTPGLut >::const_iterator EcalTPGLutMapItr
Definition: EcalTPGLutIdMap.h:13
EcalTriggerPrimitiveDigi::compressedEt
int compressedEt() const
get the encoded/compressed Et of interesting sample
Definition: EcalTriggerPrimitiveDigi.cc:19
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
edm::eventsetup::EventSetupRecordImplementation::get
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
Definition: EventSetupRecordImplementation.h:74
EcalTriggerPrimitiveSample
Definition: EcalTriggerPrimitiveSample.h:12
EcalTriggerPrimitiveDigi::fineGrain
bool fineGrain() const
get the fine-grain bit of interesting sample
Definition: EcalTriggerPrimitiveDigi.cc:28
EcalFEtoDigi::useIdentityLUT_
bool useIdentityLUT_
Definition: EcalFEtoDigi.h:56
dummy
Definition: DummySelector.h:38
EcalTPGLutGroupRcd
Definition: EcalTPGLutGroupRcd.h:5
EcalFEtoDigi::fileEventOffset_
int fileEventOffset_
Definition: EcalFEtoDigi.h:60
TauDecayModes.dec
dec
Definition: TauDecayModes.py:142
EcalTPGGroups::EcalTPGGroupsMap
std::map< uint32_t, uint32_t > EcalTPGGroupsMap
Definition: EcalTPGGroups.h:19
EcalFEtoDigi::sm_
int sm_
Definition: EcalFEtoDigi.h:57
EcalFEtoDigi::singlefile
bool singlefile
Definition: EcalFEtoDigi.h:58