CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Attributes
LA_Filler_Fitter Class Reference

#include <LA_Filler_Fitter.h>

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, const TrackerTopology *tTopo)
 
 LA_Filler_Fitter (int methods, bool layer, bool module, float localybin, unsigned stripbin, unsigned max, const TrackerTopology *tTopo)
 
std::string layerLabel (const SiStripDetId) const
 
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, Resultlayer_results (const Book &, const Method)
 
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_
 
const TrackerTopologytTopo_
 

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 40 of file LA_Filler_Fitter.h.

Constructor & Destructor Documentation

LA_Filler_Fitter::LA_Filler_Fitter ( int  methods,
int  M,
int  N,
double  low,
double  up,
unsigned  max,
const TrackerTopology tTopo 
)
inline

Definition at line 19 of file LA_Filler_Fitter.h.

19  :
20  ensembleSize_(M),
22  byLayer_(true),byModule_(false),
23  localYbin_(0),
24  stripsPerBin_(0),
25  maxEvents_(max),
26  methods_(methods),
27  tTopo_(tTopo) {}
Definition: BitonicSort.h:8
const Long64_t maxEvents_
const float localYbin_
#define N
Definition: blowfish.cc:9
const TrackerTopology * tTopo_
const double ensembleUp_
const unsigned stripsPerBin_
const double ensembleLow_
LA_Filler_Fitter::LA_Filler_Fitter ( int  methods,
bool  layer,
bool  module,
float  localybin,
unsigned  stripbin,
unsigned  max,
const TrackerTopology tTopo 
)
inline

Definition at line 30 of file LA_Filler_Fitter.h.

30  :
31  ensembleSize_(0),
33  byLayer_(layer),byModule_(module),
34  localYbin_(localybin),
35  stripsPerBin_(stripbin),
36  maxEvents_(max),
37  methods_(methods),
38  tTopo_(tTopo) {}
const Long64_t maxEvents_
const float localYbin_
const TrackerTopology * tTopo_
const double ensembleUp_
const unsigned stripsPerBin_
const double ensembleLow_
Definition: vlib.h:208

Member Function Documentation

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

Definition at line 61 of file LA_Filler.cc.

References varWidth().

Referenced by LA_Filler_Fitter::EnsembleSummary::EnsembleSummary(), and fill_one_cluster().

62 { poly<std::string> a1("_all"); if(width==1) a1*="_w1"; return a1;}
Definition: poly.h:10
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 72 of file LA_Results.cc.

References Book::begin(), Book::end(), method(), dataset::name, result(), mps_update::results, AlCaHLTBitMon_QueryRunRegistry::string, and summarize_ensembles().

Referenced by fit(), layer_results(), and summarize_ensembles().

72  {
73  std::map<std::string, std::vector<Result> > results;
74  for(Book::const_iterator it = book.begin(".*_sample.*"+method(m)); it!=book.end(); ++it ) {
75  const std::string name = boost::regex_replace(it->first,boost::regex("sample\\d*_"),"");
76  results[name].push_back(result(m,it->first,book));
77  }
78  return results;
79 }
static Result result(Method, const std::string name, const Book &)
Definition: LA_Results.cc:13
iterator begin(string_t re=".*")
Definition: Book.h:48
static std::string method(Method m, bool fit=true)
boost::filter_iterator< match_name, book_t::const_iterator > const_iterator
Definition: Book.h:47
iterator end(string_t re=".*")
Definition: Book.h:50
std::map< std::string, std::vector< LA_Filler_Fitter::EnsembleSummary > > LA_Filler_Fitter::ensemble_summary ( const Book book)
static

Definition at line 106 of file LA_Results.cc.

References runEdmFileComparison::base, Book::begin(), Book::end(), LA_Filler_Fitter::EnsembleSummary::meanMeasured, LA_Filler_Fitter::EnsembleSummary::meanUncertainty, dataset::name, offset_slope(), LA_Filler_Fitter::EnsembleSummary::pull, pull(), alignCSCRings::s, LA_Filler_Fitter::EnsembleSummary::samples, LA_Filler_Fitter::EnsembleSummary::sigmaMeasured, AlCaHLTBitMon_QueryRunRegistry::string, heppy_report::summary, and LA_Filler_Fitter::EnsembleSummary::truth.

Referenced by fit(), summarize_ensembles(), and sistrip::EnsembleCalibrationLA::write_ensembles_text().

106  {
107  std::map<std::string, std::vector<EnsembleSummary> > summary;
108  for(Book::const_iterator it = book.begin(".*_ensembleReco"); it!=book.end(); ++it) {
109  const std::string base = boost::erase_all_copy(it->first,"_ensembleReco");
110 
111  const TH1*const reco = it->second;
112  const TH1*const measure = book[base+"_measure"];
113  const TH1*const merr = book[base+"_merr"];
114  const TH1*const pull = book[base+"_pull"];
115 
116  EnsembleSummary s;
117  s.samples = reco->GetEntries();
118  s.truth = reco->GetMean();
119  s.meanMeasured = std::make_pair<float,float>( measure->GetFunction("gaus")->GetParameter(1), measure->GetFunction("gaus")->GetParError(1) );
120  s.sigmaMeasured = std::make_pair<float,float>( measure->GetFunction("gaus")->GetParameter(2), measure->GetFunction("gaus")->GetParError(2) );
121  s.meanUncertainty = std::make_pair<float,float>( merr->GetFunction("gaus")->GetParameter(1), merr->GetFunction("gaus")->GetParError(1) );
122  s.pull = std::make_pair<float,float>( pull->GetFunction("gaus")->GetParameter(2), pull->GetFunction("gaus")->GetParError(2) );
123 
124  const std::string name = boost::regex_replace(base,boost::regex("ensembleBin\\d*_"),"");
125  summary[name].push_back(s);
126  }
127  return summary;
128 }
iterator begin(string_t re=".*")
Definition: Book.h:48
base
Make Sure CMSSW is Setup ##.
boost::filter_iterator< match_name, book_t::const_iterator > const_iterator
Definition: Book.h:47
fixed size matrix
static float pull(const std::vector< EnsembleSummary > &)
Definition: LA_Results.cc:155
iterator end(string_t re=".*")
Definition: Book.h:50
void LA_Filler_Fitter::fill ( TTree *  tree,
Book book 
) const

Definition at line 9 of file LA_Filler.cc.

References funct::cos(), ensembleBins_, fill_one_cluster(), granularity(), mps_fire::i, localYbin_, maxEvents_, N, Validation_hcalonly_cfi::sign, stripsPerBin_, SiStripDetId::subDetector(), edm::swap(), funct::tan(), SiStripDetId::TIB, and SiStripDetId::TOB.

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

9  {
10  TTREE_FOREACH_ENTRY(tree) {
11  TFE_MAX(maxEvents_);
12  TFE_PRINTSTATUS;
13  std::vector<unsigned> PLEAF( tsostrackmulti , tree );
14  std::vector<unsigned> PLEAF( clusterdetid , tree );
15  std::vector<unsigned> PLEAF( clusterwidth , tree );
16  std::vector<float> PLEAF( clustervariance , tree );
17  std::vector<float> PLEAF( tsosdriftx , tree );
18  std::vector<float> PLEAF( tsosdriftz , tree );
19  std::vector<float> PLEAF( tsoslocaltheta , tree );
20  std::vector<float> PLEAF( tsoslocalphi , tree );
21  std::vector<float> PLEAF( tsosglobalZofunitlocalY , tree );
22 
23  const unsigned N(clusterdetid.size());
24  std::vector<float> BdotY(N,0); if(!ensembleBins_) { std::vector<float> PLEAF( tsosBdotY , tree ); swap(BdotY, tsosBdotY); }
25  std::vector<float> localy(N,0); if(localYbin_) { std::vector<float> PLEAF( tsoslocaly , tree ); swap(localy, tsoslocaly);}
26  std::vector<unsigned> seedstrip(N,0); if(stripsPerBin_) { std::vector<unsigned> PLEAF( clusterseedstrip , tree ); swap(seedstrip, clusterseedstrip);}
27 
28  for(unsigned i=0; i<N ; i++) {
29 
30  const SiStripDetId detid(clusterdetid[i]);
31  if( tsostrackmulti[i] != 1 || ( detid.subDetector()!=SiStripDetId::TIB &&
32  detid.subDetector()!=SiStripDetId::TOB) ) continue;
33 
34  const int sign = tsosglobalZofunitlocalY[i] < 0 ? -1 : 1;
35  const float tthetaL = sign * tsosdriftx[i] / tsosdriftz[i];
36  const float tthetaT = sign * tan(tsoslocaltheta[i]) * cos(tsoslocalphi[i]);
37 
38  fill_one_cluster( book,
39  granularity(detid, tthetaL, TFE_index, localy[i], seedstrip[i]%128),
40  clusterwidth[i], clustervariance[i], tthetaL, tthetaT, fabs(BdotY[i]) );
41  }
42  }
43 }
const Long64_t maxEvents_
poly< std::string > granularity(const SiStripDetId, const float, const Long64_t, const float, const unsigned) const
Definition: LA_Filler.cc:73
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:116
const float localYbin_
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
#define N
Definition: blowfish.cc:9
const unsigned stripsPerBin_
void fill_one_cluster(Book &, const poly< std::string > &, const unsigned, const float, const float, const float, const float) const
Definition: LA_Filler.cc:46
Definition: tree.py:1
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 46 of file LA_Filler.cc.

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

Referenced by LA_Filler_Fitter::EnsembleSummary::EnsembleSummary(), and fill().

49 {
50  book.fill( tthetaL, gran+"_reconstruction", 360,-1.0,1.0 );
51  book.fill( tthetaT-tthetaL, gran+ allAndOne(width), 360,-1.0,1.0 );
52  book.fill( tthetaT-tthetaL, variance, gran+ varWidth(width), 360,-1.0,1.0 );
53  if(methods_ & WIDTH) book.fill( tthetaT, width, gran+method(WIDTH), 81,-0.6,0.6 );
54  if(!ensembleBins_) {
55  book.fill( BdotY, gran+"_field", 101,1,5);
56  book.fill( width, gran+"_width", 10,0,10);
57  }
58 }
poly< std::string > varWidth(const unsigned width) const
Definition: LA_Filler.cc:65
static std::string method(Method m, bool fit=true)
void fill(double_t X, const char *name, uint_t NbinsX, double_t Xlow, double_t Xup, double_t W=1)
Definition: Book.h:60
poly< std::string > allAndOne(const unsigned width) const
Definition: LA_Filler.cc:61
unsigned LA_Filler_Fitter::find_rebin ( const TH1 * const  hist)
static

Definition at line 80 of file LA_Fitter.cc.

References begin, end, mps_fire::i, SiStripPI::max, SiStripPI::mean, min(), SiStripPI::rms, and rms_profile().

Referenced by fit(), and make_and_fit_symmchi2().

80  {
81  const double mean = hist->GetMean();
82  const double rms = hist->GetRMS();
83  const int begin = std::min( 1, hist->GetXaxis()->FindFixBin(mean-rms));
84  const int end = std::max(hist->GetNbinsX(), hist->GetXaxis()->FindFixBin(mean+rms)) + 1;
85  unsigned current_hole(0), max_hole(0);
86  for(int i=begin; i<end; i++) {
87  if(!hist->GetBinError(i)) current_hole++;
88  else if(current_hole) {max_hole = std::max(current_hole,max_hole); current_hole=0;}
89  }
90  return max_hole+1;
91 }
#define end
Definition: vmac.h:39
T min(T a, T b)
Definition: MathUtil.h:58
#define begin
Definition: vmac.h:32
static void LA_Filler_Fitter::fit ( Book book)
inlinestatic
void LA_Filler_Fitter::fit_width_profile ( Book book)
static

Definition at line 9 of file LA_Fitter.cc.

References Book::begin(), Book::end(), Book::erase(), make_and_fit_symmchi2(), SiStripPI::max, method(), min(), AlCaHLTBitMon_ParallelJobs::p, and WIDTH.

Referenced by fit().

9  {
10  for(Book::iterator it = book.begin(".*"+method(WIDTH)); it!=book.end(); ++it) {
11  it->second->SetTitle("Mean Cluster Width;tan#theta_{t}");
12  TH1* const p = it->second;
13  if(p->GetEntries() < 400) { delete p; book[it->first]=nullptr; continue;}
14  p->SetTitle(";tan#theta_{t};");
15  const float min = p->GetMinimum();
16  const float max = p->GetMaximum();
17  float xofmin = p->GetBinCenter(p->GetMinimumBin()); if( xofmin>0.0 || xofmin<-0.15) xofmin = -0.05;
18  const float xofmax = p->GetBinCenter(p->GetMaximumBin());
19 
20  TF1* const fit = new TF1("LA_profile_fit","[2]*(TMath::Abs(x-[0]))+[1]",-1,1);
21  fit->SetParLimits(0,-0.15,0.01);
22  fit->SetParLimits(1, 0.6*min, 1.25*min );
23  fit->SetParLimits(2,0.1,10);
24  fit->SetParameters( xofmin, min, (max-min) / fabs( xofmax - xofmin ) );
25 
26  int badfit = p->Fit(fit,"IEQ","",-.5,.3);
27  if( badfit ) badfit = p->Fit(fit,"IEQ","", -.46,.26);
28  if( badfit ) { book.erase(it); }
29  }
30 }
iterator begin(string_t re=".*")
Definition: Book.h:48
T min(T a, T b)
Definition: MathUtil.h:58
static std::string method(Method m, bool fit=true)
void erase(string_t name)
Definition: Book.h:57
boost::filter_iterator< match_name, book_t::iterator > iterator
Definition: Book.h:46
iterator end(string_t re=".*")
Definition: Book.h:50
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 73 of file LA_Filler.cc.

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

Referenced by LA_Filler_Fitter::EnsembleSummary::EnsembleSummary(), fill(), and varWidth().

73  {
74  poly<std::string> gran;
75  gran += subdetLabel(detid);
76  if(byLayer_) gran *= layerLabel(detid);
77  if(byModule_) gran *= moduleLabel(detid);
78  if(localYbin_) gran += (localy < 0 ? "_yM":"_yP") + std::to_string(abs((int)(localy/localYbin_+(localy<0?-1:0))));
79  if(stripsPerBin_) gran += "_strip"+std::to_string((unsigned)((0.5+((apvstrip/64)?(127-apvstrip):apvstrip)/stripsPerBin_)*stripsPerBin_) );
80  if(ensembleBins_) {
81  gran+= "_ensembleBin"+std::to_string((int)(ensembleBins_*(tthetaL-ensembleLow_)/(ensembleUp_-ensembleLow_)));
82  gran+= "";
83  if(ensembleSize_) gran*= "_sample"+std::to_string(TFE_index % ensembleSize_);
84  }
85  return gran;
86 }
std::string layerLabel(const SiStripDetId) const
Definition: LA_Filler.cc:93
static std::string moduleLabel(const SiStripDetId)
Definition: LA_Filler.cc:91
const float localYbin_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Definition: poly.h:10
const double ensembleUp_
static std::string subdetLabel(const SiStripDetId)
Definition: LA_Filler.cc:89
const unsigned stripsPerBin_
const double ensembleLow_
static unsigned LA_Filler_Fitter::layer_index ( bool  TIB,
bool  stereo,
unsigned  layer 
)
inlinestatic

Definition at line 86 of file LA_Filler_Fitter.h.

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

86 { 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 62 of file LA_Results.cc.

References Book::begin(), Book::end(), ensemble_results(), method(), dataset::name, result(), mps_update::results, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by fit(), module_results(), and sistrip::MeasureLA::process_reports().

62  {
63  std::map<std::string,Result> results;
64  for(Book::const_iterator it = book.begin(".*layer\\d.*"+method(m)); it!=book.end(); ++it ) {
65  const std::string name = boost::erase_all_copy(it->first,method(m));
66  results[name] = result(m,it->first,book);
67  }
68  return results;
69 }
static Result result(Method, const std::string name, const Book &)
Definition: LA_Results.cc:13
iterator begin(string_t re=".*")
Definition: Book.h:48
static std::string method(Method m, bool fit=true)
boost::filter_iterator< match_name, book_t::const_iterator > const_iterator
Definition: Book.h:47
iterator end(string_t re=".*")
Definition: Book.h:50
std::string LA_Filler_Fitter::layerLabel ( const SiStripDetId  detid) const

Definition at line 93 of file LA_Filler.cc.

References DetId::subdetId(), subdetLabel(), StripSubdetector::TIB, TrackerTopology::tibLayer(), TrackerTopology::tibStereo(), TrackerTopology::tobLayer(), TrackerTopology::tobStereo(), and tTopo_.

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

93  {
94  const bool isTIB = detid.subdetId() == StripSubdetector::TIB;
95  unsigned layer = isTIB ? tTopo_->tibLayer(detid) : tTopo_->tobLayer(detid);
96  bool stereo = isTIB ? tTopo_->tibStereo(detid) : tTopo_->tobStereo(detid);
97 
98  return subdetLabel(detid)+"_layer"+std::to_string(layer)+(stereo?"s":"a");
99 }
unsigned int tibLayer(const DetId &id) const
uint32_t tobStereo(const DetId &id) const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
const TrackerTopology * tTopo_
static std::string subdetLabel(const SiStripDetId)
Definition: LA_Filler.cc:89
uint32_t tibStereo(const DetId &id) const
unsigned int tobLayer(const DetId &id) const
void LA_Filler_Fitter::make_and_fit_symmchi2 ( Book book)
static

Definition at line 33 of file LA_Fitter.cc.

References Vispa.Plugins.EdmBrowser.EdmDataAccessor::all(), AVGV2, AVGV3, runEdmFileComparison::base, Book::begin(), create_public_pileup_plots::bins, Book::book(), vertices_cff::chi2, Book::end(), Book::find(), find_rebin(), mps_check::guess, create_public_lumi_plots::hist, SiStripPI::max, method(), PROB1, rms_profile(), RMSV2, RMSV3, AlCaHLTBitMon_QueryRunRegistry::string, subset_probability(), and SymmetryFit::symmetryChi2().

Referenced by fit(), and fit_width_profile().

33  {
34  for(Book::iterator it = book.begin(".*_all"); it!=book.end(); ++it) {
35  const std::string base = boost::erase_all_copy(it->first,"_all");
36 
37  std::vector<Book::iterator> rebin_hists;
38  const Book::iterator& all = it; rebin_hists.push_back(all);
39  Book::iterator w1 = book.find(base+"_w1"); rebin_hists.push_back(w1);
40  Book::iterator var_w2 = book.find(base+method(AVGV2,false)); rebin_hists.push_back(var_w2);
41  Book::iterator var_w3 = book.find(base+method(AVGV3,false)); rebin_hists.push_back(var_w3);
42 
43  const unsigned rebin = std::max( var_w2==book.end() ? 0 : find_rebin(var_w2->second),
44  var_w3==book.end() ? 0 : find_rebin(var_w3->second) );
45  for(const auto& it : rebin_hists) if(it!=book.end()) it->second->Rebin( rebin>1 ? rebin<7 ? rebin : 6 : 1);
46 
47  TH1* const prob_w1 = w1==book.end() ? nullptr : subset_probability( base+method(PROB1,false) ,w1->second,all->second);
48  TH1* const rmsv_w2 = var_w2==book.end() ? nullptr : rms_profile( base+method(RMSV2,false), (TProfile*const)var_w2->second);
49  TH1* const rmsv_w3 = var_w3==book.end() ? nullptr : rms_profile( base+method(RMSV3,false), (TProfile*const)var_w3->second);
50 
51  std::vector<TH1*> fit_hists;
52  if(prob_w1) {
53  book.book(base+method(PROB1,false),prob_w1);
54  fit_hists.push_back(prob_w1); prob_w1->SetTitle("Width==1 Probability;tan#theta_{t}-(dx/dz)_{reco}");
55  }
56  if(var_w2!=book.end()) {
57  book.book(base+method(RMSV2,false),rmsv_w2);
58  fit_hists.push_back(var_w2->second); var_w2->second->SetTitle("Width==2 Mean Variance;tan#theta_{t}-(dx/dz)_{reco}");
59  fit_hists.push_back(rmsv_w2); rmsv_w2->SetTitle("Width==2 RMS Variance;tan#theta_{t}-(dx/dz)_{reco}");
60  }
61  if(var_w3!=book.end()) {
62  book.book(base+method(RMSV3,false),rmsv_w3);
63  fit_hists.push_back(var_w3->second); var_w3->second->SetTitle("Width==3 Mean Variance;tan#theta_{t}-(dx/dz)_{reco}");
64  fit_hists.push_back(rmsv_w3); rmsv_w3->SetTitle("Width==3 RMS Variance;tan#theta_{t}-(dx/dz)_{reco}");
65  }
66 
67  if(fit_hists.empty()) continue;
68  const unsigned bins = fit_hists[0]->GetNbinsX();
69  const unsigned guess = fit_hists[0]->FindBin(0);
70  const std::pair<unsigned,unsigned> range(guess-bins/30,guess+bins/30);
71 
72  for(auto const& hist : fit_hists) {
73  TH1*const chi2 = SymmetryFit::symmetryChi2(hist,range);
74  if(chi2) {book.book(chi2->GetName(),chi2); chi2->SetTitle("Symmetry #chi^{2};tan#theta_{t}-(dx/dz)_{reco}");}
75  }
76  }
77 }
static TH1 * subset_probability(const std::string name, const TH1 *const , const TH1 *const )
Definition: LA_Fitter.cc:107
static TH1 * symmetryChi2(std::string, const std::vector< TH1 * > &, const std::pair< unsigned, unsigned >)
Definition: SymmetryFit.cc:6
iterator begin(string_t re=".*")
Definition: Book.h:48
base
Make Sure CMSSW is Setup ##.
static std::string method(Method m, bool fit=true)
static unsigned find_rebin(const TH1 *const)
Definition: LA_Fitter.cc:80
string guess
Definition: mps_check.py:387
static TH1 * rms_profile(const std::string, const TProfile *const)
Definition: LA_Fitter.cc:94
iterator find(string_t name, string_t re=".*")
Definition: Book.h:52
boost::filter_iterator< match_name, book_t::iterator > iterator
Definition: Book.h:46
iterator end(string_t re=".*")
Definition: Book.h:50
TH1 * book(string_t name, TH1 *const hist)
Definition: Book.h:42
static std::string LA_Filler_Fitter::method ( Method  m,
bool  fit = true 
)
inlinestatic

Definition at line 47 of file LA_Filler_Fitter.h.

References AVGV2, AVGV3, SymmetryFit::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().

47  {
48  switch(m) {
49  case WIDTH: return "_width_prof";
50  case PROB1: return fit? SymmetryFit::name(method(m,false)): "_prob_w1" ;
51  case AVGV2: return fit? SymmetryFit::name(method(m,false)): "_avg_var_w2";
52  case AVGV3: return fit? SymmetryFit::name(method(m,false)): "_avg_var_w3";
53  case RMSV2: return fit? SymmetryFit::name(method(m,false)): "_rms_var_w2";
54  case RMSV3: return fit? SymmetryFit::name(method(m,false)): "_rms_var_w3";
55  default: return "_UNKNOWN";
56  }
57  }
static std::string name(std::string base)
Definition: SymmetryFit.h:14
static std::string method(Method m, bool fit=true)
std::map< uint32_t, LA_Filler_Fitter::Result > LA_Filler_Fitter::module_results ( const Book book,
const Method  m 
)
static

Definition at line 50 of file LA_Results.cc.

References Book::begin(), Book::end(), layer_results(), method(), result(), mps_update::results, and AlCaHLTBitMon_QueryRunRegistry::string.

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

50  {
51  std::map<uint32_t,Result> results;
52  for(Book::const_iterator it = book.begin(".*_module\\d*"+method(m)); it!=book.end(); ++it ) {
53  const uint32_t detid = boost::lexical_cast<uint32_t>( boost::regex_replace( it->first,
54  boost::regex(".*_module(\\d*)_.*"),
55  std::string("\\1")));
56  results[detid] = result(m,it->first,book);
57  }
58  return results;
59 }
static Result result(Method, const std::string name, const Book &)
Definition: LA_Results.cc:13
iterator begin(string_t re=".*")
Definition: Book.h:48
static std::string method(Method m, bool fit=true)
boost::filter_iterator< match_name, book_t::const_iterator > const_iterator
Definition: Book.h:47
iterator end(string_t re=".*")
Definition: Book.h:50
std::string LA_Filler_Fitter::moduleLabel ( const SiStripDetId  detid)
static

Definition at line 91 of file LA_Filler.cc.

References layerLabel(), AlCaHLTBitMon_QueryRunRegistry::string, and subdetLabel().

Referenced by LA_Filler_Fitter::EnsembleSummary::EnsembleSummary(), granularity(), and subdetLabel().

91 { return subdetLabel(detid) + "_module"+std::to_string(detid());}
static std::string subdetLabel(const SiStripDetId)
Definition: LA_Filler.cc:89
std::pair< std::pair< float, float >, std::pair< float, float > > LA_Filler_Fitter::offset_slope ( const std::vector< EnsembleSummary > &  ensembles)
static

Definition at line 131 of file LA_Results.cc.

References MessageLogger_cfi::cerr, MillePedeFileConverter_cfg::e, pull(), x, and y.

Referenced by ensemble_summary(), fit(), and sistrip::EnsembleCalibrationLA::write_ensembles_text().

131  {
132  try {
133  std::vector<float> x,y,xerr,yerr;
134  for(auto const& ensemble : ensembles) {
135  x.push_back(ensemble.truth);
136  xerr.push_back(0);
137  y.push_back(ensemble.meanMeasured.first);
138  yerr.push_back(ensemble.meanMeasured.second);
139  }
140  TGraphErrors graph(x.size(),&(x[0]),&(y[0]),&(xerr[0]),&(yerr[0]));
141  //Need our own copy for thread safety
142  TF1 pol1("mypol1","pol1");
143  graph.Fit(&pol1);
144  const TF1*const fit = graph.GetFunction("pol1");
145 
146  return std::make_pair( std::make_pair(fit->GetParameter(0), fit->GetParError(0)),
147  std::make_pair(fit->GetParameter(1), fit->GetParError(1)) );
148  } catch(edm::Exception const& e) {
149  std::cerr << "Fitting Line Failed " << std::endl << e << std::endl;
150  return std::make_pair( std::make_pair(0,0), std::make_pair(0,0));
151  }
152 }
float LA_Filler_Fitter::pull ( const std::vector< EnsembleSummary > &  ensembles)
static

Definition at line 155 of file LA_Results.cc.

References AlCaHLTBitMon_ParallelJobs::p, funct::pow(), and w.

Referenced by ensemble_summary(), fit(), offset_slope(), and sistrip::EnsembleCalibrationLA::write_ensembles_text().

155  {
156  float p(0),w(0);
157  for(auto const& ensemble : ensembles) {
158  const float unc2 = pow(ensemble.pull.second,2);
159  p+= ensemble.pull.first / unc2;
160  w+= 1/unc2;
161  }
162  return p/w;
163 }
const double w
Definition: UKUtility.cc:23
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
LA_Filler_Fitter::Result LA_Filler_Fitter::result ( Method  m,
const std::string  name,
const Book book 
)
static

Definition at line 13 of file LA_Results.cc.

References AVGV2, AVGV3, runEdmFileComparison::base, LA_Filler_Fitter::Result::chi2, LA_Filler_Fitter::Result::entries, f, LA_Filler_Fitter::Result::field, h, LA_Filler_Fitter::Result::measured, method(), module_results(), dataset::name, LA_Filler_Fitter::Result::ndof, AlCaHLTBitMon_ParallelJobs::p, PROB1, LA_Filler_Fitter::Result::reco, RMSV2, RMSV3, AlCaHLTBitMon_QueryRunRegistry::string, and WIDTH.

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

13  {
14  Result p;
15  const std::string base = boost::erase_all_copy(name,method(m));
16 
17  const TH1* const h = book[name];
18  const TH1* const reco = book[base+"_reconstruction"];
19  const TH1* const field = book[base+"_field"];
20 
21  if(reco) p.reco = std::make_pair<float,float>( reco->GetMean(), reco->GetMeanError());
22  if(field) p.field = field->GetMean();
23  if(h) { switch(m) {
24  case WIDTH: {
25  const TF1*const f = h->GetFunction("LA_profile_fit"); if(!f) break;
26  p.measured = std::make_pair<float,float>(f->GetParameter(0),f->GetParError(0));
27  p.chi2 = f->GetChisquare();
28  p.ndof = f->GetNDF();
29  p.entries = (unsigned)(h->GetEntries());
30  break;
31  }
32  case PROB1: case AVGV2: case AVGV3: case RMSV2: case RMSV3: /*case MULTI:*/ {
33  const TF1*const f = h->GetFunction("SymmetryFit"); if(!f) break;
34  p.measured = std::make_pair<float,float>( p.reco.first + f->GetParameter(0), f->GetParameter(1) );
35  p.chi2 = f->GetParameter(2);
36  p.ndof = (unsigned) (f->GetParameter(3));
37  p.entries =
38  (m&PROB1) ? (unsigned) book[base+"_w1"]->GetEntries() :
39  (m&(AVGV2|RMSV2)) ? (unsigned) book[base+method(AVGV2,false)]->GetEntries() :
40  (m&(AVGV3|RMSV3)) ? (unsigned) book[base+method(AVGV3,false)]->GetEntries() : 0 ;
41  break;
42  }
43  default: break;
44  }
45  }
46  return p;
47 }
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
double f[11][100]
base
Make Sure CMSSW is Setup ##.
static std::string method(Method m, bool fit=true)
fixed size matrix
TH1 * LA_Filler_Fitter::rms_profile ( const std::string  name,
const TProfile * const  prof 
)
static

Definition at line 94 of file LA_Fitter.cc.

References create_public_pileup_plots::bins, mps_fire::i, SiStripPI::rms, mathSSE::sqrt(), and subset_probability().

Referenced by find_rebin(), fit(), and make_and_fit_symmchi2().

94  {
95  const int bins = prof->GetNbinsX();
96  TH1* const rms = new TH1F(name.c_str(),"",bins, prof->GetBinLowEdge(1), prof->GetBinLowEdge(bins) + prof->GetBinWidth(bins) );
97  for(int i = 1; i<=bins; i++) {
98  const double Me = prof->GetBinError(i);
99  const double neff = prof->GetBinEntries(i); //Should be prof->GetBinEffectiveEntries(i);, not availible this version ROOT. This is only ok for unweighted fills
100  rms->SetBinContent(i, Me*sqrt(neff) );
101  rms->SetBinError(i, Me/sqrt(2) );
102  }
103  return rms;
104 }
T sqrt(T t)
Definition: SSEVec.h:18
std::string LA_Filler_Fitter::subdetLabel ( const SiStripDetId  detid)
static
TH1 * LA_Filler_Fitter::subset_probability ( const std::string  name,
const TH1 * const  subset,
const TH1 * const  total 
)
static

Definition at line 107 of file LA_Fitter.cc.

References TtFullHadDaughter::B, create_public_pileup_plots::bins, mps_fire::i, AlCaHLTBitMon_ParallelJobs::p, TtFullHadEvtBuilder_cfi::prob, alignCSCRings::s, and mathSSE::sqrt().

Referenced by fit(), make_and_fit_symmchi2(), and rms_profile().

107  {
108  const int bins = subset->GetNbinsX();
109  TH1* const prob = new TH1F(name.c_str(),"",bins, subset->GetBinLowEdge(1), subset->GetBinLowEdge(bins) + subset->GetBinWidth(bins) );
110  for(int i = 1; i<=bins; i++) {
111  const double s = subset->GetBinContent(i);
112  const double T = total->GetBinContent(i);
113  const double B = T-s;
114 
115  const double p = T? s/T : 0;
116  const double perr = T? ( (s&&B)? sqrt(s*s*B+B*B*s)/(T*T) : 1/T ) : 0;
117 
118  prob->SetBinContent(i,p);
119  prob->SetBinError(i,perr);
120  }
121  return prob;
122 }
T sqrt(T t)
Definition: SSEVec.h:18
static const std::string B
long double T
void LA_Filler_Fitter::summarize_ensembles ( Book book) const

Definition at line 82 of file LA_Results.cc.

References ensemble_results(), ensemble_summary(), ensembleBins_, ensembleLow_, ensembleUp_, Book::fill(), FIRST_METHOD, g, edmIntegrityCheck::group, LAST_METHOD, funct::m, methods_, dataset::name, AlCaHLTBitMon_ParallelJobs::p, mps_update::results, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by sistrip::EnsembleCalibrationLA::endJob(), ensemble_results(), and fit().

82  {
83  typedef std::map<std::string, std::vector<Result> > results_t;
84  results_t results;
85  for(int m = FIRST_METHOD; m <= LAST_METHOD; m<<=1)
86  if(methods_ & m) { results_t g = ensemble_results(book,(Method)(m)); results.insert(g.begin(),g.end());}
87 
88  for(auto const& group : results) {
89  const std::string name = group.first;
90  for(auto const& p : group.second) {
91  const float pad = (ensembleUp_-ensembleLow_)/10;
92  book.fill( p.reco.first, name+"_ensembleReco", 12*ensembleBins_, ensembleLow_-pad, ensembleUp_+pad );
93  book.fill( p.measured.first, name+"_measure", 12*ensembleBins_, ensembleLow_-pad, ensembleUp_+pad );
94  book.fill( p.measured.second, name+"_merr", 500, 0, 0.01);
95  book.fill( (p.measured.first-p.reco.first)/p.measured.second, name+"_pull", 500, -10,10);
96  }
97  //Need our own copy for thread safety
98  TF1 gaus("mygaus","gaus");
99  book[name+"_measure"]->Fit(&gaus,"LLQ");
100  book[name+"_merr"]->Fit(&gaus,"LLQ");
101  book[name+"_pull"]->Fit(&gaus,"LLQ");
102  }
103 }
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
static std::map< std::string, std::vector< Result > > ensemble_results(const Book &, const Method)
Definition: LA_Results.cc:72
void fill(double_t X, const char *name, uint_t NbinsX, double_t Xlow, double_t Xup, double_t W=1)
Definition: Book.h:60
const double ensembleUp_
const double ensembleLow_
poly< std::string > LA_Filler_Fitter::varWidth ( const unsigned  width) const

Definition at line 65 of file LA_Filler.cc.

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

Referenced by allAndOne(), LA_Filler_Fitter::EnsembleSummary::EnsembleSummary(), and fill_one_cluster().

65  {
66  poly<std::string> vw; vw++;
67  if(width==2 && methods_ & (AVGV2|RMSV2) ) vw*=method(AVGV2,false);
68  if(width==3 && methods_ & (AVGV3|RMSV3) ) vw*=method(AVGV3,false);
69  return vw;
70 }
Definition: poly.h:10
static std::string method(Method m, bool fit=true)

Member Data Documentation

const bool LA_Filler_Fitter::byLayer_
private

Definition at line 110 of file LA_Filler_Fitter.h.

Referenced by granularity().

const bool LA_Filler_Fitter::byModule_
private

Definition at line 110 of file LA_Filler_Fitter.h.

Referenced by granularity().

const int LA_Filler_Fitter::ensembleBins_
private

Definition at line 108 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 109 of file LA_Filler_Fitter.h.

Referenced by granularity(), and summarize_ensembles().

const int LA_Filler_Fitter::ensembleSize_
private

Definition at line 108 of file LA_Filler_Fitter.h.

Referenced by granularity().

const double LA_Filler_Fitter::ensembleUp_
private

Definition at line 109 of file LA_Filler_Fitter.h.

Referenced by granularity(), and summarize_ensembles().

const float LA_Filler_Fitter::localYbin_
private

Definition at line 111 of file LA_Filler_Fitter.h.

Referenced by fill(), and granularity().

const Long64_t LA_Filler_Fitter::maxEvents_
private

Definition at line 113 of file LA_Filler_Fitter.h.

Referenced by fill().

const int LA_Filler_Fitter::methods_
private

Definition at line 114 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 112 of file LA_Filler_Fitter.h.

Referenced by fill(), and granularity().

const TrackerTopology* LA_Filler_Fitter::tTopo_
private

Definition at line 115 of file LA_Filler_Fitter.h.

Referenced by layerLabel().