DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
DetNominalCreator.cpp
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : M.Frank
11 //
12 //==========================================================================
13 //
14 // Specialized generic detector constructor
15 //
16 //==========================================================================
17 #ifndef DD4HEP_DETNOMINALCREATOR_H
18 #define DD4HEP_DETNOMINALCREATOR_H
19 
20 // Framework include files
21 #include <DD4hep/DetElement.h>
22 
23 namespace dd4hep {
24 
26  /* Heuristically assign DetElement structures to the sensitive volume pathes.
27  *
28  * \author M.Frank
29  * \version 1.0
30  * \ingroup DD4HEP_CORE
31  */
34  public:
37  virtual ~DetNominalCreator() = default;
38  int operator()(DetElement de, int /* level */) const {
39  if ( de.nominal().isValid() ) return 1;
40  return 0;
41  }
42  };
43 }
44 #endif /* DD4HEP_DETNOMINALCREATOR_H */
45 
46 // Framework include files
49 
50 // C/C++ include files
51 
52 
53 using namespace std;
54 using namespace dd4hep;
55 
56 static void* create_object(Detector& description, int argc, char** argv) {
57  for(int i = 0; i < argc && argv[i]; ++i) { }
58  shared_ptr<DetNominalCreator> obj(new DetNominalCreator(description));
61  return (void*)proc;
62 }
63 
64 // first argument is the type from the xml file
65 DECLARE_DD4HEP_CONSTRUCTOR(DD4hep_DetNominalCreator,create_object)
DetectorProcessor.h
dd4hep::DetNominalCreator::operator()
int operator()(DetElement de, int) const
Definition: DetNominalCreator.cpp:38
dd4hep::Handle::isValid
bool isValid() const
Check the validity of the object held by the handle.
Definition: Handle.h:128
dd4hep::DetElement
Handle class describing a detector element.
Definition: DetElement.h:188
DECLARE_DD4HEP_CONSTRUCTOR
#define DECLARE_DD4HEP_CONSTRUCTOR(name, func)
Definition: Factories.h:291
dd4hep::DetElement::nominal
Alignment nominal() const
Access to the constant ideal (nominal) alignment information.
Definition: DetElement.cpp:185
dd4hep::DetNominalCreator::DetNominalCreator
DetNominalCreator(Detector &d)
Definition: DetNominalCreator.cpp:35
DetFactoryHelper.h
std
Definition: Plugins.h:30
DetElement.h
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::Detector
The main interface to the dd4hep detector description package.
Definition: Detector.h:90
dd4hep::DetectorProcessorShared
Wrapper to call objects in the form of a detector element processor.
Definition: DetectorProcessor.h:100
dd4hep::DetNominalCreator::DetNominalCreator
DetNominalCreator(const DetNominalCreator &c)
Definition: DetNominalCreator.cpp:36
dd4hep::DetNominalCreator
DD4hep DetElement creator for the CMS geometry.
Definition: DetNominalCreator.cpp:32
dd4hep::DetNominalCreator::~DetNominalCreator
virtual ~DetNominalCreator()=default
dd4hep::DetNominalCreator::description
Detector & description
Definition: DetNominalCreator.cpp:33