8 #include <ktracker/SRecEvent.h>
22 int ret = GetNodes(topNode);
30 static unsigned int n_evt = 0;
31 if (++n_evt % 100000 == 0) cout << n_evt << endl;
32 else if (n_evt % 10000 == 0) cout <<
" . " << flush;
37 mo_evt.proc_id = mi_evt_true->get_process_id();
38 for (
int ii = 0; ii < 4; ii++) {
39 mo_evt.par_id [ii] = mi_evt_true->get_particle_id (ii);
40 mo_evt.par_mom[ii] = mi_evt_true->get_particle_momentum(ii);
42 mo_evt.trig_bits = mi_evt->get_trigger();
43 mo_evt.rec_stat = mi_srec->getRecStatus();
44 mo_evt.n_dim_true = mi_vec_dim->size();
45 mo_evt.n_dim_reco = mi_srec->getNDimuons();
76 FindDimuonRelation(id_dim_t2r);
79 for (
unsigned int ii = 0; ii < mi_vec_dim->size(); ii++) {
88 mo_dim_true.push_back(dd);
91 if (id_dim_t2r[ii] >= 0) {
92 SRecDimuon dim_reco = mi_srec->getDimuon(id_dim_t2r[ii]);
100 mo_dim_reco.push_back(ddr);
117 mi_evt = findNode::getClass<SQEvent >(topNode,
"SQEvent");
118 mi_evt_true = findNode::getClass<SQMCEvent >(topNode,
"SQMCEvent");
119 mi_vec_trk = findNode::getClass<SQTrackVector >(topNode,
"SQTruthTrackVector");
120 mi_vec_dim = findNode::getClass<SQDimuonVector>(topNode,
"SQTruthDimuonVector");
123 mi_srec = findNode::getClass<SRecEvent>(topNode,
"SRecEvent");
129 void AnaSimDst::MakeTree()
131 file =
new TFile(
"sim_tree.root",
"RECREATE");
132 tree =
new TTree(
"tree",
"Created by AnaSimDst");
135 tree->Branch(
"evt" , &mo_evt);
138 tree->Branch(
"dim_true", &mo_dim_true);
139 tree->Branch(
"dim_reco", &mo_dim_reco);
142 void AnaSimDst::FindTrackRelation(IdMap_t& id_map)
145 for (
unsigned int i_true = 0; i_true < mi_vec_trk->size(); i_true++) {
146 SQTrack* trk_true = mi_vec_trk->at(i_true);
150 int i_reco_best = -1;
151 double mom_diff_best;
152 for (
int i_reco = 0; i_reco < mi_srec->getNTracks(); i_reco++) {
153 SRecTrack* trk_reco = &mi_srec->getTrack(i_reco);
154 if (trk_reco->
getCharge() != ch_true)
continue;
156 if (i_reco_best < 0 || mom_diff < mom_diff_best) {
157 i_reco_best = i_reco;
158 mom_diff_best = mom_diff;
161 id_map[i_true] = i_reco_best;
165 void AnaSimDst::FindDimuonRelation(IdMap_t& id_map)
168 for (
unsigned int i_true = 0; i_true < mi_vec_dim->size(); i_true++) {
169 SQDimuon* dim_true = mi_vec_dim->at(i_true);
170 double mass_true = dim_true->
get_mom().M();
172 int i_reco_best = -1;
173 double mass_diff_best;
174 for (
int i_reco = 0; i_reco < mi_srec->getNDimuons(); i_reco++) {
175 SRecDimuon dim_reco = mi_srec->getDimuon(i_reco);
176 double mass_diff = fabs(dim_reco.
mass - mass_true);
177 if (i_reco_best < 0 || mass_diff < mass_diff_best) {
178 i_reco_best = i_reco;
179 mass_diff_best = mass_diff;
182 id_map[i_true] = i_reco_best;
virtual int get_pdg_id() const =0
Return the GPD ID of parent particle. It is valid only for true dimuon.
int InitRun(PHCompositeNode *topNode)
virtual TLorentzVector get_mom_vtx() const =0
Return the track momentum at vertex.
int process_event(PHCompositeNode *topNode)
int Init(PHCompositeNode *topNode)
void CalcVar(const SQDimuon *dim, double &mass, double &pT, double &x1, double &x2, double &xF, double &costh, double &phi)
Calculate the key kinematic variables of dimuon.
virtual TLorentzVector get_mom() const =0
Return the dimuon momentum at vertex.
virtual TLorentzVector get_mom_neg() const =0
Return the momentum of the negative track at vertex.
virtual TVector3 get_pos() const =0
Return the dimuon position at vertex.
virtual int get_charge() const =0
Return the charge, i.e. +1 or -1.
int End(PHCompositeNode *topNode)
Called at the end of all processing.
An SQ interface class to hold one true or reconstructed track.
virtual TLorentzVector get_mom_pos() const =0
Return the momentum of the positive track at vertex.
TLorentzVector getMomentumVertex()
Get the vertex info.
Int_t getCharge() const
Gets.
An SQ interface class to hold one true or reconstructed dimuon.