4 #include <TLorentzVector.h>
13 #include <calobase/RawCluster.h>
14 #include <calobase/RawClusterContainer.h>
15 #include <calobase/RawClusterUtility.h>
16 #include <calobase/RawTower.h>
17 #include <calobase/RawTowerContainer.h>
18 #include <calobase/RawTowerGeom.h>
19 #include <calobase/RawTowerGeomContainer.h>
20 #include <calobase/TowerInfo.h>
21 #include <calobase/TowerInfoContainer.h>
22 #include <calobase/TowerInfoDefs.h>
25 #include <calobase/RawCluster.h>
26 #include <calobase/RawClusterContainer.h>
46 #include <TProfile2D.h>
48 #include <Event/Event.h>
49 #include <Event/packet.h>
61 , outfilename(filename)
87 h_cemc_etaphi =
new TH2F(
"h_cemc_etaphi",
";eta;phi", 96, 0, 96, 256, 0, 256);
88 h_hcalin_etaphi =
new TH2F(
"h_ihcal_etaphi",
";eta;phi", 24, 0, 24, 64, 0, 64);
89 h_hcalout_etaphi =
new TH2F(
"h_ohcal_etaphi",
";eta;phi", 24, 0, 24, 64, 0, 64);
91 h_cemc_etaphi_wQA =
new TH2F(
"h_cemc_etaphi_wQA",
";eta;phi", 96, 0, 96, 256, 0, 256);
99 h_cemc_etaphi_time =
new TProfile2D(
"h_cemc_etaphi_time",
";eta;phi", 96, 0, 96, 256, 0, 256,-10,10);
100 h_hcalin_etaphi_time =
new TProfile2D(
"h_ihcal_etaphi_time",
";eta;phi", 24, 0, 24, 64, 0, 64 ,-10,10);
101 h_hcalout_etaphi_time =
new TProfile2D(
"h_ohcal_etaphi_time",
";eta;phi", 24, 0, 24, 64, 0, 64 ,-10,10);
103 h_cemc_etaphi_badChi2 =
new TProfile2D(
"h_cemc_etaphi_badChi2",
";eta;phi", 96, 0, 96, 256, 0, 256,-10,10);
109 h_InvMass =
new TH1F(
"h_InvMass",
"Invariant Mass", 120, 0, 1.2);
112 hzdcSouthraw =
new TH1D(
"hzdcSouthraw",
"hzdcSouthraw", 1500, 0, 15000);
113 hzdcNorthraw =
new TH1D(
"hzdcNorthraw",
"hzdcNorthraw", 1500, 0, 15000);
114 hzdcSouthcalib =
new TH1D(
"hzdcSouthcalib",
"hzdcSouthcalib", 1500, 0, 15000);
115 hzdcNorthcalib =
new TH1D(
"hzdcNorthcalib",
"hzdcNorthcalib", 1500, 0, 15000);
116 h_totalzdc_e =
new TH1D(
"h_totalzdc_e",
"", 200, 0, 2e4);
120 hvtx_z_raw =
new TH1D(
"hvtx_z_raw",
"hvtx_z_raw", 201, -100.5, 100.5);
121 hvtx_z_cut =
new TH1D(
"hvtx_z_cut",
"hvtx_z_cut", 201, -100.5, 100.5);
124 hzdctime_cut =
new TH1D(
"hzdctime_cut",
"hzdctime_cut", 50, -17.5, 32.5);
125 hemcaltime_cut =
new TH1D(
"hemcaltime_cut",
"hemcaltime_cut", 50, -17.5, 32.5);
126 hihcaltime_cut =
new TH1D(
"hihcaltime_cut",
"hihcaltime_cut", 50, -17.5, 32.5);
127 hohcaltime_cut =
new TH1D(
"hohcaltime_cut",
"hohcaltime_cut", 50, -17.5, 32.5);
130 hzdctime =
new TH1D(
"hzdctime",
"hzdctime", 50, -17.5, 32.5);
131 hemcaltime =
new TH1D(
"hemcaltime",
"hemcaltime", 50, -17.5, 32.5);
132 hihcaltime =
new TH1D(
"hihcaltime",
"hihcaltime", 50, -17.5, 32.5);
133 hohcaltime =
new TH1D(
"hohcaltime",
"hohcaltime", 50, -17.5, 32.5);
136 h_etaphi_clus =
new TH2F(
"h_etaphi_clus",
"", 140, -1.2, 1.2, 64, -1 * TMath::Pi(), TMath::Pi());
137 h_clusE =
new TH1F(
"h_clusE",
"", 100, 0, 10);
155 float totalcemc = 0.;
156 float totalihcal = 0.;
157 float totalohcal = 0.;
160 float totalzdcsouthraw = 0.;
161 float totalzdcnorthraw = 0.;
162 float totalzdcsouthcalib = 0.;
163 float totalzdcnorthcalib = 0.;
165 float emcaldownscale = 1000000 / 800;
166 float ihcaldownscale = 40000 / 300;
167 float ohcaldownscale = 250000 / 600;
168 float mbddownscale = 2000.0;
169 float zdcdownscale = 1e4;
171 float emcal_hit_threshold = 0.5;
172 float ohcal_hit_threshold = 0.5;
173 float ihcal_hit_threshold = 0.25;
176 int max_emcal_t = -1;
177 int max_ihcal_t = -1;
178 int max_ohcal_t = -1;
188 GlobalVertexMap* vertexmap = findNode::getClass<GlobalVertexMap>(topNode,
"GlobalVertexMap");
192 std::cout <<
"CaloAna GlobalVertexMap node is missing" << std::endl;
196 if (vertexmap && !vertexmap->
empty())
201 vtx_z = vtx->
get_z();
206 vector<float> ht_eta;
207 vector<float> ht_phi;
216 TowerInfoContainer* towers = findNode::getClass<TowerInfoContainer>(topNode,
"TOWERINFO_CALIB_CEMC");
232 if (!isGood && offlineenergy > 0.2)
234 ht_eta.push_back(ieta);
235 ht_phi.push_back(iphi);
238 if (_time > (max_emcal_t -
_range) && _time < (max_emcal_t +
_range))
240 totalcemc += offlineenergy;
242 if (offlineenergy > emcal_hit_threshold)
260 TowerInfoContainer* towers = findNode::getClass<TowerInfoContainer>(topNode,
"TOWERINFO_CALIB_HCALIN");
276 if (_time > (max_ihcal_t -
_range) && _time < (max_ihcal_t +
_range))
278 totalihcal += offlineenergy;
281 if (offlineenergy > ihcal_hit_threshold)
298 TowerInfoContainer* towers = findNode::getClass<TowerInfoContainer>(topNode,
"TOWERINFO_CALIB_HCALOUT");
316 if (_time > (max_ohcal_t -
_range) && _time < (max_ohcal_t +
_range))
318 totalohcal += offlineenergy;
321 if (offlineenergy > ohcal_hit_threshold)
339 TowerInfoContainer* towers = findNode::getClass<TowerInfoContainer>(topNode,
"TOWERINFO_CALIB_ZDC");
351 totalzdcsouthcalib += offlineenergy;
355 totalzdcnorthcalib += offlineenergy;
359 if (_time > (max_zdc_t -
_range) && _time < (max_zdc_t +
_range))
361 totalzdc += offlineenergy;
370 TowerInfoContainer* towers = findNode::getClass<TowerInfoContainer>(topNode,
"TOWERS_ZDC");
380 totalzdcsouthraw += offlineenergy;
384 totalzdcnorthraw += offlineenergy;
390 MbdPmtContainer* bbcpmts = findNode::getClass<MbdPmtContainer>(topNode,
"MbdPmtContainer");
393 std::cout <<
"makeMBDTrees::process_event: Could not find MbdPmtContainer, aborting" << std::endl;
398 for (
int i = 0;
i < nPMTs;
i++)
401 float pmtadc = mbdpmt->
get_q();
420 RawClusterContainer* clusterContainer = findNode::getClass<RawClusterContainer>(topNode,
"CLUSTERINFO_POS_COR_CEMC");
421 if (!clusterContainer)
423 std::cout <<
PHWHERE <<
"funkyCaloStuff::process_event - Fatal Error - CLUSTER_CEMC node is missing. " << std::endl;
430 RawTowerGeomContainer* m_geometry = findNode::getClass<RawTowerGeomContainer>(topNode, towergeomnodename);
433 std::cout <<
Name() <<
"::"
435 <<
": Could not find node " << towergeomnodename << std::endl;
436 throw std::runtime_error(
"failed to find TOWERGEOM node in RawClusterDeadHotMask::CreateNodeTree");
440 float emcMinClusE1 = 1.5;
441 float emcMinClusE2 = 0.8;
442 float emcMaxClusE = 32;
444 float maxAlpha = 0.8;
447 if (totalcemc < 0.2 * emcaldownscale)
453 for (clusterIter = clusterEnd.first; clusterIter != clusterEnd.second; clusterIter++)
455 RawCluster* recoCluster = clusterIter->second;
457 CLHEP::Hep3Vector
vertex(0, 0, 0);
460 float clusE = E_vec_cluster.mag();
461 float clus_eta = E_vec_cluster.pseudoRapidity();
462 float clus_phi = E_vec_cluster.phi();
463 float clus_pt = E_vec_cluster.perp();
464 float clus_chisq = recoCluster->
get_chi2();
468 if (clusE < emcMinClusE1 || clusE > emcMaxClusE)
472 if (abs(clus_eta) > 0.7)
486 bool hotClus =
false;
487 for (toweriter = towers.first; toweriter != towers.second; ++toweriter)
491 for (
size_t i = 0;
i < ht_eta.size();
i++)
493 if (towerphi == ht_phi[
i] && towereta == ht_eta[
i]) hotClus =
true;
496 if (hotClus ==
true)
continue;
501 TLorentzVector photon1;
502 photon1.SetPtEtaPhiE(clus_pt, clus_eta, clus_phi, clusE);
504 for (clusterIter2 = clusterEnd.first; clusterIter2 != clusterEnd.second; clusterIter2++)
506 if (clusterIter == clusterIter2)
510 RawCluster* recoCluster2 = clusterIter2->second;
512 CLHEP::Hep3Vector vertex2(0, 0, 0);
515 float clus2E = E_vec_cluster2.mag();
516 float clus2_eta = E_vec_cluster2.pseudoRapidity();
517 float clus2_phi = E_vec_cluster2.phi();
518 float clus2_pt = E_vec_cluster2.perp();
519 float clus2_chisq = recoCluster2->
get_chi2();
521 if (clus2E < emcMinClusE2 || clus2E > emcMaxClusE)
525 if (abs(clus2_eta) > 0.7)
539 bool hotClus =
false;
540 for (toweriter2 = towers2.first; toweriter2 != towers2.second; ++toweriter2)
545 for (
size_t i = 0;
i < ht_eta.size();
i++)
547 if (towerphi == ht_phi[
i] && towereta == ht_phi[
i]) hotClus =
true;
550 if (hotClus ==
true)
continue;
553 TLorentzVector photon2;
554 photon2.SetPtEtaPhiE(clus2_pt, clus2_eta, clus2_phi, clus2E);
556 if (sqrt(pow(clusE - clus2E, 2)) / (clusE + clus2E) > maxAlpha)
continue;
558 if (photon1.DeltaR(photon2) < minDr)
continue;
559 TLorentzVector pi0 = photon1 + photon2;
581 int getmaxtime, tcut = -1;
583 for (
int bin = 1; bin < h->GetNbinsX() + 1; bin++)
585 double c = h->GetBinContent(bin);
586 double max = h->GetMaximum();
587 int bincenter = h->GetBinCenter(bin);
590 getmaxtime = bincenter;
591 if (getmaxtime != -1) tcut = getmaxtime;
601 Double_t logymin = TMath::Log10(ymin);
602 Double_t logymax = TMath::Log10(ymax);
603 Double_t binwidth = (logymax - logymin) / ybins_in;
604 Double_t ybins[ybins_in + 1];
606 for (Int_t
i = 0;
i <= ybins_in + 1;
i++)
607 ybins[
i] = TMath::Power(10, logymin +
i * binwidth);
609 TH2F*
h =
new TH2F(name, title, xbins_in, xmin, xmax, ybins_in, ybins);