2 #include "StjTrackListWriter.h"
4 #include <TDirectory.h>
17 _tree =
new TTree(treeName, treeName);
18 _tree->SetAutoSave(kMaxLong64);
19 _tree->SetMaxTreeSize(kMaxLong64);
21 _tree->Branch(
"eventId" , &_eventId ,
"eventId/I" );
22 _tree->Branch(
"nTracks" , &_nTracks ,
"nTracks/I" );
23 _tree->Branch(
"pt" , _pt ,
"pt[nTracks]/D" );
24 _tree->Branch(
"eta" , _eta ,
"eta[nTracks]/D" );
25 _tree->Branch(
"phi" , _phi ,
"phi[nTracks]/D" );
26 _tree->Branch(
"exitEta" , _exitEta ,
"exitEta[nTracks]/D" );
27 _tree->Branch(
"exitPhi" , _exitPhi ,
"exitPhi[nTracks]/D" );
28 _tree->Branch(
"trackId" , _trackId ,
"trackId[nTracks]/S" );
29 _tree->Branch(
"flag" , _flag ,
"flag[nTracks]/S" );
30 _tree->Branch(
"nHits" , _nHits ,
"nHits[nTracks]/s" );
31 _tree->Branch(
"charge" , _charge ,
"charge[nTracks]/S" );
32 _tree->Branch(
"nHitsPoss" , _nHitsPoss ,
"nHitsPoss[nTracks]/s" );
33 _tree->Branch(
"nHitsDedx" , _nHitsDedx ,
"nHitsDedx[nTracks]/s" );
34 _tree->Branch(
"nHitsFit" , _nHitsFit ,
"nHitsFit[nTracks]/s" );
35 _tree->Branch(
"nSigmaPion" , _nSigmaPion ,
"nSigmaPion[nTracks]/D" );
36 _tree->Branch(
"Tdca" , _Tdca ,
"Tdca[nTracks]/D" );
37 _tree->Branch(
"dcaZ" , _dcaZ ,
"dcaZ[nTracks]/D" );
38 _tree->Branch(
"dcaD" , _dcaD ,
"dcaD[nTracks]/D" );
39 _tree->Branch(
"BField" , &_BField ,
"BField/D" );
40 _tree->Branch(
"bemcRadius" , &_bemcRadius ,
"bemcRadius/D" );
41 _tree->Branch(
"dEdx" , _dEdx ,
"dEdx[nTracks]/D" );
42 _tree->Branch(
"trackIndex" , _trackIndex ,
"trackIndex[nTracks]/I" );
43 _tree->Branch(
"exitDetectorId", _exitDetectorId ,
"exitDetectorId[nTracks]/I");
44 _tree->Branch(
"exitTowerId" , _exitTowerId ,
"exitTowerId[nTracks]/I" );
45 _tree->Branch(
"vertexZ" , &_vertexZ ,
"vertexZ/D" );
46 _tree->Branch(
"detectorId" , &_detectorId ,
"detectorId/I" );
47 _tree->Branch(
"runNumber" , &_runNumber ,
"runNumber/I" );
50 void StjTrackListWriter::Fill(
const StjTrackList& trackList)
52 if(trackList.empty())
return;
54 _runNumber = trackList[0].runNumber;
55 _eventId = trackList[0].eventId;
56 _detectorId = trackList[0].detectorId;
57 _vertexZ = trackList[0].vertexZ;
59 _BField = trackList[0].BField;
60 _bemcRadius = trackList[0].bemcRadius;
62 _nTracks = trackList.size();
63 for(
int i = 0; i < _nTracks; ++i) {
68 _flag[i] = track.flag;
69 _nHits[i] = track.nHits;
70 _charge[i] = track.charge;
71 _nHitsPoss[i] = track.nHitsPoss;
72 _nHitsDedx[i] = track.nHitsDedx;
73 _nHitsFit[i] = track.nHitsFit;
74 _nSigmaPion[i] = track.nSigmaPion;
75 _Tdca[i] = track.Tdca;
76 _dcaZ[i] = track.dcaZ;
77 _dcaD[i] = track.dcaD;
78 _exitDetectorId[i] = track.exitDetectorId;
79 _exitTowerId[i] = track.exitTowerId;
80 _exitEta[i] = track.exitEta;
81 _exitPhi[i] = track.exitPhi;
82 _dEdx[i] = track.dEdx;
83 _trackIndex[i] = track.trackIndex;
84 _trackId[i] = track.id;
90 void StjTrackListWriter::Finish()
92 _tree->BuildIndex(
"runNumber",
"eventId");