CMS 3D CMS Logo

PixelFEDCard.h
Go to the documentation of this file.
1 #ifndef TP_PIXELFEDCARD_H
2 #define TP_PIXELFEDCARD_H
3 
11 
12 #include <vector>
13 #include <string>
14 #include <cstdint>
15 
16 namespace pos {
27  class PixelFEDCard : public PixelConfigBase {
28  public:
29  //Return true or false depending on if iChannel is used
30  //iChannel=1..36
31  bool useChannel(unsigned int iChannel);
32 
33  //Set iChannel enable to mode
34  //iChannel=1..36
35  void setChannel(unsigned int iChannel, bool mode);
36 
39 
40  // Constructor and destructor
41  PixelFEDCard(); // empty
42  PixelFEDCard(std::string filename); // create from files
43  PixelFEDCard(std::vector<std::vector<std::string> > &tab); // create from DB
44  ~PixelFEDCard() override{};
45 
46  void readDBTBMLevels(std::vector<std::vector<std::string> > &tableMat, int first, int last);
47  void readDBROCLevels(std::vector<std::vector<std::string> > &tableMat, int first, int last);
48  void writeASCII(std::string dir = "") const override; // write to files
49  void writeXML(pos::PixelConfigKey key, int version, std::string path) const override;
50  void writeXMLHeader(pos::PixelConfigKey key, int version, std::string path, std::ofstream *out) const override;
51  void writeXML(std::ofstream *out) const override;
52  void writeXMLTrailer(std::ofstream *out) const override;
54  int version,
56  std::ofstream *fedstream,
57  std::ofstream *roclvlstream,
58  std::ofstream *tbmlvlsteram) const override;
59  void writeXML(std::ofstream *fedstream, std::ofstream *rocstream, std::ofstream *tbmstream) const override;
60  void writeXMLTrailer(std::ofstream *fedstream, std::ofstream *recostream, std::ofstream *tbmstream) const override;
61  uint64_t enabledChannels(); // returns 64-bit integer mask 35..0
62 
63  //Settable optical input parameters (one for each 12-receiver)
64  int opt_cap[3]; // Capacitor adjust
65  int opt_inadj[3]; // DC-input offset
66  int opt_ouadj[3]; // DC-output offset
67 
68  //input offset dac (one for each channel)
69  int offs_dac[36];
70 
71  //clock phases, use bits 0-8, select the clock edge
73 
74  //Channel delays, one for each channel, 0=15
75  int DelayCh[36];
76 
77  //Blacks and Ultra-blacks, 3 limit per channel
78  int BlackHi[36];
79  int BlackLo[36];
80  int Ublack[36];
81 
82  //Signal levels for the TBM, one per channel
83  int TBM_L0[36], TBM_L1[36], TBM_L2[36], TBM_L3[36], TBM_L4[36];
84  int TRL_L0[36], TRL_L1[36], TRL_L2[36], TRL_L3[36], TRL_L4[36];
85  // Address levels 1 per channel (36) per roc(max=26)
86  int ROC_L0[36][26], ROC_L1[36][26], ROC_L2[36][26], ROC_L3[36][26], ROC_L4[36][26];
87 
88  //These bits turn off(1) and on(0) channels
89  unsigned int Ncntrl, NCcntrl, SCcntrl, Scntrl;
90 
91  //The values as read from file so that they can be restored after
92  //calibration
94 
95  //Bits (1st 8) used to mask TBM trailer bits
97 
98  //Bits (1st 8) used to set the Private Word in the gap and filler words
99  unsigned int N_Pword, NC_Pword, SC_Pword, S_Pword;
100 
101  // 1 = Special Random trigger DAC mode on, 0=off
102  unsigned int SpecialDac;
103 
104  // Control register and delays for the TTCrx
106  unsigned int ClkDes2;
107 
108  //Main control reg for determining the DAQ mode
109  unsigned int Ccntrl; // "CtrlReg" in LAD_C
110 
111  //Mode register
112  int modeRegister; // "ModeReg" in LAD_C
113 
114  //Number of ROCS per FED channel
115  int NRocs[36];
116 
117  //Control Regs for setting ADC 1Vpp and 2Vpp
118  unsigned int Nadcg, NCadcg, SCadcg, Sadcg;
119 
120  //Control and data Regs for setting Baseline Adjustment
121  unsigned int Nbaseln, NCbaseln, SCbaseln, Sbaseln;
122 
123  //data Regs for TTs adjustable levels
125 
126  //data Regs adjustable fifo Almost Full levels
128 
129  //Master delay for FED TTC signals
131 
132  //data Regs adjustable hit limits in fifo1s by fpga
134 
135  //data Regs to skip bad ROCs by fpga
137 
138  //The values as read from file so that they can be restored after
139  //calibration
141 
144 
145  //VME base address
146  unsigned long FEDBASE_0, fedNumber;
147 
148  // Most recent additions requested by Will and Danek (Dario)
157  int SPARE1;
158  int SPARE2;
159  int SPARE3;
160  int SPARE4;
161  int SPARE5;
162  int SPARE6;
163  int SPARE7;
164  int SPARE8;
165  int SPARE9;
166  int SPARE10;
167 
168  private:
169  // Added by Dario (March 26th 2008)
170  void clear(void);
171 
172  }; // end class PixelFEDCard
173 } // namespace pos
174 /* @} */
175 #endif // ifdef include
unsigned long FEDBASE_0
Definition: PixelFEDCard.h:146
This file contains the base class for "pixel configuration data" management.
int ROC_L3[36][26]
Definition: PixelFEDCard.h:86
unsigned int ClkDes2
Definition: PixelFEDCard.h:106
unsigned int SC_Pword
Definition: PixelFEDCard.h:99
void restoreBaselinAndChannelMasks()
unsigned int NCbaseln
Definition: PixelFEDCard.h:121
void restoreControlAndModeRegister()
unsigned int Scntrl
Definition: PixelFEDCard.h:89
unsigned int S_Pword
Definition: PixelFEDCard.h:99
unsigned int SCbaseln
Definition: PixelFEDCard.h:121
int ROC_L4[36][26]
Definition: PixelFEDCard.h:86
void readDBROCLevels(std::vector< std::vector< std::string > > &tableMat, int first, int last)
unsigned int Sadcg
Definition: PixelFEDCard.h:118
unsigned int Sbaseln
Definition: PixelFEDCard.h:121
bool useChannel(unsigned int iChannel)
unsigned int NC_TBMmask
Definition: PixelFEDCard.h:96
This file contains the base class for "pixel configuration data" management.
unsigned int Nbaseln
Definition: PixelFEDCard.h:121
void readDBTBMLevels(std::vector< std::vector< std::string > > &tableMat, int first, int last)
~PixelFEDCard() override
Definition: PixelFEDCard.h:44
unsigned int N_TBMmask
Definition: PixelFEDCard.h:96
unsigned int Nadcg
Definition: PixelFEDCard.h:118
unsigned int S_TBMmask
Definition: PixelFEDCard.h:96
int ROC_L0[36][26]
Definition: PixelFEDCard.h:86
unsigned int Ccntrl
Definition: PixelFEDCard.h:109
unsigned int NC_Pword
Definition: PixelFEDCard.h:99
unsigned int NCadcg
Definition: PixelFEDCard.h:118
void writeXML(pos::PixelConfigKey key, int version, std::string path) const override
This class implements..
unsigned int SCadcg
Definition: PixelFEDCard.h:118
unsigned int SC_TBMmask
Definition: PixelFEDCard.h:96
unsigned int NCcntrl_original
Definition: PixelFEDCard.h:93
unsigned int clkphs1_9
Definition: PixelFEDCard.h:72
unsigned long long uint64_t
Definition: Time.h:13
unsigned int Ncntrl_original
Definition: PixelFEDCard.h:93
unsigned int clkphs19_27
Definition: PixelFEDCard.h:72
void writeXMLTrailer(std::ofstream *out) const override
unsigned int clkphs10_18
Definition: PixelFEDCard.h:72
unsigned int N_Pword
Definition: PixelFEDCard.h:99
unsigned int SpecialDac
Definition: PixelFEDCard.h:102
uint64_t enabledChannels()
void setChannel(unsigned int iChannel, bool mode)
void writeASCII(std::string dir="") const override
int ROC_L2[36][26]
Definition: PixelFEDCard.h:86
unsigned int Scntrl_original
Definition: PixelFEDCard.h:93
unsigned int Ncntrl
Definition: PixelFEDCard.h:89
This is the documentation about PixelFEDCard...
Definition: PixelFEDCard.h:27
unsigned int SCcntrl
Definition: PixelFEDCard.h:89
unsigned long fedNumber
Definition: PixelFEDCard.h:146
unsigned int NCcntrl
Definition: PixelFEDCard.h:89
unsigned int clkphs28_36
Definition: PixelFEDCard.h:72
unsigned int SCcntrl_original
Definition: PixelFEDCard.h:93
int ROC_L1[36][26]
Definition: PixelFEDCard.h:86
void writeXMLHeader(pos::PixelConfigKey key, int version, std::string path, std::ofstream *out) const override