11 #include "GaudiKernel/MsgStream.h"
12 #include "GaudiKernel/ITHistSvc.h"
82 ATH_MSG_INFO(
"Hough constants method needs idealized geometry > 0, aborting.");
83 return StatusCode::FAILURE;
109 ATH_MSG_ERROR(
"q/pt bin information not set in matrix element job options!");
110 return StatusCode::FAILURE;
119 return StatusCode::SUCCESS;
173 m_h_trackQoP_okHits =
new TH1I(
"h_trackQoP_okHits",
"half inverse pt of tracks passing hit check",
175 m_h_trackQoP_okRegion =
new TH1I(
"h_trackQoP_okRegion",
"half inverse pt of tracks passing region check",
177 m_h_nHit =
new TH1I(
"h_nHit",
"number of hits in sector", 100, 0, 100);
183 return StatusCode::SUCCESS;
212 if (tracks.empty()) {
214 return StatusCode::SUCCESS;
218 std::map<int, std::vector<FPGATrackSimHit>> barcode_hits =
makeBarcodeMap(
hits, tracks);
226 std::vector<FPGATrackSimHit> & track_hits = barcode_hits[
track.getBarcode()];
232 for (
int iSlice = 0; iSlice<nSlices; iSlice++){
234 for (
auto & iHit : track_hits) {
237 std::vector<FPGATrackSimHit> sector_hits;
239 if (!success)
continue;
244 if (region < 0 || region >=
m_nRegions)
continue;
248 std::vector<std::shared_ptr<const FPGATrackSimRoad>> houghRoads;
250 std::vector<std::shared_ptr<const FPGATrackSimHit>> phits;
252 for (
const FPGATrackSimHit& hit : sector_hits) phits.emplace_back(std::make_shared<const FPGATrackSimHit>(hit));
257 if (!houghRoads.empty()){
262 for (
auto const &
hr : houghRoads){
267 std::vector<module_t> modules(
m_nLayers);
269 acc.pars.qOverPt =
y;
280 return StatusCode::SUCCESS;
284 std::vector<module_t> modules(
m_nLayers);
296 return StatusCode::SUCCESS;
304 std::vector<FPGATrackSimHit>
hits;
317 std::vector<FPGATrackSimCluster> clustered_hits;
323 std::vector<FPGATrackSimCluster> spacepoints;
329 std::vector<FPGATrackSimTowerInputHeader>
towers = logicalHeader.
towers();
330 for (
auto &tower :
towers) {
331 std::vector<FPGATrackSimHit>
const & towerHits = tower.hits();
343 std::vector<FPGATrackSimTruthTrack> training_tracks;
350 double pt_GeV =
pt / 1000;
358 double eta = TMath::ASinH(
track.getPZ() /
pt);
364 <<
" pdgcode = " <<
track.getPDGCode());
369 return training_tracks;
376 std::map<int, std::vector<FPGATrackSimHit>> map;
380 map[
track.getBarcode()] = std::vector<FPGATrackSimHit>();
385 int barcode = hit.getTruth().best_barcode();
389 if (
it != map.end()) (*it).second.push_back(hit);
428 if (old_section == new_section) {
437 rmax = phi_max - phi_min;
446 rmax = phi_max - phi_min;
485 if (old_isEC != new_isEC) {
491 else if (old_disk == new_disk) {
493 ATH_MSG_DEBUG(
"Two modules hit in same physical disk " << old_disk);
498 ATH_MSG_DEBUG(
"Keeping the lower-z of the two disks (" << old_disk <<
", " << new_disk <<
") hit");
523 if (!hit.isMapped()){
531 int layer = hit.getLayer();
533 if (layer_count[
layer] == 0){
534 layer_count[
layer]++;
535 sector_hits[
layer] = hit;
537 else if (layer_count[
layer] == 1) {
538 layer_count[
layer]++;
551 ATH_MSG_DEBUG(
"Too many hits on a plane, exiting filterHitsSec");
566 if (layer_count[
i] == 0)
576 if (sector_hits[
i].isPixel()) {
584 ATH_MSG_DEBUG(
"Found " << num_sp <<
" spacepoints after removing duplicates.");
596 if (num_sp < minSpacePlusPixel) {
597 ATH_MSG_DEBUG(
"Not enough pixel hits + spacepoints (" << num_sp <<
" < " << minSpacePlusPixel <<
")");
609 std::vector<bool> region_mask(
m_nRegions,
true);
613 for (
int region = 0; region <
m_nRegions; region++) {
616 region_mask[region] =
false;
620 region_mask[region] =
false;
627 for (
int region = 0; region <
m_nRegions; region++)
628 if (region_mask[region])
639 std::vector<module_t> modules(
m_nLayers);
645 double qoverpt =
track.getQ() /
track.getPt();
653 std::string module_printout =
"";
657 if (
m_single) modules[
i] = sector_hits[
i].getIdentifierHash();
659 modules[
i] = sectorbin;
673 ATH_MSG_DEBUG(
"Generating track in sectorbin = " << sectorbin <<
" with modules: " << module_printout);
677 const int ToKeep[13] = {2200,2564,2861,3831,5368,14169,14173,20442,20446,29625,29629,42176,42180};
678 bool keepThis =
true;
679 for (
int i = 0;
i < 13;
i++) {
680 if (modules[
i] != ToKeep[
i] && modules[
i] != -1) {
686 for (
int i = 0;
i < 13;
i++) modules[
i] = -1;
689 for (
int i = 0;
i < 13;
i++) {
696 double y = accumulator.second.pars.qOverPt;
697 double x = accumulator.second.pars.phi;
700 std::vector<float> coords;
710 int other_layer = (sector_hits[
i].getSide() == 0) ?
i + 1 :
i - 1;
714 std::vector<float> coords_tmp;
726 coords.push_back(coords_tmp[1]);
731 if (sector_hits[
i].getDim() == 2 || (sector_hits[
i].getHitType() ==
HitType::spacepoint && (sector_hits[
i].getPhysLayer() % 2) == 1)) {
733 coords.push_back(coords_tmp[0]);
744 assert(coords.size() == (
size_t)
m_nDim);
745 acc.hit_coords = coords;
746 acc.hit_coordsG = coords;
751 acc.pars.qOverPt = (
y / 1000.0) -
track.getQOverPt();
758 acc.track_bins.push_back(
bins);
762 while (
acc.pars.phi < 0)
acc.pars.phi += 2*
M_PI;
769 acc.hit_x_QoP[
i] = coords[
i] *
acc.pars.qOverPt;
770 acc.hit_xG_HIP[
i] = coords[
i] *
acc.pars.qOverPt;
771 acc.hit_x_d0[
i] = coords[
i] *
acc.pars.d0;
772 acc.hit_x_z0[
i] = coords[
i] *
acc.pars.z0;
773 acc.hit_x_eta[
i] = coords[
i] *
acc.pars.eta;
774 acc.hit_xG_eta[
i] = coords[
i] *
acc.pars.eta;
775 acc.hit_x_phi[
i] = coords[
i] *
acc.pars.phi;
777 for (
int j =
i; j <
m_nDim; j++)
778 acc.covariance[
i *
m_nDim + j] = coords[
i] * coords[j];
780 for (
int j =
i; j <
m_nDim; j++)
781 acc.covarianceG[
i *
m_nDim + j] = coords[
i] * coords[j];
784 accumulator = {modules,
acc};
785 return StatusCode::SUCCESS;
800 for (
int region = 0; region <
m_nRegions; region++) {
802 std::stringstream
name;
803 std::stringstream
title;
804 name <<
"am" << region;
805 title <<
"Ambank " << region <<
" parameters";
806 TTree*
tree =
new TTree(
name.str().c_str(),
title.str().c_str());
814 double coverage = sector_info.second.track_bins.size();
823 return StatusCode::SUCCESS;
829 TTree* sliceTree =
new TTree(
"slice",
"Region slice boundaries");
844 sliceTree->Branch(
"d0_slices", &
m_nBins.
d0);
845 sliceTree->Branch(
"phi_slices", &
m_nBins.
phi);
846 sliceTree->Branch(
"z0_slices", &
m_nBins.
z0);
847 sliceTree->Branch(
"eta_slices", &
m_nBins.
eta);