5 #include <calobase/RawCluster.h>
6 #include <calobase/RawClusterContainer.h>
7 #include <calobase/RawClusterUtility.h>
8 #include <calobase/RawTowerGeomContainer.h>
9 #include <calobase/TowerInfo.h>
10 #include <calobase/TowerInfoContainer.h>
28 #include <TLorentzVector.h>
30 #include <TProfile2D.h>
44 , outfilename(filename)
63 std::cout <<
"In CaloValid::Init" << std::endl;
73 h_cemc_etaphi =
new TH2F(
"h_cemc_etaphi",
";eta;phi", 96, 0, 96, 256, 0, 256);
74 h_hcalin_etaphi =
new TH2F(
"h_ihcal_etaphi",
";eta;phi", 24, 0, 24, 64, 0, 64);
75 h_hcalout_etaphi =
new TH2F(
"h_ohcal_etaphi",
";eta;phi", 24, 0, 24, 64, 0, 64);
77 h_cemc_etaphi_wQA =
new TH2F(
"h_cemc_etaphi_wQA",
";eta;phi", 96, 0, 96, 256, 0, 256);
88 h_cemc_etaphi_time =
new TProfile2D(
"h_cemc_etaphi_time",
";eta;phi", 96, 0, 96, 256, 0, 256, -10, 10);
89 h_hcalin_etaphi_time =
new TProfile2D(
"h_ihcal_etaphi_time",
";eta;phi", 24, 0, 24, 64, 0, 64, -10, 10);
90 h_hcalout_etaphi_time =
new TProfile2D(
"h_ohcal_etaphi_time",
";eta;phi", 24, 0, 24, 64, 0, 64, -10, 10);
96 h_cemc_etaphi_badChi2 =
new TProfile2D(
"h_cemc_etaphi_badChi2",
";eta;phi", 96, 0, 96, 256, 0, 256, -10, 10);
101 h_InvMass =
new TH1F(
"h_InvMass",
"Invariant Mass", 120, 0, 1.2);
104 hzdcSouthraw =
new TH1D(
"hzdcSouthraw",
"hzdcSouthraw", 1500, 0, 15000);
105 hzdcNorthraw =
new TH1D(
"hzdcNorthraw",
"hzdcNorthraw", 1500, 0, 15000);
106 hzdcSouthcalib =
new TH1D(
"hzdcSouthcalib",
"hzdcSouthcalib", 1500, 0, 15000);
107 hzdcNorthcalib =
new TH1D(
"hzdcNorthcalib",
"hzdcNorthcalib", 1500, 0, 15000);
108 h_totalzdc_e =
new TH1D(
"h_totalzdc_e",
"", 200, 0, 2e4);
112 hvtx_z_raw =
new TH1D(
"hvtx_z_raw",
"hvtx_z_raw", 201, -100.5, 100.5);
113 hvtx_z_cut =
new TH1D(
"hvtx_z_cut",
"hvtx_z_cut", 201, -100.5, 100.5);
116 hzdctime_cut =
new TH1D(
"hzdctime_cut",
"hzdctime_cut", 50, -17.5, 32.5);
117 hemcaltime_cut =
new TH1D(
"hemcaltime_cut",
"hemcaltime_cut", 50, -17.5, 32.5);
118 hihcaltime_cut =
new TH1D(
"hihcaltime_cut",
"hihcaltime_cut", 50, -17.5, 32.5);
119 hohcaltime_cut =
new TH1D(
"hohcaltime_cut",
"hohcaltime_cut", 50, -17.5, 32.5);
122 hzdctime =
new TH1D(
"hzdctime",
"hzdctime", 50, -17.5, 32.5);
123 hemcaltime =
new TH1D(
"hemcaltime",
"hemcaltime", 50, -17.5, 32.5);
124 hihcaltime =
new TH1D(
"hihcaltime",
"hihcaltime", 50, -17.5, 32.5);
125 hohcaltime =
new TH1D(
"hohcaltime",
"hohcaltime", 50, -17.5, 32.5);
128 h_etaphi_clus =
new TH2F(
"h_etaphi_clus",
"", 140, -1.2, 1.2, 64, -1 * M_PI, M_PI);
129 h_clusE =
new TH1F(
"h_clusE",
"", 100, 0, 10);
133 std::cout <<
"Leaving CaloValid::Init" << std::endl;
154 float totalcemc = 0.;
155 float totalihcal = 0.;
156 float totalohcal = 0.;
159 float totalzdcsouthraw = 0.;
160 float totalzdcnorthraw = 0.;
161 float totalzdcsouthcalib = 0.;
162 float totalzdcnorthcalib = 0.;
164 float emcaldownscale = 1000000. / 800.;
165 float ihcaldownscale = 40000. / 300.;
166 float ohcaldownscale = 250000. / 600.;
167 float mbddownscale = 2000.0;
168 float zdcdownscale = 1e4;
170 float adc_threshold = 15.;
172 float emcal_hit_threshold = 0.5;
173 float ohcal_hit_threshold = 0.5;
174 float ihcal_hit_threshold = 0.25;
177 int max_emcal_t = -1;
178 int max_ihcal_t = -1;
179 int max_ohcal_t = -1;
188 GlobalVertexMap* vertexmap = findNode::getClass<GlobalVertexMap>(topNode,
"GlobalVertexMap");
191 std::cout <<
"CaloValid GlobalVertexMap node is missing" << std::endl;
193 float vtx_z = std::numeric_limits<float>::quiet_NaN();
194 if (vertexmap && !vertexmap->
empty())
199 vtx_z = vtx->
get_z();
206 TowerInfoContainer* towers = findNode::getClass<TowerInfoContainer>(topNode,
"TOWERINFO_CALIB_CEMC");
223 for (
int is=0; is<8; is++)
229 status = status >> 1U;
231 if (_time > (max_emcal_t -
_range) && _time < (max_emcal_t +
_range))
233 totalcemc += offlineenergy;
235 if (offlineenergy > emcal_hit_threshold)
258 TowerInfoContainer* towers = findNode::getClass<TowerInfoContainer>(topNode,
"TOWERINFO_CALIB_HCALIN");
277 for (
int is=0; is<8; is++)
283 status = status >> 1U;
286 if (_time > (max_ihcal_t -
_range) && _time < (max_ihcal_t +
_range))
288 totalihcal += offlineenergy;
291 if (offlineenergy > ihcal_hit_threshold)
314 TowerInfoContainer* towers = findNode::getClass<TowerInfoContainer>(topNode,
"TOWERINFO_CALIB_HCALOUT");
334 for (
int is=0; is<8; is++)
340 status = status >> 1U;
343 if (_time > (max_ohcal_t -
_range) && _time < (max_ohcal_t +
_range))
345 totalohcal += offlineenergy;
348 if (offlineenergy > ohcal_hit_threshold)
371 TowerInfoContainer* towers = findNode::getClass<TowerInfoContainer>(topNode,
"TOWERINFO_CALIB_ZDC");
383 totalzdcsouthcalib += offlineenergy;
387 totalzdcnorthcalib += offlineenergy;
391 if (_time > (max_zdc_t -
_range) && _time < (max_zdc_t +
_range))
393 totalzdc += offlineenergy;
403 TowerInfoContainer* towers = findNode::getClass<TowerInfoContainer>(topNode,
"TOWERS_ZDC");
413 totalzdcsouthraw += offlineenergy;
417 totalzdcnorthraw += offlineenergy;
424 TowerInfoContainer* towers = findNode::getClass<TowerInfoContainer>(topNode,
"TOWERS_CEMC");
436 if (raw_energy > adc_threshold)
448 TowerInfoContainer* towers = findNode::getClass<TowerInfoContainer>(topNode,
"TOWERS_HCALOUT");
460 if (raw_energy > adc_threshold)
472 TowerInfoContainer* towers = findNode::getClass<TowerInfoContainer>(topNode,
"TOWERS_HCALIN");
484 if (raw_energy > adc_threshold)
497 MbdPmtContainer* bbcpmts = findNode::getClass<MbdPmtContainer>(topNode,
"MbdPmtContainer");
500 std::cout <<
"makeMBDTrees::process_event: Could not find MbdPmtContainer, aborting" << std::endl;
505 for (
int i = 0;
i < nPMTs;
i++)
508 float pmtadc = mbdpmt->
get_q();
525 RawClusterContainer* clusterContainer = findNode::getClass<RawClusterContainer>(topNode,
"CLUSTERINFO_POS_COR_CEMC");
526 if (!clusterContainer)
528 std::cout <<
PHWHERE <<
"funkyCaloStuff::process_event - Fatal Error - CLUSTER_CEMC node is missing. " << std::endl;
535 RawTowerGeomContainer* m_geometry = findNode::getClass<RawTowerGeomContainer>(topNode, towergeomnodename);
538 std::cout <<
Name() <<
"::"
540 <<
": Could not find node " << towergeomnodename << std::endl;
545 float emcMinClusE1 = 1.3;
546 float emcMinClusE2 = 0.7;
547 float emcMaxClusE = 100;
548 float maxAlpha = 0.6;
550 if (totalcemc < 0.2 * emcaldownscale)
556 for (clusterIter = clusterEnd.first; clusterIter != clusterEnd.second; clusterIter++)
558 RawCluster* recoCluster = clusterIter->second;
560 CLHEP::Hep3Vector
vertex(0, 0, 0);
563 float clusE = E_vec_cluster.mag();
564 float clus_eta = E_vec_cluster.pseudoRapidity();
565 float clus_phi = E_vec_cluster.phi();
566 float clus_pt = E_vec_cluster.perp();
567 float clus_chisq = recoCluster->
get_chi2();
571 if (clusE < emcMinClusE1 || clusE > emcMaxClusE)
582 TLorentzVector photon1;
583 photon1.SetPtEtaPhiE(clus_pt, clus_eta, clus_phi, clusE);
585 for (clusterIter2 = clusterEnd.first; clusterIter2 != clusterEnd.second; clusterIter2++)
587 if (clusterIter == clusterIter2)
591 RawCluster* recoCluster2 = clusterIter2->second;
593 CLHEP::Hep3Vector vertex2(0, 0, 0);
596 float clus2E = E_vec_cluster2.mag();
597 float clus2_eta = E_vec_cluster2.pseudoRapidity();
598 float clus2_phi = E_vec_cluster2.phi();
599 float clus2_pt = E_vec_cluster2.perp();
600 float clus2_chisq = recoCluster2->
get_chi2();
602 if (clus2E < emcMinClusE2 || clus2E > emcMaxClusE)
611 TLorentzVector photon2;
612 photon2.SetPtEtaPhiE(clus2_pt, clus2_eta, clus2_phi, clus2E);
614 if (sqrt(pow(clusE - clus2E, 2)) / (clusE + clus2E) > maxAlpha)
619 TLorentzVector pi0 = photon1 + photon2;
640 int getmaxtime, tcut = -1;
642 for (
int bin = 1; bin < h->GetNbinsX() + 1; bin++)
644 double c = h->GetBinContent(bin);
645 double max = h->GetMaximum();
646 int bincenter = h->GetBinCenter(bin);
649 getmaxtime = bincenter;
650 if (getmaxtime != -1)
662 Double_t logymin = std::log10(ymin);
663 Double_t logymax = std::log10(ymax);
664 Double_t binwidth = (logymax - logymin) / ybins_in;
665 Double_t ybins[ybins_in + 1];
667 for (Int_t
i = 0;
i <= ybins_in + 1;
i++)
669 ybins[
i] = pow(10, logymin +
i * binwidth);
672 TH2F*
h =
new TH2F(name.c_str(), title.c_str(), xbins_in,
xmin,
xmax, ybins_in, ybins);