ATLAS Offline Software
PadTdsValidationTree.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 namespace NSWL1{
8  //------------------------------------------------------------------------------
10  m_tree(NULL),
11  m_nPadHits(NULL),
12  m_padGlobalX(NULL),
13  m_padGlobalY(NULL),
14  m_padGlobalZ(NULL),
15  m_padDelayedTime(NULL),
16  m_padBCHR(NULL),
17  m_padGlobalCornerX(NULL),
18  m_padGlobalCornerY(NULL),
19  m_padGlobalCornerZ(NULL),
20  m_padTruthHitGlobalX(NULL),
21  m_padTruthHitGlobalY(NULL),
22  m_padTruthHitGlobalZ(NULL),
23  m_padEtaIdFromOfflineId(NULL),
24  m_padPhiIdFromOfflineId(NULL),
25  m_padSectorIdFromOfflineId(NULL),
26  m_padSectorTypeFromOfflineId(NULL),
27  m_padGasGapIdFromOfflineId(NULL),
28  m_padModuleIdFromOfflineId(NULL),
29  m_padMultipletIdFromOfflineId(NULL),
30  m_padSideIdFromOfflineId(NULL),
31  m_offlineIdPadEtaConverted(NULL),
32  m_offlineIdPadPhiConverted(NULL),
33  m_padEtaIdFromOldSimu(NULL),
34  m_padPhiIdFromOldSimu(NULL)
35  {
36  }
37  //------------------------------------------------------------------------------
39  {
40  bool success=false;
41  if(tree){
42  m_tree = tree;
43  m_nPadHits = new std::vector<int>();
44  m_padGlobalX = new std::vector<float>();
45  m_padGlobalY = new std::vector<float>();
46  m_padGlobalZ = new std::vector<float>();
47  m_padDelayedTime = new std::vector<float>();
48  m_padBCHR = new std::vector<int>();
49  m_padGlobalCornerX = new std::vector<float>();
50  m_padGlobalCornerY = new std::vector<float>();
51  m_padGlobalCornerZ = new std::vector<float>();
52  m_padTruthHitGlobalX = new std::vector<float>();
53  m_padTruthHitGlobalY = new std::vector<float>();
54  m_padTruthHitGlobalZ = new std::vector<float>();
55  m_padEtaIdFromOfflineId = new std::vector<int>();
56  m_padPhiIdFromOfflineId = new std::vector<int>();
57  m_padSectorIdFromOfflineId = new std::vector<int>();
58  m_padSectorTypeFromOfflineId = new std::vector<int>();
59  m_padGasGapIdFromOfflineId = new std::vector<int>();
60  m_padModuleIdFromOfflineId = new std::vector<int>();
61  m_padMultipletIdFromOfflineId = new std::vector<int>();
62  m_padSideIdFromOfflineId = new std::vector<int>();
63  m_offlineIdPadEtaConverted = new std::vector<int>();
64  m_offlineIdPadPhiConverted = new std::vector<int>();
65  m_padEtaIdFromOldSimu = new std::vector<int>();
66  m_padPhiIdFromOldSimu = new std::vector<int>();
67 
68  m_tree->Branch("nPadHits", &m_nPadHits);
69  m_tree->Branch("padGlobalX", &m_padGlobalX);
70  m_tree->Branch("padGlobalY", &m_padGlobalY);
71  m_tree->Branch("padGlobalZ", &m_padGlobalZ);
72  m_tree->Branch("padDelayedTime", &m_padDelayedTime);
73  m_tree->Branch("padBCHR", &m_padBCHR);
74  m_tree->Branch("padGlobalCornerX", &m_padGlobalCornerX);
75  m_tree->Branch("padGlobalCornerY", &m_padGlobalCornerY);
76  m_tree->Branch("padGlobalCornerZ", &m_padGlobalCornerZ);
77  m_tree->Branch("padTruthHitGlobalX", &m_padTruthHitGlobalX);
78  m_tree->Branch("padTruthHitGlobalY", &m_padTruthHitGlobalY);
79  m_tree->Branch("padTruthHitGlobalZ", &m_padTruthHitGlobalZ);
80  m_tree->Branch("padEtaIdFromOfflineId", &m_padEtaIdFromOfflineId);
81  m_tree->Branch("padPhiIdFromOfflineId", &m_padPhiIdFromOfflineId);
82  m_tree->Branch("padSectorIdFromOfflineId", &m_padSectorIdFromOfflineId);
83  m_tree->Branch("padSectorTypeFromOfflineId", &m_padSectorTypeFromOfflineId);
84  m_tree->Branch("padGasGapIdFromOfflineId", &m_padGasGapIdFromOfflineId);
85  m_tree->Branch("padModuleIdFromOfflineId", &m_padModuleIdFromOfflineId);
86  m_tree->Branch("padMultipletIdFromOfflineId", &m_padMultipletIdFromOfflineId);
87  m_tree->Branch("padSideIdFromOfflineId", &m_padSideIdFromOfflineId);
88  m_tree->Branch("offlineIdPadEtaIdConverted", &m_offlineIdPadEtaConverted);
89  m_tree->Branch("offlineIdPadPhiIdConverted", &m_offlineIdPadPhiConverted);
90  m_tree->Branch("padEtaIdFromOldSimu", &m_padEtaIdFromOldSimu);
91  m_tree->Branch("padPhiIdFromOldSimu", &m_padPhiIdFromOldSimu);
92  success = true;
93  }
94  return success;
95  }
96  //------------------------------------------------------------------------------
98  {
99  if(m_tree){
100  m_nPadHits->clear();
101  m_padGlobalX->clear();
102  m_padGlobalY->clear();
103  m_padGlobalZ->clear();
104  m_padDelayedTime->clear();
105  m_padBCHR->clear();
106  m_padGlobalCornerX->clear();
107  m_padGlobalCornerY->clear();
108  m_padGlobalCornerZ->clear();
109  m_padTruthHitGlobalX->clear();
110  m_padTruthHitGlobalY->clear();
111  m_padTruthHitGlobalZ->clear();
112  m_padEtaIdFromOfflineId->clear();
113  m_padPhiIdFromOfflineId->clear();
119  m_padSideIdFromOfflineId->clear();
122  m_padEtaIdFromOldSimu->clear();
123  m_padPhiIdFromOldSimu->clear();
124  }
125  return true;
126  }
127  //------------------------------------------------------------------------------
129  {
130  m_nPadHits->push_back(num);
131  }
132  //------------------------------------------------------------------------------
134  {
135  m_padGlobalX->push_back(pos.x());
136  m_padGlobalY->push_back(pos.y());
137  m_padGlobalZ->push_back(pos.z());
138  }
139  //------------------------------------------------------------------------------
140  void PadTdsValidationTree::fill_hit_global_corner_pos(const std::vector<Amg::Vector3D> &pos) const
141  {
142  // Logic is 4-corners:
143  // x1,y1 : Lower left (locally)
144  // x2,y2 : Lower right (locally) s.t. y1=y2
145  // x3,y3 : Upper left (locally)
146  // x4,y4 : Upper right (locally) s.t. y3=y4
147  for(auto corner : pos) {
148  m_padGlobalCornerX->push_back(corner.x());
149  m_padGlobalCornerY->push_back(corner.y());
150  m_padGlobalCornerZ->push_back(corner.z());
151  }
152  }
153  //------------------------------------------------------------------------------
155  {
156  m_padTruthHitGlobalX->push_back(pos.x());
157  m_padTruthHitGlobalY->push_back(pos.y());
158  m_padTruthHitGlobalZ->push_back(pos.z());
159  }
160  //------------------------------------------------------------------------------
161  void PadTdsValidationTree::fill_offlineid_info(const PadOfflineData &o, float bin_offset) const
162  {
163  m_padEtaIdFromOfflineId->push_back ( o.padEtaId() + bin_offset );
164  m_padPhiIdFromOfflineId->push_back ( o.padPhiId() + bin_offset );
165  m_padSideIdFromOfflineId->push_back ( o.sideId() );
166  m_padModuleIdFromOfflineId->push_back ( o.moduleId() );
167  m_padSectorIdFromOfflineId->push_back ( o.sectorId() );
168  m_padSectorTypeFromOfflineId->push_back ( o.sectorType() );
169  m_padMultipletIdFromOfflineId->push_back ( o.multipletId() );
170  m_padGasGapIdFromOfflineId->push_back ( o.gasGapId() );
171  m_padDelayedTime->push_back ( o.time() );
172  // For debugging - use w/ CARE!!! ASM 16/3/17
173  uint16_t bc_tag = o.BC_Tag();
174  uint16_t bc_max = 0xFFFF;
175  int bc_hr = -999;
176  if((bc_tag >> 15) == 1) { // 400 BC
177  bc_hr = (int) ((~bc_tag)*(-1)) - (int) bc_max - 1;
178  } else {
179  bc_hr = (int) bc_tag;
180  }
181  m_padBCHR->push_back( bc_hr );
182  }
183  //------------------------------------------------------------------------------
184  void PadTdsValidationTree::fill_matched_old_id_new_id(const std::pair<int,int> &old_id, std::pair<int,int> &new_id) const
185  {
186  m_padEtaIdFromOldSimu->push_back(old_id.first );
187  m_padPhiIdFromOldSimu->push_back(old_id.second);
188  m_offlineIdPadEtaConverted->push_back(new_id.first );
189  m_offlineIdPadPhiConverted->push_back(new_id.second);
190  }
191  //------------------------------------------------------------------------------
192 }
NSWL1::PadTdsValidationTree::m_padGlobalX
std::vector< float > * m_padGlobalX
global position X of the PAD hit
Definition: PadTdsValidationTree.h:56
NSWL1::PadTdsValidationTree::m_padTruthHitGlobalY
std::vector< float > * m_padTruthHitGlobalY
global position Y of the truth hit associated to the PAD hit
Definition: PadTdsValidationTree.h:65
NSWL1::PadTdsValidationTree::m_padPhiIdFromOfflineId
std::vector< int > * m_padPhiIdFromOfflineId
PAD phi Id from the offline Id.
Definition: PadTdsValidationTree.h:68
NSWL1::PadTdsValidationTree::PadTdsValidationTree
PadTdsValidationTree()
Definition: PadTdsValidationTree.cxx:9
NSWL1::PadTdsValidationTree::m_padGlobalZ
std::vector< float > * m_padGlobalZ
global position Z of the PAD hit
Definition: PadTdsValidationTree.h:58
NSWL1::PadTdsValidationTree::reset_ntuple_variables
bool reset_ntuple_variables()
clear all vectors of internal containers
Definition: PadTdsValidationTree.cxx:97
NSWL1::PadTdsValidationTree::m_padEtaIdFromOfflineId
std::vector< int > * m_padEtaIdFromOfflineId
PAD eta Id from the offline Id.
Definition: PadTdsValidationTree.h:67
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
NSWL1::PadTdsValidationTree::m_padBCHR
std::vector< int > * m_padBCHR
human readable BC info of the PAD
Definition: PadTdsValidationTree.h:60
NSWL1::PadOfflineData::moduleId
int moduleId() const
get the physics module (ranging from 1 at lowest R to 3 at highest R)
Definition: PadOfflineData.cxx:40
NSWL1::PadTdsValidationTree::fill_num_pad_hits
void fill_num_pad_hits(size_t num) const
store the number of hits for one pad
Definition: PadTdsValidationTree.cxx:128
tree
TChain * tree
Definition: tile_monitor.h:30
NSWL1::PadTdsValidationTree::m_offlineIdPadPhiConverted
std::vector< int > * m_offlineIdPadPhiConverted
PAD phi Id from the offline Id that were converted.
Definition: PadTdsValidationTree.h:76
NSWL1::PadTdsValidationTree::m_padGlobalCornerZ
std::vector< float > * m_padGlobalCornerZ
global position Z of the PAD hit corner
Definition: PadTdsValidationTree.h:63
NSWL1::PadOfflineData::sectorType
int sectorType() const
get the sector type (ranging from 0 to 1, Small and Large)
Definition: PadOfflineData.cxx:50
NSWL1::PadTdsValidationTree::m_padGasGapIdFromOfflineId
std::vector< int > * m_padGasGapIdFromOfflineId
PAD gas gap Id from the offline Id.
Definition: PadTdsValidationTree.h:71
NSWL1::PadTdsValidationTree::m_nPadHits
std::vector< int > * m_nPadHits
number of PAD hit delivered
Definition: PadTdsValidationTree.h:55
NSWL1::PadTdsValidationTree::m_padGlobalCornerY
std::vector< float > * m_padGlobalCornerY
global position Y of the PAD hit corner
Definition: PadTdsValidationTree.h:62
NSWL1::PadOfflineData::padEtaId
int padEtaId() const
get the pad eta channel
Definition: PadOfflineData.cxx:70
NSWL1::PadTdsValidationTree::fill_matched_old_id_new_id
void fill_matched_old_id_new_id(const std::pair< int, int > &old_id, std::pair< int, int > &new_id) const
Definition: PadTdsValidationTree.cxx:184
NSWL1::PadTdsValidationTree::m_padSectorTypeFromOfflineId
std::vector< int > * m_padSectorTypeFromOfflineId
PAD sector type from the offline Id.
Definition: PadTdsValidationTree.h:70
NSWL1::PadTdsValidationTree::init_tree
bool init_tree(TTree *tree)
initialize the output containers and the tree
Definition: PadTdsValidationTree.cxx:38
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
NSWL1::PadOfflineData
class modeling the pad hit fragment for the NSW L1 offline simulation
Definition: PadOfflineData.h:36
NSWL1::PadTdsValidationTree::fill_hit_global_pos
void fill_hit_global_pos(const Amg::Vector3D &pos) const
store global position of a hit
Definition: PadTdsValidationTree.cxx:133
NSWL1::PadTdsValidationTree::m_offlineIdPadEtaConverted
std::vector< int > * m_offlineIdPadEtaConverted
PAD eta Id from the offline Id that were converted.
Definition: PadTdsValidationTree.h:75
NSWL1::PadTdsValidationTree::m_padEtaIdFromOldSimu
std::vector< int > * m_padEtaIdFromOldSimu
PAD eta Id from the standalone simulation code.
Definition: PadTdsValidationTree.h:77
NSWL1::PadTdsValidationTree::m_padGlobalY
std::vector< float > * m_padGlobalY
global position Y of the PAD hit
Definition: PadTdsValidationTree.h:57
NSWL1::PadTdsValidationTree::m_padSectorIdFromOfflineId
std::vector< int > * m_padSectorIdFromOfflineId
PAD sector Id from the offline Id.
Definition: PadTdsValidationTree.h:69
NSWL1::PadTdsValidationTree::m_padGlobalCornerX
std::vector< float > * m_padGlobalCornerX
global position X of the PAD hit corner
Definition: PadTdsValidationTree.h:61
NSWL1::PadOfflineData::padPhiId
int padPhiId() const
get the pad phi channel
Definition: PadOfflineData.cxx:75
trigbs_pickEvents.num
num
Definition: trigbs_pickEvents.py:76
NSWL1::PadOfflineData::sideId
int sideId() const
helper methods decoding the hit fragment position within the NSW detector
Definition: PadOfflineData.cxx:35
NSWL1::PadOfflineData::multipletId
int multipletId() const
get the multiplet (ranging from 1 to 2, 1 is at lowest |z|)
Definition: PadOfflineData.cxx:55
NSWL1::PadTdsValidationTree::m_padModuleIdFromOfflineId
std::vector< int > * m_padModuleIdFromOfflineId
PAD module Id from the offline Id.
Definition: PadTdsValidationTree.h:72
NSWL1::PadTdsValidationTree::fill_offlineid_info
void fill_offlineid_info(const PadOfflineData &o, float bin_offset) const
store eta,phi indices + sector,layer
Definition: PadTdsValidationTree.cxx:161
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
NSWL1::PadTdsValidationTree::m_padPhiIdFromOldSimu
std::vector< int > * m_padPhiIdFromOldSimu
PAD phi Id from the standalone simulation code.
Definition: PadTdsValidationTree.h:78
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
NSWL1::PadTdsValidationTree::fill_truth_hit_global_pos
void fill_truth_hit_global_pos(const Amg::Vector3D &pos) const
store global position of a truth-matched hit
Definition: PadTdsValidationTree.cxx:154
NSWL1::PadOfflineData::time
float time() const
get the arrival time after the delay is applied
Definition: PadOfflineData.cxx:32
NSWL1::PadTdsValidationTree::m_padDelayedTime
std::vector< float > * m_padDelayedTime
delayed time of the PAD hit
Definition: PadTdsValidationTree.h:59
NSWL1::PadTdsValidationTree::m_tree
TTree * m_tree
ntuple for analysis
Definition: PadTdsValidationTree.h:54
NSWL1::PadOfflineData::gasGapId
int gasGapId() const
get the gas gap (ranging from 1 to 4, 1 is at lowest |z|)
Definition: PadOfflineData.cxx:60
NSWL1::PadOfflineData::sectorId
int sectorId() const
get the sector (ranging from 1 to 8)
Definition: PadOfflineData.cxx:45
NSWL1::PadOfflineData::BC_Tag
uint16_t BC_Tag() const
get the BCID
Definition: PadOfflineData.cxx:31
NSWL1
A trigger trigger candidate for a stgc sector.
Definition: NSWL1Simulation.cxx:9
NSWL1::PadTdsValidationTree::fill_hit_global_corner_pos
void fill_hit_global_corner_pos(const std::vector< Amg::Vector3D > &pos) const
store global position of a hit
Definition: PadTdsValidationTree.cxx:140
NSWL1::PadTdsValidationTree::m_padSideIdFromOfflineId
std::vector< int > * m_padSideIdFromOfflineId
PAD side Id from the offline Id.
Definition: PadTdsValidationTree.h:74
NSWL1::PadTdsValidationTree::m_padTruthHitGlobalZ
std::vector< float > * m_padTruthHitGlobalZ
global position Z of the truth hit associated to the PAD hit
Definition: PadTdsValidationTree.h:66
PadTdsValidationTree.h
NSWL1::PadTdsValidationTree::m_padTruthHitGlobalX
std::vector< float > * m_padTruthHitGlobalX
global position X of the truth hit associated to the PAD hit
Definition: PadTdsValidationTree.h:64
NSWL1::PadTdsValidationTree::m_padMultipletIdFromOfflineId
std::vector< int > * m_padMultipletIdFromOfflineId
PAD multilayer Id from the offline Id.
Definition: PadTdsValidationTree.h:73