CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch12/src/L1Trigger/GlobalTrigger/src/L1GtEtaPhiConversions.cc

Go to the documentation of this file.
00001 
00017 // this class header
00018 #include "L1Trigger/GlobalTrigger/interface/L1GtEtaPhiConversions.h"
00019 
00020 // system include files
00021 #include <iostream>
00022 #include <iomanip>
00023 
00024 // user include files
00025 
00026 //   base class
00027 
00028 //
00029 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMapFwd.h"
00030 
00031 #include "CondFormats/L1TObjects/interface/L1MuTriggerScales.h"
00032 #include "CondFormats/L1TObjects/interface/L1CaloGeometry.h"
00033 
00034 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00035 #include "FWCore/MessageLogger/interface/MessageDrop.h"
00036 
00037 // constructor
00038 L1GtEtaPhiConversions::L1GtEtaPhiConversions() {
00039 
00040     // do nothing
00041 
00042 }
00043 
00044 // destructor
00045 L1GtEtaPhiConversions::~L1GtEtaPhiConversions() {
00046 
00047     // do nothing
00048 
00049 }
00050 
00051 // methods
00052 
00053 // perform all conversions
00054 void L1GtEtaPhiConversions::convert(const L1CaloGeometry* l1CaloGeometry,
00055         const L1MuTriggerScales* l1MuTriggerScales,
00056         const int ifCaloEtaNumberBits, const int ifMuEtaNumberBits) {
00057     
00058     // no bullet-proof method, depends on binning... 
00059     
00060     //
00061     // convert phi scale for muon (finer) to phi scale for calo (coarser)
00062     //
00063     
00064     unsigned int nrMuPhiBins = 144; // FIXME ask Ivan for size() ... 
00065     //unsigned int nrMuPhiBins = l1MuTriggerScales->getPhiScale()->size();
00066 
00067     unsigned int nrGctEmJetPhiBins = l1CaloGeometry->numberGctEmJetPhiBins();
00068     
00069     if (edm::isDebugEnabled() ) {
00070         
00071         LogTrace("L1GtEtaPhiConversions") << "\n nrGctEmJetPhiBins = "
00072                 << nrGctEmJetPhiBins << "\n" << std::endl;
00073 
00074         for (unsigned int iCalo = 0; iCalo < nrGctEmJetPhiBins; ++iCalo) {
00075             double phiCaloLowEdge =
00076                     l1CaloGeometry->emJetPhiBinLowEdge(iCalo);
00077             double phiCaloHighEdge =
00078                     l1CaloGeometry->emJetPhiBinHighEdge(iCalo);
00079 
00080             LogTrace("L1GtEtaPhiConversions") << "Bin " << iCalo
00081                     << "\t phiCaloLowEdge = " << phiCaloLowEdge
00082                     << "\t phiCaloHighEdge = " << phiCaloHighEdge
00083                     << std::endl;
00084 
00085         }
00086 
00087         LogTrace("L1GtEtaPhiConversions") << "\n nrMuPhiBins = "
00088                 << nrMuPhiBins << "\n" << std::endl;
00089 
00090         for (unsigned int iBin = 0; iBin < nrMuPhiBins; ++iBin) {
00091             double phiMuLowEdge = l1MuTriggerScales->getPhiScale()->getLowEdge(iBin);
00092             double phiMuHighEdge = l1MuTriggerScales->getPhiScale()->getHighEdge(iBin);
00093 
00094             LogTrace("L1GtEtaPhiConversions") << "Bin " << iBin
00095                     << "\t phiMuLowEdge = " << phiMuLowEdge
00096                     << "\t phiMuHighEdge = " << phiMuHighEdge << std::endl;
00097 
00098         }
00099 
00100         LogTrace("L1GtEtaPhiConversions") << "\n"
00101                 << l1MuTriggerScales->getPhiScale()->print() << "\n" << std::endl;
00102 
00103     }
00104     
00105     // 
00106     m_lutPhiMuCalo.clear(); 
00107     m_lutPhiMuCalo.resize(nrMuPhiBins); 
00108     
00109     for (unsigned int phiMuInd = 0; phiMuInd < nrMuPhiBins; ++phiMuInd) {
00110         
00111         double phiMuLowEdge = l1MuTriggerScales->getPhiScale()->getLowEdge(phiMuInd);
00112         double phiMuHighEdge = l1MuTriggerScales->getPhiScale()->getHighEdge(phiMuInd);
00113 
00114         for (unsigned int iCalo = nrGctEmJetPhiBins; iCalo <= nrGctEmJetPhiBins; --iCalo) {
00115             
00116             double phiCaloLowEdge = l1CaloGeometry->emJetPhiBinLowEdge(iCalo);
00117             double phiCaloHighEdge = l1CaloGeometry->emJetPhiBinHighEdge(iCalo);
00118             
00119             if (phiMuLowEdge >= phiCaloLowEdge) {
00120                 m_lutPhiMuCalo[phiMuInd] = iCalo%nrGctEmJetPhiBins;
00121                                     
00122                 LogTrace("L1GtEtaPhiConversions") 
00123                         << " phiMuLowEdge[" << phiMuInd << "] = " << phiMuLowEdge                            
00124                         << " phiMuHighEdge[" << phiMuInd << "] = " << phiMuHighEdge                            
00125                         << "\n phiCaloLowEdge[" << iCalo << "] = " << phiCaloLowEdge
00126                         << " phiCaloHighEdge[" << iCalo << "] = " << phiCaloHighEdge
00127                         << std::endl;
00128 
00129                 break;                    
00130             }                     
00131         }
00132         
00133     }
00134         
00135     if (edm::isDebugEnabled() ) {
00136         LogTrace("L1GtEtaPhiConversions") << std::endl;
00137         for (unsigned int iBin = 0; iBin < m_lutPhiMuCalo.size(); ++iBin) {
00138             LogTrace("L1GtEtaPhiConversions") << "Mu phiIndex = " << iBin
00139                     << " converted to index " << m_lutPhiMuCalo[iBin]
00140                     << std::endl;
00141 
00142         }
00143         LogTrace("L1GtEtaPhiConversions") << std::endl;
00144     }
00145     
00146     //
00147     // convert calo eta scale for CenJet/TauJet & IsoEG/NoIsoEG to a common 
00148     // central / forward eta scale
00149     //
00150     
00151     unsigned int nrGctCentralEtaBinsPerHalf = 
00152         l1CaloGeometry->numberGctCentralEtaBinsPerHalf();
00153 
00154     unsigned int nrGctForwardEtaBinsPerHalf =
00155             l1CaloGeometry->numberGctForwardEtaBinsPerHalf();
00156     
00157     unsigned int nrGctTotalEtaBinsPerHalf = nrGctCentralEtaBinsPerHalf
00158             + nrGctForwardEtaBinsPerHalf;
00159     
00160 
00161     m_lutEtaCenCaloCommon.clear(); 
00162     m_lutEtaCenCaloCommon.resize(nrGctTotalEtaBinsPerHalf); 
00163     
00164     for (unsigned int cenInd = 0; cenInd < nrGctCentralEtaBinsPerHalf; ++cenInd) {
00165         
00166         // FIXME 
00167         
00168     }
00169         
00170     if (edm::isDebugEnabled() ) {
00171         LogTrace("L1GtEtaPhiConversions") << std::endl;
00172         LogTrace("L1GtEtaPhiConversions") << std::endl;
00173     }
00174 
00175 
00176 }
00177 
00178 // print all the performed conversions
00179 void L1GtEtaPhiConversions::print(std::ostream& myCout) const {
00180 
00181     myCout << "\n  L1GtEtaPhiConversions print...\n" << std::endl;
00182     // FIXME
00183 
00184 }
00185