void ovplot() { string line, lineold, lineold2; string det[15]; string olaps ("Overlaps"); string str3; char *str3c; char *htitle ("dummy"); int pos1, pos2, ndet, len; float val, mean; ifstream infile; infile.open ("stats.txt"); if (infile.is_open()) { int nbins=200, low=0.0, hi=25; TH1F *h0 = new TH1F("h0", "All overflows (cm)",nbins,low,hi); TH1F *h1 = new TH1F("h1", "ZDC overflows (cm)",nbins,low,hi); TH1F *h2 = new TH1F("h2", "FCL overflows (cm)",nbins,low,hi); TH1F *h3 = new TH1F("h3", "ITR overflows (cm)",nbins,low,hi); TH1F *h4 = new TH1F("h4", "CRK overflows (cm)",nbins,low,hi); TH1F *h5 = new TH1F("h5", "PAD overflows (cm)",nbins,low,hi); TH1F *h6 = new TH1F("h6", "TOF overflows (cm)",nbins,low,hi); TH1F *h7 = new TH1F("h7", "EMC overflows (cm)",nbins,low,hi); TH1F *h8 = new TH1F("h8", "HBD overflows (cm)",nbins,low,hi); TH1F *h9 = new TH1F("h9", "MUM overflows (cm)",nbins,low,hi); TH1F *h10= new TH1F("h10","MUI overflows (cm)",nbins,low,hi); TH1F *h11= new TH1F("h11","MUPC overflows (cm)",nbins,low,hi); while (! infile.eof() ) { getline (infile,line); lineold2 = lineold; // save 2 lines back, has the detector name lineold = line; pos1 = line.find("Overlaps"); // position of "Overlaps" in str if ( pos1>1 ){ // New detector ndet++; // sprintf(htitle,"hist%d",ndet); cout <Fill(val); h0->Fill(val); break; case 2: h2->Fill(val); h0->Fill(val); break; case 3: h3->Fill(val); h0->Fill(val); break; case 4: h4->Fill(val); h0->Fill(val); break; case 5: h5->Fill(val); h0->Fill(val); break; case 6: h6->Fill(val); h0->Fill(val); break; case 7: h7->Fill(val); h0->Fill(val); break; case 8: h8->Fill(val); h0->Fill(val); break; case 9: h9->Fill(val); h0->Fill(val); break; case 10: h10->Fill(val); h0->Fill(val); break; case 11: h11->Fill(val); h0->Fill(val); break; } // end switch } // end line with "ovlp=" } // loop over all lines } // input file OK infile.close(); c1->SetLogy(); h1->SetLineColor(1); h2->SetLineColor(3); h3->SetLineColor(2); h4->SetLineColor(4); h5->SetLineColor(5); h6->SetLineColor(6); h7->SetLineColor(7); h8->SetLineColor(8); h9->SetLineColor(9); h10->SetLineColor(10); h11->SetLineColor(11); h3->Draw(); // biggest one first h1->Draw("same"); h2->Draw("same"); h4->Draw("same"); h5->Draw("same"); h6->Draw("same"); h7->Draw("same"); h8->Draw("same"); h9->Draw("same"); h10->Draw("same"); h11->Draw("same"); h0->SetLineColor(1); h0->SetLineStyle(2); // 2 = dashed h0->Draw("same"); // print out the means: float mean = h1->GetMean(); cout<< det[1] <<" : "<GetMean(); cout<< det[2 ] <<" : "<GetMean(); cout<< det[3 ] <<" : "<GetMean(); cout<< det[4 ] <<" : "<GetMean(); cout<< det[5 ] <<" : "<GetMean(); cout<< det[6 ] <<" : "<GetMean(); cout<< det[7 ] <<" : "<GetMean(); cout<< det[8 ] <<" : "<GetMean(); cout<< det[9 ] <<" : "<GetMean(); cout<< det[10] <<" : "<GetMean(); cout<< det[11] <<" : "<GetMean(); cout<< All <<" : "<