CMS 3D CMS Logo

Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Attributes

LA_Filler_Fitter Class Reference

#include <LA_Filler_Fitter.h>

List of all members.

Classes

struct  EnsembleSummary
struct  Result

Public Types

enum  Method {
  WIDTH = 1<<0, FIRST_METHOD = 1<<0, PROB1 = 1<<1, AVGV2 = 1<<2,
  AVGV3 = 1<<3, RMSV2 = 1<<4, RMSV3 = 1<<5, LAST_METHOD = 1<<5
}

Public Member Functions

poly< std::string > allAndOne (const unsigned width) const
void fill (TTree *, Book &) const
void fill_one_cluster (Book &, const poly< std::string > &, const unsigned, const float, const float, const float, const float) const
poly< std::string > granularity (const SiStripDetId, const float, const Long64_t, const float, const unsigned) const
 LA_Filler_Fitter (int methods, int M, int N, double low, double up, unsigned max)
 LA_Filler_Fitter (int methods, bool layer, bool module, float localybin, unsigned stripbin, unsigned max)
void summarize_ensembles (Book &) const
poly< std::string > varWidth (const unsigned width) const

Static Public Member Functions

static std::map< std::string,
std::vector< Result > > 
ensemble_results (const Book &, const Method)
static std::map< std::string,
std::vector< EnsembleSummary > > 
ensemble_summary (const Book &)
static unsigned find_rebin (const TH1 *const)
static void fit (Book &book)
static void fit_width_profile (Book &)
static unsigned layer_index (bool TIB, bool stereo, unsigned layer)
static std::map< std::string,
Result
layer_results (const Book &, const Method)
static std::string layerLabel (const SiStripDetId)
static void make_and_fit_symmchi2 (Book &)
static std::string method (Method m, bool fit=true)
static std::map< uint32_t, Resultmodule_results (const Book &, const Method)
static std::string moduleLabel (const SiStripDetId)
static std::pair< std::pair
< float, float >, std::pair
< float, float > > 
offset_slope (const std::vector< EnsembleSummary > &)
static float pull (const std::vector< EnsembleSummary > &)
static Result result (Method, const std::string name, const Book &)
static TH1 * rms_profile (const std::string, const TProfile *const)
static std::string subdetLabel (const SiStripDetId)
static TH1 * subset_probability (const std::string name, const TH1 *const , const TH1 *const )

Private Attributes

const bool byLayer_
const bool byModule_
const int ensembleBins_
const double ensembleLow_
const int ensembleSize_
const double ensembleUp_
const float localYbin_
const Long64_t maxEvents_
const int methods_
const unsigned stripsPerBin_

Detailed Description

Definition at line 14 of file LA_Filler_Fitter.h.


Member Enumeration Documentation

Enumerator:
WIDTH 
FIRST_METHOD 
PROB1 
AVGV2 
AVGV3 
RMSV2 
RMSV3 
LAST_METHOD 

Definition at line 38 of file LA_Filler_Fitter.h.

              { WIDTH =1<<0, FIRST_METHOD=1<<0, 
                PROB1 =1<<1,
                AVGV2 =1<<2,  
                AVGV3 =1<<3, 
                RMSV2 =1<<4,
                RMSV3 =1<<5, LAST_METHOD=1<<5};

Constructor & Destructor Documentation

LA_Filler_Fitter::LA_Filler_Fitter ( int  methods,
int  M,
int  N,
double  low,
double  up,
unsigned  max 
) [inline]

Definition at line 19 of file LA_Filler_Fitter.h.

LA_Filler_Fitter::LA_Filler_Fitter ( int  methods,
bool  layer,
bool  module,
float  localybin,
unsigned  stripbin,
unsigned  max 
) [inline]

Definition at line 29 of file LA_Filler_Fitter.h.


Member Function Documentation

poly< std::string > LA_Filler_Fitter::allAndOne ( const unsigned  width) const

Definition at line 60 of file LA_Filler.cc.

Referenced by fill_one_cluster().

{ poly<std::string> a1("_all"); if(width==1) a1*="_w1"; return a1;}
std::map< std::string, std::vector< LA_Filler_Fitter::Result > > LA_Filler_Fitter::ensemble_results ( const Book book,
const Method  m 
) [static]

Definition at line 73 of file LA_Results.cc.

References Book::begin(), Book::end(), method(), mergeVDriftHistosByStation::name, result(), and python::entryComment::results.

Referenced by summarize_ensembles().

                                                    {
  std::map<std::string, std::vector<Result> > results;
  for(Book::const_iterator it = book.begin(".*_sample.*"+method(m)); it!=book.end(); ++it ) {
    const std::string name = boost::regex_replace(it->first,boost::regex("sample\\d*_"),"");
    results[name].push_back(result(m,it->first,book));
  }
  return results;
}
std::map< std::string, std::vector< LA_Filler_Fitter::EnsembleSummary > > LA_Filler_Fitter::ensemble_summary ( const Book book) [static]

Definition at line 105 of file LA_Results.cc.

References Book::begin(), Book::end(), LA_Filler_Fitter::EnsembleSummary::meanMeasured, LA_Filler_Fitter::EnsembleSummary::meanUncertainty, mergeVDriftHistosByStation::name, LA_Filler_Fitter::EnsembleSummary::pull, pull(), dt_dqm_sourceclient_common_cff::reco, asciidump::s, LA_Filler_Fitter::EnsembleSummary::samples, LA_Filler_Fitter::EnsembleSummary::sigmaMeasured, summarizeEdmComparisonLogfiles::summary, and LA_Filler_Fitter::EnsembleSummary::truth.

Referenced by sistrip::EnsembleCalibrationLA::write_ensembles_text().

                                   {
  std::map<std::string, std::vector<EnsembleSummary> > summary;
  for(Book::const_iterator it = book.begin(".*_ensembleReco"); it!=book.end(); ++it) {
    const std::string base = boost::erase_all_copy(it->first,"_ensembleReco");

    const TH1*const reco = it->second;
    const TH1*const measure = book[base+"_measure"];
    const TH1*const merr = book[base+"_merr"];
    const TH1*const pull = book[base+"_pull"];

    EnsembleSummary s;
    s.samples = reco->GetEntries();
    s.truth = reco->GetMean();
    s.meanMeasured = std::make_pair<float,float>( measure->GetFunction("gaus")->GetParameter(1), measure->GetFunction("gaus")->GetParError(1) );
    s.sigmaMeasured = std::make_pair<float,float>( measure->GetFunction("gaus")->GetParameter(2), measure->GetFunction("gaus")->GetParError(2) );
    s.meanUncertainty = std::make_pair<float,float>( merr->GetFunction("gaus")->GetParameter(1), merr->GetFunction("gaus")->GetParError(1) );
    s.pull = std::make_pair<float,float>( pull->GetFunction("gaus")->GetParameter(2), pull->GetFunction("gaus")->GetParError(2) );

    const std::string name = boost::regex_replace(base,boost::regex("ensembleBin\\d*_"),"");
    summary[name].push_back(s);
  }
  return summary;
}
void LA_Filler_Fitter::fill ( TTree *  tree,
Book book 
) const

Definition at line 8 of file LA_Filler.cc.

References funct::cos(), cond::rpcobgas::detid, ensembleBins_, fill_one_cluster(), granularity(), i, localYbin_, maxEvents_, MultiGaussianStateTransform::N, stripsPerBin_, SiStripDetId::subDetector(), swap(), funct::tan(), SiStripDetId::TIB, and sistripsummary::TOB.

Referenced by sistrip::EnsembleCalibrationLA::endJob(), and sistrip::MeasureLA::MeasureLA().

                                    {
  TTREE_FOREACH_ENTRY(tree) {
    TFE_MAX(maxEvents_);
    TFE_PRINTSTATUS;
    std::vector<unsigned> PLEAF( tsostrackmulti , tree );
    std::vector<unsigned> PLEAF( clusterdetid , tree );
    std::vector<unsigned> PLEAF( clusterwidth , tree );
    std::vector<float>    PLEAF( clustervariance , tree );
    std::vector<float>    PLEAF( tsosdriftx , tree );
    std::vector<float>    PLEAF( tsosdriftz , tree );
    std::vector<float>    PLEAF( tsoslocaltheta , tree );
    std::vector<float>    PLEAF( tsoslocalphi , tree );
    std::vector<float>    PLEAF( tsosglobalZofunitlocalY , tree );

    const unsigned N(clusterdetid.size());
    std::vector<float> BdotY(N,0); if(!ensembleBins_) { std::vector<float> PLEAF( tsosBdotY , tree ); swap(BdotY, tsosBdotY); }
    std::vector<float> localy(N,0); if(localYbin_) { std::vector<float> PLEAF( tsoslocaly , tree ); swap(localy, tsoslocaly);}
    std::vector<unsigned> seedstrip(N,0); if(stripsPerBin_) { std::vector<unsigned> PLEAF( clusterseedstrip , tree ); swap(seedstrip, clusterseedstrip);}

    for(unsigned i=0; i<N ; i++) {

      const SiStripDetId detid(clusterdetid[i]);
      if( tsostrackmulti[i] != 1 || ( detid.subDetector()!=SiStripDetId::TIB && 
                                      detid.subDetector()!=SiStripDetId::TOB)    )  continue;

      const int sign = tsosglobalZofunitlocalY[i] < 0 ? -1 : 1;
      const float tthetaL = sign * tsosdriftx[i] / tsosdriftz[i];
      const float tthetaT = sign * tan(tsoslocaltheta[i]) * cos(tsoslocalphi[i]);
  
      fill_one_cluster( book, 
                        granularity(detid, tthetaL, TFE_index, localy[i], seedstrip[i]%128),
                        clusterwidth[i], clustervariance[i], tthetaL, tthetaT, fabs(BdotY[i]) );
    }
  }
}
void LA_Filler_Fitter::fill_one_cluster ( Book book,
const poly< std::string > &  gran,
const unsigned  width,
const float  variance,
const float  tthetaL,
const float  tthetaT,
const float  BdotY 
) const

Definition at line 45 of file LA_Filler.cc.

References allAndOne(), ensembleBins_, Book::fill(), method(), methods_, varWidth(), and WIDTH.

Referenced by fill().

{
  book.fill( tthetaL,                   gran+"_reconstruction", 360,-1.0,1.0 );
  book.fill( tthetaT-tthetaL,           gran+ allAndOne(width), 360,-1.0,1.0 );
  book.fill( tthetaT-tthetaL, variance, gran+  varWidth(width), 360,-1.0,1.0 );
  if(methods_ & WIDTH) book.fill( tthetaT, width, gran+method(WIDTH), 81,-0.6,0.6 );
  if(!ensembleBins_) {
    book.fill( BdotY, gran+"_field", 101,1,5);
    book.fill( width, gran+"_width", 10,0,10);
  }
}
unsigned LA_Filler_Fitter::find_rebin ( const TH1 * const  hist) [static]

Definition at line 81 of file LA_Fitter.cc.

References begin, end, i, max(), plotscripts::mean(), min, and plotscripts::rms().

Referenced by make_and_fit_symmchi2().

                                  {
  const double mean = hist->GetMean();
  const double rms = hist->GetRMS();
  const int begin = std::min(                1, hist->GetXaxis()->FindFixBin(mean-rms));
  const int end   = std::max(hist->GetNbinsX(), hist->GetXaxis()->FindFixBin(mean+rms)) + 1;
  unsigned current_hole(0), max_hole(0);
  for(int i=begin; i<end; i++) {
    if(!hist->GetBinError(i)) current_hole++;
    else if(current_hole) {max_hole = std::max(current_hole,max_hole); current_hole=0;}
  }
  return max_hole+1;
}
static void LA_Filler_Fitter::fit ( Book book) [inline, static]
void LA_Filler_Fitter::fit_width_profile ( Book book) [static]

Definition at line 10 of file LA_Fitter.cc.

References Book::begin(), Book::end(), Book::erase(), fit(), max(), method(), min, L1TEmulatorMonitor_cff::p, and WIDTH.

Referenced by fit().

                              {
  for(Book::iterator it = book.begin(".*"+method(WIDTH)); it!=book.end(); ++it) {
    it->second->SetTitle("Mean Cluster Width;tan#theta_{t}");
    TH1* const p = it->second;
    if(p->GetEntries() < 400) { delete p; book[it->first]=0; continue;}
    p->SetTitle(";tan#theta_{t};");
    const float min = p->GetMinimum();
    const float max = p->GetMaximum();
    float xofmin = p->GetBinCenter(p->GetMinimumBin()); if( xofmin>0.0 || xofmin<-0.15) xofmin = -0.05;
    const float xofmax = p->GetBinCenter(p->GetMaximumBin());

    TF1* const fit = new TF1("LA_profile_fit","[2]*(TMath::Abs(x-[0]))+[1]",-1,1);
    fit->SetParLimits(0,-0.15,0.01);
    fit->SetParLimits(1, 0.6*min, 1.25*min );
    fit->SetParLimits(2,0.1,10);
    fit->SetParameters( xofmin, min, (max-min) / fabs( xofmax - xofmin ) );

    int badfit = p->Fit(fit,"IEQ","",-.5,.3);
    if( badfit ) badfit = p->Fit(fit,"IEQ","", -.46,.26);
    if( badfit ) { book.erase(it); }
  }
}
poly< std::string > LA_Filler_Fitter::granularity ( const SiStripDetId  detid,
const float  tthetaL,
const Long64_t  TFE_index,
const float  localy,
const unsigned  apvstrip 
) const

Definition at line 72 of file LA_Filler.cc.

References abs, byLayer_, byModule_, ensembleBins_, ensembleLow_, ensembleSize_, ensembleUp_, layerLabel(), localYbin_, moduleLabel(), stripsPerBin_, and subdetLabel().

Referenced by fill().

                                                                                                                                        {
  poly<std::string> gran;
  gran += subdetLabel(detid);
  if(byLayer_)  gran *= layerLabel(detid);
  if(byModule_) gran *= moduleLabel(detid);
  if(localYbin_) gran += (localy < 0 ? "_yM":"_yP") + boost::lexical_cast<std::string>(abs((int)(localy/localYbin_+(localy<0?-1:0))));
  if(stripsPerBin_) gran += "_strip"+boost::lexical_cast<std::string>((unsigned)((0.5+((apvstrip/64)?(127-apvstrip):apvstrip)/stripsPerBin_)*stripsPerBin_) );
  if(ensembleBins_) {
    gran+= "_ensembleBin"+boost::lexical_cast<std::string>((int)(ensembleBins_*(tthetaL-ensembleLow_)/(ensembleUp_-ensembleLow_)));
    gran+= "";
    if(ensembleSize_) gran*= "_sample"+boost::lexical_cast<std::string>(TFE_index % ensembleSize_);
  }
  return gran;
}
static unsigned LA_Filler_Fitter::layer_index ( bool  TIB,
bool  stereo,
unsigned  layer 
) [inline, static]

Definition at line 84 of file LA_Filler_Fitter.h.

Referenced by sistrip::MeasureLA::calibration_key(), and sistrip::EnsembleCalibrationLA::write_ensembles_text().

{ return  layer + (TIB?0:6) +(stereo?1:0) + ( (layer>2)?1:(layer==1)?-1:0 );}
std::map< std::string, LA_Filler_Fitter::Result > LA_Filler_Fitter::layer_results ( const Book book,
const Method  m 
) [static]

Definition at line 63 of file LA_Results.cc.

References Book::begin(), Book::end(), method(), mergeVDriftHistosByStation::name, result(), and python::entryComment::results.

Referenced by sistrip::MeasureLA::process_reports().

                                                 {
  std::map<std::string,Result> results;
  for(Book::const_iterator it = book.begin(".*layer\\d.*"+method(m)); it!=book.end(); ++it ) {
    const std::string name = boost::erase_all_copy(it->first,method(m));
    results[name] = result(m,it->first,book);
  }
  return results;
}
std::string LA_Filler_Fitter::layerLabel ( const SiStripDetId  detid) [static]

Definition at line 92 of file LA_Filler.cc.

References cond::rpcobgas::detid, TIBDetId::layer(), TOBDetId::layer(), SiStripDetId::stereo(), SiStripDetId::subDetector(), subdetLabel(), and SiStripDetId::TOB.

Referenced by granularity(), and sistrip::MeasureLA::summarize_module_muH_byLayer().

                                     {
  unsigned layer = detid.subDetector() == SiStripDetId::TOB ? TOBDetId(detid()).layer() : TIBDetId(detid()).layer();
  return subdetLabel(detid)+"_layer"+boost::lexical_cast<std::string>(layer)+(detid.stereo()?"s":"a");
}
void LA_Filler_Fitter::make_and_fit_symmchi2 ( Book book) [static]

Definition at line 34 of file LA_Fitter.cc.

References cond::ecalcond::all, AVGV2, AVGV3, Book::begin(), Book::book(), Book::end(), Book::find(), find_rebin(), estimatePileup::hist, max(), method(), PROB1, rms_profile(), RMSV2, RMSV3, subset_probability(), and SymmetryFit::symmetryChi2().

Referenced by fit().

                                  {
  for(Book::iterator it = book.begin(".*_all"); it!=book.end(); ++it) {
    const std::string base = boost::erase_all_copy(it->first,"_all");

    std::vector<Book::iterator> rebin_hists;              
    Book::iterator    all = it;                              rebin_hists.push_back(all);   
    Book::iterator     w1 = book.find(base+"_w1");           rebin_hists.push_back(w1);    
    Book::iterator var_w2 = book.find(base+method(AVGV2,0)); rebin_hists.push_back(var_w2);
    Book::iterator var_w3 = book.find(base+method(AVGV3,0)); rebin_hists.push_back(var_w3);

    const unsigned rebin = std::max( var_w2==book.end() ? 0 : find_rebin(var_w2->second), 
                                     var_w3==book.end() ? 0 : find_rebin(var_w3->second) );
    BOOST_FOREACH(Book::iterator it, rebin_hists) if(it!=book.end()) it->second->Rebin( rebin>1 ? rebin<7 ? rebin : 6 : 1);

    TH1* const prob_w1 = w1==book.end()     ? 0 : subset_probability( base+method(PROB1,0) ,w1->second,all->second);
    TH1* const rmsv_w2 = var_w2==book.end() ? 0 :        rms_profile( base+method(RMSV2,0), (TProfile*const)var_w2->second);
    TH1* const rmsv_w3 = var_w3==book.end() ? 0 :        rms_profile( base+method(RMSV3,0), (TProfile*const)var_w3->second);
    
    std::vector<TH1*> fit_hists;
    if(prob_w1) {
      book.book(base+method(PROB1,0),prob_w1);
      fit_hists.push_back(prob_w1);  prob_w1->SetTitle("Width==1 Probability;tan#theta_{t}-(dx/dz)_{reco}");
    }
    if(var_w2!=book.end())  {
      book.book(base+method(RMSV2,0),rmsv_w2);
      fit_hists.push_back(var_w2->second);   var_w2->second->SetTitle("Width==2 Mean Variance;tan#theta_{t}-(dx/dz)_{reco}");
      fit_hists.push_back(rmsv_w2);                 rmsv_w2->SetTitle("Width==2 RMS Variance;tan#theta_{t}-(dx/dz)_{reco}");
    }
    if(var_w3!=book.end())  {
      book.book(base+method(RMSV3,0),rmsv_w3);
      fit_hists.push_back(var_w3->second);   var_w3->second->SetTitle("Width==3 Mean Variance;tan#theta_{t}-(dx/dz)_{reco}");
      fit_hists.push_back(rmsv_w3);                 rmsv_w3->SetTitle("Width==3 RMS Variance;tan#theta_{t}-(dx/dz)_{reco}");
    }

    if(!fit_hists.size()) continue;
    const unsigned bins = fit_hists[0]->GetNbinsX();
    const unsigned guess = fit_hists[0]->FindBin(0);
    const std::pair<unsigned,unsigned> range(guess-bins/30,guess+bins/30);

    BOOST_FOREACH(TH1*const hist, fit_hists) {
      TH1*const chi2 = SymmetryFit::symmetryChi2(hist,range);
      if(chi2) {book.book(chi2->GetName(),chi2); chi2->SetTitle("Symmetry #chi^{2};tan#theta_{t}-(dx/dz)_{reco}");}
    }
  }
}
static std::string LA_Filler_Fitter::method ( Method  m,
bool  fit = true 
) [inline, static]

Definition at line 45 of file LA_Filler_Fitter.h.

References AVGV2, AVGV3, fit(), mergeVDriftHistosByStation::name, PROB1, RMSV2, RMSV3, and WIDTH.

Referenced by ensemble_results(), fill_one_cluster(), fit_width_profile(), layer_results(), make_and_fit_symmchi2(), module_results(), result(), sistrip::MeasureLA::summarize_module_muH_byLayer(), varWidth(), sistrip::MeasureLA::write_report_plots(), and sistrip::MeasureLA::write_report_text_ms().

                                                  { 
    switch(m) {
    case WIDTH: return      "_width_prof";
    case PROB1: return fit? SymmetryFit::name(method(m,0)): "_prob_w1"   ;  
    case AVGV2: return fit? SymmetryFit::name(method(m,0)): "_avg_var_w2";  
    case AVGV3: return fit? SymmetryFit::name(method(m,0)): "_avg_var_w3";  
    case RMSV2: return fit? SymmetryFit::name(method(m,0)): "_rms_var_w2";  
    case RMSV3: return fit? SymmetryFit::name(method(m,0)): "_rms_var_w3";  
    default: return "_UNKNOWN";
    }
  }
std::map< uint32_t, LA_Filler_Fitter::Result > LA_Filler_Fitter::module_results ( const Book book,
const Method  m 
) [static]

Definition at line 51 of file LA_Results.cc.

References Book::begin(), cond::rpcobgas::detid, Book::end(), method(), result(), and python::entryComment::results.

Referenced by sistrip::MeasureLA::process_reports(), and sistrip::MeasureLA::summarize_module_muH_byLayer().

                                                  {
  std::map<uint32_t,Result> results;
  for(Book::const_iterator it = book.begin(".*_module\\d*"+method(m)); it!=book.end(); ++it ) {
    const uint32_t detid = boost::lexical_cast<uint32_t>( boost::regex_replace( it->first,
                                                                                boost::regex(".*_module(\\d*)_.*"),
                                                                                std::string("\\1")));
    results[detid] = result(m,it->first,book);
  }
  return results;
}
std::string LA_Filler_Fitter::moduleLabel ( const SiStripDetId  detid) [static]

Definition at line 90 of file LA_Filler.cc.

References cond::rpcobgas::detid, and subdetLabel().

Referenced by granularity().

{ return subdetLabel(detid) + "_module"+boost::lexical_cast<std::string>(detid());}
std::pair< std::pair< float, float >, std::pair< float, float > > LA_Filler_Fitter::offset_slope ( const std::vector< EnsembleSummary > &  ) [static]

Definition at line 130 of file LA_Results.cc.

References benchmark_cfg::cerr, fit(), LA_Filler_Fitter::EnsembleSummary::meanMeasured, LA_Filler_Fitter::EnsembleSummary::truth, x, and detailsBasic3DVector::y.

Referenced by sistrip::EnsembleCalibrationLA::write_ensembles_text().

                                                                          { 
  try {
    std::vector<float> x,y,xerr,yerr;
    BOOST_FOREACH(EnsembleSummary ensemble, ensembles) {
      x.push_back(ensemble.truth);
      xerr.push_back(0);
      y.push_back(ensemble.meanMeasured.first);
      yerr.push_back(ensemble.meanMeasured.second);
    }
    TGraphErrors graph(x.size(),&(x[0]),&(y[0]),&(xerr[0]),&(yerr[0]));
    graph.Fit("pol1");
    const TF1*const fit = graph.GetFunction("pol1");
    
    return std::make_pair( std::make_pair(fit->GetParameter(0), fit->GetParError(0)),
                           std::make_pair(fit->GetParameter(1), fit->GetParError(1)) );
  } catch(edm::Exception e) { 
    std::cerr << "Fitting Line Failed " << std::endl << e << std::endl;
    return std::make_pair( std::make_pair(0,0), std::make_pair(0,0));
  }
}
static float LA_Filler_Fitter::pull ( const std::vector< EnsembleSummary > &  ) [static]
LA_Filler_Fitter::Result LA_Filler_Fitter::result ( Method  m,
const std::string  name,
const Book book 
) [static]

Definition at line 14 of file LA_Results.cc.

References AVGV2, AVGV3, LA_Filler_Fitter::Result::chi2, LA_Filler_Fitter::Result::entries, f, LA_Filler_Fitter::Result::field, h, LA_Filler_Fitter::Result::measured, method(), mergeVDriftHistosByStation::name, LA_Filler_Fitter::Result::ndof, L1TEmulatorMonitor_cff::p, PROB1, LA_Filler_Fitter::Result::reco, dt_dqm_sourceclient_common_cff::reco, RMSV2, RMSV3, and WIDTH.

Referenced by ensemble_results(), layer_results(), and module_results().

                                                         {
  Result p;
  const std::string base = boost::erase_all_copy(name,method(m));
  
  const TH1* const h = book[name];
  const TH1* const reco = book[base+"_reconstruction"];
  const TH1* const field = book[base+"_field"];

  if(reco) p.reco = std::make_pair<float,float>( reco->GetMean(), reco->GetMeanError());
  if(field) p.field = field->GetMean();
  if(h) { switch(m) {
    case WIDTH: {
      const TF1*const f = h->GetFunction("LA_profile_fit"); if(!f) break;
      p.measured = std::make_pair<float,float>(f->GetParameter(0),f->GetParError(0));
      p.chi2 = f->GetChisquare();
      p.ndof = f->GetNDF();
      p.entries = (unsigned)(h->GetEntries());
      break;
    }
    case PROB1: case AVGV2: case AVGV3: case RMSV2: case RMSV3: /*case MULTI:*/ {
      const TF1*const f = h->GetFunction("SymmetryFit"); if(!f) break;
      p.measured = std::make_pair<float,float>( p.reco.first + f->GetParameter(0), f->GetParameter(1) );
      p.chi2 = f->GetParameter(2);
      p.ndof = (unsigned) (f->GetParameter(3));
      p.entries = 
        (m&PROB1)         ? (unsigned) book[base+"_w1"]->GetEntries() : 
        (m&(AVGV2|RMSV2)) ? (unsigned) book[base+method(AVGV2,0)]->GetEntries() : 
        (m&(AVGV3|RMSV3)) ? (unsigned) book[base+method(AVGV3,0)]->GetEntries() : 0 ;
      break;
    }
    default: break;
    }
  }
  return p;
}
TH1 * LA_Filler_Fitter::rms_profile ( const std::string  name,
const TProfile * const  prof 
) [static]

Definition at line 95 of file LA_Fitter.cc.

References i, plotscripts::rms(), and mathSSE::sqrt().

Referenced by make_and_fit_symmchi2().

                                                              {
  const int bins = prof->GetNbinsX();
  TH1* const rms = new TH1F(name.c_str(),"",bins, prof->GetBinLowEdge(1),  prof->GetBinLowEdge(bins) + prof->GetBinWidth(bins) );
  for(int i = 1; i<=bins; i++) {
    const double Me = prof->GetBinError(i);
    const double neff = prof->GetBinEntries(i); //Should be prof->GetBinEffectiveEntries(i);, not availible this version ROOT.  This is only ok for unweighted fills
    rms->SetBinContent(i, Me*sqrt(neff) );
    rms->SetBinError(i, Me/sqrt(2) );
  }
  return rms;
}
std::string LA_Filler_Fitter::subdetLabel ( const SiStripDetId  detid) [static]

Definition at line 88 of file LA_Filler.cc.

References SiStripDetId::subDetector(), and SiStripDetId::TOB.

Referenced by granularity(), layerLabel(), and moduleLabel().

{ return detid.subDetector()==SiStripDetId::TOB? "TOB" : "TIB";}
TH1 * LA_Filler_Fitter::subset_probability ( const std::string  name,
const TH1 * const  subset,
const TH1 * const  total 
) [static]

Definition at line 108 of file LA_Fitter.cc.

References i, L1TEmulatorMonitor_cff::p, asciidump::s, and mathSSE::sqrt().

Referenced by make_and_fit_symmchi2().

                                                                                          {
  const int bins = subset->GetNbinsX();
  TH1* const prob = new TH1F(name.c_str(),"",bins, subset->GetBinLowEdge(1),  subset->GetBinLowEdge(bins) + subset->GetBinWidth(bins) );
  for(int i = 1; i<=bins; i++) {
    const double s = subset->GetBinContent(i);
    const double T = total->GetBinContent(i);
    const double B = T-s;

    const double p = T? s/T : 0;
    const double perr = T? ( (s&&B)? sqrt(s*s*B+B*B*s)/(T*T) : 1/T ) : 0;

    prob->SetBinContent(i,p);
    prob->SetBinError(i,perr);
  }  
  return prob;
}
void LA_Filler_Fitter::summarize_ensembles ( Book book) const

Definition at line 83 of file LA_Results.cc.

References ensemble_results(), ensembleBins_, ensembleLow_, ensembleUp_, Book::fill(), FIRST_METHOD, g, LAST_METHOD, m, LA_Filler_Fitter::Result::measured, methods_, mergeVDriftHistosByStation::name, L1TEmulatorMonitor_cff::p, LA_Filler_Fitter::Result::reco, and python::entryComment::results.

Referenced by sistrip::EnsembleCalibrationLA::endJob().

                                      {
  typedef std::map<std::string, std::vector<Result> > results_t;
  results_t results;
  for(int m = FIRST_METHOD; m <= LAST_METHOD; m<<=1)
    if(methods_ & m) { results_t g = ensemble_results(book,(Method)(m)); results.insert(g.begin(),g.end());}
  
  BOOST_FOREACH(const results_t::value_type group, results) {
    const std::string name = group.first;
    BOOST_FOREACH(const Result p, group.second) {
      const float pad = (ensembleUp_-ensembleLow_)/10;
      book.fill( p.reco.first,      name+"_ensembleReco", 12*ensembleBins_, ensembleLow_-pad, ensembleUp_+pad );
      book.fill( p.measured.first,  name+"_measure",      12*ensembleBins_, ensembleLow_-pad, ensembleUp_+pad );
      book.fill( p.measured.second, name+"_merr",         500, 0, 0.01);
      book.fill( (p.measured.first-p.reco.first)/p.measured.second, name+"_pull", 500, -10,10);
    }
    book[name+"_measure"]->Fit("gaus","LLQ");
    book[name+"_merr"]->Fit("gaus","LLQ");
    book[name+"_pull"]->Fit("gaus","LLQ");
  }
}
poly< std::string > LA_Filler_Fitter::varWidth ( const unsigned  width) const

Definition at line 64 of file LA_Filler.cc.

References AVGV2, AVGV3, method(), methods_, RMSV2, and RMSV3.

Referenced by fill_one_cluster().

                                     { 
  poly<std::string> vw; vw++; 
  if(width==2 && methods_ & (AVGV2|RMSV2) ) vw*=method(AVGV2,0);
  if(width==3 && methods_ & (AVGV3|RMSV3) ) vw*=method(AVGV3,0);
  return vw;
}

Member Data Documentation

const bool LA_Filler_Fitter::byLayer_ [private]

Definition at line 108 of file LA_Filler_Fitter.h.

Referenced by granularity().

const bool LA_Filler_Fitter::byModule_ [private]

Definition at line 108 of file LA_Filler_Fitter.h.

Referenced by granularity().

const int LA_Filler_Fitter::ensembleBins_ [private]

Definition at line 106 of file LA_Filler_Fitter.h.

Referenced by fill(), fill_one_cluster(), granularity(), and summarize_ensembles().

const double LA_Filler_Fitter::ensembleLow_ [private]

Definition at line 107 of file LA_Filler_Fitter.h.

Referenced by granularity(), and summarize_ensembles().

const int LA_Filler_Fitter::ensembleSize_ [private]

Definition at line 106 of file LA_Filler_Fitter.h.

Referenced by granularity().

const double LA_Filler_Fitter::ensembleUp_ [private]

Definition at line 107 of file LA_Filler_Fitter.h.

Referenced by granularity(), and summarize_ensembles().

const float LA_Filler_Fitter::localYbin_ [private]

Definition at line 109 of file LA_Filler_Fitter.h.

Referenced by fill(), and granularity().

const Long64_t LA_Filler_Fitter::maxEvents_ [private]

Definition at line 111 of file LA_Filler_Fitter.h.

Referenced by fill().

const int LA_Filler_Fitter::methods_ [private]

Definition at line 112 of file LA_Filler_Fitter.h.

Referenced by fill_one_cluster(), summarize_ensembles(), and varWidth().

const unsigned LA_Filler_Fitter::stripsPerBin_ [private]

Definition at line 110 of file LA_Filler_Fitter.h.

Referenced by fill(), and granularity().