CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_9_patch3/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 #include "FWCore/Utilities/interface/Exception.h"
00038 
00039 // constructor
00040 L1GtEtaPhiConversions::L1GtEtaPhiConversions() :
00041     m_nrBinsPhiMu(0), m_nrBinsPhiJetEg(0), m_nrBinsPhiEtm(0),
00042             m_nrBinsPhiHtm(0), m_nrBinsEtaCommon(0), m_verbosity(0),
00043             m_isDebugEnabled(edm::isDebugEnabled()) {
00044 
00045     // prepare the pairs of L1GtObjects, reserve (by hand) memory for vectors
00046     // the index of the pair in m_gtObjectPairVec is used to extract
00047     // the information from the other vectors, so the push_back must be done
00048     // coherently
00049 
00050     std::pair < L1GtObject, L1GtObject > gtObjPair;
00051     m_gtObjectPairVec.reserve(56);
00052     m_pairConvertPhiFirstGtObject.reserve(56);
00053     m_pairNrPhiBinsVec.reserve(56);
00054     m_pairPhiConvVec.reserve(56);
00055 
00056 
00057     // Mu -> Jet & EG & ETM & HTM
00058     //
00059     gtObjPair = std::make_pair(Mu, CenJet);
00060     m_gtObjectPairVec.push_back(gtObjPair);
00061     m_pairConvertPhiFirstGtObject.push_back(true);
00062     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00063     m_pairPhiConvVec.push_back(&m_lutPhiMuToJetEg);
00064 
00065     gtObjPair = std::make_pair(CenJet, Mu);
00066     m_gtObjectPairVec.push_back(gtObjPair);
00067     m_pairConvertPhiFirstGtObject.push_back(false);
00068     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00069     m_pairPhiConvVec.push_back(&m_lutPhiMuToJetEg);
00070 
00071     //
00072     gtObjPair = std::make_pair(Mu, ForJet);
00073     m_gtObjectPairVec.push_back(gtObjPair);
00074     m_pairConvertPhiFirstGtObject.push_back(true);
00075     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00076     m_pairPhiConvVec.push_back(&m_lutPhiMuToJetEg);
00077 
00078     gtObjPair = std::make_pair(ForJet, Mu);
00079     m_gtObjectPairVec.push_back(gtObjPair);
00080     m_pairConvertPhiFirstGtObject.push_back(false);
00081     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00082     m_pairPhiConvVec.push_back(&m_lutPhiMuToJetEg);
00083 
00084     //
00085     gtObjPair = std::make_pair(Mu, TauJet);
00086     m_gtObjectPairVec.push_back(gtObjPair);
00087     m_pairConvertPhiFirstGtObject.push_back(true);
00088     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00089     m_pairPhiConvVec.push_back(&m_lutPhiMuToJetEg);
00090 
00091     gtObjPair = std::make_pair(TauJet, Mu);
00092     m_gtObjectPairVec.push_back(gtObjPair);
00093     m_pairConvertPhiFirstGtObject.push_back(false);
00094     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00095     m_pairPhiConvVec.push_back(&m_lutPhiMuToJetEg);
00096 
00097     //
00098     gtObjPair = std::make_pair(Mu, NoIsoEG);
00099     m_gtObjectPairVec.push_back(gtObjPair);
00100     m_pairConvertPhiFirstGtObject.push_back(true);
00101     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00102     m_pairPhiConvVec.push_back(&m_lutPhiMuToJetEg);
00103 
00104     gtObjPair = std::make_pair(NoIsoEG, Mu);
00105     m_gtObjectPairVec.push_back(gtObjPair);
00106     m_pairConvertPhiFirstGtObject.push_back(false);
00107     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00108     m_pairPhiConvVec.push_back(&m_lutPhiMuToJetEg);
00109 
00110     //
00111     gtObjPair = std::make_pair(Mu, IsoEG);
00112     m_gtObjectPairVec.push_back(gtObjPair);
00113     m_pairConvertPhiFirstGtObject.push_back(true);
00114     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00115     m_pairPhiConvVec.push_back(&m_lutPhiMuToJetEg);
00116 
00117     gtObjPair = std::make_pair(IsoEG, Mu);
00118     m_gtObjectPairVec.push_back(gtObjPair);
00119     m_pairConvertPhiFirstGtObject.push_back(false);
00120     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00121     m_pairPhiConvVec.push_back(&m_lutPhiMuToJetEg);
00122 
00123     //
00124     gtObjPair = std::make_pair(Mu, ETM);
00125     m_gtObjectPairVec.push_back(gtObjPair);
00126     m_pairConvertPhiFirstGtObject.push_back(true);
00127     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiEtm);
00128     m_pairPhiConvVec.push_back(&m_lutPhiMuToEtm);
00129 
00130     gtObjPair = std::make_pair(ETM, Mu);
00131     m_gtObjectPairVec.push_back(gtObjPair);
00132     m_pairConvertPhiFirstGtObject.push_back(false);
00133     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiEtm);
00134     m_pairPhiConvVec.push_back(&m_lutPhiMuToEtm);
00135 
00136     //
00137     gtObjPair = std::make_pair(Mu, HTM);
00138     m_gtObjectPairVec.push_back(gtObjPair);
00139     m_pairConvertPhiFirstGtObject.push_back(true);
00140     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiHtm);
00141     m_pairPhiConvVec.push_back(&m_lutPhiMuToHtm);
00142 
00143     gtObjPair = std::make_pair(HTM, Mu);
00144     m_gtObjectPairVec.push_back(gtObjPair);
00145     m_pairConvertPhiFirstGtObject.push_back(false);
00146     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiHtm);
00147     m_pairPhiConvVec.push_back(&m_lutPhiMuToHtm);
00148 
00149     // ETM -> Jet & EG
00150     //
00151     gtObjPair = std::make_pair(ETM, CenJet);
00152     m_gtObjectPairVec.push_back(gtObjPair);
00153     m_pairConvertPhiFirstGtObject.push_back(true);
00154     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00155     m_pairPhiConvVec.push_back(&m_lutPhiEtmToJetEg);
00156 
00157     gtObjPair = std::make_pair(CenJet, ETM);
00158     m_gtObjectPairVec.push_back(gtObjPair);
00159     m_pairConvertPhiFirstGtObject.push_back(false);
00160     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00161     m_pairPhiConvVec.push_back(&m_lutPhiEtmToJetEg);
00162 
00163     //
00164     gtObjPair = std::make_pair(ETM, ForJet);
00165     m_gtObjectPairVec.push_back(gtObjPair);
00166     m_pairConvertPhiFirstGtObject.push_back(true);
00167     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00168     m_pairPhiConvVec.push_back(&m_lutPhiEtmToJetEg);
00169 
00170     gtObjPair = std::make_pair(ForJet, ETM);
00171     m_gtObjectPairVec.push_back(gtObjPair);
00172     m_pairConvertPhiFirstGtObject.push_back(false);
00173     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00174     m_pairPhiConvVec.push_back(&m_lutPhiEtmToJetEg);
00175 
00176     //
00177     gtObjPair = std::make_pair(ETM, TauJet);
00178     m_gtObjectPairVec.push_back(gtObjPair);
00179     m_pairConvertPhiFirstGtObject.push_back(true);
00180     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00181     m_pairPhiConvVec.push_back(&m_lutPhiEtmToJetEg);
00182 
00183     gtObjPair = std::make_pair(TauJet, ETM);
00184     m_gtObjectPairVec.push_back(gtObjPair);
00185     m_pairConvertPhiFirstGtObject.push_back(false);
00186     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00187     m_pairPhiConvVec.push_back(&m_lutPhiEtmToJetEg);
00188 
00189     //
00190     gtObjPair = std::make_pair(ETM, NoIsoEG);
00191     m_gtObjectPairVec.push_back(gtObjPair);
00192     m_pairConvertPhiFirstGtObject.push_back(true);
00193     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00194     m_pairPhiConvVec.push_back(&m_lutPhiEtmToJetEg);
00195 
00196     gtObjPair = std::make_pair(NoIsoEG, ETM);
00197     m_gtObjectPairVec.push_back(gtObjPair);
00198     m_pairConvertPhiFirstGtObject.push_back(false);
00199     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00200     m_pairPhiConvVec.push_back(&m_lutPhiEtmToJetEg);
00201 
00202     //
00203     gtObjPair = std::make_pair(ETM, IsoEG);
00204     m_gtObjectPairVec.push_back(gtObjPair);
00205     m_pairConvertPhiFirstGtObject.push_back(true);
00206     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00207     m_pairPhiConvVec.push_back(&m_lutPhiEtmToJetEg);
00208 
00209     gtObjPair = std::make_pair(IsoEG, ETM);
00210     m_gtObjectPairVec.push_back(gtObjPair);
00211     m_pairConvertPhiFirstGtObject.push_back(false);
00212     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00213     m_pairPhiConvVec.push_back(&m_lutPhiEtmToJetEg);
00214 
00215     // HTM -> Jet & EG
00216     //
00217     gtObjPair = std::make_pair(HTM, CenJet);
00218     m_gtObjectPairVec.push_back(gtObjPair);
00219     m_pairConvertPhiFirstGtObject.push_back(true);
00220     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00221     m_pairPhiConvVec.push_back(&m_lutPhiHtmToJetEg);
00222 
00223     gtObjPair = std::make_pair(CenJet, HTM);
00224     m_gtObjectPairVec.push_back(gtObjPair);
00225     m_pairConvertPhiFirstGtObject.push_back(false);
00226     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00227     m_pairPhiConvVec.push_back(&m_lutPhiHtmToJetEg);
00228 
00229     //
00230     gtObjPair = std::make_pair(HTM, ForJet);
00231     m_gtObjectPairVec.push_back(gtObjPair);
00232     m_pairConvertPhiFirstGtObject.push_back(true);
00233     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00234     m_pairPhiConvVec.push_back(&m_lutPhiHtmToJetEg);
00235 
00236     gtObjPair = std::make_pair(ForJet, HTM);
00237     m_gtObjectPairVec.push_back(gtObjPair);
00238     m_pairConvertPhiFirstGtObject.push_back(false);
00239     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00240     m_pairPhiConvVec.push_back(&m_lutPhiHtmToJetEg);
00241 
00242     //
00243     gtObjPair = std::make_pair(HTM, TauJet);
00244     m_gtObjectPairVec.push_back(gtObjPair);
00245     m_pairConvertPhiFirstGtObject.push_back(true);
00246     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00247     m_pairPhiConvVec.push_back(&m_lutPhiHtmToJetEg);
00248 
00249     gtObjPair = std::make_pair(TauJet, HTM);
00250     m_gtObjectPairVec.push_back(gtObjPair);
00251     m_pairConvertPhiFirstGtObject.push_back(false);
00252     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00253     m_pairPhiConvVec.push_back(&m_lutPhiHtmToJetEg);
00254 
00255     //
00256     gtObjPair = std::make_pair(HTM, NoIsoEG);
00257     m_gtObjectPairVec.push_back(gtObjPair);
00258     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00259     m_pairConvertPhiFirstGtObject.push_back(true);
00260     m_pairPhiConvVec.push_back(&m_lutPhiHtmToJetEg);
00261 
00262     gtObjPair = std::make_pair(NoIsoEG, HTM);
00263     m_gtObjectPairVec.push_back(gtObjPair);
00264     m_pairConvertPhiFirstGtObject.push_back(false);
00265     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00266     m_pairPhiConvVec.push_back(&m_lutPhiHtmToJetEg);
00267 
00268     //
00269     gtObjPair = std::make_pair(HTM, IsoEG);
00270     m_gtObjectPairVec.push_back(gtObjPair);
00271     m_pairConvertPhiFirstGtObject.push_back(true);
00272     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00273     m_pairPhiConvVec.push_back(&m_lutPhiHtmToJetEg);
00274 
00275     gtObjPair = std::make_pair(IsoEG, HTM);
00276     m_gtObjectPairVec.push_back(gtObjPair);
00277     m_pairConvertPhiFirstGtObject.push_back(false);
00278     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00279     m_pairPhiConvVec.push_back(&m_lutPhiHtmToJetEg);
00280 
00281 
00282     // ETM -> HTM
00283     //
00284     gtObjPair = std::make_pair(ETM, HTM);
00285     m_gtObjectPairVec.push_back(gtObjPair);
00286     m_pairConvertPhiFirstGtObject.push_back(true);
00287     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiHtm);
00288     m_pairPhiConvVec.push_back(&m_lutPhiEtmToHtm);
00289 
00290     gtObjPair = std::make_pair(HTM, ETM);
00291     m_gtObjectPairVec.push_back(gtObjPair);
00292     m_pairConvertPhiFirstGtObject.push_back(false);
00293     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiHtm);
00294     m_pairPhiConvVec.push_back(&m_lutPhiEtmToHtm);
00295 
00296 
00297     // Jet & EG -> Jet & EG
00298     //
00299     gtObjPair = std::make_pair(CenJet, ForJet);
00300     m_gtObjectPairVec.push_back(gtObjPair);
00301     m_pairConvertPhiFirstGtObject.push_back(true);
00302     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00303     m_pairPhiConvVec.push_back(&m_lutPhiJetEgToJetEg);
00304 
00305     gtObjPair = std::make_pair(ForJet, CenJet);
00306     m_gtObjectPairVec.push_back(gtObjPair);
00307     m_pairConvertPhiFirstGtObject.push_back(false);
00308     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00309     m_pairPhiConvVec.push_back(&m_lutPhiJetEgToJetEg);
00310 
00311     //
00312     gtObjPair = std::make_pair(CenJet, TauJet);
00313     m_gtObjectPairVec.push_back(gtObjPair);
00314     m_pairConvertPhiFirstGtObject.push_back(true);
00315     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00316     m_pairPhiConvVec.push_back(&m_lutPhiJetEgToJetEg);
00317 
00318     gtObjPair = std::make_pair(TauJet, CenJet);
00319     m_gtObjectPairVec.push_back(gtObjPair);
00320     m_pairConvertPhiFirstGtObject.push_back(false);
00321     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00322     m_pairPhiConvVec.push_back(&m_lutPhiJetEgToJetEg);
00323 
00324     //
00325     gtObjPair = std::make_pair(CenJet, NoIsoEG);
00326     m_gtObjectPairVec.push_back(gtObjPair);
00327     m_pairConvertPhiFirstGtObject.push_back(true);
00328     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00329     m_pairPhiConvVec.push_back(&m_lutPhiJetEgToJetEg);
00330 
00331     gtObjPair = std::make_pair(NoIsoEG, CenJet);
00332     m_gtObjectPairVec.push_back(gtObjPair);
00333     m_pairConvertPhiFirstGtObject.push_back(false);
00334     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00335     m_pairPhiConvVec.push_back(&m_lutPhiJetEgToJetEg);
00336 
00337     //
00338     gtObjPair = std::make_pair(CenJet, IsoEG);
00339     m_gtObjectPairVec.push_back(gtObjPair);
00340     m_pairConvertPhiFirstGtObject.push_back(true);
00341     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00342     m_pairPhiConvVec.push_back(&m_lutPhiJetEgToJetEg);
00343 
00344     gtObjPair = std::make_pair(IsoEG, CenJet);
00345     m_gtObjectPairVec.push_back(gtObjPair);
00346     m_pairConvertPhiFirstGtObject.push_back(false);
00347     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00348     m_pairPhiConvVec.push_back(&m_lutPhiJetEgToJetEg);
00349 
00350     //
00351     gtObjPair = std::make_pair(ForJet, TauJet);
00352     m_gtObjectPairVec.push_back(gtObjPair);
00353     m_pairConvertPhiFirstGtObject.push_back(true);
00354     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00355     m_pairPhiConvVec.push_back(&m_lutPhiJetEgToJetEg);
00356 
00357     gtObjPair = std::make_pair(TauJet, ForJet);
00358     m_gtObjectPairVec.push_back(gtObjPair);
00359     m_pairConvertPhiFirstGtObject.push_back(false);
00360     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00361     m_pairPhiConvVec.push_back(&m_lutPhiJetEgToJetEg);
00362 
00363     //
00364     gtObjPair = std::make_pair(ForJet, NoIsoEG);
00365     m_gtObjectPairVec.push_back(gtObjPair);
00366     m_pairConvertPhiFirstGtObject.push_back(true);
00367     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00368     m_pairPhiConvVec.push_back(&m_lutPhiJetEgToJetEg);
00369 
00370     gtObjPair = std::make_pair(NoIsoEG, ForJet);
00371     m_gtObjectPairVec.push_back(gtObjPair);
00372     m_pairConvertPhiFirstGtObject.push_back(false);
00373     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00374     m_pairPhiConvVec.push_back(&m_lutPhiJetEgToJetEg);
00375 
00376     //
00377     gtObjPair = std::make_pair(ForJet, IsoEG);
00378     m_gtObjectPairVec.push_back(gtObjPair);
00379     m_pairConvertPhiFirstGtObject.push_back(true);
00380     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00381     m_pairPhiConvVec.push_back(&m_lutPhiJetEgToJetEg);
00382 
00383     gtObjPair = std::make_pair(IsoEG, ForJet);
00384     m_gtObjectPairVec.push_back(gtObjPair);
00385     m_pairConvertPhiFirstGtObject.push_back(false);
00386     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00387     m_pairPhiConvVec.push_back(&m_lutPhiJetEgToJetEg);
00388 
00389     //
00390     gtObjPair = std::make_pair(TauJet, NoIsoEG);
00391     m_gtObjectPairVec.push_back(gtObjPair);
00392     m_pairConvertPhiFirstGtObject.push_back(true);
00393     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00394     m_pairPhiConvVec.push_back(&m_lutPhiJetEgToJetEg);
00395 
00396     gtObjPair = std::make_pair(NoIsoEG, TauJet);
00397     m_gtObjectPairVec.push_back(gtObjPair);
00398     m_pairConvertPhiFirstGtObject.push_back(false);
00399     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00400     m_pairPhiConvVec.push_back(&m_lutPhiJetEgToJetEg);
00401 
00402     //
00403     gtObjPair = std::make_pair(TauJet, IsoEG);
00404     m_gtObjectPairVec.push_back(gtObjPair);
00405     m_pairConvertPhiFirstGtObject.push_back(true);
00406     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00407     m_pairPhiConvVec.push_back(&m_lutPhiJetEgToJetEg);
00408 
00409     gtObjPair = std::make_pair(IsoEG, TauJet);
00410     m_gtObjectPairVec.push_back(gtObjPair);
00411     m_pairConvertPhiFirstGtObject.push_back(false);
00412     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00413     m_pairPhiConvVec.push_back(&m_lutPhiJetEgToJetEg);
00414 
00415     //
00416     gtObjPair = std::make_pair(NoIsoEG, IsoEG);
00417     m_gtObjectPairVec.push_back(gtObjPair);
00418     m_pairConvertPhiFirstGtObject.push_back(true);
00419     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00420     m_pairPhiConvVec.push_back(&m_lutPhiJetEgToJetEg);
00421 
00422     gtObjPair = std::make_pair(IsoEG, NoIsoEG);
00423     m_gtObjectPairVec.push_back(gtObjPair);
00424     m_pairConvertPhiFirstGtObject.push_back(false);
00425     m_pairNrPhiBinsVec.push_back(&m_nrBinsPhiJetEg);
00426     m_pairPhiConvVec.push_back(&m_lutPhiJetEgToJetEg);
00427 
00428     // m_verbosity can not be used here, as L1GtEtaPhiConversions is called
00429     // in L1GlobalTriggerGTL constructor,  where m_verbosity is not yet set
00430     if (m_isDebugEnabled) {
00431         LogTrace("L1GlobalTrigger") << "\nm_gtObjectPairVec size: "
00432                 << (m_gtObjectPairVec.size()) << std::endl;
00433 
00434         unsigned int iPair = 0;
00435 
00436         for (std::vector<std::pair<L1GtObject, L1GtObject> >::const_iterator
00437                 cIter = m_gtObjectPairVec.begin();
00438                 cIter != m_gtObjectPairVec.end(); ++cIter) {
00439             LogTrace("L1GlobalTrigger") << "m_gtObjectPairVec vector element ["
00440                     << l1GtObjectEnumToString((*cIter).first) << ", "
00441                     << l1GtObjectEnumToString((*cIter).second)
00442                     << "], \t\tpair index =  " << iPair << std::endl;
00443 
00444             iPair++;
00445 
00446         }
00447     }
00448 
00449 }
00450 
00451 // destructor
00452 L1GtEtaPhiConversions::~L1GtEtaPhiConversions() {
00453 
00454     // do nothing
00455 
00456 }
00457 
00458 // methods
00459 
00460 const unsigned int L1GtEtaPhiConversions::gtObjectPairIndex(
00461         const L1GtObject& obj0, const L1GtObject& obj1) const {
00462 
00463     std::pair < L1GtObject, L1GtObject > gtObjPair;
00464     gtObjPair = std::make_pair(obj0, obj1);
00465 
00466     //LogTrace("L1GlobalTrigger") << "\nCompute index for pair ["
00467     //        << (l1GtObjectEnumToString(obj0)) << ", "
00468     //        << (l1GtObjectEnumToString(obj1)) << "]\n" << std::endl;
00469 
00470     unsigned int iPair = 0;
00471     for (std::vector<std::pair<L1GtObject, L1GtObject> >::const_iterator cIter =
00472             m_gtObjectPairVec.begin(); cIter != m_gtObjectPairVec.end(); ++cIter) {
00473 
00474         if (*cIter == gtObjPair) {
00475             LogTrace("L1GlobalTrigger") << "\n  Index for pair ["
00476                     << l1GtObjectEnumToString(obj0) << ", "
00477                     << l1GtObjectEnumToString(obj1) << "] = "
00478                     << iPair << std::endl;
00479 
00480             return iPair;
00481         }
00482 
00483         iPair++;
00484     }
00485 
00486     // if the pair was not found, return index outside vector size
00487     // it should never happen, except due to programming error
00488     // by using .at one gets an exception when using index outside vector size,
00489     // due to the programming error...
00490     return m_gtObjectPairVec.size();
00491 }
00492 
00493 const bool L1GtEtaPhiConversions::convertPhiIndex(const unsigned int pairIndex,
00494         const unsigned int positionPair, const unsigned int initialIndex,
00495         unsigned int& convertedIndex) const {
00496 
00497     unsigned int newIndex = badIndex;
00498     bool conversionStatus = false;
00499 
00500     // check if initial index is within the scale size
00501     // could be outside the scale size if there are hardware errors
00502     // or wrong scale conversions
00503     if (initialIndex >= (*(m_pairPhiConvVec.at(pairIndex))).size()) {
00504 
00505         conversionStatus = false;
00506 
00507         if (m_verbosity && m_isDebugEnabled) {
00508             LogTrace("L1GlobalTrigger") << (positionPair ? "    Second"
00509                     : "\n  First") << " object from pair " << pairIndex
00510                     << ": initial phi index " << initialIndex << " >= "
00511                     << ((*(m_pairPhiConvVec.at(pairIndex))).size())
00512                     << " Conversion failed." << std::endl;
00513         }
00514     } else {
00515         if (m_verbosity && m_isDebugEnabled) {
00516             LogTrace("L1GlobalTrigger") << (positionPair ? "    Second"
00517                     : "\n  First") << " object from pair " << pairIndex
00518                     << ": initial phi index " << initialIndex
00519                     << " within scale size " <<
00520                     ((*(m_pairPhiConvVec.at(pairIndex))).size())
00521                     << std::endl;
00522         }
00523 
00524     }
00525 
00526     // convert the index
00527     switch (positionPair) {
00528         case 0: {
00529             if (m_pairConvertPhiFirstGtObject.at(pairIndex)) {
00530 
00531                 newIndex = (*(m_pairPhiConvVec.at(pairIndex))).at(initialIndex);
00532 
00533                 if (newIndex != badIndex) {
00534 
00535                     conversionStatus = true;
00536 
00537                     if (m_verbosity && m_isDebugEnabled) {
00538                         LogTrace("L1GlobalTrigger")
00539                                 << (positionPair ? "    Second" : "\n  First")
00540                                 << " object from pair " << pairIndex
00541                                 << ": initial phi index " << initialIndex
00542                                 << " converted to " << newIndex << std::endl;
00543                     }
00544 
00545                 } else {
00546 
00547                     conversionStatus = false;
00548 
00549                     if (m_verbosity && m_isDebugEnabled) {
00550                         LogTrace("L1GlobalTrigger")
00551                                 << (positionPair ? "    Second" : "\n  First")
00552                                 << " object from pair " << pairIndex
00553                                 << ": converted phi index " << newIndex
00554                                 << "is equal to badIndex " << badIndex
00555                                 << " Conversion failed." << std::endl;
00556                     }
00557                 }
00558 
00559             } else {
00560                 newIndex = initialIndex;
00561                 conversionStatus = true;
00562 
00563                 if (m_verbosity && m_isDebugEnabled) {
00564                     LogTrace("L1GlobalTrigger") << (positionPair ? "    Second"
00565                             : "\n  First") << " object from pair " << pairIndex
00566                             << ": initial phi index " << initialIndex
00567                             << " not requested to be converted, return index "
00568                             << newIndex << std::endl;
00569                 }
00570             }
00571         }
00572 
00573             break;
00574         case 1: {
00575             if (m_pairConvertPhiFirstGtObject.at(pairIndex)) {
00576 
00577                 newIndex = initialIndex;
00578                 conversionStatus = true;
00579 
00580                 if (m_verbosity && m_isDebugEnabled) {
00581                     LogTrace("L1GlobalTrigger") << (positionPair ? "    Second"
00582                             : "\n  First") << " object from pair " << pairIndex
00583                             << ": initial phi index " << initialIndex
00584                             << " not requested to be converted, return index, return index "
00585                             << newIndex << std::endl;
00586                 }
00587             } else {
00588 
00589                 newIndex = (*(m_pairPhiConvVec.at(pairIndex))).at(initialIndex);
00590 
00591                 if (newIndex != badIndex) {
00592 
00593                     conversionStatus = true;
00594 
00595                     if (m_verbosity && m_isDebugEnabled) {
00596                         LogTrace("L1GlobalTrigger")
00597                                 << (positionPair ? "    Second" : "\n  First")
00598                                 << " object from pair " << pairIndex
00599                                 << ": initial phi index " << initialIndex
00600                                 << " converted to " << newIndex << std::endl;
00601                     }
00602 
00603                 } else {
00604 
00605                     conversionStatus = false;
00606 
00607                     if (m_verbosity && m_isDebugEnabled) {
00608                         LogTrace("L1GlobalTrigger")
00609                                 << (positionPair ? "    Second" : "\n  First")
00610                                 << " object from pair " << pairIndex
00611                                 << ": converted phi index " << newIndex
00612                                 << "is equal to badIndex " << badIndex
00613                                 << " Conversion failed." << std::endl;
00614                     }
00615                 }
00616 
00617             }
00618 
00619         }
00620 
00621             break;
00622         default: {
00623 
00624             // should not happen (programming error)
00625             throw cms::Exception("FailModule")
00626                     << "\n  Wrong position in the object pair " << positionPair
00627                     << "\n  Programming error - position must be either 0 or 1..."
00628                     << std::endl;
00629 
00630         }
00631             break;
00632     }
00633 
00634     //
00635     convertedIndex = newIndex;
00636     return conversionStatus;
00637 
00638 }
00639 
00640 const bool L1GtEtaPhiConversions::convertEtaIndex(const L1GtObject& gtObject,
00641         const unsigned int initialIndex, unsigned int& convertedIndex) const {
00642 
00643     unsigned int newIndex = badIndex;
00644     bool conversionStatus = false;
00645 
00646     switch (gtObject) {
00647 
00648         case Mu: {
00649 
00650             // check if initial index is within the scale size
00651             // could be outside the scale size if there are hardware errors
00652             // or wrong scale conversions
00653             if (initialIndex >= m_lutEtaMuToCommonCalo.size()) {
00654 
00655                 conversionStatus = false;
00656 
00657                 if (m_verbosity && m_isDebugEnabled) {
00658                     LogTrace("L1GlobalTrigger") << "    L1 GT object "
00659                             << (l1GtObjectEnumToString(gtObject))
00660                             << " has initial eta index " << initialIndex
00661                             << " >= " << (m_lutEtaMuToCommonCalo.size())
00662                             << " scale size. Conversion failed." << std::endl;
00663                 }
00664             } else {
00665 
00666                 // convert the index
00667                 newIndex = m_lutEtaMuToCommonCalo[initialIndex];
00668 
00669                 if (newIndex != badIndex) {
00670 
00671                     conversionStatus = true;
00672 
00673                     if (m_verbosity && m_isDebugEnabled) {
00674                         LogTrace("L1GlobalTrigger") << "    L1 GT object "
00675                                 << (l1GtObjectEnumToString(gtObject))
00676                                 << " initial eta index " << initialIndex
00677                                 << " (within scale size "
00678                                 << (m_lutEtaMuToCommonCalo.size())
00679                                 << ") converted to " << newIndex << std::endl;
00680                     }
00681 
00682                 } else {
00683 
00684                     conversionStatus = false;
00685 
00686                     if (m_verbosity && m_isDebugEnabled) {
00687                         LogTrace("L1GlobalTrigger") << "    L1 GT object "
00688                                 << (l1GtObjectEnumToString(gtObject))
00689                                 << " initial eta index " << initialIndex
00690                                 << " (within scale size "
00691                                 << (m_lutEtaMuToCommonCalo.size())
00692                                 << ") converted to badIndex" << newIndex
00693                                 << " Conversion failed." << std::endl;
00694                     }
00695                 }
00696 
00697             }
00698 
00699         }
00700             break;
00701 
00702         case NoIsoEG:
00703         case IsoEG:
00704         case CenJet:
00705         case TauJet: {
00706 
00707             // check if initial index is within the scale size
00708             // could be outside the scale size if there are hardware errors
00709             // or wrong scale conversions
00710             if (initialIndex >= m_lutEtaCentralToCommonCalo.size()) {
00711 
00712                 conversionStatus = false;
00713 
00714                 if (m_verbosity && m_isDebugEnabled) {
00715                     LogTrace("L1GlobalTrigger") << "    L1 GT object "
00716                             << (l1GtObjectEnumToString(gtObject))
00717                             << " has initial eta index " << initialIndex
00718                             << " >= " << (m_lutEtaCentralToCommonCalo.size())
00719                             << " scale size. Conversion failed." << std::endl;
00720                 }
00721             } else {
00722 
00723                 // convert the index
00724                 newIndex = m_lutEtaCentralToCommonCalo[initialIndex];
00725 
00726                 if (newIndex != badIndex) {
00727 
00728                     conversionStatus = true;
00729 
00730                     if (m_verbosity && m_isDebugEnabled) {
00731                         LogTrace("L1GlobalTrigger") << "    L1 GT object "
00732                                 << (l1GtObjectEnumToString(gtObject))
00733                                 << " initial eta index " << initialIndex
00734                                 << " (within scale size "
00735                                 << (m_lutEtaMuToCommonCalo.size())
00736                                 << ") converted to " << newIndex << std::endl;
00737                     }
00738 
00739                 } else {
00740 
00741                     conversionStatus = false;
00742 
00743                     if (m_verbosity && m_isDebugEnabled) {
00744                         LogTrace("L1GlobalTrigger") << "    L1 GT object "
00745                                 << (l1GtObjectEnumToString(gtObject))
00746                                 << " initial eta index " << initialIndex
00747                                 << " (within scale size "
00748                                 << (m_lutEtaCentralToCommonCalo.size())
00749                                 << ") converted to badIndex" << newIndex
00750                                 << " Conversion failed." << std::endl;
00751                     }
00752                 }
00753 
00754             }
00755 
00756         }
00757             break;
00758 
00759         case ForJet: {
00760 
00761             // check if initial index is within the scale size
00762             // could be outside the scale size if there are hardware errors
00763             // or wrong scale conversions
00764             if (initialIndex >= m_lutEtaForJetToCommonCalo.size()) {
00765 
00766                 conversionStatus = false;
00767 
00768                 if (m_verbosity && m_isDebugEnabled) {
00769                     LogTrace("L1GlobalTrigger") << "    L1 GT object "
00770                             << (l1GtObjectEnumToString(gtObject))
00771                             << " has initial eta index " << initialIndex
00772                             << " >= " << (m_lutEtaForJetToCommonCalo.size())
00773                             << " scale size. Conversion failed." << std::endl;
00774                 }
00775             } else {
00776 
00777                 // convert the index
00778                 newIndex = m_lutEtaForJetToCommonCalo[initialIndex];
00779 
00780                 if (newIndex != badIndex) {
00781 
00782                     conversionStatus = true;
00783 
00784                     if (m_verbosity && m_isDebugEnabled) {
00785                         LogTrace("L1GlobalTrigger") << "    L1 GT object "
00786                                 << (l1GtObjectEnumToString(gtObject))
00787                                 << " initial eta index " << initialIndex
00788                                 << " (within scale size "
00789                                 << (m_lutEtaMuToCommonCalo.size())
00790                                 << ") converted to " << newIndex << std::endl;
00791                     }
00792 
00793                 } else {
00794 
00795                     conversionStatus = false;
00796 
00797                     if (m_verbosity && m_isDebugEnabled) {
00798                         LogTrace("L1GlobalTrigger") << "    L1 GT object "
00799                                 << (l1GtObjectEnumToString(gtObject))
00800                                 << " initial eta index " << initialIndex
00801                                 << " (within scale size "
00802                                 << (m_lutEtaForJetToCommonCalo.size())
00803                                 << ") converted to badIndex" << newIndex
00804                                 << " Conversion failed." << std::endl;
00805                     }
00806                 }
00807 
00808             }
00809         }
00810             break;
00811 
00812         case ETM:
00813         case ETT:
00814         case HTT:
00815         case HTM:
00816         case JetCounts:
00817         case HfBitCounts:
00818         case HfRingEtSums:
00819         case TechTrig:
00820         case Castor:
00821         case BPTX:
00822         case GtExternal:
00823         case ObjNull: {
00824 
00825             //no conversions needed, there is no eta quantity for these objects
00826             conversionStatus = false;
00827         }
00828             break;
00829 
00830         default: {
00831             edm::LogInfo("L1GtObject") << "\n  '" << (l1GtObjectEnumToString(
00832                     gtObject)) << "' is not a recognized L1GtObject. "
00833                     << "\n Conversion failed. " << std::endl;
00834             conversionStatus = false;
00835         }
00836             break;
00837     }
00838 
00839     //
00840     convertedIndex = newIndex;
00841 
00842     return conversionStatus;
00843 
00844 }
00845 
00846 const unsigned int L1GtEtaPhiConversions::gtObjectNrBinsPhi(
00847         const L1GtObject& gtObject) const {
00848 
00849     switch (gtObject) {
00850 
00851         case Mu: {
00852             return m_nrBinsPhiMu;
00853         }
00854             break;
00855 
00856         case NoIsoEG:
00857         case IsoEG:
00858         case CenJet:
00859         case ForJet:
00860         case TauJet: {
00861             return m_nrBinsPhiJetEg;
00862         }
00863             break;
00864 
00865         case ETM: {
00866             return m_nrBinsPhiEtm;
00867         }
00868             break;
00869 
00870         case ETT:
00871         case HTT: {
00872             return 0;
00873         }
00874             break;
00875 
00876         case HTM: {
00877             return m_nrBinsPhiHtm;
00878         }
00879             break;
00880 
00881         case JetCounts:
00882         case HfBitCounts:
00883         case HfRingEtSums:
00884         case TechTrig:
00885         case Castor:
00886         case BPTX:
00887         case GtExternal:
00888         case ObjNull: {
00889             return 0;
00890         }
00891             break;
00892 
00893         default: {
00894             edm::LogInfo("L1GtObject") << "\n  '"
00895                     << (l1GtObjectEnumToString(gtObject))
00896                     << "' is not a recognized L1GtObject. "
00897                     << "\n Return 0 bins.";
00898             return 0;
00899         }
00900             break;
00901     }
00902 
00903 }
00904 
00905 const unsigned int L1GtEtaPhiConversions::gtObjectNrBinsPhi(
00906         const L1GtObject& obj0, const L1GtObject& obj1) const {
00907 
00908     std::pair < L1GtObject, L1GtObject > gtObjPair;
00909     gtObjPair = std::make_pair(obj0, obj1);
00910 
00911     //LogTrace("L1GlobalTrigger") << "\nCompute gtObjectNrBinsPhi ["
00912     //        << (l1GtObjectEnumToString(obj0)) << ", "
00913     //        << (l1GtObjectEnumToString(obj1)) << "]\n" << std::endl;
00914 
00915     int iPair = 0;
00916     for (std::vector<std::pair<L1GtObject, L1GtObject> >::const_iterator cIter =
00917             m_gtObjectPairVec.begin(); cIter != m_gtObjectPairVec.end(); ++cIter) {
00918 
00919         if (*cIter == gtObjPair) {
00920             LogTrace("L1GlobalTrigger") << "\n  gtObjectNrBinsPhi ["
00921                     << l1GtObjectEnumToString(obj0) << ", "
00922                     << l1GtObjectEnumToString(obj1) << "] = "
00923                     << (*(m_pairNrPhiBinsVec.at(iPair))) << std::endl;
00924 
00925             return *(m_pairNrPhiBinsVec.at(iPair));
00926         }
00927 
00928         iPair++;
00929     }
00930 
00931     return 0;
00932 }
00933 
00934 const unsigned int L1GtEtaPhiConversions::gtObjectNrBinsPhi(
00935         const unsigned int pairIndex) const {
00936 
00937     if (m_verbosity && m_isDebugEnabled) {
00938         LogTrace("L1GlobalTrigger")
00939                 << "\n  gtObjectNrBinsPhi for L1 GT object pair index "
00940                 << pairIndex << " = " << (*(m_pairNrPhiBinsVec.at(pairIndex)))
00941                 << std::endl;
00942     }
00943 
00944     return *(m_pairNrPhiBinsVec.at(pairIndex));
00945 }
00946 
00947 
00948 
00949 // perform all conversions
00950 void L1GtEtaPhiConversions::convertL1Scales(
00951         const L1CaloGeometry* l1CaloGeometry,
00952         const L1MuTriggerScales* l1MuTriggerScales,
00953         const int ifCaloEtaNumberBits, const int ifMuEtaNumberBits) {
00954 
00955     // no bullet-proof method, depends on binning ...
00956     // decide "by hand / by eyes" which object converts to which object
00957 
00958     // update the scales used
00959     m_l1CaloGeometry = l1CaloGeometry;
00960     m_l1MuTriggerScales =  l1MuTriggerScales;
00961 
00962     // number of bins for all phi scales used
00963 
00964     m_nrBinsPhiMu = 144; // FIXME ask Ivan for size() ...
00965     //m_nrBinsPhiMu = m_l1MuTriggerScales->getPhiScale()->size();
00966 
00967     m_nrBinsPhiJetEg = m_l1CaloGeometry->numberGctEmJetPhiBins();
00968     m_nrBinsPhiEtm = m_l1CaloGeometry->numberGctEtSumPhiBins();
00969     m_nrBinsPhiHtm = m_l1CaloGeometry->numberGctHtSumPhiBins();
00970 
00971     //
00972     // convert phi scale for muon (finer) to phi scale for (*Jet, EG) / ETM / HTM (coarser)
00973     //
00974 
00975     m_lutPhiMuToJetEg.clear();
00976     m_lutPhiMuToJetEg.resize(m_nrBinsPhiMu, badIndex);
00977 
00978     m_lutPhiMuToEtm.clear();
00979     m_lutPhiMuToEtm.resize(m_nrBinsPhiMu, badIndex);
00980 
00981     m_lutPhiMuToHtm.clear();
00982     m_lutPhiMuToHtm.resize(m_nrBinsPhiMu, badIndex);
00983 
00984     for (unsigned int phiMuInd = 0; phiMuInd < m_nrBinsPhiMu; ++phiMuInd) {
00985 
00986         double phiMuLowEdge = m_l1MuTriggerScales->getPhiScale()->getLowEdge(
00987                 phiMuInd);
00988         double phiMuHighEdge = m_l1MuTriggerScales->getPhiScale()->getHighEdge(
00989                 phiMuInd);
00990 
00991         // to avoid precision problems, add a small quantity to phiMuLowEdge
00992         double phiMuLowEdgeSmallShiftRight = phiMuLowEdge + (phiMuHighEdge
00993                 - phiMuLowEdge) / 100.;
00994 
00995         // phi Mu -> (*Jet, EG)
00996 
00997         unsigned int nrBins = m_nrBinsPhiJetEg;
00998 
00999         for (unsigned int iBin = nrBins;; --iBin) {
01000 
01001             double phiLowEdge = m_l1CaloGeometry->emJetPhiBinLowEdge(iBin);
01002             double phiHighEdge = m_l1CaloGeometry->emJetPhiBinHighEdge(iBin);
01003 
01004             if (phiMuLowEdgeSmallShiftRight >= phiLowEdge) {
01005                 m_lutPhiMuToJetEg[phiMuInd] = iBin % nrBins;
01006 
01007                 LogTrace("L1GlobalTrigger") << " phiMuIndex \t" << phiMuInd
01008                         << " [ " << phiMuLowEdge << " \t, "
01009                         << phiMuHighEdge << "] \t==>\t phiMuJetEG \t"
01010                         << m_lutPhiMuToJetEg[phiMuInd] << " [ "
01011                         << phiLowEdge << "\t, " << phiHighEdge << " ]"
01012                         << std::endl;
01013 
01014                 break;
01015             }
01016         }
01017 
01018         // phi Mu -> ETM
01019 
01020         nrBins = m_nrBinsPhiEtm;
01021 
01022         for (unsigned int iBin = nrBins;; --iBin) {
01023 
01024             double phiLowEdge = m_l1CaloGeometry->etSumPhiBinLowEdge(iBin);
01025             double phiHighEdge = m_l1CaloGeometry->etSumPhiBinHighEdge(iBin);
01026 
01027             if (phiMuLowEdgeSmallShiftRight >= phiLowEdge) {
01028                 m_lutPhiMuToEtm[phiMuInd] = iBin % nrBins;
01029 
01030                 LogTrace("L1GlobalTrigger") << " phiMuIndex \t" << phiMuInd
01031                         << " [ " << phiMuLowEdge << " \t, "
01032                         << phiMuHighEdge << "] \t==>\t phiMuToEtm \t"
01033                         << m_lutPhiMuToEtm[phiMuInd] << " [ " << phiLowEdge
01034                         << "\t, " << phiHighEdge << " ]" << std::endl;
01035 
01036                 break;
01037             }
01038         }
01039 
01040         // phi Mu -> HTM
01041 
01042         nrBins = m_nrBinsPhiHtm;
01043 
01044         for (unsigned int iBin = nrBins;; --iBin) {
01045 
01046             double phiLowEdge = m_l1CaloGeometry->htSumPhiBinLowEdge(iBin);
01047             double phiHighEdge = m_l1CaloGeometry->htSumPhiBinHighEdge(iBin);
01048 
01049             if (phiMuLowEdgeSmallShiftRight >= phiLowEdge) {
01050                 m_lutPhiMuToHtm[phiMuInd] = iBin % nrBins;
01051 
01052                 LogTrace("L1GlobalTrigger") << " phiMuIndex \t" << phiMuInd
01053                         << " [ " << phiMuLowEdge << " \t, "
01054                         << phiMuHighEdge << "] \t==>\t phiMuToHtm \t"
01055                         << m_lutPhiMuToHtm[phiMuInd] << " [ " << phiLowEdge
01056                         << "\t, " << phiHighEdge << " ]" << std::endl;
01057 
01058                 break;
01059             }
01060         }
01061 
01062         LogTrace("L1GlobalTrigger") << std::endl;
01063 
01064     }
01065 
01066     if (m_verbosity && m_isDebugEnabled) {
01067         LogTrace("L1GlobalTrigger") << "Mu phi conversions" << std::endl;
01068         for (unsigned int iBin = 0; iBin < m_nrBinsPhiMu; ++iBin) {
01069             LogTrace("L1GlobalTrigger") << "  Mu phiIndex \t" << iBin
01070                     << "\t converted to index:"
01071                     << "\t Jet-EG \t" << m_lutPhiMuToJetEg.at(iBin)
01072                     << "\t ETM \t"    << m_lutPhiMuToEtm.at(iBin)
01073                     << "\t HTM \t"    << m_lutPhiMuToHtm.at(iBin)
01074                     << std::endl;
01075 
01076         }
01077         LogTrace("L1GlobalTrigger") << std::endl;
01078     }
01079 
01080     //
01081     // convert phi scale for ETM to phi scale for (*Jet, EG) / HTM (coarser)
01082     //
01083 
01084     m_lutPhiEtmToJetEg.clear();
01085     m_lutPhiEtmToJetEg.resize(m_nrBinsPhiEtm, badIndex);
01086 
01087     m_lutPhiEtmToHtm.clear();
01088     m_lutPhiEtmToHtm.resize(m_nrBinsPhiEtm, badIndex);
01089 
01090 
01091     for (unsigned int phiEtmInd = 0; phiEtmInd < m_nrBinsPhiEtm; ++phiEtmInd) {
01092 
01093         double phiEtmLowEdge = m_l1CaloGeometry->etSumPhiBinLowEdge(phiEtmInd);
01094         double phiEtmHighEdge = m_l1CaloGeometry->etSumPhiBinHighEdge(phiEtmInd);
01095 
01096         // to avoid precision problems, add a small quantity to phiEtmLowEdge
01097         double phiEtmLowEdgeSmallShiftRight = phiEtmLowEdge + (phiEtmHighEdge
01098                 - phiEtmLowEdge) / 100.;
01099 
01100         // phi ETM -> (*Jet, EG)
01101 
01102         unsigned int nrBins = m_nrBinsPhiJetEg;
01103 
01104         for (unsigned int iBin = nrBins;; --iBin) {
01105 
01106             double phiLowEdge = m_l1CaloGeometry->emJetPhiBinLowEdge(iBin);
01107             double phiHighEdge = m_l1CaloGeometry->emJetPhiBinHighEdge(iBin);
01108 
01109             if (phiEtmLowEdgeSmallShiftRight >= phiLowEdge) {
01110                 m_lutPhiEtmToJetEg[phiEtmInd] = iBin % nrBins;
01111 
01112                 LogTrace("L1GlobalTrigger") << " phiEtmIndex \t" << phiEtmInd
01113                         << " [ " << phiEtmLowEdge << " \t, "
01114                         << phiEtmHighEdge << "] \t==>\t phiEtmJetEG \t"
01115                         << m_lutPhiEtmToJetEg[phiEtmInd] << " [ "
01116                         << phiLowEdge << "\t, " << phiHighEdge << " ]"
01117                         << std::endl;
01118 
01119                 break;
01120             }
01121         }
01122 
01123         // phi ETM -> HTM
01124 
01125         nrBins = m_nrBinsPhiHtm;
01126 
01127         for (unsigned int iBin = nrBins;; --iBin) {
01128 
01129             double phiLowEdge = m_l1CaloGeometry->htSumPhiBinLowEdge(iBin);
01130             double phiHighEdge = m_l1CaloGeometry->htSumPhiBinHighEdge(iBin);
01131 
01132             if (phiEtmLowEdgeSmallShiftRight >= phiLowEdge) {
01133                 m_lutPhiEtmToHtm[phiEtmInd] = iBin % nrBins;
01134 
01135                 LogTrace("L1GlobalTrigger") << " phiEtmIndex \t" << phiEtmInd
01136                         << " [ " << phiEtmLowEdge << " \t, "
01137                         << phiEtmHighEdge << "] \t==>\t phiEtmToHtm \t"
01138                         << m_lutPhiEtmToHtm[phiEtmInd] << " [ " << phiLowEdge
01139                         << "\t, " << phiHighEdge << " ]" << std::endl;
01140 
01141                 break;
01142             }
01143         }
01144 
01145         LogTrace("L1GlobalTrigger") << std::endl;
01146 
01147     }
01148 
01149     //
01150     // convert phi scale for HTM to phi scale for (*Jet, EG)
01151     //
01152 
01153     m_lutPhiHtmToJetEg.clear();
01154     m_lutPhiHtmToJetEg.resize(m_nrBinsPhiHtm, badIndex);
01155 
01156 
01157     for (unsigned int phiHtmInd = 0; phiHtmInd < m_nrBinsPhiHtm; ++phiHtmInd) {
01158 
01159         double phiHtmLowEdge = m_l1CaloGeometry->htSumPhiBinLowEdge(phiHtmInd);
01160         double phiHtmHighEdge = m_l1CaloGeometry->htSumPhiBinHighEdge(phiHtmInd);
01161 
01162         // to avoid precision problems, add a small quantity to phiHtmLowEdge
01163         double phiHtmLowEdgeSmallShiftRight = phiHtmLowEdge + (phiHtmHighEdge
01164                 - phiHtmLowEdge) / 100.;
01165 
01166         unsigned int nrBins = m_nrBinsPhiJetEg;
01167 
01168         for (unsigned int iBin = nrBins;; --iBin) {
01169 
01170             double phiLowEdge = m_l1CaloGeometry->emJetPhiBinLowEdge(iBin);
01171             double phiHighEdge = m_l1CaloGeometry->emJetPhiBinHighEdge(iBin);
01172 
01173             if (phiHtmLowEdgeSmallShiftRight >= phiLowEdge) {
01174                 m_lutPhiHtmToJetEg[phiHtmInd] = iBin % nrBins;
01175 
01176                 LogTrace("L1GlobalTrigger") << " phiHtmIndex \t" << phiHtmInd
01177                         << " [ " << phiHtmLowEdge << " \t, "
01178                         << phiHtmHighEdge << "] \t==>\t phiHtmJetEG \t"
01179                         << m_lutPhiHtmToJetEg[phiHtmInd] << " [ "
01180                         << phiLowEdge << "\t, " << phiHighEdge << " ]"
01181                         << std::endl;
01182 
01183                 break;
01184             }
01185         }
01186 
01187     }
01188 
01189 
01190     //
01191     // convert phi scale for (*Jet, EG) to (*Jet, EG)
01192     // dummy - return the same index as the input index
01193 
01194     m_lutPhiJetEgToJetEg.clear();
01195     m_lutPhiJetEgToJetEg.resize(m_nrBinsPhiJetEg, badIndex);
01196 
01197     for (unsigned int phiInd = 0; phiInd < m_nrBinsPhiJetEg; ++phiInd) {
01198         m_lutPhiJetEgToJetEg[phiInd] = phiInd;
01199     }
01200 
01201     //
01202     // eta conversions
01203     //
01204 
01205     // all objects are converted to a common central / forward calorimeter eta scale,
01206     // built by setting together the forward scale and the central scale
01207     //
01208     // eta is signed,  MSB is the sign for all objects - must be taken into account
01209     // in conversion - the common scale is, from 0 to m_nrBinsEtaCommon:
01210     //
01211     // [ForJet negative bins][Central Jet/IsoEG/NoIsoEG negative bins][Central Jet/IsoEG/NoIsoEG positive bins][ForJet positive bins]
01212     //
01213 
01214     unsigned int nrGctCentralEtaBinsPerHalf =
01215             m_l1CaloGeometry->numberGctCentralEtaBinsPerHalf();
01216 
01217     unsigned int nrGctForwardEtaBinsPerHalf =
01218             m_l1CaloGeometry->numberGctForwardEtaBinsPerHalf();
01219 
01220     unsigned int nrGctTotalEtaBinsPerHalf = nrGctCentralEtaBinsPerHalf
01221             + nrGctForwardEtaBinsPerHalf;
01222 
01223     m_nrBinsEtaCommon = 2*nrGctTotalEtaBinsPerHalf;
01224 
01225     //
01226     // convert eta scale for CenJet/TauJet & IsoEG/NoIsoEG to a common
01227     // central / forward calorimeter eta scale
01228     //
01229     // get the sign and the index absolute value
01230 
01231     LogTrace("L1GlobalTrigger")
01232             << " \nEta conversion: CenJet/TauJet & IsoEG/NoIsoEG to a common calorimeter scale\n"
01233             << std::endl;
01234 
01235     m_lutEtaCentralToCommonCalo.clear();
01236     m_lutEtaCentralToCommonCalo.resize(
01237             (nrGctCentralEtaBinsPerHalf | (1 << (ifCaloEtaNumberBits - 1))),
01238             badIndex);
01239 
01240     for (unsigned int etaInd = 0; etaInd < nrGctCentralEtaBinsPerHalf; ++etaInd) {
01241 
01242         // for positive values, the index is etaInd
01243         unsigned int globalIndex = m_l1CaloGeometry->globalEtaIndex(
01244                 m_l1CaloGeometry->etaBinCenter(etaInd, true));
01245         m_lutEtaCentralToCommonCalo[etaInd] = globalIndex;
01246 
01247         LogTrace("L1GlobalTrigger") << " etaIndex " << etaInd << "\t [hex: "
01248                 << std::hex << etaInd << "] " << std::dec
01249                 << " ==> etaIndexGlobal " << globalIndex << std::endl;
01250 
01251         // for negative values, one adds (binary) 1 as MSB to the index
01252         unsigned int etaIndNeg = etaInd | (1 << (ifCaloEtaNumberBits - 1));
01253         globalIndex = m_l1CaloGeometry->globalEtaIndex(
01254                 m_l1CaloGeometry->etaBinCenter(etaIndNeg, true));
01255         m_lutEtaCentralToCommonCalo[etaIndNeg] = globalIndex;
01256 
01257         LogTrace("L1GlobalTrigger") << " etaIndex " << etaIndNeg
01258                 << "\t [hex: " << std::hex << etaIndNeg << "] " << std::dec
01259                 << " ==> etaIndexGlobal " << globalIndex << std::endl;
01260 
01261     }
01262 
01263     //
01264     // convert eta scale for ForJet to a common
01265     // central / forward calorimeter eta scale
01266     //
01267 
01268     LogTrace("L1GlobalTrigger")
01269             << " \nEta conversion: ForJet to a common calorimeter scale\n"
01270             << std::endl;
01271 
01272     m_lutEtaForJetToCommonCalo.clear();
01273     m_lutEtaForJetToCommonCalo.resize(
01274             (nrGctForwardEtaBinsPerHalf | (1 << (ifCaloEtaNumberBits - 1))),
01275             badIndex);
01276 
01277     for (unsigned int etaInd = 0; etaInd < nrGctForwardEtaBinsPerHalf; ++etaInd) {
01278 
01279         // for positive values, the index is etaInd
01280         unsigned int globalIndex = m_l1CaloGeometry->globalEtaIndex(
01281                 m_l1CaloGeometry->etaBinCenter(etaInd, false));
01282         m_lutEtaForJetToCommonCalo[etaInd] = globalIndex;
01283 
01284         LogTrace("L1GlobalTrigger") << " etaIndex " << etaInd << "\t [hex: "
01285                 << std::hex << etaInd << "] " << std::dec
01286                 << " ==> etaIndexGlobal " << globalIndex << std::endl;
01287 
01288         // for negative values, one adds (binary) 1 as MSB to the index
01289         unsigned int etaIndNeg = etaInd | (1 << (ifCaloEtaNumberBits - 1));
01290         globalIndex = m_l1CaloGeometry->globalEtaIndex(
01291                 m_l1CaloGeometry->etaBinCenter(etaIndNeg, false));
01292         m_lutEtaForJetToCommonCalo[etaIndNeg] = globalIndex;
01293 
01294         LogTrace("L1GlobalTrigger") << " etaIndex " << etaIndNeg << "\t [hex: "
01295                 << std::hex << etaIndNeg << "] " << std::dec
01296                 << " ==> etaIndexGlobal " << globalIndex << std::endl;
01297 
01298     }
01299 
01300     //
01301     // convert eta scale for Mu to a common
01302     // central / forward calorimeter eta scale
01303     //
01304 
01305     LogDebug("L1GlobalTrigger")
01306             << " \nEta conversion: Mu to a common calorimeter scale\n"
01307             << std::endl;
01308 
01309     // eta scale defined for positive values - need to be symmetrized
01310     unsigned int nrBinsEtaMuPerHalf =
01311             m_l1MuTriggerScales->getGMTEtaScale()->getNBins();
01312     LogTrace("L1GlobalTrigger") << " \nnrBinsEtaMuPerHalf = "
01313             << nrBinsEtaMuPerHalf << "\n" << std::endl;
01314 
01315     m_lutEtaMuToCommonCalo.clear();
01316     m_lutEtaMuToCommonCalo.resize(
01317             (nrBinsEtaMuPerHalf | (1 << (ifMuEtaNumberBits - 1))), badIndex);
01318 
01319     for (unsigned int etaMuInd = 0; etaMuInd < nrBinsEtaMuPerHalf; ++etaMuInd) {
01320 
01321         double etaMuLowEdge = m_l1MuTriggerScales->getGMTEtaScale()->getValue(
01322                 etaMuInd);
01323         double etaMuHighEdge = m_l1MuTriggerScales->getGMTEtaScale()->getValue(
01324                 etaMuInd + 1);
01325 
01326         // to avoid precision problems, add a small quantity to etaMuLowEdge
01327         double etaMuLowEdgeSmallShiftRight = etaMuLowEdge + (etaMuHighEdge
01328                 - etaMuLowEdge) / 100.;
01329 
01330         // positive values
01331         for (unsigned int iBin = m_nrBinsEtaCommon;; --iBin) {
01332 
01333             double etaLowEdge = m_l1CaloGeometry->globalEtaBinLowEdge(iBin);
01334 
01335             double etaHighEdge = 0.0;
01336             if (iBin == m_nrBinsEtaCommon) {
01337                 etaHighEdge = etaLowEdge;
01338             } else {
01339                 etaHighEdge = m_l1CaloGeometry->globalEtaBinLowEdge(iBin + 1);
01340             }
01341 
01342             if (etaMuLowEdgeSmallShiftRight >= etaLowEdge) {
01343                 m_lutEtaMuToCommonCalo[etaMuInd] = iBin % m_nrBinsEtaCommon;
01344 
01345                 LogTrace("L1GlobalTrigger") << " etaMuIndex \t" << etaMuInd
01346                         << "\t [ " << etaMuLowEdge << ", \t" << etaMuHighEdge
01347                         << "] ==> etaMuJetEG \t"
01348                         << m_lutEtaMuToCommonCalo[etaMuInd] << "\t [ "
01349                         << etaLowEdge << ", \t" << etaHighEdge << " ]"
01350                         << std::endl;
01351 
01352                 break;
01353             }
01354         }
01355 
01356         // for negative values, one adds (binary) 1 as MSB to the index
01357         unsigned int etaMuIndNeg = etaMuInd | (1 << (ifMuEtaNumberBits - 1));
01358         m_lutEtaMuToCommonCalo[etaMuIndNeg] = m_lutEtaMuToCommonCalo[0]
01359                 - (m_lutEtaMuToCommonCalo[etaMuInd] - m_lutEtaMuToCommonCalo[0]
01360                         + 1);
01361 
01362         LogTrace("L1GlobalTrigger") << " etaMuIndexNeg \t" << etaMuIndNeg
01363                 << "\t [ " << (-1.0 * etaMuLowEdge) << ", \t" << (-1.0
01364                 * etaMuHighEdge) << "] ==> etaMuJetEG \t"
01365                 << m_lutEtaMuToCommonCalo[etaMuIndNeg] << "\t [ "
01366                 << m_l1CaloGeometry->globalEtaBinLowEdge(
01367                         m_lutEtaMuToCommonCalo[etaMuIndNeg]) << ", \t"
01368                 << m_l1CaloGeometry->globalEtaBinLowEdge(
01369                         m_lutEtaMuToCommonCalo[etaMuIndNeg] + 1) << " ]"
01370                 << std::endl;
01371 
01372     }
01373 
01374     if (m_verbosity && m_isDebugEnabled) {
01375         LogTrace("L1GlobalTrigger") << std::endl;
01376         LogTrace("L1GlobalTrigger") << std::endl;
01377     }
01378 
01379 }
01380 
01381 // print all the performed conversions
01382 void L1GtEtaPhiConversions::print(std::ostream& myCout) const {
01383 
01384     // force a page break before each group
01385     myCout << "<p style=\"page-break-before: always\">&nbsp;</p>";
01386 
01387     myCout
01388             << "\n---++Conversion tables for phi and eta variables of the trigger objects used in correlation conditions \n"
01389             << std::endl;
01390 
01391     //
01392     // phi conversions
01393     //
01394 
01395     // phi Mu -> (*Jet, EG)
01396 
01397     myCout
01398             << "\n---+++Phi conversion for muons to jets and e-gamma common phi scale \n"
01399             << std::endl;
01400 
01401     size_t lutPhiMuToJetEgSize = m_lutPhiMuToJetEg.size();
01402     myCout << "Size of look-up table = " << lutPhiMuToJetEgSize << "\n"
01403             << std::endl;
01404 
01405     myCout << "|  *Initial Phi Hardware Index*  "
01406             << "||  *Initial Phi Range*  ||"
01407             << "  *Converted Phi Hardware Index*  "
01408             << "||  *Converted Phi Range*  ||" << "\n"
01409             << "|  *hex*  |  *dec*  | ^|^|  *hex*  |  *dec*  |^|^|"
01410             << std::endl;
01411 
01412     for (unsigned int indexToConv = 0; indexToConv < lutPhiMuToJetEgSize; ++indexToConv) {
01413 
01414         double lowEdgeToConv = m_l1MuTriggerScales->getPhiScale()->getLowEdge(
01415                 indexToConv);
01416         double highEdgeToConv =
01417                 m_l1MuTriggerScales->getPhiScale()->getHighEdge(indexToConv);
01418 
01419         unsigned int convIndex = m_lutPhiMuToJetEg[indexToConv];
01420 
01421         double convLowEdge = 0.;
01422         double convHighEdge = 0.;
01423 
01424         if (convIndex != badIndex) {
01425             convLowEdge = m_l1CaloGeometry->emJetPhiBinLowEdge(convIndex);
01426             convHighEdge = m_l1CaloGeometry->emJetPhiBinHighEdge(convIndex);
01427         } else {
01428             // badIndex means a bad initialIndex
01429             lowEdgeToConv = 0.;
01430             highEdgeToConv = 0.;
01431         }
01432 
01433         myCout << "|  0x" << std::setw(3) << std::hex << std::left
01434                 << indexToConv << "  |  " << std::dec << std::setw(3)
01435                 << std::left << indexToConv << "  |[ " << std::setw(10)
01436                 << std::left << (rad2deg(lowEdgeToConv)) << ",  |"
01437                 << std::setw(10) << std::left << (rad2deg(highEdgeToConv))
01438                 << " )  |  0x" << std::setw(6) << std::hex << std::left
01439                 << convIndex << " |  " << std::dec << std::setw(6) << convIndex
01440                 << "  |[ " << std::setw(10) << std::left << (rad2deg(
01441                 convLowEdge)) << ",  |" << std::setw(10) << std::left
01442                 << (rad2deg(convHighEdge)) << " )  |" << std::right
01443                 << std::endl;
01444 
01445     }
01446 
01447     // phi Mu -> ETM
01448 
01449     // force a page break before each group
01450     myCout << "<p style=\"page-break-before: always\">&nbsp;</p>";
01451 
01452     myCout << "\n---+++Phi conversion for muons to ETM phi scale \n"
01453             << std::endl;
01454 
01455     size_t lutPhiMuToEtmSize = m_lutPhiMuToEtm.size();
01456     myCout << "Size of look-up table = " << lutPhiMuToEtmSize << "\n"
01457             << std::endl;
01458 
01459     myCout << "|  *Initial Phi Hardware Index*  "
01460             << "||  *Initial Phi Range*  ||"
01461             << "  *Converted Phi Hardware Index*  "
01462             << "||  *Converted Phi Range*  ||" << "\n"
01463             << "|  *hex*  |  *dec*  | ^|^|  *hex*  |  *dec*  |^|^|"
01464             << std::endl;
01465 
01466     for (unsigned int indexToConv = 0; indexToConv < lutPhiMuToEtmSize; ++indexToConv) {
01467 
01468         double lowEdgeToConv = m_l1MuTriggerScales->getPhiScale()->getLowEdge(
01469                 indexToConv);
01470         double highEdgeToConv =
01471                 m_l1MuTriggerScales->getPhiScale()->getHighEdge(indexToConv);
01472 
01473         unsigned int convIndex = m_lutPhiMuToEtm[indexToConv];
01474 
01475         double convLowEdge = 0.;
01476         double convHighEdge = 0.;
01477 
01478         if (convIndex != badIndex) {
01479             convLowEdge = m_l1CaloGeometry->etSumPhiBinLowEdge(convIndex);
01480             convHighEdge = m_l1CaloGeometry->etSumPhiBinHighEdge(convIndex);
01481         } else {
01482             // badIndex means a bad initialIndex
01483             lowEdgeToConv = 0.;
01484             highEdgeToConv = 0.;
01485         }
01486 
01487         myCout << "|  0x" << std::setw(3) << std::hex << std::left
01488                 << indexToConv << "  |  " << std::dec << std::setw(3)
01489                 << std::left << indexToConv << "  |[ " << std::setw(10)
01490                 << std::left << (rad2deg(lowEdgeToConv)) << ",  |"
01491                 << std::setw(10) << std::left << (rad2deg(highEdgeToConv))
01492                 << " )  |  0x" << std::setw(6) << std::hex << std::left
01493                 << convIndex << " |  " << std::dec << std::setw(6) << convIndex
01494                 << "  |[ " << std::setw(10) << std::left << (rad2deg(
01495                 convLowEdge)) << ",  |" << std::setw(10) << std::left
01496                 << (rad2deg(convHighEdge)) << " )  |" << std::right
01497                 << std::endl;
01498 
01499     }
01500 
01501     // phi Mu -> HTM
01502 
01503     // force a page break before each group
01504     myCout << "<p style=\"page-break-before: always\">&nbsp;</p>";
01505 
01506     myCout << "\n---+++Phi conversion for muons to HTM phi scale \n"
01507             << std::endl;
01508 
01509     size_t lutPhiMuToHtmSize = m_lutPhiMuToHtm.size();
01510     myCout << "Size of look-up table = " << lutPhiMuToHtmSize << "\n"
01511             << std::endl;
01512 
01513     myCout << "|  *Initial Phi Hardware Index*  "
01514             << "||  *Initial Phi Range*  ||"
01515             << "  *Converted Phi Hardware Index*  "
01516             << "||  *Converted Phi Range*  ||" << "\n"
01517             << "|  *hex*  |  *dec*  | ^|^|  *hex*  |  *dec*  |^|^|"
01518             << std::endl;
01519 
01520     for (unsigned int indexToConv = 0; indexToConv < lutPhiMuToHtmSize; ++indexToConv) {
01521 
01522         double lowEdgeToConv = m_l1MuTriggerScales->getPhiScale()->getLowEdge(
01523                 indexToConv);
01524         double highEdgeToConv =
01525                 m_l1MuTriggerScales->getPhiScale()->getHighEdge(indexToConv);
01526 
01527         unsigned int convIndex = m_lutPhiMuToHtm[indexToConv];
01528 
01529         double convLowEdge = 0.;
01530         double convHighEdge = 0.;
01531 
01532         if (convIndex != badIndex) {
01533             convLowEdge = m_l1CaloGeometry->htSumPhiBinLowEdge(convIndex);
01534             convHighEdge = m_l1CaloGeometry->htSumPhiBinHighEdge(convIndex);
01535         } else {
01536             // badIndex means a bad initialIndex
01537             lowEdgeToConv = 0.;
01538             highEdgeToConv = 0.;
01539         }
01540 
01541         myCout << "|  0x" << std::setw(3) << std::hex << std::left
01542                 << indexToConv << "  |  " << std::dec << std::setw(3)
01543                 << std::left << indexToConv << "  |[ " << std::setw(10)
01544                 << std::left << (rad2deg(lowEdgeToConv)) << ",  |"
01545                 << std::setw(10) << std::left << (rad2deg(highEdgeToConv))
01546                 << " )  |  0x" << std::setw(6) << std::hex << std::left
01547                 << convIndex << " |  " << std::dec << std::setw(6) << convIndex
01548                 << "  |[ " << std::setw(10) << std::left << (rad2deg(
01549                 convLowEdge)) << ",  |" << std::setw(10) << std::left
01550                 << (rad2deg(convHighEdge)) << " )  |" << std::right
01551                 << std::endl;
01552 
01553     }
01554 
01555     // phi ETM -> (*Jet, EG)
01556 
01557     // force a page break before each group
01558     myCout << "<p style=\"page-break-before: always\">&nbsp;</p>";
01559 
01560     myCout
01561             << "\n---+++Phi conversion for ETM to jets and e-gamma scale common phi scale \n"
01562             << std::endl;
01563 
01564     size_t lutPhiEtmToJetEgSize = m_lutPhiEtmToJetEg.size();
01565     myCout << "Size of look-up table = " << lutPhiEtmToJetEgSize << "\n"
01566             << std::endl;
01567 
01568     myCout << "|  *Initial Phi Hardware Index*  "
01569             << "||  *Initial Phi Range*  ||"
01570             << "  *Converted Phi Hardware Index*  "
01571             << "||  *Converted Phi Range*  ||" << "\n"
01572             << "|  *hex*  |  *dec*  | ^|^|  *hex*  |  *dec*  |^|^|"
01573             << std::endl;
01574 
01575     for (unsigned int indexToConv = 0; indexToConv < lutPhiEtmToJetEgSize; ++indexToConv) {
01576 
01577         double lowEdgeToConv =
01578                 m_l1CaloGeometry->etSumPhiBinLowEdge(indexToConv);
01579         double highEdgeToConv = m_l1CaloGeometry->etSumPhiBinHighEdge(
01580                 indexToConv);
01581 
01582         unsigned int convIndex = m_lutPhiEtmToJetEg[indexToConv];
01583 
01584         double convLowEdge = 0.;
01585         double convHighEdge = 0.;
01586 
01587         if (convIndex != badIndex) {
01588             convLowEdge = m_l1CaloGeometry->emJetPhiBinLowEdge(convIndex);
01589             convHighEdge = m_l1CaloGeometry->emJetPhiBinHighEdge(convIndex);
01590         } else {
01591             // badIndex means a bad initialIndex
01592             lowEdgeToConv = 0.;
01593             highEdgeToConv = 0.;
01594         }
01595 
01596         myCout << "|  0x" << std::setw(3) << std::hex << std::left
01597                 << indexToConv << "  |  " << std::dec << std::setw(3)
01598                 << std::left << indexToConv << "  |[ " << std::setw(10)
01599                 << std::left << (rad2deg(lowEdgeToConv)) << ",  |"
01600                 << std::setw(10) << std::left << (rad2deg(highEdgeToConv))
01601                 << " )  |  0x" << std::setw(6) << std::hex << std::left
01602                 << convIndex << " |  " << std::dec << std::setw(6) << convIndex
01603                 << "  |[ " << std::setw(10) << std::left << (rad2deg(
01604                 convLowEdge)) << ",  |" << std::setw(10) << std::left
01605                 << (rad2deg(convHighEdge)) << " )  |" << std::right
01606                 << std::endl;
01607 
01608     }
01609 
01610     // phi ETM -> HTM
01611 
01612     // force a page break before each group
01613     myCout << "<p style=\"page-break-before: always\">&nbsp;</p>";
01614 
01615     myCout << "\n---+++Phi conversion for ETM to HTM phi scale \n" << std::endl;
01616 
01617     size_t lutPhiEtmToHtmSize = m_lutPhiEtmToHtm.size();
01618     myCout << "Size of look-up table = " << lutPhiEtmToHtmSize << "\n"
01619             << std::endl;
01620 
01621     myCout << "|  *Initial Phi Hardware Index*  "
01622             << "||  *Initial Phi Range*  ||"
01623             << "  *Converted Phi Hardware Index*  "
01624             << "||  *Converted Phi Range*  ||" << "\n"
01625             << "|  *hex*  |  *dec*  | ^|^|  *hex*  |  *dec*  |^|^|"
01626             << std::endl;
01627 
01628     for (unsigned int indexToConv = 0; indexToConv < lutPhiEtmToHtmSize; ++indexToConv) {
01629 
01630         double lowEdgeToConv =
01631                 m_l1CaloGeometry->etSumPhiBinLowEdge(indexToConv);
01632         double highEdgeToConv = m_l1CaloGeometry->etSumPhiBinHighEdge(
01633                 indexToConv);
01634 
01635         unsigned int convIndex = m_lutPhiEtmToHtm[indexToConv];
01636 
01637         double convLowEdge = 0.;
01638         double convHighEdge = 0.;
01639 
01640         if (convIndex != badIndex) {
01641             convLowEdge = m_l1CaloGeometry->htSumPhiBinLowEdge(convIndex);
01642             convHighEdge = m_l1CaloGeometry->htSumPhiBinHighEdge(convIndex);
01643         } else {
01644             // badIndex means a bad initialIndex
01645             lowEdgeToConv = 0.;
01646             highEdgeToConv = 0.;
01647         }
01648 
01649         myCout << "|  0x" << std::setw(3) << std::hex << std::left
01650                 << indexToConv << "  |  " << std::dec << std::setw(3)
01651                 << std::left << indexToConv << "  |[ " << std::setw(10)
01652                 << std::left << (rad2deg(lowEdgeToConv)) << ",  |"
01653                 << std::setw(10) << std::left << (rad2deg(highEdgeToConv))
01654                 << " )  |  0x" << std::setw(6) << std::hex << std::left
01655                 << convIndex << " |  " << std::dec << std::setw(6) << convIndex
01656                 << "  |[ " << std::setw(10) << std::left << (rad2deg(
01657                 convLowEdge)) << ",  |" << std::setw(10) << std::left
01658                 << (rad2deg(convHighEdge)) << " )  |" << std::right
01659                 << std::endl;
01660 
01661     }
01662 
01663     // phi HTM -> (*Jet, EG)
01664 
01665 
01666     // force a page break before each group
01667     myCout << "<p style=\"page-break-before: always\">&nbsp;</p>";
01668 
01669     myCout
01670             << "\n---+++Phi conversion for HTM to jets and e-gamma scale common phi scale \n"
01671             << std::endl;
01672 
01673     size_t lutPhiHtmToJetEgSize = m_lutPhiHtmToJetEg.size();
01674     myCout << "Size of look-up table = " << lutPhiHtmToJetEgSize << "\n"
01675             << std::endl;
01676 
01677     myCout << "|  *Initial Phi Hardware Index*  "
01678             << "||  *Initial Phi Range*  ||"
01679             << "  *Converted Phi Hardware Index*  "
01680             << "||  *Converted Phi Range*  ||" << "\n"
01681             << "|  *hex*  |  *dec*  | ^|^|  *hex*  |  *dec*  |^|^|"
01682             << std::endl;
01683 
01684     for (unsigned int indexToConv = 0; indexToConv < lutPhiHtmToJetEgSize; ++indexToConv) {
01685 
01686         double lowEdgeToConv =
01687                 m_l1CaloGeometry->htSumPhiBinLowEdge(indexToConv);
01688         double highEdgeToConv = m_l1CaloGeometry->htSumPhiBinHighEdge(
01689                 indexToConv);
01690 
01691         unsigned int convIndex = m_lutPhiHtmToJetEg[indexToConv];
01692 
01693         double convLowEdge = 0.;
01694         double convHighEdge = 0.;
01695 
01696         if (convIndex != badIndex) {
01697             convLowEdge = m_l1CaloGeometry->emJetPhiBinLowEdge(convIndex);
01698             convHighEdge = m_l1CaloGeometry->emJetPhiBinHighEdge(convIndex);
01699         } else {
01700             // badIndex means a bad initialIndex
01701             lowEdgeToConv = 0.;
01702             highEdgeToConv = 0.;
01703         }
01704 
01705         myCout << "|  0x" << std::setw(3) << std::hex << std::left
01706                 << indexToConv << "  |  " << std::dec << std::setw(3)
01707                 << std::left << indexToConv << "  |[ " << std::setw(10)
01708                 << std::left << (rad2deg(lowEdgeToConv)) << ",  |"
01709                 << std::setw(10) << std::left << (rad2deg(highEdgeToConv))
01710                 << " )  |  0x" << std::setw(6) << std::hex << std::left
01711                 << convIndex << " |  " << std::dec << std::setw(6) << convIndex
01712                 << "  |[ " << std::setw(10) << std::left << (rad2deg(
01713                 convLowEdge)) << ",  |" << std::setw(10) << std::left
01714                 << (rad2deg(convHighEdge)) << " )  |" << std::right
01715                 << std::endl;
01716 
01717     }
01718 
01719     //
01720     // eta conversions
01721     //
01722 
01723 
01724     // CenJet/TauJet & IsoEG/NoIsoEG to a common central / forward calorimeter eta scale
01725 
01726 
01727     // force a page break before each group
01728     myCout << "<p style=\"page-break-before: always\">&nbsp;</p>";
01729 
01730     myCout
01731             << "\n---+++Eta conversion for central and tau jets and e-gamma objects to a common central and forward calorimeter eta scale \n"
01732             << std::endl;
01733 
01734     size_t lutEtaCentralToCommonCaloSize = m_lutEtaCentralToCommonCalo.size();
01735     myCout << "Size of look-up table = " << lutEtaCentralToCommonCaloSize
01736             << "\n" << std::endl;
01737 
01738     myCout << "|  *Initial Eta Hardware Index*  "
01739             << "||  *Initial Eta Range*  ||"
01740             << "  *Converted Eta Hardware Index*  "
01741             << "||  *Converted Eta Range*  ||" << "\n"
01742             << "|  *hex*  |  *dec*  | ^|^|  *hex*  |  *dec*  |^|^|"
01743             << std::endl;
01744 
01745     for (unsigned int indexToConv = 0; indexToConv
01746             < lutEtaCentralToCommonCaloSize; ++indexToConv) {
01747 
01748         double lowEdgeToConv = m_l1CaloGeometry->globalEtaBinLowEdge(
01749                 m_l1CaloGeometry->globalEtaIndex(
01750                         m_l1CaloGeometry->etaBinCenter(indexToConv, true)));
01751         double highEdgeToConv = m_l1CaloGeometry->globalEtaBinLowEdge(
01752                 m_l1CaloGeometry->globalEtaIndex(
01753                         m_l1CaloGeometry->etaBinCenter(indexToConv, true)) + 1);
01754 
01755         unsigned int convIndex = m_lutEtaCentralToCommonCalo[indexToConv];
01756 
01757         double convLowEdge = 0.;
01758         double convHighEdge = 0.;
01759 
01760         if (convIndex != badIndex) {
01761             convLowEdge = m_l1CaloGeometry->globalEtaBinLowEdge(convIndex);
01762             convHighEdge = m_l1CaloGeometry->globalEtaBinLowEdge(convIndex + 1);
01763         } else {
01764             // badIndex means a bad initialIndex
01765             lowEdgeToConv = 0.;
01766             highEdgeToConv = 0.;
01767         }
01768 
01769         myCout << "|  0x" << std::setw(3) << std::hex << std::left
01770                 << indexToConv << "  |  " << std::dec << std::setw(3)
01771                 << std::left << indexToConv << "  |[ " << std::setw(10)
01772                 << std::left << lowEdgeToConv << ",  |" << std::setw(10)
01773                 << std::left << highEdgeToConv << " )  |  0x" << std::setw(6)
01774                 << std::hex << std::left << convIndex << " |  " << std::dec
01775                 << std::setw(6) << convIndex << "  |[ " << std::setw(10)
01776                 << std::left << convLowEdge << ",  |" << std::setw(10)
01777                 << std::left << convHighEdge << " )  |" << std::right
01778                 << std::endl;
01779     }
01780 
01781     // ForJet to a common central / forward calorimeter eta scale
01782 
01783 
01784     // force a page break before each group
01785     myCout << "<p style=\"page-break-before: always\">&nbsp;</p>";
01786 
01787     myCout
01788             << "\n---+++Eta conversion for forward jets to a common central and forward calorimeter eta scale \n"
01789             << std::endl;
01790 
01791     size_t lutEtaForJetToCommonCaloSize = m_lutEtaForJetToCommonCalo.size();
01792     myCout << "Size of look-up table = " << lutEtaForJetToCommonCaloSize
01793             << "\n" << std::endl;
01794 
01795     myCout << "|  *Initial Eta Hardware Index*  "
01796             << "||  *Initial Eta Range*  ||"
01797             << "  *Converted Eta Hardware Index*  "
01798             << "||  *Converted Eta Range*  ||" << "\n"
01799             << "|  *hex*  |  *dec*  | ^|^|  *hex*  |  *dec*  |^|^|"
01800             << std::endl;
01801 
01802     for (unsigned int indexToConv = 0; indexToConv
01803             < lutEtaForJetToCommonCaloSize; ++indexToConv) {
01804 
01805         double lowEdgeToConv = m_l1CaloGeometry->globalEtaBinLowEdge(
01806                 m_l1CaloGeometry->globalEtaIndex(
01807                         m_l1CaloGeometry->etaBinCenter(indexToConv, false)));
01808         double highEdgeToConv =
01809                 m_l1CaloGeometry->globalEtaBinLowEdge(
01810                         m_l1CaloGeometry->globalEtaIndex(
01811                                 m_l1CaloGeometry->etaBinCenter(indexToConv,
01812                                         false)) + 1);
01813 
01814         unsigned int convIndex = m_lutEtaForJetToCommonCalo[indexToConv];
01815 
01816         double convLowEdge = 0.;
01817         double convHighEdge = 0.;
01818 
01819         if (convIndex != badIndex) {
01820             convLowEdge = m_l1CaloGeometry->globalEtaBinLowEdge(convIndex);
01821             convHighEdge = m_l1CaloGeometry->globalEtaBinLowEdge(convIndex + 1);
01822         } else {
01823             // badIndex means a bad initialIndex
01824             lowEdgeToConv = 0.;
01825             highEdgeToConv = 0.;
01826         }
01827 
01828         myCout << "|  0x" << std::setw(3) << std::hex << std::left
01829                 << indexToConv << "  |  " << std::dec << std::setw(3)
01830                 << std::left << indexToConv << "  |[ " << std::setw(10)
01831                 << std::left << lowEdgeToConv << ",  |" << std::setw(10)
01832                 << std::left << highEdgeToConv << " )  |  0x" << std::setw(6)
01833                 << std::hex << std::left << convIndex << " |  " << std::dec
01834                 << std::setw(6) << convIndex << "  |[ " << std::setw(10)
01835                 << std::left << convLowEdge << ",  |" << std::setw(10)
01836                 << std::left << convHighEdge << " )  |" << std::right
01837                 << std::endl;
01838     }
01839 
01840     // Mu to a common central / forward calorimeter eta scale
01841 
01842     // force a page break before each group
01843     myCout << "<p style=\"page-break-before: always\">&nbsp;</p>";
01844 
01845     myCout
01846             << "\n---+++Eta conversion for muons to a common central and forward calorimeter eta scale \n"
01847             << std::endl;
01848 
01849     size_t lutEtaMuToCommonCaloSize = m_lutEtaMuToCommonCalo.size();
01850     myCout << "Size of look-up table = " << lutEtaMuToCommonCaloSize << "\n"
01851             << std::endl;
01852 
01853     unsigned int nrBinsEtaMuPerHalf =
01854             m_l1MuTriggerScales->getGMTEtaScale()->getNBins();
01855 
01856     myCout << "|  *Initial Eta Hardware Index*  "
01857             << "||  *Initial Eta Range*  ||"
01858             << "  *Converted Eta Hardware Index*  "
01859             << "||  *Converted Eta Range*  ||" << "\n"
01860             << "|  *hex*  |  *dec*  | ^|^|  *hex*  |  *dec*  |^|^|"
01861             << std::endl;
01862 
01863     for (unsigned int indexToConv = 0; indexToConv < lutEtaMuToCommonCaloSize; ++indexToConv) {
01864 
01865         // Mu scale defined for positive values only, need to be symmetrized
01866         unsigned int iBinOffset = 0;
01867         double etaSign = 1.;
01868 
01869         if (indexToConv > nrBinsEtaMuPerHalf) {
01870             iBinOffset = nrBinsEtaMuPerHalf + 1;
01871             etaSign = -1.;
01872         }
01873 
01874         double lowEdgeToConv = etaSign
01875                 * m_l1MuTriggerScales->getGMTEtaScale()->getValue(
01876                         indexToConv - iBinOffset);
01877         double highEdgeToConv = etaSign
01878                 * m_l1MuTriggerScales->getGMTEtaScale()->getValue(
01879                         indexToConv + 1 - iBinOffset);
01880 
01881         unsigned int convIndex = m_lutEtaMuToCommonCalo[indexToConv];
01882 
01883         double convLowEdge = 0.;
01884         double convHighEdge = 0.;
01885 
01886         if (convIndex != badIndex) {
01887             convLowEdge = m_l1CaloGeometry->globalEtaBinLowEdge(convIndex);
01888             convHighEdge = m_l1CaloGeometry->globalEtaBinLowEdge(convIndex + 1);
01889         } else {
01890             // badIndex means a bad initialIndex
01891             lowEdgeToConv = 0.;
01892             highEdgeToConv = 0.;
01893         }
01894 
01895         myCout << "|  0x" << std::setw(3) << std::hex << std::left
01896                 << indexToConv << "  |  " << std::dec << std::setw(3)
01897                 << std::left << indexToConv << "  |[ " << std::setw(10)
01898                 << std::left << lowEdgeToConv << ",  |" << std::setw(10)
01899                 << std::left << highEdgeToConv << " )  |  0x" << std::setw(6)
01900                 << std::hex << std::left << convIndex << " |  " << std::dec
01901                 << std::setw(6) << convIndex << "  |[ " << std::setw(10)
01902                 << std::left << convLowEdge << ",  |" << std::setw(10)
01903                 << std::left << convHighEdge << " )  |" << std::right
01904                 << std::endl;
01905     }
01906 
01907 }
01908 
01909 // convert phi from rad (-pi, pi] to deg (0, 360)
01910 const double L1GtEtaPhiConversions::rad2deg(const double& phiRad) const {
01911 
01912     if (phiRad < 0.) {
01913         return (phiRad * PiConversion) + 360.;
01914     } else {
01915         return (phiRad * PiConversion);
01916     }
01917 }
01918 
01919 // static members
01920 
01921 const unsigned int L1GtEtaPhiConversions::badIndex = 999999;
01922 const double L1GtEtaPhiConversions::PiConversion = 180. / acos(-1.);
01923