9 void ReadStJets(
int nevents = 10,
const char* jetfile =
"Jets_pt15_25_01.root",
const char* skimfile =
"Skim_pt15_25_01.root")
12 gSystem->Load(
"StJets");
13 gSystem->Load(
"StJetSkimEvent");
16 TChain* jetchain =
new TChain(
"jet");
17 TChain* skimchain =
new TChain(
"jetSkimTree");
20 jetchain->Add(jetfile);
21 skimchain->Add(skimfile);
25 skimchain->SetBranchAddress(
"skimEventBranch",&skimevent);
28 for (
int iEvent = 0; iEvent < nevents; ++iEvent) {
30 if (jetchain->GetEvent(iEvent) <= 0 || skimchain->GetEvent(iEvent) <= 0)
break;
33 for (
int iBranch = 0; iBranch < jetchain->GetNbranches(); ++iBranch) {
34 TBranch* branch = (TBranch*)jetchain->GetListOfBranches()->At(iBranch);
35 cout <<
"Branch #" << iBranch <<
": " << branch->GetName() << endl;
41 assert(stjets->runId() == skimevent->runId() && stjets->
eventId() == skimevent->eventId());
44 cout <<
"iEvent = " << iEvent << endl;
45 cout <<
"runId = " << stjets->runId() << endl;
46 cout <<
"eventId = " << stjets->
eventId() << endl;
48 TVector3
vertex(skimevent->bestVert()->position());
49 cout <<
"vx = " <<
vertex.x() <<
", vy = " <<
vertex.y() <<
", vz = " <<
vertex.z() << endl;
52 cout <<
"nJets = " << stjets->
nJets() << endl;
53 for (
int iJet = 0; iJet < stjets->
nJets(); ++iJet) {
55 cout <<
"Jet #" << iJet <<
": jetPt = " << jet->
jetPt <<
", jetEta = " << jet->
jetEta <<
", jetPhi = " << jet->
jetPhi
60 TObjArray tracks = stjets->
tracks(iJet);
61 if (strcmp(branch->GetName(),
"PythiaConeJets") == 0) {
62 for (
int iTrack = 0; iTrack < tracks.GetEntriesFast(); ++iTrack) {
64 cout <<
"Particle #" << iTrack <<
": id = " << track->id() <<
", pdg = " << track->pdg()
65 <<
", status = " << track->status()
66 <<
", pt = " << track->Pt() <<
", eta = " << track->Eta() <<
", phi = " << track->Phi()
67 <<
", e = " << track->E() <<
", m = " << track->M()
72 for (
int iTrack = 0; iTrack < tracks.GetEntriesFast(); ++iTrack) {
74 cout <<
"Track #" << iTrack <<
": id = " << track->trackId() <<
", detId = " << track->detectorId()
75 <<
", pt = " << track->Pt() <<
", eta = " << track->Eta() <<
", phi = " << track->Phi()
81 TObjArray towers = stjets->towers(iJet);
82 for (
int iTower = 0; iTower < towers.GetEntriesFast(); ++iTower) {
84 cout <<
"Tower #" << iTower <<
": id = " << tower->towerId() <<
", detId = " << tower->detectorId()
85 <<
", pt = " << tower->Pt() <<
", eta = " << tower->Eta() <<
", phi = " << tower->Phi()
int nTracks
The number of tracks in this jet.
TClonesArray * jets()
Access to the jets in this event.
float jetPt
Pt (stored for convenience when drawing TTree)
int nJets() const
The number of jets found in this event.
int nBtowers
The number of Barrel towers in this jet.
int eventId() const
access to event numbers, used to synchronize with StMuDstMaker for simultaneous reading ...
float jetEta
Eta (stored for convenience when drawing TTree)
TClonesArray * tracks()
The track/tower to jet indices TClonesArray: this contains all the 4momenta contained in jets for jet...
float jetPhi
Phi (stored for convenience when drawing TTree)
int nEtowers
The number of Endcap towers in this jet.