CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
WriteOneGeometryFromXML Class Reference

#include <WriteOneGeometryFromXML.h>

Inheritance diagram for WriteOneGeometryFromXML:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginRun (const edm::Run &, edm::EventSetup const &)
 
virtual void endJob ()
 
 WriteOneGeometryFromXML (const edm::ParameterSet &iConfig)
 
 ~WriteOneGeometryFromXML ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

std::string label_
 
int rotNumSeed_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 6 of file WriteOneGeometryFromXML.h.

Constructor & Destructor Documentation

WriteOneGeometryFromXML::WriteOneGeometryFromXML ( const edm::ParameterSet iConfig)
explicit

Definition at line 24 of file WriteOneGeometryFromXML.cc.

References gather_cfg::cout, edm::ParameterSet::getParameter(), and rotNumSeed_.

24  : label_()
25 {
26  std::cout<<"WriteOneGeometryFromXML::WriteOneGeometryFromXML"<<std::endl;
27  rotNumSeed_ = iConfig.getParameter<int>("rotNumSeed");
28 }
T getParameter(std::string const &) const
tuple cout
Definition: gather_cfg.py:121
WriteOneGeometryFromXML::~WriteOneGeometryFromXML ( )

Definition at line 30 of file WriteOneGeometryFromXML.cc.

References gather_cfg::cout.

31 {
32  std::cout<<"WriteOneGeometryFromXML::~WriteOneGeometryFromXML"<<std::endl;
33 }
tuple cout
Definition: gather_cfg.py:121

Member Function Documentation

virtual void WriteOneGeometryFromXML::analyze ( const edm::Event ,
const edm::EventSetup  
)
inlinevirtual

Implements edm::EDAnalyzer.

Definition at line 12 of file WriteOneGeometryFromXML.h.

12 {}
void WriteOneGeometryFromXML::beginRun ( const edm::Run ,
edm::EventSetup const &  es 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 36 of file WriteOneGeometryFromXML.cc.

References DDBase< DDName, DDI::Material * >::begin(), DDBase< DDName, DDRotationMatrix * >::begin(), DDBase< DDName, DDI::Specific * >::begin(), DDBase< DDName, DDI::Solid * >::begin(), cond::service::PoolDBOutputService::beginOfTime(), gather_cfg::cout, cond::service::PoolDBOutputService::createNewIOV(), DDrot(), DDBase< DDName, DDI::Specific * >::end(), DDBase< DDName, DDRotationMatrix * >::end(), DDBase< DDName, DDI::Material * >::end(), DDBase< DDName, DDI::Solid * >::end(), cond::service::PoolDBOutputService::endOfTime(), edm::EventSetup::get(), i, DDI::Singleton< I >::instance(), edm::Service< T >::isAvailable(), DDBase< N, C >::isDefined(), cond::service::PoolDBOutputService::isNewTagRequest(), edm::ESHandleBase::isValid(), label_, DDRotation::matrix(), cmsRelvalreport::red(), rotNumSeed_, and makeHLTPrescaleTable::values.

37 {
38  std::cout<<"WriteOneGeometryFromXML::beginRun"<<std::endl;
39  PIdealGeometry* pgeom = new PIdealGeometry;
41  if( !mydbservice.isAvailable() ){
42  std::cout<<"PoolDBOutputService unavailable"<<std::endl;
43  return;
44  }
45 
46  // std::cout << "About to do... size_t callbackToken=mydbservice->callbackToken(\"PIdealGeometry\");" << std::endl;
47  // size_t callbackToken=mydbservice->callbackToken("PIdealGeometry");
48  // std::cout << "Got back token " << callbackToken << std::endl;
50 
51  es.get<IdealGeometryRecord>().get(label_, pDD );
52  if (pDD.isValid())
53  std::cout << "DD is Valid" << std::endl;
54 
55  DDCompactView::DDCompactView::graph_type gra = pDD->graph();
56 
57  DDDToPersFactory dddFact;
58  DDMaterial::iterator<DDMaterial> it(DDMaterial::begin()), ed(DDMaterial::end());
59  PMaterial* pm;
60  for (; it != ed; ++it) {
61  if (! it->isDefined().second) continue;
62  pm = dddFact.material ( *it );
63  pgeom->pMaterials.push_back ( *pm );
64  delete pm;
65  }
66 
67  DDRotation::iterator<DDRotation> rit(DDRotation::begin()), red(DDRotation::end());
68  PRotation* pr;
69  DDRotation rotn(DDName("IDENTITYDB","generatedForDB"));
70  if ( !rotn.isDefined().second ) {
71  DDRotationMatrix* rotID = new DDRotationMatrix();
72  DDRotation mydr = DDrot (DDName("IDENTITYDB","generatedForDB"), rotID);
73  pr = dddFact.rotation ( mydr );
74  pgeom->pRotations.push_back ( *pr );
75  }
76  for (; rit != red; ++rit) {
77  if (! rit->isDefined().second) continue;
78  // if it is the identity...
79  if ( *(rit->matrix()) == *(rotn.matrix()) ) continue;
80  pr = dddFact.rotation( *rit );
81  pgeom->pRotations.push_back ( *pr );
82  }
83 
84 
85  DDSolid::iterator<DDSolid> sit(DDSolid::begin()), sed(DDSolid::end());
86  PSolid* ps;
87  for (; sit != sed; ++sit) {
88  if (! sit->isDefined().second) continue;
89  ps = dddFact.solid( *sit );
90  pgeom->pSolids.push_back( *ps );
91  delete ps;
92  }
93 
94  // Discovered during validation: If a user declares
95  // a LogicalPart in the DDD XML and does not position it
96  // in the graph, it will NOT be stored to the database
97  // subsequently SpecPars (see below) that use wildcards
98  // that may have selected the orphaned LogicalPart node
99  // will be read into the DDD from the DB (not by this
100  // code, but in the system) and so DDSpecifics will
101  // throw a DDException.
102  typedef DDCompactView::graph_type::const_adj_iterator adjl_iterator;
103  adjl_iterator git = gra.begin();
104  adjl_iterator gend = gra.end();
105 
107  PLogicalPart* plp;
108  for (; git != gend; ++git)
109  {
110  const DDLogicalPart & ddLP = gra.nodeData(git);
111  // std::cout << ddLP << std::endl;
112  plp = dddFact.logicalPart ( ddLP );
113  pgeom->pLogicalParts.push_back( *plp );
114  delete plp;
115  ++i;
116  if (git->size())
117  {
118  // ask for children of ddLP
119  DDCompactView::graph_type::edge_list::const_iterator cit = git->begin();
120  DDCompactView::graph_type::edge_list::const_iterator cend = git->end();
121  PPosPart* ppp;
122  for (; cit != cend; ++cit)
123  {
124  const DDLogicalPart & ddcurLP = gra.nodeData(cit->first);
125  ppp = dddFact.position ( ddLP, ddcurLP, gra.edgeData(cit->second), *pgeom, rotNumSeed_ );
126  // std::cout << "okay after the factory..." << std::endl;
127  pgeom->pPosParts.push_back( *ppp );
128  // std::cout << "okay after the push_back" << std::endl;
129  delete ppp;
130  // std::cout << "okay after the delete..." << std::endl;
131  } // iterate over children
132  } // if (children)
133  } // iterate over graph nodes
134 
135  std::vector<std::string> partSelections;
136  std::map<std::string, std::vector<std::pair<std::string, double> > > values;
137  std::map<std::string, int> isEvaluated;
138 
139  PSpecPar* psp;
140 
141  DDSpecifics::iterator<DDSpecifics> spit(DDSpecifics::begin()), spend(DDSpecifics::end());
142 
143  // ======= For each DDSpecific...
144  for (; spit != spend; ++spit) {
145  if ( !spit->isDefined().second ) continue;
146  psp = dddFact.specpar( *spit );
147  pgeom->pSpecPars.push_back( *psp );
148  delete psp;
149  }
150  std::cout <<" did the static work? is there a size to this string storage? " << std::endl;
151  std::cout << " dddFact.pstrs.pStrings.size() = " << dddFact.pstrs.pStrings.size() << std::endl;
152  pgeom->pStrings = dddFact.pstrs.pStrings;
153  pgeom->pStartNode = DDRootDef::instance().root().toString();
154 
155  if ( mydbservice->isNewTagRequest("IdealGeometryRecord") ) {
156  // mydbservice->newValidityForNewPayload<PIdealGeometry>(pgeom, mydbservice->endOfTime(), callbackToken);
157  mydbservice->createNewIOV<PIdealGeometry>(pgeom
158  , mydbservice->beginOfTime()
159  , mydbservice->endOfTime()
160  , "IdealGeometryRecord");
161  } else {
162  std::cout << "Tag is already present." << std::endl;
163  }
164 }
int i
Definition: DBlmapReader.cc:9
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:18
std::vector< double >::size_type index_type
Definition: adjgraph.h:15
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:66
static value_type & instance()
bool isNewTagRequest(const std::string &recordName)
bool isAvailable() const
Definition: Service.h:47
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:88
void createNewIOV(T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
DDRotation DDrot(const DDName &name, DDRotationMatrix *rot)
Definition of a uniquely identifiable rotation matrix named by DDName name.
Definition: DDRotation.cc:91
adj_list::const_iterator const_adj_iterator
Definition: adjgraph.h:125
static DDI::Store< DDName, DDI::Material * >::iterator begin()
Definition: DDBase.h:70
tuple cout
Definition: gather_cfg.py:121
static DDI::Store< DDName, DDI::Material * >::iterator end()
Definition: DDBase.h:69
bool isValid() const
Definition: ESHandle.h:37
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
virtual void WriteOneGeometryFromXML::endJob ( void  )
inlinevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 13 of file WriteOneGeometryFromXML.h.

13 {};

Member Data Documentation

std::string WriteOneGeometryFromXML::label_
private
int WriteOneGeometryFromXML::rotNumSeed_
private

Definition at line 17 of file WriteOneGeometryFromXML.h.

Referenced by beginRun(), and WriteOneGeometryFromXML().