CMS 3D CMS Logo

Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Private Attributes

SiPixelSCurveCalibrationAnalysis Class Reference

#include <CalibTracker/SiPixelSCurveCalibration/src/SiPixelSCurveCalibrationAnalysis.cc>

Inheritance diagram for SiPixelSCurveCalibrationAnalysis:
SiPixelOfflineCalibAnalysisBase edm::EDAnalyzer

List of all members.

Public Member Functions

void buildACurveHistogram (const uint32_t &detid, const uint32_t &row, const uint32_t &col, sCurveErrorFlag errorFlag, const std::vector< float > &efficiencies, const std::vector< float > &errors)
virtual bool doFits (uint32_t detid, std::vector< SiPixelCalibDigi >::const_iterator ipix)
void doSetup (const edm::ParameterSet &)
sCurveErrorFlag estimateSCurveParameters (const std::vector< float > &eff, float &threshold, float &sigma)
sCurveErrorFlag fittedSCurveSanityCheck (float threshold, float sigma, float amplitude)
 SiPixelSCurveCalibrationAnalysis (const edm::ParameterSet &iConfig)
 ~SiPixelSCurveCalibrationAnalysis ()

Public Attributes

std::vector< float > vCalPointsAsFloats_

Static Public Attributes

static std::vector< float > effErrors_
static std::vector< float > efficiencies_

Private Member Functions

virtual void calibrationEnd ()
virtual void calibrationSetup (const edm::EventSetup &iSetup)
virtual bool checkCorrectCalibrationType ()
void makeThresholdSummary (void)
virtual void newDetID (uint32_t detid)

Private Attributes

unsigned int curvesSavedCounter_
std::map< uint32_t, bool > detIDsToSave_
detIDHistogramMap histograms_
unsigned int maxCurvesToSave_
double maximumEffAsymptote_
double maximumSigma_
double maximumSigmaBin_
double maximumThreshold_
double maximumThresholdBin_
double minimumChi2prob_
double minimumEffAsymptote_
double minimumSigma_
double minimumThreshold_
std::vector< std::string > plaquettesToSave_
bool printoutthresholds_
bool saveCurvesThatFlaggedBad_
std::string thresholdfilename_
bool useDetectorHierarchyFolders_
bool write2dFitResult_
bool write2dHistograms_
bool writeZeroes_

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 58 of file SiPixelSCurveCalibrationAnalysis.h.


Constructor & Destructor Documentation

SiPixelSCurveCalibrationAnalysis::SiPixelSCurveCalibrationAnalysis ( const edm::ParameterSet iConfig) [inline, explicit]

Definition at line 60 of file SiPixelSCurveCalibrationAnalysis.h.

References doSetup().

SiPixelSCurveCalibrationAnalysis::~SiPixelSCurveCalibrationAnalysis ( )

Definition at line 132 of file SiPixelSCurveCalibrationAnalysis.cc.

{
   //do nothing
}

Member Function Documentation

void SiPixelSCurveCalibrationAnalysis::buildACurveHistogram ( const uint32_t &  detid,
const uint32_t &  row,
const uint32_t &  col,
sCurveErrorFlag  errorFlag,
const std::vector< float > &  efficiencies,
const std::vector< float > &  errors 
)

Definition at line 137 of file SiPixelSCurveCalibrationAnalysis.cc.

References SiPixelOfflineCalibAnalysisBase::bookDQMHistogram1D(), curvesSavedCounter_, maxCurvesToSave_, MonitorElement::setBinContent(), MonitorElement::setBinError(), SiPixelOfflineCalibAnalysisBase::setDQMDirectory(), SiPixelOfflineCalibAnalysisBase::translateDetIdToString(), and vCalPointsAsFloats_.

Referenced by doFits().

{
   if (curvesSavedCounter_ > maxCurvesToSave_)
   {
      edm::LogWarning("SiPixelSCurveCalibrationAnalysis") << "WARNING: Request to save curve for [detid](col/row):  [" << detid << "](" << col << "/" << row << ") denied. Maximum number of saved curves (defined in .cfi) exceeded.";
      return;
   }
   std::ostringstream rootName;
   rootName << "SCurve_row_" << row << "_col_" << col;
   std::ostringstream humanName;
   humanName << translateDetIdToString(detid) << "_" << rootName.str() << "_ErrorFlag_" << (int)errorFlag;

   unsigned int numberOfVCalPoints = vCalPointsAsFloats_.size()-1; //minus one is necessary since the lower edge of the last bin must be added
   if (efficiencies.size() != numberOfVCalPoints || errors.size() != numberOfVCalPoints)
   {
      edm::LogError("SiPixelSCurveCalibrationAnalysis") << "Error saving single curve histogram!  Number of Vcal values (" << numberOfVCalPoints << ") does not match number of efficiency points or error points!";
      return;
   }
   setDQMDirectory(detid);
   float * vcalValuesToPassToCrappyRoot = &vCalPointsAsFloats_[0];
   MonitorElement * aBadHisto = bookDQMHistogram1D(detid, rootName.str(), humanName.str(), numberOfVCalPoints, vcalValuesToPassToCrappyRoot);  //ROOT only takes an input as array. :(  HOORAY FOR CINT!
   curvesSavedCounter_++;
   for(unsigned int iBin = 0; iBin < numberOfVCalPoints; ++iBin)
   {
      int rootBin = iBin + 1;  //root bins start at 1
      aBadHisto->setBinContent(rootBin, efficiencies[iBin]);
      aBadHisto->setBinError(rootBin, errors[iBin]);
   }
}
void SiPixelSCurveCalibrationAnalysis::calibrationEnd ( ) [private, virtual]
void SiPixelSCurveCalibrationAnalysis::calibrationSetup ( const edm::EventSetup iSetup) [private, virtual]

Reimplemented from SiPixelOfflineCalibAnalysisBase.

Definition at line 167 of file SiPixelSCurveCalibrationAnalysis.cc.

References curvesSavedCounter_, SiPixelOfflineCalibAnalysisBase::fitFunction_, SiPixelOfflineCalibAnalysisBase::getVcalValues(), i, maxCurvesToSave_, SiPixelOfflineCalibAnalysisBase::nTriggers_, saveCurvesThatFlaggedBad_, vCalPointsAsFloats_, and SiPixelOfflineCalibAnalysisBase::vCalValues_.

{
   edm::LogInfo("SiPixelSCurveCalibrationAnalysis") << "Calibration Settings: VCalLow: " << vCalValues_[0] << "  VCalHigh: " << vCalValues_[vCalValues_.size()-1] << " nVCal: " << vCalValues_.size() << "  nTriggers: " << nTriggers_;
   curvesSavedCounter_ = 0;
   if (saveCurvesThatFlaggedBad_)
   {
      //build the vCal values as a vector of floats if we want to save single curves
      const std::vector<short>* theVCalValues = this->getVcalValues();
      unsigned int numberOfVCalPoints = theVCalValues->size();
      edm::LogWarning("SiPixelSCurveCalibrationAnalysis") << "WARNING: Option set to save indiviual S-Curves - max number: " 
                                                          << maxCurvesToSave_ << " This can lead to large memory consumption! (Got " << numberOfVCalPoints << " VCal Points";
      for(unsigned int i = 0; i < numberOfVCalPoints; i++)
      {
         vCalPointsAsFloats_.push_back( static_cast<float>((*theVCalValues)[i]) );
         edm::LogInfo("SiPixelSCurveCalibrationAnalysis") << "Adding calibration Vcal: " << (*theVCalValues)[i];
      }
      // must add lower edge of last bin to the vector
      vCalPointsAsFloats_.push_back( vCalPointsAsFloats_[numberOfVCalPoints-1] + 1 );
   }

   fitFunction_ = new TF1("sCurve", "0.5*[2]*(1+TMath::Erf( (x-[0]) / ([1]*sqrt(2)) ) )", vCalValues_[0], vCalValues_[vCalValues_.size()-1]);
}
bool SiPixelSCurveCalibrationAnalysis::checkCorrectCalibrationType ( ) [private, virtual]

Reimplemented from SiPixelOfflineCalibAnalysisBase.

Definition at line 191 of file SiPixelSCurveCalibrationAnalysis.cc.

References SiPixelOfflineCalibAnalysisBase::calibrationMode_.

{
  if(calibrationMode_=="SCurve")
    return true;
  else if(calibrationMode_=="unknown"){
    edm::LogInfo("SiPixelSCurveCalibrationAnalysis") <<  "calibration mode is: " << calibrationMode_ << ", continuing anyway..." ;
    return true;
  }
  else{
    //    edm::LogDebug("SiPixelSCurveCalibrationAnalysis") << "unknown calibration mode for SCurves, should be \"SCurve\" and is \"" << calibrationMode_ << "\"";
  }
  return false;
}
bool SiPixelSCurveCalibrationAnalysis::doFits ( uint32_t  detid,
std::vector< SiPixelCalibDigi >::const_iterator  ipix 
) [virtual]

Reimplemented from SiPixelOfflineCalibAnalysisBase.

Definition at line 296 of file SiPixelSCurveCalibrationAnalysis.cc.

References buildACurveHistogram(), calculateEffAndError(), ExpressReco_HICollisions_FallBack::chi2, chi2toMinimize(), detIDsToSave_, effErrors_, efficiencies_, errBadChi2Prob, errOK, error, estimateSCurveParameters(), fittedSCurveSanityCheck(), fitWZ::gMinuit, histograms_, kChi2s, kChi2Summary, kFitResults, kFitResultSummary, kSigmas, kSigmaSummary, kThresholds, kThresholdSummary, minimumChi2prob_, SiPixelOfflineCalibAnalysisBase::nTriggers_, NULL, saveCurvesThatFlaggedBad_, ExpressReco_HICollisions_FallBack::sigma, crabWrap::threshold, SiPixelOfflineCalibAnalysisBase::vCalValues_, write2dFitResult_, and write2dHistograms_.

{
   sCurveErrorFlag errorFlag = errOK;
   uint32_t nVCalPts = calibDigi->getnpoints();
   //reset and fill static datamembers with vector of points and errors
   efficiencies_.resize(0);
   effErrors_.resize(0);
   for (uint32_t iVcalPt = 0; iVcalPt < nVCalPts; iVcalPt++)
   {
      float eff;
      float error;
      calculateEffAndError(calibDigi->getnentries(iVcalPt), nTriggers_, eff, error);
      edm::LogInfo("SiPixelSCurveCalibrationAnalysis") << "Eff: " << eff << " Error:  " << error << "  nEntries: " << calibDigi->getnentries(iVcalPt) << "  nTriggers: " << nTriggers_ << " VCalPt " << vCalValues_[iVcalPt];
      efficiencies_.push_back(eff);
      effErrors_.push_back(error);
   } 

   //estimate the S-Curve parameters
   float thresholdGuess;
   float sigmaGuess;
   errorFlag = estimateSCurveParameters(efficiencies_, thresholdGuess, sigmaGuess);

   // these -1.0 default values will only be filled if the curve is all zeroes, or doesn't turn on, WHICH INDICATES A SERIOUS PROBLEM
   Double_t sigma                       = -1.0;
   Double_t sigmaError                  = -1.0;
   Double_t threshold                   = -1.0;
   Double_t thresholdError              = -1.0;
   Double_t amplitude                   = -1.0;
   Double_t amplitudeError              = -1.0;
   Double_t chi2                        = -1.0;
   //calculate NDF
   Int_t nDOF                           = vCalValues_.size() - 3;
   Double_t chi2probability             = 0;

   if (errorFlag == errOK)          //only do fit if curve is fittable
   {
      //set up minuit fit
      TMinuit *gMinuit = new TMinuit(3);
      gMinuit->SetPrintLevel(-1);  //save ourselves from gigabytes of stdout
      gMinuit->SetFCN(chi2toMinimize);

      //define threshold parameters - choose step size 1, max 300, min -50
      gMinuit->DefineParameter(0, "Threshold", (Double_t)thresholdGuess, 1, -50, 300);
      //sigma
      gMinuit->DefineParameter(1, "Sigma", (Double_t)sigmaGuess, 0.1, 0, 255); 
      //amplitude
      gMinuit->DefineParameter(2, "Amplitude", 1, 0.1, -0.001, 200);

      //Do Chi2 minimazation
      gMinuit->Migrad();
      gMinuit->GetParameter(0, threshold, thresholdError);
      gMinuit->GetParameter(1, sigma, sigmaError);
      gMinuit->GetParameter(2, amplitude, amplitudeError);

      //get Chi2
      Double_t params[3]   = {threshold, sigma, amplitude};
      gMinuit->Eval(3, NULL, chi2, params, 0);
      //calculate Chi2 proability
      if (nDOF <= 0)
         chi2probability = 0;
      else
         chi2probability = TMath::Prob(chi2, nDOF);
      
      //check to make sure output makes sense (i.e. threshold > 0)
      if (chi2probability > minimumChi2prob_)
         errorFlag = fittedSCurveSanityCheck(threshold, sigma, amplitude);
      else
         errorFlag = errBadChi2Prob;

      edm::LogInfo("SiPixelSCurveCalibrationAnalysis") << "Fit finished with errorFlag: " << errorFlag << " - threshold: " << threshold << "  sigma: " << sigma << "  chi2: " << chi2 << "  nDOF: " << nDOF << " chi2Prob: " << chi2probability << " chi2MinUser: " << minimumChi2prob_;

      delete gMinuit;
   }
   //get row and column for this pixel
   uint32_t row = calibDigi->row();
   uint32_t col = calibDigi->col();

   //get iterator to histogram holder for this detid
   detIDHistogramMap::iterator thisDetIdHistoGrams;
   thisDetIdHistoGrams = histograms_.find(detid);
   if (thisDetIdHistoGrams != histograms_.end())
   {
      edm::LogInfo("SiPixelSCurveCalibrationAnalysisHistogramReport") << "Filling histograms for [detid](col/row):  [" << detid << "](" << col << "/" << row << ") ErrorFlag: " << errorFlag;
      //always fill fit result
      (*thisDetIdHistoGrams).second[kFitResultSummary]->Fill(errorFlag);
      if (write2dFitResult_)
         (*thisDetIdHistoGrams).second[kFitResults]->setBinContent(col+1, row+1, errorFlag); // +1 because root bins start at 1

      // fill sigma/threshold result
      (*thisDetIdHistoGrams).second[kSigmaSummary]->Fill(sigma);
      (*thisDetIdHistoGrams).second[kThresholdSummary]->Fill(threshold);
      if (write2dHistograms_)
      {
         (*thisDetIdHistoGrams).second[kSigmas]->setBinContent(col+1, row+1, sigma); // +1 because root bins start at 1
         (*thisDetIdHistoGrams).second[kThresholds]->setBinContent(col+1, row+1, threshold); // +1 because root bins start at 1
      }
      // fill chi2
      (*thisDetIdHistoGrams).second[kChi2Summary]->Fill(chi2probability);
      if (write2dHistograms_)
         (*thisDetIdHistoGrams).second[kChi2s]->Fill(col, row, chi2probability);
   }
   // save individual curves, if requested
   if (saveCurvesThatFlaggedBad_)
   {
      bool thisDetIDinList = false;
      if (detIDsToSave_.find(detid) != detIDsToSave_.end()) //see if we want to save this histogram
         thisDetIDinList = true;

      if (errorFlag != errOK || thisDetIDinList)
      {
         edm::LogError("SiPixelSCurveCalibrationAnalysis") << "Saving error histogram for [detid](col/row):  [" << detid << "](" << col << "/" << row << ") ErrorFlag: " << errorFlag;
         buildACurveHistogram(detid, row, col, errorFlag, efficiencies_, effErrors_);
      }
   }

   return true;
   
}
void SiPixelSCurveCalibrationAnalysis::doSetup ( const edm::ParameterSet iConfig)

Definition at line 102 of file SiPixelSCurveCalibrationAnalysis.cc.

References detIDsToSave_, edm::ParameterSet::getUntrackedParameter(), i, maxCurvesToSave_, maximumEffAsymptote_, maximumSigma_, maximumSigmaBin_, maximumThreshold_, maximumThresholdBin_, minimumChi2prob_, minimumEffAsymptote_, minimumSigma_, minimumThreshold_, printoutthresholds_, saveCurvesThatFlaggedBad_, thresholdfilename_, useDetectorHierarchyFolders_, write2dFitResult_, write2dHistograms_, and writeZeroes_.

Referenced by SiPixelSCurveCalibrationAnalysis().

{
   edm::LogInfo("SiPixelSCurveCalibrationAnalysis") << "Setting up calibration paramters.";
   std::vector<uint32_t>        anEmptyDefaultVectorOfUInts;
   std::vector<uint32_t>        detIDsToSaveVector_;
   useDetectorHierarchyFolders_ = iConfig.getUntrackedParameter<bool>("useDetectorHierarchyFolders", true);
   saveCurvesThatFlaggedBad_    = iConfig.getUntrackedParameter<bool>("saveCurvesThatFlaggedBad", false);
   detIDsToSaveVector_          = iConfig.getUntrackedParameter<std::vector<uint32_t> >("detIDsToSave", anEmptyDefaultVectorOfUInts);
   maxCurvesToSave_             = iConfig.getUntrackedParameter<uint32_t>("maxCurvesToSave", 1000);
   write2dHistograms_           = iConfig.getUntrackedParameter<bool>("write2dHistograms", true);
   write2dFitResult_            = iConfig.getUntrackedParameter<bool>("write2dFitResult", true);
   printoutthresholds_          = iConfig.getUntrackedParameter<bool>("writeOutThresholdSummary",true);
   thresholdfilename_           = iConfig.getUntrackedParameter<std::string>("thresholdOutputFileName","thresholds.txt");  
   minimumChi2prob_             = iConfig.getUntrackedParameter<double>("minimumChi2prob", 0);
   minimumThreshold_            = iConfig.getUntrackedParameter<double>("minimumThreshold", -10);
   maximumThreshold_            = iConfig.getUntrackedParameter<double>("maximumThreshold", 300);
   minimumSigma_                = iConfig.getUntrackedParameter<double>("minimumSigma", 0);
   maximumSigma_                = iConfig.getUntrackedParameter<double>("maximumSigma", 100);
   minimumEffAsymptote_         = iConfig.getUntrackedParameter<double>("minimumEffAsymptote", 0);
   maximumEffAsymptote_         = iConfig.getUntrackedParameter<double>("maximumEffAsymptote", 1000);
   maximumSigmaBin_             = iConfig.getUntrackedParameter<double>("maximumSigmaBin", 10);
   maximumThresholdBin_         = iConfig.getUntrackedParameter<double>("maximumThresholdBin", 255);

   writeZeroes_= iConfig.getUntrackedParameter<bool>("alsoWriteZeroThresholds", false);

   // convert the vector into a map for quicker lookups.
   for(unsigned int i = 0; i < detIDsToSaveVector_.size(); i++)
      detIDsToSave_.insert( std::make_pair(detIDsToSaveVector_[i], true) );
}
sCurveErrorFlag SiPixelSCurveCalibrationAnalysis::estimateSCurveParameters ( const std::vector< float > &  eff,
float &  threshold,
float &  sigma 
)

Definition at line 205 of file SiPixelSCurveCalibrationAnalysis.cc.

References delta, errAllZeros, errNoTurnOn, errOK, convertSQLitetoXML_cfg::output, and SiPixelOfflineCalibAnalysisBase::vCalValues_.

Referenced by doFits().

{
   sCurveErrorFlag output = errAllZeros;
   bool allZeroSoFar    = true;
   int turnOnBin        = -1;
   int saturationBin    = -1;
   for (uint32_t iVcalPt = 0; iVcalPt < eff.size(); iVcalPt++)
   {
      if (allZeroSoFar && eff[iVcalPt] != 0 ) {
         turnOnBin = iVcalPt;
         allZeroSoFar = false;
         output = errNoTurnOn;
      } else if (eff[iVcalPt] > 0.90)
      {
         saturationBin  = iVcalPt;
         short turnOnVcal       = vCalValues_[turnOnBin];
         short saturationVcal   = vCalValues_[saturationBin];
         short delta            = saturationVcal - turnOnVcal;
         sigma                  = delta * 0.682;
         if (sigma < 1)         //check to make sure sigma guess is larger than our X resolution.  Hopefully prevents Minuit from getting stuck at boundary
            sigma = 1;
         threshold              = turnOnVcal + (0.5 * delta);
         return errOK;
      }
   }
   return output;
}
sCurveErrorFlag SiPixelSCurveCalibrationAnalysis::fittedSCurveSanityCheck ( float  threshold,
float  sigma,
float  amplitude 
)

Definition at line 233 of file SiPixelSCurveCalibrationAnalysis.cc.

References errFitNonPhysical, errFlaggedBadByUser, errOK, maximumEffAsymptote_, maximumSigma_, maximumThreshold_, and SiPixelOfflineCalibAnalysisBase::vCalValues_.

Referenced by doFits().

{
   //check if nonsensical
   if (threshold > vCalValues_[vCalValues_.size()-1] || threshold < vCalValues_[0] ||
         sigma > vCalValues_[vCalValues_.size()-1] - vCalValues_[0] )
      return errFitNonPhysical;

   if (threshold < minimumThreshold_ || threshold > maximumThreshold_ ||
         sigma < minimumSigma_ || sigma > maximumSigma_ ||
         amplitude < minimumEffAsymptote_ || amplitude > maximumEffAsymptote_)
      return errFlaggedBadByUser;

   return errOK;
}
void SiPixelSCurveCalibrationAnalysis::makeThresholdSummary ( void  ) [private]

Definition at line 25 of file SiPixelSCurveCalibrationAnalysis.cc.

References gather_cfg::cout, sipixelobjects::ElectronicIndex::dcol, sipixelobjects::LocalPixel::DcolPxid::dcol, ExpressReco_HICollisions_FallBack::detector, cond::rpcobgas::detid, MonitorElement::getBinContent(), MonitorElement::getNbinsX(), MonitorElement::getNbinsY(), MonitorElement::getTitle(), histograms_, sipixelobjects::PixelROC::idInDetUnit(), kSigmas, kThresholds, sipixelobjects::ElectronicIndex::link, AlCaRecoCosmics_cfg::name, path(), edm::ESHandle< T >::product(), sipixelobjects::ElectronicIndex::pxid, sipixelobjects::LocalPixel::DcolPxid::pxid, sipixelobjects::ElectronicIndex::roc, sipixelobjects::LocalPixel::rocCol(), sipixelobjects::LocalPixel::rocRow(), SiPixelOfflineCalibAnalysisBase::theCablingMap_, thresholdfilename_, SiPixelFrameConverter::toCabling(), and writeZeroes_.

Referenced by calibrationEnd().

                                                               {
  ofstream myfile;
  myfile.open (thresholdfilename_.c_str());
  for(detIDHistogramMap::iterator  thisDetIdHistoGrams= histograms_.begin();  thisDetIdHistoGrams != histograms_.end(); ++thisDetIdHistoGrams){
   // loop over det id (det id = number (unsigned int) of pixel module 
    const MonitorElement *sigmahist = (*thisDetIdHistoGrams).second[kSigmas];
    const MonitorElement *thresholdhist = (*thisDetIdHistoGrams).second[kThresholds];  
    uint32_t detid = (*thisDetIdHistoGrams).first;
    std::string name = sigmahist->getTitle();
    std::string rocname = name.substr(0,name.size()-7);
    rocname+="_ROC";
    int total_rows = sigmahist ->getNbinsY();
    int total_columns = sigmahist->getNbinsX();
    //loop over all rows on columns on all ROCs 
    for (int irow=0; irow<total_rows; ++irow){
      for (int icol=0; icol<total_columns; ++icol){
        float threshold_error = sigmahist->getBinContent(icol+1,irow+1); // +1 because root bins start at 1
        if(writeZeroes_ ||(!writeZeroes_ && threshold_error>0)){             
          //changing from offline to online numbers
          int realfedID=-1;
          for(int fedid=0; fedid<=40; ++fedid){
            SiPixelFrameConverter converter(theCablingMap_.product(),fedid);
            if(converter.hasDetUnit(detid)){
              realfedID=fedid;
              break;   
            }
          }
          if (realfedID==-1){
            std::cout<<"error: could not obtain real fed ID"<<std::endl;
          }
          sipixelobjects::DetectorIndex detector ={detid,irow,icol};
          sipixelobjects::ElectronicIndex cabling; 
          SiPixelFrameConverter formatter(theCablingMap_.product(),realfedID);
          formatter.toCabling(cabling,detector);
          // cabling should now contain cabling.roc and cabling.dcol  and cabling.pxid
          // however, the coordinates now need to be converted from dcl,pxid to the row,col coordinates used in the calibration info 
          sipixelobjects::LocalPixel::DcolPxid loc;
          loc.dcol = cabling.dcol;
          loc.pxid = cabling.pxid;
          // FIX to adhere to new cabling map. To be replaced with CalibTracker/SiPixelTools detid - > hardware id classes ASAP.
          //        const sipixelobjects::PixelFEDCabling *theFed= theCablingMap.product()->fed(realfedID);
          //        const sipixelobjects::PixelFEDLink * link = theFed->link(cabling.link);
          //        const sipixelobjects::PixelROC *theRoc = link->roc(cabling.roc);
          sipixelobjects::LocalPixel locpixel(loc);
          sipixelobjects::CablingPathToDetUnit path = {realfedID, cabling.link, cabling.roc};  
          const sipixelobjects::PixelROC *theRoc = theCablingMap_->findItem(path);
          // END of FIX
          int newrow= locpixel.rocRow();
          int newcol = locpixel.rocCol();
          myfile<<rocname<<theRoc->idInDetUnit()<<" "<<newcol<<" "<<newrow<<" "<<thresholdhist->getBinContent(icol+1, irow+1)<<" "<<threshold_error;  // +1 because root bins start at 1
          myfile<<"\n";
        }
      }
    }
  }
  myfile.close();
}
void SiPixelSCurveCalibrationAnalysis::newDetID ( uint32_t  detid) [private, virtual]

Reimplemented from SiPixelOfflineCalibAnalysisBase.

Definition at line 258 of file SiPixelSCurveCalibrationAnalysis.cc.

References SiPixelOfflineCalibAnalysisBase::bookDQMHistogram1D(), SiPixelOfflineCalibAnalysisBase::bookDQMHistoPlaquetteSummary2D(), cond::rpcobgas::detid, histograms_, kChi2s, kChi2Summary, kFitResults, kFitResultSummary, kSigmas, kSigmaSummary, kThresholds, kThresholdSummary, maximumSigmaBin_, maximumThresholdBin_, SiPixelOfflineCalibAnalysisBase::setDQMDirectory(), SiPixelOfflineCalibAnalysisBase::translateDetIdToString(), useDetectorHierarchyFolders_, write2dFitResult_, and write2dHistograms_.

{
   edm::LogInfo("SiPixelSCurveCalibrationAnalysis") << "Found a new DetID (" << detid << ")!  Checking to make sure it has not been added.";
   //ensure that this DetID has not been added yet
   sCurveHistogramHolder tempMap;
   std::pair<detIDHistogramMap::iterator, bool> insertResult; 
   insertResult = histograms_.insert(std::make_pair(detid, tempMap));
   if (insertResult.second)     //indicates successful insertion
   {
      edm::LogInfo("SiPixelSCurveCalibrationAnalysisHistogramReport") << "Histogram Map.insert() returned true!  Booking new histogrames for detID: " << detid;
      // use detector hierarchy folders if desired
      if (useDetectorHierarchyFolders_)
         setDQMDirectory(detid);

      std::string detIdName = translateDetIdToString(detid);
      if (write2dHistograms_){
        MonitorElement * D2sigma       = bookDQMHistoPlaquetteSummary2D(detid,"ScurveSigmas", detIdName + " Sigmas");
        MonitorElement * D2thresh      = bookDQMHistoPlaquetteSummary2D(detid,"ScurveThresholds", detIdName + " Thresholds");
        MonitorElement * D2chi2        = bookDQMHistoPlaquetteSummary2D(detid,"ScurveChi2Prob",detIdName + " Chi2Prob");
         insertResult.first->second.insert(std::make_pair(kSigmas, D2sigma));
         insertResult.first->second.insert(std::make_pair(kThresholds, D2thresh));
         insertResult.first->second.insert(std::make_pair(kChi2s, D2chi2));
      }
      if (write2dFitResult_){
        MonitorElement * D2FitResult = bookDQMHistoPlaquetteSummary2D(detid,"ScurveFitResult", detIdName + " Fit Result");
         insertResult.first->second.insert(std::make_pair(kFitResults, D2FitResult));
      }
      MonitorElement * D1sigma       = bookDQMHistogram1D(detid,"ScurveSigmasSummary", detIdName + " Sigmas Summary", 100, 0, maximumSigmaBin_);
      MonitorElement * D1thresh      = bookDQMHistogram1D(detid,"ScurveThresholdSummary", detIdName + " Thresholds Summary", 255, 0, maximumThresholdBin_);
      MonitorElement * D1chi2        = bookDQMHistogram1D(detid,"ScurveChi2ProbSummary", detIdName + " Chi2Prob Summary", 101, 0, 1.01);
      MonitorElement * D1FitResult   = bookDQMHistogram1D(detid,"ScurveFitResultSummary", detIdName + " Fit Result Summary", 10, -0.5, 9.5);
      insertResult.first->second.insert(std::make_pair(kSigmaSummary, D1sigma));
      insertResult.first->second.insert(std::make_pair(kThresholdSummary, D1thresh));
      insertResult.first->second.insert(std::make_pair(kChi2Summary, D1chi2));
      insertResult.first->second.insert(std::make_pair(kFitResultSummary, D1FitResult));
   }
}

Member Data Documentation

Definition at line 82 of file SiPixelSCurveCalibrationAnalysis.h.

Referenced by buildACurveHistogram(), and calibrationSetup().

std::map<uint32_t, bool> SiPixelSCurveCalibrationAnalysis::detIDsToSave_ [private]

Definition at line 89 of file SiPixelSCurveCalibrationAnalysis.h.

Referenced by doFits(), and doSetup().

std::vector< float > SiPixelSCurveCalibrationAnalysis::effErrors_ [static]

Definition at line 67 of file SiPixelSCurveCalibrationAnalysis.h.

Referenced by chi2toMinimize(), and doFits().

std::vector< float > SiPixelSCurveCalibrationAnalysis::efficiencies_ [static]

Definition at line 66 of file SiPixelSCurveCalibrationAnalysis.h.

Referenced by chi2toMinimize(), and doFits().

Definition at line 107 of file SiPixelSCurveCalibrationAnalysis.h.

Referenced by doFits(), makeThresholdSummary(), and newDetID().

Definition at line 99 of file SiPixelSCurveCalibrationAnalysis.h.

Referenced by doSetup(), and fittedSCurveSanityCheck().

Definition at line 97 of file SiPixelSCurveCalibrationAnalysis.h.

Referenced by doSetup(), and fittedSCurveSanityCheck().

Definition at line 103 of file SiPixelSCurveCalibrationAnalysis.h.

Referenced by doSetup(), and newDetID().

Definition at line 95 of file SiPixelSCurveCalibrationAnalysis.h.

Referenced by doSetup(), and fittedSCurveSanityCheck().

Definition at line 102 of file SiPixelSCurveCalibrationAnalysis.h.

Referenced by doSetup(), and newDetID().

Definition at line 93 of file SiPixelSCurveCalibrationAnalysis.h.

Referenced by doFits(), and doSetup().

Definition at line 98 of file SiPixelSCurveCalibrationAnalysis.h.

Referenced by doSetup().

Definition at line 96 of file SiPixelSCurveCalibrationAnalysis.h.

Referenced by doSetup().

Definition at line 94 of file SiPixelSCurveCalibrationAnalysis.h.

Referenced by doSetup().

std::vector<std::string> SiPixelSCurveCalibrationAnalysis::plaquettesToSave_ [private]

Definition at line 85 of file SiPixelSCurveCalibrationAnalysis.h.

Definition at line 86 of file SiPixelSCurveCalibrationAnalysis.h.

Referenced by calibrationEnd(), and doSetup().

Definition at line 80 of file SiPixelSCurveCalibrationAnalysis.h.

Referenced by calibrationSetup(), doFits(), and doSetup().

Definition at line 88 of file SiPixelSCurveCalibrationAnalysis.h.

Referenced by doSetup(), and makeThresholdSummary().

Definition at line 79 of file SiPixelSCurveCalibrationAnalysis.h.

Referenced by doSetup(), and newDetID().

Definition at line 68 of file SiPixelSCurveCalibrationAnalysis.h.

Referenced by buildACurveHistogram(), and calibrationSetup().

Definition at line 84 of file SiPixelSCurveCalibrationAnalysis.h.

Referenced by doFits(), doSetup(), and newDetID().

Definition at line 83 of file SiPixelSCurveCalibrationAnalysis.h.

Referenced by doFits(), doSetup(), and newDetID().

Definition at line 87 of file SiPixelSCurveCalibrationAnalysis.h.

Referenced by doSetup(), and makeThresholdSummary().