CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/src/DataFormats/ParticleFlowReco/src/PFLayer.cc

Go to the documentation of this file.
00001 #include "DataFormats/ParticleFlowReco/interface/PFLayer.h"
00002 
00003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00004 
00005 #include <assert.h>
00006 #include <iostream>
00007 
00008 using namespace reco;
00009 using namespace std;
00010 
00011 CaloID  PFLayer::toCaloID( Layer layer) {
00012   
00013   switch(layer) {
00014   case PS2           : return  CaloID(CaloID::DET_PS2);      
00015   case PS1           : return  CaloID(CaloID::DET_PS1); 
00016   case ECAL_ENDCAP   : return  CaloID(CaloID::DET_ECAL_ENDCAP); 
00017   case ECAL_BARREL   : return  CaloID(CaloID::DET_ECAL_BARREL);  
00018   case HCAL_BARREL1  : return  CaloID(CaloID::DET_HCAL_BARREL); 
00019   case HCAL_BARREL2  : return  CaloID(CaloID::DET_HO); 
00020   case HCAL_ENDCAP   : return  CaloID(CaloID::DET_HCAL_ENDCAP); 
00021   case HF_EM         : return  CaloID(CaloID::DET_HF_EM); 
00022   case HF_HAD        : return  CaloID(CaloID::DET_HF_HAD); 
00023   default            : return  CaloID();
00024   }
00025 }
00026 
00027 
00028 PFLayer::Layer   PFLayer::fromCaloID( const CaloID& id) {
00029 
00030   //  cout<<"PFLayer::fromCaloID "<<id<<" "<<id.detector()<<endl;
00031   if( !id.isSingleDetector() ) {
00032     edm::LogError("PFLayer")<<"cannot convert "<<id<<" to a layer, as this CaloID does not correspond to a single detector"; 
00033   }
00034 
00035   switch( id.detector() ) {
00036   case CaloID::DET_ECAL_BARREL   : return  ECAL_BARREL;  
00037   case CaloID::DET_ECAL_ENDCAP   : return  ECAL_ENDCAP; 
00038   case CaloID::DET_PS1           : return  PS1;
00039   case CaloID::DET_PS2           : return  PS2;
00040   case CaloID::DET_HCAL_BARREL   : return  HCAL_BARREL1;
00041   case CaloID::DET_HCAL_ENDCAP   : return  HCAL_ENDCAP;
00042   case CaloID::DET_HF_EM         : return  HF_EM;
00043   case CaloID::DET_HF_HAD        : return  HF_HAD;
00044   case CaloID::DET_HO            : return  HCAL_BARREL2; 
00045   default                        : return  NONE;
00046   }
00047 }