ATLAS Offline Software
TauShot.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "tauEvent/TauShot.h"
6 #include "tauEvent/TauDetails.h"
7 //#include <sstream>
8 
9 namespace Analysis
10 {
11  // Default Constructor
13  : P4PtEtaPhiM()
15  , m_cluster()
16  , m_seedCell()
17  , m_nCellsInEta(TauDetails::DEFAULT_INT)
18  , m_pt1(TauDetails::DEFAULT)
19  , m_pt3(TauDetails::DEFAULT)
20  , m_pt5(TauDetails::DEFAULT)
21  , m_ws5(TauDetails::DEFAULT)
22  , m_sdevEta5_WRTmean(TauDetails::DEFAULT)
23  , m_sdevEta5_WRTmode(TauDetails::DEFAULT)
24  , m_sdevPt5(TauDetails::DEFAULT)
25  , m_deltaPt12_min(TauDetails::DEFAULT)
26  , m_Fside_3not1(TauDetails::DEFAULT)
27  , m_Fside_5not1(TauDetails::DEFAULT)
28  , m_Fside_5not3(TauDetails::DEFAULT)
29  , m_fracSide_3not1(TauDetails::DEFAULT)
30  , m_fracSide_5not1(TauDetails::DEFAULT)
31  , m_fracSide_5not3(TauDetails::DEFAULT)
32  , m_pt1OverPt3(TauDetails::DEFAULT)
33  , m_pt3OverPt5(TauDetails::DEFAULT)
34  , m_mergedScore(TauDetails::DEFAULT)
35  , m_signalScore(TauDetails::DEFAULT)
36  , m_nPhotons(TauDetails::DEFAULT_INT)
37  {}
38 
39 
40  // Copy Constructor
42  : IAthenaBarCode(rhs)
43  , INavigable(rhs)
44  , I4Momentum(rhs)
45  , INavigable4Momentum(rhs)
46  //, P4PxPyPzEBase(rhs)
47  , P4PtEtaPhiM(rhs)
49  , m_cluster(rhs.m_cluster)
50  , m_seedCell(rhs.m_seedCell)
51  , m_nCellsInEta(rhs.m_nCellsInEta)
52  , m_pt1(rhs.m_pt1)
53  , m_pt3(rhs.m_pt3)
54  , m_pt5(rhs.m_pt5)
55  , m_ws5(rhs.m_ws5)
56  , m_sdevEta5_WRTmean(rhs.m_sdevEta5_WRTmean)
57  , m_sdevEta5_WRTmode(rhs.m_sdevEta5_WRTmode)
58  , m_sdevPt5(rhs.m_sdevPt5)
59  , m_deltaPt12_min(rhs.m_deltaPt12_min)
60  , m_Fside_3not1(rhs.m_Fside_3not1)
61  , m_Fside_5not1(rhs.m_Fside_5not1)
62  , m_Fside_5not3(rhs.m_Fside_5not3)
63  , m_fracSide_3not1(rhs.m_fracSide_3not1)
64  , m_fracSide_5not1(rhs.m_fracSide_5not1)
65  , m_fracSide_5not3(rhs.m_fracSide_5not3)
66  , m_pt1OverPt3(rhs.m_pt1OverPt3)
67  , m_pt3OverPt5(rhs.m_pt3OverPt5)
68  , m_mergedScore(rhs.m_mergedScore)
69  , m_signalScore(rhs.m_signalScore)
70  , m_nPhotons(rhs.m_nPhotons)
71  {
72  }
73 
74  // Assignment operator
76  {
77  if (this!=&rhs){
78  m_cluster = rhs.m_cluster;
79  m_seedCell = rhs.m_seedCell;
81  m_pt1 = rhs.m_pt1;
82  m_pt3 = rhs.m_pt3;
83  m_pt5 = rhs.m_pt5;
84  m_ws5 = rhs.m_ws5;
87  m_sdevPt5 = rhs.m_sdevPt5;
99  m_nPhotons = rhs.m_nPhotons;
100  }
101  return *this;
102  }
103 
104  // Comparison Operator
105  bool TauShot::operator== ( const TauShot& rhs ) const
106  {
107  if(m_cluster != rhs.m_cluster) return false;
108  if(m_seedCell != rhs.m_seedCell) return false;
109  if(m_nCellsInEta != rhs.m_nCellsInEta) return false;
110  if(m_pt1 != rhs.m_pt1) return false;
111  if(m_pt3 != rhs.m_pt3) return false;
112  if(m_pt5 != rhs.m_pt5) return false;
113  if(m_ws5 != rhs.m_ws5) return false;
114  if(m_sdevEta5_WRTmean != rhs.m_sdevEta5_WRTmean) return false;
115  if(m_sdevEta5_WRTmode != rhs.m_sdevEta5_WRTmode) return false;
116  if(m_sdevPt5 != rhs.m_sdevPt5) return false;
117  if(m_deltaPt12_min != rhs.m_deltaPt12_min) return false;
118  if(m_Fside_3not1 != rhs.m_Fside_3not1) return false;
119  if(m_Fside_5not1 != rhs.m_Fside_5not1) return false;
120  if(m_Fside_5not3 != rhs.m_Fside_5not3) return false;
121  if(m_fracSide_3not1 != rhs.m_fracSide_3not1) return false;
122  if(m_fracSide_5not1 != rhs.m_fracSide_5not1) return false;
123  if(m_fracSide_5not3 != rhs.m_fracSide_5not3) return false;
124  if(m_pt1OverPt3 != rhs.m_pt1OverPt3) return false;
125  if(m_pt3OverPt5 != rhs.m_pt3OverPt5) return false;
126  if(m_mergedScore != rhs.m_mergedScore) return false;
127  if(m_signalScore != rhs.m_signalScore) return false;
128  if(m_nPhotons != rhs.m_nPhotons) return false;
129  return true;
130  }
131 
132  // Destructor
134  {
135  }
136 
137 
138  std::vector<std::vector<const CaloCell*> > TauShot::getCellVector(const CaloCell_ID* calo_id) const
139  {
140  std::vector<std::vector<const CaloCell*> > cellVector;
141  std::vector<const CaloCell*> oneEtaLayer;
142  for(int iCell=0; iCell<m_nCellsInEta;++iCell) oneEtaLayer.push_back(NULL);
143  // have two layers in phi
144  cellVector.push_back(oneEtaLayer);
145  cellVector.push_back(oneEtaLayer);
146  const CaloCell* seedCell = this->seedCell();
147  const CaloCell* mergedCell = NULL;
148  // get merged cell in phi. Keep NULL if shot is not merged across phi
149  std::vector<IdentifierHash> nextInPhi;
150  std::vector<IdentifierHash> prevInPhi;
153  CaloCluster::cell_iterator cellItr = this->cluster()->cell_begin();
154  CaloCluster::cell_iterator cellItrE = this->cluster()->cell_end();
155  for(;cellItr!=cellItrE;++cellItr){
157  for( ; itr!=nextInPhi.end(); ++itr ){
158  if((*cellItr)->caloDDE()->calo_hash() != (*itr)) continue;
159  mergedCell = (*cellItr);
160  break;
161  }
162  if(mergedCell!=NULL) break;
163  itr = prevInPhi.begin();
164  for( ; itr!=prevInPhi.end(); ++itr ){
165  if((*cellItr)->caloDDE()->calo_hash() != (*itr)) continue;
166  mergedCell = (*cellItr);
167  break;
168  }
169  if(mergedCell!=NULL) break;
170  }
171  // store cells in the eta layer, which contains the seed cell
172  int nCellsFromSeed = 1;
173  const CaloCell* lastCell = seedCell;
174  cellVector.at(0).at(m_nCellsInEta/2) = seedCell; // store seed cell
175  std::vector<IdentifierHash> next;
176  while(lastCell!=NULL && nCellsFromSeed<m_nCellsInEta/2+1){
178  lastCell = NULL;
179  for(cellItr=this->cluster()->cell_begin();cellItr!=cellItrE;++cellItr){
181  for( ; itr!=next.end(); ++itr ){
182  if((*cellItr)->caloDDE()->calo_hash() != (*itr)) continue;
183  cellVector.at(0).at(m_nCellsInEta/2+nCellsFromSeed) = (*cellItr);
184  lastCell = (*cellItr);
185  }
186  }
187  nCellsFromSeed++;
188  }
189  nCellsFromSeed = 1;
190  lastCell = seedCell;
191  while(lastCell!=NULL && nCellsFromSeed<m_nCellsInEta/2+1){
193  lastCell = NULL;
194  for(cellItr=this->cluster()->cell_begin();cellItr!=cellItrE;++cellItr){
196  for( ; itr!=next.end(); ++itr ){
197  if((*cellItr)->caloDDE()->calo_hash() != (*itr)) continue;
198  cellVector.at(0).at(m_nCellsInEta/2-nCellsFromSeed) = (*cellItr);
199  lastCell = (*cellItr);
200  }
201  }
202  nCellsFromSeed++;
203  }
204  // store cells in the eta layer, which contains the merged cell
205  int nCellsFromMerged = 1;
206  lastCell = mergedCell; // is NULL if shot is not merged
207  cellVector.at(1).at(m_nCellsInEta/2) = mergedCell; // store merged cell
208  while(lastCell!=NULL && nCellsFromMerged<m_nCellsInEta/2+1){
210  lastCell = NULL;
211  for(cellItr=this->cluster()->cell_begin();cellItr!=cellItrE;++cellItr){
213  for( ; itr!=next.end(); ++itr ){
214  if((*cellItr)->caloDDE()->calo_hash() != (*itr)) continue;
215  cellVector.at(1).at(m_nCellsInEta/2+nCellsFromMerged) = (*cellItr);
216  lastCell = (*cellItr);
217  }
218  }
219  nCellsFromMerged++;
220  }
221  nCellsFromMerged = 1;
222  lastCell = mergedCell;
223  while(lastCell!=NULL && nCellsFromMerged<m_nCellsInEta/2+1){
225  lastCell = NULL;
226  for(cellItr=this->cluster()->cell_begin();cellItr!=cellItrE;++cellItr){
228  for( ; itr!=next.end(); ++itr ){
229  if((*cellItr)->caloDDE()->calo_hash() != (*itr)) continue;
230  cellVector.at(1).at(m_nCellsInEta/2-nCellsFromMerged) = (*cellItr);
231  lastCell = (*cellItr);
232  }
233  }
234  nCellsFromMerged++;
235  }
236  return cellVector;
237  }
238 
239 
240  // just for testing
241  void TauShot::print() const{
242  int oldpr = std::cout.precision(5);
243  // can probably do this better through IMomentum::dump(), but whatevs
244  std::cout << "in TauShot::dump()" << std::endl;
245  std::cout << "pt: " << this->pt() << std::endl;
246  std::cout << "eta: " << this->eta() << std::endl;
247  std::cout << "phi: " << this->phi() << std::endl;
248  std::cout << "m: " << this->m() << std::endl;
249  std::cout.precision(oldpr);
250  }
251 
252 }//end of namespace definitions
253 
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
Analysis::TauShot::m_seedCell
ElementLink< CaloCellContainer > m_seedCell
pointer to seed cell
Definition: TauShot.h:148
I4Momentum
Definition: I4Momentum.h:31
Analysis::TauShot::m_Fside_5not1
float m_Fside_5not1
Definition: TauShot.h:161
Analysis::TauShot::m_pt3
float m_pt3
Definition: TauShot.h:153
NavigableTerminalNode
Dummy type needed fro specialized implementation.
Definition: NavigableTerminalNode.h:19
Analysis::TauShot::seedCell
const CaloCell * seedCell() const
pointer to seed cell
Analysis::TauShot::m_ws5
float m_ws5
Definition: TauShot.h:155
TauShot.h
Analysis::TauShot::m_sdevEta5_WRTmode
float m_sdevEta5_WRTmode
Definition: TauShot.h:157
CaloCompositeCellBase::cell_end
cell_iterator cell_end() const
Retrieve a STL-type end() iterator for the cell store.
Analysis::TauShot::m_pt5
float m_pt5
Definition: TauShot.h:154
LArNeighbours::prevInPhi
@ prevInPhi
Definition: LArNeighbours.h:12
Analysis::TauShot::m_Fside_5not3
float m_Fside_5not3
Definition: TauShot.h:162
TauDetails.h
Analysis::TauDetails
Definition: TauDetails.h:26
Analysis::TauShot::m_mergedScore
float m_mergedScore
Definition: TauShot.h:168
Analysis::TauShot::m_cluster
ElementLink< CaloClusterContainer > m_cluster
element link to cluster
Definition: TauShot.h:145
Analysis::TauShot::m_pt3OverPt5
float m_pt3OverPt5
Definition: TauShot.h:167
LArNeighbours::nextInPhi
@ nextInPhi
Definition: LArNeighbours.h:13
CaloCluster::cell_iterator
CaloCompositeCellBase< CaloClusterNavigable >::cell_iterator cell_iterator
Iterator on CaloCell s.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:115
Analysis::TauShot
Definition: TauShot.h:48
P4PtEtaPhiM::phi
virtual double phi() const
get phi data member
Definition: P4PtEtaPhiM.h:109
CaloDetDescrElement::calo_hash
IdentifierHash calo_hash() const
cell calo hash
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:412
fillPileUpNoiseLumi.next
next
Definition: fillPileUpNoiseLumi.py:52
Analysis::TauShot::cluster
const CaloCluster * cluster() const
pointer to CaloCluster
Analysis::TauShot::operator==
bool operator==(const TauShot &) const
Comparison operator.
Definition: TauShot.cxx:105
Analysis::TauShot::m_Fside_3not1
float m_Fside_3not1
Definition: TauShot.h:160
CaloCell::caloDDE
const CaloDetDescrElement * caloDDE() const
get pointer to CaloDetDescrElement (data member)
Definition: CaloCell.h:305
Analysis::TauShot::m_fracSide_3not1
float m_fracSide_3not1
Definition: TauShot.h:163
CaloCell_ID
Helper class for offline cell identifiers.
Definition: CaloCell_ID.h:34
INavigable
Definition: INavigable.h:18
P4PtEtaPhiM::m
virtual double m() const
get mass data member
Definition: P4PtEtaPhiM.h:112
P4PtEtaPhiM::pt
virtual double pt() const
get pt data member
Definition: P4PtEtaPhiM.h:103
IAthenaBarCode
Definition: AthenaKernel/AthenaKernel/IAthenaBarCode.h:48
Analysis::TauShot::m_sdevEta5_WRTmean
float m_sdevEta5_WRTmean
Definition: TauShot.h:156
Analysis
The namespace of all packages in PhysicsAnalysis/JetTagging.
Definition: BTaggingCnvAlg.h:20
P4PtEtaPhiM::eta
virtual double eta() const
get eta data member
Definition: P4PtEtaPhiM.h:106
CaloCompositeCellBase::cell_begin
cell_iterator cell_begin() const
Retrieve a STL-type begin() iterator for the cell store.
CaloCell_Base_ID::get_neighbours
int get_neighbours(const IdentifierHash caloHash, const LArNeighbours::neighbourOption &option, std::vector< IdentifierHash > &neighbourList) const
access to hashes for neighbours return == 0 for neighbours found
Definition: CaloCell_Base_ID.cxx:190
Analysis::TauShot::m_signalScore
float m_signalScore
Definition: TauShot.h:169
CaloCell
Data object for each calorimeter readout cell.
Definition: CaloCell.h:57
INavigable4Momentum
Definition: INavigable4Momentum.h:21
LArNeighbours::nextInEta
@ nextInEta
Definition: LArNeighbours.h:15
Analysis::TauShot::print
void print() const
print method
Definition: TauShot.cxx:241
Analysis::TauShot::m_nCellsInEta
int m_nCellsInEta
other shot variables
Definition: TauShot.h:151
Analysis::TauShot::getCellVector
std::vector< std::vector< const CaloCell * > > getCellVector(const CaloCell_ID *) const
get vector<vector<CaloCell*> > used for calculation of shape vars
Definition: TauShot.cxx:138
Analysis::TauShot::operator=
TauShot & operator=(const TauShot &)
Assignment operator.
Definition: TauShot.cxx:75
LArNeighbours::prevInEta
@ prevInEta
Definition: LArNeighbours.h:14
Analysis::TauShot::m_nPhotons
int m_nPhotons
Definition: TauShot.h:170
P4PtEtaPhiM
Definition: P4PtEtaPhiM.h:25
Analysis::TauShot::m_pt1OverPt3
float m_pt1OverPt3
Definition: TauShot.h:166
Analysis::TauShot::TauShot
TauShot()
Default Constructor standard constructor which sets everything to 0, needed for persistency.
Definition: TauShot.cxx:12
Analysis::TauShot::~TauShot
virtual ~TauShot()
Destructor.
Definition: TauShot.cxx:133
Analysis::TauShot::m_deltaPt12_min
float m_deltaPt12_min
Definition: TauShot.h:159
Analysis::TauShot::m_fracSide_5not1
float m_fracSide_5not1
Definition: TauShot.h:164
Analysis::TauShot::m_pt1
float m_pt1
Definition: TauShot.h:152
Analysis::TauShot::m_sdevPt5
float m_sdevPt5
Definition: TauShot.h:158
Analysis::TauShot::m_fracSide_5not3
float m_fracSide_5not3
Definition: TauShot.h:165