Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:54:17

0001 #include "DataFormats/ParticleFlowReco/interface/PFLayer.h"
0002 
0003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0004 
0005 #include <cassert>
0006 #include <iostream>
0007 
0008 using namespace reco;
0009 using namespace std;
0010 
0011 CaloID PFLayer::toCaloID(Layer layer) {
0012   switch (layer) {
0013     case PS2:
0014       return CaloID(CaloID::DET_PS2);
0015     case PS1:
0016       return CaloID(CaloID::DET_PS1);
0017     case ECAL_ENDCAP:
0018       return CaloID(CaloID::DET_ECAL_ENDCAP);
0019     case ECAL_BARREL:
0020       return CaloID(CaloID::DET_ECAL_BARREL);
0021     case HCAL_BARREL1:
0022       return CaloID(CaloID::DET_HCAL_BARREL);
0023     case HCAL_BARREL2:
0024       return CaloID(CaloID::DET_HO);
0025     case HCAL_ENDCAP:
0026       return CaloID(CaloID::DET_HCAL_ENDCAP);
0027     case HF_EM:
0028       return CaloID(CaloID::DET_HF_EM);
0029     case HF_HAD:
0030       return CaloID(CaloID::DET_HF_HAD);
0031     case HGCAL:
0032       return CaloID(CaloID::DET_HGCAL_ENDCAP);
0033     default:
0034       return CaloID();
0035   }
0036 }
0037 
0038 PFLayer::Layer PFLayer::fromCaloID(const CaloID& id) {
0039   //  cout<<"PFLayer::fromCaloID "<<id<<" "<<id.detector()<<endl;
0040   if (!id.isSingleDetector()) {
0041     edm::LogError("PFLayer") << "cannot convert " << id
0042                              << " to a layer, as this CaloID does not correspond to a single detector";
0043   }
0044 
0045   switch (id.detector()) {
0046     case CaloID::DET_ECAL_BARREL:
0047       return ECAL_BARREL;
0048     case CaloID::DET_ECAL_ENDCAP:
0049       return ECAL_ENDCAP;
0050     case CaloID::DET_PS1:
0051       return PS1;
0052     case CaloID::DET_PS2:
0053       return PS2;
0054     case CaloID::DET_HCAL_BARREL:
0055       return HCAL_BARREL1;
0056     case CaloID::DET_HCAL_ENDCAP:
0057       return HCAL_ENDCAP;
0058     case CaloID::DET_HF_EM:
0059       return HF_EM;
0060     case CaloID::DET_HF_HAD:
0061       return HF_HAD;
0062     case CaloID::DET_HO:
0063       return HCAL_BARREL2;
0064     case CaloID::DET_HGCAL_ENDCAP:
0065       return HGCAL;
0066     default:
0067       return NONE;
0068   }
0069 }