ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RUNME.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file RUNME.C
1 #include "mRICH.C"
2 #include <vector>
3 #include <TMath.h>
4 #include <TH1.h>
5 #include <TH2.h>
6 
7 std::vector<PID*> Detectors;
8 std::vector<TH1*> Plots;
9 
10 PID::type myType = PID::pi_k; // This means I want to plot the pi_K separation;
11 double numSigma = 3.001; // This means I want to plot teh contour for three sigma separation
12 double mom=5.;//GeV/c
13 
14 void RUNME()
15 {
16 
17  gStyle->SetOptStat(0);
18 
19  // Add as many detectors as your heart desires....
20  Detectors.push_back( new mRICH(0.00175, 1, 1, mom) ); // 5 psec @ 150 cm
21  Detectors.push_back( new mRICH(0.00175, 1, 2, mom) ); // 10 psec @ 100 cm
22  Detectors.push_back( new mRICH(0.00175, 1, 3, mom) ); // 20 psec @ 100 cm
23 
24  // Select the booking criterion for the performance plot.
25  TH1* Performance = new TH1D("Performance","Performance",100,-6,6); // Format for detector Performance.
26 
27  //----------------------------------------------------------------------------------
28  // At least in the beginning, you might not want to change the lines below here...
29  //----------------------------------------------------------------------------------
30 
31  // Now we call upon all detectors to present their descriptions and assumptions.
32  for (int i=0; i<Detectors.size(); i++)
33  {
34  Detectors[i]->description();
35  }
36 
37  // Now we clone the original performance plot once for every known detector.
38  for (int i=0; i<Detectors.size(); i++)
39  {
40  Plots.push_back( (TH1*)Performance->Clone(Detectors[i]->name().c_str()) );
41  Plots[i]->SetLineColor(i+1); // Works well only for the first 9 colors...
42  Plots[i]->SetLineWidth(4);
43  }
44 
45  // Now we fill all the performance plots:
46  for (int i=1; i<Plots[0]->GetNbinsX(); i++) // Remember root is weird...bin0 is the underflow bin
47  {
48  double eta = Plots[0]->GetBinCenter(i);
49  for (int j=0; j<Detectors.size(); j++)
50  {
51  if (Detectors[j]->valid(eta,mom))
52  {
53  Plots[j]->SetBinContent(i, Detectors[j]->maxP(eta, mom, numSigma, myType) );
54  //cout<<numSigma<<"\t"<<Detectors[j]->maxP(eta, numSigma, myType)<<endl;
55  }
56  }
57  }
58 
59  TCanvas *c1 = new TCanvas("c1","c1",700,500);
60  // Now we display the performance plots
61  for (int i=0; i<Plots.size(); i++)
62  {
63  Plots[i]->Draw("same");
64  }
65 
66  // Now we put colored names on top of the plot (too fancy?)...
67  TPaveText *pt = new TPaveText(0.15,0.7,0.4,0.90,"NDC");
68  for (int i=0; i<Detectors.size(); i++)
69  {
70  pt->AddText( Detectors[i]->name().c_str() );
71  ((TText*)pt->GetListOfLines()->Last())->SetTextColor(i+1);
72  }
73  pt->Draw();
74 
75 }