File indexing completed on 2025-08-05 08:14:30
0001
0002
0003
0004
0005
0006 #include "Photons.h"
0007
0008 #include <fun4all/Fun4AllServer.h>
0009 #include <g4main/PHG4Hit.h>
0010 #include <g4main/PHG4Particle.h>
0011 #include <g4main/PHG4TruthInfoContainer.h>
0012 #include <phool/PHCompositeNode.h>
0013 #include <phool/getClass.h>
0014
0015 #include <TLorentzVector.h>
0016 #include <g4jets/Jet.h>
0017 #include <g4jets/JetMap.h>
0018 #include <iostream>
0019
0020 #include <calobase/RawCluster.h>
0021 #include <calobase/RawClusterContainer.h>
0022 #include <calobase/RawClusterUtility.h>
0023 #include <calobase/RawTower.h>
0024 #include <calobase/RawTowerContainer.h>
0025 #include <calobase/RawTowerGeom.h>
0026 #include <calobase/RawTowerGeomContainer.h>
0027 #include <g4detectors/PHG4ScintillatorSlatContainer.h>
0028 #include <g4eval/JetEvalStack.h>
0029
0030 #include <g4vertex/GlobalVertex.h>
0031 #include <g4vertex/GlobalVertexMap.h>
0032
0033 #include <g4eval/SvtxEvalStack.h>
0034 #include <sstream>
0035
0036 #include <HepMC/GenEvent.h>
0037 #include <HepMC/GenVertex.h>
0038 #include <phhepmc/PHHepMCGenEvent.h>
0039 using namespace std;
0040
0041 #include <cassert>
0042 #include <iostream>
0043
0044 Photons::Photons(const std::string &name)
0045 : SubsysReco("PHOTONS")
0046 {
0047 outfilename = name;
0048
0049 initialize_to_zero();
0050
0051
0052
0053
0054
0055 _etalow = -1;
0056 _etahi = 1;
0057
0058 nevents = 0;
0059
0060
0061 _embed = 0;
0062 }
0063
0064 int Photons::Init(PHCompositeNode *topnode)
0065 {
0066 file = new TFile(outfilename.c_str(), "RECREATE");
0067
0068 histo = new TH1F("histo", "histo", 100, -3, 3);
0069
0070 tree = new TTree("tree", "a tree");
0071 tree->Branch("nevents", &nevents, "nevents/I");
0072
0073
0074 Set_Tree_Branches();
0075
0076 return 0;
0077 }
0078
0079 int Photons::process_event(PHCompositeNode *topnode)
0080 {
0081 if (nevents % 10 == 0)
0082 cout << "at event number " << nevents << endl;
0083
0084
0085
0086
0087 PHG4TruthInfoContainer *truthinfo = findNode::getClass<PHG4TruthInfoContainer>(topnode, "G4TruthInfo");
0088
0089 RawClusterContainer *clusters = findNode::getClass<RawClusterContainer>(topnode, "CLUSTER_CEMC");
0090
0091
0092 RawClusterContainer *recal_clusters = findNode::getClass<RawClusterContainer>(topnode, "CLUSTER_POS_COR_CEMC");
0093
0094 RawClusterContainer *fclusters = 0;
0095 if (_etalow > 1)
0096 {
0097 fclusters = findNode::getClass<RawClusterContainer>(topnode, "CLUSTER_FEMC");
0098 }
0099
0100 RawClusterContainer *hcalin_clusters = findNode::getClass<RawClusterContainer>(topnode, "CLUSTER_HCALIN");
0101
0102 RawTowerContainer *_towers = findNode::getClass<RawTowerContainer>(topnode, "TOWER_CALIB_CEMC");
0103
0104 GlobalVertexMap *vertexmap = findNode::getClass<GlobalVertexMap>(topnode, "GlobalVertexMap");
0105 if (!vertexmap)
0106 {
0107 cout << "Photons::process_event - Fatal Error - GlobalVertexMap node is missing. Please turn on the do_global flag in the main macro in order to reconstruct the global vertex." << endl;
0108 assert(vertexmap);
0109
0110 return 0;
0111 }
0112
0113 if (vertexmap->empty())
0114 {
0115 cout << "Photons::process_event - Fatal Error - GlobalVertexMap node is empty. Please turn on the do_global flag in the main macro in order to reconstruct the global vertex." << endl;
0116 return 0;
0117 }
0118
0119 GlobalVertex *vtx = vertexmap->begin()->second;
0120 if (vtx == nullptr) return 0;
0121
0122 if (!recal_clusters)
0123 {
0124 cout << "no recalibrated cemc clusters, bailing" << endl;
0125 return 0;
0126 }
0127
0128 if (!_towers)
0129 {
0130 cout << "NO CALIBRATED CEMC TOWERS, BAILING" << endl;
0131 return 0;
0132 }
0133 if (!fclusters && _etalow > 1)
0134 {
0135 cout << "not forward cluster info" << endl;
0136 return 0;
0137 }
0138 if (!truthinfo)
0139 {
0140 cout << "no truth track info" << endl;
0141 return 0;
0142 }
0143 if (!clusters)
0144 {
0145 cout << "no cluster info" << endl;
0146 return 0;
0147 }
0148
0149 if (!hcalin_clusters)
0150 {
0151 cout << "no hcal in cluster info" << endl;
0152 return 0;
0153 }
0154
0155 if (Verbosity() > 1)
0156 {
0157 cout << "Getting truth particles" << endl;
0158 }
0159
0160 PHG4TruthInfoContainer::Range range = truthinfo->GetPrimaryParticleRange();
0161
0162 for (PHG4TruthInfoContainer::ConstIterator iter = range.first; iter != range.second; ++iter)
0163 {
0164 PHG4Particle *truth = iter->second;
0165
0166 const int this_embed_id = truthinfo->isEmbeded(truth->get_track_id());
0167
0168
0169
0170
0171 if (this_embed_id != 1 && _embed)
0172 continue;
0173 truthpid = truth->get_pid();
0174 truthpx = truth->get_px();
0175 truthpy = truth->get_py();
0176 truthpz = truth->get_pz();
0177 truthp = sqrt(truthpx * truthpx + truthpy * truthpy + truthpz * truthpz);
0178 truthenergy = truth->get_e();
0179
0180 TLorentzVector vec;
0181 vec.SetPxPyPzE(truthpx, truthpy, truthpz, truthenergy);
0182
0183 truthpt = sqrt(truthpx * truthpx + truthpy * truthpy);
0184
0185 truthphi = vec.Phi();
0186 trutheta = vec.Eta();
0187
0188 truth_g4particles->Fill();
0189 }
0190
0191
0192
0193
0194
0195
0196
0197
0198
0199 RawClusterContainer::ConstRange begin_end_hcal = hcalin_clusters->getClusters();
0200 RawClusterContainer::ConstIterator hcaliter;
0201
0202 if (Verbosity() > 1)
0203 {
0204 cout << "Getting inner HCal clusters for energy leakage studies" << endl;
0205 }
0206
0207 for (hcaliter = begin_end_hcal.first;
0208 hcaliter != begin_end_hcal.second;
0209 ++hcaliter)
0210 {
0211 RawCluster *cluster = hcaliter->second;
0212 CLHEP::Hep3Vector vertex(vtx->get_x(), vtx->get_y(), vtx->get_z());
0213 CLHEP::Hep3Vector E_vec_cluster = RawClusterUtility::GetEVec(*cluster, vertex);
0214 hcal_energy = E_vec_cluster.mag();
0215 hcal_eta = E_vec_cluster.pseudoRapidity();
0216 hcal_theta = E_vec_cluster.getTheta();
0217 hcal_pt = E_vec_cluster.perp();
0218 hcal_phi = E_vec_cluster.getPhi();
0219
0220 if (hcal_pt < 0.5)
0221 continue;
0222
0223 TLorentzVector *clus = new TLorentzVector();
0224 clus->SetPtEtaPhiE(hcal_pt, hcal_eta, hcal_phi, hcal_energy);
0225 float dumarray[4];
0226 clus->GetXYZT(dumarray);
0227 hcal_x = dumarray[0];
0228 hcal_y = dumarray[1];
0229 hcal_z = dumarray[2];
0230 hcal_t = dumarray[3];
0231
0232 hcal_px = hcal_pt * TMath::Cos(hcal_phi);
0233 hcal_py = hcal_pt * TMath::Sin(hcal_phi);
0234 hcal_pz = sqrt(hcal_energy * hcal_energy - hcal_px * hcal_px * hcal_py * hcal_py);
0235
0236
0237
0238
0239 for (PHG4TruthInfoContainer::ConstIterator iter = range.first; iter != range.second; ++iter)
0240 {
0241 PHG4Particle *truth = iter->second;
0242
0243 hclustruthpid = truth->get_pid();
0244 if (hclustruthpid == 22)
0245 {
0246 hclustruthpx = truth->get_px();
0247 hclustruthpy = truth->get_py();
0248 hclustruthpz = truth->get_pz();
0249 hclustruthenergy = truth->get_e();
0250 hclustruthpt = sqrt(clustruthpx * clustruthpx + clustruthpy * clustruthpy);
0251 if (hclustruthpt < 0.5)
0252 continue;
0253
0254 TLorentzVector vec;
0255 vec.SetPxPyPzE(hclustruthpx, hclustruthpy, hclustruthpz, hclustruthenergy);
0256 hclustruthphi = vec.Phi();
0257 hclustrutheta = vec.Eta();
0258
0259 break;
0260 }
0261 }
0262
0263 inhcal_tree->Fill();
0264 }
0265
0266
0267
0268
0269
0270
0271
0272 if (_etalow > 1)
0273 {
0274 if (Verbosity() > 1)
0275 {
0276 cout << "getting forward EMCal clusters" << endl;
0277 }
0278
0279 RawClusterContainer::ConstRange fclus = fclusters->getClusters();
0280 RawClusterContainer::ConstIterator fclusiter;
0281
0282 for (fclusiter = fclus.first;
0283 fclusiter != fclus.second;
0284 ++fclusiter)
0285 {
0286 RawCluster *cluster = fclusiter->second;
0287
0288 CLHEP::Hep3Vector vertex(vtx->get_x(), vtx->get_y(), vtx->get_z());
0289 CLHEP::Hep3Vector E_vec_cluster = RawClusterUtility::GetEVec(*cluster, vertex);
0290 fclusenergy = E_vec_cluster.mag();
0291 fclus_eta = E_vec_cluster.pseudoRapidity();
0292 fclus_theta = E_vec_cluster.getTheta();
0293 fclus_pt = E_vec_cluster.perp();
0294 fclus_phi = E_vec_cluster.getPhi();
0295
0296 fclus_px = fclus_pt * TMath::Cos(fclus_phi);
0297 fclus_py = fclus_pt * TMath::Sin(fclus_phi);
0298 fclus_pz = fclusenergy * TMath::Cos(fclus_theta);
0299
0300
0301
0302
0303 for (PHG4TruthInfoContainer::ConstIterator fiter = range.first;
0304 fiter != range.second;
0305 ++fiter)
0306 {
0307 PHG4Particle *truth = fiter->second;
0308
0309 fclustruthpid = truth->get_pid();
0310
0311 if (fclustruthpid == 22 || abs(fclustruthpid) == 11)
0312 {
0313 fclustruthpx = truth->get_px();
0314 fclustruthpy = truth->get_py();
0315 fclustruthpz = truth->get_pz();
0316 fclustruthenergy = truth->get_e();
0317 fclustruthpt = sqrt(fclustruthpx * fclustruthpx + fclustruthpy * fclustruthpy);
0318 if (fclustruthpt < 0.3)
0319 continue;
0320
0321 TLorentzVector vec;
0322 vec.SetPxPyPzE(fclustruthpx, fclustruthpy, fclustruthpz, fclustruthenergy);
0323 fclustruthphi = vec.Phi();
0324 fclustrutheta = vec.Eta();
0325
0326 break;
0327 }
0328 }
0329
0330 fcluster_tree->Fill();
0331 }
0332 }
0333
0334
0335
0336
0337
0338
0339
0340
0341
0342
0343
0344
0345 RawClusterContainer::ConstRange rbegin_end = recal_clusters->getClusters();
0346 RawClusterContainer::ConstIterator rclusiter;
0347
0348 if (Verbosity() > 1)
0349 cout << "Getting the position recalibrated clusters" << endl;
0350
0351
0352
0353 if (_etahi < 1.1)
0354 {
0355 for (rclusiter = rbegin_end.first;
0356 rclusiter != rbegin_end.second;
0357 ++rclusiter)
0358 {
0359
0360 RawCluster *cluster = rclusiter->second;
0361
0362 CLHEP::Hep3Vector vertex(vtx->get_x(), vtx->get_y(), vtx->get_z());
0363 CLHEP::Hep3Vector E_vec_cluster = RawClusterUtility::GetEVec(*cluster, vertex);
0364 rclus_energy = E_vec_cluster.mag();
0365 rclus_eta = E_vec_cluster.pseudoRapidity();
0366 rclus_theta = E_vec_cluster.getTheta();
0367 rclus_pt = E_vec_cluster.perp();
0368 rclus_phi = E_vec_cluster.getPhi();
0369
0370 if (rclus_pt < mincluspt)
0371 continue;
0372 if(Verbosity() > 1)
0373 cout<<"passed recal pt cut"<<endl;
0374 TLorentzVector *clus = new TLorentzVector();
0375 clus->SetPtEtaPhiE(rclus_pt, rclus_eta, rclus_phi, rclus_energy);
0376
0377 float dumarray[4];
0378 clus->GetXYZT(dumarray);
0379 rclus_x = dumarray[0];
0380 rclus_y = dumarray[1];
0381 rclus_z = dumarray[2];
0382 rclus_t = dumarray[3];
0383
0384 rclus_px = rclus_pt * TMath::Cos(rclus_phi);
0385 rclus_py = rclus_pt * TMath::Sin(rclus_phi);
0386 rclus_pz = sqrt(rclus_energy * rclus_energy - rclus_px * rclus_px - rclus_py * rclus_py);
0387 rclus_ecore = cluster->get_ecore();
0388 rclus_prob = cluster->get_prob();
0389 rclus_chi2 = cluster->get_chi2();
0390
0391
0392
0393 for (PHG4TruthInfoContainer::ConstIterator iter = range.first; iter != range.second; ++iter)
0394 {
0395 PHG4Particle *truth = iter->second;
0396
0397 clustruthpid = truth->get_pid();
0398 const int this_embed_id = truthinfo->isEmbeded(truth->get_track_id());
0399
0400
0401
0402 if (this_embed_id != 1 && _embed)
0403 continue;
0404
0405
0406 if (clustruthpid == 22 || fabs(clustruthpid) == 11)
0407 {
0408 clustruthpx = truth->get_px();
0409 clustruthpy = truth->get_py();
0410 clustruthpz = truth->get_pz();
0411 clustruthenergy = truth->get_e();
0412 clustruthpt = sqrt(clustruthpx * clustruthpx + clustruthpy * clustruthpy);
0413
0414 if (clustruthpt < mincluspt)
0415 continue;
0416
0417 TLorentzVector vec;
0418 vec.SetPxPyPzE(clustruthpx, clustruthpy, clustruthpz, clustruthenergy);
0419 clustruthphi = vec.Phi();
0420 clustrutheta = vec.Eta();
0421
0422 if(Verbosity() > 1)
0423 cout<<"found recal truth photon"<<endl;
0424 break;
0425 }
0426 }
0427 if(Verbosity() > 1)
0428 cout<<"filling recal cluster tree"<<endl;
0429
0430 recal_cluster_tree->Fill();
0431 }
0432 }
0433
0434
0435
0436
0437
0438
0439
0440
0441
0442
0443
0444 RawClusterContainer::ConstRange begin_end = clusters->getClusters();
0445 RawClusterContainer::ConstIterator clusiter;
0446
0447 if (Verbosity() > 1)
0448 cout << "Get the non-position recalibrated clusters" << endl;
0449
0450 for (clusiter = begin_end.first;
0451 clusiter != begin_end.second;
0452 ++clusiter)
0453 {
0454
0455 RawCluster *cluster = clusiter->second;
0456
0457 CLHEP::Hep3Vector vertex(vtx->get_x(), vtx->get_y(), vtx->get_z());
0458 CLHEP::Hep3Vector E_vec_cluster = RawClusterUtility::GetEVec(*cluster, vertex);
0459 clus_energy = E_vec_cluster.mag();
0460 clus_eta = E_vec_cluster.pseudoRapidity();
0461 clus_theta = E_vec_cluster.getTheta();
0462 clus_pt = E_vec_cluster.perp();
0463 clus_phi = E_vec_cluster.getPhi();
0464
0465 clus_ecore = cluster->get_ecore();
0466 clus_chi2 = cluster->get_chi2();
0467 clus_prob = cluster->get_prob();
0468
0469 if (clus_pt < mincluspt)
0470 continue;
0471
0472 if(Verbosity() > 1)
0473 cout<<"passed cluster pt cut"<<endl;
0474
0475 TLorentzVector *clus = new TLorentzVector();
0476 clus->SetPtEtaPhiE(clus_pt, clus_eta, clus_phi, clus_energy);
0477
0478 float dumarray[4];
0479 clus->GetXYZT(dumarray);
0480 clus_x = dumarray[0];
0481 clus_y = dumarray[1];
0482 clus_z = dumarray[2];
0483 clus_t = dumarray[3];
0484
0485 clus_px = clus_pt * TMath::Cos(clus_phi);
0486 clus_py = clus_pt * TMath::Sin(clus_phi);
0487 clus_pz = sqrt(clus_energy * clus_energy - clus_px * clus_px - clus_py * clus_py);
0488
0489
0490
0491 for (PHG4TruthInfoContainer::ConstIterator iter = range.first; iter != range.second; ++iter)
0492 {
0493 PHG4Particle *truth = iter->second;
0494
0495 clustruthpid = truth->get_pid();
0496 const int this_embed_id = truthinfo->isEmbeded(truth->get_track_id());
0497 if (this_embed_id != 1 && _embed)
0498 continue;
0499 if (clustruthpid == 22 || fabs(clustruthpid) == 11)
0500 {
0501 clustruthpx = truth->get_px();
0502 clustruthpy = truth->get_py();
0503 clustruthpz = truth->get_pz();
0504 clustruthenergy = truth->get_e();
0505 clustruthpt = sqrt(clustruthpx * clustruthpx + clustruthpy * clustruthpy);
0506
0507 if (clustruthpt < mincluspt)
0508 continue;
0509
0510 TLorentzVector vec;
0511 vec.SetPxPyPzE(clustruthpx, clustruthpy, clustruthpz, clustruthenergy);
0512 clustruthphi = vec.Phi();
0513 clustrutheta = vec.Eta();
0514
0515
0516 break;
0517 }
0518 }
0519
0520
0521
0522
0523
0524
0525
0526
0527
0528
0529
0530
0531
0532
0533
0534
0535
0536
0537
0538
0539
0540
0541
0542
0543
0544
0545
0546
0547
0548
0549
0550
0551
0552
0553
0554
0555
0556
0557
0558
0559
0560
0561
0562
0563
0564
0565
0566
0567
0568
0569
0570
0571
0572
0573
0574
0575
0576
0577
0578
0579
0580
0581
0582
0583
0584
0585
0586
0587
0588
0589
0590
0591
0592
0593
0594
0595
0596
0597
0598
0599
0600
0601
0602
0603
0604
0605
0606
0607
0608
0609
0610
0611
0612
0613
0614
0615
0616
0617
0618
0619
0620
0621
0622
0623
0624
0625
0626
0627 cluster_tree->Fill();
0628 }
0629
0630 if(Verbosity() > 1)
0631 cout<<"Finished event in Photons package"<<endl;
0632
0633 nevents++;
0634 tree->Fill();
0635 return 0;
0636 }
0637
0638 int Photons::End(PHCompositeNode *topnode)
0639 {
0640 std::cout << " DONE PROCESSING " << endl;
0641
0642 file->Write();
0643 file->Close();
0644 return 0;
0645 }
0646
0647 void Photons::Set_Tree_Branches()
0648 {
0649 inhcal_tree = new TTree("hcalclustree", "a tree with inner hcal cluster information");
0650 inhcal_tree->Branch("hcal_energy", &hcal_energy, "hcal_energy/F");
0651 inhcal_tree->Branch("hcal_eta", &hcal_eta, "hcal_eta/F");
0652 inhcal_tree->Branch("hcal_phi", &hcal_phi, "hcal_phi/F");
0653 inhcal_tree->Branch("hcal_pt", &hcal_pt, "hcal_pt/F");
0654 inhcal_tree->Branch("hcal_theta", &hcal_theta, "hcal_theta/F");
0655 inhcal_tree->Branch("hcal_x", &hcal_x, "hcal_x/F");
0656 inhcal_tree->Branch("hcal_y", &hcal_y, "hcal_y/F");
0657 inhcal_tree->Branch("hcal_z", &hcal_z, "hcal_z/F");
0658 inhcal_tree->Branch("hcal_t", &hcal_t, "hcal_t/F");
0659 inhcal_tree->Branch("hcal_px", &hcal_px, "hcal_px/F");
0660 inhcal_tree->Branch("hcal_py", &hcal_py, "hcal_py/F");
0661 inhcal_tree->Branch("hcal_pz", &hcal_pz, "hcal_pz/F");
0662 inhcal_tree->Branch("nevents", &nevents, "nevents/I");
0663 inhcal_tree->Branch("hclustruthpx", &hclustruthpx, "hclustruthpx/F");
0664 inhcal_tree->Branch("hclustruthpy", &hclustruthpy, "hclustruthpy/F");
0665 inhcal_tree->Branch("hclustruthpz", &hclustruthpz, "hclustruthpz/F");
0666 inhcal_tree->Branch("hclustruthenergy", &hclustruthenergy, "hclustruthenergy/F");
0667 inhcal_tree->Branch("hclustruthpt", &hclustruthpt, "hclustruthpt/F");
0668 inhcal_tree->Branch("hclustruthphi", &hclustruthphi, "hclustruthphi/F");
0669 inhcal_tree->Branch("hclustrutheta", &hclustrutheta, "hclustrutheta/F");
0670
0671 cluster_tree = new TTree("clustertree", "A tree with EMCal cluster information");
0672 cluster_tree->Branch("clus_energy", &clus_energy, "clus_energy/F");
0673 cluster_tree->Branch("clus_eta", &clus_eta, "clus_eta/F");
0674 cluster_tree->Branch("clus_phi", &clus_phi, "clus_phi/F");
0675 cluster_tree->Branch("clus_pt", &clus_pt, "clus_pt/F");
0676 cluster_tree->Branch("clus_theta", &clus_theta, "clus_theta/F");
0677 cluster_tree->Branch("clus_x", &clus_x, "clus_x/F");
0678 cluster_tree->Branch("clus_y", &clus_y, "clus_y/F");
0679 cluster_tree->Branch("clus_z", &clus_z, "clus_z/F");
0680 cluster_tree->Branch("clus_t", &clus_t, "clus_t/F");
0681 cluster_tree->Branch("clus_px", &clus_px, "clus_px/F");
0682 cluster_tree->Branch("clus_py", &clus_py, "clus_py/F");
0683 cluster_tree->Branch("clus_pz", &clus_pz, "clus_pz/F");
0684 cluster_tree->Branch("nevents", &nevents, "nevents/I");
0685 cluster_tree->Branch("clus_ecore", &clus_ecore, "clus_ecore/F");
0686 cluster_tree->Branch("clus_chi2", &clus_chi2, "clus_chi2/F");
0687 cluster_tree->Branch("clustruthpx", &clustruthpx, "clustruthpx/F");
0688 cluster_tree->Branch("clustruthpy", &clustruthpy, "clustruthpy/F");
0689 cluster_tree->Branch("clustruthpz", &clustruthpz, "clustruthpz/F");
0690 cluster_tree->Branch("clustruthenergy", &clustruthenergy, "clustruthenergy/F");
0691 cluster_tree->Branch("clustruthpt", &clustruthpt, "clustruthpt/F");
0692 cluster_tree->Branch("clustruthphi", &clustruthphi, "clustruthphi/F");
0693 cluster_tree->Branch("clustrutheta", &clustrutheta, "clustrutheta/F");
0694 cluster_tree->Branch("fmodphi", &fmodphi, "fmodphi/F");
0695 cluster_tree->Branch("fmodeta", &fmodeta, "fmodeta/F");
0696
0697 recal_cluster_tree = new TTree("recalclustertree", "A tree with EMCal recalib cluster information");
0698 recal_cluster_tree->Branch("rclus_energy", &rclus_energy, "rclus_energy/F");
0699 recal_cluster_tree->Branch("rclus_eta", &rclus_eta, "rclus_eta/F");
0700 recal_cluster_tree->Branch("rclus_phi", &rclus_phi, "rclus_phi/F");
0701 recal_cluster_tree->Branch("rclus_pt", &rclus_pt, "rclus_pt/F");
0702 recal_cluster_tree->Branch("rclus_theta", &rclus_theta, "rclus_theta/F");
0703 recal_cluster_tree->Branch("rclus_ecore", &rclus_ecore, "rclus_ecore/F");
0704 recal_cluster_tree->Branch("rclus_chi2", &rclus_chi2, "rclus_chi2/F");
0705 recal_cluster_tree->Branch("rclus_x", &rclus_x, "rclus_x/F");
0706 recal_cluster_tree->Branch("rclus_y", &rclus_y, "rclus_y/F");
0707 recal_cluster_tree->Branch("rclus_z", &rclus_z, "rclus_z/F");
0708 recal_cluster_tree->Branch("rclus_t", &rclus_t, "rclus_t/F");
0709 recal_cluster_tree->Branch("rclus_px", &rclus_px, "rclus_px/F");
0710 recal_cluster_tree->Branch("rclus_py", &rclus_py, "rclus_py/F");
0711 recal_cluster_tree->Branch("rclus_pz", &rclus_pz, "rclus_pz/F");
0712 recal_cluster_tree->Branch("nevents", &nevents, "nevents/I");
0713 recal_cluster_tree->Branch("clustruthpx", &clustruthpx, "clustruthpx/F");
0714 recal_cluster_tree->Branch("clustruthpy", &clustruthpy, "clustruthpy/F");
0715 recal_cluster_tree->Branch("clustruthpz", &clustruthpz, "clustruthpz/F");
0716 recal_cluster_tree->Branch("clustruthenergy", &clustruthenergy, "clustruthenergy/F");
0717 recal_cluster_tree->Branch("clustruthpt", &clustruthpt, "clustruthpt/F");
0718 recal_cluster_tree->Branch("clustruthphi", &clustruthphi, "clustruthphi/F");
0719 recal_cluster_tree->Branch("clustrutheta", &clustrutheta, "clustrutheta/F");
0720
0721 fcluster_tree = new TTree("fclustertree", "A tree with FEMCal cluster information");
0722 fcluster_tree->Branch("fclusenergy", &fclusenergy, "fclusenergy/F");
0723 fcluster_tree->Branch("fclus_eta", &fclus_eta, "fclus_eta/F");
0724 fcluster_tree->Branch("fclus_phi", &fclus_phi, "fclus_phi/F");
0725 fcluster_tree->Branch("fclus_pt", &fclus_pt, "fclus_pt/F");
0726 fcluster_tree->Branch("fclus_theta", &fclus_theta, "fclus_theta/F");
0727 fcluster_tree->Branch("fclus_px", &fclus_px, "fclus_px/F");
0728 fcluster_tree->Branch("fclus_py", &fclus_py, "fclus_py/F");
0729 fcluster_tree->Branch("fclus_pz", &fclus_pz, "fclus_pz/F");
0730 fcluster_tree->Branch("nevents", &nevents, "nevents/I");
0731 fcluster_tree->Branch("fclustruthpx", &fclustruthpx, "fclustruthpx/F");
0732 fcluster_tree->Branch("fclustruthpy", &fclustruthpy, "fclustruthpy/F");
0733 fcluster_tree->Branch("fclustruthpz", &fclustruthpz, "fclustruthpz/F");
0734 fcluster_tree->Branch("fclustruthenergy", &fclustruthenergy, "fclustruthenergy/F");
0735 fcluster_tree->Branch("fclustruthpt", &fclustruthpt, "fclustruthpt/F");
0736 fcluster_tree->Branch("fclustruthphi", &fclustruthphi, "fclustruthphi/F");
0737 fcluster_tree->Branch("fclustrutheta", &fclustrutheta, "fclustrutheta/F");
0738
0739 truth_g4particles = new TTree("truthtree_g4", "a tree with all truth g4 particles");
0740 truth_g4particles->Branch("truthpx", &truthpx, "truthpx/F");
0741 truth_g4particles->Branch("truthpy", &truthpy, "truthpy/F");
0742 truth_g4particles->Branch("truthpz", &truthpz, "truthpz/F");
0743 truth_g4particles->Branch("truthp", &truthp, "truthp/F");
0744 truth_g4particles->Branch("truthenergy", &truthenergy, "truthenergy/F");
0745 truth_g4particles->Branch("truthphi", &truthphi, "truthphi/F");
0746 truth_g4particles->Branch("trutheta", &trutheta, "trutheta/F");
0747 truth_g4particles->Branch("truthpt", &truthpt, "truthpt/F");
0748 truth_g4particles->Branch("truthpid", &truthpid, "truthpid/I");
0749 truth_g4particles->Branch("nevents", &nevents, "nevents/I");
0750 }
0751
0752 void Photons::initialize_to_zero()
0753 {
0754 file = 0;
0755 tree = 0;
0756 cluster_tree = 0;
0757 truth_g4particles = 0;
0758 inhcal_tree = 0;
0759 fcluster_tree = 0;
0760
0761 recal_cluster_tree = 0;
0762 rclus_energy = 0;
0763 rclus_eta = 0;
0764 rclus_phi = 0;
0765 rclus_pt = 0;
0766 rclus_px = 0;
0767 rclus_pz = 0;
0768 rclus_py = 0;
0769 rclus_theta = 0;
0770 rclus_x = 0;
0771 rclus_y = 0;
0772 rclus_z = 0;
0773 rclus_t = 0;
0774
0775 nevents = 0;
0776 histo = 0;
0777 hcal_energy = 0;
0778 hcal_eta = 0;
0779 hcal_phi = 0;
0780 hcal_pt = 0;
0781 hcal_px = 0;
0782 hcal_py = 0;
0783 hcal_pz = 0;
0784 hcal_theta = 0;
0785 hcal_x = 0;
0786 hcal_y = 0;
0787 hcal_z = 0;
0788 hcal_t = 0;
0789
0790 clus_energy = 0;
0791 clus_eta = 0;
0792 clus_phi = 0;
0793 clus_pt = 0;
0794 clus_px = 0;
0795 clus_py = 0;
0796 clus_pz = 0;
0797 clus_theta = 0;
0798 clus_x = 0;
0799 clus_y = 0;
0800 clus_z = 0;
0801 clus_t = 0;
0802 fmodphi = 0;
0803 fmodeta = 0;
0804
0805 truthpx = 0;
0806 truthpy = 0;
0807 truthpz = 0;
0808 truthp = 0;
0809 truthphi = 0;
0810 trutheta = 0;
0811 truthpt = 0;
0812 truthenergy = 0;
0813 truthpid = 0;
0814 numparticlesinevent = 0;
0815 process_id = 0;
0816
0817 clustruthpx = 0;
0818 clustruthpy = 0;
0819 clustruthpz = 0;
0820 clustruthenergy = 0;
0821 clustruthpt = 0;
0822 clustruthphi = 0;
0823 clustrutheta = 0;
0824 clustruthpid = 0;
0825 hclustruthpx = 0;
0826 hclustruthpy = 0;
0827 hclustruthpz = 0;
0828 hclustruthenergy = 0;
0829 hclustruthpt = 0;
0830 hclustruthphi = 0;
0831 hclustrutheta = 0;
0832 hclustruthpid = 0;
0833
0834 fclusenergy = 0;
0835 fclus_eta = 0;
0836 fclus_phi = 0;
0837 fclus_theta = 0;
0838 fclus_pt = 0;
0839 fclustruthpid = 0;
0840 fclustruthpx = 0;
0841 fclustruthpy = 0;
0842 fclustruthpz = 0;
0843 fclustruthenergy = 0;
0844 fclustruthpt = 0;
0845 fclustruthphi = 0;
0846 fclustrutheta = 0;
0847 fclus_px = 0;
0848 fclus_py = 0;
0849 fclus_pz = 0;
0850 }