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
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () 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
 
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)
 
 ~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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (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::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
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<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 36 of file EcalFEtoDigi.h.

Constructor & Destructor Documentation

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

Definition at line 7 of file EcalFEtoDigi.cc.

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

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 }
T getUntrackedParameter(std::string const &, T const &) const
int fileEventOffset_
Definition: EcalFEtoDigi.h:60
std::string basename_
Definition: EcalFEtoDigi.h:55
bool useIdentityLUT_
Definition: EcalFEtoDigi.h:56
EcalFEtoDigi::~EcalFEtoDigi ( )
inlineoverride

Member Function Documentation

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.

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

Referenced by ~EcalFEtoDigi().

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 }
void readInput()
open and read in input (flat) data file
std::ofstream outfile
Definition: EcalFEtoDigi.h:62
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.

References create_TTDetId(), debug_, TCCinput::get_energy(), TCCinput::get_fg(), getLUT(), mps_fire::i, TCCinput::input, DetId::rawId(), and useIdentityLUT_.

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

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 }
void getLUT(unsigned int *lut, const int towerId, const edm::EventSetup &) const
return the LUT from eventSetup
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
bool useIdentityLUT_
Definition: EcalFEtoDigi.h:56
int get_fg() const
Definition: TCCinput.h:28
int get_energy() const
Definition: TCCinput.h:24
unsigned input
Definition: TCCinput.h:15
EcalTrigTowerDetId create_TTDetId(TCCinput)
create EcalTrigTowerDetId from input data (line)
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.

References create_TTDetId(), TCCinput::get_energy(), TCCinput::get_fg(), getLUT(), mps_fire::i, DetId::rawId(), and useIdentityLUT_.

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

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 }
void getLUT(unsigned int *lut, const int towerId, const edm::EventSetup &) const
return the LUT from eventSetup
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
bool useIdentityLUT_
Definition: EcalFEtoDigi.h:56
int get_fg() const
Definition: TCCinput.h:28
int get_energy() const
Definition: TCCinput.h:24
EcalTrigTowerDetId create_TTDetId(TCCinput)
create EcalTrigTowerDetId from input data (line)
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.

References debug_, EcalBarrel, TCCinput::get_energy(), sm_, TCCinput::tower, and ecaldqm::zside().

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

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 }
int zside(DetId const &)
int get_energy() const
Definition: TCCinput.h:24
int tower
Definition: TCCinput.h:13
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.

References outfile.

Referenced by ~EcalFEtoDigi().

294  {
295  if (outfile.is_open())
296  outfile.close();
297 }
std::ofstream outfile
Definition: EcalFEtoDigi.h:62
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.

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

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

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 }
const EcalTPGGroupsMap & getMap() const
Definition: EcalTPGGroups.h:28
std::map< uint32_t, uint32_t >::const_iterator EcalTPGGroupsMapItr
Definition: EcalTPGGroups.h:23
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
l1t::HGCalTowerID towerId
Definition: classes.h:36
std::map< uint32_t, EcalTPGLut > EcalTPGLutMap
T get() const
Definition: EventSetup.h:71
T const * product() const
Definition: ESHandle.h:86
std::map< uint32_t, uint32_t > EcalTPGGroupsMap
Definition: EcalTPGGroups.h:22
std::map< uint32_t, EcalTPGLut >::const_iterator EcalTPGLutMapItr
void EcalFEtoDigi::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

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

Definition at line 21 of file EcalFEtoDigi.cc.

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

Referenced by ~EcalFEtoDigi().

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 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
int fileEventOffset_
Definition: EcalFEtoDigi.h:60
TCCInputData inputdata_[N_SM]
Definition: EcalFEtoDigi.h:53
int ieta() const
get the tower ieta
int compressedEt() const
get the encoded/compressed Et of interesting sample
void setSample(int i, const EcalTriggerPrimitiveSample &sam)
static const int N_SM
Definition: EcalFEtoDigi.h:34
int iphi() const
get the tower iphi
const EcalTrigTowerDetId & id() const
EcalTriggerPrimitiveSample create_TPSampleTcp(TCCinput, const edm::EventSetup &)
create EcalTriggerPrimitiveSample in tcp format (uncomrpessed energy)
#define begin
Definition: vmac.h:32
bool fineGrain() const
get the fine-grain bit of interesting sample
EcalTriggerPrimitiveSample create_TPSample(TCCinput, const edm::EventSetup &)
create EcalTriggerPrimitiveSample from input data (line)
int ttFlag() const
get the Trigger tower Flag of interesting sample
def move(src, dest)
Definition: eostools.py:511
std::ofstream outfile
Definition: EcalFEtoDigi.h:62
EcalTrigTowerDetId create_TTDetId(TCCinput)
create EcalTrigTowerDetId from input data (line)
void EcalFEtoDigi::readInput ( )
private

open and read in input (flat) data file

Definition at line 112 of file EcalFEtoDigi.cc.

References basename_, hitfit::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(), parserPerfsuiteMetadata.parserPerfsuiteMetadata::readCmsScimarkTest(), and ~EcalFEtoDigi().

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 }
int fileEventOffset_
Definition: EcalFEtoDigi.h:60
std::string basename_
Definition: EcalFEtoDigi.h:55
TCCInputData inputdata_[N_SM]
Definition: EcalFEtoDigi.h:53
int SMidToTCCid(const int) const
translate input supermodule id into TCC id (barrel)
void clear(CLHEP::HepGenMatrix &m)
Helper function: Reset all elements of a matrix to 0.
Definition: matutil.cc:167
static const int N_SM
Definition: EcalFEtoDigi.h:34
double f[11][100]
int EcalFEtoDigi::SMidToTCCid ( const int  smid) const
private

translate input supermodule id into TCC id (barrel)

Definition at line 300 of file EcalFEtoDigi.cc.

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

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

Member Data Documentation

std::string EcalFEtoDigi::basename_
private

Definition at line 55 of file EcalFEtoDigi.h.

Referenced by EcalFEtoDigi(), and readInput().

bool EcalFEtoDigi::debug_
private
int EcalFEtoDigi::fileEventOffset_
private

Definition at line 60 of file EcalFEtoDigi.h.

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

TCCInputData EcalFEtoDigi::inputdata_[N_SM]
private

Definition at line 53 of file EcalFEtoDigi.h.

Referenced by produce(), and readInput().

std::ofstream EcalFEtoDigi::outfile
private

Definition at line 62 of file EcalFEtoDigi.h.

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

bool EcalFEtoDigi::singlefile
private

Definition at line 58 of file EcalFEtoDigi.h.

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

int EcalFEtoDigi::sm_
private

Definition at line 57 of file EcalFEtoDigi.h.

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

bool EcalFEtoDigi::useIdentityLUT_
private

Definition at line 56 of file EcalFEtoDigi.h.

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