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 nBarrelEtaBins = 170
 
static const int nBarrelPhiBins = 360
 
static const int nBarrelTowerEtaBins = nBarrelEtaBins/5
 
static const int nBarrelTowerPhiBins = nBarrelPhiBins/5
 
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 nTTInABAlongEta =nTTInEta/nABInEta
 
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 193 of file GenABIO.cc.

Definition: GenABIO.cc:193
Definition: GenABIO.cc:193
Definition: GenABIO.cc:193
Definition: GenABIO.cc:193
Definition: GenABIO.cc:193
roAction_t
Definition: GenABIO.cc:193

Function Documentation

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

Definition at line 851 of file GenABIO.cc.

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

Referenced by getABABInputStream().

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

Definition at line 217 of file GenABIO.cc.

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

217 {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 472 of file GenABIO.cc.

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

Referenced by main().

475  {
476  for(int iABEta=0; iABEta < nABInEta; ++iABEta){
477  for(int iABPhi=0; iABPhi < nABInPhi; ++iABPhi){
478  int iAB = abNum(iABEta, iABPhi);
479  // writeABIOFileHeader(files[iAB], iAB);
480  files[iAB] << "# Event " << iEvent << "\n";
481  //TCC inputs:
482  for(int iTCC=0; iTCC< nABTCCCh; ++iTCC){
483  files[iAB] << "ITCC" << iTCC+1 << ":"
484  << getABTCCInputStream(ttFlags, iABEta, iABPhi, iTCC)
485  << "\n";
486  }
487  //AB inputs:
488  for(int iABCh=0; iABCh<nABABCh; ++iABCh){
489  files[iAB] << "IAB" << iABCh+1 << ":"
490  << getABABInputStream(ttFlags, iABEta, iABPhi, iABCh)
491  << "\n";
492  }
493  //AB outputs:
494  for(int iABCh=0; iABCh<nABABCh; ++iABCh){
495  files[iAB] << "OAB" << iABCh+1 << ":"
496  << getABABOutputStream(ttFlags, iABEta, iABPhi, iABCh)
497  << "\n";
498  }
499  //DCC output:
500  for(int iDCCCh=0; iDCCCh<nDCCCh; ++iDCCCh){
501  files[iAB] << "ODCC";
502  files[iAB]<< (iDCCCh<=8?"0":"") << iDCCCh+1 << ":"
503  << getABDCCOutputStream(barrelSrFlags, endcapSrFlags, iABEta, iABPhi,iDCCCh)
504  << "\n";
505  }
506  files[iAB] << "#\n";
507  }
508  }
509 }
string getABABInputStream(const char tccFlags[nTTInEta][nTTInPhi], int iABEta, int iABPhi, int iABCh)
Definition: GenABIO.cc:834
const int nABInEta
Definition: GenABIO.cc:154
tuple files
Definition: linker.py:146
int iEvent
Definition: GenABIO.cc:243
const int nABTCCCh
Definition: GenABIO.cc:162
string getABABOutputStream(const char tccFlags[nTTInEta][nTTInPhi], int iABEta, int iABPhi, int iABCh)
Definition: GenABIO.cc:766
const int nDCCCh
Definition: GenABIO.cc:163
string getABTCCInputStream(const char tccFlags[nTTInEta][nTTInPhi], int iABEta, int iABPhi, int iTCCCh)
Definition: GenABIO.cc:736
const int nABInPhi
Definition: GenABIO.cc:157
int abNum(int iABEta, int iABPhi)
Definition: GenABIO.cc:217
const int nABABCh
Definition: GenABIO.cc:161
string getABDCCOutputStream(const char barrelSrFlags[nBarrelTTInEta][nTTInPhi], const char endcapSrFlags[nEndcaps][nSupercrystalXBins][nSupercrystalYBins], int iABEta, int iABPhi, int DCCCh)
Definition: GenABIO.cc:891
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 402 of file GenABIO.cc.

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

405  {
406  //event headers:
407  for(int iAB=0; iAB < nAB; ++iAB){
408  files[iAB] << "# Event " << iEvent << "\n";
409  }
410 
411  bool lineAppended[nAB];
412  for(int i=0; i< nAB; lineAppended[i++]=false)/*empty*/;
413 
414  //EE:
415  for(int iEE = 0; iEE < nEndcaps; ++iEE){
416  for(int iX = 0; iX < nSupercrystalXBins; ++iX){
417  for(int iY=0; iY < nSupercrystalYBins; ++iY){
418  // int iDCC = dccIndex(iEE==0?0:2,iX*5,iY*5);
419  int iDCC = dccIndexOfRU(iEE==0?0:2,iX,iY);
420  if(iDCC>=0){
421  int iAB = abOfDcc(iDCC);
422  if(!lineAppended[iAB]){
423  for(int i=0; i< iY; ++i) files[iAB] << ' ';
424  }
425  files[iAB] << srp2roFlags[(int)endcapSrFlags[iEE][iX][iY]];
426  lineAppended[iAB] = true;
427  }
428  }//next iY
429  for(int iFile=0; iFile< nAB; ++iFile){
430  if(lineAppended[iFile]){
431  files[iFile] << "\n";
432  lineAppended[iFile] = false;
433  }
434  }
435  }//next iX
436  }
437 
438  //EB:
439  for(int iABEta=1; iABEta<3; ++iABEta){
440  for(int iABPhi=0; iABPhi<nABInPhi; ++iABPhi){
441  int iAB = abNum(iABEta,iABPhi);
442  int iTTPhiMin;
443  int iTTPhiMax;
444  getABTTPhiBounds(iABPhi, iTTPhiMin, iTTPhiMax);
445  //writeEventHeader(files[iAB], iEvent, nTTInABAlongPhi);
446  for(int i = 0 ; i <= iTTEtaMax[iABEta]-iTTEtaMin[iABEta];
447  ++i){
448  int iTTEta;
449  if(iTTEtaSign[iABEta]>0){
450  iTTEta = iTTEtaMin[iABEta] + i;
451  } else{
452  iTTEta = iTTEtaMax[iABEta] - i;
453  }
454  for(int iTTPhi = iTTPhiMin;
455  mod(iTTPhiMax-iTTPhi,nTTInPhi) < nTTInABAlongPhi;
456  iTTPhi = mod(++iTTPhi, nTTInPhi)){
457  files[iAB] << srp2roFlags[(int)barrelSrFlags[iTTEta-nEndcapTTInEta][iTTPhi]];
458  }
459  files[iAB] << "\n";
460  }
461  // writeEventTrailer(files[iAB], nTTInABAlongPhi);
462  files[iAB] << "#\n";
463  }
464  }
465 
466  //file trailers
467  for(int iAB=0; iAB < nAB; ++iAB){
468  files[iAB] << "#\n";
469  }
470 }
const int iTTEtaMin[nABInEta]
Definition: GenABIO.cc:168
int i
Definition: DBlmapReader.cc:9
static const int nSupercrystalXBins
Definition: GenABIO.cc:126
char srp2roFlags[128]
Definition: GenABIO.cc:191
void getABTTPhiBounds(int iABPhi, int &iTTPhiMin, int &iTTPhiMax)
Definition: GenABIO.cc:846
tuple files
Definition: linker.py:146
int iEvent
Definition: GenABIO.cc:243
const int iTTEtaMax[nABInEta]
Definition: GenABIO.cc:169
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:129
const int iTTEtaSign[nABInEta]
Definition: GenABIO.cc:170
static const int nEndcaps
Definition: GenABIO.cc:138
const int nTTInABAlongPhi
Definition: GenABIO.cc:167
static const int nTTInPhi
Definition: GenABIO.cc:151
const int nABInPhi
Definition: GenABIO.cc:157
static const int nEndcapTTInEta
Definition: GenABIO.cc:141
const int nAB
Definition: GenABIO.cc:165
int abNum(int iABEta, int iABPhi)
Definition: GenABIO.cc:217
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 370 of file GenABIO.cc.

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

Referenced by main().

371  {
372  for(int iABEta=0; iABEta<nABInEta; ++iABEta){
373  for(int iABPhi=0; iABPhi<nABInPhi; ++iABPhi){
374  int iAB = abNum(iABEta,iABPhi);
375  int iTTPhiMin;
376  int iTTPhiMax;
377  getABTTPhiBounds(iABPhi, iTTPhiMin, iTTPhiMax);
378  // writeEventHeader(files[iAB], iEvent, nTTInABAlongPhi);
379  files[iAB] << "# Event " << iEvent << "\n";
380 
381  for(int i = 0 ; i <= iTTEtaMax[iABEta]-iTTEtaMin[iABEta];
382  ++i){
383  int iTTEta;
384  if(iTTEtaSign[iABEta]>0){
385  iTTEta = iTTEtaMin[iABEta] + i;
386  } else{
387  iTTEta = iTTEtaMax[iABEta] - i;
388  }
389  for(int iTTPhi = iTTPhiMin;
390  mod(iTTPhiMax-iTTPhi,nTTInPhi) < nTTInABAlongPhi;
391  iTTPhi = mod(++iTTPhi, nTTInPhi)){
392  files[iAB] << ttFlags[iTTEta][iTTPhi];
393  }
394  files[iAB] << "\n";
395  }
396  files[iAB] << "#\n";
397  //writeEventTrailer(files[iAB], nTTInABAlongPhi);
398  }
399  }
400 }
const int iTTEtaMin[nABInEta]
Definition: GenABIO.cc:168
int i
Definition: DBlmapReader.cc:9
const int nABInEta
Definition: GenABIO.cc:154
void getABTTPhiBounds(int iABPhi, int &iTTPhiMin, int &iTTPhiMax)
Definition: GenABIO.cc:846
tuple files
Definition: linker.py:146
int iEvent
Definition: GenABIO.cc:243
const int iTTEtaMax[nABInEta]
Definition: GenABIO.cc:169
const int iTTEtaSign[nABInEta]
Definition: GenABIO.cc:170
const int nTTInABAlongPhi
Definition: GenABIO.cc:167
static const int nTTInPhi
Definition: GenABIO.cc:151
const int nABInPhi
Definition: GenABIO.cc:157
int abNum(int iABEta, int iABPhi)
Definition: GenABIO.cc:217
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 834 of file GenABIO.cc.

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

Referenced by fillABIOFiles().

835  {
836  int iAB = abNum(iABEta, iABPhi);
837  int iOtherAB; //AB which this channel is connected to
838  int iOtherABCh; //ch # on the other side of the AB-AB link
839  abConnect(iAB,iABCh,iOtherAB,iOtherABCh);
840  int iOtherABEta = iOtherAB/3;
841  int iOtherABPhi = iOtherAB%3;
842  return getABABOutputStream(tccFlags, iOtherABEta, iOtherABPhi, iOtherABCh);
843 }
string getABABOutputStream(const char tccFlags[nTTInEta][nTTInPhi], int iABEta, int iABPhi, int iABCh)
Definition: GenABIO.cc:766
void abConnect(int iAB, int iABCh, int &iOtherAB, int &iOtherABCh)
Definition: GenABIO.cc:851
int abNum(int iABEta, int iABPhi)
Definition: GenABIO.cc:217
string getABABOutputStream ( const char  tccFlags[nTTInEta][nTTInPhi],
int  iABEta,
int  iABPhi,
int  iABCh 
)

Definition at line 766 of file GenABIO.cc.

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

Referenced by fillABIOFiles(), and getABABInputStream().

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

Definition at line 891 of file GenABIO.cc.

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

Referenced by fillABIOFiles().

894  {
895  bool barrel = (iABEta==1||iABEta==2);
896  if(barrel){
897  //same as TCC with same ch number but with TCC flags replaced by SRP flags:
898  string stream = getABTCCInputStream(barrelSrFlags-nEndcapTTInEta, iABEta, iABPhi, iDCCCh);
899  //converts srp flags to readout flags:
900  for(size_t i=0; i< stream.size(); ++i){
901  stream[i] = srp2roFlags[(int)stream[i]];
902  }
903  return stream;
904  } else{//endcap
905  if(iDCCCh<3){//used DCC output channel
906  //endcap index:
907  int iEE=(iABEta==0)?0:1;
908  stringstream buffer("");
909  //3 DCC per AB and AB DCC output channel in
910  //increasing DCC phi position:
911  int iDCCPhi = iABPhi*3+iDCCCh;
912  for(size_t iSC=0; iSC < ecalDccSC[iEE][iDCCPhi].size(); ++iSC){
913  pair<int,int> sc = ecalDccSC[iEE][iDCCPhi][iSC];
914  buffer << srp2roFlags[(int)endcapSrFlags[iEE][sc.first][sc.second]];
915  }
916  return buffer.str();
917  } else{//unused output channel
918  return "";
919  }
920  }
921 }
int i
Definition: DBlmapReader.cc:9
char srp2roFlags[128]
Definition: GenABIO.cc:191
string getABTCCInputStream(const char tccFlags[nTTInEta][nTTInPhi], int iABEta, int iABPhi, int iTCCCh)
Definition: GenABIO.cc:736
static const int nEndcapTTInEta
Definition: GenABIO.cc:141
vector< pair< int, int > > ecalDccSC[nEndcaps][nDCCEE]
Definition: GenABIO.cc:204
string getABTCCInputStream ( const char  tccFlags[nTTInEta][nTTInPhi],
int  iABEta,
int  iABPhi,
int  iTCCCh 
)

Definition at line 736 of file GenABIO.cc.

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

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

737  {
738  //gets eta bounds for this tcc channel:
739  int iTCCEta;
740  if(iABEta==1 || iABEta==2){//barrel
741  if(iTCCCh>5) return ""; //only 6 TCCs per AB for barrel
742  iTCCEta = 1 + iABEta;
743  } else{//endcap
744  if(iABEta==0){//EE-
745  iTCCEta = (iTCCCh<6)?1:0;
746  } else{//EE+
747  iTCCEta = (iTCCCh<6)?4:5;
748  }
749  }
750  int iEtaMin = iTCCEtaBounds[iTCCEta];
751  int iEtaMax = iTCCEtaBounds[iTCCEta+1]-1;
752 
753  //gets phi bounds:
754  int iPhiMin;
755  int iPhiMax;
756  getABTTPhiBounds(iABPhi, iPhiMin, iPhiMax);
757  //phi is increasing with TTC channel number
758  //a TTC covers a 4TT-wide phi-sector
759  //=>iPhiMin(iTTCCh) = iPhiMin(AB) + 4*iTTCCh for iTCCCh<6
760  iPhiMin += 4*(iTCCCh%6);
761  iPhiMax = iPhiMin + 4 - 1;
762 
763  return getFlagStream(tccFlags, iEtaMin, iEtaMax, iPhiMin, iPhiMax);
764 }
void getABTTPhiBounds(int iABPhi, int &iTTPhiMin, int &iTTPhiMax)
Definition: GenABIO.cc:846
string getFlagStream(char flags[nTTInEta][nTTInPhi], int iEtaMin, int iEtaMax, int iPhiMin, int iPhiMax)
Definition: GenABIO.cc:702
const int iTCCEtaBounds[nTCCInEta+1]
Definition: GenABIO.cc:175
void getABTTPhiBounds ( int  iABPhi,
int &  iTTPhiMin,
int &  iTTPhiMax 
)

Definition at line 846 of file GenABIO.cc.

References mod(), nTTInABAlongPhi, and nTTInPhi.

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

846  {
847  iTTPhiMin = mod(-6+iABPhi*nTTInABAlongPhi,nTTInPhi);
848  iTTPhiMax = mod(iTTPhiMin+nTTInABAlongPhi-1, nTTInPhi);
849 }
const int nTTInABAlongPhi
Definition: GenABIO.cc:167
static const int nTTInPhi
Definition: GenABIO.cc:151
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 702 of file GenABIO.cc.

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

Referenced by getABTCCInputStream().

703  {
704  assert(0<=iEtaMin && iEtaMin<=iEtaMax && iEtaMax<nTTInEta);
705  if(iEtaMin<=nTTInEta/2 && iEtaMax>nTTInEta){
706  cerr << "Implementation Errror:"
707  << __FILE__ << ":" << __LINE__
708  << ": A flag stream cannot covers parts of both half-ECAL!"
709  << endl;
710  exit(EXIT_FAILURE);
711  }
712 
713  bool zPos = (iEtaMin>=nTTInEta/2);
714 
715  stringstream buffer;
716  buffer.str("");
717  for(int jEta = 0; jEta <= iEtaMax-iEtaMin; ++jEta){
718  //loops on iEta in |eta| increasing order:
719  int iEta;
720  if(zPos){
721  iEta = iEtaMin + jEta;
722  } else{
723  iEta = iEtaMax - jEta;
724  }
725 
726  for(int iPhi = mod(iPhiMin,nTTInPhi);
727  mod(iPhiMax+1-iPhi,nTTInPhi) != 0;
728  iPhi = mod(++iPhi, nTTInPhi)){
729  buffer << flags[iEta][iPhi];
730  }
731  }
732 
733  return buffer.str();
734 }
double zPos
std::vector< Variable::Flags > flags
Definition: MVATrainer.cc:135
static const int nTTInEta
Definition: GenABIO.cc:147
static const int nTTInPhi
Definition: GenABIO.cc:151
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
int main ( int  argc,
char *  argv[] 
)

Definition at line 247 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().

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

Definition at line 553 of file GenABIO.cc.

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

Referenced by main().

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

Definition at line 519 of file GenABIO.cc.

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

Referenced by main().

519  {
520  char* buffer = NULL;
521  size_t bufferSize = 0;
522  int read;
523  if(f==NULL) exit(EXIT_FAILURE);
524  int line=0;
525  int iEta = 0;
526  while(iEta<nTTInEta && (read=getline(&buffer, &bufferSize,f))!=-1){
527  ++line;
528  char* pos = buffer;
529  while(*pos==' ' || *pos=='\t') ++pos; //skip spaces
530  if(*pos!='#' && *pos!='\n'){//not a comment line nor an empty line
531  if(read-1!=nTTInPhi){
532  cerr << "Error: line " << line
533  << " of file "<< ttfFilename << " has incorrect length"
534  // << " (" << read-1 << " instead of " << nTTInPhi << ")"
535  << endl;
536  exit(EXIT_FAILURE);
537  }
538  for(int iPhi=0; iPhi<nTTInPhi; ++iPhi){
539  ttFlags[iEta][iPhi] = buffer[iPhi];
540  // if(ttFlags[iEta][iPhi]!='.'){
541  // cout << __FILE__ << ":" << __LINE__ << ": "
542  // << iEta << "," << iPhi
543  // << " " << ttFlags[iEta][iPhi] << "\n";
544  // }
545  }
546  ++iEta;
547  }
548  }
549  //returns true if all TT were read (not at end of file)
550  return (iEta==nTTInEta)?true:false;
551 }
#define NULL
Definition: scimark2.h:8
double f[11][100]
static const int nTTInEta
Definition: GenABIO.cc:147
static const int nTTInPhi
Definition: GenABIO.cc:151
const char * ttfFilename
Definition: GenABIO.cc:185
void writeABIOFileHeader ( ofstream &  f,
int  abNum 
)

Definition at line 683 of file GenABIO.cc.

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

Referenced by main().

683  {
684  time_t t;
685  time(&t);
686  const char* date = ctime(&t);
687  f << "# AB " << abNum+1 <<" I/O \n#\n"
688  "# Generated on : " << date << "#\n"
689  "# " << srpFlagMarker[0] << ": 000 (low interest) " << tccFlagMarker[0] << ": 000 (low interest) " << roFlagMarker[0] << ": 000 (suppress)\n"
690  "# " << srpFlagMarker[1] << ": 001 (single) " << tccFlagMarker[1] << ": 001 (mid interest) " << roFlagMarker[1] << ": 010 (SR Threshold 2)\n"
691  "# " << srpFlagMarker[2] << ": 010 (neighbour) " << tccFlagMarker[2] << ": 010 (not valid) " << roFlagMarker[2] << ": 001 (SR Threshold 1)\n"
692  "# " << srpFlagMarker[3] << ": 011 (center) " << tccFlagMarker[3] << ": 011 (high interest) " << roFlagMarker[3] << ": 011 (Full readout)\n"
693  "#\n"
694  "# action table (when forced):\n"
695  "# LI-> " << roFlagMarker[actions[0]] << " (" << roFlagMarker[actions[4]]<< ")" << "\n"
696  "# S -> " << roFlagMarker[actions[1]] << " (" << roFlagMarker[actions[5]]<< ")" << "\n"
697  "# N -> " << roFlagMarker[actions[2]] << " (" << roFlagMarker[actions[6]]<< ")" << "\n"
698  "# C -> " << roFlagMarker[actions[3]] << " (" << roFlagMarker[actions[7]]<< ")" << "\n"
699  "#\n";
700 }
roAction_t actions[nactions]
Definition: GenABIO.cc:200
const char tccFlagMarker[]
Definition: GenABIO.cc:189
double f[11][100]
char roFlagMarker[]
Definition: GenABIO.cc:194
int abNum(int iABEta, int iABPhi)
Definition: GenABIO.cc:217
const char srpFlagMarker[]
Definition: GenABIO.cc:188
void writeABSRFFileHeader ( ofstream &  f,
int  abNum 
)

Definition at line 656 of file GenABIO.cc.

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

Referenced by main().

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

Definition at line 643 of file GenABIO.cc.

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

Referenced by main().

643  {
644  time_t t;
645  time(&t);
646  const char* date = ctime(&t);
647  f << "# TTF flag map covered by AB " << abNum+1 <<"\n#\n"
648  "# Generated on : " << date << "#\n"
649  "# +---> Phi " << srpFlagMarker[0] << ": 000 (low interest)\n"
650  "# | " << srpFlagMarker[1] << ": 001 (single)\n"
651  "# | " << srpFlagMarker[2] << ": 010 (neighbour)\n"
652  "# V |Eta| " << srpFlagMarker[3] << ": 011 (center)\n"
653  "#\n";
654 }
double f[11][100]
int abNum(int iABEta, int iABPhi)
Definition: GenABIO.cc:217
const char srpFlagMarker[]
Definition: GenABIO.cc:188

Variable Documentation

const char* abIOFilePostfix = ".txt"

Definition at line 182 of file GenABIO.cc.

Referenced by main().

const char* abIOFilePrefix = "IO_AB"

Definition at line 181 of file GenABIO.cc.

Referenced by main().

const char* abSRFFilePostfix = ".txt"

Definition at line 180 of file GenABIO.cc.

Referenced by main().

const char* abSRFFilePrefix = "AF_AB"

Definition at line 179 of file GenABIO.cc.

Referenced by main().

const char* abTTFFilePostfix = ".txt"

Definition at line 178 of file GenABIO.cc.

Referenced by main().

const char* abTTFFilePrefix = "TTF_AB"

Definition at line 177 of file GenABIO.cc.

Referenced by main().

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

Definition at line 204 of file GenABIO.cc.

Referenced by getABDCCOutputStream(), and main().

int iEvent = 0

Definition at line 243 of file GenABIO.cc.

Referenced by SiStripGainFromData::algoAnalyze(), Digi2Raw2Digi::analyze(), RawDataConverter::analyze(), HcalDigiTester::analyze(), HLTMonPhotonSource::analyze(), EcalSimRawData::analyze(), HLTMonElectron::analyze(), HLTMon::analyze(), CastorDumpConditions::analyze(), HcalDigisValidation::analyze(), FFTJetTreeDump::analyze(), CSCSkim::beginJob(), RPCNoise::beginJob(), pat::LeptonVertexSignificance::calculate(), VarSplitter::eval(), VariablePower::eval(), TCTauAlgorithm::eventSetup(), ConfigurableHisto::fill(), fillABIOFiles(), fillABSRPFiles(), fillABTTFFiles(), MuonTimingFiller::fillTiming(), ConfigurableAnalysis::filter(), CSCSkim::filter(), RPCNoise::filter(), CSCEfficiency::filter(), FWFileEntry::filterEventsWithCustomParser(), MuonDetLayerMeasurements::groupedMeasurements(), main(), FWEventItemsManager::newEvent(), SubjetFilterJetProducer::output(), cms::CompoundJetProducer::output(), VirtualJetProducer::output(), pf2pat::TopProjectorAlgo< Top, Bottom >::processCollection(), PFRootEventManager::processEntry(), TtDilepEvtSolutionMaker::produce(), TtSemiEvtSolutionMaker::produce(), EcalSelectiveReadoutProducer::produce(), pat::MatcherUsingTracks::produce(), PFLinker::produce(), SiStripFineDelayHit::produce(), pf2pat::TopProjectorAlgo< Top, Bottom >::produce(), TriggerSummaryProducerAOD::produce(), FFTJetPatRecoProducer::produce(), FFTJetProducer::produce(), SiStripFineDelayHit::produceNoTracking(), PFRootEventManager::readFromSimulation(), MuonDetLayerMeasurements::recHits(), KalmanAlignmentAlgorithm::run(), edm::IndexIntoFile::set_intersection(), PFTauDiscriminants::PFTauDiscriminantManager::setEvent(), and FWEventItem::setEvent().

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

Definition at line 175 of file GenABIO.cc.

Referenced by getABTCCInputStream().

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

Definition at line 169 of file GenABIO.cc.

Referenced by fillABSRPFiles(), and fillABTTFFiles().

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

Definition at line 168 of file GenABIO.cc.

Referenced by fillABSRPFiles(), and fillABTTFFiles().

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

Definition at line 170 of file GenABIO.cc.

Referenced by fillABSRPFiles(), and fillABTTFFiles().

const int nAB = nABInPhi*nABInEta

Definition at line 165 of file GenABIO.cc.

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

const int nABABCh = 8

Definition at line 161 of file GenABIO.cc.

Referenced by abConnect(), and fillABIOFiles().

const int nABInEta =4

Number of ABs in a phi-sector

Definition at line 154 of file GenABIO.cc.

Referenced by fillABIOFiles(), and fillABTTFFiles().

const int nABInPhi =3

Number of ABs in an eta slice

Definition at line 157 of file GenABIO.cc.

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

const int nABTCCCh = 12

Definition at line 162 of file GenABIO.cc.

Referenced by fillABIOFiles().

const int nactions = 8

Definition at line 198 of file GenABIO.cc.

Referenced by main().

const int nBarrelEtaBins = 170
static

Number of crystals along eta in barrel

Definition at line 111 of file GenABIO.cc.

const int nBarrelPhiBins = 360
static

Number of crystals in a eta ring of the barrel

Definition at line 114 of file GenABIO.cc.

const int nBarrelTowerEtaBins = nBarrelEtaBins/5
static

Number of trigger tower along eta in the barrel

Definition at line 132 of file GenABIO.cc.

const int nBarrelTowerPhiBins = nBarrelPhiBins/5
static

Number of trigger tower in a eta ring of the barrel

Definition at line 135 of file GenABIO.cc.

const int nBarrelTTInEta = 34
static

Number of barrel trigger towers along eta

Definition at line 144 of file GenABIO.cc.

Referenced by main(), and readSRF().

const int nDCCCh = 12

Definition at line 163 of file GenABIO.cc.

Referenced by fillABIOFiles().

const int nDCCEE = 9

Number of DCCs in an endcap

Definition at line 160 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 141 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 117 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 120 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 126 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 129 of file GenABIO.cc.

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

const int nTCCInEta = 6

Definition at line 164 of file GenABIO.cc.

const int nTTInABAlongEta =nTTInEta/nABInEta

Definition at line 166 of file GenABIO.cc.

const int nTTInABAlongPhi =nTTInPhi/nABInPhi

Definition at line 167 of file GenABIO.cc.

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

const int nTTInEta
static
Initial value:
=
static const int nBarrelTTInEta
Definition: GenABIO.cc:144
static const int nEndcapTTInEta
Definition: GenABIO.cc:141

Number of trigger towers along eta for the whole ECAL

Definition at line 147 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 151 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 194 of file GenABIO.cc.

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

const char* srfFilename = "SRF.txt"

Definition at line 184 of file GenABIO.cc.

Referenced by main(), and readSRF().

char srp2roFlags[128]

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

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

Definition at line 245 of file GenABIO.cc.

Referenced by main().

const char* ttfFilename = "TTF.txt"

Definition at line 185 of file GenABIO.cc.

Referenced by main(), and readTTF().

const char* xconnectFilename = "xconnect_universal.txt"

Definition at line 186 of file GenABIO.cc.

Referenced by abConnect().