diff --git a/[refs] b/[refs] index 50f75f88026df..63d35dacf7384 100644 --- a/[refs] +++ b/[refs] @@ -1,3 +1,3 @@ --- refs/heads/gh-pages: 09c786f70121f131b3715aaf3464996502bbeb7e -"refs/heads/CMSSW_7_1_X": cc11794e7ecca2359bfde918089808a9bde76fc8 +"refs/heads/CMSSW_7_1_X": 487a7a279f5854201a308164784436c3e441bad4 diff --git a/trunk/Geometry/CaloEventSetup/test/CaloGeometryAnalyzer.cc b/trunk/Geometry/CaloEventSetup/test/CaloGeometryAnalyzer.cc index c17307170f0f4..0132aee5577c4 100644 --- a/trunk/Geometry/CaloEventSetup/test/CaloGeometryAnalyzer.cc +++ b/trunk/Geometry/CaloEventSetup/test/CaloGeometryAnalyzer.cc @@ -50,13 +50,18 @@ // using namespace CLHEP; -class CaloGeometryAnalyzer : public edm::EDAnalyzer { - public: +class CaloGeometryAnalyzer : public edm::EDAnalyzer +{ + enum CenterOrCorner { kCenter , kCorner } ; + enum XorYorZ { kX, kY, kZ } ; + + public: + explicit CaloGeometryAnalyzer( const edm::ParameterSet& ); ~CaloGeometryAnalyzer(); - virtual void analyze( const edm::Event&, const edm::EventSetup& ); + private: // ----------member data --------------------------- void build( const CaloGeometry& cg , @@ -65,17 +70,22 @@ class CaloGeometryAnalyzer : public edm::EDAnalyzer { const char* name, unsigned int histi ); - void ctrcor( const DetId::Detector det , - const int subdetn , - const DetId& did , + void ctrcor( const DetId& did , const CaloCellGeometry& cell , std::fstream& fCtr , std::fstream& fCor , std::fstream& oldCtr , std::fstream& oldCor , unsigned int histi ); - int pass_; - // bool fullEcalDump_; + + void checkDiff( unsigned int i1, + unsigned int i2, + unsigned int i3, + CenterOrCorner iCtrCor , + XorYorZ iXYZ , + double diff ) ; + int pass_; + // bool fullEcalDump_; EEDetId gid( unsigned int ix, unsigned int iy, @@ -105,6 +115,7 @@ class CaloGeometryAnalyzer : public edm::EDAnalyzer { TH1D* h_diffs[10][12] ; + bool m_allOK ; }; // // constants, enums and typedefs @@ -344,10 +355,31 @@ CaloGeometryAnalyzer::ovrTst( const CaloGeometry& cg , } } + void -CaloGeometryAnalyzer::ctrcor( const DetId::Detector det , - const int subdetn , - const DetId& did , +CaloGeometryAnalyzer::checkDiff( unsigned int i1, + unsigned int i2, + unsigned int i3, + CenterOrCorner iCtrCor , + XorYorZ iXYZ , + double diff ) +{ + if( 1.6 < fabs( diff ) ) + { + std::cout<<"For a volume "<<( kCenter==iCtrCor ? "CENTER" : "CORNER" ) + <<", & " + <<"i1="<>oldie>>oldip ; oldCor>>oldie>>oldip ; - if( det == DetId::Ecal && - subdetn == EcalBarrel ) + const CaloGenericDetId cgid ( did ) ; + if( cgid.isEB() ) { const EBDetId ebid ( did ) ; const int ie ( ebid.ieta() ) ; @@ -370,8 +402,7 @@ CaloGeometryAnalyzer::ctrcor( const DetId::Detector det , fCor << std::setw(4) << ie << std::setw(4) << ip ; } - if( det == DetId::Ecal && - subdetn == EcalEndcap ) + if( cgid.isEE() ) { const EEDetId eeid ( did ) ; const int ix ( eeid.ix() ) ; @@ -382,8 +413,7 @@ CaloGeometryAnalyzer::ctrcor( const DetId::Detector det , fCor << std::setw(4) << ix << std::setw(4) << iy ; } - if( det == DetId::Ecal && - subdetn == EcalPreshower ) + if( cgid.isES() ) { const ESDetId esid ( did ) ; const int pl ( esid.plane() ) ; @@ -403,7 +433,7 @@ CaloGeometryAnalyzer::ctrcor( const DetId::Detector det , oldCtr>>oldiy>>oldst ; oldCor>>oldip>>oldst ; } - if( det == DetId::Hcal ) + if( cgid.isHcal() ) { const HcalDetId hcid ( did ) ; const int ie ( hcid.ieta() ) ; @@ -420,8 +450,7 @@ CaloGeometryAnalyzer::ctrcor( const DetId::Detector det , oldCtr>>oldde ; oldCor>>oldde ; } - if( det == DetId::Calo && - subdetn == HcalZDCDetId::SubdetectorId ) + if( cgid.isZDC() ) { const HcalZDCDetId zcid ( did ) ; const int is ( zcid.section() ) ; @@ -431,8 +460,7 @@ CaloGeometryAnalyzer::ctrcor( const DetId::Detector det , fCor << std::setw(4) << is << std::setw(4) << ic ; } - if( det == DetId::Calo && - subdetn == HcalCastorDetId::SubdetectorId ) + if( cgid.isCastor() ) { const HcalCastorDetId cid ( did ) ; const int is ( cid.sector() ) ; @@ -442,8 +470,7 @@ CaloGeometryAnalyzer::ctrcor( const DetId::Detector det , fCor << std::setw(4) << is << std::setw(4) << im ; } - if( det == DetId::Calo && - subdetn == CaloTowerDetId::SubdetId ) + if( cgid.isCaloTower() ) { const CaloTowerDetId cid ( did ) ; const int ie ( cid.ieta() ) ; @@ -470,13 +497,9 @@ CaloGeometryAnalyzer::ctrcor( const DetId::Detector det , h_diffs[histi][1]->Fill( dy ) ; h_diffs[histi][2]->Fill( dz ) ; - if( 1.6 < fabs( dx ) ) std::cout<<"For i="<Fill( dy ) ; h_diffs[histi][j+5]->Fill( dz ) ; - if( 1.6 < fabs( dx ) ) std::cout<<"For i="<& ids ( geom->getValidDetIds( det, subdetn ) ) ; - std::cout<<"***************total number = "<().get(pG); const std::vector allDetId ( pG->getValidDetIds() ) ; - std::cout<<"Total number of DetIds in all subdets is = "<(pG->getGeometry(EEDetId((*pG).getSubdetectorGeometry(DetId::Ecal,EcalEndcap)->getClosestCell(GlobalPoint(-38.9692,-27.5548,-317)))))->getPosition(0.) << std::endl; +// std::cout << "Checking getClosestCell for position" << GlobalPoint(-38.9692,-27.5548,-317) << std::endl; +// std::cout << "Position of Closest Cell in EE " << dynamic_cast(pG->getGeometry(EEDetId((*pG).getSubdetectorGeometry(DetId::Ecal,EcalEndcap)->getClosestCell(GlobalPoint(-38.9692,-27.5548,-317)))))->getPosition(0.) << std::endl; + + std::cout<<"\n\n*********** Validation of cell centers and corners " + <<( m_allOK ? "SUCCEEDS!! " : "FAILS!! ") + <<"**********************\n\n\n" + <