4 #include <pdbcalbase/PdbParameterMap.h>
31 #include <mvtx/MvtxDefs.h>
33 #include <HepMC/GenEvent.h>
34 #include <HepMC/GenVertex.h>
38 #include <TDatabasePDG.h>
44 #include <TLorentzVector.h>
48 #include <rapidjson/document.h>
49 #include <rapidjson/ostreamwrapper.h>
50 #include <rapidjson/prettywriter.h>
52 #include <boost/format.hpp>
53 #include <boost/property_tree/json_parser.hpp>
54 #include <boost/property_tree/ptree.hpp>
55 #include <boost/property_tree/xml_parser.hpp>
72 , _svtxevalstack(nullptr)
73 , m_hitsetcont(nullptr)
75 , m_truthInfo(nullptr)
80 , m_hitStaveLayer(nullptr)
81 , m_hitModuleHalfStave(nullptr)
82 , m_hitChipModule(nullptr)
83 , m_hitLayerMap(nullptr)
84 , m_hitPixelPhiMap(nullptr)
85 , m_hitPixelPhiMapHL(nullptr)
86 , m_hitPixelZMap(nullptr)
87 , m_Multiplicity(nullptr)
88 , m_LayerMultiplicity(nullptr)
89 , m_LayerChipMultiplicity(nullptr)
98 _f =
new TFile((
_foutname +
string(
".root")).c_str(),
"RECREATE");
110 m_hNorm =
new TH1F(
"hNormalization",
111 "Normalization;Items;Summed quantity", 10, .5, 10.5);
113 m_hNorm->GetXaxis()->SetBinLabel(i++,
"IntegratedLumi");
114 m_hNorm->GetXaxis()->SetBinLabel(i++,
"Event");
115 m_hNorm->GetXaxis()->LabelsOption(
"v");
118 "Charged particle #eta distribution;#eta;Count",
121 "Vertex z distribution;z [cm];Count",
124 m_hitLayerMap =
new TH3F(
"hitLayerMap",
"hitLayerMap", 600, -10, 10, 600, -10, 10, 10, -.5, 9.5);
125 m_hitLayerMap->SetTitle(
"hitLayerMap;x [mm];y [mm];Half Layers");
134 m_hitStaveLayer =
new TH2F(
"hitStaveLayer",
"hitStaveLayer", 100, -.5, 100 - .5, 10, -.5, 9.5);
136 m_hitModuleHalfStave =
new TH2F(
"hitModuleHalfStave",
"hitModuleHalfStave", 100, -.5, 100 - .5, 10, -.5, 9.5);
138 m_hitChipModule =
new TH2F(
"hitChipModule",
"hitChipModule", 100, -.5, 100 - .5, 10, -.5, 9.5);
141 m_Multiplicity =
new TH1F(
"Multiplicity",
"Multiplicity", 10000, -.5, 10000 - .5);
144 m_LayerMultiplicity =
new TH2F(
"LayerMultiplicity",
"LayerMultiplicity", 3, -.5, 2.5, 1000, -.5, 1000 - .5);
147 m_LayerChipMultiplicity =
new TH3F(
"LayerChipMultiplicity",
"LayerChipMultiplicity", 3, -.5, 2.5,
kNCHip, -.5,
kNCHip - .5, 1000, -.5, 1000 - .5);
155 m_hitsetcont = findNode::getClass<TrkrHitSetContainerv1>(topNode,
"TRKR_HITSET");
158 std::cout <<
PHWHERE <<
"ERROR: Can't find node TrkrHitSetContainer" << std::endl;
162 findNode::getClass<PHG4CylinderGeomContainer>(topNode,
"CYLINDERGEOM_MVTX");
165 std::cout <<
PHWHERE <<
"ERROR: Can't find node CYLINDERCELLGEOM_MVTX" << std::endl;
169 m_truthInfo = findNode::getClass<PHG4TruthInfoContainer>(topNode,
"G4TruthInfo");
172 std::cout <<
PHWHERE <<
"ERROR: Can't find node G4TruthInfo" << std::endl;
176 m_Flags = findNode::getClass<PdbParameterMap>(topNode,
"HFMLTrigger_HepMCTriggerFlags");
179 cout <<
"HFMLTriggerOccupancy::InitRun - WARNING - missing HFMLTrigger_HepMCTriggerFlags" << endl;
249 const auto primary_range =
251 for (
auto particle_iter =
253 particle_iter != primary_range.second;
258 TParticlePDG *pdg_p = TDatabasePDG::Instance()->GetParticle(
261 if (fabs(pdg_p->Charge()) > 0)
264 if (pvec.Perp2() > 0)
274 vector<vector<vector<int> > >
286 multiplicity_vec[
layer].resize(n_stave, vector<int>(
kNCHip, 0));
294 hitset_iter != hitset_range.second;
300 hit_iter != hit_range.second;
304 TrkrHit* hit = hit_iter->second;
307 if (layer < _nlayers_maps)
319 assert((
int)pixel_x < geom->get_NX());
320 assert((
int)pixel_z < geom->get_NZ());
369 cout <<
"HFMLTriggerOccupancy::process_event - MVTX hit "
370 <<
"layer " << layer <<
"\t"
371 <<
"Stave " << stave <<
"\t"
372 <<
"Chip " << chip <<
"\t"
373 <<
"Pixel x " << pixel_x <<
"\t"
374 <<
"Pixel z " << pixel_z <<
"\t"
376 <<
"(" << world_coords.x() <<
"," << world_coords.y() <<
"," << world_coords.z() <<
")" << endl;
390 assert(layer < multiplicity_vec.size());
391 auto& multiplicity_layer = multiplicity_vec[
layer];
392 assert(static_cast<size_t>(stave) < multiplicity_layer.size());
393 auto& multiplicity_stave = multiplicity_layer[stave];
394 assert(static_cast<size_t>(chip) < multiplicity_stave.size());
395 multiplicity_stave[chip]++;
414 for (
auto& multiplicity_layer : multiplicity_vec)
417 for (
auto& multiplicity_stave : multiplicity_layer)
420 for (
auto& multiplicity_chip : multiplicity_stave)
430 cout <<
"HFMLTriggerOccupancy::process_event - fill layer " << layer <<
" stave. " << stave <<
"Accumulated chips = "
463 cout <<
"HFMLTriggerOccupancy::End - output to " <<
_foutname <<
".*" << endl;