CMS 3D CMS Logo

Macros | Enumerations | Functions | Variables
GenABIO.cc File Reference
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <sstream>
#include <vector>
#include "ecalDccMap.h"
#include <errno.h>

Go to the source code of this file.

Macros

#define SIZE_MAX   ((size_t)-1)
 
#define SSIZE_MAX   ((ssize_t)(SIZE_MAX / 2))
 

Enumerations

enum  roAction_t {
  suppress = 0, sr2, sr1, full,
  fsuppress, fsr2, fsr1, ffull
}
 

Functions

void abConnect (int iAB, int iABCh, int &iOtherAB, int &iOtherABCh)
 
int abNum (int iABEta, int iABPhi)
 
void fillABIOFiles (const char ttFlags[nTTInEta][nTTInPhi], const char barrelSrFlags[nBarrelTTInEta][nTTInPhi], const char endcapSrFlags[nEndcaps][nSupercrystalXBins][nSupercrystalYBins], ofstream files[])
 
void fillABSRPFiles (const char barrelSrFlags[nBarrelTTInEta][nTTInPhi], const char endcapSrFlags[nEndcaps][nSupercrystalXBins][nSupercrystalYBins], ofstream files[])
 
void fillABSRPFiles (const char barrelSrFlags[nBarrelTTInEta][nTTInPhi], const char endcapSrFlags[nEndcaps][nSupercrystalXBins][nSupercrystalYBins], ofstream files[nAB])
 
void fillABTTFFiles (const char ttFlags[nTTInEta][nTTInPhi], ofstream files[])
 
string getABABInputStream (const char tccFlags[nTTInEta][nTTInPhi], int iABEta, int iABPhi, int iABCh)
 
string getABABOutputStream (const char tccFlags[nTTInEta][nTTInPhi], int iABEta, int iABPhi, int iABCh)
 
string getABDCCOutputStream (const char barrelSrFlags[nBarrelTTInEta][nTTInPhi], const char endcapSrFlags[nEndcaps][nSupercrystalXBins][nSupercrystalYBins], int iABEta, int iABPhi, int DCCCh)
 
string getABTCCInputStream (const char tccFlags[nTTInEta][nTTInPhi], int iABEta, int iABPhi, int iTCCCh)
 
void getABTTPhiBounds (int iABPhi, int &iTTPhiMin, int &iTTPhiMax)
 
string getFlagStream (char flags[nTTInEta][nTTInPhi], int iEtaMin, int iEtaMax, int iPhiMin, int iPhiMax)
 
int main (int argc, char *argv[])
 
bool readSRF (FILE *file, char barrelSrFlags[nBarrelTTInEta][nTTInPhi], char endcapSrFlags[nEndcaps][nSupercrystalXBins][nSupercrystalYBins])
 
bool readTTF (FILE *file, char ttFlags[nTTInEta][nTTInPhi])
 
void writeABIOFileHeader (ofstream &f, int abNum)
 
void writeABSRFFileHeader (ofstream &f, int abNum)
 
void writeABTTFFileHeader (ofstream &f, int abNum)
 

Variables

const char * abIOFilePostfix = ".txt"
 
const char * abIOFilePrefix = "IO_AB"
 
const char * abSRFFilePostfix = ".txt"
 
const char * abSRFFilePrefix = "AF_AB"
 
const char * abTTFFilePostfix = ".txt"
 
const char * abTTFFilePrefix = "TTF_AB"
 
roAction_t actions [nactions]
 
vector< pair< int, int > > ecalDccSC [nEndcaps][nDCCEE]
 
int iEvent = 0
 
const int iTCCEtaBounds [nTCCInEta+1] = {0, 7, 11, 28, 45, 49, 56}
 
const int iTTEtaMax [nABInEta] = {10, 27, 44, 55}
 
const int iTTEtaMin [nABInEta] = {0, 11, 28, 45}
 
const int iTTEtaSign [nABInEta] = {-1, -1, 1, 1}
 
const int nAB = nABInPhi * nABInEta
 
const int nABABCh = 8
 
const int nABInEta = 4
 
const int nABInPhi = 3
 
const int nABTCCCh = 12
 
const int nactions = 8
 
static const int nBarrelTTInEta = 34
 
const int nDCCCh = 12
 
const int nDCCEE = 9
 
static const int nEndcaps = 2
 
static const int nEndcapTTInEta = 11
 
static const int nEndcapXBins = 100
 
static const int nEndcapYBins = 100
 
static const int nSupercrystalXBins = nEndcapXBins / supercrystalEdge
 
static const int nSupercrystalYBins = nEndcapYBins / supercrystalEdge
 
const int nTCCInEta = 6
 
const int nTTInABAlongPhi = nTTInPhi / nABInPhi
 
static const int nTTInEta = 2 * nEndcapTTInEta + nBarrelTTInEta
 
static const int nTTInPhi = 72
 
char roFlagMarker []
 
const char * srfFilename = "SRF.txt"
 
char srp2roFlags [128]
 
const char srpFlagMarker [] = {'.', 'S', 'N', 'C', '4', '5', '6', '7'}
 
static const int supercrystalEdge = 5
 
const char tccFlagMarker [] = {'.', 'S', '?', 'C', '4', '5', '6', '7'}
 
int theAB = -1
 
const char * ttfFilename = "TTF.txt"
 
const char * xconnectFilename = "xconnect_universal.txt"
 

Detailed Description

GenABIO is a standalone program to produce individual SRP card trigger tower and selective readout action flags from TTF.txt and SRF.txt global flag files. Run 'GenABIO -h' for usage.

Definition in file GenABIO.cc.

Macro Definition Documentation

#define SIZE_MAX   ((size_t)-1)

Definition at line 25 of file GenABIO.cc.

#define SSIZE_MAX   ((ssize_t)(SIZE_MAX / 2))

Definition at line 28 of file GenABIO.cc.

Enumeration Type Documentation

enum roAction_t
Enumerator
suppress 
sr2 
sr1 
full 
fsuppress 
fsr2 
fsr1 
ffull 

Definition at line 168 of file GenABIO.cc.

Definition: GenABIO.cc:168
Definition: GenABIO.cc:168
Definition: GenABIO.cc:168
Definition: GenABIO.cc:168
Definition: GenABIO.cc:168
roAction_t
Definition: GenABIO.cc:168

Function Documentation

void abConnect ( int  iAB,
int  iABCh,
int &  iOtherAB,
int &  iOtherABCh 
)

Definition at line 870 of file GenABIO.cc.

References HltBtagPostValidation_cff::c, beam_dqm_sourceclient-live_cfg::cerr, beamvalidation::exit(), f, mps_fire::i, nAB, nABABCh, and xconnectFilename.

Referenced by abNum(), and getABABInputStream().

870  {
871  static bool firstCall = true;
872  static int xconnectMap[nAB][nABABCh][2];
873  if (firstCall) {
874  FILE *f = fopen(xconnectFilename, "r");
875  if (f == nullptr) {
876  cerr << "Error. Failed to open xconnect definition file," << xconnectFilename << endl;
877  exit(EXIT_FAILURE);
878  }
879  // skips two first lines:
880  for (int i = 0; i < 2; ++i) {
881  int c;
882  while ((c = getc(f)) != '\n' && c >= 0)
883  ;
884  }
885  int ilink = 0;
886  while (!feof(f)) {
887  int abIn;
888  int pinIn;
889  int abOut;
890  int pinOut;
891  if (4 == fscanf(f, "%d\t%d\t%d\t%d", &abIn, &pinIn, &abOut, &pinOut)) {
892  xconnectMap[abIn][pinIn][0] = abOut;
893  xconnectMap[abIn][pinIn][1] = pinOut;
894  ++ilink;
895  }
896  }
897  if (ilink != nAB * nABABCh) {
898  cerr << "Error cross-connect definition file " << xconnectFilename
899  << " contains an unexpected number of link definition." << endl;
900  exit(EXIT_FAILURE);
901  }
902  firstCall = false;
903  }
904 
905  iOtherAB = xconnectMap[iAB][iABCh][0];
906  iOtherABCh = xconnectMap[iAB][iABCh][1];
907 }
double f[11][100]
const char * xconnectFilename
Definition: GenABIO.cc:161
const int nAB
Definition: GenABIO.cc:141
const int nABABCh
Definition: GenABIO.cc:137
def exit(msg="")
int abNum ( int  iABEta,
int  iABPhi 
)
inline
void fillABIOFiles ( const char  ttFlags[nTTInEta][nTTInPhi],
const char  barrelSrFlags[nBarrelTTInEta][nTTInPhi],
const char  endcapSrFlags[nEndcaps][nSupercrystalXBins][nSupercrystalYBins],
ofstream  files[] 
)

Definition at line 459 of file GenABIO.cc.

References abNum(), getABABInputStream(), getABABOutputStream(), getABDCCOutputStream(), getABTCCInputStream(), iEvent, nABABCh, nABInEta, nABInPhi, nABTCCCh, and nDCCCh.

Referenced by main().

462  {
463  for (int iABEta = 0; iABEta < nABInEta; ++iABEta) {
464  for (int iABPhi = 0; iABPhi < nABInPhi; ++iABPhi) {
465  int iAB = abNum(iABEta, iABPhi);
466  // writeABIOFileHeader(files[iAB], iAB);
467  files[iAB] << "# Event " << iEvent << "\n";
468  // TCC inputs:
469  for (int iTCC = 0; iTCC < nABTCCCh; ++iTCC) {
470  files[iAB] << "ITCC" << iTCC + 1 << ":" << getABTCCInputStream(ttFlags, iABEta, iABPhi, iTCC) << "\n";
471  }
472  // AB inputs:
473  for (int iABCh = 0; iABCh < nABABCh; ++iABCh) {
474  files[iAB] << "IAB" << iABCh + 1 << ":" << getABABInputStream(ttFlags, iABEta, iABPhi, iABCh) << "\n";
475  }
476  // AB outputs:
477  for (int iABCh = 0; iABCh < nABABCh; ++iABCh) {
478  files[iAB] << "OAB" << iABCh + 1 << ":" << getABABOutputStream(ttFlags, iABEta, iABPhi, iABCh) << "\n";
479  }
480  // DCC output:
481  for (int iDCCCh = 0; iDCCCh < nDCCCh; ++iDCCCh) {
482  files[iAB] << "ODCC";
483  files[iAB] << (iDCCCh <= 8 ? "0" : "") << iDCCCh + 1 << ":"
484  << getABDCCOutputStream(barrelSrFlags, endcapSrFlags, iABEta, iABPhi, iDCCCh) << "\n";
485  }
486  files[iAB] << "#\n";
487  }
488  }
489 }
string getABABInputStream(const char tccFlags[nTTInEta][nTTInPhi], int iABEta, int iABPhi, int iABCh)
Definition: GenABIO.cc:855
const int nABInEta
Definition: GenABIO.cc:130
int iEvent
Definition: GenABIO.cc:224
const int nABTCCCh
Definition: GenABIO.cc:138
string getABABOutputStream(const char tccFlags[nTTInEta][nTTInPhi], int iABEta, int iABPhi, int iABCh)
Definition: GenABIO.cc:788
const int nDCCCh
Definition: GenABIO.cc:139
string getABTCCInputStream(const char tccFlags[nTTInEta][nTTInPhi], int iABEta, int iABPhi, int iTCCCh)
Definition: GenABIO.cc:758
const int nABInPhi
Definition: GenABIO.cc:133
int abNum(int iABEta, int iABPhi)
Definition: GenABIO.cc:202
const int nABABCh
Definition: GenABIO.cc:137
string getABDCCOutputStream(const char barrelSrFlags[nBarrelTTInEta][nTTInPhi], const char endcapSrFlags[nEndcaps][nSupercrystalXBins][nSupercrystalYBins], int iABEta, int iABPhi, int DCCCh)
Definition: GenABIO.cc:909
void fillABSRPFiles ( const char  barrelSrFlags[nBarrelTTInEta][nTTInPhi],
const char  endcapSrFlags[nEndcaps][nSupercrystalXBins][nSupercrystalYBins],
ofstream  files[] 
)

Referenced by main().

void fillABSRPFiles ( const char  barrelSrFlags[nBarrelTTInEta][nTTInPhi],
const char  endcapSrFlags[nEndcaps][nSupercrystalXBins][nSupercrystalYBins],
ofstream  files[nAB] 
)

Definition at line 390 of file GenABIO.cc.

References abNum(), abOfDcc(), dccIndexOfRU(), MainPageGenerator::files, getABTTPhiBounds(), mps_fire::i, iEvent, createfilelist::int, iTTEtaMax, iTTEtaMin, iTTEtaSign, mod(), nAB, nABInPhi, nEndcaps, nEndcapTTInEta, nSupercrystalXBins, nSupercrystalYBins, nTTInABAlongPhi, and srp2roFlags.

392  {
393  // event headers:
394  for (int iAB = 0; iAB < nAB; ++iAB) {
395  files[iAB] << "# Event " << iEvent << "\n";
396  }
397 
398  bool lineAppended[nAB];
399  for (int i = 0; i < nAB; lineAppended[i++] = false) /*empty*/
400  ;
401 
402  // EE:
403  for (int iEE = 0; iEE < nEndcaps; ++iEE) {
404  for (int iX = 0; iX < nSupercrystalXBins; ++iX) {
405  for (int iY = 0; iY < nSupercrystalYBins; ++iY) {
406  // int iDCC = dccIndex(iEE==0?0:2,iX*5,iY*5);
407  int iDCC = dccIndexOfRU(iEE == 0 ? 0 : 2, iX, iY);
408  if (iDCC >= 0) {
409  int iAB = abOfDcc(iDCC);
410  if (!lineAppended[iAB]) {
411  for (int i = 0; i < iY; ++i)
412  files[iAB] << ' ';
413  }
414  files[iAB] << srp2roFlags[(int)endcapSrFlags[iEE][iX][iY]];
415  lineAppended[iAB] = true;
416  }
417  } // next iY
418  for (int iFile = 0; iFile < nAB; ++iFile) {
419  if (lineAppended[iFile]) {
420  files[iFile] << "\n";
421  lineAppended[iFile] = false;
422  }
423  }
424  } // next iX
425  }
426 
427  // EB:
428  for (int iABEta = 1; iABEta < 3; ++iABEta) {
429  for (int iABPhi = 0; iABPhi < nABInPhi; ++iABPhi) {
430  int iAB = abNum(iABEta, iABPhi);
431  int iTTPhiMin;
432  int iTTPhiMax;
433  getABTTPhiBounds(iABPhi, iTTPhiMin, iTTPhiMax);
434  // writeEventHeader(files[iAB], iEvent, nTTInABAlongPhi);
435  for (int i = 0; i <= iTTEtaMax[iABEta] - iTTEtaMin[iABEta]; ++i) {
436  int iTTEta;
437  if (iTTEtaSign[iABEta] > 0) {
438  iTTEta = iTTEtaMin[iABEta] + i;
439  } else {
440  iTTEta = iTTEtaMax[iABEta] - i;
441  }
442  for (int iTTPhi = iTTPhiMin; mod(iTTPhiMax - iTTPhi, nTTInPhi) < nTTInABAlongPhi;
443  iTTPhi = mod(++iTTPhi, nTTInPhi)) {
444  files[iAB] << srp2roFlags[(int)barrelSrFlags[iTTEta - nEndcapTTInEta][iTTPhi]];
445  }
446  files[iAB] << "\n";
447  }
448  // writeEventTrailer(files[iAB], nTTInABAlongPhi);
449  files[iAB] << "#\n";
450  }
451  }
452 
453  // file trailers
454  for (int iAB = 0; iAB < nAB; ++iAB) {
455  files[iAB] << "#\n";
456  }
457 }
const int iTTEtaMin[nABInEta]
Definition: GenABIO.cc:143
static const int nSupercrystalXBins
Definition: GenABIO.cc:109
char srp2roFlags[128]
Definition: GenABIO.cc:166
void getABTTPhiBounds(int iABPhi, int &iTTPhiMin, int &iTTPhiMax)
Definition: GenABIO.cc:865
int iEvent
Definition: GenABIO.cc:224
const int iTTEtaMax[nABInEta]
Definition: GenABIO.cc:144
int abOfDcc(int iDCC)
Definition: ecalDccMap.h:103
int dccIndexOfRU(int iDet, int i, int j)
Definition: ecalDccMap.h:86
static const int nSupercrystalYBins
Definition: GenABIO.cc:112
const int iTTEtaSign[nABInEta]
Definition: GenABIO.cc:145
static const int nEndcaps
Definition: GenABIO.cc:115
const int nTTInABAlongPhi
Definition: GenABIO.cc:142
static const int nTTInPhi
Definition: GenABIO.cc:127
const int nABInPhi
Definition: GenABIO.cc:133
static const int nEndcapTTInEta
Definition: GenABIO.cc:118
const int nAB
Definition: GenABIO.cc:141
int abNum(int iABEta, int iABPhi)
Definition: GenABIO.cc:202
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
void fillABTTFFiles ( const char  ttFlags[nTTInEta][nTTInPhi],
ofstream  files[] 
)

Produces one file per AB. Each file contains the TT flags the AB receives from its inputs.

Definition at line 361 of file GenABIO.cc.

References abNum(), getABTTPhiBounds(), mps_fire::i, iEvent, iTTEtaMax, iTTEtaMin, iTTEtaSign, mod(), nABInEta, nABInPhi, and nTTInABAlongPhi.

Referenced by main().

361  {
362  for (int iABEta = 0; iABEta < nABInEta; ++iABEta) {
363  for (int iABPhi = 0; iABPhi < nABInPhi; ++iABPhi) {
364  int iAB = abNum(iABEta, iABPhi);
365  int iTTPhiMin;
366  int iTTPhiMax;
367  getABTTPhiBounds(iABPhi, iTTPhiMin, iTTPhiMax);
368  // writeEventHeader(files[iAB], iEvent, nTTInABAlongPhi);
369  files[iAB] << "# Event " << iEvent << "\n";
370 
371  for (int i = 0; i <= iTTEtaMax[iABEta] - iTTEtaMin[iABEta]; ++i) {
372  int iTTEta;
373  if (iTTEtaSign[iABEta] > 0) {
374  iTTEta = iTTEtaMin[iABEta] + i;
375  } else {
376  iTTEta = iTTEtaMax[iABEta] - i;
377  }
378  for (int iTTPhi = iTTPhiMin; mod(iTTPhiMax - iTTPhi, nTTInPhi) < nTTInABAlongPhi;
379  iTTPhi = mod(++iTTPhi, nTTInPhi)) {
380  files[iAB] << ttFlags[iTTEta][iTTPhi];
381  }
382  files[iAB] << "\n";
383  }
384  files[iAB] << "#\n";
385  // writeEventTrailer(files[iAB], nTTInABAlongPhi);
386  }
387  }
388 }
const int iTTEtaMin[nABInEta]
Definition: GenABIO.cc:143
const int nABInEta
Definition: GenABIO.cc:130
void getABTTPhiBounds(int iABPhi, int &iTTPhiMin, int &iTTPhiMax)
Definition: GenABIO.cc:865
int iEvent
Definition: GenABIO.cc:224
const int iTTEtaMax[nABInEta]
Definition: GenABIO.cc:144
const int iTTEtaSign[nABInEta]
Definition: GenABIO.cc:145
const int nTTInABAlongPhi
Definition: GenABIO.cc:142
static const int nTTInPhi
Definition: GenABIO.cc:127
const int nABInPhi
Definition: GenABIO.cc:133
int abNum(int iABEta, int iABPhi)
Definition: GenABIO.cc:202
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
string getABABInputStream ( const char  tccFlags[nTTInEta][nTTInPhi],
int  iABEta,
int  iABPhi,
int  iABCh 
)

Definition at line 855 of file GenABIO.cc.

References abConnect(), abNum(), and getABABOutputStream().

Referenced by abNum(), and fillABIOFiles().

855  {
856  int iAB = abNum(iABEta, iABPhi);
857  int iOtherAB; // AB which this channel is connected to
858  int iOtherABCh; // ch # on the other side of the AB-AB link
859  abConnect(iAB, iABCh, iOtherAB, iOtherABCh);
860  int iOtherABEta = iOtherAB / 3;
861  int iOtherABPhi = iOtherAB % 3;
862  return getABABOutputStream(tccFlags, iOtherABEta, iOtherABPhi, iOtherABCh);
863 }
string getABABOutputStream(const char tccFlags[nTTInEta][nTTInPhi], int iABEta, int iABPhi, int iABCh)
Definition: GenABIO.cc:788
void abConnect(int iAB, int iABCh, int &iOtherAB, int &iOtherABCh)
Definition: GenABIO.cc:870
int abNum(int iABEta, int iABPhi)
Definition: GenABIO.cc:202
string getABABOutputStream ( const char  tccFlags[nTTInEta][nTTInPhi],
int  iABEta,
int  iABPhi,
int  iABCh 
)

Definition at line 788 of file GenABIO.cc.

References Reference_intrackfit_cff::barrel, edmScanValgrind::buffer, getABTCCInputStream(), and alignCSCRings::s.

Referenced by abNum(), fillABIOFiles(), and getABABInputStream().

788  {
789  stringstream buffer;
790  buffer.str("");
791  bool barrel = (iABEta == 1 || iABEta == 2); // true for barrel, false for endcap
792  switch (iABCh) {
793  case 0:
794  // to AB ch #0 are sent the 16 1st TCC flags received on TCC input Ch. 0
795  buffer << getABTCCInputStream(tccFlags, iABEta, iABPhi, 0).substr(0, 16);
796  break;
797  case 1:
798  // to AB ch #1 are sent the 16 1st TCC flags received on TCC input Ch. 0 to
799  // 5:
800  for (int iTCCCh = 0; iTCCCh < 6; ++iTCCCh) {
801  buffer << getABTCCInputStream(tccFlags, iABEta, iABPhi, iTCCCh).substr(0, 16);
802  }
803  break;
804  case 2:
805  // to AB ch #2 are sent the 16 1st TCC flags received on TCC input Ch. 5:
806  buffer << getABTCCInputStream(tccFlags, iABEta, iABPhi, 5).substr(0, 16);
807  break;
808  case 3:
809  // to AB ch #3 are sent TCC flags received on TCC input Ch. 0 and 6:
810  buffer << getABTCCInputStream(tccFlags, iABEta, iABPhi, 0);
811  buffer << getABTCCInputStream(tccFlags, iABEta, iABPhi, 6);
812  break;
813  case 4:
814  // to AB ch #4 are sent TCC flags received on TCC input Ch 5 and 11:
815  buffer << getABTCCInputStream(tccFlags, iABEta, iABPhi, 5);
816  buffer << getABTCCInputStream(tccFlags, iABEta, iABPhi, 11);
817  break;
818  case 5:
819  // for endcaps AB output ch 5 is not used.
820  // for barrel, to AB ch #5 are sent the 16 last TCC flags received on TCC
821  // input Ch. 0:
822  if (barrel) { // in barrel
823  string s = getABTCCInputStream(tccFlags, iABEta, iABPhi, 0);
824  assert(s.size() >= 16);
825  buffer << s.substr(s.size() - 16, 16);
826  }
827  break;
828  case 6:
829  // for endcaps AB output ch 6 is not used.
830  // for barrel, to AB ch #6 are sent the 16 last TCC flags received on TCC
831  // input Ch. 0 to 5:
832  if (barrel) { // in barrel
833  for (int iTCCCh = 0; iTCCCh < 6; ++iTCCCh) {
834  string s = getABTCCInputStream(tccFlags, iABEta, iABPhi, iTCCCh);
835  buffer << s.substr(s.size() - 16, 16);
836  }
837  }
838  break;
839  case 7:
840  // for endcaps AB output ch 7 is not used.
841  // for barrel, to AB ch #7 are sent the 16 last TCC flags received on TCC
842  // input Ch. 5:
843  if (barrel) { // in barrel
844  string s = getABTCCInputStream(tccFlags, iABEta, iABPhi, 5);
845  assert(s.size() >= 16);
846  buffer << s.substr(s.size() - 16, 16);
847  }
848  break;
849  default:
850  assert(false);
851  }
852  return buffer.str();
853 }
string getABTCCInputStream(const char tccFlags[nTTInEta][nTTInPhi], int iABEta, int iABPhi, int iTCCCh)
Definition: GenABIO.cc:758
string getABDCCOutputStream ( const char  barrelSrFlags[nBarrelTTInEta][nTTInPhi],
const char  endcapSrFlags[nEndcaps][nSupercrystalXBins][nSupercrystalYBins],
int  iABEta,
int  iABPhi,
int  DCCCh 
)

Definition at line 909 of file GenABIO.cc.

References Reference_intrackfit_cff::barrel, edmScanValgrind::buffer, ecalDccSC, getABTCCInputStream(), mps_fire::i, createfilelist::int, nEndcapTTInEta, SimDataFormats::CaloAnalysis::sc, and srp2roFlags.

Referenced by abNum(), and fillABIOFiles().

913  {
914  bool barrel = (iABEta == 1 || iABEta == 2);
915  if (barrel) {
916  // same as TCC with same ch number but with TCC flags replaced by SRP flags:
917  string stream = getABTCCInputStream(barrelSrFlags - nEndcapTTInEta, iABEta, iABPhi, iDCCCh);
918  // converts srp flags to readout flags:
919  for (size_t i = 0; i < stream.size(); ++i) {
920  stream[i] = srp2roFlags[(int)stream[i]];
921  }
922  return stream;
923  } else { // endcap
924  if (iDCCCh < 3) { // used DCC output channel
925  // endcap index:
926  int iEE = (iABEta == 0) ? 0 : 1;
927  stringstream buffer("");
928  // 3 DCC per AB and AB DCC output channel in
929  // increasing DCC phi position:
930  int iDCCPhi = iABPhi * 3 + iDCCCh;
931  for (size_t iSC = 0; iSC < ecalDccSC[iEE][iDCCPhi].size(); ++iSC) {
932  pair<int, int> sc = ecalDccSC[iEE][iDCCPhi][iSC];
933  buffer << srp2roFlags[(int)endcapSrFlags[iEE][sc.first][sc.second]];
934  }
935  return buffer.str();
936  } else { // unused output channel
937  return "";
938  }
939  }
940 }
char srp2roFlags[128]
Definition: GenABIO.cc:166
string getABTCCInputStream(const char tccFlags[nTTInEta][nTTInPhi], int iABEta, int iABPhi, int iTCCCh)
Definition: GenABIO.cc:758
static const int nEndcapTTInEta
Definition: GenABIO.cc:118
vector< pair< int, int > > ecalDccSC[nEndcaps][nDCCEE]
Definition: GenABIO.cc:192
string getABTCCInputStream ( const char  tccFlags[nTTInEta][nTTInPhi],
int  iABEta,
int  iABPhi,
int  iTCCCh 
)

Definition at line 758 of file GenABIO.cc.

References getABTTPhiBounds(), getFlagStream(), hcalTTPDigis_cfi::iEtaMax, hcalTTPDigis_cfi::iEtaMin, and iTCCEtaBounds.

Referenced by abNum(), fillABIOFiles(), getABABOutputStream(), and getABDCCOutputStream().

758  {
759  // gets eta bounds for this tcc channel:
760  int iTCCEta;
761  if (iABEta == 1 || iABEta == 2) { // barrel
762  if (iTCCCh > 5)
763  return ""; // only 6 TCCs per AB for barrel
764  iTCCEta = 1 + iABEta;
765  } else { // endcap
766  if (iABEta == 0) { // EE-
767  iTCCEta = (iTCCCh < 6) ? 1 : 0;
768  } else { // EE+
769  iTCCEta = (iTCCCh < 6) ? 4 : 5;
770  }
771  }
772  int iEtaMin = iTCCEtaBounds[iTCCEta];
773  int iEtaMax = iTCCEtaBounds[iTCCEta + 1] - 1;
774 
775  // gets phi bounds:
776  int iPhiMin;
777  int iPhiMax;
778  getABTTPhiBounds(iABPhi, iPhiMin, iPhiMax);
779  // phi is increasing with TTC channel number
780  // a TTC covers a 4TT-wide phi-sector
781  //=>iPhiMin(iTTCCh) = iPhiMin(AB) + 4*iTTCCh for iTCCCh<6
782  iPhiMin += 4 * (iTCCCh % 6);
783  iPhiMax = iPhiMin + 4 - 1;
784 
785  return getFlagStream(tccFlags, iEtaMin, iEtaMax, iPhiMin, iPhiMax);
786 }
void getABTTPhiBounds(int iABPhi, int &iTTPhiMin, int &iTTPhiMax)
Definition: GenABIO.cc:865
string getFlagStream(char flags[nTTInEta][nTTInPhi], int iEtaMin, int iEtaMax, int iPhiMin, int iPhiMax)
Definition: GenABIO.cc:729
const int iTCCEtaBounds[nTCCInEta+1]
Definition: GenABIO.cc:150
void getABTTPhiBounds ( int  iABPhi,
int &  iTTPhiMin,
int &  iTTPhiMax 
)

Definition at line 865 of file GenABIO.cc.

References mod(), nTTInABAlongPhi, and nTTInPhi.

Referenced by abNum(), fillABSRPFiles(), fillABTTFFiles(), and getABTCCInputStream().

865  {
866  iTTPhiMin = mod(-6 + iABPhi * nTTInABAlongPhi, nTTInPhi);
867  iTTPhiMax = mod(iTTPhiMin + nTTInABAlongPhi - 1, nTTInPhi);
868 }
const int nTTInABAlongPhi
Definition: GenABIO.cc:142
static const int nTTInPhi
Definition: GenABIO.cc:127
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
string getFlagStream ( char  flags[nTTInEta][nTTInPhi],
int  iEtaMin,
int  iEtaMax,
int  iPhiMin,
int  iPhiMax 
)

Definition at line 729 of file GenABIO.cc.

References edmScanValgrind::buffer, beam_dqm_sourceclient-live_cfg::cerr, beamvalidation::exit(), HLT_2018_cff::flags, hcalTTPDigis_cfi::iEtaMin, mod(), and nTTInEta.

Referenced by abNum(), and getABTCCInputStream().

729  {
730  assert(0 <= iEtaMin && iEtaMin <= iEtaMax && iEtaMax < nTTInEta);
731  if (iEtaMin <= nTTInEta / 2 && iEtaMax > nTTInEta) {
732  cerr << "Implementation Errror:" << __FILE__ << ":" << __LINE__
733  << ": A flag stream cannot covers parts of both half-ECAL!" << endl;
734  exit(EXIT_FAILURE);
735  }
736 
737  bool zPos = (iEtaMin >= nTTInEta / 2);
738 
739  stringstream buffer;
740  buffer.str("");
741  for (int jEta = 0; jEta <= iEtaMax - iEtaMin; ++jEta) {
742  // loops on iEta in |eta| increasing order:
743  int iEta;
744  if (zPos) {
745  iEta = iEtaMin + jEta;
746  } else {
747  iEta = iEtaMax - jEta;
748  }
749 
750  for (int iPhi = mod(iPhiMin, nTTInPhi); mod(iPhiMax + 1 - iPhi, nTTInPhi) != 0; iPhi = mod(++iPhi, nTTInPhi)) {
751  buffer << flags[iEta][iPhi];
752  }
753  }
754 
755  return buffer.str();
756 }
static const int nTTInEta
Definition: GenABIO.cc:124
static const int nTTInPhi
Definition: GenABIO.cc:127
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
def exit(msg="")
int main ( int  argc,
char *  argv[] 
)

CALO JETS


PF JETS

Definition at line 228 of file GenABIO.cc.

References abIOFilePostfix, abIOFilePrefix, abSRFFilePostfix, abSRFFilePrefix, abTTFFilePostfix, abTTFFilePrefix, actions, beam_dqm_sourceclient-live_cfg::cerr, gather_cfg::cout, dccPhiIndexOfRU(), ecalDccSC, beamvalidation::exit(), fillABIOFiles(), fillABSRPFiles(), fillABTTFFiles(), mps_fire::i, iEvent, createfilelist::int, nAB, nactions, nBarrelTTInEta, nEndcaps, nEndcapXBins, nEndcapYBins, nSupercrystalXBins, nSupercrystalYBins, nTTInEta, nTTInPhi, MillePedeFileConverter_cfg::out, readSRF(), readTTF(), roFlagMarker, alignCSCRings::s, srfFilename, srp2roFlags, srpFlagMarker, theAB, ttfFilename, writeABIOFileHeader(), writeABSRFFileHeader(), and writeABTTFFileHeader().

228  {
229  char barrelSrFlags[nBarrelTTInEta][nTTInPhi];
230  char endcapSrFlags[nEndcaps][nEndcapXBins / 5][nEndcapYBins / 5];
231  char ttFlags[nTTInEta][nTTInPhi];
232  ofstream abTTFFiles[nAB];
233  ofstream abSRFFiles[nAB];
234  ofstream abIOFiles[nAB];
235 
236  int iarg = 0;
237  while (++iarg < argc) {
238  if (strcmp(argv[iarg], "-h") == 0 || strcmp(argv[iarg], "--help") == 0) {
239  cout << "Usage: GenABIO [OPTIONS]\n\n"
240  "Produces TT and SR flag files for each SRP board from TTF.txt "
241  "and "
242  "SRF.txt global flag files. Requires the SRP cross-connect "
243  "description"
244  " description file (xconnect_universal.txt). TTF.txt, SRF.txt and "
245  "xconnect_universal.txt must be in the directory the command is "
246  "launched.\n\n"
247  "OPTIONS:\n"
248  " -A, --actions IJKLMNOP. IJKLMNOP I..P integers from 0 to 7.\n"
249  " I: action flag for low interest RUs\n"
250  " J: action flag for single RUs\n"
251  " K: action flag for neighbour RUs\n"
252  " L: action flag for centers RUs\n"
253  " M: action flag for forced low interest RUs\n"
254  " N: action flag for forced single RUs\n"
255  " O: action flag for forced neighbour RUs\n"
256  " P: action flag for forced centers RUs\n\n"
257  " -h, --help display this help\n"
258  " -a n, --ab n specifies indices of the AB whose file must be "
259  "produced. The ab number runs from 1 to 12. Use -1 to produce "
260  "files "
261  "for every AB\n\n";
262 
263  return 0;
264  }
265 
266  if (!strcmp(argv[iarg], "-A") || !strcmp(argv[iarg], "-A")) { // actions
267  if (++iarg >= argc) {
268  cout << "Option error. Try -h\n";
269  return 1;
270  }
271  for (int i = 0; i < 8; ++i) {
272  int act = argv[iarg][i] - '0';
273  if (act < 0 || act >= nactions) {
274  cout << "Error. Action argument is invalid.\n";
275  return 1;
276  } else {
277  actions[i] = (roAction_t)act;
278  }
279  }
280  continue;
281  }
282  if (!strcmp(argv[iarg], "-a") || !strcmp(argv[iarg], "--ab")) {
283  if (++iarg >= argc) {
284  cout << "Option error. Try -h\n";
285  return 1;
286  }
287  theAB = strtoul(argv[iarg], nullptr, 0);
288  if (theAB >= 0)
289  --theAB;
290  if (theAB < -1 || theAB > 11) {
291  cout << "AB number is incorrect. Try -h option to get help.\n";
292  }
293  continue;
294  }
295  }
296 
297  for (size_t i = 0; i < sizeof(srp2roFlags) / sizeof(srp2roFlags[0]); srp2roFlags[i++] = '?')
298  ;
299  for (size_t i = 0; i < sizeof(actions) / sizeof(actions[0]); ++i) {
301  }
302 
303  for (int iEE = 0; iEE < nEndcaps; ++iEE) {
304  for (int iY = 0; iY < nSupercrystalXBins; ++iY) {
305  for (int iX = 0; iX < nSupercrystalYBins; ++iX) {
306  int iDCCPhi = dccPhiIndexOfRU(iEE == 0 ? 0 : 2, iX, iY);
307  if (iDCCPhi >= 0) { // SC exists
308  ecalDccSC[iEE][iDCCPhi].push_back(pair<int, int>(iX, iY));
309  }
310  }
311  }
312  }
313 
314  stringstream s;
315  for (int iAB = 0; iAB < nAB; ++iAB) {
316  if (theAB != -1 && theAB != iAB)
317  continue;
318  s.str("");
319  s << abTTFFilePrefix << (iAB < 9 ? "0" : "") << iAB + 1 << abTTFFilePostfix;
320  abTTFFiles[iAB].open(s.str().c_str(), ios::out);
321  writeABTTFFileHeader(abTTFFiles[iAB], iAB);
322  s.str("");
323  s << abSRFFilePrefix << (iAB < 9 ? "0" : "") << iAB + 1 << abSRFFilePostfix;
324  abSRFFiles[iAB].open(s.str().c_str(), ios::out);
325  writeABSRFFileHeader(abSRFFiles[iAB], iAB);
326  s.str("");
327  s << abIOFilePrefix << (iAB < 9 ? "0" : "") << iAB + 1 << abIOFilePostfix;
328  abIOFiles[iAB].open(s.str().c_str(), ios::out);
329  writeABIOFileHeader(abIOFiles[iAB], iAB);
330  }
331 
332  FILE *srfFile = fopen(srfFilename, "r");
333  if (srfFile == nullptr) {
334  cerr << "Failed to open SRF file, " << srfFilename << endl;
335  exit(EXIT_FAILURE);
336  }
337 
338  FILE *ttfFile = fopen(ttfFilename, "r");
339  if (ttfFile == nullptr) {
340  cerr << "Failed to open TTF file, " << ttfFilename << endl;
341  exit(EXIT_FAILURE);
342  }
343 
344  iEvent = 0;
345  while (readSRF(srfFile, barrelSrFlags, endcapSrFlags) && readTTF(ttfFile, ttFlags)) {
346  if (iEvent % 100 == 0) {
347  cout << "Event " << iEvent << endl;
348  }
349  fillABTTFFiles(ttFlags, abTTFFiles);
350  fillABSRPFiles(barrelSrFlags, endcapSrFlags, abSRFFiles);
351  fillABIOFiles(ttFlags, barrelSrFlags, endcapSrFlags, abIOFiles);
352  ++iEvent;
353  }
354 
355  return 0;
356 }
bool readTTF(FILE *file, char ttFlags[nTTInEta][nTTInPhi])
Definition: GenABIO.cc:499
static const int nEndcapYBins
Definition: GenABIO.cc:103
void writeABSRFFileHeader(ofstream &f, int abNum)
Definition: GenABIO.cc:645
roAction_t actions[nactions]
Definition: GenABIO.cc:181
static const int nSupercrystalXBins
Definition: GenABIO.cc:109
static const int nEndcapXBins
Definition: GenABIO.cc:100
const char * abTTFFilePrefix
Definition: GenABIO.cc:152
const char * abSRFFilePrefix
Definition: GenABIO.cc:154
const char * abIOFilePostfix
Definition: GenABIO.cc:157
char srp2roFlags[128]
Definition: GenABIO.cc:166
int iEvent
Definition: GenABIO.cc:224
void writeABIOFileHeader(ofstream &f, int abNum)
Definition: GenABIO.cc:691
void fillABTTFFiles(const char ttFlags[nTTInEta][nTTInPhi], ofstream files[])
Definition: GenABIO.cc:361
int theAB
Definition: GenABIO.cc:226
roAction_t
Definition: GenABIO.cc:168
static const int nTTInEta
Definition: GenABIO.cc:124
static const int nSupercrystalYBins
Definition: GenABIO.cc:112
const char * abIOFilePrefix
Definition: GenABIO.cc:156
char roFlagMarker[]
Definition: GenABIO.cc:169
static const int nBarrelTTInEta
Definition: GenABIO.cc:121
void fillABIOFiles(const char ttFlags[nTTInEta][nTTInPhi], const char barrelSrFlags[nBarrelTTInEta][nTTInPhi], const char endcapSrFlags[nEndcaps][nSupercrystalXBins][nSupercrystalYBins], ofstream files[])
Definition: GenABIO.cc:459
static const int nEndcaps
Definition: GenABIO.cc:115
const int nactions
Definition: GenABIO.cc:179
static const int nTTInPhi
Definition: GenABIO.cc:127
const char * abTTFFilePostfix
Definition: GenABIO.cc:153
void writeABTTFFileHeader(ofstream &f, int abNum)
Definition: GenABIO.cc:621
const char * abSRFFilePostfix
Definition: GenABIO.cc:155
const char * srfFilename
Definition: GenABIO.cc:159
vector< pair< int, int > > ecalDccSC[nEndcaps][nDCCEE]
Definition: GenABIO.cc:192
const char * ttfFilename
Definition: GenABIO.cc:160
const int nAB
Definition: GenABIO.cc:141
void fillABSRPFiles(const char barrelSrFlags[nBarrelTTInEta][nTTInPhi], const char endcapSrFlags[nEndcaps][nSupercrystalXBins][nSupercrystalYBins], ofstream files[])
int dccPhiIndexOfRU(int iDet, int i, int j)
Definition: ecalDccMap.h:38
bool readSRF(FILE *file, char barrelSrFlags[nBarrelTTInEta][nTTInPhi], char endcapSrFlags[nEndcaps][nSupercrystalXBins][nSupercrystalYBins])
Definition: GenABIO.cc:536
const char srpFlagMarker[]
Definition: GenABIO.cc:163
def exit(msg="")
bool readSRF ( FILE *  file,
char  barrelSrFlags[nBarrelTTInEta][nTTInPhi],
char  endcapSrFlags[nEndcaps][nSupercrystalXBins][nSupercrystalYBins] 
)

Definition at line 536 of file GenABIO.cc.

References edmScanValgrind::buffer, beam_dqm_sourceclient-live_cfg::cerr, beamvalidation::exit(), mps_splice::line, nBarrelTTInEta, nEndcaps, nSupercrystalXBins, nSupercrystalYBins, nTTInPhi, readEcalDQMStatus::read, and srfFilename.

Referenced by abNum(), and main().

538  {
539  char *buffer = nullptr;
540  size_t bufferSize = 0;
541  int read;
542  if (f == nullptr)
543  exit(EXIT_FAILURE);
544  int line = 0;
545  int iEta = 0;
546  int iXm = 0;
547  int iXp = 0;
548  int iReadLine = 0; // number of read line, comment lines excluded
549  // number of non-comment lines to read:
550  const int nReadLine = nBarrelTTInEta + nEndcaps * nSupercrystalXBins;
551  while (iReadLine < nReadLine && (read = getline(&buffer, &bufferSize, f)) != -1) {
552  ++line;
553  char *pos = buffer;
554  while (*pos == ' ' || *pos == '\t')
555  ++pos; // skip spaces
556  if (*pos != '#' && *pos != '\n') { // not a comment line nor an empty line
557  // go back to beginning of line:
558  pos = buffer;
559  if (iReadLine < nSupercrystalXBins) { // EE- reading
560  if (read - 1 != nSupercrystalYBins) {
561  cerr << "Error: line " << line << " of file " << srfFilename << " has incorrect length"
562  << " (" << read - 1 << " instead of " << nSupercrystalYBins << ")" << endl;
563  exit(EXIT_FAILURE);
564  }
565  for (int iY = 0; iY < nSupercrystalYBins; ++iY) {
566  endcapSrFlags[0][iXm][iY] = buffer[iY];
567  }
568  ++iXm;
569  } else if (iReadLine < nSupercrystalYBins + nBarrelTTInEta) { // EB
570  // reading
571  if (read - 1 != nTTInPhi) {
572  cerr << "Error: line " << line << " of file " << srfFilename << " has incorrect length"
573  << " (" << read - 1 << " instead of " << nTTInPhi << ")" << endl;
574  exit(EXIT_FAILURE);
575  }
576  for (int iPhi = 0; iPhi < nTTInPhi; ++iPhi) {
577  barrelSrFlags[iEta][iPhi] = buffer[iPhi];
578  }
579  ++iEta;
580  } else if (iReadLine < 2 * nSupercrystalXBins + nBarrelTTInEta) { // EE+ reading
581  if (read - 1 != nSupercrystalYBins) {
582  cerr << "Error: line " << line << " of file " << srfFilename << " has incorrect length"
583  << " (" << read - 1 << " instead of " << nSupercrystalYBins << ")" << endl;
584  exit(EXIT_FAILURE);
585  }
586  for (int iY = 0; iY < nSupercrystalYBins; ++iY) {
587  endcapSrFlags[1][iXp][iY] = buffer[iY];
588  }
589  ++iXp;
590  }
591  ++iReadLine;
592  } // not a comment or empty line
593  }
594  // returns 0 if all TT were read:
595  return (iReadLine == nReadLine) ? true : false;
596 }
static const int nSupercrystalXBins
Definition: GenABIO.cc:109
double f[11][100]
static const int nSupercrystalYBins
Definition: GenABIO.cc:112
static const int nBarrelTTInEta
Definition: GenABIO.cc:121
static const int nEndcaps
Definition: GenABIO.cc:115
static const int nTTInPhi
Definition: GenABIO.cc:127
const char * srfFilename
Definition: GenABIO.cc:159
def exit(msg="")
bool readTTF ( FILE *  file,
char  ttFlags[nTTInEta][nTTInPhi] 
)

Definition at line 499 of file GenABIO.cc.

References edmScanValgrind::buffer, beam_dqm_sourceclient-live_cfg::cerr, beamvalidation::exit(), mps_splice::line, nTTInEta, nTTInPhi, readEcalDQMStatus::read, and ttfFilename.

Referenced by abNum(), and main().

499  {
500  char *buffer = nullptr;
501  size_t bufferSize = 0;
502  int read;
503  if (f == nullptr)
504  exit(EXIT_FAILURE);
505  int line = 0;
506  int iEta = 0;
507  while (iEta < nTTInEta && (read = getline(&buffer, &bufferSize, f)) != -1) {
508  ++line;
509  char *pos = buffer;
510  while (*pos == ' ' || *pos == '\t')
511  ++pos; // skip spaces
512  if (*pos != '#' && *pos != '\n') { // not a comment line nor an empty line
513  if (read - 1 != nTTInPhi) {
514  cerr << "Error: line " << line << " of file " << ttfFilename
515  << " has incorrect length"
516  // << " (" << read-1 << " instead of " << nTTInPhi <<
517  // ")"
518  << endl;
519  exit(EXIT_FAILURE);
520  }
521  for (int iPhi = 0; iPhi < nTTInPhi; ++iPhi) {
522  ttFlags[iEta][iPhi] = buffer[iPhi];
523  // if(ttFlags[iEta][iPhi]!='.'){
524  // cout << __FILE__ << ":" << __LINE__ << ": "
525  // << iEta << "," << iPhi
526  // << " " << ttFlags[iEta][iPhi] << "\n";
527  // }
528  }
529  ++iEta;
530  }
531  }
532  // returns true if all TT were read (not at end of file)
533  return (iEta == nTTInEta) ? true : false;
534 }
double f[11][100]
static const int nTTInEta
Definition: GenABIO.cc:124
static const int nTTInPhi
Definition: GenABIO.cc:127
const char * ttfFilename
Definition: GenABIO.cc:160
def exit(msg="")
void writeABIOFileHeader ( ofstream &  f,
int  abNum 
)

Definition at line 691 of file GenABIO.cc.

References actions, indexGen::date, roFlagMarker, srpFlagMarker, OrderedSet::t, tccFlagMarker, and ntuplemaker::time.

Referenced by abNum(), and main().

691  {
692  time_t t;
693  time(&t);
694  const char *date = ctime(&t);
695  f << "# AB " << abNum + 1
696  << " I/O \n#\n"
697  "# Generated on : "
698  << date
699  << "#\n"
700  "# "
701  << srpFlagMarker[0] << ": 000 (low interest) " << tccFlagMarker[0] << ": 000 (low interest) " << roFlagMarker[0]
702  << ": 000 (suppress)\n"
703  "# "
704  << srpFlagMarker[1] << ": 001 (single) " << tccFlagMarker[1] << ": 001 (mid interest) " << roFlagMarker[1]
705  << ": 010 (SR Threshold 2)\n"
706  "# "
707  << srpFlagMarker[2] << ": 010 (neighbour) " << tccFlagMarker[2] << ": 010 (not valid) " << roFlagMarker[2]
708  << ": 001 (SR Threshold 1)\n"
709  "# "
710  << srpFlagMarker[3] << ": 011 (center) " << tccFlagMarker[3] << ": 011 (high interest) " << roFlagMarker[3]
711  << ": 011 (Full readout)\n"
712  "#\n"
713  "# action table (when forced):\n"
714  "# LI-> "
715  << roFlagMarker[actions[0]] << " (" << roFlagMarker[actions[4]] << ")"
716  << "\n"
717  "# S -> "
718  << roFlagMarker[actions[1]] << " (" << roFlagMarker[actions[5]] << ")"
719  << "\n"
720  "# N -> "
721  << roFlagMarker[actions[2]] << " (" << roFlagMarker[actions[6]] << ")"
722  << "\n"
723  "# C -> "
724  << roFlagMarker[actions[3]] << " (" << roFlagMarker[actions[7]] << ")"
725  << "\n"
726  "#\n";
727 }
roAction_t actions[nactions]
Definition: GenABIO.cc:181
const char tccFlagMarker[]
Definition: GenABIO.cc:164
double f[11][100]
char roFlagMarker[]
Definition: GenABIO.cc:169
int abNum(int iABEta, int iABPhi)
Definition: GenABIO.cc:202
const char srpFlagMarker[]
Definition: GenABIO.cc:163
void writeABSRFFileHeader ( ofstream &  f,
int  abNum 
)

Definition at line 645 of file GenABIO.cc.

References actions, indexGen::date, roFlagMarker, OrderedSet::t, and ntuplemaker::time.

Referenced by abNum(), and main().

645  {
646  time_t t;
647  time(&t);
648  const char *date = ctime(&t);
649  const char *xLabel;
650  const char *yLabel;
651  if (abNum < 3 || abNum > 8) { // endcap
652  xLabel = "Y ";
653  yLabel = "X ";
654  } else { // barrel
655  xLabel = "Phi";
656  yLabel = "|Eta|";
657  }
658  f << "# SRF flag map covered by AB " << abNum + 1
659  << "\n#\n"
660  "# Generated on : "
661  << date
662  << "#\n"
663  "# +---> "
664  << xLabel << " " << roFlagMarker[0]
665  << ": 000 (suppress)\n"
666  "# | "
667  << roFlagMarker[1]
668  << ": 010 (SR Threshold 2)\n"
669  "# | "
670  << roFlagMarker[2]
671  << ": 001 (SR Threshold 1)\n"
672  "# V "
673  << yLabel << " " << roFlagMarker[3]
674  << ": 011 (Full readout)\n"
675  "#\n"
676  "# action table (when forced):\n"
677  "# LI-> "
678  << roFlagMarker[actions[0]] << " (" << roFlagMarker[actions[4]] << ")"
679  << "\n"
680  "# S -> "
681  << roFlagMarker[actions[1]] << " (" << roFlagMarker[actions[5]] << ")"
682  << "\n"
683  "# N -> "
684  << roFlagMarker[actions[2]] << " (" << roFlagMarker[actions[6]] << ")"
685  << "\n"
686  "# C -> "
687  << roFlagMarker[actions[3]] << " (" << roFlagMarker[actions[7]] << ")"
688  << "\n";
689 }
roAction_t actions[nactions]
Definition: GenABIO.cc:181
double f[11][100]
char roFlagMarker[]
Definition: GenABIO.cc:169
int abNum(int iABEta, int iABPhi)
Definition: GenABIO.cc:202
void writeABTTFFileHeader ( ofstream &  f,
int  abNum 
)

Definition at line 621 of file GenABIO.cc.

References indexGen::date, srpFlagMarker, OrderedSet::t, and ntuplemaker::time.

Referenced by abNum(), and main().

621  {
622  time_t t;
623  time(&t);
624  const char *date = ctime(&t);
625  f << "# TTF flag map covered by AB " << abNum + 1
626  << "\n#\n"
627  "# Generated on : "
628  << date
629  << "#\n"
630  "# +---> Phi "
631  << srpFlagMarker[0]
632  << ": 000 (low interest)\n"
633  "# | "
634  << srpFlagMarker[1]
635  << ": 001 (single)\n"
636  "# | "
637  << srpFlagMarker[2]
638  << ": 010 (neighbour)\n"
639  "# V |Eta| "
640  << srpFlagMarker[3]
641  << ": 011 (center)\n"
642  "#\n";
643 }
double f[11][100]
int abNum(int iABEta, int iABPhi)
Definition: GenABIO.cc:202
const char srpFlagMarker[]
Definition: GenABIO.cc:163

Variable Documentation

const char* abIOFilePostfix = ".txt"

Definition at line 157 of file GenABIO.cc.

Referenced by main().

const char* abIOFilePrefix = "IO_AB"

Definition at line 156 of file GenABIO.cc.

Referenced by main().

const char* abSRFFilePostfix = ".txt"

Definition at line 155 of file GenABIO.cc.

Referenced by main().

const char* abSRFFilePrefix = "AF_AB"

Definition at line 154 of file GenABIO.cc.

Referenced by main().

const char* abTTFFilePostfix = ".txt"

Definition at line 153 of file GenABIO.cc.

Referenced by main().

const char* abTTFFilePrefix = "TTF_AB"

Definition at line 152 of file GenABIO.cc.

Referenced by main().

roAction_t actions[nactions]
vector<pair<int, int> > ecalDccSC[nEndcaps][nDCCEE]

Definition at line 192 of file GenABIO.cc.

Referenced by getABDCCOutputStream(), and main().

int iEvent = 0

Definition at line 224 of file GenABIO.cc.

Referenced by cms::Phase2TrackerDigitizer::accumulate(), SiStripGainFromData::algoAnalyze(), RawDataConverter::analyze(), SiPixelPhase1HitsV::analyze(), SiPixelPhase1TrackingParticleV::analyze(), PhotonMVANtuplizer::analyze(), ElectronMVANtuplizer::analyze(), EcalSimRawData::analyze(), __class__< T >::analyze(), FFTJetTreeDump::analyze(), CastorDumpConditions::analyze(), HcalDigisValidation::analyze(), FSQ::BaseHandler::BaseHandler(), tnp::BaseTreeFiller::BaseTreeFiller(), pat::helper::BasicOverlapTest::BasicOverlapTest(), BeamFitter::BeamFitter(), DDTestMuonNumbering::beginJob(), GeometricTimingDetLoader::beginJob(), GeometricDetLoader::beginJob(), XMLGeometryReader::beginJob(), DTGeometryTest::beginJob(), L1CSCTPEmulatorConfigAnalyzer::beginJob(), DDCMSDetector::beginJob(), OutputMagneticFieldDDToDDL::beginJob(), OutputDDToDDL::beginJob(), HcalTestNumberingTester::beginJob(), cms::Phase2TrackerDigitizer::beginJob(), CSCSkim::beginJob(), RPCNoise::beginJob(), DigiVertexCorrHistogramMaker::book(), DigiLumiCorrHistogramMaker::book(), pat::LeptonVertexSignificance::calculate(), CandMergerCleanOthersByDR::CandMergerCleanOthersByDR(), reco::isodeposit::OtherCandidatesDeltaRVeto::centerOn(), reco::isodeposit::OtherCandVeto::centerOn(), CSCRecoIdealDBLoader::CSCRecoIdealDBLoader(), DTRecoIdealDBLoader::DTRecoIdealDBLoader(), EcalSimRawData::EcalSimRawData(), TTClusterBuilder< T >::endRun(), TTTrackAssociator< T >::endRun(), TTStubAssociator< T >::endRun(), TTClusterAssociator< T >::endRun(), VarSplitter::eval(), VariablePower::eval(), EventStringOutputBranches::EventStringOutputBranches(), L1GtUtils::LogicalExpressionL1Results::expL1Triggers(), SimpleFlatTableProducer< T >::ExtVariable::ExtVariable(), ConfigurableHisto::fill(), fillABIOFiles(), fillABSRPFiles(), fillABTTFFiles(), l1t::L1TGlobalUtil::fillDescription(), PixelFitterByHelixProjectionsProducer::fillDescriptions(), PixelFitterByConformalMappingAndLineProducer::fillDescriptions(), MuonTimingFiller::fillTiming(), ConfigurableAnalysis::filter(), CSCSkim::filter(), RPCNoise::filter(), CSCEfficiency::filter(), FWFileEntry::filterEventsWithCustomParser(), PreMixingWorker::finalizeBunchCrossing(), cms::Phase2TrackerDigitizer::finalizeEvent(), GEMRecoIdealDBLoader::GEMRecoIdealDBLoader(), EcalSelectiveReadoutSuppressor::getEcalSelectiveReadout(), FWEventItem::getEvent(), pat::PATMuonProducer::globalEndJob(), MTDDetLayerMeasurements::groupedMeasurements(), MuonDetLayerMeasurements::groupedMeasurements(), HcalParametersDBBuilder::HcalParametersDBBuilder(), PreMixingTrackingParticleWorker::initializeEvent(), PreMixingDigiSimLinkWorker< DigiSimLinkCollection >::initializeEvent(), edm::PreMixingCrossingFrameWorker< T >::initializeEvent(), PreMixingCaloParticleWorker::initializeEvent(), PreMixingMuonWorker< CSCWireDigiCollection >::initializeEvent(), HLTPrescaler::initializeGlobalCache(), pat::CandidateSummaryTable::initializeGlobalCache(), VirtualJetProducer::jetType(), HLTPrescaleProvider::l1tGlobalUtil(), main(), GroupedCkfTrajectoryBuilder::mass(), ME0RecoIdealDBLoader::ME0RecoIdealDBLoader(), ParametersDefinerForTP::momentum(), tnp::ProbeFlag::name(), FWEventItemsManager::newEvent(), ElectronHEEPIDValueMapProducer::DataFormat::operator()(), PhysicsTowerOrganizer::towercmp::operator()(), SubjetFilterJetProducer::output(), cms::CompoundJetProducer::output(), VirtualJetProducer::output(), PCaloGeometryBuilder::PCaloGeometryBuilder(), PGeometricDetBuilder::PGeometricDetBuilder(), PGeometricDetExtraBuilder::PGeometricDetExtraBuilder(), PHGCalParametersDBBuilder::PHGCalParametersDBBuilder(), QcdLowPtDQM::print(), TtDilepEvtSolutionMaker::produce(), PFEGammaToCandidateRemapper::produce(), ConeIsolation::produce(), TtSemiEvtSolutionMaker::produce(), ImpactParameter::produce(), PFLinker::produce(), pat::MatcherUsingTracks::produce(), SiStripFineDelayHit::produce(), QuickTrackAssociatorByHitsProducer::produce(), pat::PATTriggerEventProducer::produce(), FFTJetPatRecoProducer::produce(), TriggerSummaryProducerAOD::produce(), FFTJetProducer::produce(), SiStripFineDelayHit::produceNoTracking(), PTrackerParametersDBBuilder::PTrackerParametersDBBuilder(), PVFitter::PVFitter(), MTDDetLayerMeasurements::recHits(), MuonDetLayerMeasurements::recHits(), L1Analysis::L1AnalysisL1Menu::Reset(), RPCRecoIdealDBLoader::RPCRecoIdealDBLoader(), pat::helper::AnyNumberAssociationAdaptor::run(), FWEventItem::setEvent(), XMLConfigReader::setEventsFile(), BaseCkfTrajectoryBuilder::setNavigationSchool(), TTStubBuilder< T >::SortStubsBend(), Splitter::Splitter(), TableOutputBranches::TableOutputBranches(), TrackingNtuple::tpHitIndexListLessSort(), tnp::TPTreeFiller::TPTreeFiller(), TrackingSeedCandidates::TrackingSeedCandidates(), TriggerOutputBranches::TriggerOutputBranches(), GlobalVariablesTableProducer::Variable::Variable(), VarSplitter::VarSplitter(), VertexBeamspotOrigins::VertexBeamspotOrigins(), AlCaElectronsTest::~AlCaElectronsTest(), AlignmentMonitorBase::~AlignmentMonitorBase(), AlignmentMonitorMuonResiduals::~AlignmentMonitorMuonResiduals(), AlignmentMonitorMuonSystemMap1D::~AlignmentMonitorMuonSystemMap1D(), AlignmentMonitorMuonVsCurvature::~AlignmentMonitorMuonVsCurvature(), AlignmentMonitorSegmentDifferences::~AlignmentMonitorSegmentDifferences(), AlignmentMonitorTemplate::~AlignmentMonitorTemplate(), AlignmentMonitorTracksFromTrajectories::~AlignmentMonitorTracksFromTrajectories(), pat::helper::AnythingToValueMap< Adaptor, Collection, value_type >::~AnythingToValueMap(), BadGlobalMuonTagger::~BadGlobalMuonTagger(), cms::BHFilter::~BHFilter(), calcTopMass::~calcTopMass(), CalibratedElectronProducerT< T >::~CalibratedElectronProducerT(), CalibratedPhotonProducerT< T >::~CalibratedPhotonProducerT(), CaloMuonMerger::~CaloMuonMerger(), cms::CATopJetProducer::~CATopJetProducer(), CosmicGenFilterLowE::~CosmicGenFilterLowE(), CosmicParametersDefinerForTP::~CosmicParametersDefinerForTP(), cms::CosmicTIFTrigFilter::~CosmicTIFTrigFilter(), CSCTightHalo2015Filter::~CSCTightHalo2015Filter(), CSCTightHaloFilter::~CSCTightHaloFilter(), CSCTightHaloTrkMuUnvetoFilter::~CSCTightHaloTrkMuUnvetoFilter(), cms::CSJetProducer::~CSJetProducer(), DiJetMonitor::~DiJetMonitor(), EcalBadCalibFilter::~EcalBadCalibFilter(), EcalLaserCorrFilter::~EcalLaserCorrFilter(), edm::EDLooper::~EDLooper(), EEBadScFilter::~EEBadScFilter(), EENoiseFilter::~EENoiseFilter(), ElectronIDExternalProducer< algo >::~ElectronIDExternalProducer(), reco::isodeposit::EventDependentAbsVeto::~EventDependentAbsVeto(), FakeTrackProducer< T >::~FakeTrackProducer(), pat::GenJetFlavourInfoPreserver::~GenJetFlavourInfoPreserver(), GlobalSuperTightHalo2016Filter::~GlobalSuperTightHalo2016Filter(), GlobalTightHalo2016Filter::~GlobalTightHalo2016Filter(), HcalStripHaloFilter::~HcalStripHaloFilter(), HGCalEgammaIDHelper::~HGCalEgammaIDHelper(), HistoFillerReco< l1extra::L1EmParticleCollection >::~HistoFillerReco(), pat::HLTL1MuonMatcher::~HLTL1MuonMatcher(), cms::HTTTopJetProducer::~HTTTopJetProducer(), JetCollectionReducerT< T >::~JetCollectionReducerT(), KFBasedPixelFitterProducer::~KFBasedPixelFitterProducer(), pat::L1MuonMatcher::~L1MuonMatcher(), LogErrorEventFilter::~LogErrorEventFilter(), pat::helper::ManyThingsToValueMaps< Adaptor, Collection, value_type >::~ManyThingsToValueMaps(), pat::MatcherUsingTracks::~MatcherUsingTracks(), METplusTrackMonitor::~METplusTrackMonitor(), MultiEventFilter::~MultiEventFilter(), modules::MuonCleanerBySegmentsT< T >::~MuonCleanerBySegmentsT(), cms::MuonMETValueMapProducer::~MuonMETValueMapProducer(), MuonReSeeder::~MuonReSeeder(), MuonSelectorVertex::~MuonSelectorVertex(), NjettinessAdder::~NjettinessAdder(), NTupler::~NTupler(), OutsideInMuonSeeder::~OutsideInMuonSeeder(), pat::helper::OverlapTest::~OverlapTest(), pat::PackedPFCandidateRefMixer::~PackedPFCandidateRefMixer(), ParticleListDrawer::~ParticleListDrawer(), pat::PATCleaner< PATObjType >::~PATCleaner(), PatElectronEAIsoCorrectionProducer::~PatElectronEAIsoCorrectionProducer(), pat::PATElectronSlimmer::~PATElectronSlimmer(), pat::PATGenJetSlimmer::~PATGenJetSlimmer(), pat::PATJetSlimmer::~PATJetSlimmer(), pat::PATMETSlimmer::~PATMETSlimmer(), pat::PATMuonSlimmer::~PATMuonSlimmer(), pat::PATObjectUserDataEmbedder< T >::~PATObjectUserDataEmbedder(), pat::PATPhotonSlimmer::~PATPhotonSlimmer(), pat::PATTauSlimmer::~PATTauSlimmer(), pat::PATTriggerEventProducer::~PATTriggerEventProducer(), pat::PATTriggerMatchEmbedder< PATObjectType >::~PATTriggerMatchEmbedder(), pat::PATTriggerObjectStandAloneSlimmer::~PATTriggerObjectStandAloneSlimmer(), pat::PATTriggerObjectStandAloneUnpacker::~PATTriggerObjectStandAloneUnpacker(), pat::PATTriggerProducer::~PATTriggerProducer(), pat::PATUserDataHelper< pat::pat::PFParticle >::~PATUserDataHelper(), pat::PATUserDataMerger< pat::pat::MET, pat::helper::AddUserInt >::~PATUserDataMerger(), PFEGammaToCandidateRemapper::~PFEGammaToCandidateRemapper(), PhotonIsolationCalculator::~PhotonIsolationCalculator(), PhotonMIPHaloTagger::~PhotonMIPHaloTagger(), PileUpSubtractor::~PileUpSubtractor(), Plotter::~Plotter(), QjetsAdder::~QjetsAdder(), RazorBox::~RazorBox(), RazorComputer::~RazorComputer(), SimpleFlatTableProducerBase< T, T >::~SimpleFlatTableProducerBase(), SiPixelPhase1Base::~SiPixelPhase1Base(), cms::SubJetProducer::~SubJetProducer(), tnp::TagProbePairMaker::~TagProbePairMaker(), TICLSeedingRegionProducer::~TICLSeedingRegionProducer(), fastsim::TrackerSimHitProducer::~TrackerSimHitProducer(), TrackFitterProducer::~TrackFitterProducer(), TrackingFailureFilter::~TrackingFailureFilter(), TrackingRegionsFromSuperClustersProducer::~TrackingRegionsFromSuperClustersProducer(), TriggerObjectFilterByCollection::~TriggerObjectFilterByCollection(), VariableComputer::~VariableComputer(), VariableComputerTest::~VariableComputerTest(), VariablePower::~VariablePower(), and XtoFFbarFilter::~XtoFFbarFilter().

const int iTCCEtaBounds[nTCCInEta+1] = {0, 7, 11, 28, 45, 49, 56}

Definition at line 150 of file GenABIO.cc.

Referenced by getABTCCInputStream().

const int iTTEtaMax[nABInEta] = {10, 27, 44, 55}

Definition at line 144 of file GenABIO.cc.

Referenced by fillABSRPFiles(), and fillABTTFFiles().

const int iTTEtaMin[nABInEta] = {0, 11, 28, 45}

Definition at line 143 of file GenABIO.cc.

Referenced by fillABSRPFiles(), and fillABTTFFiles().

const int iTTEtaSign[nABInEta] = {-1, -1, 1, 1}

Definition at line 145 of file GenABIO.cc.

Referenced by fillABSRPFiles(), and fillABTTFFiles().

const int nAB = nABInPhi * nABInEta

Definition at line 141 of file GenABIO.cc.

Referenced by abConnect(), fillABSRPFiles(), and main().

const int nABABCh = 8

Definition at line 137 of file GenABIO.cc.

Referenced by abConnect(), and fillABIOFiles().

const int nABInEta = 4

Number of ABs in a phi-sector

Definition at line 130 of file GenABIO.cc.

Referenced by fillABIOFiles(), and fillABTTFFiles().

const int nABInPhi = 3

Number of ABs in an eta slice

Definition at line 133 of file GenABIO.cc.

Referenced by fillABIOFiles(), fillABSRPFiles(), and fillABTTFFiles().

const int nABTCCCh = 12

Definition at line 138 of file GenABIO.cc.

Referenced by fillABIOFiles().

const int nactions = 8

Definition at line 179 of file GenABIO.cc.

Referenced by main().

const int nBarrelTTInEta = 34
static

Number of barrel trigger towers along eta

Definition at line 121 of file GenABIO.cc.

Referenced by abNum(), main(), and readSRF().

const int nDCCCh = 12

Definition at line 139 of file GenABIO.cc.

Referenced by fillABIOFiles().

const int nDCCEE = 9

Number of DCCs in an endcap

Definition at line 136 of file GenABIO.cc.

const int nEndcaps = 2
static
const int nEndcapTTInEta = 11
static

Number of trigger towers along eta in one endcap

Definition at line 118 of file GenABIO.cc.

Referenced by fillABSRPFiles(), and getABDCCOutputStream().

const int nEndcapXBins = 100
static

Range of the x-index of endcap crystals (xman-xmin+1).

Definition at line 100 of file GenABIO.cc.

Referenced by main().

const int nEndcapYBins = 100
static

Range of the y-index of endcap crystals (yman-ymin+1).

Definition at line 103 of file GenABIO.cc.

Referenced by main().

const int nSupercrystalXBins = nEndcapXBins / supercrystalEdge
static

Range of endcap supercrystal x-index (xmax-xmin+1)

Definition at line 109 of file GenABIO.cc.

Referenced by abNum(), fillABSRPFiles(), main(), and readSRF().

const int nSupercrystalYBins = nEndcapYBins / supercrystalEdge
static

Range of endcap supercrystal y-index (ymay-ymin+1)

Definition at line 112 of file GenABIO.cc.

Referenced by abNum(), fillABSRPFiles(), main(), and readSRF().

const int nTCCInEta = 6

Definition at line 140 of file GenABIO.cc.

const int nTTInABAlongPhi = nTTInPhi / nABInPhi

Definition at line 142 of file GenABIO.cc.

Referenced by fillABSRPFiles(), fillABTTFFiles(), and getABTTPhiBounds().

const int nTTInEta = 2 * nEndcapTTInEta + nBarrelTTInEta
static

Number of trigger towers along eta for the whole ECAL

Definition at line 124 of file GenABIO.cc.

Referenced by abNum(), getFlagStream(), main(), and readTTF().

const int nTTInPhi = 72
static

Number of trigger towers in an eta ring

Definition at line 127 of file GenABIO.cc.

Referenced by abNum(), getABTTPhiBounds(), main(), readSRF(), and readTTF().

char roFlagMarker[]
Initial value:
= {
'.',
'z',
'Z',
'F',
'4',
'5',
'6',
'7'}

Definition at line 169 of file GenABIO.cc.

Referenced by main(), writeABIOFileHeader(), and writeABSRFFileHeader().

const char* srfFilename = "SRF.txt"

Definition at line 159 of file GenABIO.cc.

Referenced by main(), and readSRF().

char srp2roFlags[128]

Definition at line 166 of file GenABIO.cc.

Referenced by fillABSRPFiles(), getABDCCOutputStream(), and main().

const char srpFlagMarker[] = {'.', 'S', 'N', 'C', '4', '5', '6', '7'}
const int supercrystalEdge = 5
static

Edge size of a supercrystal. A supercrystal is a tower of 5x5 crystals.

Definition at line 106 of file GenABIO.cc.

const char tccFlagMarker[] = {'.', 'S', '?', 'C', '4', '5', '6', '7'}
int theAB = -1

Definition at line 226 of file GenABIO.cc.

Referenced by main().

const char* ttfFilename = "TTF.txt"

Definition at line 160 of file GenABIO.cc.

Referenced by main(), and readTTF().

const char* xconnectFilename = "xconnect_universal.txt"

Definition at line 161 of file GenABIO.cc.

Referenced by abConnect().