ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
PRDCollHandleBase::Imp Class Reference
Collaboration diagram for PRDCollHandleBase::Imp:

Public Member Functions

template<class T >
bool actualLoad ()
 
void updateDetailSepAttachments ()
 
bool ensureLoaded ()
 
bool etaPhiCut (PRDHandleBase *)
 

Public Attributes

PRDCollHandleBasetheclass = nullptr
 
QString storegate_key
 
PRDDetType::Type detType
 
VP1ExtraSepLayerHelpersephelper_detail = nullptr
 
VP1ExtraSepLayerHelpersephelper_simple = nullptr
 
SoSeparator * sep_lods = nullptr
 
std::map< int, std::pair< SoLevelOfDetail *, std::pair< VP1ExtraSepLayerHelper *, VP1ExtraSepLayerHelper * > > > regionindex2lodhelpers
 
DETAIL generalprddetaillevel
 
SoMaterial * highlightmaterial = nullptr
 
bool highlightoutliers = false
 
bool drawerrors = false
 
bool drawrdos = false
 
VP1Interval allowedEta
 
QList< VP1IntervalallowedPhi
 
std::vector< PRDHandleBase * > prdhandles
 
QComboBox * comboBox_detailLevel = nullptr
 

Detailed Description

Definition at line 39 of file PRDCollHandleBase.cxx.

Member Function Documentation

◆ actualLoad()

template<class T >
bool PRDCollHandleBase::Imp::actualLoad ( )

Definition at line 226 of file PRDCollHandleBase.cxx.

227 {
229  // Retrieve element container from event store:
230  const T* container;
231  VP1SGAccessHelper sg_access(theclass->systemBase());
232  if(!sg_access.retrieve(container,storegate_key))
233  return false;
234 
235  typename T::const_iterator element, lastElement(container->end());
236 
238  // Sanity check:
239  if ( container->size()==0 && container->begin()!=lastElement ) {
240  theclass->message("ERROR: container '"+storegate_key+"' has size()==0, but different begin() and end() iterators!");
241  return false;
242  }
243 
245  // In case the container was created incorrectly we must fallback to a different method of getting the prds:
246  bool fallback(false);
247  SG::ConstIterator<typename T::base_value_type> firstElementD, lastElementD;
248  if ( container->size()!=0 && container->begin()==lastElement ) {
249  //This is either an empty container, or it is a case of an incorrectly created container which we must get by SG::ConstIterator's.
250  theclass->messageDebug("Retrieved empty container. This might be misleading. Now going to attempt to load prds via iterators instead.");
251  if (VP1SGContentsHelper(theclass->systemBase()).getKeys<T>().count()!=1) {
252  theclass->messageDebug("But seems that there is not exactly one collection of type "+QString(typeid(T).name())
253  +", so we won't attempt that anyway!! Thus we assume there there are simply no prd's.");
254  } else {
255  if(sg_access.retrieve(firstElementD, lastElementD,true)) {
256  if (firstElementD==lastElementD) {
257  theclass->messageDebug("No prd's found when accessed by iterators either. It seems that there really are just no prds in this collection.");
258  } else {
259  fallback = true;
260  }
261  } else {
262  theclass->messageDebug("Failed retrieval by iterators. We take that as a sign that there really are just no prds in this collection ");
263  }
264  }
265  }
266 
267  theclass->messageVerbose("Loop over actual prd's and create handles");
268  //Retrieve prds and create handles:
269 
270  int ignoredUnsafeHandle_NoPRD(0);
271  int ignoredUnsafeHandle_NoDetElem(0);
272  int ignoredUnsafeHandle_NotSane(0);
273  typename T::base_value_type::const_iterator prd, prdLast;
274  int iprds(0);
275  if (!fallback) {
276  // element = container->begin();
277  // prd = (*element)->begin();
278  // ++iprds;
279  // PRDHandleBase * handle = theclass->addPRD(*prd);
280  // theclass->addHandle(handle);
281  // theclass->common()->registerPRD2Handle(*prd,handle);
282  // theclass->systemBase()->updateGUI();
283  for ( element = container->begin(); element!=lastElement ; ++element) {
284  prd = (*element)->begin(), prdLast = (*element)->end();
285  for ( ; prd!=prdLast ; ++prd) {
286  ++iprds;
287  if (!*prd) {
288  ++ignoredUnsafeHandle_NoPRD;
289  continue;
290  }
291  PRDHandleBase * handle = theclass->addPRD(*prd);
292  if (handle) {
293  if (!handle->isSane()) ignoredUnsafeHandle_NotSane++;
294  if (!handle->getPRD()->detectorElement()) {
295  ++ignoredUnsafeHandle_NoDetElem;
296  delete handle;
297  } else {
298  theclass->addHandle(handle);
299  theclass->common()->registerPRD2Handle(*prd,handle);
300  }
301  }
302  }
303  if (!(iprds%100))
305  }
306 
307  } else {
308 
309  for (; firstElementD!=lastElementD; ++firstElementD ) {
310  prd = firstElementD->begin(), prdLast = firstElementD->end();
311  for ( ; prd!=prdLast ; ++prd) {
312  ++iprds;
313  if (!*prd) {
314  ++ignoredUnsafeHandle_NoPRD;
315  continue;
316  }
317  PRDHandleBase * handle = theclass->addPRD(*prd);
318  if (handle) {
319  if (!handle->isSane()) ignoredUnsafeHandle_NotSane++;
320 
321  if (!handle->getPRD()->detectorElement()) {
322  ++ignoredUnsafeHandle_NoDetElem;
323  delete handle;
324  } else {
325  theclass->addHandle(handle);
326  theclass->common()->registerPRD2Handle(*prd,handle);
327  }
328  }
329  if (!(iprds%100))
331  }
332  }
333  }
335  prdhandles.resize(prdhandles.size());
336 
337  if (ignoredUnsafeHandle_NoPRD)
338  theclass->message("WARNING - ignoring "+str(ignoredUnsafeHandle_NoPRD)+" null prd pointer(s).");
339  if (ignoredUnsafeHandle_NoDetElem)
340  theclass->message("WARNING - ignoring "+str(ignoredUnsafeHandle_NoDetElem)+" prd pointer(s) with null detector elements.");
341  if (ignoredUnsafeHandle_NotSane)
342  theclass->message("WARNING - found "+str(ignoredUnsafeHandle_NotSane)+" prd pointer(s) which fail sanity checks (i.e. contain NaNs).");
343 
344  //Perform initialisation needed for cuts (e.g. those of the "global" type, such as requiring a number of PRDs in the same detector module):
345  theclass->messageVerbose("postLoadInitialisation");
347 
349 
350  //Show the handles that need to be shown:
351  theclass->recheckCutStatusOfAllNotVisibleHandles();//Use this method to not get the deselectAll call
352 
353  theclass->message("Found "+QString::number(iprds)+" ("+QString::number(theclass->nShownHandles())+" shown) PRDs in container '"+storegate_key+"'");
354 
355  return true;
356 
357 }

◆ ensureLoaded()

bool PRDCollHandleBase::Imp::ensureLoaded ( )

◆ etaPhiCut()

bool PRDCollHandleBase::Imp::etaPhiCut ( PRDHandleBase handle)

Definition at line 861 of file PRDCollHandleBase.cxx.

862 {
863  bool allPhiAllowed = allowedPhi.count()==1&&allowedPhi.at(0).isAllR();
864  bool allEtaAllowed = allowedEta.isAllR();
865  if (allEtaAllowed&&allPhiAllowed)
866  return true;
867  if (allowedPhi.isEmpty()||allowedEta.isEmpty())
868  return false;
869  Amg::Vector3D p = handle->center();
870  if (!allEtaAllowed) {
871  if (!allowedEta.contains(p.eta()))
872  return false;
873  }
874  if (!allPhiAllowed) {
875  double phi(p.phi());
876  for(const VP1Interval& i : allowedPhi) {
877  if (i.contains(phi)||i.contains(phi+2*M_PI)||i.contains(phi-2*M_PI))
878  return true;
879  }
880  return false;
881  }
882  return true;
883 }

◆ updateDetailSepAttachments()

void PRDCollHandleBase::Imp::updateDetailSepAttachments ( )

Definition at line 360 of file PRDCollHandleBase.cxx.

361 {
362  SoSeparator * collsep = theclass->collSep();
363  if (!collsep)
364  return;
365  bool save = collsep->enableNotify(false);
367  //Detail
368  if (collsep->findChild(sephelper_detail->topSeparator())<0)
369  collsep->addChild(sephelper_detail->topSeparator());
370  } else {
371  //No detail
372  if (collsep->findChild(sephelper_detail->topSeparator())>-1)
373  collsep->removeChild(sephelper_detail->topSeparator());
374  }
376  //Simple
377  if (collsep->findChild(sephelper_simple->topSeparator())<0)
378  collsep->addChild(sephelper_simple->topSeparator());
379  } else {
380  //No simple
381  if (collsep->findChild(sephelper_simple->topSeparator())>-1)
382  collsep->removeChild(sephelper_simple->topSeparator());
383  }
385  //LOD
386  if (collsep->findChild(sep_lods)<0)
387  collsep->addChild(sep_lods);
388  } else {
389  //No LOD
390  if (collsep->findChild(sep_lods)>-1)
391  collsep->removeChild(sep_lods);
392  }
393  if (save) {
394  collsep->enableNotify(true);
395  collsep->touch();
396  }
397 }

Member Data Documentation

◆ allowedEta

VP1Interval PRDCollHandleBase::Imp::allowedEta

Definition at line 62 of file PRDCollHandleBase.cxx.

◆ allowedPhi

QList<VP1Interval> PRDCollHandleBase::Imp::allowedPhi

Definition at line 63 of file PRDCollHandleBase.cxx.

◆ comboBox_detailLevel

QComboBox* PRDCollHandleBase::Imp::comboBox_detailLevel = nullptr

Definition at line 76 of file PRDCollHandleBase.cxx.

◆ detType

PRDDetType::Type PRDCollHandleBase::Imp::detType

Definition at line 45 of file PRDCollHandleBase.cxx.

◆ drawerrors

bool PRDCollHandleBase::Imp::drawerrors = false

Definition at line 59 of file PRDCollHandleBase.cxx.

◆ drawrdos

bool PRDCollHandleBase::Imp::drawrdos = false

Definition at line 60 of file PRDCollHandleBase.cxx.

◆ generalprddetaillevel

DETAIL PRDCollHandleBase::Imp::generalprddetaillevel

Definition at line 54 of file PRDCollHandleBase.cxx.

◆ highlightmaterial

SoMaterial* PRDCollHandleBase::Imp::highlightmaterial = nullptr

Definition at line 57 of file PRDCollHandleBase.cxx.

◆ highlightoutliers

bool PRDCollHandleBase::Imp::highlightoutliers = false

Definition at line 58 of file PRDCollHandleBase.cxx.

◆ prdhandles

std::vector<PRDHandleBase*> PRDCollHandleBase::Imp::prdhandles

Definition at line 71 of file PRDCollHandleBase.cxx.

◆ regionindex2lodhelpers

std::map<int,std::pair<SoLevelOfDetail*,std::pair<VP1ExtraSepLayerHelper*,VP1ExtraSepLayerHelper*> > > PRDCollHandleBase::Imp::regionindex2lodhelpers

Definition at line 53 of file PRDCollHandleBase.cxx.

◆ sep_lods

SoSeparator* PRDCollHandleBase::Imp::sep_lods = nullptr

Definition at line 52 of file PRDCollHandleBase.cxx.

◆ sephelper_detail

VP1ExtraSepLayerHelper* PRDCollHandleBase::Imp::sephelper_detail = nullptr

Definition at line 50 of file PRDCollHandleBase.cxx.

◆ sephelper_simple

VP1ExtraSepLayerHelper* PRDCollHandleBase::Imp::sephelper_simple = nullptr

Definition at line 51 of file PRDCollHandleBase.cxx.

◆ storegate_key

QString PRDCollHandleBase::Imp::storegate_key

Definition at line 44 of file PRDCollHandleBase.cxx.

◆ theclass

PRDCollHandleBase* PRDCollHandleBase::Imp::theclass = nullptr

Definition at line 41 of file PRDCollHandleBase.cxx.


The documentation for this class was generated from the following file:
PRDCollHandleBase::Imp::allowedPhi
QList< VP1Interval > allowedPhi
Definition: PRDCollHandleBase.cxx:63
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
PRDCollHandleBase::SIMPLE
@ SIMPLE
Definition: PRDCollHandleBase.h:66
VP1HelperClassBase::messageVerbose
void messageVerbose(const QString &) const
Definition: VP1HelperClassBase.cxx:78
PRDCollHandleBase::postLoadInitialisation
virtual void postLoadInitialisation()
Definition: PRDCollHandleBase.h:103
PRDCollHandleBase::common
PRDSysCommonData * common() const
Definition: PRDCollHandleBase.h:49
PRDCollHandleBase::DETAILED
@ DETAILED
Definition: PRDCollHandleBase.h:66
M_PI
#define M_PI
Definition: ActiveFraction.h:11
PRDCollHandleBase::addHandle
void addHandle(PRDHandleBase *)
Definition: PRDCollHandleBase.cxx:500
PRDHandleBase::isSane
virtual bool isSane() const
Returns false if the PRD is not safe to draw.
Definition: PRDHandleBase.h:75
PRDCollHandleBase::Imp::storegate_key
QString storegate_key
Definition: PRDCollHandleBase.cxx:44
PRDCollHandleBase::Imp::allowedEta
VP1Interval allowedEta
Definition: PRDCollHandleBase.cxx:62
VP1String::str
static QString str(const QString &s)
Definition: VP1String.h:49
PRDCollHandleBase::Imp::generalprddetaillevel
DETAIL generalprddetaillevel
Definition: PRDCollHandleBase.cxx:54
VP1HelperClassBase::messageDebug
void messageDebug(const QString &) const
Definition: VP1HelperClassBase.cxx:65
PRDCollHandleBase::addPRD
virtual PRDHandleBase * addPRD(const Trk::PrepRawData *)=0
VP1SGContentsHelper::getKeys
QStringList getKeys() const
Definition: VP1SGContentsHelper.h:55
PRDCollHandleBase::AUTO
@ AUTO
Definition: PRDCollHandleBase.h:66
checkTP.save
def save(self, fileName="./columbo.out")
Definition: checkTP.py:178
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
PRDSysCommonData::registerPRD2Handle
void registerPRD2Handle(const Trk::PrepRawData *prd, PRDHandleBase *handle)
Definition: PRDSysCommonData.cxx:97
lumiFormat.i
int i
Definition: lumiFormat.py:85
PRDCollHandleBase::Imp::sephelper_detail
VP1ExtraSepLayerHelper * sephelper_detail
Definition: PRDCollHandleBase.cxx:50
PRDCollHandleBase::recheckCutStatusOfAllNotVisibleHandles
void recheckCutStatusOfAllNotVisibleHandles()
Definition: PRDCollHandleBase.cxx:603
VP1Interval::isEmpty
bool isEmpty() const
PRDHandleBase::getPRD
virtual const Trk::PrepRawData * getPRD() const =0
VP1HelperClassBase::systemBase
IVP1System * systemBase() const
Definition: VP1HelperClassBase.h:50
python.selection.number
number
Definition: selection.py:20
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
VP1Interval::contains
bool contains(const double &x) const
PRDCollHandleBase::Imp::sephelper_simple
VP1ExtraSepLayerHelper * sephelper_simple
Definition: PRDCollHandleBase.cxx:51
PRDCollHandleBase::Imp::sep_lods
SoSeparator * sep_lods
Definition: PRDCollHandleBase.cxx:52
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
VP1SGContentsHelper
Definition: VP1SGContentsHelper.h:26
VP1Interval
Definition: VP1Interval.h:23
PRDCollHandleBase::nShownHandles
int nShownHandles()
Definition: PRDCollHandleBase.h:121
IVP1System::updateGUI
void updateGUI()
Definition: IVP1System.cxx:262
VP1Interval::isAllR
bool isAllR() const
VP1ExtraSepLayerHelper::topSeparator
SoSeparator * topSeparator() const
Definition: VP1ExtraSepLayerHelper.cxx:178
VP1StdCollection::collSep
SoSeparator * collSep() const
All 3D objects from this coll.
Definition: VP1StdCollection.cxx:212
VP1HelperClassBase::message
void message(const QString &) const
Definition: VP1HelperClassBase.cxx:49
PRDHandleBase
Definition: PRDHandleBase.h:35
PRDCollHandleBase::Imp::prdhandles
std::vector< PRDHandleBase * > prdhandles
Definition: PRDCollHandleBase.cxx:71
VP1SGAccessHelper
Definition: VP1SGAccessHelper.h:25
SG::ConstIterator
Definition: SGIterator.h:163
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
PRDHandleBase::center
virtual Amg::Vector3D center() const
Definition: PRDHandleBase.cxx:316
PRDCollHandleBase::Imp::theclass
PRDCollHandleBase * theclass
Definition: PRDCollHandleBase.cxx:41
Trk::PrepRawData::detectorElement
virtual const TrkDetElementBase * detectorElement() const =0
return the detector element corresponding to this PRD The pointer will be zero if the det el is not d...