StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StjDijetListWriter.cxx
1 // $Id: StjDijetListWriter.cxx,v 1.4 2009/03/27 19:14:34 tai Exp $
2 #include "StjDijetListWriter.h"
3 
4 #include <TFile.h>
5 #include <TTree.h>
6 
7 #include <iostream>
8 
9 ClassImp(StjDijetListWriter)
10 
11 using namespace std;
12 
13 StjDijetListWriter::StjDijetListWriter(const char* treeName, TDirectory* file)
14  : _file(file)
15 {
16  _file->cd();
17 
18  _tree = new TTree(treeName, treeName);
19  _tree->SetAutoSave(kMaxLong64);
20  _tree->SetMaxTreeSize(kMaxLong64);
21 
22  _tree->Branch("eventId" , &_eventId , "eventId/I" );
23  _tree->Branch("dijetId" , &_dijetId , "dijetId/I" );
24  _tree->Branch("m" , &_m , "m/D" );
25  _tree->Branch("eta" , &_eta , "eta/D" );
26  _tree->Branch("costh" , &_costh , "costh/D" );
27  _tree->Branch("deta" , &_deta , "deta/D" );
28  _tree->Branch("dphi" , &_dphi , "dphi/D" );
29 
30  _tree->Branch("eth" , & _eth , "eth/D" );
31  _tree->Branch("etl" , & _etl , "etl/D" );
32 
33  _tree->Branch("vertexZ" , &_vertexZ , "vertexZ/D" );
34 
35  _tree->Branch("_pt3" , &_pt3 ,"pt3/D" );
36  _tree->Branch("_pt4" , &_pt4 ,"pt4/D" );
37  _tree->Branch("_eta3" , &_eta3 ,"eta3/D" );
38  _tree->Branch("_eta4" , &_eta4 ,"eta4/D" );
39  _tree->Branch("_phi3" , &_phi3 ,"phi3/D" );
40  _tree->Branch("_phi4" , &_phi4 ,"phi4/D" );
41  _tree->Branch("_m3" , &_m3 ,"m3/D" );
42  _tree->Branch("_m4" , &_m4 ,"m4/D" );
43 
44  _tree->Branch("jet3Id" , &_jet3Id , "jet3Id/I" );
45  _tree->Branch("jet4Id" , &_jet4Id , "jet4Id/I" );
46  _tree->Branch("jetSameSideId", &_jetSameSideId, "jetSameSideId/I" );
47  _tree->Branch("jetAwaySideId", &_jetAwaySideId, "jetAwaySideId/I" );
48  _tree->Branch("neuRtSame" , &_neuRtSame , "neuRtSame/D" );
49  _tree->Branch("neuRtAway" , &_neuRtAway , "neuRtAway/D" );
50  _tree->Branch("neuRt3" , &_neuRt3 , "neuRt3/D" );
51  _tree->Branch("neuRt4" , &_neuRt4 , "neuRt4/D" );
52  _tree->Branch("runNumber" , &_runNumber , "runNumber/I" );
53 }
54 
55 void StjDijetListWriter::Fill(const StjDijetList& dijetList)
56 {
57  if(dijetList.empty()) return;
58 
59  _runNumber = dijetList[0].runNumber;
60  _eventId = dijetList[0].eventId;
61  _dijetId = dijetList[0].dijetId;
62  _m = dijetList[0].m;
63  _eta = dijetList[0].eta;
64  _costh = dijetList[0].costh;
65  _deta = dijetList[0].deta;
66  _dphi = dijetList[0].dphi;
67  _eth = dijetList[0].eth;
68  _etl = dijetList[0].etl;
69  _vertexZ = dijetList[0].vertexZ;
70  _pt3 = dijetList[0].pt3;
71  _pt4 = dijetList[0].pt4;
72  _eta3 = dijetList[0].eta3;
73  _eta4 = dijetList[0].eta4;
74  _phi3 = dijetList[0].phi3;
75  _phi4 = dijetList[0].phi4;
76  _m3 = dijetList[0].m3;
77  _m4 = dijetList[0].m4;
78  _jet3Id = dijetList[0].jet3.jetId;
79  _jet4Id = dijetList[0].jet4.jetId;
80  _jetSameSideId = dijetList[0].jetSameSide.jetId;
81  _jetAwaySideId = dijetList[0].jetAwaySide.jetId;
82  _neuRtSame = dijetList[0].neuRtSameSide;
83  _neuRtAway = dijetList[0].neuRtAwaySide;
84  _neuRt3 = dijetList[0].neuRt3;
85  _neuRt4 = dijetList[0].neuRt4;
86 
87  _tree->Fill();
88 }
89 
90 void StjDijetListWriter::Finish()
91 {
92  _tree->BuildIndex("runNumber", "eventId");
93 }