CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes
EcalSimRawData Class Reference

#include <EcalSimRawData.h>

Inheritance diagram for EcalSimRawData:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
 EcalSimRawData (const edm::ParameterSet &pset)
 
 ~EcalSimRawData () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () 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 Types

enum  writeMode_t { littleEndian, bigEndian, ascii }
 

Private Member Functions

void checkGeometry (const edm::EventSetup &eventSetup)
 
void checkTriggerMap (const edm::EventSetup &eventSetup)
 
int cIndex2iTtEta (int iTtEta0) const
 
int cIndex2TtPhi (int iTtPhi0) const
 
void elec2GeomNum (int ittEta0, int ittPhi0, int strip1, int ch1, int &iEta0, int &iPhi0) const
 
void fwrite (std::ofstream &f, uint16_t data, int &iword, bool hpar=true) const
 
void genFeData (std::string basename, int iEvent, const std::vector< uint16_t > adcCount[nEbEta][nEbPhi]) const
 
void genSrData (std::string basename, int iEvent, int ttf[nEbTtEta][nTtPhi]) const
 
void genTccIn (std::string basename, int iEvent, const int tps[nTtEta][nTtPhi]) const
 
void genTccOut (std::string basename, int iEvent, const int tps[nTtEta][nTtPhi]) const
 
void getEbDigi (const edm::Event &event, std::vector< uint16_t > adc[nEbEta][nEbPhi]) const
 
std::string getExt () const
 
void getSrfs (const edm::Event &event, int ebSrf[nTtEta][nTtPhi], int eeSrf[nEndcaps][nScX][nScY]) const
 
void getTp (const edm::Event &event, const std::string &collName, int tp[nTtEta][nTtPhi]) const
 
int iEta2cIndex (int iEta) const
 
int iPhi2cIndex (int iPhi) const
 
int iTtEta2cIndex (int iTtEta) const
 
int iTtPhi2cIndex (int iTtPhi) const
 
void setHParity (uint16_t &a) const
 

Private Attributes

std::string basename_
 
int dccNum_
 
std::string digiProducer_
 
std::string ebDigiCollection_
 
std::string ebSrFlagCollection_
 
std::string eeDigiCollection_
 
std::string eeSrFlagCollection_
 
std::unique_ptr< EcalSelectiveReadoutesr_
 
bool fe2dcc_
 
bool fe2tcc_
 
int iEvent
 
std::string srDigiProducer_
 
std::ofstream srfFile
 
bool srp2dcc_
 
bool tcc2dcc_
 
int tccInDefaultVal_
 
int tccNum_
 
std::string tcpDigiCollection_
 
const CaloGeometrytheGeometry
 
const EcalTrigTowerConstituentsMaptheTriggerTowerMap
 
std::string tpDigiCollection_
 
std::string tpProducer_
 
bool tpVerbose_
 
std::ofstream ttfFile
 
writeMode_t writeMode_
 
bool xtalVerbose_
 

Static Private Attributes

static const int ebDccPhiEdge = 20
 
static const int ebTccPhiEdge = 20
 
static const int nDccEndcap = 9
 
static const int nDccInPhi = 18
 
static const int nEbEta = 170
 
static const int nEbPhi = 360
 
static const int nEbTtEta = nEbEta / ttEdge
 
static const int nEeTtEta = 11
 
static const int nEeX = 100
 
static const int nEeY = 100
 
static const int nEndcaps = 2
 
static const int nScX = 20
 
static const int nScY = 20
 
static const int nTccEndcap = 36
 
static const int nTccInPhi = 18
 
static const int nTtEta = nEbTtEta + 2 * nEeTtEta
 
static const int nTtPhi = nEbPhi / ttEdge
 
static const int nTtPhisPerEbDcc = 4
 
static const int nTtPhisPerEbTcc = 4
 
static const int nTtSmEta = 17
 
static const int nTtSmPhi = 4
 
static const int nTtTypes = 2
 
static const int scEdge = 5
 
static const int strip2Eta [nTtTypes][ttEdge]
 
static const int stripCh2Phi [nTtTypes][ttEdge][ttEdge]
 
static const int ttEdge = 5
 
static const int ttType [nEbTtEta]
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
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

The EcalSimRawData CMSSW module produces raw data from digis. The raw data are written into files which can be loaded into the TCC DCC and SRP boards in order to emulate the front-end. Only barrel is fully supported. The produced files for TCC assumes a special LUT in the TCC forged for FE emulation mode.

Module Parameters:

Definition at line 42 of file EcalSimRawData.h.

Member Enumeration Documentation

Output format mode

littleEndian: little endian binary bigEndian: big endian binary ascii: ascii mode. The one accepted by the TCC, DCC and SRP board control software.

Enumerator
littleEndian 
bigEndian 
ascii 

Definition at line 185 of file EcalSimRawData.h.

Constructor & Destructor Documentation

EcalSimRawData::EcalSimRawData ( const edm::ParameterSet pset)
explicit

Constructor

Parameters
psetCMSSW configuration

Definition at line 42 of file EcalSimRawData.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), iEvent, AlCaHLTBitMon_QueryRunRegistry::string, and EcalSimRawData_cfi::writeMode.

42  {
43  // sets up parameters:
44  digiProducer_ = params.getParameter<string>("unsuppressedDigiProducer");
45  ebDigiCollection_ = params.getParameter<std::string>("EBdigiCollection");
46  eeDigiCollection_ = params.getParameter<std::string>("EEdigiCollection");
47  srDigiProducer_ = params.getParameter<string>("srProducer");
48  ebSrFlagCollection_ = params.getParameter<std::string>("EBSrFlagCollection");
49  eeSrFlagCollection_ = params.getParameter<std::string>("EESrFlagCollection");
50  tpDigiCollection_ = params.getParameter<std::string>("trigPrimDigiCollection");
51  tcpDigiCollection_ = params.getParameter<std::string>("tcpDigiCollection");
52  tpProducer_ = params.getParameter<string>("trigPrimProducer");
53  xtalVerbose_ = params.getUntrackedParameter<bool>("xtalVerbose", false);
54  tpVerbose_ = params.getUntrackedParameter<bool>("tpVerbose", false);
55  tcc2dcc_ = params.getUntrackedParameter<bool>("tcc2dccData", true);
56  srp2dcc_ = params.getUntrackedParameter<bool>("srp2dccData", true);
57  fe2dcc_ = params.getUntrackedParameter<bool>("fe2dccData", true);
58  fe2tcc_ = params.getUntrackedParameter<bool>("fe2tccData", true);
59  dccNum_ = params.getUntrackedParameter<int>("dccNum", -1);
60  tccNum_ = params.getUntrackedParameter<int>("tccNum", -1);
61  tccInDefaultVal_ = params.getUntrackedParameter<int>("tccInDefaultVal", 0xffff);
62  basename_ = params.getUntrackedParameter<std::string>("outputBaseName");
63 
64  iEvent = 0;
65 
66  string writeMode = params.getParameter<string>("writeMode");
67 
68  if (writeMode == string("littleEndian")) {
70  } else if (writeMode == string("bigEndian")) {
72  } else {
73  writeMode_ = ascii;
74  }
75 }
std::string srDigiProducer_
writeMode_t writeMode_
std::string digiProducer_
std::string eeSrFlagCollection_
std::string ebDigiCollection_
std::string ebSrFlagCollection_
std::string tcpDigiCollection_
std::string basename_
std::string eeDigiCollection_
std::string tpDigiCollection_
std::string tpProducer_
EcalSimRawData::~EcalSimRawData ( )
inlineoverride

Destructor

Definition at line 51 of file EcalSimRawData.h.

References analyze().

51 {};

Member Function Documentation

void EcalSimRawData::analyze ( const edm::Event event,
const edm::EventSetup es 
)
override

Main method. Called back for each event. This method produced the raw data and write them to disk.

Definition at line 77 of file EcalSimRawData.cc.

References ecalMGPA::adc(), gather_cfg::cout, iEvent, and nEndcaps.

Referenced by ~EcalSimRawData().

77  {
78  // Event counter:
79  ++iEvent;
80 
81  if (xtalVerbose_ | tpVerbose_) {
82  cout << "=================================================================="
83  "====\n"
84  << " Event " << iEvent << "\n"
85  << "------------------------------------------------------------------"
86  "----\n";
87  }
88 
89  if (fe2dcc_) {
90  vector<uint16_t> adc[nEbEta][nEbPhi];
91  getEbDigi(event, adc);
92  genFeData(basename_, iEvent, adc);
93  }
94 
95  if (fe2tcc_) {
96  int tcp[nTtEta][nTtPhi] = {{0}};
97  getTp(event, tcpDigiCollection_, tcp);
98  genTccIn(basename_, iEvent, tcp);
99  }
100 
101  if (tcc2dcc_) {
102  int tp[nTtEta][nTtPhi] = {{0}};
103  getTp(event, tpDigiCollection_, tp);
104  genTccOut(basename_, iEvent, tp);
105  }
106 
107  // SR flags:
108  int ebSrf[nTtEta][nTtPhi];
109  int eeSrf[nEndcaps][nScX][nScY];
110 
111  if (srp2dcc_) {
112  getSrfs(event, ebSrf, eeSrf);
113  genSrData(basename_, iEvent, ebSrf);
114  }
115 }
static const int nTtPhi
static const int nEbEta
static const int nScX
static const int nEbPhi
void getTp(const edm::Event &event, const std::string &collName, int tp[nTtEta][nTtPhi]) const
static const int nEndcaps
void genFeData(std::string basename, int iEvent, const std::vector< uint16_t > adcCount[nEbEta][nEbPhi]) const
void getSrfs(const edm::Event &event, int ebSrf[nTtEta][nTtPhi], int eeSrf[nEndcaps][nScX][nScY]) const
static const int nScY
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
std::string tcpDigiCollection_
std::string basename_
void genTccOut(std::string basename, int iEvent, const int tps[nTtEta][nTtPhi]) const
void genSrData(std::string basename, int iEvent, int ttf[nEbTtEta][nTtPhi]) const
void getEbDigi(const edm::Event &event, std::vector< uint16_t > adc[nEbEta][nEbPhi]) const
std::string tpDigiCollection_
void genTccIn(std::string basename, int iEvent, const int tps[nTtEta][nTtPhi]) const
static const int nTtEta
void EcalSimRawData::checkGeometry ( const edm::EventSetup eventSetup)
private

call these once an event, to make sure everything is up-to-date

void EcalSimRawData::checkTriggerMap ( const edm::EventSetup eventSetup)
private
int EcalSimRawData::cIndex2iTtEta ( int  iTtEta0) const
inlineprivate

Converse of iTtEta2cIndex

Parameters
iTtEta0c eta index of TT
stdCMSSW TT eta index

Definition at line 235 of file EcalSimRawData.h.

235 { return (iTtEta0 < 28) ? (iTtEta0 - 28) : (iTtEta0 - 27); }
int EcalSimRawData::cIndex2TtPhi ( int  iTtPhi0) const
inlineprivate

Converse of iTtPhi2cIndex

Parameters
iTtPhi0phi index of TT
Returns
std CMSS TT index

Definition at line 241 of file EcalSimRawData.h.

241 { return iTtPhi0 + 1; }
void EcalSimRawData::elec2GeomNum ( int  ittEta0,
int  ittPhi0,
int  strip1,
int  ch1,
int &  iEta0,
int &  iPhi0 
) const
private

Converts electronic number of an ECAL barrel channel to geometrical indices

Parameters
ittEta0trigger tower c index
ittPhi0trigger tower c index
strip1strip index within the TT. Runs from 1 to 5.
ch1channel electronics number within the VFE. Runs from 1 to 5.
[out]iEta0eta c index of the channel
[out]iPhi0eta c index of the channel

Definition at line 117 of file EcalSimRawData.cc.

Referenced by iTtPhi2cIndex().

117  {
118  assert(0 <= ittEta0 && ittEta0 < nEbTtEta);
119  assert(0 <= ittPhi0 && ittPhi0 < nTtPhi);
120  assert(1 <= strip1 && strip1 <= ttEdge);
121  assert(1 <= ch1 && ch1 <= ttEdge);
122  const int type = ttType[ittEta0];
123  iEta0 = ittEta0 * ttEdge + strip2Eta[type][strip1 - 1];
124  iPhi0 = ittPhi0 * ttEdge + stripCh2Phi[type][strip1 - 1][ch1 - 1];
125  assert(0 <= iEta0 && iEta0 < nEbEta);
126  assert(0 <= iPhi0 && iPhi0 < nEbPhi);
127 }
type
Definition: HCALResponse.h:21
static const int nTtPhi
static const int nEbEta
static const int nEbPhi
static const int strip2Eta[nTtTypes][ttEdge]
static const int nEbTtEta
static const int stripCh2Phi[nTtTypes][ttEdge][ttEdge]
static const int ttEdge
static const int ttType[nEbTtEta]
void EcalSimRawData::fwrite ( std::ofstream &  f,
uint16_t  data,
int &  iword,
bool  hpar = true 
) const
private

Write a data 16-bit word into file according to selected format.

Parameters
fthe file stream to write to
datathe peace of data to write
[in,out]iwordpass zero when writing for the first time in a file, then the value returned by the previous call. Counts the number of words written into the file.
hparif true the horizontal odd word parity is set before writing the word into the file.

Definition at line 129 of file EcalSimRawData.cc.

References EnergyCorrector::c, and TauDecayModes::dec.

Referenced by iTtPhi2cIndex().

129  {
130  if (hpar) {
131  // set horizontal odd parity bit:
132  setHParity(data);
133  }
134 
135  switch (writeMode_) {
136  case littleEndian: {
137  char c = data & 0x00FF;
138  f.write(&c, sizeof(c));
139  c = (data >> 8) & 0x00FF;
140  f.write(&c, sizeof(c));
141  } break;
142  case bigEndian: {
143  char c = (data >> 8) & 0x00FF;
144  f.write(&c, sizeof(c));
145  c = data & 0x00FF;
146  f.write(&c, sizeof(c));
147  } break;
148  case ascii:
149  f << ((iWord % 8 == 0 && iWord != 0) ? "\n" : "") << "0x" << setfill('0') << setw(4) << hex << data << "\t" << dec
150  << setfill(' ');
151  break;
152  }
153  ++iWord;
154 }
writeMode_t writeMode_
void setHParity(uint16_t &a) const
double f[11][100]
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void EcalSimRawData::genFeData ( std::string  basename,
int  iEvent,
const std::vector< uint16_t >  adcCount[nEbEta][nEbPhi] 
) const
private

Generates FE crystal data

Parameters
basenamebase for the output file name. DCC number is appended to the name
iEventevent index
adcCountthe payload, the ADC count of the channels.

stripHeader |= parity(stripHeader) << 15;

Definition at line 169 of file EcalSimRawData.cc.

References ecalMGPA::adc(), gather_cfg::cout, data, TauDecayModes::dec, f, alignCSCRings::s, and globals_cff::x1.

Referenced by iTtPhi2cIndex().

169  {
170  int smf = 0;
171  int gmf = 0;
172  int nPendingEvt = 0;
173  int monitorFlag = 0;
174  int chFrameLen = adcCount[0][0].size() + 1;
175 
176  int iWord = 0;
177 
178  for (int iZ0 = 0; iZ0 < 2; ++iZ0) {
179  for (int iDccPhi0 = 0; iDccPhi0 < nDccInPhi; ++iDccPhi0) {
180  int iDcc1 = iDccPhi0 + iZ0 * nDccInPhi + nDccEndcap + 1;
181 
182  if (dccNum_ != -1 && dccNum_ != iDcc1)
183  continue;
184 
185  stringstream s;
186  s.str("");
187  const string &ext = getExt();
188  s << basename << "_fe2dcc" << setfill('0') << setw(2) << iDcc1 << setfill(' ') << ext;
189  ofstream f(s.str().c_str(), (iEvent == 1 ? ios::ate : ios::app));
190 
191  if (f.fail())
192  return;
193 
194  if (writeMode_ == ascii) {
195  f << (iEvent == 1 ? "" : "\n") << "[Event:" << iEvent << "]\n";
196  }
197 
198  for (int iTtEtaInSm0 = 0; iTtEtaInSm0 < nTtSmEta; ++iTtEtaInSm0) {
199  int iTtEta0 = iZ0 * nTtSmEta + iTtEtaInSm0;
200  for (int iTtPhiInSm0 = 0; iTtPhiInSm0 < nTtSmPhi; ++iTtPhiInSm0) {
201  // phi=0deg at middle of 1st barrel DCC:
202  int iTtPhi0 = -nTtPhisPerEbDcc / 2 + iDccPhi0 * nTtPhisPerEbDcc + iTtPhiInSm0;
203  if (iTtPhi0 < 0)
204  iTtPhi0 += nTtPhi;
205  for (int stripId1 = 1; stripId1 <= ttEdge; ++stripId1) {
206  uint16_t stripHeader =
207  0xF << 11 | (nPendingEvt & 0x3F) << 5 | (gmf & 0x1) << 4 | (smf & 0x1) << 3 | (stripId1 & 0x7);
209  fwrite(f, stripHeader, iWord);
210 
211  for (int xtalId1 = 1; xtalId1 <= ttEdge; ++xtalId1) {
212  uint16_t crystalHeader = 1 << 14 | (chFrameLen & 0xFF) << 4 | (monitorFlag & 0x1) << 3 | (xtalId1 & 0x7);
213  // crystalHeader |=parity(crystalHeader) << 15;
214  fwrite(f, crystalHeader, iWord);
215 
216  int iEta0;
217  int iPhi0;
218  elec2GeomNum(iTtEta0, iTtPhi0, stripId1, xtalId1, iEta0, iPhi0);
219  if (xtalVerbose_) {
220  cout << dec << "iDcc1 = " << iDcc1 << "\t"
221  << "iEbTtEta0 = " << iTtEta0 << "\t"
222  << "iEbTtPhi0 = " << iTtPhi0 << "\t"
223  << "stripId1 = " << stripId1 << "\t"
224  << "xtalId1 = " << xtalId1 << "\t"
225  << "iEta0 = " << iEta0 << "\t"
226  << "iPhi0 = " << iPhi0 << "\t"
227  << "adc[5] = 0x" << hex << adcCount[iEta0][iPhi0][5] << dec << "\n";
228  }
229 
230  const vector<uint16_t> &adc = adcCount[iEta0][iPhi0];
231  for (unsigned iSample = 0; iSample < adc.size(); ++iSample) {
232  uint16_t data = adc[iSample] & 0x3FFF;
233  // data |= parity(data);
234  fwrite(f, data, iWord);
235  } // next time sample
236  } // next crystal in strip
237  } // next strip in TT
238  } // next TT along phi
239  } // next TT along eta
240  } // next DCC
241  } // next half-barrel
242 }
static const int nDccInPhi
writeMode_t writeMode_
static const int nTtPhi
static const int nTtSmPhi
static const int nDccEndcap
std::string getExt() const
static const int nTtPhisPerEbDcc
double f[11][100]
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
void fwrite(std::ofstream &f, uint16_t data, int &iword, bool hpar=true) const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
Definition: memstream.h:15
void elec2GeomNum(int ittEta0, int ittPhi0, int strip1, int ch1, int &iEta0, int &iPhi0) const
static const int ttEdge
static const int nTtSmEta
void EcalSimRawData::genSrData ( std::string  basename,
int  iEvent,
int  ttf[nEbTtEta][nTtPhi] 
) const
private

Generates SR flags

Parameters
basenamebase for the output file name. DCC number is appended to the name
iEventevent index
thetrigger tower flags

Definition at line 244 of file EcalSimRawData.cc.

References data, f, alignCSCRings::s, and globals_cff::x1.

Referenced by iTtPhi2cIndex().

244  {
245  for (int iZ0 = 0; iZ0 < 2; ++iZ0) {
246  for (int iDccPhi0 = 0; iDccPhi0 < nDccInPhi; ++iDccPhi0) {
247  int iDcc1 = iDccPhi0 + iZ0 * nDccInPhi + nDccEndcap + 1;
248  if (dccNum_ != -1 && dccNum_ != iDcc1)
249  continue;
250  stringstream s;
251  s.str("");
252  s << basename << "_ab2dcc" << setfill('0') << setw(2) << iDcc1 << setfill(' ') << getExt();
253  ofstream f(s.str().c_str(), (iEvent == 1 ? ios::ate : ios::app));
254 
255  if (f.fail())
256  throw cms::Exception(string("Cannot create/open file ") + s.str() + ".");
257 
258  int iWord = 0;
259 
260  if (writeMode_ == ascii) {
261  f << (iEvent == 1 ? "" : "\n") << "[Event:" << iEvent << "]\n";
262  }
263 
264  const uint16_t le1 = 0;
265  const uint16_t le0 = 0;
266  const uint16_t h1 = 1;
267  const uint16_t nFlags = 68;
268  uint16_t data = (h1 & 0x1) << 14 | (le1 & 0x1) << 12 | (le0 & 0x1) << 11 | (nFlags & 0x7F);
269 
270  fwrite(f, data, iWord, true);
271 
272  int iFlag = 0;
273  data = 0;
274 
275  for (int iTtEtaInSm0 = 0; iTtEtaInSm0 < nTtSmEta; ++iTtEtaInSm0) {
276  // int iTtEbEta0 = iZ0*nTtSmEta + iTtEtaInSm0;
277  int iTtEta0 = nEeTtEta + iZ0 * nTtSmEta + iTtEtaInSm0;
278  for (int iTtPhiInSm0 = 0; iTtPhiInSm0 < nTtSmPhi; ++iTtPhiInSm0) {
279  // phi=0deg at middle of 1st barrel DCC:
280  int iTtPhi0 = -nTtPhisPerEbDcc / 2 + iDccPhi0 * nTtPhisPerEbDcc + iTtPhiInSm0;
281  if (iTtPhi0 < 0)
282  iTtPhi0 += nTtPhi;
283  // flags are packed by four:
284  //|15 |14 |13-12 |11 9|8 6|5 3|2 0|
285  //| P | 0 | X X | srf i+3| srf i+2| srf i+1| srf i |
286  //| | | | field 3 |field 2 | field 1| field 0|
287  const int field = iFlag % 4;
288  // cout << "TtEta0: " << iTtEta0 << "\tTtPhi0: " << iTtPhi0 << "\n";
289  // cout << "#" << oct << (int)srf[iTtEta0][iTtPhi0] << "o ****> #" <<
290  // oct << (srf[iTtEta0][iTtPhi0] << (field*3)) << "o\n" << dec;
291 
292  data |= srf[iTtEta0][iTtPhi0] << (field * 3);
293 
294  if (field == 3) {
295  // cout << srf[iTtEta0][iTtPhi0] << "----> 0x" << hex << data <<
296  // "\n";
297  fwrite(f, data, iWord, true);
298  data = 0;
299  }
300  ++iFlag;
301  } // next TT along phi
302  } // next TT along eta
303  } // next DCC
304  } // next half-barrel
305 }
static const int nDccInPhi
writeMode_t writeMode_
static const int nTtPhi
static const int nEeTtEta
static const int nTtSmPhi
static const int nDccEndcap
std::string getExt() const
static const int nTtPhisPerEbDcc
double f[11][100]
void fwrite(std::ofstream &f, uint16_t data, int &iword, bool hpar=true) const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
static const int nTtSmEta
void EcalSimRawData::genTccIn ( std::string  basename,
int  iEvent,
const int  tps[nTtEta][nTtPhi] 
) const
private

Generates FE trigger primitives data

Parameters
basenamebase for the output file name. DCC number is appended to the name
iEventevent index
tpsthe payload, the trigger primitives

Definition at line 307 of file EcalSimRawData.cc.

References gather_cfg::cout, TauDecayModes::dec, and alignCSCRings::s.

Referenced by iTtPhi2cIndex().

307  {
308  for (int iZ0 = 0; iZ0 < 2; ++iZ0) {
309  for (int iTccPhi0 = 0; iTccPhi0 < nTccInPhi; ++iTccPhi0) {
310  int iTcc1 = iTccPhi0 + iZ0 * nTccInPhi + nTccEndcap + 1;
311 
312  if (tccNum_ != -1 && tccNum_ != iTcc1)
313  continue;
314 
315  stringstream s;
316  s.str("");
317  const char *ext = ".txt"; // only ascii mode supported for TCP
318 
319  s << basename << "_tcc" << setfill('0') << setw(2) << iTcc1 << setfill(' ') << ext;
320  ofstream fe2tcc(s.str().c_str(), (iEvent == 1 ? ios::ate : ios::app));
321 
322  if (fe2tcc.fail())
323  throw cms::Exception(string("Failed to create file ") + s.str() + ".");
324 
325  int memPos = iEvent - 1;
326  int iCh1 = 1;
327  for (int iTtEtaInSm0 = 0; iTtEtaInSm0 < nTtSmEta; ++iTtEtaInSm0) {
328  int iTtEta0 = (iZ0 == 0) ? 27 - iTtEtaInSm0 : 28 + iTtEtaInSm0;
329  for (int iTtPhiInSm0 = 0; iTtPhiInSm0 < nTtSmPhi; ++iTtPhiInSm0) {
330  // phi=0deg at middle of 1st barrel DCC:
331  int iTtPhi0 = -nTtPhisPerEbTcc / 2 + iTccPhi0 * nTtPhisPerEbTcc + iTtPhiInSm0;
332  iTtPhi0 += nTtPhisPerEbTcc * iTccPhi0;
333  if (iTtPhi0 < 0)
334  iTtPhi0 += nTtPhi;
335  uint16_t tp_fe2tcc = (tcp[iTtEta0][iTtPhi0] & 0x7ff); // keep only Et (9:0) and FineGrain (10)
336 
337  if (tpVerbose_ && tp_fe2tcc != 0) {
338  cout << dec << "iTcc1 = " << iTcc1 << "\t"
339  << "iTtEta0 = " << iTtEta0 << "\t"
340  << "iTtPhi0 = " << iTtPhi0 << "\t"
341  << "iCh1 = " << iCh1 << "\t"
342  << "memPos = " << memPos << "\t"
343  << "tp = 0x" << setfill('0') << hex << setw(3) << tp_fe2tcc << dec << setfill(' ') << "\n";
344  }
345  fe2tcc << iCh1 << "\t" << memPos << "\t" << setfill('0') << hex << "0x" << setw(4) << tp_fe2tcc << "\t"
346  << "0" << dec << setfill(' ') << "\n";
347  ++iCh1;
348  } // next TT along phi
349  } // next TT along eta
350  fe2tcc << std::flush;
351  fe2tcc.close();
352  } // next TCC
353  } // next half-barrel
354 }
static const int nTtPhi
static const int nTccInPhi
static const int nTtSmPhi
static const int nTccEndcap
static const int nTtPhisPerEbTcc
Definition: memstream.h:15
static const int nTtSmEta
void EcalSimRawData::genTccOut ( std::string  basename,
int  iEvent,
const int  tps[nTtEta][nTtPhi] 
) const
private

Generates TCC->DCC data

Parameters
basenamebase for the output file name. DCC number is appended to the name
iEventevent index
tpsthe payload, the trigger primitives

Definition at line 356 of file EcalSimRawData.cc.

References gather_cfg::cout, data, TauDecayModes::dec, hgc_digi::nSamples, alignCSCRings::s, and globals_cff::x1.

Referenced by iTtPhi2cIndex().

356  {
357  int iDccWord = 0;
358 
359  for (int iZ0 = 0; iZ0 < 2; ++iZ0) {
360  for (int iTccPhi0 = 0; iTccPhi0 < nTccInPhi; ++iTccPhi0) {
361  int iTcc1 = iTccPhi0 + iZ0 * nTccInPhi + nTccEndcap + 1;
362 
363  if (tccNum_ != -1 && tccNum_ != iTcc1)
364  continue;
365 
366  stringstream s;
367  s.str("");
368  const char *ext = ".txt"; // only ascii mode supported for TCP
369 
370  s << basename << "_tcc" << setfill('0') << setw(2) << iTcc1 << setfill(' ') << ext;
371 
372  s.str("");
373  s << basename << "_tcc2dcc" << setfill('0') << setw(2) << iTcc1 << setfill(' ') << getExt();
374  ofstream dccF(s.str().c_str(), (iEvent == 1 ? ios::ate : ios::app));
375 
376  if (dccF.fail()) {
377  cout << "Warning: failed to create or open file " << s.str() << ".\n";
378  return;
379  }
380 
381  const uint16_t h1 = 1;
382  const uint16_t le1 = 0;
383  const uint16_t le0 = 0;
384  const uint16_t nSamples = 1;
385  const uint16_t nTts = 68;
386  const uint16_t data =
387  (h1 & 0x1) << 14 | (le1 & 0x1) << 12 | (le0 & 0x1) << 11 | (nSamples & 0xF) << 7 | (nTts & 0x7F);
388  dccF << (iEvent == 1 ? "" : "\n") << "[Event:" << iEvent << "]\n";
389  fwrite(dccF, data, iDccWord, false);
390 
391  int memPos = iEvent - 1;
392  int iCh1 = 1;
393  for (int iTtEtaInSm0 = 0; iTtEtaInSm0 < nTtSmEta; ++iTtEtaInSm0) {
394  int iTtEta0 = nEeTtEta + iZ0 * nTtSmEta + iTtEtaInSm0;
395  for (int iTtPhiInSm0 = 0; iTtPhiInSm0 < nTtSmPhi; ++iTtPhiInSm0) {
396  // phi=0deg at middle of 1st barrel DCC:
397  int iTtPhi0 = -nTtPhisPerEbTcc / 2 + iTccPhi0 * nTtPhisPerEbTcc + iTtPhiInSm0;
398  if (iTtPhi0 < 0)
399  iTtPhi0 += nTtPhi;
400 
401  if (tpVerbose_) {
402  cout << dec << "iTcc1 = " << iTcc1 << "\t"
403  << "iTtEta0 = " << iTtEta0 << "\t"
404  << "iTtPhi0 = " << iTtPhi0 << "\t"
405  << "iCh1 = " << iCh1 << "\t"
406  << "memPos = " << memPos << "\t"
407  << "tp = 0x" << hex << tps[iTtEta0][iTtPhi0] << dec << "\n";
408  }
409  fwrite(dccF, tps[iTtEta0][iTtPhi0], iDccWord, false);
410  ++iCh1;
411  } // next TT along phi
412  } // next TT along eta
413  } // next TCC
414  } // next half-barrel
415 }
static const int nTtPhi
static const int nTccInPhi
static const int nEeTtEta
static const int nTtSmPhi
std::string getExt() const
static const int nTccEndcap
constexpr size_t nSamples
void fwrite(std::ofstream &f, uint16_t data, int &iword, bool hpar=true) const
static const int nTtPhisPerEbTcc
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
Definition: memstream.h:15
static const int nTtSmEta
void EcalSimRawData::getEbDigi ( const edm::Event event,
std::vector< uint16_t >  adc[nEbEta][nEbPhi] 
) const
private

Retrieves barrel digis (APD ADC count).

Parameters
eventCMS event
adc[out] the adc counts: adc[iEta0][iPhi0][iTimeSample0]

Definition at line 478 of file EcalSimRawData.cc.

References ecalMGPA::adc(), edm::DataFrameContainer::begin(), gather_cfg::cout, TauDecayModes::dec, edm::DataFrameContainer::empty(), edm::DataFrameContainer::end(), Exception, EBDataFrame::id(), edm::HandleBase::isValid(), hgc_digi::nSamples, EcalMGPASample::raw(), simplePhotonAnalyzer_cfi::sample, EcalDataFrame::sample(), and EcalDataFrame::size().

Referenced by iTtPhi2cIndex().

478  {
480  event.getByLabel(digiProducer_, ebDigiCollection_, hEbDigis);
481 
482  int nSamples = 0;
483  if (hEbDigis.isValid() && !hEbDigis->empty()) { // there is at least one digi
484  nSamples = hEbDigis->begin()->size(); // gets the sample count from 1st digi
485  }
486 
487  const uint16_t suppressed = 0xFFFF;
488 
489  adc[0][0] = vector<uint16_t>(nSamples, suppressed);
490 
491  for (int iEbEta = 0; iEbEta < nEbEta; ++iEbEta) {
492  for (int iEbPhi = 0; iEbPhi < nEbPhi; ++iEbPhi) {
493  adc[iEbEta][iEbPhi] = adc[0][0];
494  }
495  }
496  if (hEbDigis.isValid()) {
497  if (xtalVerbose_)
498  cout << setfill('0');
499  for (EBDigiCollection::const_iterator it = hEbDigis->begin(); it != hEbDigis->end(); ++it) {
500  const EBDataFrame &frame = *it;
501 
502  int iEta0 = iEta2cIndex((frame.id()).ieta());
503  int iPhi0 = iPhi2cIndex((frame.id()).iphi());
504 
505  // cout << "xtl indices conv: (" << frame.id().ieta() << ","
506  // << frame.id().iphi() << ") -> ("
507  // << iEta0 << "," << iPhi0 << ")\n";
508 
509  if (iEta0 < 0 || iEta0 >= nEbEta) {
510  cout << "iEta0 (= " << iEta0 << ") is out of range ("
511  << "[0," << nEbEta - 1 << "])\n";
512  }
513  if (iPhi0 < 0 || iPhi0 >= nEbPhi) {
514  cout << "iPhi0 (= " << iPhi0 << ") is out of range ("
515  << "[0," << nEbPhi - 1 << "])\n";
516  }
517 
518  if (xtalVerbose_) {
519  cout << iEta0 << "\t" << iPhi0 << ":\t";
520  cout << hex;
521  }
522 
523  if (nSamples != frame.size()) {
524  throw cms::Exception("EcalSimRawData",
525  "Found EB digis with different sample count! This "
526  "is not supported by EcalSimRawData.");
527  }
528 
529  for (int iSample = 0; iSample < nSamples; ++iSample) {
530  const EcalMGPASample &sample = frame.sample(iSample);
531  uint16_t encodedAdc = sample.raw();
532  adc[iEta0][iPhi0][iSample] = encodedAdc;
533  if (xtalVerbose_) {
534  cout << (iSample > 0 ? " " : "") << "0x" << setw(4) << encodedAdc;
535  }
536  }
537  if (xtalVerbose_)
538  cout << "\n" << dec;
539  }
540  if (xtalVerbose_)
541  cout << setfill(' ');
542  }
543 }
key_type id() const
Definition: EBDataFrame.h:31
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
int iPhi2cIndex(int iPhi) const
static const int nEbEta
static const int nEbPhi
EcalMGPASample sample(int i) const
Definition: EcalDataFrame.h:29
std::string digiProducer_
const_iterator begin() const
uint16_t raw() const
get the raw word
int size() const
Definition: EcalDataFrame.h:26
int iEta2cIndex(int iEta) const
std::string ebDigiCollection_
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
bool isValid() const
Definition: HandleBase.h:74
constexpr size_t nSamples
const_iterator end() const
string EcalSimRawData::getExt ( ) const
private

Help function to get the file extension which depends on the output formats.

Definition at line 156 of file EcalSimRawData.cc.

Referenced by iTtPhi2cIndex().

156  {
157  switch (writeMode_) {
158  case littleEndian:
159  return ".le";
160  case bigEndian:
161  return ".be";
162  case ascii:
163  return ".txt";
164  default:
165  return ".?";
166  }
167 }
writeMode_t writeMode_
void EcalSimRawData::getSrfs ( const edm::Event event,
int  ebSrf[nTtEta][nTtPhi],
int  eeSrf[nEndcaps][nScX][nScY] 
) const
private

Computes the selective readout flags.

Parameters
[in]eventCMS event
[out]ebSrfthe computed SR flags for barrel
[out]eeSrfthe computed SR flags for endcaps

Definition at line 428 of file EcalSimRawData.cc.

References edm::SortedCollection< T, SORT >::begin(), edm::SortedCollection< T, SORT >::end(), RemoveAddSevLevel::flag, mps_fire::i, EBSrFlag::id(), EESrFlag::id(), EcalTrigTowerDetId::ieta(), EcalTrigTowerDetId::iphi(), edm::HandleBase::isValid(), EcalScDetId::ix(), EcalScDetId::iy(), nEndcaps, EcalSrFlag::value(), and EcalScDetId::zside().

Referenced by iTtPhi2cIndex().

430  {
431  // EE
433  event.getByLabel(srDigiProducer_, eeSrFlagCollection_, hEeSrFlags);
434  for (size_t i = 0; i < (nEndcaps * nScX * nScY); ((int *)eeSrf)[i++] = -1) {
435  };
436  if (hEeSrFlags.isValid()) {
437  for (EESrFlagCollection::const_iterator it = hEeSrFlags->begin(); it != hEeSrFlags->end(); ++it) {
438  const EESrFlag &flag = *it;
439  int iZ0 = flag.id().zside() > 0 ? 1 : 0;
440  int iX0 = flag.id().ix() - 1;
441  int iY0 = flag.id().iy() - 1;
442  assert(iZ0 >= 0 && iZ0 < nEndcaps);
443  assert(iX0 >= 0 && iX0 < nScX);
444  assert(iY0 >= 0 && iY0 < nScY);
445  eeSrf[iZ0][iX0][iY0] = flag.value();
446  }
447  } else {
448  LogWarning("EcalSimRawData") << "EE SR flag not found ("
449  << "Product label: " << srDigiProducer_ << "Producet instance: " << eeSrFlagCollection_
450  << ")";
451  }
452 
453  // EB
455  event.getByLabel(srDigiProducer_, ebSrFlagCollection_, hEbSrFlags);
456  for (size_t i = 0; i < (nTtEta * nTtPhi); ((int *)ebSrf)[i++] = -1) {
457  };
458  if (hEbSrFlags.isValid()) {
459  for (EBSrFlagCollection::const_iterator it = hEbSrFlags->begin(); it != hEbSrFlags->end(); ++it) {
460  const EBSrFlag &flag = *it;
461  int iEta = flag.id().ieta();
462  int iEta0 = iEta + nTtEta / 2 - (iEta >= 0 ? 1 : 0); // 0->55 from eta=-3 to eta=3
463  int iEbEta0 = iEta0 - nEeTtEta; // 0->33 from eta=-1.48 to eta=1.48
464  int iPhi0 = flag.id().iphi() - 1;
465 
466  assert(iEbEta0 >= 0 && iEbEta0 < nEbTtEta);
467  assert(iPhi0 >= 0 && iPhi0 < nTtPhi);
468 
469  ebSrf[iEbEta0][iPhi0] = flag.value();
470  }
471  } else {
472  LogWarning("EcalSimRawData") << "EB SR flag not found ("
473  << "Product label: " << srDigiProducer_ << "Producet instance: " << ebSrFlagCollection_
474  << ")";
475  }
476 }
std::string srDigiProducer_
static const int nTtPhi
static const int nEeTtEta
int value() const
Definition: EcalSrFlag.h:44
static const int nScX
std::vector< T >::const_iterator const_iterator
std::string eeSrFlagCollection_
static const int nEndcaps
int ieta() const
get the tower ieta
int ix() const
Definition: EcalScDetId.h:70
std::string ebSrFlagCollection_
static const int nEbTtEta
static const int nScY
bool isValid() const
Definition: HandleBase.h:74
int iy() const
Definition: EcalScDetId.h:76
const_iterator end() const
const EcalTrigTowerDetId & id() const override
Definition: EBSrFlag.h:36
int iphi() const
get the tower iphi
int zside() const
Definition: EcalScDetId.h:64
static const int nTtEta
const EcalScDetId & id() const override
Definition: EESrFlag.h:37
const_iterator begin() const
void EcalSimRawData::getTp ( const edm::Event event,
const std::string &  collName,
int  tp[nTtEta][nTtPhi] 
) const
private

Extracts the trigger primitive (TP). The collection name parameter permits to select either the TCP Fenix output or the TCC output. Note: TCP output is only valid for the barrel.

Parameters
eventCMS event
collNamelabel of the EDM collection containing the TP.
tp[out] the trigger primitives

Definition at line 545 of file EcalSimRawData.cc.

References edm::SortedCollection< T, SORT >::begin(), gather_cfg::cout, edm::SortedCollection< T, SORT >::empty(), edm::SortedCollection< T, SORT >::end(), EcalTriggerPrimitiveDigi::id(), EcalTrigTowerDetId::ieta(), EcalTrigTowerDetId::iphi(), edm::HandleBase::isValid(), edm::Handle< T >::product(), and EcalTriggerPrimitiveDigi::sampleOfInterest().

Referenced by iTtPhi2cIndex().

545  {
547  event.getByLabel(tpProducer_, collName, hTpDigis);
548  if (hTpDigis.isValid() && !hTpDigis->empty()) {
549  const EcalTrigPrimDigiCollection &tpDigis = *hTpDigis.product();
550 
551  // EcalSelectiveReadout::ttFlag_t ttf[nTtEta][nTtPhi];
552  for (int iTtEta0 = 0; iTtEta0 < nTtEta; ++iTtEta0) {
553  for (int iTtPhi0 = 0; iTtPhi0 < nTtPhi; ++iTtPhi0) {
554  tcp[iTtEta0][iTtPhi0] = tccInDefaultVal_;
555  }
556  }
557  if (tpVerbose_) {
558  cout << setfill('0');
559  }
560  for (EcalTrigPrimDigiCollection::const_iterator it = tpDigis.begin(); it != tpDigis.end(); ++it) {
561  const EcalTriggerPrimitiveDigi &tp = *it;
562  int iTtEta0 = iTtEta2cIndex(tp.id().ieta());
563  int iTtPhi0 = iTtPhi2cIndex(tp.id().iphi());
564  if (iTtEta0 < 0 || iTtEta0 >= nTtEta) {
565  cout << "iTtEta0 (= " << iTtEta0 << ") is out of range ("
566  << "[0," << nEbTtEta - 1 << "])\n";
567  }
568  if (iTtPhi0 < 0 || iTtPhi0 >= nTtPhi) {
569  cout << "iTtPhi0 (= " << iTtPhi0 << ") is out of range ("
570  << "[0," << nTtPhi - 1 << "])\n";
571  }
572 
573  tcp[iTtEta0][iTtPhi0] = tp[tp.sampleOfInterest()].raw();
574 
575  if (tpVerbose_) {
576  if (tcp[iTtEta0][iTtPhi0] != 0) // print non-zero values only
577  cout << collName << (collName.empty() ? "" : " ") << "TP(" << setw(2) << iTtEta0 << "," << iTtPhi0 << ") = "
578  << "0x" << setw(4) << tcp[iTtEta0][iTtPhi0] << "\tcmssw indices: " << tp.id().ieta() << " "
579  << tp.id().iphi() << "\n";
580  }
581  } // next TP
582  if (tpVerbose_)
583  cout << setfill(' ');
584  }
585 }
static const int nTtPhi
std::vector< T >::const_iterator const_iterator
int ieta() const
get the tower ieta
static const int nEbTtEta
bool isValid() const
Definition: HandleBase.h:74
const_iterator end() const
int iphi() const
get the tower iphi
const EcalTrigTowerDetId & id() const
T const * product() const
Definition: Handle.h:74
static const int nTtEta
std::string tpProducer_
int sampleOfInterest() const
Gets the interesting sample.
int iTtPhi2cIndex(int iTtPhi) const
int iTtEta2cIndex(int iTtEta) const
const_iterator begin() const
int EcalSimRawData::iEta2cIndex ( int  iEta) const
inlineprivate

Converts std CMSSW crystal eta index into a c-index (contiguous integer starting from 0 and increasing with pseudo-rapidity).

Parameters
iEtastd CMSSW crystal eta index
Returns
the c-array index

Definition at line 209 of file EcalSimRawData.h.

209 { return (iEta < 0) ? iEta + 85 : iEta + 84; }
int EcalSimRawData::iPhi2cIndex ( int  iPhi) const
inlineprivate

Converts std CMSSW crystal phi index into a c-index (contiguous integer starting from 0 at phi=0deg and increasing with phi).

Parameters
iPhistd CMSSW crystal phi index
Returns
the c-array index

Definition at line 216 of file EcalSimRawData.h.

References nEbPhi.

216  {
217  int iPhi0 = iPhi - 11;
218  if (iPhi0 < 0)
219  iPhi0 += nEbPhi;
220  return iPhi0;
221  }
static const int nEbPhi
int EcalSimRawData::iTtEta2cIndex ( int  iTtEta) const
inlineprivate

Converts std CMSSW ECAL trigger tower eta index into a c-index (contiguous integer starting from 0 and increasing with pseudo-rapidity).

Parameters
iEtastd CMSSW trigger tower eta index
Returns
the c-array index

Definition at line 229 of file EcalSimRawData.h.

229 { return (iTtEta < 0) ? (iTtEta + 28) : (iTtEta + 27); }
int EcalSimRawData::iTtPhi2cIndex ( int  iTtPhi) const
inlineprivate

Converts std CMSSW ECAL trigger tower phi index into a c-index (contiguous integer starting from 0 at phi=0deg and increasing with phi).

Parameters
iPhistd CMSSW ECAL trigger tower phi index
Returns
the c-array index

Definition at line 248 of file EcalSimRawData.h.

References a, ecalMGPA::adc(), estimatePileup::basename, data, elec2GeomNum(), f, fwrite(), genFeData(), genSrData(), genTccIn(), genTccOut(), getEbDigi(), getExt(), getSrfs(), getTp(), setHParity(), and AlCaHLTBitMon_QueryRunRegistry::string.

248 { return iTtPhi - 1; }
void EcalSimRawData::setHParity ( uint16_t &  a) const
private

Definition at line 417 of file EcalSimRawData.cc.

References AlCaHLTBitMon_ParallelJobs::p.

Referenced by iTtPhi2cIndex().

417  {
418  const int odd = 1 << 15;
419  const int even = 0;
420  // parity bit of numbers from 0x0 to 0xF:
421  // 0 1 2 3 4 5 6 7 8 9 A B C
422  // D E F
423  const int p[16] = {even, odd, odd, even, odd, even, even, odd, odd, even, even, odd, even, odd, odd, even};
424  // inverts parity bit (LSB) of 'a' in case of even parity:
425  a ^= p[a & 0xF] ^ p[(a >> 4) & 0xF] ^ p[(a >> 8) & 0xF] ^ p[a >> 12 & 0xF] ^ odd;
426 }
double a
Definition: hdecay.h:121

Member Data Documentation

std::string EcalSimRawData::basename_
private

basename for output files

Definition at line 442 of file EcalSimRawData.h.

int EcalSimRawData::dccNum_
private

Index of the DCC, FE data must be produced for. -1 for all TTCs

Definition at line 434 of file EcalSimRawData.h.

std::string EcalSimRawData::digiProducer_
private

Name of module/plugin/producer making digis

Definition at line 346 of file EcalSimRawData.h.

const int EcalSimRawData::ebDccPhiEdge = 20
staticprivate

Number of barrel crystals along phi covered by a DCC

Definition at line 143 of file EcalSimRawData.h.

std::string EcalSimRawData::ebDigiCollection_
private

EB digi product instance name

Definition at line 350 of file EcalSimRawData.h.

std::string EcalSimRawData::ebSrFlagCollection_
private

EB SRP flag digi product instance name

Definition at line 362 of file EcalSimRawData.h.

const int EcalSimRawData::ebTccPhiEdge = 20
staticprivate

number of TTs along phi of a TCC sector

Definition at line 131 of file EcalSimRawData.h.

std::string EcalSimRawData::eeDigiCollection_
private

EE digi product instance name

Definition at line 354 of file EcalSimRawData.h.

std::string EcalSimRawData::eeSrFlagCollection_
private

EE SRP flag digi product instancename

Definition at line 366 of file EcalSimRawData.h.

std::unique_ptr<EcalSelectiveReadout> EcalSimRawData::esr_
private

Selective readout simulator

Definition at line 418 of file EcalSimRawData.h.

bool EcalSimRawData::fe2dcc_
private

Switch for data of FE->DCC link

Definition at line 406 of file EcalSimRawData.h.

bool EcalSimRawData::fe2tcc_
private

Switch for data of FE->TCC link

Definition at line 410 of file EcalSimRawData.h.

int EcalSimRawData::iEvent
private

Definition at line 59 of file EcalSimRawData.h.

const int EcalSimRawData::nDccEndcap = 9
staticprivate

Number of DCCs for a single endcap

Definition at line 127 of file EcalSimRawData.h.

const int EcalSimRawData::nDccInPhi = 18
staticprivate

Number of barrel DCCs along Phi

Definition at line 123 of file EcalSimRawData.h.

const int EcalSimRawData::nEbEta = 170
staticprivate

Number of crystals in ECAL barrel along eta

Definition at line 63 of file EcalSimRawData.h.

const int EcalSimRawData::nEbPhi = 360
staticprivate

Number of crystals in ECAL barrel along phi

Definition at line 67 of file EcalSimRawData.h.

Referenced by iPhi2cIndex().

const int EcalSimRawData::nEbTtEta = nEbEta / ttEdge
staticprivate

Number of TTs along Ecal barrel eta

Definition at line 111 of file EcalSimRawData.h.

const int EcalSimRawData::nEeTtEta = 11
staticprivate

Number of TTs along eta for one endcap.

Definition at line 115 of file EcalSimRawData.h.

const int EcalSimRawData::nEeX = 100
staticprivate

X-edge of endcap (x,y)- crystal grid

Definition at line 71 of file EcalSimRawData.h.

const int EcalSimRawData::nEeY = 100
staticprivate

Y-edge of endcap (x,y)- crystal grid

Definition at line 75 of file EcalSimRawData.h.

const int EcalSimRawData::nEndcaps = 2
staticprivate

Number of endcaps

Definition at line 79 of file EcalSimRawData.h.

const int EcalSimRawData::nScX = 20
staticprivate

Maximum number of supercrystal along x axis

Definition at line 87 of file EcalSimRawData.h.

const int EcalSimRawData::nScY = 20
staticprivate

Maximum number of supercrystal along y axis

Definition at line 91 of file EcalSimRawData.h.

const int EcalSimRawData::nTccEndcap = 36
staticprivate

Number of TCCs for a single endcap

Definition at line 139 of file EcalSimRawData.h.

const int EcalSimRawData::nTccInPhi = 18
staticprivate

Number of Barrel TTCs along phi

Definition at line 135 of file EcalSimRawData.h.

const int EcalSimRawData::nTtEta = nEbTtEta + 2 * nEeTtEta
staticprivate

Number of TTs along ECAL eta

Definition at line 119 of file EcalSimRawData.h.

const int EcalSimRawData::nTtPhi = nEbPhi / ttEdge
staticprivate

Number of TTs along Ecal Phi

Definition at line 107 of file EcalSimRawData.h.

const int EcalSimRawData::nTtPhisPerEbDcc = 4
staticprivate

Number of trigger towers alng phi covered by a DCC

Definition at line 147 of file EcalSimRawData.h.

const int EcalSimRawData::nTtPhisPerEbTcc = 4
staticprivate

Number of trigger towers alng phi covered by a TCC

Definition at line 151 of file EcalSimRawData.h.

const int EcalSimRawData::nTtSmEta = 17
staticprivate

Number of TTs along SM eta

Definition at line 103 of file EcalSimRawData.h.

const int EcalSimRawData::nTtSmPhi = 4
staticprivate

Number of TTs along SM phi

Definition at line 99 of file EcalSimRawData.h.

const int EcalSimRawData::nTtTypes = 2
staticprivate

Number of barrel trigger tower types (in term of VFE card orientation)

Definition at line 155 of file EcalSimRawData.h.

const int EcalSimRawData::scEdge = 5
staticprivate

Supercrystal edge in number of crystals

Definition at line 83 of file EcalSimRawData.h.

std::string EcalSimRawData::srDigiProducer_
private

Label of SR flags and suppressed digis

Definition at line 358 of file EcalSimRawData.h.

std::ofstream EcalSimRawData::srfFile
private

Output file for selective readout flags

Definition at line 426 of file EcalSimRawData.h.

bool EcalSimRawData::srp2dcc_
private

Switch for data of SRP->DCC link

Definition at line 398 of file EcalSimRawData.h.

const int EcalSimRawData::strip2Eta
staticprivate
Initial value:
= {
{4, 3, 2, 1, 0},
{0, 1, 2, 3, 4}
}

Maps strip_id to eta index within a TT. strip2Eta[iTtType][strip_id-1] will be the eta index of channels with strip_id 'strip_id'. The eta index runs from 0 to 4 and increasing with the eta of the std CMS coordinates.

Definition at line 176 of file EcalSimRawData.h.

const int EcalSimRawData::stripCh2Phi
staticprivate
Initial value:
= {
{{4, 3, 2, 1, 0},
{0, 1, 2, 3, 4},
{4, 3, 2, 1, 0},
{0, 1, 2, 3, 4},
{4, 3, 2, 1, 0}},
{{0, 1, 2, 3, 4}, {4, 3, 2, 1, 0}, {0, 1, 2, 3, 4}, {4, 3, 2, 1, 0}, {0, 1, 2, 3, 4}}}

Maps (strip_id, channel_id) to phi index within a TT. stripCh2Phi[iTtType][strip_id-1][ch_id-1] will be the phi index of the TT of type iTtType with strip ID 'strip_id' and channel VFE id 'ch_id'. The phi runs from 0 to 4 and increases with the phi of std CMS coordinates.

Definition at line 169 of file EcalSimRawData.h.

bool EcalSimRawData::tcc2dcc_
private

Switch for data of TCC->DCC link

Definition at line 402 of file EcalSimRawData.h.

int EcalSimRawData::tccInDefaultVal_
private

default TriggerPrimitive values if the trigger tower is abscent

Definition at line 438 of file EcalSimRawData.h.

int EcalSimRawData::tccNum_
private

Index of the TCC, FE data must be produced for. -1 for all TTCs

Definition at line 430 of file EcalSimRawData.h.

std::string EcalSimRawData::tcpDigiCollection_
private

TCP Fenix output digi product instance name

Definition at line 374 of file EcalSimRawData.h.

const CaloGeometry* EcalSimRawData::theGeometry
private

Calorimeter geometry

Definition at line 378 of file EcalSimRawData.h.

const EcalTrigTowerConstituentsMap* EcalSimRawData::theTriggerTowerMap
private

ECAL endcap trigger tower map

Definition at line 414 of file EcalSimRawData.h.

std::string EcalSimRawData::tpDigiCollection_
private

Trigger primitive digi product instance name

Definition at line 370 of file EcalSimRawData.h.

std::string EcalSimRawData::tpProducer_
private

Name of the trigger primitive label

Definition at line 382 of file EcalSimRawData.h.

bool EcalSimRawData::tpVerbose_
private

Verbosity switch for crystal data

Definition at line 394 of file EcalSimRawData.h.

const int EcalSimRawData::ttEdge = 5
staticprivate

Definition at line 95 of file EcalSimRawData.h.

std::ofstream EcalSimRawData::ttfFile
private

Output file for trigger tower flags

Definition at line 422 of file EcalSimRawData.h.

const int EcalSimRawData::ttType
staticprivate
Initial value:
= {
0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1,
0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1
}

Map of trigger tower types (in term of VFE card orientation). ttType[iTtEta0]: trigger tower type of TTs with eta 'c-arrary' index iTtEta0

Definition at line 161 of file EcalSimRawData.h.

writeMode_t EcalSimRawData::writeMode_
private

output format

Definition at line 386 of file EcalSimRawData.h.

bool EcalSimRawData::xtalVerbose_
private

Verbosity switch for crystal data

Definition at line 390 of file EcalSimRawData.h.