52 std::cout <<
"analyze does nothing" << std::endl;
57 double tolerance = 1.0e-3;
59 std::string physicalPartsTreeFileName(
"PHYSICALPARTSTREE.dat");
60 std::string logicalPartTypesFileName(
"LOGICALPARTTYPES.dat");
61 std::string nominalPlacementsFileName(
"NOMINALPLACEMENTS.dat");
62 std::string detectorPartsFileName(
"DETECTORPARTS.dat");
63 std::string pospartsGraphFileName(
"POSPARTSGRAPH.dat");
65 std::ofstream physicalPartsTreeOS(physicalPartsTreeFileName.c_str());
66 std::ofstream logicalPartTypesOS(logicalPartTypesFileName.c_str());
67 std::ofstream nominalPlacementsOS(nominalPlacementsFileName.c_str());
68 std::ofstream detectorPartsOS(detectorPartsFileName.c_str());
69 std::ofstream pospartsGraphOS(pospartsGraphFileName.c_str());
74 std::vector<std::string> lpname_vec;
77 std::cout <<
"PhysicalPartsTree Analyzer..." << std::endl;
90 std::ostringstream
parent,
child,logicalpartid,parentid;
93 parent << hist[hist.size()-2].logicalPart().name();
95 parentid<<hist[hist.size()-2];
96 lgname=logicalpartid.str();
97 lastfound=lgname.find_last_of(
"/\\");
98 lgname=lgname.substr(lastfound+1,lgname.size());
99 physicalPartsTreeOS<<lgname<<
","<< parentid.str() <<
"," << child.str()<<std::endl;
103 bool reflection =
false;
106 epv.
rotation().GetComponents(x, y, z);
113 if ( (1.0 + (x.Cross(y)).Dot(z)) <= tolerance ) {
116 std::vector<double> comps(9);
117 epv.
rotation().GetComponents(comps.begin(), comps.end());
118 nominalPlacementsOS<< logicalpartid.str()<<
","
147 <<logicalpartid.str()
152 pospartsGraphOS<<++pospartid<<
","<<epv.
copyno()<<
","
153 <<parent.str() <<
"," << child.str()<<std::endl;
165 std::vector<std::string>::iterator it =
find(lpname_vec.begin(), lpname_vec.end(), slpname);
167 if (it==lpname_vec.end()){
171 scategory=category.str();
173 if(scategory==unspec){
174 lpname_vec.push_back(slpname);
175 logicalPartTypesOS <<slpname<<
","
176 <<
"DETECTORPARTS"<<std::endl;
179 lpname_vec.push_back(slpname);
180 logicalPartTypesOS <<slpname<<
","<<scategory<<std::endl;
185 lpname_vec.push_back(slpname);
186 logicalPartTypesOS <<slpname<<
","
187 <<
"DETECTORPARTS"<<std::endl;
197 physicalPartsTreeOS.close();
198 logicalPartTypesOS.close();
199 nominalPlacementsOS.close();
200 detectorPartsOS.close();
201 pospartsGraphOS.close();
bool next()
set current node to the next node in the expanded tree
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
DDEnums::Category category(void) const
Returns the categorization of the DDLogicalPart (sensitive detector element, cable, ...)
#define DEFINE_FWK_MODULE(type)
static const char * categoryName(Category s)
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
type of data representation of DDCompactView
PhysicalPartsTree(const edm::ParameterSet &)
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
A DD Translation is currently implemented with Root Vector3D.
const DDTranslation & translation() const
The absolute translation of the current node.
virtual void beginRun(const edm::Run &, const edm::EventSetup &)
std::vector< DDExpandedNode > DDGeoHistory
Geometrical 'path' of the current node up to the root-node.
std::string toString() const
int copyno() const
Copy number associated with the current node.
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the expanded-view.
Provides an exploded view of the detector (tree-view)
virtual void analyze(const edm::Event &, const edm::EventSetup &)
const DDMaterial & material(void) const
Returns a reference object of the material this LogicalPart is made of.