MakePlots Class Reference

#include <MakePlots.h>

List of all members.

Public Member Functions

 MakePlots ()
 ~MakePlots ()
void FillHistos (int set)
void SetupHistos ()
void Run ()
void SavePlots (int norm=0)
void SaveRatioPlots ()
void SetRatioPair (int set1, int set2, const char *name)
void AddSet (const char *filename, const char *typesname, int ismc, int ismrcc=0)
void SetOutDir (const char *o)
void SetOutFile (const char *o)
void SetPots (int chain, double p)

Public Attributes

std::vector< double > pots

Private Member Functions

void SortOutStats (TPad *pad, float fracPadx=0.3, float fracPady=0.5, int numPerCol=4, float startx=0.98, float starty=0.98)
void SetBranches (TChain *c)
void FillHistos (int type, int cut)

Private Attributes

std::vector< std::vector
< std::vector< TH1F * > > > 
histos
std::vector< std::pair< int,
int > > 
ratiopair
std::vector< std::string > rationame
char names [nHistos][200]
std::vector< int > ismc
std::vector< int > ismrcc
char cutnames [nCut][200]
std::vector< TChain * > chains
std::vector< std::string > typesname
int nchains
char outdir [200]
char outfile [200]
Double_t particles_primary_long_e
Double_t particles_longest_s_particle_s
Double_t particles_elec_vise
Double_t particles_primary_phi
Double_t particles_prim_par_b
Double_t particles_mol_rad_r
Double_t particles_longest_z
Double_t particles_emfrac
Int_t particles_ntot
Double_t particles_total_long_e
Double_t particles_weighted_phi
Double_t particles_largest_particle_e
Double_t particles_totvise
Double_t particles_prim_vise
Double_t event_visenergy
Double_t event_max_z
Double_t event_min_z
Int_t event_nstrips
Int_t event_inFiducial
Int_t event_contained
Double_t event_pidA
Double_t event_pidB
Double_t event_pidC
Double_t event_pidD
Int_t mctrue_type
Double_t mctrue_oscprob
Double_t mctrue_totbeamweight
Int_t mctrue_iresonance
Double_t trainweight
Int_t type
Double_t largest_frac
Double_t reco_frac
Int_t isnc
Int_t isnue
Int_t iscc
Int_t istau
Int_t isbeamve
Int_t isndis
Int_t isdis
Double_t particles_rms_r
Double_t particles_prim_par_a
Double_t particles_prim_par_e0
Double_t particles_prim_par_chisq
Double_t particles_largest_particle_peakdiff
Double_t particles_largest_particle_cmp_chisq
Int_t particles_largest_particlecmp_ndf
Double_t particles_longest_particle_type
Double_t mrccinfo_particle_s
Double_t mrccinfo_sum_e

Detailed Description

Definition at line 15 of file MakePlots.h.


Constructor & Destructor Documentation

MakePlots::MakePlots (  ) 

Definition at line 14 of file MakePlots.cxx.

References nchains, outdir, and outfile.

00015 {
00016         nchains=0;
00017         sprintf(outdir,"plots");
00018         sprintf(outfile,"plots.root");
00019 }

MakePlots::~MakePlots (  )  [inline]

Definition at line 19 of file MakePlots.h.

00019 {};


Member Function Documentation

void MakePlots::AddSet ( const char *  filename,
const char *  typesname,
int  ismc,
int  ismrcc = 0 
)

Definition at line 21 of file MakePlots.cxx.

References MuELoss::a, chains, histos, ismc, ismrcc, nchains, pots, and typesname.

00022 {
00023         nchains=chains.size();
00024         chains.push_back(new TChain("PA"));
00025         int added = chains[nchains]->Add(filename);
00026         if(!added)
00027         {
00028                 printf("error adding chain %s '%s' mc %d\n",filename,tn, mc);
00029                 delete chains[nchains];
00030                 return;
00031         }
00032         printf("adding chain %s '%s' mc %d\n",filename,tn, mc);
00033         char tmpchar[200];
00034         sprintf(tmpchar,"%s",tn);
00035         typesname.push_back(tmpchar);
00036         ismc.push_back(mc);
00037         ismrcc.push_back(mrcc);
00038         
00039         TChain * POTchain=new TChain("pottree");
00040         POTchain->Add(filename);
00041         int ent=POTchain->GetEntries();
00042         pots.push_back(0);
00043         for(int i=0;i<ent;i++)
00044         {
00045                 POTchain->GetEntry(i);
00046                 pots[nchains]+=POTchain->GetLeaf("pot")->GetValue();
00047         }
00048         printf("%s has %f POTs \n",tn,pots[nchains]);
00049 
00050 
00051         nchains++;
00052         std::vector<std::vector<TH1F *> > a;
00053         histos.push_back(a);
00054 }

void MakePlots::FillHistos ( int  type,
int  cut 
) [private]

Definition at line 656 of file MakePlots.cxx.

References event_nstrips, event_visenergy, histos, ismc, mctrue_oscprob, mctrue_totbeamweight, particles_elec_vise, particles_emfrac, particles_largest_particle_cmp_chisq, particles_largest_particle_e, particles_largest_particle_peakdiff, particles_largest_particlecmp_ndf, particles_longest_s_particle_s, particles_longest_z, particles_mol_rad_r, particles_ntot, particles_prim_par_a, particles_prim_par_b, particles_prim_par_chisq, particles_prim_par_e0, particles_prim_vise, particles_primary_long_e, particles_primary_phi, particles_rms_r, particles_total_long_e, particles_totvise, particles_weighted_phi, and pots.

00657 {
00658         if(!pots[type])return;
00659         
00660         double weight = 1;
00661         if(ismc[type]==1)weight*=mctrue_totbeamweight*mctrue_oscprob;
00662         
00663         histos[type][cut][0]->Fill(particles_longest_z,weight);
00664         histos[type][cut][1]->Fill(particles_longest_s_particle_s,weight);
00665         histos[type][cut][2]->Fill(particles_primary_long_e,weight);
00666         histos[type][cut][3]->Fill(particles_elec_vise/25.,weight);
00667         histos[type][cut][4]->Fill(particles_primary_phi,weight);
00668         if(particles_prim_par_e0)histos[type][cut][5]->Fill(particles_prim_par_b,weight);
00669         histos[type][cut][6]->Fill(particles_mol_rad_r,weight);
00670         histos[type][cut][7]->Fill(particles_emfrac,weight);
00671         histos[type][cut][8]->Fill(particles_ntot,weight);
00672         histos[type][cut][9]->Fill(particles_total_long_e,weight);
00673         histos[type][cut][10]->Fill(particles_weighted_phi,weight);
00674         histos[type][cut][11]->Fill((particles_largest_particle_e*0.03379042+0.5866994)/particles_totvise,weight);
00675         histos[type][cut][12]->Fill(particles_prim_vise/25./event_visenergy,weight);
00676         histos[type][cut][13]->Fill(particles_totvise,weight);
00677         histos[type][cut][14]->Fill(event_visenergy,weight);
00678 
00679         histos[type][cut][15]->Fill(particles_rms_r,weight);
00680         if(particles_prim_par_e0)histos[type][cut][16]->Fill(particles_prim_par_a,weight);
00681         if(particles_prim_par_e0)histos[type][cut][17]->Fill(particles_prim_par_e0/25./60.,weight);
00682         histos[type][cut][18]->Fill(particles_prim_par_chisq,weight);
00683         histos[type][cut][19]->Fill(particles_largest_particle_peakdiff/25.,weight);
00684         histos[type][cut][20]->Fill(particles_largest_particle_cmp_chisq/particles_largest_particlecmp_ndf,weight);
00685         histos[type][cut][21]->Fill(event_nstrips,weight);      
00686         
00687 }

void MakePlots::FillHistos ( int  set  ) 

Definition at line 587 of file MakePlots.cxx.

References chains, event_contained, event_inFiducial, event_pidB, event_visenergy, histos, ismrcc, mrccinfo_particle_s, mrccinfo_sum_e, nCut, nHistos, particles_largest_particle_cmp_chisq, particles_longest_particle_type, particles_longest_s_particle_s, particles_ntot, pots, and SetBranches().

Referenced by Run().

00588 {
00589         TChain *c=chains[set];
00590 
00591         printf("make plots set %d\n",set);
00592 
00593         SetBranches(c);
00594 
00595         if(!pots[set])return;
00596         int ent=c->GetEntries();
00597         printf("%d entries\n",ent);
00598         for(int i=0;i<ent;i++)
00599         {
00600         //      if(i>1000)break;//testing
00601         
00602                 if(i%10000==0)printf("entry %d\n",i);
00603                 c->GetEntry(i);
00604                 
00605                 //is this an mrcc file?  if so do the mrcc cut
00606                 if(ismrcc[set])
00607                 {
00608                         if(mrccinfo_particle_s<3)continue;//no long muon track
00609                         event_visenergy-= (mrccinfo_sum_e*0.03799819+0.4803261); //adjust!
00610                 }
00611                 
00612                 
00613                 
00614                 FillHistos(set,0);
00615                 
00616                 
00617                 if(event_inFiducial!=1 || event_contained!=1)continue;
00618                 FillHistos(set,1);
00619                 
00620                 //presel
00621                 if(particles_ntot<1)continue;
00622                 if(particles_longest_s_particle_s>1.2 ||particles_longest_s_particle_s<0.2)continue;
00623                 //broken in mrcc files if(event_max_z-event_min_z>0.9 || event_max_z-event_min_z < 0.2)continue;
00624                 //need to use particle total energy rather than strip energy for mrcc...
00625                 if(particles_totvise<0.2 || particles_totvise>8)continue;
00626 
00627                 //if(event_nstrips<10 || event_nstrips>40)continue;
00628 
00629                 //don't want a long muon..
00630                 if(particles_longest_particle_type>12)continue;         
00631 
00632 
00633                 if(particles_largest_particle_cmp_chisq>30)continue;
00634 
00635 
00636 
00637                 FillHistos(set,2);
00638 
00639                 if(event_pidB<0.5)continue;
00640         
00641         //      if(event_pidA<0.5)continue;
00642                 FillHistos(set,3);
00643 
00644         }
00645 
00646         
00647         for(int j=0;j<nCut;j++)
00648         for(int k=0;k<nHistos;k++)
00649         {
00650                 if(pots[set])histos[set][j][k]->Scale(3.25e8/pots[set]);
00651         }
00652 
00653 }

void MakePlots::Run (  ) 

Definition at line 56 of file MakePlots.cxx.

References cutnames, FillHistos(), nchains, outdir, and SetupHistos().

00057 {
00058 
00059 //      AddSet("/minos/data/dogwood0/near/data/PO*.root","near data",0);
00060 //      AddSet("/minos/data/dogwood0/near/mc/PO*.root","near mc",1);
00061         
00062 
00063 /*      TChain * near_mc=new TChain("PA");
00064         TChain * near_data=new TChain("PA");
00065         
00066         TChain * near_mc_POT=new TChain("pottree");
00067         TChain * near_data_POT=new TChain("pottree");
00068         
00069         / *near_data->Add("/minos/data/dogwood0/near/data/PO*.root");
00070         near_data_POT->Add("/minos/data/dogwood0/near/data/PO*.root");
00071 
00072         near_mc->Add("/minos/data/dogwood0/near/mc/PO*.root");
00073         near_mc_POT->Add("/minos/data/dogwood0/near/mc/PO*.root");
00074         */
00075         
00076 /*      near_data->Add("/data/minos/ManagedPIDCVS/PO-N00011449_0000.spill.sntp.dogwood0.0-Trim-NN.root");
00077         near_data_POT->Add("/data/minos/ManagedPIDCVS/PO-N00011449_0000.spill.sntp.dogwood0.0-Trim-NN.root");
00078 
00079         near_mc->Add("/data/minos/ManagedPIDCVS/PO-n13037040_0000_L010185N_D04.sntp.dogwood0-Trim-NN.root");
00080         near_mc_POT->Add("/data/minos/ManagedPIDCVS/PO-n13037040_0000_L010185N_D04.sntp.dogwood0-Trim-NN.root");
00081         
00082         
00083         
00084         for(int i=0;i<nType;i++)pots[i]=0;
00085         
00086         int ent;
00087         
00088         ent=near_data_POT->GetEntries();
00089         for(int i=0;i<ent;i++)
00090         {
00091                 near_data_POT->GetEntry(i);
00092                 pots[0]+=near_data_POT->GetLeaf("pot")->GetValue();
00093         }
00094         printf("%f near data POTs\n",pots[0]);
00095         ismc[0]=0;
00096 
00097         ent=near_mc_POT->GetEntries();
00098         for(int i=0;i<ent;i++)
00099         {
00100                 near_mc_POT->GetEntry(i);
00101                 pots[1]+=near_mc_POT->GetLeaf("pot")->GetValue();
00102         }
00103         printf("%f near mc POTs\n",pots[1]);
00104         ismc[1]=1;
00105 */      
00106 
00107         if(!nchains)
00108         {
00109                 printf("You must specify some input sets...\n");
00110                 return;
00111         }
00112         
00113         printf("outdir: %s\n",outdir);
00114         
00115         
00116         //define cut names
00117         sprintf(cutnames[0],"No Cuts");
00118         sprintf(cutnames[1],"Fiducial");
00119         sprintf(cutnames[2],"Preselection");
00120         sprintf(cutnames[3],"PID");
00121 
00122 
00123         SetupHistos();
00124         
00125         for(int i=0;i<nchains;i++)
00126                 FillHistos(i);
00127 
00128 
00129 }

void MakePlots::SavePlots ( int  norm = 0  ) 

Definition at line 466 of file MakePlots.cxx.

References cutnames, histos, max, min, names, nCut, nHistos, outdir, outfile, SortOutStats(), and typesname.

00467 {
00468         TFile *of = TFile::Open(outfile,"RECREATE");
00469         of->cd();
00470 
00471 
00472         
00473         
00474         for(int k=0;k<nHistos;k++)
00475         for(int j=0;j<nCut;j++)
00476         for(int i=0;i<(int)histos.size();i++)
00477         {
00478                 if(norm && histos[i][j][k]->Integral())histos[i][j][k]->Scale(1./histos[i][j][k]->Integral());
00479                 histos[i][j][k]->Write();
00480         }
00481         of->Close();
00482 
00483 
00484         TCanvas c1;
00485         TPad p1("p1","",0,0.4,1,1);
00486         TPad p2("p2","",0,0,1,0.4);
00487         c1.Draw();
00488         p1.Draw();
00489         p2.Draw();
00490         for(int k=0;k<nHistos;k++)
00491         for(int j=0;j<nCut;j++)
00492         {
00493                         p1.cd();
00494 
00495                         double maxb=0;
00496                         for(int i=0;i<(int)histos.size();i++)
00497                         {
00498                                 char tmpchar[200];
00499                                 sprintf(tmpchar,"%s  %s",names[k],cutnames[j]);
00500                                 histos[i][j][k]->SetTitle(tmpchar);
00501                                 double maxt=histos[i][j][k]->GetMaximum();
00502                                 histos[i][j][k]->SetXTitle(names[k]);
00503                                 if(maxt>maxb)maxb=maxt;
00504                         }
00505                         
00506                         
00507                         
00508                         for(int i=0;i<(int)histos.size();i++)
00509                         {
00510                                 histos[i][j][k]->GetYaxis()->SetRangeUser(0,maxb*1.2);
00511                                 histos[i][j][k]->SetName(typesname[i].c_str());
00512                                 if(i==0)
00513                                 {
00514                                         histos[i][j][k]->Draw("E");
00515                                         continue;
00516                                 }
00517                                 histos[i][j][k]->SetLineColor(1+i);
00518                                 histos[i][j][k]->Draw("SAMESE");
00519 
00520                         }
00521                         
00522                         
00523                         
00524                         
00525 
00526                         
00527 
00528         
00529                         p2.cd();
00530                         
00531                         double extt=0;
00532                         std::vector<TH1F *> tmp;
00533                         for(int i=1;i<(int)histos.size();i++)
00534                         {
00535                                 tmp.push_back((TH1F*)histos[0][j][k]->Clone("tmp"));
00536                                 tmp[i-1]->Add(histos[i][j][k],-1);      
00537                                 tmp[i-1]->Divide(histos[i][j][k]);
00538                                 tmp[i-1]->SetLineColor(i+1);
00539                                 
00540                                 int minbin=tmp[i-1]->GetMinimumBin();
00541                                 int maxbin=tmp[i-1]->GetMaximumBin();
00542                                 
00543                                 double min=tmp[i-1]->GetBinContent(minbin);
00544                                 double max=tmp[i-1]->GetBinContent(maxbin);
00545                         
00546                                 double ext = TMath::Abs(min);
00547                                 ext = TMath::Abs(max) < ext?ext:TMath::Abs(max);
00548                                 if(ext>extt)extt=ext;
00549                         }
00550                         extt=extt>0.2?0.2:extt;
00551                         extt*=1.25;
00552                         
00553                         for(int i=0;i<(int)histos.size()-1;i++)
00554                         {
00555                                 tmp[i]->GetYaxis()->SetRangeUser(-extt,extt);
00556                         
00557                                 tmp[i]->SetStats(0);
00558                                 tmp[i]->SetTitle("");
00559                                 if(i==0)
00560                                 {
00561                                         tmp[i]->Draw();
00562                                         continue;
00563                                 }
00564                                 tmp[i]->Draw("same");
00565                         }
00566                         
00567                         TLine l(tmp[0]->GetXaxis()->GetXmin(),0,tmp[0]->GetXaxis()->GetXmax(),0);
00568                         l.Draw("same");
00569                         
00570                         
00571                         SortOutStats(&c1);
00572                         
00573                         char tmpchar[200];
00574                         printf("%d  %s/%s_%d.gif\n",k,outdir,names[k],j);
00575                         sprintf(tmpchar,"%s/%s_%d.gif",outdir,names[k],j);
00576                         c1.SaveAs(tmpchar);
00577                         for(int i=0;i<(int)histos.size()-1;i++)delete tmp[i];
00578         }
00579         
00580         
00581 
00582         
00583 }

void MakePlots::SaveRatioPlots (  ) 

Definition at line 341 of file MakePlots.cxx.

References Nav::GetName(), histos, max, min, names, nCut, nHistos, outdir, outfile, rationame, ratiopair, Munits::second, and SortOutStats().

00342 {
00343         if(ratiopair.size()<1)return;
00344 
00345 
00346 
00347         const int nHist=ratiopair.size();
00348         std::vector<TH1F*>  histos[nCut][nHistos];
00349         
00350         
00351         for(int j=0;j<nCut;j++)
00352         for(int k=0;k<nHistos;k++)
00353         for(int i=0;i<nHist;i++)
00354         {
00355                 histos[j][k].push_back((TH1F*)0);
00356                 
00357                 printf("making %s with %s and %s %d %d\n",rationame[i].c_str(),this->histos[ratiopair[i].first][j][k]->GetName(),this->histos[ratiopair[i].second][j][k]->GetName(),j,k);
00358                 histos[j][k][i]=(TH1F*)this->histos[ratiopair[i].first][j][k]->Clone(rationame[i].c_str());
00359                 histos[j][k][i]->SetDirectory(0);
00360                 histos[j][k][i]->Divide((TH1F*)this->histos[ratiopair[i].second][j][k]);
00361                 printf("made %s max %f\n",histos[j][k][i]->GetName(),histos[j][k][i]->GetMaximum());
00362         }
00363 
00364         TFile *of = TFile::Open(outfile,"RECREATE");
00365         of->cd();
00366         for(int k=0;k<nHistos;k++)
00367         for(int j=0;j<nCut;j++)
00368         for(int i=0;i<nHist;i++)
00369                 histos[j][k][i]->Write();
00370         
00371         of->Close();
00372 
00373 
00374         TCanvas c1;
00375         TPad p1("p1","",0,0.4,1,1);
00376         TPad p2("p2","",0,0,1,0.4);
00377         c1.Draw();
00378         p1.Draw();
00379         p2.Draw();
00380         for(int k=0;k<nHistos;k++)
00381         for(int j=0;j<nCut;j++)
00382         {
00383                         p1.cd();
00384 
00385                         double maxb=0;
00386                         for(int i=0;i<nHist;i++)
00387                         {
00388                                 //char tmpchar[200];
00389                                 double maxt=histos[j][k][i]->GetMaximum();
00390                                 if(maxt>maxb)maxb=maxt;
00391                         }
00392                         
00393                         for(int i=0;i<nHist;i++)
00394                         {
00395                 //              histos[j][k][i]->GetYaxis()->SetRangeUser(0.5,1.5);//0,maxb*1.2);
00396                         
00397                                 if(i==0)
00398                                 {
00399                                         histos[j][k][i]->Draw("E");
00400                                         continue;
00401                                 }
00402                                 histos[j][k][i]->SetLineColor(1+i);
00403                                 histos[j][k][i]->Draw("SAMESE");
00404 
00405                         }
00406                         
00407         
00408                         p2.cd();
00409                         
00410                         double extt=0;
00411                         std::vector<TH1F*> tmp;
00412                         
00413                         if(nHist>1)
00414                         {
00415                         for(int i=1;i<nHist;i++)
00416                         {
00417                                 tmp.push_back((TH1F*)0);
00418                                 tmp[i-1]= (TH1F*)histos[j][k][0]->Clone("tmp");
00419                                 tmp[i-1]->Add(histos[j][k][i],-1);      
00420                                 tmp[i-1]->Divide(histos[j][k][i]);
00421                                 tmp[i-1]->SetLineColor(i+1);
00422                                 
00423                                 int minbin=tmp[i-1]->GetMinimumBin();
00424                                 int maxbin=tmp[i-1]->GetMaximumBin();
00425                                 
00426                                 double min=tmp[i-1]->GetBinContent(minbin);
00427                                 double max=tmp[i-1]->GetBinContent(maxbin);
00428                         
00429                                 double ext = TMath::Abs(min);
00430                                 ext = TMath::Abs(max) < ext?ext:TMath::Abs(max);
00431                                 if(ext>extt)extt=ext;
00432                         }
00433                         extt=extt>0.2?0.2:extt;
00434                         extt*=1.25;
00435                         
00436                         for(int i=0;i<nHist-1;i++)
00437                         {
00438                                 tmp[i]->GetYaxis()->SetRangeUser(-extt,extt);
00439                         
00440                                 tmp[i]->SetStats(0);
00441                                 tmp[i]->SetTitle("");
00442                                 if(i==0)
00443                                 {
00444                                         tmp[i]->Draw();
00445                                         continue;
00446                                 }
00447                                 tmp[i]->Draw("same");
00448                         }
00449                         
00450                         TLine l(tmp[0]->GetXaxis()->GetXmin(),0,tmp[0]->GetXaxis()->GetXmax(),0);
00451                         l.Draw("same");
00452                         }
00453                         
00454                         SortOutStats(&c1);
00455                         
00456                         char tmpchar[200];
00457                         printf("%d  %s/%s_%d.gif\n",k,outdir,names[k],j);
00458                         sprintf(tmpchar,"%s/%s_%d.gif",outdir,names[k],j);
00459                         c1.SaveAs(tmpchar);
00460                         for(int i=0;i<(int)tmp.size()-1;i++){delete tmp[i];tmp[i]=0;}
00461         }
00462 }

void MakePlots::SetBranches ( TChain *  c  )  [private]

Definition at line 253 of file MakePlots.cxx.

References event_contained, event_inFiducial, event_max_z, event_min_z, event_nstrips, event_pidA, event_pidB, event_pidC, event_pidD, event_visenergy, mctrue_iresonance, mctrue_oscprob, mctrue_totbeamweight, mctrue_type, mrccinfo_particle_s, mrccinfo_sum_e, particles_elec_vise, particles_emfrac, particles_largest_particle_cmp_chisq, particles_largest_particle_e, particles_largest_particle_peakdiff, particles_largest_particlecmp_ndf, particles_longest_particle_type, particles_longest_s_particle_s, particles_longest_z, particles_mol_rad_r, particles_ntot, particles_prim_par_a, particles_prim_par_b, particles_prim_par_chisq, particles_prim_par_e0, particles_prim_vise, particles_primary_long_e, particles_primary_phi, particles_rms_r, particles_total_long_e, particles_totvise, and particles_weighted_phi.

Referenced by FillHistos().

00254 {
00255         c->SetMakeClass(1);
00256         c->SetBranchStatus("*",0);
00257         c->SetBranchStatus("particles.primary_long_e",1);
00258         c->SetBranchStatus("particles.longest_s_particle_s",1);
00259         c->SetBranchStatus("particles.elec_vise",1);
00260         c->SetBranchStatus("particles.primary_phi",1);
00261         c->SetBranchStatus("particles.prim_par_b",1);
00262         c->SetBranchStatus("particles.mol_rad_r",1);
00263         c->SetBranchStatus("particles.longest_z",1);
00264         c->SetBranchStatus("particles.emfrac",1);
00265         c->SetBranchStatus("particles.ntot",1);
00266         c->SetBranchStatus("particles.total_long_e",1);
00267         c->SetBranchStatus("particles.weighted_phi",1);
00268         c->SetBranchStatus("particles.largest_particle_e",1);
00269         c->SetBranchStatus("particles.totvise",1);
00270         c->SetBranchStatus("particles.prim_vise",1);
00271         c->SetBranchStatus("event.visenergy",1);
00272         c->SetBranchStatus("event.nstrips",1);
00273         c->SetBranchStatus("event.inFiducial",1);
00274         c->SetBranchStatus("event.max_z",1);
00275         c->SetBranchStatus("event.min_z",1);
00276         c->SetBranchStatus("mctrue.type",1);
00277         c->SetBranchStatus("mctrue.oscprob",1);
00278         c->SetBranchStatus("mctrue.totbeamweight",1);
00279         c->SetBranchStatus("mctrue.iresonance",1);
00280         c->SetBranchStatus("event.contained",1);                        
00281         c->SetBranchStatus("event.pidA",1);             
00282         c->SetBranchStatus("event.pidB",1);             
00283         c->SetBranchStatus("event.pidC",1);             
00284         c->SetBranchStatus("event.pidD",1);
00285         c->SetBranchStatus("mrccinfo.particle_s",1);
00286         c->SetBranchStatus("mrccinfo.sum_e",1);
00287 
00288         c->SetBranchStatus("particles.rms_r",1);
00289         c->SetBranchStatus("particles.prim_par_a",1);
00290         c->SetBranchStatus("particles.prim_par_e0",1);
00291         c->SetBranchStatus("particles.prim_par_chisq",1);
00292         c->SetBranchStatus("particles.largest_particle_peakdiff",1);
00293         c->SetBranchStatus("particles.largest_particle_cmp_chisq",1);
00294         c->SetBranchStatus("particles.largest_particle_cmp_ndf",1);     
00295         c->SetBranchStatus("particles.longest_particle_type",1);
00296 
00297         
00298         c->SetBranchAddress("particles.primary_long_e",&particles_primary_long_e);
00299         c->SetBranchAddress("particles.longest_s_particle_s",&particles_longest_s_particle_s);
00300         c->SetBranchAddress("particles.elec_vise",&particles_elec_vise);
00301         c->SetBranchAddress("particles.primary_phi",&particles_primary_phi);
00302         c->SetBranchAddress("particles.prim_par_b",&particles_prim_par_b);
00303         c->SetBranchAddress("particles.mol_rad_r",&particles_mol_rad_r);
00304         c->SetBranchAddress("particles.longest_z",&particles_longest_z);
00305         c->SetBranchAddress("particles.emfrac",&particles_emfrac);
00306         c->SetBranchAddress("particles.ntot",&particles_ntot);
00307         c->SetBranchAddress("particles.total_long_e",&particles_total_long_e);
00308         c->SetBranchAddress("particles.weighted_phi",&particles_weighted_phi);
00309         c->SetBranchAddress("particles.largest_particle_e",&particles_largest_particle_e);
00310         c->SetBranchAddress("particles.totvise",&particles_totvise);
00311         c->SetBranchAddress("particles.prim_vise",&particles_prim_vise);
00312         c->SetBranchAddress("event.visenergy",&event_visenergy);
00313         c->SetBranchAddress("event.nstrips",&event_nstrips);
00314         c->SetBranchAddress("event.inFiducial",&event_inFiducial);
00315         c->SetBranchAddress("event.max_z",&event_max_z);
00316         c->SetBranchAddress("event.min_z",&event_min_z);
00317         c->SetBranchAddress("mctrue.type",&mctrue_type);
00318         c->SetBranchAddress("mctrue.oscprob",&mctrue_oscprob);
00319         c->SetBranchAddress("mctrue.totbeamweight",&mctrue_totbeamweight);
00320         c->SetBranchAddress("mctrue.iresonance",&mctrue_iresonance);
00321         c->SetBranchAddress("event.contained",&event_contained);
00322         c->SetBranchAddress("event.pidA",&event_pidA);
00323         c->SetBranchAddress("event.pidB",&event_pidB);
00324         c->SetBranchAddress("event.pidC",&event_pidC);
00325         c->SetBranchAddress("event.pidD",&event_pidD);
00326         c->SetBranchAddress("mrccinfo.particle_s",&mrccinfo_particle_s);
00327         c->SetBranchAddress("mrccinfo.sum_e",&mrccinfo_sum_e);
00328         
00329         c->SetBranchAddress("particles.rms_r",&particles_rms_r);
00330         c->SetBranchAddress("particles.prim_par_a",&particles_prim_par_a);
00331         c->SetBranchAddress("particles.prim_par_e0",&particles_prim_par_e0);
00332         c->SetBranchAddress("particles.prim_par_chisq",&particles_prim_par_chisq);
00333         c->SetBranchAddress("particles.largest_particle_peakdiff",&particles_largest_particle_peakdiff);
00334         c->SetBranchAddress("particles.largest_particle_cmp_chisq",&particles_largest_particle_cmp_chisq);
00335         c->SetBranchAddress("particles.largest_particle_cmp_ndf",&particles_largest_particlecmp_ndf);   
00336         c->SetBranchAddress("particles.longest_particle_type",&particles_longest_particle_type);
00337         
00338 
00339 }

void MakePlots::SetOutDir ( const char *  o  ) 

Definition at line 131 of file MakePlots.cxx.

References outdir.

00132 {
00133 
00134         sprintf(outdir,"%s",o);
00135 }

void MakePlots::SetOutFile ( const char *  o  ) 

Definition at line 138 of file MakePlots.cxx.

References outfile.

00139 {
00140 
00141         sprintf(outfile,"%s",o);
00142 }

void MakePlots::SetPots ( int  chain,
double  p 
) [inline]

Definition at line 46 of file MakePlots.h.

References nchains, and pots.

00046 {if(chain>-1 && chain<nchains)pots[chain]=p;};

void MakePlots::SetRatioPair ( int  set1,
int  set2,
const char *  name 
) [inline]

Definition at line 35 of file MakePlots.h.

References rationame, and ratiopair.

00035                                                                        {
00036                         ratiopair.push_back(std::pair<int,int>(set1,set2));
00037                         rationame.push_back(name);
00038                 };

void MakePlots::SetupHistos (  ) 

Definition at line 145 of file MakePlots.cxx.

References MuELoss::a, histos, names, nCut, and nHistos.

Referenced by Run().

00146 {
00147         char tmp[200];
00148         
00149         for(int i=0;i<(int)histos.size();i++)   
00150         for(int j=0;j<nCut;j++) 
00151         {
00152                 std::vector<TH1F*> a;
00153                 histos[i].push_back(a);
00154                 
00155                 sprintf(tmp,"particles_longest_z_%d_%d",i,j);
00156                 histos[i][j].push_back(new TH1F(tmp,tmp,10,0,2));
00157                 sprintf(names[0],"particles_longest_z");        
00158 
00159                 sprintf(tmp,"particles_longest_s_particle_s_%d_%d",i,j);
00160                 histos[i][j].push_back(new TH1F(tmp,tmp,20,0,2));
00161                 sprintf(names[1],"particles_longest_s_particle_s");                     
00162 
00163                 sprintf(tmp,"particles_primary_long_e_%d_%d",i,j);
00164                 histos[i][j].push_back(new TH1F(tmp,tmp,10,0,2));
00165                 sprintf(names[2],"particles_primary_long_e");
00166                 
00167                 sprintf(tmp,"particles_elec_vise_%d_%d",i,j);
00168                 histos[i][j].push_back(new TH1F(tmp,tmp,20,0,10));
00169                 sprintf(names[3],"particles_elec_vise");                                
00170 
00171                 sprintf(tmp,"particles_primary_phi_%d_%d",i,j);
00172                 histos[i][j].push_back(new TH1F(tmp,tmp,20,0,1.6));
00173                 sprintf(names[4],"particles_primary_phi");      
00174                         
00175                 sprintf(tmp,"particles_prim_par_b_%d_%d",i,j);
00176                 histos[i][j].push_back(new TH1F(tmp,tmp,20,0,1.5));             
00177                 sprintf(names[5],"particles_prim_par_b");       
00178                         
00179                 sprintf(tmp,"particles_mol_rad_r_%d_%d",i,j);
00180                 histos[i][j].push_back(new TH1F(tmp,tmp,20,0,0.2));
00181                 sprintf(names[6],"particles_mol_rad_r");        
00182                         
00183                 sprintf(tmp,"particles_emfrac_%d_%d",i,j);
00184                 histos[i][j].push_back(new TH1F(tmp,tmp,20,0,1.1));     
00185                 sprintf(names[7],"particles_emfrac");   
00186                 
00187                 sprintf(tmp,"particles_ntot_%d_%d",i,j);
00188                 histos[i][j].push_back(new TH1F(tmp,tmp,20,0,20));
00189                 sprintf(names[8],"particles_ntot");     
00190                         
00191                 sprintf(tmp,"particles_total_long_e_%d_%d",i,j);
00192                 histos[i][j].push_back(new TH1F(tmp,tmp,20,0,200));     
00193                 sprintf(names[9],"particles_total_long_e");     
00194                 
00195                 sprintf(tmp,"particles_weighted_phi_%d_%d",i,j);
00196                 histos[i][j].push_back(new TH1F(tmp,tmp,20,0,1.6));     
00197                 sprintf(names[10],"particles_weighted_phi");    
00198                 
00199                 sprintf(tmp,"largest_frac_%d_%d",i,j);
00200                 histos[i][j].push_back(new TH1F(tmp,tmp,50,0,2));       
00201                 sprintf(names[11],"largest_frac");      
00202                 
00203                 sprintf(tmp,"reco_frac_%d_%d",i,j);
00204                 histos[i][j].push_back(new TH1F(tmp,tmp,50,0,2));       
00205                 sprintf(names[12],"reco_frac"); 
00206 
00207                 sprintf(tmp,"particles_totvise_%d_%d",i,j);
00208                 histos[i][j].push_back(new TH1F(tmp,tmp,20,0,20));      
00209                 sprintf(names[13],"particles_totvise"); 
00210                 
00211                 sprintf(tmp,"event_visenergy_%d_%d",i,j);
00212                 histos[i][j].push_back(new TH1F(tmp,tmp,20,0,20));      
00213                 sprintf(names[14],"event_visenergy");                   
00214 
00215 
00216                 sprintf(tmp,"particles_rms_r_%d_%d",i,j);
00217                 histos[i][j].push_back(new TH1F(tmp,tmp,20,0,4));       
00218                 sprintf(names[15],"particles_rms_r");   
00219                 
00220                 sprintf(tmp,"particles_prim_par_a_%d_%d",i,j);
00221                 histos[i][j].push_back(new TH1F(tmp,tmp,20,0,10));      
00222                 sprintf(names[16],"particles_prim_par_a");      
00223 
00224 
00225                 sprintf(tmp,"particles_prim_par_e0_%d_%d",i,j);
00226                 histos[i][j].push_back(new TH1F(tmp,tmp,20,0,10));      
00227                 sprintf(names[17],"particles_prim_par_e0");     
00228 
00229                 sprintf(tmp,"particles_prim_par_chisq_%d_%d",i,j);
00230                 histos[i][j].push_back(new TH1F(tmp,tmp,20,0.1,500));   
00231                 sprintf(names[18],"particles_prim_par_chisq");  
00232 
00233                 sprintf(tmp,"particles_largest_particle_peakdiff_%d_%d",i,j);
00234                 histos[i][j].push_back(new TH1F(tmp,tmp,20,-5,5));      
00235                 sprintf(names[19],"particles_largest_particle_peakdiff");                                                                       
00236 
00237                 sprintf(tmp,"largest_cmp_chisqndf_%d_%d",i,j);
00238                 histos[i][j].push_back(new TH1F(tmp,tmp,20,0,2));       
00239                 sprintf(names[20],"largest_cmp_chisqndf");      
00240                 
00241                 sprintf(tmp,"event_nstrips_%d_%d",i,j);
00242                 histos[i][j].push_back(new TH1F(tmp,tmp,20,0,80));      
00243                 sprintf(names[21],"event_nstrips");     
00244 
00245         }
00246 
00247         for(int j=0;j<nCut;j++) 
00248                 for(int i=0;i<(int)histos.size();i++)
00249                         for(int k=0;k<nHistos;k++)
00250                                 histos[i][j][k]->Sumw2();
00251 }

void MakePlots::SortOutStats ( TPad *  pad,
float  fracPadx = 0.3,
float  fracPady = 0.5,
int  numPerCol = 4,
float  startx = 0.98,
float  starty = 0.98 
) [private]

Definition at line 691 of file MakePlots.cxx.

References stat.

Referenced by SavePlots(), and SaveRatioPlots().

00692                                             {
00693 
00694   pad->Update();
00695   pad->Modified();
00696 
00697   TList *theList = pad->GetListOfPrimitives();
00698   TIterator *iter = theList->MakeIterator();
00699   TObject *ob;
00700   int numStats = 0;
00701   while((ob = iter->Next())){
00702     if(ob->InheritsFrom("TPad")) {
00703       TPad *p = (TPad*) ob;
00704       SortOutStats(p,fracPadx,fracPady,numPerCol,startx,starty);
00705     }
00706     else if(ob->InheritsFrom("TH1")||ob->InheritsFrom("TH2")
00707             ||ob->InheritsFrom("TGraph")||ob->InheritsFrom("TProfile")){
00708       if(ob->FindObject("stats")) numStats+=1;
00709     }
00710     else if(ob->InheritsFrom("TLegend")){
00711       numStats+=1;
00712     }
00713   }
00714   
00715   if(numStats!=0){
00716     
00717     float xwidth = fracPadx/float(int((numStats-1)/numPerCol)+1);
00718     float ywidth = 0.2;
00719     if(numStats>=numPerCol) ywidth = fracPady/numPerCol;
00720     else ywidth = fracPady/float(numStats%numPerCol);
00721     float xgap = 0.01;
00722     float ygap = 0.01;
00723     float x2 = startx;
00724     float y2 = starty;
00725     float x1 = x2-xwidth;
00726     float y1 = y2-ywidth;
00727     int cnt = 0;
00728     
00729     iter->Reset();
00730     while((ob = iter->Next())){
00731       int col = 1;
00732       if(ob->InheritsFrom("TH1")){
00733         TH1 *h1 = (TH1*) ob;
00734         col = h1->GetLineColor();
00735       }
00736       else if(ob->InheritsFrom("TProfile")){
00737         TProfile *p1 = (TProfile*) ob;
00738         col = p1->GetLineColor();
00739       }
00740       else if(ob->InheritsFrom("TGraph")){
00741         TGraph *g1 = (TGraph*) ob;
00742         col = g1->GetLineColor();
00743       }
00744 
00745       TPaveStats *stat = 0;
00746       if((stat = (TPaveStats*) ob->FindObject("stats"))){
00747         stat->SetTextColor(col);
00748         stat->SetX1NDC(x1-int(cnt/numPerCol)*(xwidth+xgap));
00749         stat->SetX2NDC(x2-int(cnt/numPerCol)*(xwidth+xgap));
00750         stat->SetY1NDC(y1-float(cnt%numPerCol)*(ywidth+ygap));
00751         stat->SetY2NDC(y2-float(cnt%numPerCol)*(ywidth+ygap));
00752         cnt+=1;
00753       }
00754       else if(ob->InheritsFrom("TLegend")){
00755         TLegend *leg = (TLegend*) ob;
00756         leg->SetX1NDC(x1-int(cnt/numPerCol)*(xwidth+xgap));
00757         leg->SetX2NDC(x2-int(cnt/numPerCol)*(xwidth+xgap));
00758         leg->SetY1NDC(y1-float(cnt%numPerCol)*(ywidth+ygap));
00759         leg->SetY2NDC(y2-float(cnt%numPerCol)*(ywidth+ygap));
00760         cnt+=1;
00761       }
00762     }
00763   }
00764 }


Member Data Documentation

std::vector<TChain *> MakePlots::chains [private]

Definition at line 67 of file MakePlots.h.

Referenced by AddSet(), and FillHistos().

char MakePlots::cutnames[nCut][200] [private]

Definition at line 65 of file MakePlots.h.

Referenced by Run(), and SavePlots().

Int_t MakePlots::event_contained [private]

Definition at line 95 of file MakePlots.h.

Referenced by FillHistos(), and SetBranches().

Int_t MakePlots::event_inFiducial [private]

Definition at line 94 of file MakePlots.h.

Referenced by FillHistos(), and SetBranches().

Double_t MakePlots::event_max_z [private]

Definition at line 91 of file MakePlots.h.

Referenced by SetBranches().

Double_t MakePlots::event_min_z [private]

Definition at line 92 of file MakePlots.h.

Referenced by SetBranches().

Int_t MakePlots::event_nstrips [private]

Definition at line 93 of file MakePlots.h.

Referenced by FillHistos(), and SetBranches().

Double_t MakePlots::event_pidA [private]

Definition at line 97 of file MakePlots.h.

Referenced by SetBranches().

Double_t MakePlots::event_pidB [private]

Definition at line 98 of file MakePlots.h.

Referenced by FillHistos(), and SetBranches().

Double_t MakePlots::event_pidC [private]

Definition at line 99 of file MakePlots.h.

Referenced by SetBranches().

Double_t MakePlots::event_pidD [private]

Definition at line 100 of file MakePlots.h.

Referenced by SetBranches().

Double_t MakePlots::event_visenergy [private]

Definition at line 90 of file MakePlots.h.

Referenced by FillHistos(), and SetBranches().

std::vector<std::vector<std::vector<TH1F *> > > MakePlots::histos [private]

Definition at line 56 of file MakePlots.h.

Referenced by AddSet(), FillHistos(), SavePlots(), SaveRatioPlots(), and SetupHistos().

Int_t MakePlots::isbeamve [private]

Definition at line 117 of file MakePlots.h.

Int_t MakePlots::iscc [private]

Definition at line 115 of file MakePlots.h.

Int_t MakePlots::isdis [private]

Definition at line 119 of file MakePlots.h.

std::vector<int> MakePlots::ismc [private]

Definition at line 62 of file MakePlots.h.

Referenced by AddSet(), and FillHistos().

std::vector<int> MakePlots::ismrcc [private]

Definition at line 63 of file MakePlots.h.

Referenced by AddSet(), and FillHistos().

Int_t MakePlots::isnc [private]

Definition at line 113 of file MakePlots.h.

Int_t MakePlots::isndis [private]

Definition at line 118 of file MakePlots.h.

Int_t MakePlots::isnue [private]

Definition at line 114 of file MakePlots.h.

Int_t MakePlots::istau [private]

Definition at line 116 of file MakePlots.h.

Double_t MakePlots::largest_frac [private]

Definition at line 110 of file MakePlots.h.

Definition at line 105 of file MakePlots.h.

Referenced by SetBranches().

Double_t MakePlots::mctrue_oscprob [private]

Definition at line 103 of file MakePlots.h.

Referenced by FillHistos(), and SetBranches().

Double_t MakePlots::mctrue_totbeamweight [private]

Definition at line 104 of file MakePlots.h.

Referenced by FillHistos(), and SetBranches().

Int_t MakePlots::mctrue_type [private]

Definition at line 102 of file MakePlots.h.

Referenced by SetBranches().

Double_t MakePlots::mrccinfo_particle_s [private]

Definition at line 130 of file MakePlots.h.

Referenced by FillHistos(), and SetBranches().

Double_t MakePlots::mrccinfo_sum_e [private]

Definition at line 131 of file MakePlots.h.

Referenced by FillHistos(), and SetBranches().

char MakePlots::names[nHistos][200] [private]

Definition at line 61 of file MakePlots.h.

Referenced by SavePlots(), SaveRatioPlots(), and SetupHistos().

int MakePlots::nchains [private]

Definition at line 69 of file MakePlots.h.

Referenced by AddSet(), MakePlots(), Run(), and SetPots().

char MakePlots::outdir[200] [private]

Definition at line 71 of file MakePlots.h.

Referenced by MakePlots(), Run(), SavePlots(), SaveRatioPlots(), and SetOutDir().

char MakePlots::outfile[200] [private]

Definition at line 72 of file MakePlots.h.

Referenced by MakePlots(), SavePlots(), SaveRatioPlots(), and SetOutFile().

Double_t MakePlots::particles_elec_vise [private]

Definition at line 76 of file MakePlots.h.

Referenced by FillHistos(), and SetBranches().

Double_t MakePlots::particles_emfrac [private]

Definition at line 81 of file MakePlots.h.

Referenced by FillHistos(), and SetBranches().

Definition at line 126 of file MakePlots.h.

Referenced by FillHistos(), and SetBranches().

Definition at line 86 of file MakePlots.h.

Referenced by FillHistos(), and SetBranches().

Definition at line 125 of file MakePlots.h.

Referenced by FillHistos(), and SetBranches().

Definition at line 127 of file MakePlots.h.

Referenced by FillHistos(), and SetBranches().

Definition at line 129 of file MakePlots.h.

Referenced by FillHistos(), and SetBranches().

Definition at line 75 of file MakePlots.h.

Referenced by FillHistos(), and SetBranches().

Double_t MakePlots::particles_longest_z [private]

Definition at line 80 of file MakePlots.h.

Referenced by FillHistos(), and SetBranches().

Double_t MakePlots::particles_mol_rad_r [private]

Definition at line 79 of file MakePlots.h.

Referenced by FillHistos(), and SetBranches().

Int_t MakePlots::particles_ntot [private]

Definition at line 82 of file MakePlots.h.

Referenced by FillHistos(), and SetBranches().

Double_t MakePlots::particles_prim_par_a [private]

Definition at line 122 of file MakePlots.h.

Referenced by FillHistos(), and SetBranches().

Double_t MakePlots::particles_prim_par_b [private]

Definition at line 78 of file MakePlots.h.

Referenced by FillHistos(), and SetBranches().

Definition at line 124 of file MakePlots.h.

Referenced by FillHistos(), and SetBranches().

Definition at line 123 of file MakePlots.h.

Referenced by FillHistos(), and SetBranches().

Double_t MakePlots::particles_prim_vise [private]

Definition at line 89 of file MakePlots.h.

Referenced by FillHistos(), and SetBranches().

Definition at line 74 of file MakePlots.h.

Referenced by FillHistos(), and SetBranches().

Definition at line 77 of file MakePlots.h.

Referenced by FillHistos(), and SetBranches().

Double_t MakePlots::particles_rms_r [private]

Definition at line 121 of file MakePlots.h.

Referenced by FillHistos(), and SetBranches().

Definition at line 83 of file MakePlots.h.

Referenced by FillHistos(), and SetBranches().

Double_t MakePlots::particles_totvise [private]

Definition at line 87 of file MakePlots.h.

Referenced by FillHistos(), and SetBranches().

Definition at line 84 of file MakePlots.h.

Referenced by FillHistos(), and SetBranches().

std::vector<double> MakePlots::pots

Definition at line 24 of file MakePlots.h.

Referenced by AddSet(), FillHistos(), and SetPots().

std::vector<std::string> MakePlots::rationame [private]

Definition at line 59 of file MakePlots.h.

Referenced by SaveRatioPlots(), and SetRatioPair().

std::vector<std::pair<int,int> > MakePlots::ratiopair [private]

Definition at line 58 of file MakePlots.h.

Referenced by SaveRatioPlots(), and SetRatioPair().

Double_t MakePlots::reco_frac [private]

Definition at line 111 of file MakePlots.h.

Double_t MakePlots::trainweight [private]

Definition at line 107 of file MakePlots.h.

Int_t MakePlots::type [private]

Definition at line 108 of file MakePlots.h.

std::vector<std::string> MakePlots::typesname [private]

Definition at line 68 of file MakePlots.h.

Referenced by AddSet(), and SavePlots().


The documentation for this class was generated from the following files:

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1