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

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
 EcalSimRawData (const edm::ParameterSet &pset)
 
virtual ~EcalSimRawData ()
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
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::auto_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 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 41 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 47 of file EcalSimRawData.cc.

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

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

Destructor

Definition at line 50 of file EcalSimRawData.h.

References analyze().

50 {};

Member Function Documentation

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

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

Definition at line 84 of file EcalSimRawData.cc.

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

Referenced by ~EcalSimRawData().

85  {
86  //Event counter:
87  ++iEvent;
88 
90  cout << "======================================================================\n"
91  << " Event " << iEvent << "\n"
92  << "----------------------------------------------------------------------\n";
93  }
94 
95  if(fe2dcc_){
96  vector<uint16_t> adc[nEbEta][nEbPhi];
97  getEbDigi(event, adc);
98  genFeData(basename_, iEvent, adc);
99  }
100 
101  if(fe2tcc_){
102  int tcp[nTtEta][nTtPhi]={{0}};
103  getTp(event, tcpDigiCollection_, tcp);
104  genTccIn(basename_, iEvent, tcp);
105  }
106 
107  if(tcc2dcc_){
108  int tp[nTtEta][nTtPhi]={{0}};
109  getTp(event, tpDigiCollection_, tp);
110  genTccOut(basename_, iEvent, tp);
111  }
112 
113  //SR flags:
114  int ebSrf[nTtEta][nTtPhi];
115  int eeSrf[nEndcaps][nScX][nScY];
116 
117  if(srp2dcc_){
118  getSrfs(event, ebSrf, eeSrf);
119  genSrData(basename_, iEvent, ebSrf);
120  }
121 
122 }
int adc(sample_type sample)
get the ADC sample (12 bits)
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
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 240 of file EcalSimRawData.h.

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

Converse of iTtPhi2cIndex

Parameters
iTtPhi0phi index of TT
Returns
std CMSS TT index

Definition at line 248 of file EcalSimRawData.h.

248  {
249  return iTtPhi0+1;
250  }
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 124 of file EcalSimRawData.cc.

Referenced by iTtPhi2cIndex().

125  {
126  assert(0<=ittEta0 && ittEta0<nEbTtEta);
127  assert(0<=ittPhi0 && ittPhi0<nTtPhi);
128  assert(1<=strip1&& strip1<=ttEdge);
129  assert(1<=ch1 && ch1<=ttEdge);
130  const int type = ttType[ittEta0];
131  iEta0 = ittEta0*ttEdge + strip2Eta[type][strip1-1];
132  iPhi0 = ittPhi0*ttEdge + stripCh2Phi[type][strip1-1][ch1-1];
133  assert(0<=iEta0 && iEta0<nEbEta);
134  assert(0<=iPhi0 && iPhi0<nEbPhi);
135 }
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 137 of file EcalSimRawData.cc.

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

Referenced by iTtPhi2cIndex().

138  {
139 
140  if(hpar){
141  //set horizontal odd parity bit:
142  setHParity(data);
143  }
144 
145  switch(writeMode_){
146  case littleEndian:
147  {
148  char c = data & 0x00FF;
149  f.write(&c, sizeof(c));
150  c = (data >>8) & 0x00FF;
151  f.write(&c, sizeof(c));
152  }
153  break;
154  case bigEndian:
155  {
156  char c = (data >>8) & 0x00FF;
157  f.write(&c, sizeof(c));
158  c = data & 0x00FF;
159  f.write(&c, sizeof(c));
160  }
161  break;
162  case ascii:
163  f << ((iWord%8==0&&iWord!=0)?"\n":"")
164  << "0x" << setfill('0') << setw(4) << hex << data << "\t"
165  << dec << setfill(' ');
166  break;
167  }
168  ++iWord;
169 }
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 184 of file EcalSimRawData.cc.

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

Referenced by iTtPhi2cIndex().

186  {
187  int smf = 0;
188  int gmf = 0;
189  int nPendingEvt = 0;
190  int monitorFlag = 0;
191  int chFrameLen = adcCount[0][0].size() + 1;
192 
193  int iWord = 0;
194 
195  for(int iZ0 = 0; iZ0<2; ++iZ0){
196  for(int iDccPhi0 = 0; iDccPhi0<nDccInPhi; ++iDccPhi0){
197  int iDcc1 = iDccPhi0 + iZ0*nDccInPhi + nDccEndcap + 1;
198 
199  if(dccNum_!=-1 && dccNum_!=iDcc1) continue;
200 
201  stringstream s;
202  s.str("");
203  const string& ext = getExt();
204  s << basename << "_fe2dcc" << setfill('0') << setw(2) << iDcc1
205  << setfill(' ') << ext;
206  ofstream f(s.str().c_str(), (iEvent==1?ios::ate:ios::app));
207 
208  if(f.fail()) return;
209 
210 
211  if(writeMode_==ascii){
212  f << (iEvent==1?"":"\n") << "[Event:" << iEvent << "]\n";
213  }
214 
215  for(int iTtEtaInSm0 = 0; iTtEtaInSm0 < nTtSmEta; ++iTtEtaInSm0){
216  int iTtEta0 = iZ0*nTtSmEta + iTtEtaInSm0;
217  for(int iTtPhiInSm0 = 0; iTtPhiInSm0 < nTtSmPhi; ++iTtPhiInSm0){
218  //phi=0deg at middle of 1st barrel DCC:
219  int iTtPhi0 = -nTtPhisPerEbDcc/2 + iDccPhi0*nTtPhisPerEbDcc
220  + iTtPhiInSm0;
221  if(iTtPhi0<0) iTtPhi0 += nTtPhi;
222  for(int stripId1 = 1; stripId1 <= ttEdge; ++stripId1){
223  uint16_t stripHeader =
224  0xF << 11
225  | (nPendingEvt & 0x3F) << 5
226  | (gmf & 0x1) << 4
227  | (smf & 0x1) << 3
228  | (stripId1 & 0x7);
230  fwrite(f,stripHeader, iWord);
231 
232  for(int xtalId1 = 1; xtalId1 <= ttEdge; ++xtalId1){
233 
234  uint16_t crystalHeader =
235  1 <<14
236  | (chFrameLen & 0xFF) <<4
237  | (monitorFlag & 0x1) <<3
238  | (xtalId1 & 0x7);
239  // crystalHeader |=parity(crystalHeader) << 15;
240  fwrite(f, crystalHeader, iWord);
241 
242  int iEta0;
243  int iPhi0;
244  elec2GeomNum(iTtEta0, iTtPhi0, stripId1, xtalId1,
245  iEta0, iPhi0);
246  if(xtalVerbose_){
247  cout << dec
248  << "iDcc1 = " << iDcc1 << "\t"
249  << "iEbTtEta0 = " << iTtEta0 << "\t"
250  << "iEbTtPhi0 = " << iTtPhi0 << "\t"
251  << "stripId1 = " << stripId1 << "\t"
252  << "xtalId1 = " << xtalId1 << "\t"
253  << "iEta0 = " << iEta0 << "\t"
254  << "iPhi0 = " << iPhi0 << "\t"
255  << "adc[5] = 0x" << hex << adcCount[iEta0][iPhi0][5]
256  << dec << "\n";
257  }
258 
259 
260  const vector<uint16_t>& adc = adcCount[iEta0][iPhi0];
261  for(unsigned iSample=0; iSample < adc.size(); ++iSample){
262  uint16_t data = adc[iSample] & 0x3FFF;
263  // data |= parity(data);
264  fwrite(f, data, iWord);
265  } //next time sample
266  } //next crystal in strip
267  } //next strip in TT
268  } //next TT along phi
269  } //next TT along eta
270  } //next DCC
271  } //next half-barrel
272 }
int adc(sample_type sample)
get the ADC sample (12 bits)
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]
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 274 of file EcalSimRawData.cc.

References data, f, and alignCSCRings::s.

Referenced by iTtPhi2cIndex().

275  {
276  for(int iZ0 = 0; iZ0<2; ++iZ0){
277  for(int iDccPhi0 = 0; iDccPhi0<nDccInPhi; ++iDccPhi0){
278  int iDcc1 = iDccPhi0 + iZ0*nDccInPhi + nDccEndcap + 1;
279  if(dccNum_!=-1 && dccNum_!=iDcc1) continue;
280  stringstream s;
281  s.str("");
282  s << basename << "_ab2dcc" << setfill('0') << setw(2) << iDcc1
283  << setfill(' ') << getExt();
284  ofstream f(s.str().c_str(), (iEvent==1?ios::ate:ios::app));
285 
286  if(f.fail()) throw cms::Exception(string("Cannot create/open file ")
287  + s.str() + ".");
288 
289  int iWord = 0;
290 
291  if(writeMode_==ascii){
292  f << (iEvent==1?"":"\n")<< "[Event:" << iEvent << "]\n";
293  }
294 
295  const uint16_t le1 = 0;
296  const uint16_t le0 = 0;
297  const uint16_t h1 = 1;
298  const uint16_t nFlags = 68;
299  uint16_t data = (h1 & 0x1)<< 14
300  | (le1 & 0x1) << 12
301  | (le0 & 0x1) << 11
302  | (nFlags & 0x7F);
303 
304  fwrite(f, data, iWord, true);
305 
306  int iFlag = 0;
307  data = 0;
308 
309  for(int iTtEtaInSm0 = 0; iTtEtaInSm0 < nTtSmEta; ++iTtEtaInSm0){
310  // int iTtEbEta0 = iZ0*nTtSmEta + iTtEtaInSm0;
311  int iTtEta0 = nEeTtEta + iZ0*nTtSmEta + iTtEtaInSm0;
312  for(int iTtPhiInSm0 = 0; iTtPhiInSm0 < nTtSmPhi; ++iTtPhiInSm0){
313  //phi=0deg at middle of 1st barrel DCC:
314  int iTtPhi0 = -nTtPhisPerEbDcc/2 + iDccPhi0*nTtPhisPerEbDcc
315  + iTtPhiInSm0;
316  if(iTtPhi0<0) iTtPhi0 += nTtPhi;
317  //flags are packed by four:
318  //|15 |14 |13-12 |11 9|8 6|5 3|2 0|
319  //| P | 0 | X X | srf i+3| srf i+2| srf i+1| srf i |
320  //| | | | field 3 |field 2 | field 1| field 0|
321  const int field = iFlag%4;
322  //cout << "TtEta0: " << iTtEta0 << "\tTtPhi0: " << iTtPhi0 << "\n";
323  //cout << "#" << oct << (int)srf[iTtEta0][iTtPhi0] << "o ****> #" << oct << (srf[iTtEta0][iTtPhi0] << (field*3)) << "o\n" << dec;
324 
325  data |= srf[iTtEta0][iTtPhi0] << (field*3);
326 
327  if(field==3){
328  //cout << srf[iTtEta0][iTtPhi0] << "----> 0x" << hex << data << "\n";
329  fwrite(f, data, iWord, true);
330  data = 0;
331  }
332  ++iFlag;
333  } //next TT along phi
334  } //next TT along eta
335  } //next DCC
336  } //next half-barrel
337 }
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 340 of file EcalSimRawData.cc.

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

Referenced by iTtPhi2cIndex().

341  {
342  for(int iZ0 = 0; iZ0<2; ++iZ0){
343  for(int iTccPhi0 = 0; iTccPhi0<nTccInPhi; ++iTccPhi0){
344  int iTcc1 = iTccPhi0 + iZ0*nTccInPhi + nTccEndcap + 1;
345 
346  if(tccNum_!=-1 && tccNum_!=iTcc1) continue;
347 
348  stringstream s;
349  s.str("");
350  const char* ext = ".txt"; //only ascii mode supported for TCP
351 
352  s << basename << "_tcc" << setfill('0') << setw(2) << iTcc1
353  << setfill(' ') << ext;
354  ofstream fe2tcc(s.str().c_str(), (iEvent==1?ios::ate:ios::app));
355 
356  if(fe2tcc.fail()) throw cms::Exception(string("Failed to create file ")
357  + s.str() + ".");
358 
359  int memPos = iEvent-1;
360  int iCh1 = 1;
361  for(int iTtEtaInSm0 = 0; iTtEtaInSm0 < nTtSmEta; ++iTtEtaInSm0){
362  int iTtEta0 = (iZ0==0) ? 27 - iTtEtaInSm0 : 28 + iTtEtaInSm0;
363  for(int iTtPhiInSm0 = 0; iTtPhiInSm0 < nTtSmPhi; ++iTtPhiInSm0){
364  //phi=0deg at middle of 1st barrel DCC:
365  int iTtPhi0 = -nTtPhisPerEbTcc/2 + iTccPhi0*nTtPhisPerEbTcc
366  + iTtPhiInSm0;
367  iTtPhi0 += nTtPhisPerEbTcc*iTccPhi0;
368  if(iTtPhi0<0) iTtPhi0 += nTtPhi;
369  uint16_t tp_fe2tcc = (tcp[iTtEta0][iTtPhi0] & 0x7ff) ; //keep only Et (9:0) and FineGrain (10)
370 
371  if(tpVerbose_ && tp_fe2tcc!=0){
372  cout << dec
373  << "iTcc1 = " << iTcc1 << "\t"
374  << "iTtEta0 = " << iTtEta0 << "\t"
375  << "iTtPhi0 = " << iTtPhi0 << "\t"
376  << "iCh1 = " << iCh1 << "\t"
377  << "memPos = " << memPos << "\t"
378  << "tp = 0x" << setfill('0') << hex << setw(3)
379  << tp_fe2tcc
380  << dec << setfill(' ') << "\n";
381  }
382  fe2tcc << iCh1 << "\t"
383  << memPos << "\t"
384  << setfill('0') << hex
385  << "0x" << setw(4) << tp_fe2tcc << "\t"
386  << "0"
387  << dec << setfill(' ') << "\n";
388  ++iCh1;
389  } //next TT along phi
390  } //next TT along eta
391  fe2tcc << std::flush;
392  fe2tcc.close();
393  } //next TCC
394  } //next half-barrel
395 }
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 398 of file EcalSimRawData.cc.

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

Referenced by iTtPhi2cIndex().

399  {
400  int iDccWord = 0;
401 
402  for(int iZ0 = 0; iZ0<2; ++iZ0){
403  for(int iTccPhi0 = 0; iTccPhi0<nTccInPhi; ++iTccPhi0){
404  int iTcc1 = iTccPhi0 + iZ0*nTccInPhi + nTccEndcap + 1;
405 
406  if(tccNum_!=-1 && tccNum_!=iTcc1) continue;
407 
408  stringstream s;
409  s.str("");
410  const char* ext = ".txt"; //only ascii mode supported for TCP
411 
412  s << basename << "_tcc" << setfill('0') << setw(2) << iTcc1
413  << setfill(' ') << ext;
414 
415  s.str("");
416  s << basename << "_tcc2dcc" << setfill('0') << setw(2) << iTcc1
417  << setfill(' ') << getExt();
418  ofstream dccF(s.str().c_str(), (iEvent==1?ios::ate:ios::app));
419 
420  if(dccF.fail()){
421  cout << "Warning: failed to create or open file " << s.str() << ".\n";
422  return;
423  }
424 
425  const uint16_t h1 = 1;
426  const uint16_t le1 = 0;
427  const uint16_t le0 = 0;
428  const uint16_t nSamples = 1;
429  const uint16_t nTts = 68;
430  const uint16_t data = (h1 & 0x1) << 14
431  | (le1 & 0x1) << 12
432  | (le0 & 0x1) << 11
433  | (nSamples & 0xF) << 7
434  | (nTts & 0x7F);
435  dccF << (iEvent==1?"":"\n") << "[Event:" << iEvent << "]\n";
436  fwrite(dccF, data, iDccWord, false);
437 
438  int memPos = iEvent-1;
439  int iCh1 = 1;
440  for(int iTtEtaInSm0 = 0; iTtEtaInSm0 < nTtSmEta; ++iTtEtaInSm0){
441  int iTtEta0 = nEeTtEta + iZ0*nTtSmEta + iTtEtaInSm0;
442  for(int iTtPhiInSm0 = 0; iTtPhiInSm0 < nTtSmPhi; ++iTtPhiInSm0){
443  //phi=0deg at middle of 1st barrel DCC:
444  int iTtPhi0 = -nTtPhisPerEbTcc/2 + iTccPhi0*nTtPhisPerEbTcc
445  + iTtPhiInSm0;
446  if(iTtPhi0<0) iTtPhi0 += nTtPhi;
447 
448  if(tpVerbose_){
449  cout << dec
450  << "iTcc1 = " << iTcc1 << "\t"
451  << "iTtEta0 = " << iTtEta0 << "\t"
452  << "iTtPhi0 = " << iTtPhi0 << "\t"
453  << "iCh1 = " << iCh1 << "\t"
454  << "memPos = " << memPos << "\t"
455  << "tp = 0x" << hex << tps[iTtEta0][iTtPhi0]
456  << dec << "\n";
457  }
458  fwrite(dccF, tps[iTtEta0][iTtPhi0], iDccWord, false);
459  ++iCh1;
460  } //next TT along phi
461  } //next TT along eta
462  } //next TCC
463  } //next half-barrel
464 }
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 531 of file EcalSimRawData.cc.

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

Referenced by iTtPhi2cIndex().

532  {
533 
535  event.getByLabel(digiProducer_, ebDigiCollection_, hEbDigis);
536 
537  int nSamples = 0;
538  if(hEbDigis.isValid() && hEbDigis->size()>0){//there is at least one digi
539  nSamples = hEbDigis->begin()->size();//gets the sample count from 1st digi
540  }
541 
542 
543  const uint16_t suppressed = 0xFFFF;
544 
545  adc[0][0] = vector<uint16_t>(nSamples, suppressed);
546 
547  for(int iEbEta=0; iEbEta<nEbEta; ++iEbEta){
548  for(int iEbPhi=0; iEbPhi<nEbPhi; ++iEbPhi){
549  adc[iEbEta][iEbPhi] = adc[0][0];
550  }
551  }
552  if(hEbDigis.isValid()){
553  if(xtalVerbose_) cout << setfill('0');
554  for(EBDigiCollection::const_iterator it = hEbDigis->begin();
555  it != hEbDigis->end(); ++it){
556  const EBDataFrame& frame = *it;
557 
558  int iEta0 = iEta2cIndex((frame.id()).ieta());
559  int iPhi0 = iPhi2cIndex((frame.id()).iphi());
560 
561  // cout << "xtl indices conv: (" << frame.id().ieta() << ","
562  // << frame.id().iphi() << ") -> ("
563  // << iEta0 << "," << iPhi0 << ")\n";
564 
565  if(iEta0<0 || iEta0>=nEbEta){
566  cout << "iEta0 (= " << iEta0 << ") is out of range ("
567  << "[0," << nEbEta -1 << "])\n";
568  }
569  if(iPhi0<0 || iPhi0>=nEbPhi){
570  cout << "iPhi0 (= " << iPhi0 << ") is out of range ("
571  << "[0," << nEbPhi -1 << "])\n";
572  }
573 
574  if(xtalVerbose_){
575  cout << iEta0 << "\t" << iPhi0 << ":\t";
576  cout << hex;
577  }
578 
579  if(nSamples!=frame.size()){
580  throw cms::Exception("EcalSimRawData", "Found EB digis with different sample count! This is not supported by EcalSimRawData.");
581  }
582 
583  for(int iSample=0; iSample<nSamples; ++iSample){
584  const EcalMGPASample& sample = frame.sample(iSample);
585  uint16_t encodedAdc = sample.raw();
586  adc[iEta0][iPhi0][iSample] = encodedAdc;
587  if(xtalVerbose_){
588  cout << (iSample>0?" ":"") << "0x" << setw(4)
589  << encodedAdc;
590  }
591  }
592  if(xtalVerbose_) cout << "\n" << dec;
593  }
594  if(xtalVerbose_) cout << setfill(' ');
595  }
596 }
int adc(sample_type sample)
get the ADC sample (12 bits)
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_
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 171 of file EcalSimRawData.cc.

Referenced by iTtPhi2cIndex().

171  {
172  switch(writeMode_){
173  case littleEndian:
174  return ".le";
175  case bigEndian:
176  return ".be";
177  case ascii:
178  return ".txt";
179  default:
180  return".?";
181  }
182 }
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 477 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().

479  {
480 
481  //EE
483  event.getByLabel(srDigiProducer_, eeSrFlagCollection_, hEeSrFlags);
484  for(size_t i=0; i < (nEndcaps*nScX*nScY); ((int*)eeSrf)[i++] = -1){};
485  if(hEeSrFlags.isValid()){
486  for(EESrFlagCollection::const_iterator it = hEeSrFlags->begin();
487  it != hEeSrFlags->end(); ++it){
488  const EESrFlag& flag = *it;
489  int iZ0 = flag.id().zside()>0?1:0;
490  int iX0 = flag.id().ix()-1;
491  int iY0 = flag.id().iy()-1;
492  assert(iZ0>=0 && iZ0<nEndcaps);
493  assert(iX0>=0 && iX0<nScX);
494  assert(iY0>=0 && iY0<nScY);
495  eeSrf[iZ0][iX0][iY0] = flag.value();
496  }
497  } else{
498  LogWarning("EcalSimRawData") << "EE SR flag not found ("
499  << "Product label: " << srDigiProducer_
500  << "Producet instance: "
501  << eeSrFlagCollection_ << ")";
502  }
503 
504  //EB
506  event.getByLabel(srDigiProducer_, ebSrFlagCollection_, hEbSrFlags);
507  for(size_t i=0; i<(nTtEta*nTtPhi); ((int*)ebSrf)[i++] = -1){};
508  if(hEbSrFlags.isValid()){
509  for(EBSrFlagCollection::const_iterator it = hEbSrFlags->begin();
510  it != hEbSrFlags->end(); ++it){
511 
512  const EBSrFlag& flag = *it;
513  int iEta = flag.id().ieta();
514  int iEta0 = iEta + nTtEta/2 - (iEta>=0?1:0); //0->55 from eta=-3 to eta=3
515  int iEbEta0 = iEta0 - nEeTtEta;//0->33 from eta=-1.48 to eta=1.48
516  int iPhi0 = flag.id().iphi() - 1;
517 
518  assert(iEbEta0>=0 && iEbEta0<nEbTtEta);
519  assert(iPhi0>=0 && iPhi0<nTtPhi);
520 
521  ebSrf[iEbEta0][iPhi0] = flag.value();
522  }
523  } else{
524  LogWarning("EcalSimRawData") << "EB SR flag not found ("
525  << "Product label: " << srDigiProducer_
526  << "Producet instance: "
527  << ebSrFlagCollection_ << ")";
528  }
529 }
std::string srDigiProducer_
static const int nTtPhi
static const int nEeTtEta
int value() const
Definition: EcalSrFlag.h:44
static const int nScX
std::vector< EESrFlag >::const_iterator const_iterator
std::string eeSrFlagCollection_
static const int nEndcaps
int ieta() const
get the tower ieta
int ix() const
Definition: EcalScDetId.h:71
std::string ebSrFlagCollection_
static const int nEbTtEta
static const int nScY
bool isValid() const
Definition: HandleBase.h:74
int iy() const
Definition: EcalScDetId.h:77
const_iterator end() const
int iphi() const
get the tower iphi
const EcalScDetId & id() const
Definition: EESrFlag.h:37
int zside() const
Definition: EcalScDetId.h:65
const EcalTrigTowerDetId & id() const
Definition: EBSrFlag.h:36
static const int nTtEta
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 599 of file EcalSimRawData.cc.

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

Referenced by iTtPhi2cIndex().

601  {
603  event.getByLabel(tpProducer_, collName, hTpDigis);
604  if(hTpDigis.isValid() && hTpDigis->size()>0){
605  const EcalTrigPrimDigiCollection& tpDigis = *hTpDigis.product();
606 
607  // EcalSelectiveReadout::ttFlag_t ttf[nTtEta][nTtPhi];
608  for(int iTtEta0=0; iTtEta0 < nTtEta; ++iTtEta0){
609  for(int iTtPhi0=0; iTtPhi0 < nTtPhi; ++iTtPhi0){
610  tcp[iTtEta0][iTtPhi0] = tccInDefaultVal_ ;
611  }
612  }
613  if(tpVerbose_){
614  cout << setfill('0');
615  }
617  it != tpDigis.end(); ++it){
618  const EcalTriggerPrimitiveDigi& tp = *it;
619  int iTtEta0 = iTtEta2cIndex(tp.id().ieta());
620  int iTtPhi0 = iTtPhi2cIndex(tp.id().iphi());
621  if(iTtEta0<0 || iTtEta0>=nTtEta){
622  cout << "iTtEta0 (= " << iTtEta0 << ") is out of range ("
623  << "[0," << nEbTtEta -1 << "])\n";
624  }
625  if(iTtPhi0<0 || iTtPhi0>=nTtPhi){
626  cout << "iTtPhi0 (= " << iTtPhi0 << ") is out of range ("
627  << "[0," << nTtPhi -1 << "])\n";
628  }
629 
630  tcp[iTtEta0][iTtPhi0] = tp[tp.sampleOfInterest()].raw();
631 
632  if(tpVerbose_){
633  if(tcp[iTtEta0][iTtPhi0]!=0) //print non-zero values only
634  cout << collName << (collName.size()==0?"":" ")
635  << "TP(" << setw(2) << iTtEta0 << "," << iTtPhi0 << ") = "
636  << "0x" << setw(4)
637  << tcp[iTtEta0][iTtPhi0]
638  << "\tcmssw indices: "
639  << tp.id().ieta() << " " << tp.id().iphi() << "\n";
640  }
641  }//next TP
642  if(tpVerbose_) cout << setfill(' ');
643  }
644 }
static const int nTtPhi
std::vector< EcalTriggerPrimitiveDigi >::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:81
static const int nTtEta
size_type size() const
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 211 of file EcalSimRawData.h.

211  {
212  return (iEta<0)?iEta+85:iEta+84;
213  }
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 220 of file EcalSimRawData.h.

References nEbPhi.

220  {
221  int iPhi0 = iPhi -11;
222  if(iPhi0<0) iPhi0+=nEbPhi;
223  return iPhi0;
224  }
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 232 of file EcalSimRawData.h.

232  {
233  return (iTtEta<0)?(iTtEta+28):(iTtEta+27);
234  }
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 257 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.

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

Definition at line 467 of file EcalSimRawData.cc.

References AlCaHLTBitMon_ParallelJobs::p.

Referenced by iTtPhi2cIndex().

467  {
468  const int odd = 1 <<15;
469  const int even = 0;
470  //parity bit of numbers from 0x0 to 0xF:
471  // 0 1 2 3 4 5 6 7 8 9 A B C D E F
472  const int p[16] = {even,odd,odd,even,odd,even,even,odd,odd,even,even,odd,even,odd,odd,even};
473  //inverts parity bit (LSB) of 'a' in case of even parity:
474  a ^= p[a&0xF] ^ p[(a>>4)&0xF] ^ p[(a>>8)&0xF] ^ p[a>>12&0xF] ^ odd;
475 }
double a
Definition: hdecay.h:121

Member Data Documentation

std::string EcalSimRawData::basename_
private

basename for output files

Definition at line 469 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 461 of file EcalSimRawData.h.

std::string EcalSimRawData::digiProducer_
private

Name of module/plugin/producer making digis

Definition at line 372 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 376 of file EcalSimRawData.h.

std::string EcalSimRawData::ebSrFlagCollection_
private

EB SRP flag digi product instance name

Definition at line 389 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 380 of file EcalSimRawData.h.

std::string EcalSimRawData::eeSrFlagCollection_
private

EE SRP flag digi product instancename

Definition at line 393 of file EcalSimRawData.h.

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

Selective readout simulator

Definition at line 445 of file EcalSimRawData.h.

bool EcalSimRawData::fe2dcc_
private

Switch for data of FE->DCC link

Definition at line 433 of file EcalSimRawData.h.

bool EcalSimRawData::fe2tcc_
private

Switch for data of FE->TCC link

Definition at line 437 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 385 of file EcalSimRawData.h.

std::ofstream EcalSimRawData::srfFile
private

Output file for selective readout flags

Definition at line 453 of file EcalSimRawData.h.

bool EcalSimRawData::srp2dcc_
private

Switch for data of SRP->DCC link

Definition at line 425 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 429 of file EcalSimRawData.h.

int EcalSimRawData::tccInDefaultVal_
private

default TriggerPrimitive values if the trigger tower is abscent

Definition at line 465 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 457 of file EcalSimRawData.h.

std::string EcalSimRawData::tcpDigiCollection_
private

TCP Fenix output digi product instance name

Definition at line 401 of file EcalSimRawData.h.

const CaloGeometry* EcalSimRawData::theGeometry
private

Calorimeter geometry

Definition at line 405 of file EcalSimRawData.h.

const EcalTrigTowerConstituentsMap* EcalSimRawData::theTriggerTowerMap
private

ECAL endcap trigger tower map

Definition at line 441 of file EcalSimRawData.h.

std::string EcalSimRawData::tpDigiCollection_
private

Trigger primitive digi product instance name

Definition at line 397 of file EcalSimRawData.h.

std::string EcalSimRawData::tpProducer_
private

Name of the trigger primitive label

Definition at line 409 of file EcalSimRawData.h.

bool EcalSimRawData::tpVerbose_
private

Verbosity switch for crystal data

Definition at line 421 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 449 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 413 of file EcalSimRawData.h.

bool EcalSimRawData::xtalVerbose_
private

Verbosity switch for crystal data

Definition at line 417 of file EcalSimRawData.h.