4 #include <pdbcalbase/PdbParameterMap.h>
17 #include <g4mvtx/PHG4CylinderGeom_MVTX.h>
26 #include <trackbase_historic/SvtxCluster.h>
27 #include <trackbase_historic/SvtxClusterMap.h>
28 #include <trackbase_historic/SvtxHit.h>
29 #include <trackbase_historic/SvtxHitMap.h>
32 #include <trackbase_historic/SvtxVertex.h>
33 #include <trackbase_historic/SvtxVertexMap.h>
37 #include <HepMC/GenEvent.h>
38 #include <HepMC/GenVertex.h>
42 #include <TDatabasePDG.h>
48 #include <TLorentzVector.h>
52 #include <rapidjson/document.h>
53 #include <rapidjson/ostreamwrapper.h>
54 #include <rapidjson/prettywriter.h>
56 #include <boost/format.hpp>
57 #include <boost/property_tree/json_parser.hpp>
58 #include <boost/property_tree/ptree.hpp>
59 #include <boost/property_tree/xml_parser.hpp>
76 , _svtxevalstack(nullptr)
79 , m_truthInfo(nullptr)
84 , m_hitStaveLayer(nullptr)
85 , m_hitModuleHalfStave(nullptr)
86 , m_hitChipModule(nullptr)
87 , m_hitLayerMap(nullptr)
88 , m_hitPixelPhiMap(nullptr)
89 , m_hitPixelPhiMapHL(nullptr)
90 , m_hitPixelZMap(nullptr)
91 , m_Multiplicity(nullptr)
92 , m_LayerMultiplicity(nullptr)
93 , m_LayerChipMultiplicity(nullptr)
102 _f =
new TFile((
_foutname +
string(
".root")).c_str(),
"RECREATE");
114 m_hNorm =
new TH1F(
"hNormalization",
115 "Normalization;Items;Summed quantity", 10, .5, 10.5);
117 m_hNorm->GetXaxis()->SetBinLabel(i++,
"IntegratedLumi");
118 m_hNorm->GetXaxis()->SetBinLabel(i++,
"Event");
119 m_hNorm->GetXaxis()->LabelsOption(
"v");
122 "Charged particle #eta distribution;#eta;Count",
125 "Vertex z distribution;z [cm];Count",
128 m_hitLayerMap =
new TH3F(
"hitLayerMap",
"hitLayerMap", 600, -10, 10, 600, -10, 10, 10, -.5, 9.5);
129 m_hitLayerMap->SetTitle(
"hitLayerMap;x [mm];y [mm];Half Layers");
138 m_hitStaveLayer =
new TH2F(
"hitStaveLayer",
"hitStaveLayer", 100, -.5, 100 - .5, 10, -.5, 9.5);
140 m_hitModuleHalfStave =
new TH2F(
"hitModuleHalfStave",
"hitModuleHalfStave", 100, -.5, 100 - .5, 10, -.5, 9.5);
142 m_hitChipModule =
new TH2F(
"hitChipModule",
"hitChipModule", 100, -.5, 100 - .5, 10, -.5, 9.5);
145 m_Multiplicity =
new TH1F(
"Multiplicity",
"Multiplicity", 10000, -.5, 10000 - .5);
148 m_LayerMultiplicity =
new TH2F(
"LayerMultiplicity",
"LayerMultiplicity", 3, -.5, 2.5, 1000, -.5, 1000 - .5);
151 m_LayerChipMultiplicity =
new TH3F(
"LayerChipMultiplicity",
"LayerChipMultiplicity", 3, -.5, 2.5,
kNCHip, -.5,
kNCHip - .5, 1000, -.5, 1000 - .5);
159 m_hitMap = findNode::getClass<SvtxHitMap>(topNode,
"SvtxHitMap");
162 std::cout <<
PHWHERE <<
"ERROR: Can't find node SvtxHitMap" << std::endl;
166 findNode::getClass<PHG4CylinderGeomContainer>(topNode,
"CYLINDERGEOM_MVTX");
169 std::cout <<
PHWHERE <<
"ERROR: Can't find node CYLINDERCELLGEOM_MVTX" << std::endl;
173 m_truthInfo = findNode::getClass<PHG4TruthInfoContainer>(topNode,
"G4TruthInfo");
176 std::cout <<
PHWHERE <<
"ERROR: Can't find node G4TruthInfo" << std::endl;
180 m_Flags = findNode::getClass<PdbParameterMap>(topNode,
"HFMLTrigger_HepMCTriggerFlags");
183 cout <<
"HFMLTriggerOccupancy::InitRun - WARNING - missing HFMLTrigger_HepMCTriggerFlags" << endl;
253 const auto primary_range =
255 for (
auto particle_iter =
257 particle_iter != primary_range.second;
262 TParticlePDG *pdg_p = TDatabasePDG::Instance()->GetParticle(
265 if (fabs(pdg_p->Charge()) > 0)
268 if (pvec.Perp2() > 0)
278 vector<vector<vector<int> > >
287 const int n_stave = geom->get_N_staves();
290 multiplicity_vec[
layer].resize(n_stave, vector<int>(
kNCHip, 0));
293 set<unsigned int> mapsHits;
299 SvtxHit* hit = iter->second;
301 unsigned int layer = hit->get_layer();
302 if (layer < _nlayers_maps)
304 unsigned int hitID = hit->get_id();
305 mapsHits.insert(hitID);
307 PHG4Cell* cell = hiteval->get_cell(hit);
309 PHG4CylinderGeom_MVTX* geom =
dynamic_cast<PHG4CylinderGeom_MVTX*
>(
m_Geoms->
GetLayerGeom(layer));
312 TVector3 local_coords = geom->get_local_coords_from_pixel(cell->
get_pixel_index());
317 unsigned int halflayer = (int) pixel_x >= geom->get_NX() / 2 ? 0 : 1;
319 assert((
int) pixel_x < geom->get_NX());
320 assert((
int) pixel_z < geom->get_NZ());
322 unsigned int halfLayerIndex(layer * 2 + halflayer);
357 cout <<
"HFMLTriggerOccupancy::process_event - MVTX hit "
358 <<
"layer " << layer <<
"\t"
363 <<
"(" << world_coords.x() <<
"," << world_coords.y() <<
"," << world_coords.z() <<
")" << endl;
372 m_hitLayerMap->Fill(world_coords.x(), world_coords.y(), halfLayerIndex);
377 assert(layer < multiplicity_vec.size());
378 auto& multiplicity_layer = multiplicity_vec[
layer];
380 auto& multiplicity_stave = multiplicity_layer[cell->
get_stave_index()];
399 for (
auto& multiplicity_layer : multiplicity_vec)
402 for (
auto& multiplicity_stave : multiplicity_layer)
405 for (
auto& multiplicity_chip : multiplicity_stave)
415 cout <<
"HFMLTriggerOccupancy::process_event - fill layer " << layer <<
" stave. " << stave <<
"Accumulated chips = "
448 cout <<
"HFMLTriggerOccupancy::End - output to " <<
_foutname <<
".*" << endl;