CMS 3D CMS Logo

SiPixelSCurveCalibrationAnalysis Class Reference

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

#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, booldetIDsToSave_
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().

00060 :SiPixelOfflineCalibAnalysisBase(iConfig){doSetup(iConfig);};

SiPixelSCurveCalibrationAnalysis::~SiPixelSCurveCalibrationAnalysis (  ) 

Definition at line 128 of file SiPixelSCurveCalibrationAnalysis.cc.

00129 {
00130    //do nothing
00131 }


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 133 of file SiPixelSCurveCalibrationAnalysis.cc.

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

Referenced by doFits().

00134 {
00135    if (curvesSavedCounter_ > maxCurvesToSave_)
00136    {
00137       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.";
00138       return;
00139    }
00140    std::ostringstream rootName;
00141    rootName << "SCurve_row_" << row << "_col_" << col;
00142    std::ostringstream humanName;
00143    humanName << translateDetIdToString(detid) << "_" << rootName.str() << "_ErrorFlag_" << (int)errorFlag;
00144 
00145    unsigned int numberOfVCalPoints = vCalPointsAsFloats_.size()-1; //minus one is necessary since the lower edge of the last bin must be added
00146    if (efficiencies.size() != numberOfVCalPoints || errors.size() != numberOfVCalPoints)
00147    {
00148       edm::LogError("SiPixelSCurveCalibrationAnalysis") << "Error saving single curve histogram!  Number of Vcal values (" << numberOfVCalPoints << ") does not match number of efficiency points or error points!";
00149       return;
00150    }
00151    setDQMDirectory(detid);
00152    float * vcalValuesToPassToCrappyRoot = &vCalPointsAsFloats_[0];
00153    MonitorElement * aBadHisto = bookDQMHistogram1D(detid, rootName.str(), humanName.str(), numberOfVCalPoints, vcalValuesToPassToCrappyRoot);  //ROOT only takes an input as array. :(  HOORAY FOR CINT!
00154    curvesSavedCounter_++;
00155    for(unsigned int iBin = 0; iBin < numberOfVCalPoints; ++iBin)
00156    {
00157       int rootBin = iBin + 1;  //root bins start at 1
00158       aBadHisto->setBinContent(rootBin, efficiencies[iBin]);
00159       aBadHisto->setBinError(rootBin, errors[iBin]);
00160    }
00161 }

void SiPixelSCurveCalibrationAnalysis::calibrationEnd (  )  [private, virtual]

Reimplemented from SiPixelOfflineCalibAnalysisBase.

Definition at line 20 of file SiPixelSCurveCalibrationAnalysis.cc.

References makeThresholdSummary(), and printoutthresholds_.

00020                                                      {
00021   if(printoutthresholds_)
00022     makeThresholdSummary();
00023 }

void SiPixelSCurveCalibrationAnalysis::calibrationSetup ( const edm::EventSetup iSetup  )  [private, virtual]

Reimplemented from SiPixelOfflineCalibAnalysisBase.

Definition at line 163 of file SiPixelSCurveCalibrationAnalysis.cc.

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

00164 {
00165    edm::LogInfo("SiPixelSCurveCalibrationAnalysis") << "Calibration Settings: VCalLow: " << vCalValues_[0] << "  VCalHigh: " << vCalValues_[vCalValues_.size()-1] << " nVCal: " << vCalValues_.size() << "  nTriggers: " << nTriggers_;
00166    curvesSavedCounter_ = 0;
00167    if (saveCurvesThatFlaggedBad_)
00168    {
00169       //build the vCal values as a vector of floats if we want to save single curves
00170       const std::vector<short>* theVCalValues = this->getVcalValues();
00171       unsigned int numberOfVCalPoints = theVCalValues->size();
00172       edm::LogWarning("SiPixelSCurveCalibrationAnalysis") << "WARNING: Option set to save indiviual S-Curves - max number: " 
00173                                                           << maxCurvesToSave_ << " This can lead to large memory consumption! (Got " << numberOfVCalPoints << " VCal Points";
00174       for(unsigned int i = 0; i < numberOfVCalPoints; i++)
00175       {
00176          vCalPointsAsFloats_.push_back( static_cast<float>((*theVCalValues)[i]) );
00177          edm::LogInfo("SiPixelSCurveCalibrationAnalysis") << "Adding calibration Vcal: " << (*theVCalValues)[i];
00178       }
00179       // must add lower edge of last bin to the vector
00180       vCalPointsAsFloats_.push_back( vCalPointsAsFloats_[numberOfVCalPoints-1] + 1 );
00181    }
00182 
00183    fitFunction_ = new TF1("sCurve", "0.5*[2]*(1+TMath::Erf( (x-[0]) / ([1]*sqrt(2)) ) )", vCalValues_[0], vCalValues_[vCalValues_.size()-1]);
00184 }

bool SiPixelSCurveCalibrationAnalysis::checkCorrectCalibrationType (  )  [private, virtual]

Reimplemented from SiPixelOfflineCalibAnalysisBase.

Definition at line 187 of file SiPixelSCurveCalibrationAnalysis.cc.

References SiPixelOfflineCalibAnalysisBase::calibrationMode_.

00188 {
00189   if(calibrationMode_=="SCurve")
00190     return true;
00191   else if(calibrationMode_=="unknown"){
00192     edm::LogInfo("SiPixelSCurveCalibrationAnalysis") <<  "calibration mode is: " << calibrationMode_ << ", continuing anyway..." ;
00193     return true;
00194   }
00195   else{
00196     //    edm::LogDebug("SiPixelSCurveCalibrationAnalysis") << "unknown calibration mode for SCurves, should be \"SCurve\" and is \"" << calibrationMode_ << "\"";
00197   }
00198   return false;
00199 }

bool SiPixelSCurveCalibrationAnalysis::doFits ( uint32_t  detid,
std::vector< SiPixelCalibDigi >::const_iterator  ipix 
) [virtual]

Reimplemented from SiPixelOfflineCalibAnalysisBase.

Definition at line 292 of file SiPixelSCurveCalibrationAnalysis.cc.

References buildACurveHistogram(), calculateEffAndError(), chi2toMinimize(), parsecf::pyparsing::col(), detIDsToSave_, effErrors_, efficiencies_, errBadChi2Prob, errOK, error, estimateSCurveParameters(), fittedSCurveSanityCheck(), histograms_, kChi2s, kChi2Summary, kFitResults, kFitResultSummary, kSigmas, kSigmaSummary, kThresholds, kThresholdSummary, minimumChi2prob_, SiPixelOfflineCalibAnalysisBase::nTriggers_, NULL, params, row, saveCurvesThatFlaggedBad_, dimuonsSequences_cff::threshold, SiPixelOfflineCalibAnalysisBase::vCalValues_, write2dFitResult_, and write2dHistograms_.

00293 {
00294    sCurveErrorFlag errorFlag = errOK;
00295    uint32_t nVCalPts = calibDigi->getnpoints();
00296    //reset and fill static datamembers with vector of points and errors
00297    efficiencies_.resize(0);
00298    effErrors_.resize(0);
00299    for (uint32_t iVcalPt = 0; iVcalPt < nVCalPts; iVcalPt++)
00300    {
00301       float eff;
00302       float error;
00303       calculateEffAndError(calibDigi->getnentries(iVcalPt), nTriggers_, eff, error);
00304       edm::LogInfo("SiPixelSCurveCalibrationAnalysis") << "Eff: " << eff << " Error:  " << error << "  nEntries: " << calibDigi->getnentries(iVcalPt) << "  nTriggers: " << nTriggers_ << " VCalPt " << vCalValues_[iVcalPt];
00305       efficiencies_.push_back(eff);
00306       effErrors_.push_back(error);
00307    } 
00308 
00309    //estimate the S-Curve parameters
00310    float thresholdGuess;
00311    float sigmaGuess;
00312    errorFlag = estimateSCurveParameters(efficiencies_, thresholdGuess, sigmaGuess);
00313 
00314    // 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
00315    Double_t sigma                       = -1.0;
00316    Double_t sigmaError                  = -1.0;
00317    Double_t threshold                   = -1.0;
00318    Double_t thresholdError              = -1.0;
00319    Double_t amplitude                   = -1.0;
00320    Double_t amplitudeError              = -1.0;
00321    Double_t chi2                        = -1.0;
00322    //calculate NDF
00323    Int_t nDOF                           = vCalValues_.size() - 3;
00324    Double_t chi2probability             = 0;
00325 
00326    if (errorFlag == errOK)          //only do fit if curve is fittable
00327    {
00328       //set up minuit fit
00329       TMinuit *gMinuit = new TMinuit(3);
00330       gMinuit->SetPrintLevel(-1);  //save ourselves from gigabytes of stdout
00331       gMinuit->SetFCN(chi2toMinimize);
00332 
00333       //define threshold parameters - choose step size 1, max 300, min -50
00334       gMinuit->DefineParameter(0, "Threshold", (Double_t)thresholdGuess, 1, -50, 300);
00335       //sigma
00336       gMinuit->DefineParameter(1, "Sigma", (Double_t)sigmaGuess, 0.1, 0, 255); 
00337       //amplitude
00338       gMinuit->DefineParameter(2, "Amplitude", 1, 0.1, -0.001, 200);
00339 
00340       //Do Chi2 minimazation
00341       gMinuit->Migrad();
00342       gMinuit->GetParameter(0, threshold, thresholdError);
00343       gMinuit->GetParameter(1, sigma, sigmaError);
00344       gMinuit->GetParameter(2, amplitude, amplitudeError);
00345 
00346       //get Chi2
00347       Double_t params[3]   = {threshold, sigma, amplitude};
00348       gMinuit->Eval(3, NULL, chi2, params, 0);
00349       //calculate Chi2 proability
00350       if (nDOF <= 0)
00351          chi2probability = 0;
00352       else
00353          chi2probability = TMath::Prob(chi2, nDOF);
00354       
00355       //check to make sure output makes sense (i.e. threshold > 0)
00356       if (chi2probability > minimumChi2prob_)
00357          errorFlag = fittedSCurveSanityCheck(threshold, sigma, amplitude);
00358       else
00359          errorFlag = errBadChi2Prob;
00360 
00361       edm::LogInfo("SiPixelSCurveCalibrationAnalysis") << "Fit finished with errorFlag: " << errorFlag << " - threshold: " << threshold << "  sigma: " << sigma << "  chi2: " << chi2 << "  nDOF: " << nDOF << " chi2Prob: " << chi2probability << " chi2MinUser: " << minimumChi2prob_;
00362 
00363       delete gMinuit;
00364    }
00365    //get row and column for this pixel
00366    uint32_t row = calibDigi->row();
00367    uint32_t col = calibDigi->col();
00368 
00369    //get iterator to histogram holder for this detid
00370    detIDHistogramMap::iterator thisDetIdHistoGrams;
00371    thisDetIdHistoGrams = histograms_.find(detid);
00372    if (thisDetIdHistoGrams != histograms_.end())
00373    {
00374       edm::LogInfo("SiPixelSCurveCalibrationAnalysisHistogramReport") << "Filling histograms for [detid](col/row):  [" << detid << "](" << col << "/" << row << ") ErrorFlag: " << errorFlag;
00375       //always fill fit result
00376       (*thisDetIdHistoGrams).second[kFitResultSummary]->Fill(errorFlag);
00377       if (write2dFitResult_)
00378          (*thisDetIdHistoGrams).second[kFitResults]->setBinContent(col+1, row+1, errorFlag); // +1 because root bins start at 1
00379 
00380       // fill sigma/threshold result
00381       (*thisDetIdHistoGrams).second[kSigmaSummary]->Fill(sigma);
00382       (*thisDetIdHistoGrams).second[kThresholdSummary]->Fill(threshold);
00383       if (write2dHistograms_)
00384       {
00385          (*thisDetIdHistoGrams).second[kSigmas]->setBinContent(col+1, row+1, sigma); // +1 because root bins start at 1
00386          (*thisDetIdHistoGrams).second[kThresholds]->setBinContent(col+1, row+1, threshold); // +1 because root bins start at 1
00387       }
00388       // fill chi2
00389       (*thisDetIdHistoGrams).second[kChi2Summary]->Fill(chi2probability);
00390       if (write2dHistograms_)
00391          (*thisDetIdHistoGrams).second[kChi2s]->Fill(col, row, chi2probability);
00392    }
00393    // save individual curves, if requested
00394    if (saveCurvesThatFlaggedBad_)
00395    {
00396       bool thisDetIDinList = false;
00397       if (detIDsToSave_.find(detid) != detIDsToSave_.end()) //see if we want to save this histogram
00398          thisDetIDinList = true;
00399 
00400       if (errorFlag != errOK || thisDetIDinList)
00401       {
00402          edm::LogError("SiPixelSCurveCalibrationAnalysis") << "Saving error histogram for [detid](col/row):  [" << detid << "](" << col << "/" << row << ") ErrorFlag: " << errorFlag;
00403          buildACurveHistogram(detid, row, col, errorFlag, efficiencies_, effErrors_);
00404       }
00405    }
00406 
00407    return true;
00408    
00409 }

void SiPixelSCurveCalibrationAnalysis::doSetup ( const edm::ParameterSet iConfig  ) 

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

00099 {
00100    edm::LogInfo("SiPixelSCurveCalibrationAnalysis") << "Setting up calibration paramters.";
00101    std::vector<uint32_t>        anEmptyDefaultVectorOfUInts;
00102    std::vector<uint32_t>        detIDsToSaveVector_;
00103    useDetectorHierarchyFolders_ = iConfig.getUntrackedParameter<bool>("useDetectorHierarchyFolders", true);
00104    saveCurvesThatFlaggedBad_    = iConfig.getUntrackedParameter<bool>("saveCurvesThatFlaggedBad", false);
00105    detIDsToSaveVector_          = iConfig.getUntrackedParameter<std::vector<uint32_t> >("detIDsToSave", anEmptyDefaultVectorOfUInts);
00106    maxCurvesToSave_             = iConfig.getUntrackedParameter<uint32_t>("maxCurvesToSave", 1000);
00107    write2dHistograms_           = iConfig.getUntrackedParameter<bool>("write2dHistograms", true);
00108    write2dFitResult_            = iConfig.getUntrackedParameter<bool>("write2dFitResult", true);
00109    printoutthresholds_          = iConfig.getUntrackedParameter<bool>("writeOutThresholdSummary",true);
00110    thresholdfilename_           = iConfig.getUntrackedParameter<std::string>("thresholdOutputFileName","thresholds.txt");  
00111    minimumChi2prob_             = iConfig.getUntrackedParameter<double>("minimumChi2prob", 0);
00112    minimumThreshold_            = iConfig.getUntrackedParameter<double>("minimumThreshold", -10);
00113    maximumThreshold_            = iConfig.getUntrackedParameter<double>("maximumThreshold", 300);
00114    minimumSigma_                = iConfig.getUntrackedParameter<double>("minimumSigma", 0);
00115    maximumSigma_                = iConfig.getUntrackedParameter<double>("maximumSigma", 100);
00116    minimumEffAsymptote_         = iConfig.getUntrackedParameter<double>("minimumEffAsymptote", 0);
00117    maximumEffAsymptote_         = iConfig.getUntrackedParameter<double>("maximumEffAsymptote", 1000);
00118    maximumSigmaBin_             = iConfig.getUntrackedParameter<double>("maximumSigmaBin", 10);
00119    maximumThresholdBin_         = iConfig.getUntrackedParameter<double>("maximumThresholdBin", 255);
00120 
00121    writeZeroes_= iConfig.getUntrackedParameter<bool>("alsoWriteZeroThresholds", false);
00122 
00123    // convert the vector into a map for quicker lookups.
00124    for(unsigned int i = 0; i < detIDsToSaveVector_.size(); i++)
00125       detIDsToSave_.insert( std::make_pair(detIDsToSaveVector_[i], true) );
00126 }

sCurveErrorFlag SiPixelSCurveCalibrationAnalysis::estimateSCurveParameters ( const std::vector< float > &  eff,
float &  threshold,
float &  sigma 
)

Definition at line 201 of file SiPixelSCurveCalibrationAnalysis.cc.

References errAllZeros, errNoTurnOn, errOK, output(), and SiPixelOfflineCalibAnalysisBase::vCalValues_.

Referenced by doFits().

00202 {
00203    sCurveErrorFlag output = errAllZeros;
00204    bool allZeroSoFar    = true;
00205    int turnOnBin        = -1;
00206    int saturationBin    = -1;
00207    for (uint32_t iVcalPt = 0; iVcalPt < eff.size(); iVcalPt++)
00208    {
00209       if (allZeroSoFar && eff[iVcalPt] != 0 ) {
00210          turnOnBin = iVcalPt;
00211          allZeroSoFar = false;
00212          output = errNoTurnOn;
00213       } else if (eff[iVcalPt] > 0.90)
00214       {
00215          saturationBin  = iVcalPt;
00216          short turnOnVcal       = vCalValues_[turnOnBin];
00217          short saturationVcal   = vCalValues_[saturationBin];
00218          short delta            = saturationVcal - turnOnVcal;
00219          sigma                  = delta * 0.682;
00220          if (sigma < 1)         //check to make sure sigma guess is larger than our X resolution.  Hopefully prevents Minuit from getting stuck at boundary
00221             sigma = 1;
00222          threshold              = turnOnVcal + (0.5 * delta);
00223          return errOK;
00224       }
00225    }
00226    return output;
00227 }

sCurveErrorFlag SiPixelSCurveCalibrationAnalysis::fittedSCurveSanityCheck ( float  threshold,
float  sigma,
float  amplitude 
)

Definition at line 229 of file SiPixelSCurveCalibrationAnalysis.cc.

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

Referenced by doFits().

00230 {
00231    //check if nonsensical
00232    if (threshold > vCalValues_[vCalValues_.size()-1] || threshold < vCalValues_[0] ||
00233          sigma > vCalValues_[vCalValues_.size()-1] - vCalValues_[0] )
00234       return errFitNonPhysical;
00235 
00236    if (threshold < minimumThreshold_ || threshold > maximumThreshold_ ||
00237          sigma < minimumSigma_ || sigma > maximumSigma_ ||
00238          amplitude < minimumEffAsymptote_ || amplitude > maximumEffAsymptote_)
00239       return errFlaggedBadByUser;
00240 
00241    return errOK;
00242 }

void SiPixelSCurveCalibrationAnalysis::makeThresholdSummary ( void   )  [private]

Definition at line 25 of file SiPixelSCurveCalibrationAnalysis.cc.

References GenMuonPlsPt100GeV_cfg::cout, sipixelobjects::ElectronicIndex::dcol, sipixelobjects::LocalPixel::DcolPxid::dcol, lat::endl(), SiPixelFedCablingMap::fed(), MonitorElement::getBinContent(), MonitorElement::getNbinsX(), MonitorElement::getNbinsY(), MonitorElement::getTitle(), histograms_, icol, sipixelobjects::PixelROC::idInDetUnit(), kSigmas, kThresholds, link(), sipixelobjects::ElectronicIndex::link, sipixelobjects::PixelFEDCabling::link(), muonGeometry::loc, name, edm::ESHandle< T >::product(), sipixelobjects::ElectronicIndex::pxid, sipixelobjects::LocalPixel::DcolPxid::pxid, sipixelobjects::PixelFEDLink::roc(), sipixelobjects::ElectronicIndex::roc, sipixelobjects::LocalPixel::rocCol(), sipixelobjects::LocalPixel::rocRow(), SiPixelOfflineCalibAnalysisBase::theCablingMap_, thresholdfilename_, and writeZeroes_.

Referenced by calibrationEnd().

00025                                                                {
00026   ofstream myfile;
00027   myfile.open (thresholdfilename_.c_str());
00028   for(detIDHistogramMap::iterator  thisDetIdHistoGrams= histograms_.begin();  thisDetIdHistoGrams != histograms_.end(); ++thisDetIdHistoGrams){
00029    // loop over det id (det id = number (unsigned int) of pixel module 
00030     const MonitorElement *sigmahist = (*thisDetIdHistoGrams).second[kSigmas];
00031     const MonitorElement *thresholdhist = (*thisDetIdHistoGrams).second[kThresholds];  
00032     uint32_t detid = (*thisDetIdHistoGrams).first;
00033     std::string name = sigmahist->getTitle();
00034     std::string rocname = name.substr(0,name.size()-7);
00035     rocname+="_ROC";
00036     int total_rows = sigmahist ->getNbinsY();
00037     int total_columns = sigmahist->getNbinsX();
00038     //loop over all rows on columns on all ROCs 
00039     for (int irow=0; irow<total_rows; ++irow){
00040       for (int icol=0; icol<total_columns; ++icol){
00041         float threshold_error = sigmahist->getBinContent(icol+1,irow+1); // +1 because root bins start at 1
00042         if(writeZeroes_ ||(!writeZeroes_ && threshold_error>0)){             
00043           //changing from offline to online numbers
00044           int realfedID=-1;
00045           for(int fedid=0; fedid<=40; ++fedid){
00046             SiPixelFrameConverter converter(theCablingMap_.product(),fedid);
00047             if(converter.hasDetUnit(detid)){
00048               realfedID=fedid;
00049               break;   
00050             }
00051           }
00052           if (realfedID==-1){
00053             std::cout<<"error: could not obtain real fed ID"<<std::endl;
00054           }
00055           sipixelobjects::DetectorIndex detector ={detid,irow,icol};
00056           sipixelobjects::ElectronicIndex cabling; 
00057           SiPixelFrameConverter formatter(theCablingMap_.product(),realfedID);
00058           formatter.toCabling(cabling,detector);
00059           // cabling should now contain cabling.roc and cabling.dcol  and cabling.pxid
00060           // however, the coordinates now need to be converted from dcl,pxid to the row,col coordinates used in the calibration info 
00061           sipixelobjects::LocalPixel::DcolPxid loc;
00062           loc.dcol = cabling.dcol;
00063           loc.pxid = cabling.pxid;
00064           const sipixelobjects::PixelFEDCabling *theFed= theCablingMap_.product()->fed(realfedID);
00065           const sipixelobjects::PixelFEDLink * link = theFed->link(cabling.link);
00066           const sipixelobjects::PixelROC *theRoc = link->roc(cabling.roc);
00067           sipixelobjects::LocalPixel locpixel(loc);
00068           int newrow= locpixel.rocRow();
00069           int newcol = locpixel.rocCol();
00070           myfile<<rocname<<theRoc->idInDetUnit()<<" "<<newcol<<" "<<newrow<<" "<<thresholdhist->getBinContent(icol+1, irow+1)<<" "<<threshold_error;  // +1 because root bins start at 1
00071           myfile<<"\n";
00072         }
00073       }
00074     }
00075   }
00076   myfile.close();
00077 }

void SiPixelSCurveCalibrationAnalysis::newDetID ( uint32_t  detid  )  [private, virtual]

Reimplemented from SiPixelOfflineCalibAnalysisBase.

Definition at line 254 of file SiPixelSCurveCalibrationAnalysis.cc.

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

00255 {
00256    edm::LogInfo("SiPixelSCurveCalibrationAnalysis") << "Found a new DetID (" << detid << ")!  Checking to make sure it has not been added.";
00257    //ensure that this DetID has not been added yet
00258    sCurveHistogramHolder tempMap;
00259    std::pair<detIDHistogramMap::iterator, bool> insertResult; 
00260    insertResult = histograms_.insert(std::make_pair(detid, tempMap));
00261    if (insertResult.second)     //indicates successful insertion
00262    {
00263       edm::LogInfo("SiPixelSCurveCalibrationAnalysisHistogramReport") << "Histogram Map.insert() returned true!  Booking new histogrames for detID: " << detid;
00264       // use detector hierarchy folders if desired
00265       if (useDetectorHierarchyFolders_)
00266          setDQMDirectory(detid);
00267 
00268       std::string detIdName = translateDetIdToString(detid);
00269       if (write2dHistograms_){
00270         MonitorElement * D2sigma       = bookDQMHistoPlaquetteSummary2D(detid,"ScurveSigmas", detIdName + " Sigmas");
00271         MonitorElement * D2thresh      = bookDQMHistoPlaquetteSummary2D(detid,"ScurveThresholds", detIdName + " Thresholds");
00272         MonitorElement * D2chi2        = bookDQMHistoPlaquetteSummary2D(detid,"ScurveChi2Prob",detIdName + " Chi2Prob");
00273          insertResult.first->second.insert(std::make_pair(kSigmas, D2sigma));
00274          insertResult.first->second.insert(std::make_pair(kThresholds, D2thresh));
00275          insertResult.first->second.insert(std::make_pair(kChi2s, D2chi2));
00276       }
00277       if (write2dFitResult_){
00278         MonitorElement * D2FitResult = bookDQMHistoPlaquetteSummary2D(detid,"ScurveFitResult", detIdName + " Fit Result");
00279          insertResult.first->second.insert(std::make_pair(kFitResults, D2FitResult));
00280       }
00281       MonitorElement * D1sigma       = bookDQMHistogram1D(detid,"ScurveSigmasSummary", detIdName + " Sigmas Summary", 100, 0, maximumSigmaBin_);
00282       MonitorElement * D1thresh      = bookDQMHistogram1D(detid,"ScurveThresholdSummary", detIdName + " Thresholds Summary", 255, 0, maximumThresholdBin_);
00283       MonitorElement * D1chi2        = bookDQMHistogram1D(detid,"ScurveChi2ProbSummary", detIdName + " Chi2Prob Summary", 101, 0, 1.01);
00284       MonitorElement * D1FitResult   = bookDQMHistogram1D(detid,"ScurveFitResultSummary", detIdName + " Fit Result Summary", 10, -0.5, 9.5);
00285       insertResult.first->second.insert(std::make_pair(kSigmaSummary, D1sigma));
00286       insertResult.first->second.insert(std::make_pair(kThresholdSummary, D1thresh));
00287       insertResult.first->second.insert(std::make_pair(kChi2Summary, D1chi2));
00288       insertResult.first->second.insert(std::make_pair(kFitResultSummary, D1FitResult));
00289    }
00290 }


Member Data Documentation

unsigned int SiPixelSCurveCalibrationAnalysis::curvesSavedCounter_ [private]

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().

detIDHistogramMap SiPixelSCurveCalibrationAnalysis::histograms_ [private]

Definition at line 107 of file SiPixelSCurveCalibrationAnalysis.h.

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

unsigned int SiPixelSCurveCalibrationAnalysis::maxCurvesToSave_ [private]

Definition at line 81 of file SiPixelSCurveCalibrationAnalysis.h.

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

double SiPixelSCurveCalibrationAnalysis::maximumEffAsymptote_ [private]

Definition at line 99 of file SiPixelSCurveCalibrationAnalysis.h.

Referenced by doSetup(), and fittedSCurveSanityCheck().

double SiPixelSCurveCalibrationAnalysis::maximumSigma_ [private]

Definition at line 97 of file SiPixelSCurveCalibrationAnalysis.h.

Referenced by doSetup(), and fittedSCurveSanityCheck().

double SiPixelSCurveCalibrationAnalysis::maximumSigmaBin_ [private]

Definition at line 103 of file SiPixelSCurveCalibrationAnalysis.h.

Referenced by doSetup(), and newDetID().

double SiPixelSCurveCalibrationAnalysis::maximumThreshold_ [private]

Definition at line 95 of file SiPixelSCurveCalibrationAnalysis.h.

Referenced by doSetup(), and fittedSCurveSanityCheck().

double SiPixelSCurveCalibrationAnalysis::maximumThresholdBin_ [private]

Definition at line 102 of file SiPixelSCurveCalibrationAnalysis.h.

Referenced by doSetup(), and newDetID().

double SiPixelSCurveCalibrationAnalysis::minimumChi2prob_ [private]

Definition at line 93 of file SiPixelSCurveCalibrationAnalysis.h.

Referenced by doFits(), and doSetup().

double SiPixelSCurveCalibrationAnalysis::minimumEffAsymptote_ [private]

Definition at line 98 of file SiPixelSCurveCalibrationAnalysis.h.

Referenced by doSetup().

double SiPixelSCurveCalibrationAnalysis::minimumSigma_ [private]

Definition at line 96 of file SiPixelSCurveCalibrationAnalysis.h.

Referenced by doSetup().

double SiPixelSCurveCalibrationAnalysis::minimumThreshold_ [private]

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.

bool SiPixelSCurveCalibrationAnalysis::printoutthresholds_ [private]

Definition at line 86 of file SiPixelSCurveCalibrationAnalysis.h.

Referenced by calibrationEnd(), and doSetup().

bool SiPixelSCurveCalibrationAnalysis::saveCurvesThatFlaggedBad_ [private]

Definition at line 80 of file SiPixelSCurveCalibrationAnalysis.h.

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

std::string SiPixelSCurveCalibrationAnalysis::thresholdfilename_ [private]

Definition at line 88 of file SiPixelSCurveCalibrationAnalysis.h.

Referenced by doSetup(), and makeThresholdSummary().

bool SiPixelSCurveCalibrationAnalysis::useDetectorHierarchyFolders_ [private]

Definition at line 79 of file SiPixelSCurveCalibrationAnalysis.h.

Referenced by doSetup(), and newDetID().

std::vector<float> SiPixelSCurveCalibrationAnalysis::vCalPointsAsFloats_

Definition at line 68 of file SiPixelSCurveCalibrationAnalysis.h.

Referenced by buildACurveHistogram(), and calibrationSetup().

bool SiPixelSCurveCalibrationAnalysis::write2dFitResult_ [private]

Definition at line 84 of file SiPixelSCurveCalibrationAnalysis.h.

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

bool SiPixelSCurveCalibrationAnalysis::write2dHistograms_ [private]

Definition at line 83 of file SiPixelSCurveCalibrationAnalysis.h.

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

bool SiPixelSCurveCalibrationAnalysis::writeZeroes_ [private]

Definition at line 87 of file SiPixelSCurveCalibrationAnalysis.h.

Referenced by doSetup(), and makeThresholdSummary().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:32:05 2009 for CMSSW by  doxygen 1.5.4