Class Reference for E1039 Core & Analysis Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
OnlMonReco.cc
Go to the documentation of this file.
1 #include <iomanip>
3 #include <TH1D.h>
4 #include <interface_main/SQRun.h>
7 #include <ktracker/SRecEvent.h>
9 #include <phool/PHNodeIterator.h>
10 #include <phool/PHIODataNode.h>
11 #include <phool/getClass.h>
12 //#include <geom_svc/CalibParamInTimeTaiwan.h>
13 #include <UtilAna/UtilHist.h>
14 #include "OnlMonServer.h"
15 #include "OnlMonReco.h"
16 
17 #define MUON_MASS 0.105658
18 
19 using namespace std;
20 
22 {
23  NumCanvases(2);
24  Title("Reco Mon");
25 }
26 
28 {
30 }
31 
33 {
34  h1_rec_stats = new TH1D("h1_rec_stats", ";Rec. Stats; ", 7, -6.5, 0.5);
35  RegisterHist(h1_rec_stats);
36 
37  h1_sgmu_pt = new TH1D("h1_sgmu_pt", ";pt; ", 10, 0, 5);
38  RegisterHist(h1_sgmu_pt);
39 
40  h1_dimu_mass = new TH1D("h1_dimu_mass", ";mass; ", 20, 0, 10);
41  RegisterHist(h1_dimu_mass);
42 
44 }
45 
47 {
48  std::cout << "OnlMonReco::ProcessEventOnlMon: " << std::endl;
49  SRecEvent* rec_event = findNode::getClass<SRecEvent>(topNode, "SRecEvent");
50 
51  if (!rec_event) return Fun4AllReturnCodes::ABORTEVENT;
52  std::cout << "getEventID: " << rec_event->getEventID() << std::endl;
53 
54  h1_rec_stats->Fill(rec_event->getRecStatus());
55 
56  for (int itrack0=0; itrack0<rec_event->getNTracks(); ++itrack0) {
57  SRecTrack track0 = rec_event->getTrack(itrack0);
58  TVector3 mom0 = track0.getMomentumVecSt1();
59  int charge0 = track0.getCharge();
60  h1_sgmu_pt->Fill(mom0.Pt());
61  for (int itrack1=itrack0+1; itrack1<rec_event->getNTracks(); ++itrack1) {
62  SRecTrack track1 = rec_event->getTrack(itrack1);
63  int charge1 = track1.getCharge();
64  if(charge0*charge1>0) continue;
65  TVector3 mom1 = track1.getMomentumVecSt1();
66  TLorentzVector mom40;
67  TLorentzVector mom41;
68  mom40.SetXYZM(mom0.Px(),mom0.Py(),mom0.Pz(),MUON_MASS);
69  mom41.SetXYZM(mom1.Px(),mom1.Py(),mom1.Pz(),MUON_MASS);
70  TLorentzVector gamma = mom40 + mom41;
71  h1_dimu_mass->Fill(gamma.M());
72 
73  }
74  }
75 
77 }
78 
80 {
82 }
83 
85 {
86  h1_rec_stats = FindMonHist("h1_rec_stats");
87  if (!h1_rec_stats) return 1;
88 
89  h1_sgmu_pt = FindMonHist("h1_sgmu_pt");
90  if (!h1_sgmu_pt) return 1;
91 
92  h1_dimu_mass = FindMonHist("h1_dimu_mass");
93  if (!h1_dimu_mass) return 1;
94 
95  return 0;
96 }
97 
99 {
100  OnlMonCanvas* can0 = GetCanvas(0);
101  TPad* pad0 = can0->GetMainPad();
102  pad0->SetGrid();
103  pad0->Divide(1, 1);
104  pad0->cd(1);
105  h1_rec_stats->Draw();
106  can0->AddMessage("OK");
108 
109  OnlMonCanvas* can1 = GetCanvas(1);
110  TPad* pad1 = can1->GetMainPad();
111  pad1->SetGrid();
112  pad1->Divide(1, 2);
113  pad1->cd(1);
114  h1_sgmu_pt->Draw();
115  pad1->cd(2);
116  h1_dimu_mass->Draw();
117  can1->AddMessage("OK");
119 
120  return 0;
121 }
Int_t getNTracks()
Get tracks.
Definition: SRecEvent.h:447
int InitRunOnlMon(PHCompositeNode *topNode)
Definition: OnlMonReco.cc:32
void SetStatus(const MonStatus_t stat)
Definition: OnlMonCanvas.h:42
int DrawMonitor()
Definition: OnlMonReco.cc:98
int EndOnlMon(PHCompositeNode *topNode)
Definition: OnlMonReco.cc:79
int InitOnlMon(PHCompositeNode *topNode)
Definition: OnlMonReco.cc:27
TVector3 getMomentumVecSt1() const
Definition: SRecEvent.h:128
SRecTrack & getTrack(Int_t i)
Definition: SRecEvent.h:448
TPad * GetMainPad()
Definition: OnlMonCanvas.cc:74
#define MUON_MASS
OnlMonReco.C.
Definition: OnlMonReco.cc:17
void AddMessage(const char *msg)
Definition: OnlMonCanvas.cc:50
Int_t getCharge() const
Gets.
Definition: SRecEvent.h:100
int FindAllMonHist()
Definition: OnlMonReco.cc:84
int ProcessEventOnlMon(PHCompositeNode *topNode)
Definition: OnlMonReco.cc:46
Int_t getEventID()
Definition: SRecEvent.h:434
Int_t getRecStatus()
Definition: SRecEvent.h:437