CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Macros | Enumerations | Functions | Variables
GenABIO.cc File Reference
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <cassert>
#include <cstdlib>
#include <cstring>
#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
 
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 180 of file GenABIO.cc.

Definition: GenABIO.cc:180
Definition: GenABIO.cc:180
Definition: GenABIO.cc:180
Definition: GenABIO.cc:180
Definition: GenABIO.cc:180
roAction_t
Definition: GenABIO.cc:180

Function Documentation

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

Definition at line 838 of file GenABIO.cc.

References EnergyCorrector::c, dtNoiseDBValidation_cfg::cerr, cmsRelvalreport::exit, f, i, nAB, nABABCh, NULL, and xconnectFilename.

Referenced by getABABInputStream().

838  {
839  static bool firstCall = true;
840  static int xconnectMap[nAB][nABABCh][2];
841  if(firstCall){
842  FILE* f = fopen(xconnectFilename, "r");
843  if(f==NULL){
844  cerr << "Error. Failed to open xconnect definition file,"
845  << xconnectFilename << endl;
846  exit(EXIT_FAILURE);
847  }
848  //skips two first lines:
849  for(int i=0; i<2; ++i){
850  int c;
851  while((c=getc(f))!='\n' && c >=0);
852  }
853  int ilink = 0 ;
854  while(!feof(f)){
855  int abIn;
856  int pinIn;
857  int abOut;
858  int pinOut;
859  if(4==fscanf(f, "%d\t%d\t%d\t%d", &abIn, &pinIn, &abOut, &pinOut)){
860  xconnectMap[abIn][pinIn][0] = abOut;
861  xconnectMap[abIn][pinIn][1] = pinOut;
862  ++ilink;
863  }
864  }
865  if(ilink!=nAB*nABABCh){
866  cerr << "Error cross-connect definition file " << xconnectFilename
867  << " contains an unexpected number of link definition."
868  << endl;
869  exit(EXIT_FAILURE);
870  }
871  firstCall = false;
872  }
873 
874  iOtherAB = xconnectMap[iAB][iABCh][0];
875  iOtherABCh = xconnectMap[iAB][iABCh][1];
876 }
int i
Definition: DBlmapReader.cc:9
#define NULL
Definition: scimark2.h:8
double f[11][100]
const char * xconnectFilename
Definition: GenABIO.cc:173
const int nAB
Definition: GenABIO.cc:153
const int nABABCh
Definition: GenABIO.cc:149
int abNum ( int  iABEta,
int  iABPhi 
)
inline

Definition at line 204 of file GenABIO.cc.

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

204 {return 3*iABEta+iABPhi;}
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 << ":"
471  << getABTCCInputStream(ttFlags, iABEta, iABPhi, iTCC)
472  << "\n";
473  }
474  //AB inputs:
475  for(int iABCh=0; iABCh<nABABCh; ++iABCh){
476  files[iAB] << "IAB" << iABCh+1 << ":"
477  << getABABInputStream(ttFlags, iABEta, iABPhi, iABCh)
478  << "\n";
479  }
480  //AB outputs:
481  for(int iABCh=0; iABCh<nABABCh; ++iABCh){
482  files[iAB] << "OAB" << iABCh+1 << ":"
483  << getABABOutputStream(ttFlags, iABEta, iABPhi, iABCh)
484  << "\n";
485  }
486  //DCC output:
487  for(int iDCCCh=0; iDCCCh<nDCCCh; ++iDCCCh){
488  files[iAB] << "ODCC";
489  files[iAB]<< (iDCCCh<=8?"0":"") << iDCCCh+1 << ":"
490  << getABDCCOutputStream(barrelSrFlags, endcapSrFlags, iABEta, iABPhi,iDCCCh)
491  << "\n";
492  }
493  files[iAB] << "#\n";
494  }
495  }
496 }
string getABABInputStream(const char tccFlags[nTTInEta][nTTInPhi], int iABEta, int iABPhi, int iABCh)
Definition: GenABIO.cc:821
const int nABInEta
Definition: GenABIO.cc:142
int iEvent
Definition: GenABIO.cc:230
const int nABTCCCh
Definition: GenABIO.cc:150
string getABABOutputStream(const char tccFlags[nTTInEta][nTTInPhi], int iABEta, int iABPhi, int iABCh)
Definition: GenABIO.cc:753
const int nDCCCh
Definition: GenABIO.cc:151
string getABTCCInputStream(const char tccFlags[nTTInEta][nTTInPhi], int iABEta, int iABPhi, int iTCCCh)
Definition: GenABIO.cc:723
const int nABInPhi
Definition: GenABIO.cc:145
int abNum(int iABEta, int iABPhi)
Definition: GenABIO.cc:204
const int nABABCh
Definition: GenABIO.cc:149
string getABDCCOutputStream(const char barrelSrFlags[nBarrelTTInEta][nTTInPhi], const char endcapSrFlags[nEndcaps][nSupercrystalXBins][nSupercrystalYBins], int iABEta, int iABPhi, int DCCCh)
Definition: GenABIO.cc:878
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 389 of file GenABIO.cc.

References abNum(), abOfDcc(), dccIndexOfRU(), MainPageGenerator::files, getABTTPhiBounds(), i, iEvent, 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  //EE:
402  for(int iEE = 0; iEE < nEndcaps; ++iEE){
403  for(int iX = 0; iX < nSupercrystalXBins; ++iX){
404  for(int iY=0; iY < nSupercrystalYBins; ++iY){
405  // int iDCC = dccIndex(iEE==0?0:2,iX*5,iY*5);
406  int iDCC = dccIndexOfRU(iEE==0?0:2,iX,iY);
407  if(iDCC>=0){
408  int iAB = abOfDcc(iDCC);
409  if(!lineAppended[iAB]){
410  for(int i=0; i< iY; ++i) files[iAB] << ' ';
411  }
412  files[iAB] << srp2roFlags[(int)endcapSrFlags[iEE][iX][iY]];
413  lineAppended[iAB] = true;
414  }
415  }//next iY
416  for(int iFile=0; iFile< nAB; ++iFile){
417  if(lineAppended[iFile]){
418  files[iFile] << "\n";
419  lineAppended[iFile] = false;
420  }
421  }
422  }//next iX
423  }
424 
425  //EB:
426  for(int iABEta=1; iABEta<3; ++iABEta){
427  for(int iABPhi=0; iABPhi<nABInPhi; ++iABPhi){
428  int iAB = abNum(iABEta,iABPhi);
429  int iTTPhiMin;
430  int iTTPhiMax;
431  getABTTPhiBounds(iABPhi, iTTPhiMin, iTTPhiMax);
432  //writeEventHeader(files[iAB], iEvent, nTTInABAlongPhi);
433  for(int i = 0 ; i <= iTTEtaMax[iABEta]-iTTEtaMin[iABEta];
434  ++i){
435  int iTTEta;
436  if(iTTEtaSign[iABEta]>0){
437  iTTEta = iTTEtaMin[iABEta] + i;
438  } else{
439  iTTEta = iTTEtaMax[iABEta] - i;
440  }
441  for(int iTTPhi = iTTPhiMin;
442  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:155
int i
Definition: DBlmapReader.cc:9
static const int nSupercrystalXBins
Definition: GenABIO.cc:120
char srp2roFlags[128]
Definition: GenABIO.cc:178
void getABTTPhiBounds(int iABPhi, int &iTTPhiMin, int &iTTPhiMax)
Definition: GenABIO.cc:833
int iEvent
Definition: GenABIO.cc:230
const int iTTEtaMax[nABInEta]
Definition: GenABIO.cc:156
int abOfDcc(int iDCC)
Definition: ecalDccMap.h:104
int dccIndexOfRU(int iDet, int i, int j)
Definition: ecalDccMap.h:88
static const int nSupercrystalYBins
Definition: GenABIO.cc:123
const int iTTEtaSign[nABInEta]
Definition: GenABIO.cc:157
static const int nEndcaps
Definition: GenABIO.cc:126
const int nTTInABAlongPhi
Definition: GenABIO.cc:154
static const int nTTInPhi
Definition: GenABIO.cc:139
const int nABInPhi
Definition: GenABIO.cc:145
static const int nEndcapTTInEta
Definition: GenABIO.cc:129
const int nAB
Definition: GenABIO.cc:153
int abNum(int iABEta, int iABPhi)
Definition: GenABIO.cc:204
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 357 of file GenABIO.cc.

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

Referenced by main().

358  {
359  for(int iABEta=0; iABEta<nABInEta; ++iABEta){
360  for(int iABPhi=0; iABPhi<nABInPhi; ++iABPhi){
361  int iAB = abNum(iABEta,iABPhi);
362  int iTTPhiMin;
363  int iTTPhiMax;
364  getABTTPhiBounds(iABPhi, iTTPhiMin, iTTPhiMax);
365  // writeEventHeader(files[iAB], iEvent, nTTInABAlongPhi);
366  files[iAB] << "# Event " << iEvent << "\n";
367 
368  for(int i = 0 ; i <= iTTEtaMax[iABEta]-iTTEtaMin[iABEta];
369  ++i){
370  int iTTEta;
371  if(iTTEtaSign[iABEta]>0){
372  iTTEta = iTTEtaMin[iABEta] + i;
373  } else{
374  iTTEta = iTTEtaMax[iABEta] - i;
375  }
376  for(int iTTPhi = iTTPhiMin;
377  mod(iTTPhiMax-iTTPhi,nTTInPhi) < nTTInABAlongPhi;
378  iTTPhi = mod(++iTTPhi, nTTInPhi)){
379  files[iAB] << ttFlags[iTTEta][iTTPhi];
380  }
381  files[iAB] << "\n";
382  }
383  files[iAB] << "#\n";
384  //writeEventTrailer(files[iAB], nTTInABAlongPhi);
385  }
386  }
387 }
const int iTTEtaMin[nABInEta]
Definition: GenABIO.cc:155
int i
Definition: DBlmapReader.cc:9
const int nABInEta
Definition: GenABIO.cc:142
void getABTTPhiBounds(int iABPhi, int &iTTPhiMin, int &iTTPhiMax)
Definition: GenABIO.cc:833
int iEvent
Definition: GenABIO.cc:230
const int iTTEtaMax[nABInEta]
Definition: GenABIO.cc:156
const int iTTEtaSign[nABInEta]
Definition: GenABIO.cc:157
const int nTTInABAlongPhi
Definition: GenABIO.cc:154
static const int nTTInPhi
Definition: GenABIO.cc:139
const int nABInPhi
Definition: GenABIO.cc:145
int abNum(int iABEta, int iABPhi)
Definition: GenABIO.cc:204
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 821 of file GenABIO.cc.

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

Referenced by fillABIOFiles().

822  {
823  int iAB = abNum(iABEta, iABPhi);
824  int iOtherAB; //AB which this channel is connected to
825  int iOtherABCh; //ch # on the other side of the AB-AB link
826  abConnect(iAB,iABCh,iOtherAB,iOtherABCh);
827  int iOtherABEta = iOtherAB/3;
828  int iOtherABPhi = iOtherAB%3;
829  return getABABOutputStream(tccFlags, iOtherABEta, iOtherABPhi, iOtherABCh);
830 }
string getABABOutputStream(const char tccFlags[nTTInEta][nTTInPhi], int iABEta, int iABPhi, int iABCh)
Definition: GenABIO.cc:753
void abConnect(int iAB, int iABCh, int &iOtherAB, int &iOtherABCh)
Definition: GenABIO.cc:838
int abNum(int iABEta, int iABPhi)
Definition: GenABIO.cc:204
string getABABOutputStream ( const char  tccFlags[nTTInEta][nTTInPhi],
int  iABEta,
int  iABPhi,
int  iABCh 
)

Definition at line 753 of file GenABIO.cc.

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

Referenced by fillABIOFiles(), and getABABInputStream().

754  {
755  stringstream buffer;
756  buffer.str("");
757  bool barrel = (iABEta==1 || iABEta==2); //true for barrel, false for endcap
758  switch(iABCh){
759  case 0:
760  //to AB ch #0 are sent the 16 1st TCC flags received on TCC input Ch. 0
761  buffer << getABTCCInputStream(tccFlags, iABEta, iABPhi, 0).substr(0,16);
762  break;
763  case 1:
764  //to AB ch #1 are sent the 16 1st TCC flags received on TCC input Ch. 0 to 5:
765  for(int iTCCCh=0; iTCCCh<6; ++iTCCCh){
766  buffer <<
767  getABTCCInputStream(tccFlags, iABEta, iABPhi, iTCCCh).substr(0,16);
768  }
769  break;
770  case 2:
771  //to AB ch #2 are sent the 16 1st TCC flags received on TCC input Ch. 5:
772  buffer << getABTCCInputStream(tccFlags, iABEta, iABPhi, 5).substr(0,16);
773  break;
774  case 3:
775  //to AB ch #3 are sent TCC flags received on TCC input Ch. 0 and 6:
776  buffer << getABTCCInputStream(tccFlags, iABEta, iABPhi, 0);
777  buffer << getABTCCInputStream(tccFlags, iABEta, iABPhi, 6);
778  break;
779  case 4:
780  //to AB ch #4 are sent TCC flags received on TCC input Ch 5 and 11:
781  buffer << getABTCCInputStream(tccFlags, iABEta, iABPhi, 5);
782  buffer << getABTCCInputStream(tccFlags, iABEta, iABPhi, 11);
783  break;
784  case 5:
785  //for endcaps AB output ch 5 is not used.
786  //for barrel, to AB ch #5 are sent the 16 last TCC flags received on TCC
787  //input Ch. 0:
788  if(barrel){//in barrel
789  string s = getABTCCInputStream(tccFlags, iABEta, iABPhi, 0);
790  assert(s.size()>=16);
791  buffer << s.substr(s.size()-16,16);
792  }
793  break;
794  case 6:
795  //for endcaps AB output ch 6 is not used.
796  //for barrel, to AB ch #6 are sent the 16 last TCC flags received on TCC
797  //input Ch. 0 to 5:
798  if(barrel){//in barrel
799  for(int iTCCCh=0; iTCCCh<6; ++iTCCCh){
800  string s = getABTCCInputStream(tccFlags, iABEta, iABPhi, iTCCCh);
801  buffer << s.substr(s.size()-16,16);
802  }
803  }
804  break;
805  case 7:
806  //for endcaps AB output ch 7 is not used.
807  //for barrel, to AB ch #7 are sent the 16 last TCC flags received on TCC
808  //input Ch. 5:
809  if(barrel){//in barrel
810  string s = getABTCCInputStream(tccFlags, iABEta, iABPhi, 5);
811  assert(s.size()>=16);
812  buffer << s.substr(s.size()-16,16);
813  }
814  break;
815  default:
816  assert(false);
817  }
818  return buffer.str();
819 }
assert(m_qm.get())
string getABTCCInputStream(const char tccFlags[nTTInEta][nTTInPhi], int iABEta, int iABPhi, int iTCCCh)
Definition: GenABIO.cc:723
string getABDCCOutputStream ( const char  barrelSrFlags[nBarrelTTInEta][nTTInPhi],
const char  endcapSrFlags[nEndcaps][nSupercrystalXBins][nSupercrystalYBins],
int  iABEta,
int  iABPhi,
int  DCCCh 
)

Definition at line 878 of file GenABIO.cc.

References Reference_intrackfit_cff::barrel, ecalDccSC, getABTCCInputStream(), i, nEndcapTTInEta, srp2roFlags, and edmStreamStallGrapher::stream.

Referenced by fillABIOFiles().

881  {
882  bool barrel = (iABEta==1||iABEta==2);
883  if(barrel){
884  //same as TCC with same ch number but with TCC flags replaced by SRP flags:
885  string stream = getABTCCInputStream(barrelSrFlags-nEndcapTTInEta, iABEta, iABPhi, iDCCCh);
886  //converts srp flags to readout flags:
887  for(size_t i=0; i< stream.size(); ++i){
888  stream[i] = srp2roFlags[(int)stream[i]];
889  }
890  return stream;
891  } else{//endcap
892  if(iDCCCh<3){//used DCC output channel
893  //endcap index:
894  int iEE=(iABEta==0)?0:1;
895  stringstream buffer("");
896  //3 DCC per AB and AB DCC output channel in
897  //increasing DCC phi position:
898  int iDCCPhi = iABPhi*3+iDCCCh;
899  for(size_t iSC=0; iSC < ecalDccSC[iEE][iDCCPhi].size(); ++iSC){
900  pair<int,int> sc = ecalDccSC[iEE][iDCCPhi][iSC];
901  buffer << srp2roFlags[(int)endcapSrFlags[iEE][sc.first][sc.second]];
902  }
903  return buffer.str();
904  } else{//unused output channel
905  return "";
906  }
907  }
908 }
int i
Definition: DBlmapReader.cc:9
char srp2roFlags[128]
Definition: GenABIO.cc:178
string getABTCCInputStream(const char tccFlags[nTTInEta][nTTInPhi], int iABEta, int iABPhi, int iTCCCh)
Definition: GenABIO.cc:723
static const int nEndcapTTInEta
Definition: GenABIO.cc:129
vector< pair< int, int > > ecalDccSC[nEndcaps][nDCCEE]
Definition: GenABIO.cc:191
string getABTCCInputStream ( const char  tccFlags[nTTInEta][nTTInPhi],
int  iABEta,
int  iABPhi,
int  iTCCCh 
)

Definition at line 723 of file GenABIO.cc.

References getABTTPhiBounds(), getFlagStream(), and iTCCEtaBounds.

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

724  {
725  //gets eta bounds for this tcc channel:
726  int iTCCEta;
727  if(iABEta==1 || iABEta==2){//barrel
728  if(iTCCCh>5) return ""; //only 6 TCCs per AB for barrel
729  iTCCEta = 1 + iABEta;
730  } else{//endcap
731  if(iABEta==0){//EE-
732  iTCCEta = (iTCCCh<6)?1:0;
733  } else{//EE+
734  iTCCEta = (iTCCCh<6)?4:5;
735  }
736  }
737  int iEtaMin = iTCCEtaBounds[iTCCEta];
738  int iEtaMax = iTCCEtaBounds[iTCCEta+1]-1;
739 
740  //gets phi bounds:
741  int iPhiMin;
742  int iPhiMax;
743  getABTTPhiBounds(iABPhi, iPhiMin, iPhiMax);
744  //phi is increasing with TTC channel number
745  //a TTC covers a 4TT-wide phi-sector
746  //=>iPhiMin(iTTCCh) = iPhiMin(AB) + 4*iTTCCh for iTCCCh<6
747  iPhiMin += 4*(iTCCCh%6);
748  iPhiMax = iPhiMin + 4 - 1;
749 
750  return getFlagStream(tccFlags, iEtaMin, iEtaMax, iPhiMin, iPhiMax);
751 }
void getABTTPhiBounds(int iABPhi, int &iTTPhiMin, int &iTTPhiMax)
Definition: GenABIO.cc:833
string getFlagStream(char flags[nTTInEta][nTTInPhi], int iEtaMin, int iEtaMax, int iPhiMin, int iPhiMax)
Definition: GenABIO.cc:689
const int iTCCEtaBounds[nTCCInEta+1]
Definition: GenABIO.cc:162
void getABTTPhiBounds ( int  iABPhi,
int &  iTTPhiMin,
int &  iTTPhiMax 
)

Definition at line 833 of file GenABIO.cc.

References mod(), nTTInABAlongPhi, and nTTInPhi.

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

833  {
834  iTTPhiMin = mod(-6+iABPhi*nTTInABAlongPhi,nTTInPhi);
835  iTTPhiMax = mod(iTTPhiMin+nTTInABAlongPhi-1, nTTInPhi);
836 }
const int nTTInABAlongPhi
Definition: GenABIO.cc:154
static const int nTTInPhi
Definition: GenABIO.cc:139
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 689 of file GenABIO.cc.

References assert(), dtNoiseDBValidation_cfg::cerr, cmsRelvalreport::exit, flags, mod(), nTTInEta, and zPos.

Referenced by getABTCCInputStream().

690  {
691  assert(0<=iEtaMin && iEtaMin<=iEtaMax && iEtaMax<nTTInEta);
692  if(iEtaMin<=nTTInEta/2 && iEtaMax>nTTInEta){
693  cerr << "Implementation Errror:"
694  << __FILE__ << ":" << __LINE__
695  << ": A flag stream cannot covers parts of both half-ECAL!"
696  << endl;
697  exit(EXIT_FAILURE);
698  }
699 
700  bool zPos = (iEtaMin>=nTTInEta/2);
701 
702  stringstream buffer;
703  buffer.str("");
704  for(int jEta = 0; jEta <= iEtaMax-iEtaMin; ++jEta){
705  //loops on iEta in |eta| increasing order:
706  int iEta;
707  if(zPos){
708  iEta = iEtaMin + jEta;
709  } else{
710  iEta = iEtaMax - jEta;
711  }
712 
713  for(int iPhi = mod(iPhiMin,nTTInPhi);
714  mod(iPhiMax+1-iPhi,nTTInPhi) != 0;
715  iPhi = mod(++iPhi, nTTInPhi)){
716  buffer << flags[iEta][iPhi];
717  }
718  }
719 
720  return buffer.str();
721 }
double zPos
assert(m_qm.get())
std::vector< Variable::Flags > flags
Definition: MVATrainer.cc:135
static const int nTTInEta
Definition: GenABIO.cc:135
static const int nTTInPhi
Definition: GenABIO.cc:139
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
int main ( int  argc,
char *  argv[] 
)

CALO JETS


PF JETS

Definition at line 234 of file GenABIO.cc.

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

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

Definition at line 540 of file GenABIO.cc.

References dtNoiseDBValidation_cfg::cerr, cmsRelvalreport::exit, geometryCSVtoXML::line, nBarrelTTInEta, nEndcaps, nSupercrystalXBins, nSupercrystalYBins, nTTInPhi, NULL, SiPixelLorentzAngle_cfi::read, and srfFilename.

Referenced by main().

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

Definition at line 506 of file GenABIO.cc.

References dtNoiseDBValidation_cfg::cerr, cmsRelvalreport::exit, geometryCSVtoXML::line, nTTInEta, nTTInPhi, NULL, SiPixelLorentzAngle_cfi::read, and ttfFilename.

Referenced by main().

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

Definition at line 670 of file GenABIO.cc.

References actions, roFlagMarker, srpFlagMarker, edmStreamStallGrapher::t, tccFlagMarker, and cond::rpcobgas::time.

Referenced by main().

670  {
671  time_t t;
672  time(&t);
673  const char* date = ctime(&t);
674  f << "# AB " << abNum+1 <<" I/O \n#\n"
675  "# Generated on : " << date << "#\n"
676  "# " << srpFlagMarker[0] << ": 000 (low interest) " << tccFlagMarker[0] << ": 000 (low interest) " << roFlagMarker[0] << ": 000 (suppress)\n"
677  "# " << srpFlagMarker[1] << ": 001 (single) " << tccFlagMarker[1] << ": 001 (mid interest) " << roFlagMarker[1] << ": 010 (SR Threshold 2)\n"
678  "# " << srpFlagMarker[2] << ": 010 (neighbour) " << tccFlagMarker[2] << ": 010 (not valid) " << roFlagMarker[2] << ": 001 (SR Threshold 1)\n"
679  "# " << srpFlagMarker[3] << ": 011 (center) " << tccFlagMarker[3] << ": 011 (high interest) " << roFlagMarker[3] << ": 011 (Full readout)\n"
680  "#\n"
681  "# action table (when forced):\n"
682  "# LI-> " << roFlagMarker[actions[0]] << " (" << roFlagMarker[actions[4]]<< ")" << "\n"
683  "# S -> " << roFlagMarker[actions[1]] << " (" << roFlagMarker[actions[5]]<< ")" << "\n"
684  "# N -> " << roFlagMarker[actions[2]] << " (" << roFlagMarker[actions[6]]<< ")" << "\n"
685  "# C -> " << roFlagMarker[actions[3]] << " (" << roFlagMarker[actions[7]]<< ")" << "\n"
686  "#\n";
687 }
roAction_t actions[nactions]
Definition: GenABIO.cc:187
const char tccFlagMarker[]
Definition: GenABIO.cc:176
double f[11][100]
char roFlagMarker[]
Definition: GenABIO.cc:181
int abNum(int iABEta, int iABPhi)
Definition: GenABIO.cc:204
const char srpFlagMarker[]
Definition: GenABIO.cc:175
void writeABSRFFileHeader ( ofstream &  f,
int  abNum 
)

Definition at line 643 of file GenABIO.cc.

References actions, roFlagMarker, edmStreamStallGrapher::t, and cond::rpcobgas::time.

Referenced by main().

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

Definition at line 630 of file GenABIO.cc.

References srpFlagMarker, edmStreamStallGrapher::t, and cond::rpcobgas::time.

Referenced by main().

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

Variable Documentation

const char* abIOFilePostfix = ".txt"

Definition at line 169 of file GenABIO.cc.

Referenced by main().

const char* abIOFilePrefix = "IO_AB"

Definition at line 168 of file GenABIO.cc.

Referenced by main().

const char* abSRFFilePostfix = ".txt"

Definition at line 167 of file GenABIO.cc.

Referenced by main().

const char* abSRFFilePrefix = "AF_AB"

Definition at line 166 of file GenABIO.cc.

Referenced by main().

const char* abTTFFilePostfix = ".txt"

Definition at line 165 of file GenABIO.cc.

Referenced by main().

const char* abTTFFilePrefix = "TTF_AB"

Definition at line 164 of file GenABIO.cc.

Referenced by main().

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

Definition at line 191 of file GenABIO.cc.

Referenced by getABDCCOutputStream(), and main().

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

Definition at line 162 of file GenABIO.cc.

Referenced by getABTCCInputStream().

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

Definition at line 156 of file GenABIO.cc.

Referenced by fillABSRPFiles(), and fillABTTFFiles().

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

Definition at line 155 of file GenABIO.cc.

Referenced by fillABSRPFiles(), and fillABTTFFiles().

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

Definition at line 157 of file GenABIO.cc.

Referenced by fillABSRPFiles(), and fillABTTFFiles().

const int nAB = nABInPhi*nABInEta

Definition at line 153 of file GenABIO.cc.

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

const int nABABCh = 8

Definition at line 149 of file GenABIO.cc.

Referenced by abConnect(), and fillABIOFiles().

const int nABInEta =4

Number of ABs in a phi-sector

Definition at line 142 of file GenABIO.cc.

Referenced by fillABIOFiles(), and fillABTTFFiles().

const int nABInPhi =3

Number of ABs in an eta slice

Definition at line 145 of file GenABIO.cc.

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

const int nABTCCCh = 12

Definition at line 150 of file GenABIO.cc.

Referenced by fillABIOFiles().

const int nactions = 8

Definition at line 185 of file GenABIO.cc.

Referenced by main().

const int nBarrelTTInEta = 34
static

Number of barrel trigger towers along eta

Definition at line 132 of file GenABIO.cc.

Referenced by main(), and readSRF().

const int nDCCCh = 12

Definition at line 151 of file GenABIO.cc.

Referenced by fillABIOFiles().

const int nDCCEE = 9

Number of DCCs in an endcap

Definition at line 148 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 129 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 111 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 114 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 120 of file GenABIO.cc.

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

const int nSupercrystalYBins = nEndcapYBins/supercrystalEdge
static

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

Definition at line 123 of file GenABIO.cc.

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

const int nTCCInEta = 6

Definition at line 152 of file GenABIO.cc.

const int nTTInABAlongPhi =nTTInPhi/nABInPhi

Definition at line 154 of file GenABIO.cc.

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

const int nTTInEta
static
Initial value:
=
static const int nBarrelTTInEta
Definition: GenABIO.cc:132
static const int nEndcapTTInEta
Definition: GenABIO.cc:129

Number of trigger towers along eta for the whole ECAL

Definition at line 135 of file GenABIO.cc.

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

const int nTTInPhi = 72
static

Number of trigger towers in an eta ring

Definition at line 139 of file GenABIO.cc.

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

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

Definition at line 181 of file GenABIO.cc.

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

const char* srfFilename = "SRF.txt"

Definition at line 171 of file GenABIO.cc.

Referenced by main(), and readSRF().

char srp2roFlags[128]

Definition at line 178 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 117 of file GenABIO.cc.

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

Definition at line 232 of file GenABIO.cc.

Referenced by main().

const char* ttfFilename = "TTF.txt"

Definition at line 172 of file GenABIO.cc.

Referenced by main(), and readTTF().

const char* xconnectFilename = "xconnect_universal.txt"

Definition at line 173 of file GenABIO.cc.

Referenced by abConnect().