/[PAMELA software]/PamCut/CollectionActions/CoordHistoAction/CoordHistoAction.cpp
ViewVC logotype

Contents of /PamCut/CollectionActions/CoordHistoAction/CoordHistoAction.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Wed Aug 5 13:57:19 2009 UTC (15 years, 5 months ago) by pam-fi
Branch: MAIN
Added some new actions.

1 /*
2 * CoordHistoAction.cpp
3 *
4 * Created on: 11-giu-2009
5 * Author: mori
6 */
7
8 /*! @file CoordHistoAction.cpp The CoordHistoAction class implementation file. */
9
10 #include "CoordHistoAction.h"
11
12 CoordHistoAction::CoordHistoAction(const char *actionName, TString outFileName, TString mode) :
13 CollectionAction(actionName), _outFileName(outFileName), _histoLatLong(), _histoRateS11(), _histoRateS12(),
14 _histoAlt(), _histoEta(), _histoTheta(), _histoPhi(), _histoPitch(), _mode(mode), _rateRate() {
15
16 _histoLatLong.SetName(TString(GetName()) + "_LatLong");
17 _histoLatLong.SetTitle("Latitude Vs Longitude");
18 _histoLatLong.GetXaxis()->SetTitle("Longitude");
19 _histoLatLong.GetYaxis()->SetTitle("Latitude");
20 _histoLatLong.SetBins(720, -185., 185., 360, -95., 95.);
21
22 _histoRateS11.SetName(TString(GetName()) + "_RateS11LatLong");
23 _histoRateS11.SetTitle("S11 event rate");
24 _histoRateS11.GetXaxis()->SetTitle("Longitude");
25 _histoRateS11.GetYaxis()->SetTitle("Latitude");
26 _histoRateS11.SetBins(720, -185., 185., 360, -95., 95.);
27
28 _histoRateS12.SetName(TString(GetName()) + "_RateS12LatLong");
29 _histoRateS12.SetTitle("S12 event rate");
30 _histoRateS12.GetXaxis()->SetTitle("Longitude");
31 _histoRateS12.GetYaxis()->SetTitle("Latitude");
32 _histoRateS12.SetBins(720, -185., 185., 360, -95., 95.);
33
34 _histoAlt.SetName(TString(GetName()) + "_Alt");
35 _histoAlt.SetTitle("Altitude");
36 _histoAlt.GetXaxis()->SetTitle("Altitude (m)");
37 _histoAlt.GetYaxis()->SetTitle("Events");
38 _histoAlt.SetBins(100, 300., 650.);
39
40 _histoEta.SetName(TString(GetName()) + "_Eta");
41 _histoEta.SetTitle("Eta");
42 _histoEta.GetXaxis()->SetTitle("Eta");
43 _histoEta.GetYaxis()->SetTitle("Events");
44 _histoEta.SetBins(100, -30., 30.);
45
46 _histoTheta.SetName(TString(GetName()) + "_Theta");
47 _histoTheta.SetTitle("Theta");
48 _histoTheta.GetXaxis()->SetTitle("Theta");
49 _histoTheta.GetYaxis()->SetTitle("Events");
50 _histoTheta.SetBins(100, -1., 1.);
51
52 _histoPhi.SetName(TString(GetName()) + "_Phi");
53 _histoPhi.SetTitle("Phi");
54 _histoPhi.GetXaxis()->SetTitle("Phi");
55 _histoPhi.GetYaxis()->SetTitle("Events");
56 _histoPhi.SetBins(100, -4., 4.);
57
58 _histoPitch.SetName(TString(GetName()) + "_Pitch");
59 _histoPitch.SetTitle("Pitch");
60 _histoPitch.GetXaxis()->SetTitle("Pitch");
61 _histoPitch.GetYaxis()->SetTitle("Events");
62 _histoPitch.SetBins(100, -90., 90.);
63
64 _rateRate.SetName(TString(GetName()) + "_rateRate");
65 _rateRate.SetTitle("Rate on S11 / Rate on S12");
66 _rateRate.GetXaxis()->SetTitle("Rate of rates");
67 _rateRate.GetYaxis()->SetTitle("Events");
68 _rateRate.SetBins(100, 0., 10.);
69
70 }
71
72 void CoordHistoAction::OnGood(PamLevel2 *event) {
73
74 _histoLatLong.Fill(event->GetOrbitalInfo()->lon, event->GetOrbitalInfo()->lat);
75 int totRateS11 = 0;
76 for (int i = 0; i < 16; i++)
77 totRateS11 += event->GetTrigLevel2()->pmtcount1[i];
78 _histoRateS11.Fill(event->GetOrbitalInfo()->lon, event->GetOrbitalInfo()->lat, (float) totRateS11 / 16.);
79 int totRateS12 = 0;
80 for (int i = 16; i < 24; i++) // First 8 PMTs of S12
81 totRateS12 += event->GetTrigLevel2()->pmtcount1[i];
82 for (int i = 0; i < 4; i++) // Last 4 PMTs of S12
83 totRateS12 += event->GetTrigLevel2()->pmtcount2[i];
84 _histoRateS12.Fill(event->GetOrbitalInfo()->lon, event->GetOrbitalInfo()->lat, (float) totRateS12 / 12.);
85 _rateRate.Fill(((float) totRateS11 / 16.) / (totRateS12 / 12.));
86
87 _histoAlt.Fill(event->GetOrbitalInfo()->alt);
88 if (event->GetOrbitalInfo()->etha != -1000.)
89 _histoEta.Fill(event->GetOrbitalInfo()->etha);
90 if (event->GetOrbitalInfo()->theta != -1000.)
91 _histoTheta.Fill(event->GetOrbitalInfo()->theta);
92 if (event->GetOrbitalInfo()->phi != -1000.)
93 _histoPhi.Fill(event->GetOrbitalInfo()->phi);
94
95 int seqno = event->GetTrack(0)->GetTrkTrack()->GetSeqNo();
96 int i = 0;
97 while (seqno != event->GetOrbitalInfo()->GetOrbitalInfoTrkVar(i)->trkseqno)
98 i++;
99 _histoPitch.Fill(event->GetOrbitalInfo()->GetOrbitalInfoTrkVar(i)->pitch);
100
101 }
102
103 void CoordHistoAction::Finalize() {
104
105 TFile outFile(_outFileName, _mode);
106 outFile.cd();
107 _histoLatLong.Write();
108 _histoRateS11.Write();
109 _histoRateS12.Write();
110 _histoAlt.Write();
111 _histoEta.Write();
112 _histoTheta.Write();
113 _histoPhi.Write();
114 _histoPitch.Write();
115 _rateRate.Write();
116 outFile.Close();
117 }

  ViewVC Help
Powered by ViewVC 1.1.23