ATLAS Offline Software
Public Slots | Public Member Functions | Private Member Functions | Private Attributes | List of all members
VP1CaloCellManager Class Reference

#include <VP1CaloCellManager.h>

Inheritance diagram for VP1CaloCellManager:
Collaboration diagram for VP1CaloCellManager:

Public Slots

void selectionUpdated (const VP1CCIntervalMap &)
 
void scaleUpdated (const QPair< bool, double > &)
 
void outlineUpdated (const bool &)
 
void globalCutsUpdated (const VP1CC_GlobalCuts &)
 
void clipVolumeRadiusChanged (double radius)
 

Public Member Functions

 VP1CaloCellManager (VP1CC_SelectionTypes type, VP1CC_SoNode2CCMap *node2cc, bool useEt, const QPair< bool, double > &scale, bool outline, const VP1CC_GlobalCuts &globalCuts)
 
 ~VP1CaloCellManager ()
 
void add (VP1CaloCell *cell)
 

Private Member Functions

void updateScene (const VP1Interval &newInterval, bool positive)
 

Private Attributes

VP1CC_SelectionTypes m_type
 
VP1CC_SoNode2CCMapm_node2cc
 
bool m_useEt
 
QPair< bool, double > m_scale
 
bool m_outline
 
VP1CCMultimap m_positiveCells
 
VP1CCMultimap m_negativeCells
 
VP1CCMultimapIterator m_firstDisplayedPos
 
VP1CCMultimapIterator m_lastDisplayedPos
 
VP1CCMultimapIterator m_firstDisplayedNeg
 
VP1CCMultimapIterator m_lastDisplayedNeg
 
VP1CCIntervalPair m_intervals
 
VP1CC_GlobalCuts m_globalCuts
 

Detailed Description

Definition at line 38 of file VP1CaloCellManager.h.

Constructor & Destructor Documentation

◆ VP1CaloCellManager()

VP1CaloCellManager::VP1CaloCellManager ( VP1CC_SelectionTypes  type,
VP1CC_SoNode2CCMap node2cc,
bool  useEt,
const QPair< bool, double > &  scale,
bool  outline,
const VP1CC_GlobalCuts globalCuts 
)

Definition at line 12 of file VP1CaloCellManager.cxx.

17  :
18  m_type(type),
19  m_node2cc(node2cc),
20  m_useEt(useEt),
21  m_scale(scale),
22  m_outline(outline),
23  m_globalCuts(globalCuts)
24 {
25  // Initialize private iterators
30 
32 }

◆ ~VP1CaloCellManager()

VP1CaloCellManager::~VP1CaloCellManager ( )

Definition at line 34 of file VP1CaloCellManager.cxx.

35 {
36  // Clear multimaps
38  while(it!=m_positiveCells.end()) {
39  if(it->second) {
40  delete it->second;
41  it->second = 0;
42  }
43  ++it;
44  }
45 
46  it = m_negativeCells.begin();
47  while(it!=m_negativeCells.end()) {
48  if(it->second) {
49  delete it->second;
50  it->second = 0;
51  }
52  ++it;
53  }
54 
55  m_positiveCells.clear();
56  m_negativeCells.clear();
57 }

Member Function Documentation

◆ add()

void VP1CaloCellManager::add ( VP1CaloCell cell)

Definition at line 59 of file VP1CaloCellManager.cxx.

60 {
61  double energy = cell->getCaloCell()->energy();
62 
63  if(m_useEt)
64  energy = cell->energyToTransverse(energy);
65 
66  // We need to choose which map to add the new cell to according to its energy sign
68 
69  // This is going to be the new key in the map
70  double ccKey = fabs(energy);
71 
72  // Add new element to the map
73  useMap.emplace(ccKey,cell);
74 }

◆ clipVolumeRadiusChanged

void VP1CaloCellManager::clipVolumeRadiusChanged ( double  radius)
slot

Definition at line 128 of file VP1CaloCellManager.cxx.

129 {
130  m_globalCuts.clipRadius=radius; // Adjust radius to match new value
132  it->second->updateScene(m_node2cc,m_useEt,m_scale,m_outline,m_globalCuts);
134  it->second->updateScene(m_node2cc,m_useEt,m_scale,m_outline,m_globalCuts);
135 }

◆ globalCutsUpdated

void VP1CaloCellManager::globalCutsUpdated ( const VP1CC_GlobalCuts new_cuts)
slot

Definition at line 119 of file VP1CaloCellManager.cxx.

◆ outlineUpdated

void VP1CaloCellManager::outlineUpdated ( const bool &  new_outline)
slot

Definition at line 103 of file VP1CaloCellManager.cxx.

104 {
105  m_outline = new_outline;
106 
107  // Redraw objects with new outline settings
108  // Pos
110  it->second->updateScene(m_node2cc,m_useEt,m_scale,m_outline,m_globalCuts);
111  }
112 
113  // Neg
115  it->second->updateScene(m_node2cc,m_useEt,m_scale,m_outline,m_globalCuts);
116  }
117 }

◆ scaleUpdated

void VP1CaloCellManager::scaleUpdated ( const QPair< bool, double > &  new_scale)
slot

Definition at line 87 of file VP1CaloCellManager.cxx.

88 {
89  m_scale = new_scale;
90 
91  // Redraw objects with new scale
92  // Pos
94  it->second->updateScene(m_node2cc,m_useEt,m_scale,m_outline,m_globalCuts);
95  }
96 
97  // Neg
99  it->second->updateScene(m_node2cc,m_useEt,m_scale,m_outline,m_globalCuts);
100  }
101 }

◆ selectionUpdated

void VP1CaloCellManager::selectionUpdated ( const VP1CCIntervalMap intervals)
slot

Definition at line 77 of file VP1CaloCellManager.cxx.

78 {
79  VP1CCIntervalMap::const_iterator it = intervals.find(m_type);
80  if(it!=intervals.end()) {
81  // Update scene with pos/neg cells
82  updateScene(it->first,true);
83  updateScene(it->second,false);
84  }
85 }

◆ updateScene()

void VP1CaloCellManager::updateScene ( const VP1Interval newInterval,
bool  positive 
)
private

Definition at line 138 of file VP1CaloCellManager.cxx.

139 {
140  // We need to choose which map to work with, according to the value of 'positive' flag
141  VP1CCMultimap* useMap = 0;
142  VP1CCMultimapIterator* useItFirst = 0;
143  VP1CCMultimapIterator* useItLast = 0;
144  VP1Interval* currentInterval = 0;
145 
146  if(positive) {
147  useMap = &m_positiveCells;
148  useItFirst = &m_firstDisplayedPos;
149  useItLast = &m_lastDisplayedPos;
150  currentInterval = &m_intervals.first;
151  } else {
152  useMap = &m_negativeCells;
153  useItFirst = &m_firstDisplayedNeg;
154  useItLast = &m_lastDisplayedNeg;
155  currentInterval = &m_intervals.second;
156  }
157 
158  // If new iterval is equal to the existing one just check global cuts
159  if(*currentInterval==newInterval) {
160  for(VP1CCMultimapIterator it=*useItFirst; it!=*useItLast; ++it)
161  it->second->updateScene(m_node2cc,m_useEt,m_scale,m_outline,m_globalCuts);
162  return;
163  }
164 
165  // If new interval is empty hide everything and update the current interval
166  if(newInterval.isEmpty()) {
167  for(VP1CCMultimapIterator it=*useItFirst; it!=*useItLast; ++it)
168  it->second->remove3DObjects(m_node2cc);
169  *currentInterval = newInterval;
170  *useItFirst = useMap->end();
171  *useItLast = useMap->end();
172  return;
173  }
174 
175  // If old interval was empty, find values for first & last iterators and
176  // display everything between them, taking into account global cuts
177  if(currentInterval->isEmpty()) {
178  *useItFirst = useMap->lower_bound(newInterval.lower());
179  if(newInterval.upper() == VP1Interval::inf())
180  *useItLast = useMap->end();
181  else
182  *useItLast = useMap->upper_bound(newInterval.upper());
183 
184  for(VP1CCMultimapIterator it=*useItFirst; it!=*useItLast; ++it)
185  it->second->updateScene(m_node2cc,m_useEt,m_scale,m_outline,m_globalCuts);
186 
187  *currentInterval = newInterval;
188  return;
189  }
190 
191  // No one is empty.
192  VP1CCMultimapIterator newIterator;
193 
194  if(currentInterval->lower() != newInterval.lower() &&
195  currentInterval->upper() != newInterval.upper()) {
196  // This is unexpected!
197  // Hide everything what was there before and display new thresholds
198  for(VP1CCMultimapIterator it=*useItFirst; it!=*useItLast; ++it)
199  it->second->remove3DObjects(m_node2cc);
200 
201  *useItFirst = useMap->lower_bound(newInterval.lower());
202  if(newInterval.upper() == VP1Interval::inf())
203  *useItLast = useMap->end();
204  else
205  *useItLast = useMap->upper_bound(newInterval.upper());
206 
207  for(VP1CCMultimapIterator it=*useItFirst; it!=*useItLast; ++it)
208  it->second->updateScene(m_node2cc,m_useEt,m_scale,m_outline,m_globalCuts);
209 
210  } else if (currentInterval->lower() != newInterval.lower()) {
211  // Adjust lower threshold
212  newIterator = useMap->lower_bound(newInterval.lower());
213 
214  if(currentInterval->lower() < newInterval.lower())
215  // May need to hide something
216  for(VP1CCMultimapIterator it=*useItFirst; it!=newIterator; ++it)
217  it->second->remove3DObjects(m_node2cc);
218  else
219  // May need to add new objects to the scene
220  for(VP1CCMultimapIterator it=newIterator; it!=*useItFirst; ++it)
221  it->second->updateScene(m_node2cc,m_useEt,m_scale,m_outline,m_globalCuts);
222 
223  *useItFirst = newIterator;
224 
225  } else {
226 
227  // Adjust upper threshold
228  if(newInterval.upper() == VP1Interval::inf()) {
229  newIterator = useMap->end();
230 
231  // May need to add new objects to the scene
232  for(VP1CCMultimapIterator it=*useItLast; it!=newIterator; ++it)
233  it->second->updateScene(m_node2cc,m_useEt,m_scale,m_outline,m_globalCuts);
234  } else {
235  newIterator = useMap->upper_bound(newInterval.upper());
236 
237  if(*useItLast == useMap->end() ||
238  currentInterval->upper() > newInterval.upper()) {
239  // May need to hide something
240  for(VP1CCMultimapIterator it=newIterator; it!=*useItLast; ++it)
241  it->second->remove3DObjects(m_node2cc);
242  } else {
243  // May need to add new objects to the scene
244  for(VP1CCMultimapIterator it=*useItLast; it!=newIterator; ++it)
245  it->second->updateScene(m_node2cc,m_useEt,m_scale,m_outline,m_globalCuts);
246  }
247  }
248  *useItLast = newIterator;
249  }
250 
251  *currentInterval = newInterval;
252 }

Member Data Documentation

◆ m_firstDisplayedNeg

VP1CCMultimapIterator VP1CaloCellManager::m_firstDisplayedNeg
private

Definition at line 90 of file VP1CaloCellManager.h.

◆ m_firstDisplayedPos

VP1CCMultimapIterator VP1CaloCellManager::m_firstDisplayedPos
private

Definition at line 88 of file VP1CaloCellManager.h.

◆ m_globalCuts

VP1CC_GlobalCuts VP1CaloCellManager::m_globalCuts
private

Definition at line 97 of file VP1CaloCellManager.h.

◆ m_intervals

VP1CCIntervalPair VP1CaloCellManager::m_intervals
private

Definition at line 94 of file VP1CaloCellManager.h.

◆ m_lastDisplayedNeg

VP1CCMultimapIterator VP1CaloCellManager::m_lastDisplayedNeg
private

Definition at line 91 of file VP1CaloCellManager.h.

◆ m_lastDisplayedPos

VP1CCMultimapIterator VP1CaloCellManager::m_lastDisplayedPos
private

Definition at line 89 of file VP1CaloCellManager.h.

◆ m_negativeCells

VP1CCMultimap VP1CaloCellManager::m_negativeCells
private

Definition at line 85 of file VP1CaloCellManager.h.

◆ m_node2cc

VP1CC_SoNode2CCMap* VP1CaloCellManager::m_node2cc
private

Definition at line 72 of file VP1CaloCellManager.h.

◆ m_outline

bool VP1CaloCellManager::m_outline
private

Definition at line 81 of file VP1CaloCellManager.h.

◆ m_positiveCells

VP1CCMultimap VP1CaloCellManager::m_positiveCells
private

Definition at line 84 of file VP1CaloCellManager.h.

◆ m_scale

QPair<bool,double> VP1CaloCellManager::m_scale
private

Definition at line 78 of file VP1CaloCellManager.h.

◆ m_type

VP1CC_SelectionTypes VP1CaloCellManager::m_type
private

Definition at line 69 of file VP1CaloCellManager.h.

◆ m_useEt

bool VP1CaloCellManager::m_useEt
private

Definition at line 75 of file VP1CaloCellManager.h.


The documentation for this class was generated from the following files:
VP1CaloCellManager::m_positiveCells
VP1CCMultimap m_positiveCells
Definition: VP1CaloCellManager.h:84
VP1CaloCellManager::m_lastDisplayedNeg
VP1CCMultimapIterator m_lastDisplayedNeg
Definition: VP1CaloCellManager.h:91
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
VP1CaloCellManager::updateScene
void updateScene(const VP1Interval &newInterval, bool positive)
Definition: VP1CaloCellManager.cxx:138
VP1CaloCellManager::m_lastDisplayedPos
VP1CCMultimapIterator m_lastDisplayedPos
Definition: VP1CaloCellManager.h:89
VP1CCIntervalPair
QPair< VP1Interval, VP1Interval > VP1CCIntervalPair
Definition: VP1CaloCells.h:115
skel.it
it
Definition: skel.GENtoEVGEN.py:423
VP1CaloCellManager::m_node2cc
VP1CC_SoNode2CCMap * m_node2cc
Definition: VP1CaloCellManager.h:72
VP1Interval::upper
double upper() const
yodamerge_tmp.scale
scale
Definition: yodamerge_tmp.py:138
VP1CaloCellManager::m_globalCuts
VP1CC_GlobalCuts m_globalCuts
Definition: VP1CaloCellManager.h:97
VP1CaloCellManager::m_firstDisplayedNeg
VP1CCMultimapIterator m_firstDisplayedNeg
Definition: VP1CaloCellManager.h:90
VP1CaloCellManager::m_scale
QPair< bool, double > m_scale
Definition: VP1CaloCellManager.h:78
VP1Interval::lower
double lower() const
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
VP1Interval::inf
static double inf()
Definition: VP1Interval.h:25
VP1CaloCellManager::m_outline
bool m_outline
Definition: VP1CaloCellManager.h:81
VP1CaloCellManager::m_useEt
bool m_useEt
Definition: VP1CaloCellManager.h:75
VP1CaloCellManager::m_negativeCells
VP1CCMultimap m_negativeCells
Definition: VP1CaloCellManager.h:85
VP1CC_GlobalCuts::clipRadius
double clipRadius
Definition: VP1CaloCells.h:59
VP1CaloCellManager::m_type
VP1CC_SelectionTypes m_type
Definition: VP1CaloCellManager.h:69
VP1CaloCellManager::m_firstDisplayedPos
VP1CCMultimapIterator m_firstDisplayedPos
Definition: VP1CaloCellManager.h:88
VP1Interval::isEmpty
bool isEmpty() const
ParticleGun_SamplingFraction.radius
radius
Definition: ParticleGun_SamplingFraction.py:96
VP1Interval
Definition: VP1Interval.h:23
VP1CaloCellManager::m_intervals
VP1CCIntervalPair m_intervals
Definition: VP1CaloCellManager.h:94
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
VP1CCMultimap
std::multimap< double, VP1CaloCell * > VP1CCMultimap
Definition: VP1CaloCellManager.h:16
VP1CCMultimapIterator
VP1CCMultimap::iterator VP1CCMultimapIterator
Definition: VP1CaloCellManager.h:36