45 TGraph *
MakeGraph(vector<pair<double, double> > v,
int col,
int style,
const float size=1.5)
47 cout <<
"Making graph from vector of size " << v.size() << endl;
48 TGraph * g =
new TGraph(v.size());
49 for(
size_t i = 0;
i < v.size();
i++) {
51 g->SetPoint(
i, pair.first, pair.second);
54 g->SetMarkerColor(col);
55 g->SetMarkerStyle(style);
56 g->SetMarkerSize(size);
62 double t = TMath::ATan(y / x);
69 t = TMath::ATan2(y, x);
79 r = TMath::Sqrt(x*x + y*y);
81 cout << std::setw(6) << ipmt
82 <<
" " << std::setw(8) << tube->
GetTubeNo()
83 <<
" " << std::setw(8) << tube->
GetmPMTNo()
85 <<
" " << std::setw(9) << x
86 <<
" " << std::setw(9) << y
87 <<
" " << std::setw(9) << z
88 <<
" " << std::setw(9) << r
89 <<
" " << std::setw(9) << t
90 <<
" " << std::setw(2) << tube->
GetCylLoc()
112 cout <<
"N 20\" PMTs in TClonesArray: " << pmts->GetEntries() << endl
115 cout <<
"N mPMTs in TClonesArray: " << pmts2->GetEntries() << endl
118 cout <<
"N OD PMTs in TClonesArray: " << pmtsod->GetEntries() << endl;
121 const int narrays = 9;
122 vector<pair<double, double> > pos[narrays];
123 TH1D * Rs[narrays], * Zs[narrays];
124 vector<double> Rsv[narrays], Zsv[narrays];
125 THStack * stackR =
new THStack(
"stackR",
";R (cm);Number in bin");
126 THStack * stackZ =
new THStack(
"stackZ",
";Z (cm);Number in bin");
127 for(
int i = 0;
i < narrays;
i++) {
128 Rs[
i] =
new TH1D(TString::Format(
"R%d",
i),
";R (cm);Number in bin", TMath::Ceil(detR*8), 0, detR);
129 Zs[
i] =
new TH1D(TString::Format(
"Z%d",
i),
";Z (cm);Number in bin", TMath::Ceil(detZ*8), -detZ, +detZ);
133 double x, y, z, r, t;
137 cout << endl <<
"20\" PMT list" << endl;
138 for(
int ipmt = 0; ipmt < pmts->GetEntries() - 1; ipmt++) {
144 r = TMath::Sqrt(x*x + y*y);
151 pos[loc].push_back(std::make_pair(x, y));
155 pos[loc].push_back(std::make_pair(t, z));
158 cout <<
"Unknown case " << tube->
GetCylLoc() << endl;
163 Rsv[loc].push_back(r);
164 Zsv[loc].push_back(z);
171 cout << endl <<
"OD PMT list" << endl;
172 for(
int ipmt = 0; ipmt < pmtsod->GetEntries() - 1; ipmt++) {
178 r = TMath::Sqrt(x*x + y*y);
185 pos[loc].push_back(std::make_pair(x, y));
189 pos[loc].push_back(std::make_pair(t, z));
192 cout <<
"Unknown case " << tube->
GetCylLoc() << endl;
197 Rsv[loc].push_back(r);
198 Zsv[loc].push_back(z);
205 cout << endl <<
"mPMT list" << endl;
206 for(
int ipmt = 0; ipmt < pmts2->GetEntries() - 1; ipmt++) {
212 r = TMath::Sqrt(x*x + y*y);
219 pos[loc].push_back(std::make_pair(x, y));
223 pos[loc].push_back(std::make_pair(t, z));
226 cout <<
"Unknown case " << tube->
GetCylLoc() << endl;
231 Rsv[loc].push_back(r);
232 Zsv[loc].push_back(z);
238 c->SaveAs(
"display_geo.pdf[");
240 Color_t cols[narrays] = {kBlack, kBlue, kRed,
242 kBlack, kBlue, kRed};
243 Style_t styles[narrays] = {29, 29, 29,
246 for(
int i = 0;
i < narrays;
i++) {
247 cout <<
"Vector " <<
i <<
" (" <<
CycLocs[
i]
248 <<
") contains " << pos[
i].size() <<
" entries" << endl;
252 TEllipse circle(0, 0, detR);
253 for(
int i = 0;
i < narrays;
i+=3) {
254 c->cd(1)->DrawFrame(-detR,-detR,+detR,+detR,
";X (cm);Y (cm)")->GetYaxis()->SetTitleOffset(1);
260 c->cd(2)->DrawFrame(-TMath::Pi(),-detZ,+TMath::Pi(),+detZ,
";Azimuthal angle;Z (cm)")->GetYaxis()->SetTitleOffset(1);
263 c->SaveAs(
"display_geo.pdf");
265 c->SaveAs(
"display_geo.pdf]");
267 TFile fout(
"display_geo.root",
"RECREATE");
268 for(
int i = 0;
i < narrays;
i++)
269 g[
i]->Write(TString::Format(
"graph%d",
i));
274 for(
int i = 0;
i < narrays;
i++) {
277 cout <<
" No PMTs in this cycloc" << endl;
280 cout <<
" MIN R: " << *std::min_element(Rsv[
i].begin(), Rsv[
i].end())
281 <<
"\t MAX R: " << *std::max_element(Rsv[
i].begin(), Rsv[
i].end()) << endl;
282 cout <<
" MIN Z: " << *std::min_element(Zsv[
i].begin(), Zsv[
i].end())
283 <<
"\t MAX Z: " << *std::max_element(Zsv[
i].begin(), Zsv[
i].end()) << endl;
285 cout <<
"Detector half z: " << detZ << endl
286 <<
"Detector radius: " << detR << endl;
300 if (!
file->IsOpen()){
301 cout <<
"Error, could not open input file: " <<
filename << endl;
306 TTree *geotree = (TTree*)
file->Get(
"wcsimGeoT");
308 geotree->SetBranchAddress(
"wcsimrootgeom", &
geo);
309 if(verbose) std::cout <<
"Geotree has: " << geotree->GetEntries() <<
" entries (1 expected)" << std::endl;
310 if (geotree->GetEntries() == 0) {
313 geotree->GetEntry(0);
316 TTree *opttree = (TTree*)
file->Get(
"wcsimRootOptionsT");
318 opttree->SetBranchAddress(
"wcsimrootoptions", &opt);
319 if(verbose) std::cout <<
"Options tree has: " << opttree->GetEntries() <<
" entries (1 expected)" << std::endl;
320 if (opttree->GetEntries() == 0) {
323 opttree->GetEntry(0);
326 float win_scale = 0.75;
329 TCanvas* c1 =
new TCanvas(
"c1",
"First canvas", 1000*n_wide*win_scale, 500*n_high*win_scale);
Int_t GetODWCNumPMT() const
Detector geometry information (also containing PMT information arrays)
TGraph * MakeGraph(vector< pair< double, double > > v, int col, int style, const float size=1.5)
Float_t GetWCCylLength() const
void PrintPMT(const WCSimRootPMT *tube, const int ipmt)
void Print(Option_t *option="") const
Float_t GetWCCylRadius() const
void DumpGeoTree(WCSimRootGeom *geo, TCanvas *c, int verbose)
int display(int verbose, const char *filename)
int plot_pmts(int verbose=0, const char *filename="wcsim.root")
const WCSimRootPMT * GetODPMTPtr(Int_t i) const
PMT geometry information.
Int_t GetWCNumPMT(bool hybridsecondtype=false) const
const WCSimRootPMT * GetPMTPtr(Int_t i, bool hybridsecondtype=false) const
List of WCSim running options.
TClonesArray * GetPMTs(bool hybridsecondtype=false)
TClonesArray * GetODPMTs()
double GetAzimuth(double x, double y)
Int_t GetmPMT_PMTNo() const
Float_t GetPosition(Int_t i=0) const