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
 
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)
 
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 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 
19 }
T getUntrackedParameter(std::string const &, T const &) const
int fileEventOffset_
Definition: EcalFEtoDigi.h:63
std::string basename_
Definition: EcalFEtoDigi.h:58
bool useIdentityLUT_
Definition: EcalFEtoDigi.h:59
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 295 of file EcalFEtoDigi.cc.

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

Referenced by ~EcalFEtoDigi().

295  {
296 
299  if(sm_!=-1 && (sm_<1 || sm_>36))
300  throw cms::Exception("EcalFEtoDigiInvalidDetId")
301  << "EcalFEtoDigi: Adapt SM numbering convention.\n";
302 
304  if(debug_)
305  outfile.open("inputcopy.txt");
306 
307  readInput();
308 
309 }
void readInput()
open and read in input (flat) data file
std::ofstream outfile
Definition: EcalFEtoDigi.h:65
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 237 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().

237  {
238 
239  int tower = create_TTDetId(data).rawId() ;
240  int Et = data.get_energy();
241  bool tt_fg = data.get_fg();
242  //unsigned input = data.input;
243  //int Et = input & 0x3ff; //get bits 0-9
244  //bool tt_fg = input & 0x400; //get bit number 10
245 
247  unsigned int lut_[1024] ;
248  if(!useIdentityLUT_)
249  getLUT(lut_, tower, evtSetup) ;
250  else
251  for(int i=0; i<1024; i++) lut_[i] = i ; //identity lut!
252 
254  int lut_out = lut_[Et];
255  int ttFlag = (lut_out & 0x700) >> 8;
256  int cEt = (lut_out & 0xff );
257 
259  if(debug_&&data.get_energy()!=0)
260  printf("[EcalFEtoDigi] Creating sample; input:0x%X (Et:0x%x) cEt:0x%x fg:%d ttflag:0x%x \n",
261  data.input, Et, cEt, tt_fg, ttFlag);
262 
263  EcalTriggerPrimitiveSample e_sample(cEt, tt_fg, ttFlag);
264 
265  return e_sample;
266 }
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:47
bool useIdentityLUT_
Definition: EcalFEtoDigi.h:59
int get_fg() const
Definition: TCCinput.h:32
int get_energy() const
Definition: TCCinput.h:28
unsigned input
Definition: TCCinput.h:16
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 270 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().

270  {
271 
272  int tower = create_TTDetId(data).rawId() ;
273  int Et = data.get_energy();
274  bool tt_fg = data.get_fg();
275 
277  unsigned int lut_[1024] ;
278  if(!useIdentityLUT_)
279  getLUT(lut_, tower, evtSetup) ;
280  else
281  for(int i=0; i<1024; i++) lut_[i] = i ; //identity lut!
282 
283  int lut_out = lut_[Et];
284  int ttFlag = (lut_out & 0x700) >> 8;
285  int tcpdata = ((ttFlag&0x7)<<11) | ((tt_fg & 0x1)<<10) | (Et & 0x3ff) ;
286 
287  EcalTriggerPrimitiveSample e_sample(tcpdata);
288 
289  return e_sample;
290 }
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:47
bool useIdentityLUT_
Definition: EcalFEtoDigi.h:59
int get_fg() const
Definition: TCCinput.h:32
int get_energy() const
Definition: TCCinput.h:28
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 203 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().

203  {
204 
205  // (EcalBarrel only)
206  static const int kTowersInPhi = 4;
207 
208  int iTT = data.tower;
209  int zside = (sm_>18)?-1:+1;
210  int SMid = sm_;
211 
212  int jtower = iTT-1;
213  int etaTT = jtower / kTowersInPhi +1;
214  int phiTT;
215  if (zside < 0)
216  phiTT = (SMid-19) * kTowersInPhi + jtower % kTowersInPhi;
217  else
218  phiTT = (SMid- 1) * kTowersInPhi + kTowersInPhi-(jtower % kTowersInPhi)-1;
219 
220  phiTT ++;
221  //needed as phi=0 (iphi=1) is at middle of lower SMs (1 and 19), need shift by 2
222  phiTT = phiTT -2;
223  if (phiTT <= 0) phiTT = 72+phiTT;
224 
226  if(debug_&&data.get_energy()!=0)
227  printf("[EcalFEtoDigi] Creating EcalTrigTowerDetId (SMid,itt)=(%d,%d)->(eta,phi)=(%d,%d) \n", SMid, iTT, etaTT, phiTT);
228 
230  e_id( zside , EcalBarrel, etaTT, phiTT, 0);
231 
232  return e_id;
233 }
int zside(DetId const &)
int get_energy() const
Definition: TCCinput.h:28
int tower
Definition: TCCinput.h:14
void EcalFEtoDigi::endJob ( void  )
overrideprivatevirtual

method called once each job just after ending the event loop

Reimplemented from edm::one::EDProducerBase.

Definition at line 314 of file EcalFEtoDigi.cc.

References outfile.

Referenced by ~EcalFEtoDigi().

314  {
315  if(outfile.is_open())
316  outfile.close();
317 }
std::ofstream outfile
Definition: EcalFEtoDigi.h:65
void EcalFEtoDigi::getLUT ( unsigned int *  lut,
const int  towerId,
const edm::EventSetup evtSetup 
) const
private

return the LUT from eventSetup

Definition at line 328 of file EcalFEtoDigi.cc.

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

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

329 {
330  edm::ESHandle<EcalTPGLutGroup> lutGrpHandle;
331  evtSetup.get<EcalTPGLutGroupRcd>().get( lutGrpHandle );
332  const EcalTPGGroups::EcalTPGGroupsMap & lutGrpMap = lutGrpHandle.product()->getMap() ;
333  EcalTPGGroups::EcalTPGGroupsMapItr itgrp = lutGrpMap.find(towerId) ;
334  uint32_t lutGrp = 999 ;
335  if (itgrp != lutGrpMap.end()) lutGrp = itgrp->second ;
336 
337  edm::ESHandle<EcalTPGLutIdMap> lutMapHandle;
338  evtSetup.get<EcalTPGLutIdMapRcd>().get( lutMapHandle );
339  const EcalTPGLutIdMap::EcalTPGLutMap & lutMap = lutMapHandle.product()->getMap() ;
340  EcalTPGLutIdMap::EcalTPGLutMapItr itLut = lutMap.find(lutGrp) ;
341  if (itLut != lutMap.end()) {
342  const unsigned int * theLut = (itLut->second).getLut() ;
343  for (unsigned int i=0 ; i<1024 ; i++) lut[i] = theLut[i] ;
344  }
345 }
const EcalTPGGroupsMap & getMap() const
Definition: EcalTPGGroups.h:28
std::map< uint32_t, uint32_t >::const_iterator EcalTPGGroupsMapItr
Definition: EcalTPGGroups.h:23
void get(HolderT &iHolder) const
l1t::HGCalTowerID towerId
Definition: classes.h:34
std::map< uint32_t, EcalTPGLut > EcalTPGLutMap
T get() const
Definition: EventSetup.h:63
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 23 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().

24 {
25 
27  static int current_bx = -1;
28  current_bx++;
29 
31  //readInput();
32 
33  if(debug_)
34  std::cout << "[EcalFEtoDigi::produce] producing event " << current_bx << std::endl;
35 
36  std::unique_ptr<EcalTrigPrimDigiCollection>
37  e_tpdigis (new EcalTrigPrimDigiCollection);
38  std::unique_ptr<EcalTrigPrimDigiCollection>
39  e_tpdigisTcp (new EcalTrigPrimDigiCollection);
40 
41  std::vector<TCCinput>::const_iterator it;
42 
43  for(int i=0; i<N_SM; i++) {
44 
45  if(!singlefile)
46  sm_=i+1;
47 
48  for(it = inputdata_[i].begin(); it != inputdata_[i].end(); it++) {
49 
50  if(!(*it).is_current(current_bx+fileEventOffset_))
51  continue;
52  else
53  if(debug_ && (*it).input!=0 )
54  std::cout << "[EcalFEtoDigi] "
55  << "\tsupermodule:" << sm_
56  << "\tevent: " << current_bx
57  << "\tbx: " << (*it).bunchCrossing
58  << "\tvalue:0x" << std::setfill('0') << std::setw(4)
59  << std::hex << (*it).input << std::setfill(' ') << std::dec
60  << std::endl;
61 
62 
64  const EcalTrigTowerDetId e_id = create_TTDetId(*it);
65 
66  //EcalElectronicsMapping theMapping;
67  //const EcalTrigTowerDetId e_id
68  //= theMapping.getTrigTowerDetId(SMidToTCCid(sm_),(*it).tower);
69  //EcalElectronicsMapping::getTrigTowerDetId(int TCCid, int iTT)
70 
74 
76  EcalTriggerPrimitiveSample e_sample = create_TPSample(*it, iSetup);
77  EcalTriggerPrimitiveSample e_sampleTcp = create_TPSampleTcp(*it, iSetup);
78 
80  e_digi->setSize(1); //set sampleOfInterest to 0
81  e_digi->setSample(0,e_sample);
82 
84  e_tpdigis->push_back(*e_digi);
85 
87  e_digiTcp->setSize(1); //set sampleOfInterest to 0
88  e_digiTcp->setSample(0,e_sampleTcp);
89 
91  e_tpdigisTcp->push_back(*e_digiTcp);
92 
93  if(debug_)
94  outfile << (*it).tower << '\t'
95  << (*it).bunchCrossing << '\t'<< std::setfill('0') << std::hex
96  << "0x" << std::setw(4) << (*it).input << '\t'
97  << "0" << std::dec << std::setfill(' ')
98  << std::endl;
99 
101  if(debug_ && (*it).input!=0 )
102  std::cout << "[EcalFEtoDigi] debug id: " << e_digi->id() << "\n\t"
103  << std::dec
104  << "\tieta: " << e_digi->id().ieta()
105  << "\tiphi: " << e_digi->id().iphi()
106  << "\tsize: " << e_digi->size()
107  << "\tfg: " <<(e_digi->fineGrain()?1:0)
108  << std::hex
109  << "\tEt: 0x" << e_digi->compressedEt()
110  << " (0x" << (*it).get_energy() << ")"
111  << "\tttflag: 0x" << e_digi->ttFlag()
112  << std::dec
113  << std::endl;
114 
115  delete e_digi;
116  delete e_digiTcp;
117 
118  }
119 
120  if(singlefile)
121  break;
122  }
123 
125  if(e_tpdigis->empty()) {
126  std::cout << "[EcalFEtoDigi] creating empty collection for the event!\n";
128  e_tpdigis->push_back(*e_digi);
129  }
130 
131  iEvent.put(std::move(e_tpdigis));
132  iEvent.put(std::move(e_tpdigisTcp),"formatTCP");
133 
134 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
int fileEventOffset_
Definition: EcalFEtoDigi.h:63
TCCInputData inputdata_[N_SM]
Definition: EcalFEtoDigi.h:56
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:510
std::ofstream outfile
Definition: EcalFEtoDigi.h:65
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 139 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().

139  {
140 
141  if(debug_)
142  std::cout << "\n[EcalFEtoDigi::readInput] Reading input data\n";
143 
144  if(!singlefile)
145  sm_=-1;
146  for(int i=0; i<N_SM; i++)
147  inputdata_[i].clear();
148 
149  std::stringstream s;
150  int tcc;
151 
152  for (int i=0; i<N_SM; i++) {
153 
154  tcc = (sm_==-1)?SMidToTCCid(i+1):SMidToTCCid(sm_);
155 
156  s.str("");
157  s << basename_ << tcc << ".txt";
158 
159  std::ifstream f(s.str().c_str());
160 
161  if(debug_) {
162  std::cout << " opening " << s.str().c_str() << "..." << std::endl;
163  if(!f.good())
164  std::cout << " skipped!";
165  std::cout << std::endl;
166  }
167  //if (!f.good() || f.eof())
168  // throw cms::Exception("BadInputFile")
169  // << "EcalFEtoDigi: cannot open file " << s.str().c_str() << std::endl;
170 
171  int n_bx=0;
172  int tt; int bx; unsigned val; int dummy;
173 
174  while(f.good()) {
175  if(f.eof()) break;
176  tt=0; bx=-1; val=0x0; dummy=0;
177  f >> tt >> bx >> std::hex >> val >> std::dec >> dummy;
178  if(bx==-1 || bx < fileEventOffset_ ) continue;
179  if( !n_bx || (bx!=(inputdata_[i].back()).bunchCrossing) )
180  n_bx++;
181  TCCinput ttdata(tt,bx,val);
182  inputdata_[i].push_back(ttdata);
183 
184  if(debug_&&val!=0)
185  printf("\treading tower:%d bx:%d input:0x%x dummy:%2d\n",
186  tt, bx, val, dummy);
187  }
188 
189  f.close();
190 
191  if(sm_!=-1)
192  break;
193  }
194 
195  if(debug_)
196  std::cout << "[EcalFEtoDigi::readInput] Done reading." << std::endl;
197 
198  return;
199 }
int fileEventOffset_
Definition: EcalFEtoDigi.h:63
std::string basename_
Definition: EcalFEtoDigi.h:58
TCCInputData inputdata_[N_SM]
Definition: EcalFEtoDigi.h:56
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 321 of file EcalFEtoDigi.cc.

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

321  {
322 
323  return (smid<=18) ? smid+55-1 : smid+37-19;
324 
325 }

Member Data Documentation

std::string EcalFEtoDigi::basename_
private

Definition at line 58 of file EcalFEtoDigi.h.

Referenced by EcalFEtoDigi(), and readInput().

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

Definition at line 63 of file EcalFEtoDigi.h.

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

TCCInputData EcalFEtoDigi::inputdata_[N_SM]
private

Definition at line 56 of file EcalFEtoDigi.h.

Referenced by produce(), and readInput().

std::ofstream EcalFEtoDigi::outfile
private

Definition at line 65 of file EcalFEtoDigi.h.

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

bool EcalFEtoDigi::singlefile
private

Definition at line 61 of file EcalFEtoDigi.h.

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

int EcalFEtoDigi::sm_
private

Definition at line 60 of file EcalFEtoDigi.h.

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

bool EcalFEtoDigi::useIdentityLUT_
private

Definition at line 59 of file EcalFEtoDigi.h.

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