22 for(
unsigned int i=0;
i<runs.size();++
i) {
25 sprintf(runlabel,
"%d",runs[
i]);
29 if(res->
ngoodbx!=res->
hratio->GetEntries())
std::cout <<
"Inconsistency in number of good bx" << std::endl;
39 else {
std::cout <<
"File is not ok" << std::endl; }
53 for(
unsigned int i=0;
i<runs.size();++
i) {
56 sprintf(runlabel,
"%d",runs[
i]);
60 if(res->
ngoodbx!=res->
hratio->GetEntries())
std::cout <<
"Inconsistency in number of good bx" << std::endl;
70 else {
std::cout <<
"File is not ok" << std::endl; }
77 if(perFill) {
std::cout <<
"Processing fill " << run << std::endl;}
else {
std::cout <<
"Processing run " << run << std::endl;}
83 sprintf(itpath,
"%s/fill_%d",itmodule,run);
84 sprintf(ootpath,
"%s/fill_%d",ootmodule,run);
85 sprintf(etpath,
"%s/fill_%d",etmodule,run);
88 sprintf(itpath,
"%s/run_%d",itmodule,run);
89 sprintf(ootpath,
"%s/run_%d",ootmodule,run);
90 sprintf(etpath,
"%s/run_%d",etmodule,run);
100 if(filledbx.size() != filledbxtest.size())
std::cout <<
"Inconsistency in number of filled BX "
101 << run <<
" " << filledbx.size() <<
" " << filledbxtest.size() << std::endl;
104 TProfile* itmult = 0;
105 TProfile* ootmult = 0;
106 res->
hratio =
new TH1F(
"ratio",
"ratio",200,0.,2.);
117 itmult = (TProfile*)gDirectory->Get(hname);
119 else {
std::cout <<
"In time path is not ok" << std::endl;}
120 if(ff->cd(ootpath)) {
121 ootmult = (TProfile*)gDirectory->Get(hname);
123 else {
std::cout <<
"out of time path is not ok" << std::endl;}
124 if(itmult && ootmult) {
125 ootmult->SetLineColor(kRed); ootmult->SetMarkerColor(kRed);
128 for(std::vector<int>::const_iterator fbx=filledbx.begin();fbx!=filledbx.end();++fbx) {
129 nzb += itmult->GetBinEntries(*fbx);
130 nrandom += ootmult->GetBinEntries(*fbx+1);
132 for(std::vector<int>::const_iterator fbx=filledbx.begin();fbx!=filledbx.end();++fbx) {
133 if(nzb > 0 && nrandom > 0) {
134 rclzb += (itmult->GetBinContent(*fbx)*itmult->GetBinEntries(*fbx))/nzb;
135 errclzb += (itmult->GetBinError(*fbx)*itmult->GetBinEntries(*fbx))*(itmult->GetBinError(*fbx)*itmult->GetBinEntries(*fbx))/(nzb*nzb);
136 rclrandom += (ootmult->GetBinContent(*fbx+1)*ootmult->GetBinEntries(*fbx+1))/nrandom;
137 errclrandom += (ootmult->GetBinError(*fbx+1)*ootmult->GetBinEntries(*fbx+1))*(ootmult->GetBinError(*fbx+1)*ootmult->GetBinEntries(*fbx+1))
140 if(itmult->GetBinContent(*fbx)==0) {
std::cout <<
"No cluster in filled BX! " << *fbx << std::endl;}
141 else if(ootmult->GetBinEntries(*fbx+1)==0) {}
143 float rat= ootmult->GetBinContent(*fbx+1)/itmult->GetBinContent(*fbx);
148 else {
std::cout<<
"histograms not found"<<std::endl;}
150 else {
std::cout <<
"Input file pointer is not ok" <<std::endl;}
154 if(nzb>0 && nrandom>0 &&rclzb>0 && rclrandom > 0) {
156 res->
ootfracsumerr = rclrandom/rclzb*
sqrt(errclzb/(rclzb*rclzb)+errclrandom/(rclrandom*rclrandom));
159 res->
hratio->Fit(
"gaus",
"Q0",
"",.01,1.99);
160 if(res->
hratio->GetFunction(
"gaus")) {
161 res->
ootfrac = res->
hratio->GetFunction(
"gaus")->GetParameter(1);
164 else {
std::cout <<
"Missing fitting function" << std::endl;}
166 else {
std::cout <<
"No filled BX or strange filling scheme" <<std::endl;}
174 std::vector<int> filledbx;
177 bx = (TH1F*)gDirectory->Get(
"bx");
180 std::cout <<
"Number of entries " << bx->GetEntries() <<
" threshold " << thr/3564.*bx->GetEntries() << std::endl;
181 for(
int i=1;
i<bx->GetNbinsX()+1;++
i) {
182 if(bx->GetBinContent(
i)>thr/3564.*bx->GetEntries()) {
183 if(filledbx.size() &&
i == filledbx[filledbx.size()-1]+1) {
184 std::cout <<
"This is not a 50ns run ! " << std::endl;
188 filledbx.push_back(
i);
192 else {
std::cout <<
"Histogram not found" << std::endl;}
194 else {
std::cout <<
"module path is not ok" << std::endl;}
196 else {
std::cout <<
"Input file pointer is not ok" <<std::endl;}
205 std::vector<int> filledbx;
208 bx = (TProfile*)gDirectory->Get(hname);
211 std::cout <<
"Number of entries " << bx->GetEntries() <<
" threshold " << thr/3564.*bx->GetEntries() << std::endl;
212 for(
int i=1;
i<bx->GetNbinsX()+1;++
i) {
213 if(bx->GetBinEntries(
i)>thr/3564.*bx->GetEntries()) {
214 if(filledbx.size() &&
i == filledbx[filledbx.size()-1]+1) {
215 std::cout <<
"This is not a 50ns run ! " << std::endl;
219 filledbx.push_back(
i);
223 else {
std::cout <<
"Histogram not found" << std::endl;}
225 else {
std::cout <<
"module path is not ok" << std::endl;}
227 else {
std::cout <<
"Input file pointer is not ok" <<std::endl;}
OOTSummary * ComputeOOTFractionvsFill(TFile *ff, const char *itmodule, const char *ootmodule, const char *etmodule, const char *hname, OOTSummary *ootsumm)
OOTResult * ComputeOOTFraction(TFile *ff, const char *itmodule, const char *ootmodule, const char *etmodule, const int run, const char *hname, const bool &perFill)
tuple path
else: Piece not in the list, fine.
std::vector< int > FillingSchemeFromProfile(TFile *ff, const char *path, const char *hname, const float thr)
const std::vector< unsigned int > getRunList() const
std::vector< int > FillingScheme(TFile *ff, const char *path, const float thr)
OOTSummary * ComputeOOTFractionvsRun(TFile *ff, const char *itmodule, const char *ootmodule, const char *etmodule, const char *hname, OOTSummary *ootsumm)
const std::vector< unsigned int > getFillList() const