Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:47:24

0001 //
0002 // This class collects the information
0003 // about the range of DAC settings used
0004 // in scans of the DACs.
0005 //
0006 //
0007 //
0008 
0009 #include "CalibFormats/SiPixelObjects/interface/PixelDACScanRange.h"
0010 #include "CalibFormats/SiPixelObjects/interface/PixelDACNames.h"
0011 #include <iostream>
0012 #include <cassert>
0013 
0014 using namespace pos;
0015 
0016 PixelDACScanRange::PixelDACScanRange(std::string name,
0017                                      unsigned int first,
0018                                      unsigned int last,
0019                                      unsigned int step,
0020                                      unsigned int index,
0021                                      bool mixValuesAcrossROCs) {
0022   uniformSteps_ = true;
0023   relative_ = false;
0024   negative_ = false;
0025 
0026   first_ = first;
0027   last_ = last;
0028   step_ = step;
0029 
0030   name_ = name;
0031   index_ = index;
0032   mixValuesAcrossROCs_ = mixValuesAcrossROCs;
0033   if (first_ == last_)
0034     assert(mixValuesAcrossROCs == false);
0035   while (first <= last) {
0036     values_.push_back(first);
0037     first += step;
0038     //FIXME should have a better reporting
0039     assert(values_.size() < 1000);
0040   }
0041 
0042   setDACChannel(name);
0043 }
0044 
0045 PixelDACScanRange::PixelDACScanRange(std::string name,
0046                                      const std::vector<unsigned int>& values,
0047                                      unsigned int index,
0048                                      bool mixValuesAcrossROCs) {
0049   uniformSteps_ = false;
0050   relative_ = false;
0051   negative_ = false;
0052 
0053   name_ = name;
0054   values_ = values;
0055   mixValuesAcrossROCs_ = mixValuesAcrossROCs;
0056   assert(mixValuesAcrossROCs == false);
0057 
0058   setDACChannel(name);
0059 }
0060 
0061 void PixelDACScanRange::setDACChannel(std::string name) {
0062   if (name == pos::k_DACName_Vdd) {
0063     dacchannel_ = pos::k_DACAddress_Vdd;
0064   } else if (name == pos::k_DACName_Vana) {
0065     dacchannel_ = pos::k_DACAddress_Vana;
0066   } else if (name == pos::k_DACName_Vsf) {
0067     dacchannel_ = pos::k_DACAddress_Vsf;
0068   } else if (name == pos::k_DACName_Vcomp) {
0069     dacchannel_ = pos::k_DACAddress_Vcomp;
0070   } else if (name == pos::k_DACName_Vleak) {
0071     dacchannel_ = pos::k_DACAddress_Vleak;
0072   } else if (name == pos::k_DACName_VrgPr) {
0073     dacchannel_ = pos::k_DACAddress_VrgPr;
0074   } else if (name == pos::k_DACName_VwllPr) {
0075     dacchannel_ = pos::k_DACAddress_VwllPr;
0076   } else if (name == pos::k_DACName_VrgSh) {
0077     dacchannel_ = pos::k_DACAddress_VrgSh;
0078   } else if (name == pos::k_DACName_VwllSh) {
0079     dacchannel_ = pos::k_DACAddress_VwllSh;
0080   } else if (name == pos::k_DACName_VHldDel) {
0081     dacchannel_ = pos::k_DACAddress_VHldDel;
0082   } else if (name == pos::k_DACName_Vtrim) {
0083     dacchannel_ = pos::k_DACAddress_Vtrim;
0084   } else if (name == pos::k_DACName_VcThr) {
0085     dacchannel_ = pos::k_DACAddress_VcThr;
0086   } else if (name == pos::k_DACName_VIbias_bus) {
0087     dacchannel_ = pos::k_DACAddress_VIbias_bus;
0088   } else if (name == pos::k_DACName_VIbias_sf) {
0089     dacchannel_ = pos::k_DACAddress_VIbias_sf;
0090   } else if (name == pos::k_DACName_VOffsetOp) {
0091     dacchannel_ = pos::k_DACAddress_VOffsetOp;
0092   } else if (name == pos::k_DACName_VbiasOp) {
0093     dacchannel_ = pos::k_DACAddress_VbiasOp;
0094   } else if (name == pos::k_DACName_VOffsetRO) {
0095     dacchannel_ = pos::k_DACAddress_VOffsetRO;
0096   } else if (name == pos::k_DACName_VIon) {
0097     dacchannel_ = pos::k_DACAddress_VIon;
0098   } else if (name == pos::k_DACName_VIbias_PH) {
0099     dacchannel_ = pos::k_DACAddress_VIbias_PH;
0100   } else if (name == pos::k_DACName_VIbias_DAC) {
0101     dacchannel_ = pos::k_DACAddress_VIbias_DAC;
0102   } else if (name == pos::k_DACName_VIbias_roc) {
0103     dacchannel_ = pos::k_DACAddress_VIbias_roc;
0104   } else if (name == pos::k_DACName_VIColOr) {
0105     dacchannel_ = pos::k_DACAddress_VIColOr;
0106   } else if (name == pos::k_DACName_Vnpix) {
0107     dacchannel_ = pos::k_DACAddress_Vnpix;
0108   } else if (name == pos::k_DACName_VsumCol) {
0109     dacchannel_ = pos::k_DACAddress_VsumCol;
0110   } else if (name == pos::k_DACName_Vcal) {
0111     dacchannel_ = pos::k_DACAddress_Vcal;
0112   } else if (name == pos::k_DACName_CalDel) {
0113     dacchannel_ = pos::k_DACAddress_CalDel;
0114   } else if (name == pos::k_DACName_WBC) {
0115     dacchannel_ = pos::k_DACAddress_WBC;
0116   } else if (name == pos::k_DACName_ChipContReg) {
0117     dacchannel_ = pos::k_DACAddress_ChipContReg;
0118   } else {
0119     std::cout << __LINE__ << "]\t[PixelDACScanRange::setDACChannel()]\t\t\t    "
0120               << "The dac name: " << name << " is unknown!" << std::endl;
0121     assert(0);
0122   }
0123 }