CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
BSvsBPIX.cc
Go to the documentation of this file.
2 #include "TFile.h"
3 #include "TH1F.h"
4 #include "TProfile.h"
5 #include "TGraphErrors.h"
6 #include "TCanvas.h"
7 #include "TDirectory.h"
8 #include <iostream>
9 
10 void BSvsBPIXPlot(TFile* ff, const char* bsmodule, const char* occumodule, const int run) {
11 
12  TGraphErrors* bspos = new TGraphErrors();
13  TGraphErrors* bpixpos = new TGraphErrors();
14 
15  if(ff) {
16 
17  char bsfolder[200];
18  sprintf(bsfolder,"%s/run_%d",bsmodule,run);
19  if(ff->cd(bsfolder)) {
20  TH1F* bsx = (TH1F*)gDirectory->Get("bsxrun");
21  TH1F* bsy = (TH1F*)gDirectory->Get("bsyrun");
22  if(bsx && bsy) {
23  std::cout << "beam spot position ("
24  << bsx->GetMean() << "+/-" << bsx->GetMeanError() << ","
25  << bsy->GetMean() << "+/-" << bsy->GetMeanError() << ")" << std::endl;
26  bspos->SetPoint(0,bsx->GetMean(),bsy->GetMean());
27  bspos->SetPointError(0,bsx->GetMeanError(),bsy->GetMeanError());
28  }
29  }
30  char occufolder[200];
31  sprintf(occufolder,"%s/run_%d",occumodule,run);
32  if(ff->cd(occufolder)) {
33  TProfile* xmean = (TProfile*)gDirectory->Get("avex");
34  TProfile* ymean = (TProfile*)gDirectory->Get("avey");
35  if(xmean && ymean) {
36  for(int i=1;i<=xmean->GetNbinsX();++i) {
37  if(xmean->GetBinEntries(i) >0) {
38  std::cout << "ladder position " << i << " : ("
39  << xmean->GetBinContent(i) << "+/-" << xmean->GetBinError(i) << ","
40  << ymean->GetBinContent(i) << "+/-" << ymean->GetBinError(i) << ")" << std::endl;
41  int point = bpixpos->GetN();
42  bpixpos->SetPoint(point,xmean->GetBinContent(i),ymean->GetBinContent(i));
43  bpixpos->SetPointError(point,xmean->GetBinError(i),ymean->GetBinError(i));
44  }
45  }
46  }
47 
48  }
49  }
50  new TCanvas("bsbpix","bsbpix",500,500);
51  bpixpos->Draw("ap");
52  bspos->Draw("p");
53 
54 }
int i
Definition: DBlmapReader.cc:9
void BSvsBPIXPlot(TFile *ff, const char *bsmodule, const char *occumodule, const int run)
Definition: BSvsBPIX.cc:10
tuple cout
Definition: gather_cfg.py:145
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5