CMS 3D CMS Logo

ESDigiToRaw.cc
Go to the documentation of this file.
4 
6 
10 
11 using namespace std;
12 using namespace edm;
13 
15  : ESDataFormatter_(nullptr),
16  label_(ps.getParameter<string>("Label")),
17  instanceName_(ps.getParameter<string>("InstanceES")),
18  ESDigiToken_(consumes<ESDigiCollection>(edm::InputTag(label_, instanceName_))),
19  lookup_(ps.getUntrackedParameter<FileInPath>("LookupTable")),
20  debug_(ps.getUntrackedParameter<bool>("debugMode", false)),
21  formatMajor_(ps.getUntrackedParameter<int>("formatMajor", 4)),
22  formatMinor_(ps.getUntrackedParameter<int>("formatMinor", 1)) {
23  if (formatMajor_ == 4)
25  else
27 
28  produces<FEDRawDataCollection>();
29  // initialize look-up table
30  for (int i = 0; i < 2; ++i)
31  for (int j = 0; j < 2; ++j)
32  for (int k = 0; k < 40; ++k)
33  for (int m = 0; m < 40; m++)
34  fedId_[i][j][k][m] = -1;
35 
36  // read in look-up table
37  int nLines, iz, ip, ix, iy, fed, kchip, pace, bundle, fiber, optorx;
38  ifstream file;
39  file.open(lookup_.fullPath().c_str());
40  if (file.is_open()) {
41  file >> nLines;
42  for (int i = 0; i < nLines; ++i) {
43  file >> iz >> ip >> ix >> iy >> fed >> kchip >> pace >> bundle >> fiber >> optorx;
44  fedId_[(3 - iz) / 2 - 1][ip - 1][ix - 1][iy - 1] = fed;
45  }
46  } else {
47  cout << "[ESDigiToRaw] Look up table file can not be found in " << lookup_.fullPath().c_str() << endl;
48  }
49 
50  file.close();
51 }
52 
54  if (ESDataFormatter_)
55  delete ESDataFormatter_;
56 }
57 
60  meta_data.lv1 = ev.id().event();
61  meta_data.run_number = ev.id().run();
62  meta_data.orbit_number = meta_data.lv1 / LHC_BX_RANGE;
63  meta_data.bx = (meta_data.lv1 % LHC_BX_RANGE);
64 
65  meta_data.kchip_ec = (meta_data.lv1 % KCHIP_EC_RANGE);
66  meta_data.kchip_bc = (meta_data.lv1 % KCHIP_BC_RANGE);
67 
69  ev.getByToken(ESDigiToken_, digis);
70 
71  int ifed;
73  Digis.clear();
74 
75  for (ESDigiCollection::const_iterator it = digis->begin(); it != digis->end(); ++it) {
76  const ESDataFrame& df = *it;
77  const ESDetId& detId = it->id();
78 
79  ifed = fedId_[(3 - detId.zside()) / 2 - 1][detId.plane() - 1][detId.six() - 1][detId.siy() - 1];
80  if (ifed < 0)
81  continue;
82 
83  Digis[ifed].push_back(df);
84  }
85 
86  auto productRawData = std::make_unique<FEDRawDataCollection>();
87 
88  ESDataFormatter::Digis::const_iterator itfed;
89  for (itfed = Digis.begin(); itfed != Digis.end(); ++itfed) {
90  int fId = (*itfed).first;
91 
92  FEDRawData& fedRawData = productRawData->FEDData(fId);
93  ESDataFormatter_->DigiToRaw(fId, Digis, fedRawData, meta_data);
94 
95  if (debug_)
96  cout << "FED : " << fId << " Data size : " << fedRawData.size() << " (Bytes)" << endl;
97  }
98 
99  ev.put(std::move(productRawData));
100 
101  return;
102 }
FEDNumbering.h
edm::StreamID
Definition: StreamID.h:30
ESDataFormatter::Meta_Data
Definition: ESDataFormatter.h:18
electrons_cff.bool
bool
Definition: electrons_cff.py:372
mps_fire.i
i
Definition: mps_fire.py:355
funct::false
false
Definition: Factorize.h:34
ESDigiToRaw::ESDigiToken_
const edm::EDGetTokenT< ESDigiCollection > ESDigiToken_
Definition: ESDigiToRaw.h:41
edm::DataFrameContainer::const_iterator
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
Definition: DataFrameContainer.h:61
edm
HLT enums.
Definition: AlignableModifier.h:19
gather_cfg.cout
cout
Definition: gather_cfg.py:144
ESDigiToRaw::KCHIP_EC_RANGE
static const int KCHIP_EC_RANGE
Definition: ESDigiToRaw.h:33
ESDigiToRaw.h
ESDetId
Definition: ESDetId.h:15
FEDRawData.h
edm::Handle
Definition: AssociativeIterator.h:50
submitDQMOfflineCAF.nLines
nLines
Definition: submitDQMOfflineCAF.py:676
ESDataFormatter::Digis
std::map< int, DetDigis > Digis
Definition: ESDataFormatter.h:31
ESDataFrame
Definition: ESDataFrame.h:10
FEDRawData
Definition: FEDRawData.h:19
ESDataFrame.h
edm::FileInPath
Definition: FileInPath.h:64
ESDataFormatterV1_1.h
l1t_dqm_sourceclient-live_cfg.fedRawData
fedRawData
Definition: l1t_dqm_sourceclient-live_cfg.py:182
ESDigiToRaw::produce
void produce(edm::StreamID, edm::Event &e, const edm::EventSetup &es) const override
Definition: ESDigiToRaw.cc:58
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
ESDigiToRaw::fedId_
int fedId_[2][2][40][40]
Definition: ESDigiToRaw.h:36
ESDigiToRaw::formatMajor_
const int formatMajor_
Definition: ESDigiToRaw.h:44
ESDataFormatterV4.h
dqmdumpme.k
k
Definition: dqmdumpme.py:60
ESDigiCollection
Definition: EcalDigiCollections.h:58
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ESDataFormatter::Meta_Data::run_number
int run_number
Definition: ESDataFormatter.h:19
ESDataFormatter::Meta_Data::orbit_number
int orbit_number
Definition: ESDataFormatter.h:20
edm::ParameterSet
Definition: ParameterSet.h:36
ESDigiToRaw::debug_
const bool debug_
Definition: ESDigiToRaw.h:43
ESDigiToRaw::ESDataFormatter_
const ESDataFormatter * ESDataFormatter_
Definition: ESDigiToRaw.h:38
ESDigiToRaw::lookup_
const edm::FileInPath lookup_
Definition: ESDigiToRaw.h:42
ESDataFormatter::Meta_Data::kchip_ec
int kchip_ec
Definition: ESDataFormatter.h:24
createfilelist.int
int
Definition: createfilelist.py:10
FrontierConditions_GlobalTag_cff.file
file
Definition: FrontierConditions_GlobalTag_cff.py:13
FEDRawDataCollection.h
edm::DataFrameContainer::begin
const_iterator begin() const
The iterator returned can not safely be used across threads.
Definition: DataFrameContainer.h:149
edm::EventSetup
Definition: EventSetup.h:57
ESDetId::plane
int plane() const
Definition: ESDetId.h:41
ESDetId::six
int six() const
Definition: ESDetId.h:43
ESDigiToRaw::KCHIP_BC_RANGE
static const int KCHIP_BC_RANGE
Definition: ESDigiToRaw.h:32
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
ESDataFormatterV4
Definition: ESDataFormatterV4.h:21
ESDataFormatter::Meta_Data::bx
int bx
Definition: ESDataFormatter.h:21
ESDataFormatter::Meta_Data::kchip_bc
int kchip_bc
Definition: ESDataFormatter.h:23
ESDigiToRaw::LHC_BX_RANGE
static const int LHC_BX_RANGE
Definition: ESDigiToRaw.h:31
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
ESDetId::siy
int siy() const
Definition: ESDetId.h:45
ESDataFormatter::DigiToRaw
virtual void DigiToRaw(int fedId, Digis &digis, FEDRawData &fedRawData, const Meta_Data &meta_data) const =0
ESDataFormatter::Meta_Data::lv1
int lv1
Definition: ESDataFormatter.h:22
ESDigiToRaw::ESDigiToRaw
ESDigiToRaw(const edm::ParameterSet &ps)
Definition: ESDigiToRaw.cc:14
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::Event
Definition: Event.h:73
ESDataFormatterV1_1
Definition: ESDataFormatterV1_1.h:20
edm::DataFrameContainer::end
const_iterator end() const
Definition: DataFrameContainer.h:152
edm::InputTag
Definition: InputTag.h:15
ESDetId::zside
int zside() const
Definition: ESDetId.h:39
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:163
ESDigiToRaw::~ESDigiToRaw
~ESDigiToRaw() override
Definition: ESDigiToRaw.cc:53