2 #include "StjJetListWriter.h"
18 _jetTree =
new TTree(jetTreeName, jetTreeName);
19 _jetTree->SetAutoSave(kMaxLong64);
20 _jetTree->SetMaxTreeSize(kMaxLong64);
22 _jetTree->Branch(
"eventId" , &_jet_eventId ,
"eventId/I" );
23 _jetTree->Branch(
"nJets" , &_jet_nJets ,
"nJets/I" );
24 _jetTree->Branch(
"jetId" , _jet_jetId ,
"jetId[nJets]/I" );
25 _jetTree->Branch(
"pt" , _jet_pt ,
"pt[nJets]/D" );
26 _jetTree->Branch(
"eta" , _jet_eta ,
"eta[nJets]/D" );
27 _jetTree->Branch(
"detectorEta", _jet_detectorEta ,
"detectorEta[nJets]/D");
28 _jetTree->Branch(
"phi" , _jet_phi ,
"phi[nJets]/D" );
29 _jetTree->Branch(
"m" , _jet_m ,
"m[nJets]/D" );
30 _jetTree->Branch(
"neuRt" , _jet_neuRt ,
"neuRt[nJets]/D" );
31 _jetTree->Branch(
"vertexZ" , &_jet_vertexZ ,
"vertexZ/D");
32 _jetTree->Branch(
"runNumber" , &_jet_runNumber ,
"runNumber/I" );
34 _jetFourVecTree =
new TTree(jetFourVecTreeName, jetFourVecTreeName);
35 _jetFourVecTree->SetAutoSave(kMaxLong64);
36 _jetFourVecTree->SetMaxTreeSize(kMaxLong64);
38 _jetFourVecTree->Branch(
"eventId" , &_four_eventId ,
"eventId/I" );
39 _jetFourVecTree->Branch(
"nFourVecs" , &_four_nFourVecs ,
"nFourVecs/I" );
40 _jetFourVecTree->Branch(
"jetId" , _four_jetId ,
"jetId[nFourVecs]/I" );
41 _jetFourVecTree->Branch(
"pt" , _four_pt ,
"pt[nFourVecs]/D" );
42 _jetFourVecTree->Branch(
"eta" , _four_eta ,
"eta[nFourVecs]/D" );
43 _jetFourVecTree->Branch(
"phi" , _four_phi ,
"phi[nFourVecs]/D" );
44 _jetFourVecTree->Branch(
"towerId" , _four_towerId ,
"towerId[nFourVecs]/I" );
45 _jetFourVecTree->Branch(
"trackId" , _four_trackId ,
"trackId[nFourVecs]/S" );
46 _jetFourVecTree->Branch(
"mcparticleId", _four_mcparticleId ,
"mcparticleId[nFourVecs]/I");
47 _jetFourVecTree->Branch(
"m" , _four_m ,
"m[nFourVecs]/D" );
48 _jetFourVecTree->Branch(
"type" , _four_type ,
"type[nFourVecs]/I" );
49 _jetFourVecTree->Branch(
"detectorId" , _four_detectorId ,
"detectorId[nFourVecs]/I" );
50 _jetFourVecTree->Branch(
"fourvecId" , _four_fourvecId ,
"fourvecId[nFourVecs]/I" );
51 _jetFourVecTree->Branch(
"runNumber" , &_four_runNumber ,
"runNumber/I" );
52 _jetFourVecTree->Branch(
"vertexZ" , &_four_vertexZ ,
"vertexZ/D" );
55 void StjJetListWriter::Fill(
const StjJetList& jetList)
57 if(jetList.empty())
return;
59 _jet_runNumber = jetList[0].runNumber;
60 _jet_eventId = jetList[0].eventId;
61 _jet_vertexZ = jetList[0].vertexZ;
65 _jet_nJets = jetList.size();
66 for(
int i = 0; i < _jet_nJets; ++i) {
67 const StjJet& jet = jetList[i];
68 _jet_jetId[i] = jet.jetId;
70 _jet_eta[i] = jet.eta;
71 _jet_phi[i] = jet.phi;
73 _jet_neuRt[i] = jet.neuRt;
74 _jet_detectorEta[i] = jet.detectorEta;
75 fillFourVecTree(jet.jetId, jet.fourVecList);
79 _jetFourVecTree->Fill();
82 void StjJetListWriter::fillFourVecTree(
int jetId,
const StjFourVecList& fourVecList)
84 if(fourVecList.empty())
return;
86 _four_runNumber = fourVecList[0].runNumber;
87 _four_eventId = fourVecList[0].eventId;
88 _four_vertexZ = fourVecList[0].vertexZ;
90 for(
size_t i = 0; i < fourVecList.size(); ++i) {
92 _four_fourvecId[_four_nFourVecs] = four.fourvecId;
93 _four_jetId[_four_nFourVecs] = jetId;
94 _four_type[_four_nFourVecs] = four.type;
95 _four_detectorId[_four_nFourVecs] = four.detectorId;
96 _four_trackId[_four_nFourVecs] = four.trackId;
97 _four_towerId[_four_nFourVecs] = four.towerId;
98 _four_mcparticleId[_four_nFourVecs] = four.mcparticleId;
99 _four_pt[_four_nFourVecs] = four.pt;
100 _four_eta[_four_nFourVecs] = four.eta;
101 _four_phi[_four_nFourVecs] = four.phi;
102 _four_m[_four_nFourVecs] = four.m;
107 void StjJetListWriter::Finish()
109 _jetTree->BuildIndex(
"runNumber",
"eventId");
110 _jetFourVecTree->BuildIndex(
"runNumber",
"eventId");