1 void selectAllM7(
const char* infile,
char* outputdir =
"./",
int rescale=0){
7 cout <<
" selectAllM7, input: " << infile <<
"\tout dir: " << outputdir << endl;
8 gSystem->Load(
"StEStructPoolSupport.so");
10 TFile * tf=
new TFile(infile);
13 cout<<
"error opening file "<<endl;
24 TH1D* hns = (TH1D*)tf->Get(
"NEventsSame");
25 int nevs = hns->GetEntries();
26 TH1D* hnm = (TH1D*)tf->Get(
"NEventsMixed");
27 int nevm = hnm->GetEntries();
28 cout << infile <<
" has " << nevs <<
" sibling events and " << nevm <<
" mixed events." << endl;
30 TH1D* hcb = (TH1D*)tf->Get(
"hcb");
31 if(!hcb) { cout <<
"error loading hcb" << endl;
return;}
32 TH1D* hcbs = (TH1D*)hcb->Clone(
"hcbs");
33 TH1D* hcbm = (TH1D*)hcb->Clone(
"hcbm");
34 hcbs->Scale( nevs / hcbs->Integral() );
35 hcbm->Scale( nevm / hcbm->Integral() );
42 for(
int i=0; i<10; i++) {
45 for(
int j=0; j<6; j++) {
46 sib[i] += hcbs->GetBinContent(i*6 + j + 1);
47 mix[i] += hcbm->GetBinContent(i*6 + j + 1);
53 cout <<
"Targets " << endl;
54 for(
int i=0; i<10; i++) cout << sib[i] <<
"\t" << mix[i] << endl;
55 cout <<
"Totals:\t" << hcbs->Integral() <<
"\t" << hcbm->Integral() << endl;
56 cout <<
"Totals:\t" << sibtot <<
"\t" << mixtot << endl;
66 for(
int i=0; i<10; i++) {
67 for(
int j=0; j<6; j++) narray[j] = i*6 + j;
68 fname=outputdir; fname+=
"final0"; fname+=i; fname+=
".root";
69 cout <<
"writing " << fname << endl;
70 adder.addCuts(fname,tf,narray,num);
73 tfout =
new TFile(fname,
"UPDATE");
74 TH1D* hs = (TH1D*)tfout->Get(
"NEventsSame");
75 hs->SetEntries( sib[i] );
77 TH1D* hm = (TH1D*)tfout->Get(
"NEventsMixed");
78 hm->SetEntries( mix[i] );