1 | #include "EsafMsgDispatcher.hh" |
---|
2 | #include "EusoDetector.hh" |
---|
3 | #include "TestLightToEuso.hh" |
---|
4 | #include "DetectorTransportManager.hh" |
---|
5 | #include "FocalPlane.hh" |
---|
6 | #include "Photon.hh" |
---|
7 | #include "PhotonsOnPupil.hh" |
---|
8 | #include "Etypes.hh" |
---|
9 | #include <TAxis3D.h> |
---|
10 | #include <TGraph.h> |
---|
11 | #include <TPolyMarker3D.h> |
---|
12 | #include <TCanvas.h> |
---|
13 | #include <TView.h> |
---|
14 | |
---|
15 | EusoDetector* e = 0; |
---|
16 | |
---|
17 | //______________________________________________________________________________ |
---|
18 | // |
---|
19 | // CheckPmtShift() |
---|
20 | // |
---|
21 | // Macro to check the dispacemente between the photomultipliers (pmts) and the |
---|
22 | // ideal focal surface (ifs) using the photon tracking engine. A streak of |
---|
23 | // light (0-30 deg) is transmitted through the optics and recorded on the focal |
---|
24 | // plane. FakeOpticalAdaptor's are fixed to have the pmts' photocathod exactly |
---|
25 | // on the ifs. |
---|
26 | // |
---|
27 | // The photon's final position on the pmts and on the ifs are plotted in the |
---|
28 | // focal plane's reference system in 2D and 3D. |
---|
29 | // |
---|
30 | |
---|
31 | //______________________________________________________________________________ |
---|
32 | void CheckPmtShift() { |
---|
33 | |
---|
34 | Config* cfg = Config::Get(); |
---|
35 | cfg->Reset(); |
---|
36 | EsafMsgDispatcher::Get()->SetScreenSeverity(EsafMsg::Debug ); |
---|
37 | |
---|
38 | // |
---|
39 | cfg->AddUserDefinition("TestLightToEuso","TestLightToEuso.Type=EXTRADIUS"); |
---|
40 | cfg->AddUserDefinition("TestLightToEuso", "TestLightToEuso.Duration=5"); |
---|
41 | cfg->AddUserDefinition("TestLightToEuso", "TestLightToEuso.Photons=50000"); |
---|
42 | cfg->AddUserDefinition("TestLightToEuso", "TestLightToEuso.Theta1=0"); |
---|
43 | cfg->AddUserDefinition("TestLightToEuso", "TestLightToEuso.Theta2=30"); |
---|
44 | cfg->AddUserDefinition("TestLightToEuso", "TestLightToEuso.Phi1=0"); |
---|
45 | cfg->AddUserDefinition("OpticsFactory", "OpticsFactory.fOpticalAdaptor=FakeOpticalAdaptor"); |
---|
46 | // cfg->AddUserDefinition("TestLightToEuso.Phi2=1250"); |
---|
47 | |
---|
48 | LightToEuso* lte = new TestLightToEuso; |
---|
49 | if ( !e ) e = new EusoDetector(); |
---|
50 | |
---|
51 | DetectorTransportManager *dm = e->GetDetectorTransportManager(); |
---|
52 | FocalPlane *fs = dm->GetFocalPlane(); |
---|
53 | |
---|
54 | PhotonsOnPupil* pop = lte->Get(e->GetGeometry()); |
---|
55 | e->Get(pop); |
---|
56 | cout << " Tracking Complete" << endl; |
---|
57 | |
---|
58 | pop->Rewind(); |
---|
59 | Int_t n(0); |
---|
60 | Photon* p = 0; |
---|
61 | |
---|
62 | TGraph* gFS = new TGraph(); |
---|
63 | TGraph* gIFS = new TGraph(); |
---|
64 | |
---|
65 | gIFS->SetMarkerColor(kRed); |
---|
66 | |
---|
67 | TPolyMarker3D* mFS = new TPolyMarker3D(); |
---|
68 | TPolyMarker3D* mIFS = new TPolyMarker3D(); |
---|
69 | |
---|
70 | mIFS->SetMarkerColor(kRed); |
---|
71 | |
---|
72 | TVector3 pos; |
---|
73 | |
---|
74 | |
---|
75 | while ((p = pop->GetPhoton())) |
---|
76 | if ( p->hitIfs && p->history == kFocalPlane ) { |
---|
77 | |
---|
78 | pos = p->pos-fs->Position(); |
---|
79 | gFS->SetPoint(n, pos.X(),pos.Z()); |
---|
80 | mFS->SetPoint(n, pos.X(),pos.Y(),pos.Z()); |
---|
81 | |
---|
82 | pos = p->posOnIfs-fs->Position(); |
---|
83 | gIFS->SetPoint(n, pos.X(),pos.Z()); |
---|
84 | mIFS->SetPoint(n, pos.X(),pos.Y(),pos.Z()); |
---|
85 | n++; |
---|
86 | } |
---|
87 | |
---|
88 | cout << n << endl; |
---|
89 | |
---|
90 | if ( n ) { |
---|
91 | TCanvas *c = new TCanvas("c_pmtshift","Pmt Shift"); |
---|
92 | c->Divide(2,1); |
---|
93 | c->cd(1); |
---|
94 | gIFS->Draw("AP"); |
---|
95 | gFS->Draw("P"); |
---|
96 | TH1* h = gIFS->GetHistogram(); |
---|
97 | h->SetXTitle("X [mm]"); |
---|
98 | h->SetYTitle("Z [mm]"); |
---|
99 | |
---|
100 | c->cd(2); |
---|
101 | |
---|
102 | mIFS->Draw(); |
---|
103 | mFS->Draw("same"); |
---|
104 | |
---|
105 | c->Modified(); |
---|
106 | c->Update(); |
---|
107 | |
---|
108 | TView* v = gPad->GetView(); |
---|
109 | v->SetPerspective(); |
---|
110 | TAxis3D::ToggleRulers(); |
---|
111 | } |
---|
112 | |
---|
113 | |
---|
114 | |
---|
115 | |
---|
116 | delete lte; |
---|
117 | } |
---|