28 #include <CLHEP/Units/SystemOfUnits.h>
30 #include <boost/format.hpp>
41 using namespace CLHEP;
44 unsigned int minLayer,
45 unsigned int m_maxLayer,
48 , m_outputFileName(outputfilename)
49 , m_minLayer(minLayer)
50 , m_maxLayer(m_maxLayer)
71 for (
unsigned int i = 0;
i < hm->
nHistos();
i++)
75 TTree* T_Index =
new TTree(
"T_Index",
"T_Index");
92 cout <<
"TPCIntegratedCharge::get_HistoManager - Making PHTFileServer " <<
m_outputFileName
99 TH1D*
h =
new TH1D(
"hNormalization",
100 "Normalization;Items;Summed quantity", 10, .5, 10.5);
102 h->GetXaxis()->SetBinLabel(i++,
"Event count");
103 h->GetXaxis()->SetBinLabel(i++,
"Collision count");
104 h->GetXaxis()->SetBinLabel(i++,
"TPC G4Hit");
105 h->GetXaxis()->SetBinLabel(i++,
"TPC G4Hit Edep");
106 h->GetXaxis()->SetBinLabel(i++,
"TPC Pad Hit");
107 h->GetXaxis()->SetBinLabel(i++,
"TPC Charge e");
108 h->GetXaxis()->SetBinLabel(i++,
"TPC Charge fC");
109 h->GetXaxis()->LabelsOption(
"v");
122 "Number of ADC time-bin hit per channel;Layer ID;Hit number",
126 "Charge integrated over drift window per channel;Layer ID;Charge [fC]",
128 1000, 0, 1e7 * eplus / (1
e-15 * coulomb)));
131 "Number of ADC time-bin hit integrated over channels per layer;Layer ID;Hit number",
133 10000, -.5, 99999.5));
135 "Charge integrated over drift window and channel per layer;Layer ID;Charge [fC]",
137 10000, 0, 1000 * 4e6 * eplus / (1
e-15 * coulomb)));
146 TH1D* h_norm =
dynamic_cast<TH1D*
>(hm->
getHisto(
"hNormalization"));
149 PHG4HitContainer* g4hit = findNode::getClass<PHG4HitContainer>(topNode,
"G4HIT_SVTX");
152 cout <<
"TPCIntegratedCharge::process_event - Could not locate g4 hit node G4HIT_SVTX" << endl;
155 PHG4CellContainer* cells = findNode::getClass<PHG4CellContainer>(topNode,
"G4CELL_SVTX");
158 cout <<
"TPCIntegratedCharge::process_event - could not locate cell node "
159 <<
"G4CELL_SVTX" << endl;
166 cout <<
"TPCIntegratedCharge::process_event - could not locate geo node "
167 <<
"CYLINDERCELLGEOM_SVTX" << endl;
170 PHHepMCGenEventMap* geneventmap = findNode::getClass<PHHepMCGenEventMap>(topNode,
"PHHepMCGenEventMap");
173 static bool once =
true;
178 std::cout <<
"TPCIntegratedCharge::process_event - missing node PHHepMCGenEventMap. Skipping HepMC stat." << std::endl;
183 h_norm->Fill(
"Collision count", geneventmap->
size());
192 const double edep = hiter->second->get_edep();
193 h_norm->Fill(
"TPC G4Hit Edep", edep);
194 h_norm->Fill(
"TPC G4Hit", 1);
200 unsigned int nZBins = 0;
201 vector<array<vector<int>, 2> > layerChanCellHit(
m_maxLayer + 1);
202 vector<array<vector<double>, 2> > layerChanCellCharge(
m_maxLayer + 1);
215 cout <<
"TPCIntegratedCharge::process_event - init layer " <<
layer <<
" with "
216 <<
"nphibins = " << nphibins
217 <<
", layerGeom->get_zbins() = " << layerGeom->
get_zbins() << endl;
227 if ((
int) nZBins != layerGeom->
get_zbins())
229 cout <<
"TPCIntegratedCharge::process_event - Fatal Error - nZBin at layer " <<
layer <<
" is " << layerGeom->
get_zbins()
230 <<
", which is different from previous layers of nZBin = " << nZBins << endl;
235 layerChanCellHit[
layer][0].resize(nphibins, 0);
236 layerChanCellHit[
layer][1].resize(nphibins, 0);
238 layerChanCellCharge[
layer][0].resize(nphibins, 0);
239 layerChanCellCharge[
layer][1].resize(nphibins, 0);
246 celliter != cellrange.second;
256 cout <<
"TPCIntegratedCharge::process_event - process cell: "
257 <<
"layer = " << layer
258 <<
", get_phibin = " << phibin
259 <<
", get_zbin = " << zbin
260 <<
", get_edep = " << cell->
get_edep()
261 <<
", get_eion = " << cell->
get_eion() <<
": "
262 <<
"Class = " << cell->ClassName();
266 if (layer < m_minLayer or layer >
m_maxLayer)
continue;
270 cout <<
"TPCIntegratedCharge::process_event - invalid cell: "
271 <<
"layer = " << layer
272 <<
", get_phibin = " << phibin
273 <<
", get_zbin = " << zbin
274 <<
", get_edep = " << cell->
get_edep()
275 <<
", get_eion = " << cell->
get_eion() <<
": "
276 <<
"Class = " << cell->ClassName();
282 const int side = (zbin < nZBins / 2) ? 0 : 1;
284 vector<int>& ChanCellHit = layerChanCellHit[
layer][side];
285 vector<double>& ChanCellCharge = layerChanCellCharge[
layer][side];
288 assert(phibin < ChanCellHit.size());
289 assert(phibin < ChanCellHit.size());
291 ChanCellHit[phibin] += 1;
292 ChanCellCharge[phibin] += cell->
get_edep();
296 TH2* hLayerCellHit =
dynamic_cast<TH2*
>(hm->
getHisto(
"hLayerCellHit"));
298 TH2* hLayerCellCharge =
dynamic_cast<TH2*
>(hm->
getHisto(
"hLayerCellCharge"));
300 TH2* hLayerSumCellHit =
dynamic_cast<TH2*
>(hm->
getHisto(
"hLayerSumCellHit"));
302 TH2* hLayerSumCellCharge =
dynamic_cast<TH2*
>(hm->
getHisto(
"hLayerSumCellCharge"));
303 assert(hLayerSumCellCharge);
307 for (
unsigned int side = 0; side < 2; ++side)
310 for (
unsigned int phibin = 0; phibin < layerChanCellHit[
layer][side].size(); ++phibin)
312 const int& hit = layerChanCellHit[
layer][side][phibin];
315 hLayerCellHit->Fill(
layer, hit);
316 h_norm->Fill(
"TPC Pad Hit", hit);
320 cout <<
"TPCIntegratedCharge::process_event - hit: "
322 <<
"at layer = " <<
layer
323 <<
", side = " << side
324 <<
", phibin = " << phibin
331 cout <<
"TPCIntegratedCharge::process_event - hLayerSumCellHit->Fill(" <<
layer <<
", " << sumHit <<
")" << endl;
334 hLayerSumCellHit->Fill(
layer, sumHit);
336 double sum_charge_fC = 0;
337 for (
unsigned int phibin = 0; phibin < layerChanCellCharge[
layer][side].size(); ++phibin)
339 const double& charge_e = layerChanCellCharge[
layer][side][phibin];
340 const double charge_fC = charge_e * eplus / (1
e-15 * coulomb);
341 sum_charge_fC += charge_fC;
343 hLayerCellCharge->Fill(
layer, charge_fC);
345 h_norm->Fill(
"TPC Charge e", charge_e);
346 h_norm->Fill(
"TPC Charge fC", charge_fC);
348 hLayerSumCellCharge->Fill(
layer, sum_charge_fC);
353 h_norm->Fill(
"Event count", 1);
361 static string histname(
"TPCIntegratedCharge_HISTOS");
369 <<
"TPCIntegratedCharge::get_HistoManager - Making Fun4AllHistoManager " << histname