ATLAS Offline Software
Loading...
Searching...
No Matches
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))
304 theclass->systemBase()->updateGUI();
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))
330 theclass->systemBase()->updateGUI();
331 }
332 }
333 }
334 theclass->systemBase()->updateGUI();
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");
346 theclass->postLoadInitialisation();
347
348 theclass->systemBase()->updateGUI();
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}
PRDCollHandleBase * theclass
std::vector< PRDHandleBase * > prdhandles
virtual const Trk::PrepRawData * getPRD() const =0
virtual bool isSane() const
Returns false if the PRD is not safe to draw.
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...
unsigned long long T

◆ 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}
#define M_PI
Scalar phi() const
phi method
QList< VP1Interval > allowedPhi
virtual Amg::Vector3D center() const
Eigen::Matrix< double, 3, 1 > Vector3D

◆ 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}
VP1ExtraSepLayerHelper * sephelper_simple
VP1ExtraSepLayerHelper * sephelper_detail

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: