Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:16:30

0001 //==========================================================================
0002 //  AIDA Detector description implementation 
0003 //--------------------------------------------------------------------------
0004 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0005 // All rights reserved.
0006 //
0007 // For the licensing terms see $DD4hepINSTALL/LICENSE.
0008 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0009 //
0010 // Author     : M.Frank
0011 //
0012 //==========================================================================
0013 
0014 // Framework include files
0015 #include <DD4hep/Printout.h>
0016 #include <DD4hep/InstanceCount.h>
0017 #include <DD4hep/detail/ConditionsInterna.h>
0018 #include <DDCond/ConditionsPool.h>
0019 #include <DDCond/ConditionsIOVPool.h>
0020 #include <DDCond/ConditionsOperators.h>
0021 
0022 // C/C++ include files
0023 #include <cstring>
0024 
0025 using namespace dd4hep::cond;
0026 
0027 /// Select all condition from the conditions manager registered at the Detector object
0028 size_t Operators::collectAllConditions(Detector& description, RangeConditions& conditions)   {
0029   ConditionsManager manager = ConditionsManager::from(description);
0030   return collectAllConditions(manager, conditions);
0031 }
0032 
0033 /// Select all condition from the conditions manager registered at the Detector object
0034 size_t Operators::collectAllConditions(ConditionsManager manager, RangeConditions& conditions)   {
0035   const auto types = manager.iovTypesUsed();
0036   size_t num_conditions = 0;
0037   for( auto type : types )  {
0038     if ( type )   {
0039       ConditionsIOVPool* pool = manager.iovPool(*type);
0040       if ( pool )  {
0041         for( auto& cp : pool->elements )  {
0042           RangeConditions rc;
0043           cp.second->select_all(rc);
0044           for( auto c : rc )
0045             conditions.emplace_back(c);
0046           num_conditions += rc.size();
0047         }
0048       }
0049     }
0050   }
0051   return num_conditions;
0052 }
0053 
0054 /// Select all condition from the conditions manager registered at the Detector object
0055 size_t Operators::collectAllConditions(Detector& description, std::map<int,Condition>& conditions)   {
0056   ConditionsManager manager = ConditionsManager::from(description);
0057   return collectAllConditions(manager, conditions);
0058 }
0059 
0060 /// Select all condition from the conditions manager registered at the Detector object
0061 size_t Operators::collectAllConditions(ConditionsManager manager, std::map<int,Condition>& conditions)   {
0062   const auto types = manager.iovTypesUsed();
0063   size_t num_conditions = 0;
0064   for( auto type : types )  {
0065     if ( type )   {
0066       ConditionsIOVPool* pool = manager.iovPool(*type);
0067       if ( pool )  {
0068         for( auto& cp : pool->elements )  {
0069           RangeConditions rc;
0070           cp.second->select_all(rc);
0071           for( auto c : rc )
0072             conditions.emplace(c->hash,c);
0073           num_conditions += rc.size();
0074         }
0075       }
0076     }
0077   }
0078   return num_conditions;
0079 }
0080