23 for (
int itower = 0; itower < 17664; itower++) {
38 fMeanPed[sm][ircu][branchHG][fecHG][chipHG][channelHG] = obj.
getPedestalValue(itower,
false,
false);
39 fMeanPed[sm][ircu][branchLG][fecLG][chipLG][channelLG] = obj.
getPedestalValue(itower,
true,
false);
42 for (
int iledmon = 0; iledmon < 480; iledmon++) {
43 int sm = iledmon / 24,
58 fMeanPed[sm][ircu][branchHG][fecHG][chipHG][channelHG] = obj.
getPedestalValue(iledmon,
false,
true);
59 fMeanPed[sm][ircu][branchLG][fecLG][chipLG][channelLG] = obj.
getPedestalValue(iledmon,
true,
true);
62 return createInstructionString(runNum);
65void EMCALPedestalHelper::setZero()
67 for (
int ism = 0; ism < kNSM; ism++) {
68 for (
int ircu = 0; ircu < kNRCU; ircu++) {
69 for (
int ibranch = 0; ibranch < kNBranch; ibranch++) {
70 for (
int ifec = 0; ifec < kNFEC; ifec++) {
71 for (
int ichip = 0; ichip < kNChip; ichip++) {
72 for (
int ichan = 0; ichan < kNChan; ichan++) {
73 fMeanPed[ism][ircu][ibranch][ifec][ichip][ichan] = 0;
82std::vector<char> EMCALPedestalHelper::createInstructionString(
const int runNum)
84 std::stringstream fout;
87 fout << runNum << std::endl;
90 unsigned int lineValue = 0;
92 const unsigned int FECheaderCode = 0xC0000000;
94 const unsigned int FEClineCode = 0x40000000;
96 const unsigned int TrailerLineCode = 0xFFFFFFFF;
107 for (iSM = 0; iSM < kNSM; iSM++) {
114 std::bitset<kNDTC> activeDTC;
115 for (iDTC = 0; iDTC < kNDTC; iDTC++) {
116 if (iDTC == 10 || iDTC == 20 || iDTC == 30) {
122 if (iSM == 10 || iSM == 19) {
128 }
else if (iSM == 11 || iSM == 18) {
129 if (iDTC == 0 || iDTC >= 27) {
136 if ((iDTC >= 9 && iDTC <= 13) || (iDTC >= 23 && iDTC <= 26) ||
137 (iDTC >= 36 && iDTC <= 39)) {
148 for (iDTC = 0; iDTC < kNDTC; iDTC++) {
149 if (activeDTC[iDTC] == 0) {
153 lineValue = FECheaderCode | isect << 9 | iside << 8 | iDTC;
154 fout << lineValue << std::endl;
157 ibranch = (iDTC % 20) / 10;
159 int ipos = iFEC + 10 * ibranch;
164 dtcselLower = (1 << ipos);
166 dtcselUpper = (1 << ipos);
169 for (ichip = 0; ichip < kNChip; ichip++) {
171 for (ichan = 0; ichan < kNChan; ichan++) {
172 if (iFEC != 0 || (ichan < 8 || ichan > 11)) {
173 Ped = fMeanPed[iSM][iRCU][ibranch][iFEC][ichip][ichan];
174 int writeAddr = (ichip << 4) | ichan;
175 lineValue = FEClineCode | (writeAddr << 12) | Ped;
176 fout << lineValue << std::endl;
186 fout << TrailerLineCode << std::endl;
189 const std::string instructionString(fout.str());
190 std::vector<char>
output(instructionString.begin(), instructionString.end());
196 std::ofstream fout(
filename.data());
static int getAltroIndexFromHwAddress(int hwaddress)
Extracting ALTRO index from the hardware address.
static int getChannelIndexFromHwAddress(int hwaddress)
Extracting Channel index in FEC from the hardware address.
static int getFecIndexFromHwAddress(int hwaddress)
Extracting FEC index in branch from the hardware address.
static int getBranchIndexFromHwAddress(int hwaddress)
Extracting branch index from the hardware address.
void dumpInstructions(const std::string_view filename, const gsl::span< char > &data)
print the vector produced by createInstructionString in a textfile
std::vector< char > createPedestalInstruction(const Pedestal &obj, const int runNum=-1)
Encodes the pedestal object into a string. This function fills fMeanPed which is then converted to a ...
EMCAL geometry definition.
static Geometry * GetInstanceFromRunNumber(Int_t runNumber, const std::string_view="", const std::string_view mcname="TGeant3", const std::string_view mctitle="")
Instanciate geometry depending on the run number. Mostly used in analysis and MC anchors.
std::tuple< int, int, int, int > GetCellIndex(Int_t absId) const
Get cell SM, module numbers from absolute ID number.
std::tuple< int, int, int > getOnlineID(int towerID)
Get link ID, row and column from cell ID, have a look here: https://alice.its.cern....
unsigned int getHardwareAddress(uint8_t row, uint8_t col, ChannelType_t channeltype) const
Get the hardware address for a channel.
Handler providing the correct mapping for the given DDL.
Mapper & getMappingForDDL(unsigned int ddl)
Get Mapping for given DDL.
CCDB container for pedestal values.
short getPedestalValue(unsigned short cellID, bool isLowGain, bool isLEDMON) const
Get the time calibration coefficient for a certain cell.
@ HIGH_GAIN
High gain channel.
@ LOW_GAIN
Low gain channel.
@ LEDMON
LED monitor channel.