CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/FastSimulation/L1CaloTriggerProducer/interface/FastL1Region.h

Go to the documentation of this file.
00001 #ifndef RecoTauTag_FastL1Region_h
00002 #define RecoTauTag_FastL1Region_h
00003 // -*- C++ -*-
00004 //
00005 // Package:    L1CaloSim
00006 // Class:      FastL1Region
00007 // 
00015 //
00016 // Original Author:  Chi Nhan Nguyen
00017 //         Created:  Mon Feb 19 13:25:24 CST 2007
00018 // $Id: FastL1Region.h,v 1.17 2009/03/23 11:41:27 chinhan Exp $
00019 //
00020 
00021 // user include files
00022 #include "FWCore/Framework/interface/Frameworkfwd.h"
00023 #include "FWCore/Framework/interface/Event.h"
00024 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00025 #include "FWCore/Framework/interface/MakerMacros.h"
00026 #include "FWCore/Framework/interface/EventSetup.h"
00027 
00028 #include <string>
00029 #include <iostream>
00030 #include <iomanip>
00031 #include <vector>
00032 #include <list>
00033 
00034 #include "DataFormats/CaloTowers/interface/CaloTowerCollection.h"
00035 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
00036 #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
00037 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
00038 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
00039 #include "DataFormats/EcalDetId/interface/EBDetId.h"
00040 #include "DataFormats/EcalDetId/interface/EEDetId.h"
00041 
00042 #include "Geometry/Records/interface/IdealGeometryRecord.h"
00043 #include "FWCore/Framework/interface/ESHandle.h"
00044 #include "Geometry/CaloTopology/interface/CaloTopology.h"
00045 #include "Geometry/CaloEventSetup/interface/CaloTopologyRecord.h"
00046 
00047 #include "Geometry/CaloTopology/interface/CaloTowerConstituentsMap.h"
00048 
00049 #include "FastSimulation/L1CaloTriggerProducer/interface/FastL1RegionMap.h"
00050 // No BitInfos for release versions
00051 #include "FastSimDataFormats/External/interface/FastL1BitInfo.h" // FastL1BitInfo is not yet for publication
00052 
00053 struct L1Config {
00054   bool DoJetCorr;
00055   bool DoEMCorr;
00056 
00057   double JetSeedEtThreshold;
00058   double EMSeedEnThreshold;
00059  
00060   double EMActiveLevel; 
00061   double HadActiveLevel; 
00062   double EMNoiseLevel; 
00063   double HadNoiseLevel;
00064 
00065   double noTauVetoLevel; 
00066   double hOeThreshold; 
00067   double FGEBThreshold;
00068   double FGEEThreshold;
00069   double noFGThreshold;
00070   double QuietRegionThreshold;  
00071   double MuonNoiseLevel; 
00072   double CrystalEBThreshold;
00073   double CrystalEEThreshold;
00074 
00075   double TowerEMLSB;
00076   double TowerHadLSB;
00077   double EMLSB;
00078   double JetLSB;
00079 
00080   double TowerEBThreshold;
00081   double TowerEEThreshold;
00082   double TowerHBThreshold;
00083   double TowerHEThreshold;
00084 
00085   double TowerEBScale;
00086   double TowerEEScale;
00087   double TowerHBScale;
00088   double TowerHEScale;
00089 
00090   std::vector<edm::InputTag> EmInputs;
00091   edm::InputTag TowerInput;
00092 
00093   edm::InputTag EcalTPInput;
00094   edm::InputTag HcalTPInput;
00095 
00096   edm::FileInPath HcalLUT;
00097 };
00098 
00099 
00100 class CaloTowerConstituentsMap;
00101 class CaloTopology;
00102 class CaloGeometry;
00103 //class EcalRecHitCollection;
00104 
00105 //
00106 //
00107 // This Class is container for region data like
00108 // towers and algorithms for veto bits.
00109 //
00110 class FastL1Region {
00111 
00112  public:
00113   FastL1Region();
00114   ~FastL1Region();
00115 
00116   void SetParameters(L1Config);
00117   void FillTower(const CaloTower& t,int& tid,edm::ESHandle<CaloGeometry> &cGeom); 
00118   void FillTowerZero(const CaloTower& t,int& tid); 
00119   void FillTower_Scaled(const CaloTower& t,int& tid,bool doRCTTrunc,edm::ESHandle<CaloGeometry> &cGeom); 
00120   void FillEMCrystals(const CaloTowerConstituentsMap* theTowerConstituentsMap,
00121                       const CaloTopology* calotopo,
00122                       const CaloGeometry* cGeom,
00123                       const EcalRecHitCollection* ec0,
00124                       const EcalRecHitCollection* ec1,
00125                       FastL1RegionMap* m_RMap);
00126 
00127 
00128   void Dump();
00129   void SetEtaPhiIndex(int eta,int phi,int ind) 
00130   { ieta=eta; iphi=phi; id=ind; };
00131 
00132   int GetiEta() { return ieta; };
00133   int GetiPhi() { return iphi; };
00134   int GetId()  { return id; };
00135 
00136   int GetNorthId();
00137   int GetSouthId(); 
00138   int GetWestId(); 
00139   int GetEastId(); 
00140   int GetNWId(); 
00141   int GetSWId(); 
00142   int GetNEId(); 
00143   int GetSEId(); 
00144 
00145   void SetRegionBits(edm::Event const& e);
00146   void SetTowerBits();
00147   void SetRegionEnergy();
00148 
00149   bool GetTauBit() { return tauBit; };
00150   bool GetQuietBit() { return quietBit; };
00151   bool GetMIPBit() { return mipBit; };
00152   bool GetFGBit(int i) { if(i>=0 && i<16) {return fgBit[i];} else { return false; } };
00153   bool GetHOEBit(int i) { if(i>=0 && i<16) { return hOeBit[i]; } else { return false; } };
00154   bool GetHCFGBit(int i) {  if(i>=0 && i<16) return hcfgBit[i]; else return false; };
00155 
00156   CaloTowerCollection GetCaloTowers() { return Towers; };
00157   void SetEMCrystalEnergy(int itwr, int icell, double en) { EMCrystalEnergy[itwr][icell] = en; };
00158   double GetEMCrystalEnergy(int itwr, int icell) { return EMCrystalEnergy[itwr][icell]; };
00159 
00160   double SumE() { return CalcSumE(); };
00161   double SumEt() { return CalcSumEt(); };
00162   double SumEmE() { return CalcSumEmE(); };
00163   double SumEmEt() { return CalcSumEmEt(); };
00164   double SumHadE() { return CalcSumHadE(); };
00165   double SumHadEt() { return CalcSumHadEt(); };
00166   double CalcSumE();
00167   double CalcSumEt();
00168   double CalcSumEmE();
00169   double CalcSumEmEt();
00170   double CalcSumHadE();
00171   double CalcSumHadEt();
00172   double GetJetE() { return jetE; };
00173   double GetJetEt() { return jetEt; };
00174   void SetJetE(double jE) { jetE = jE; };
00175   void SetJetEt(double jEt) { jetEt = jEt; };
00176 
00177   void SetDoBitInfo(bool doIt) {doBitInfo = doIt;}
00178 
00179   int HighestEtTowerID();
00180   int HighestEmEtTowerID();
00181   int HighestHadEtTowerID();
00182 
00183   double GetJetE3x3() { return jetE3x3; };
00184   double GetJetEt3x3() { return jetEt3x3; };
00185   void SetJetE3x3(double jE) { jetE3x3 = jE; };
00186   void SetJetEt3x3(double jEt) { jetEt3x3 = jEt; };
00187 
00188   std::pair<double, double> getRegionCenterEtaPhi(const edm::EventSetup& c);
00189 
00190   std::pair<int, int> GetTowerNorthEtaPhi(int ieta, int iphi); 
00191 
00192   FastL1BitInfo getBitInfo() { return BitInfo; }
00193 
00194   // public - has to bechanged!!!
00195   bool doBitInfo;
00196   FastL1BitInfo BitInfo;
00197 
00198   void SetFGBit(int twrid,bool FGBIT);
00199   void SetHCFGBit(int twrid,bool FGBIT);
00200   void SetHOEBit(int twrid,bool FGBIT);
00201 
00202  private:
00203   void SetTauBit(edm::Event const& e);
00204   void SetFGBit();
00205   void SetHOEBit();
00206   void SetQuietBit();
00207   void SetMIPBit();
00208   void SetHCFGBit();
00209 
00210   // Save Tower info
00211   // 4x4 matrices (rows,columns):
00212   // 0  1  2  3
00213   // 4  5  6  7
00214   // 8  9  10 11
00215   // 10 13 14 15
00216   CaloTowerCollection Towers;
00217   // Save only Crystal Energies
00218   double EMCrystalEnergy[16][25];
00219 
00220   // if region is central: jet energy is sum of 12x12 tower
00221   // surrounding the central region
00222   double jetE;
00223   double jetEt;
00224   double jetE3x3;
00225   double jetEt3x3;
00226 
00227   int id;
00228   int ieta;
00229   int iphi;
00230 
00231   bool tauBit;
00232   bool quietBit;
00233   bool mipBit;
00234 
00235   bool fgBit[16];
00236   bool hOeBit[16];
00237   bool hcfgBit[16];
00238 
00239   double sumEt;
00240   double sumE;
00241 
00242   L1Config Config;
00243 };
00244 
00245 
00246 double 
00247 corrJetEt(double et, double eta);
00248 
00249 // Jet Calibration from Frederick(Helsinki), Monika/Creighton (Wisconsin)
00250 double 
00251 corrJetEt1(double et, double eta);
00252 
00253 // Jet Calibration from CMSSW_1_3_0
00254 double 
00255 corrJetEt2(double et, double eta);
00256 
00257 // EM correction from ORCA for cmsim 133
00258 double 
00259 corrEmEt(double et, int eta);
00260 //corrEmEt(double et, double eta);
00261 
00262 double 
00263 RCTEnergyTrunc(double et, double Resol = 1., double thres = 1024.);
00264 
00265 double 
00266 GCTEnergyTrunc(double et, double LSB = 1., bool doEM=false);
00267 
00268 #endif