Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:58:39

0001 /**
0002   * \file EcalEleCalibLooper.h
0003   * \class EcalEleCalibLooper
0004   * \brief ECAL TB 2006 calibration with matrix inversion technique
0005   * \author 
0006   *
0007 */
0008 #ifndef __CINT__
0009 #ifndef EcalEleCalibLooper_H
0010 #define EcalEleCalibLooper_H
0011 #include "Calibration/EcalCalibAlgos/interface/VEcalCalibBlock.h"
0012 #include "FWCore/Framework/interface/EDLooper.h"
0013 #include "FWCore/Framework/interface/Event.h"
0014 #include "Calibration/EcalCalibAlgos/interface/VFillMap.h"
0015 #include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h"
0016 #include <string>
0017 #include <vector>
0018 
0019 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
0020 #include "DataFormats/DetId/interface/DetId.h"
0021 #include "DataFormats/EcalDetId/interface/EBDetId.h"
0022 #include "DataFormats/EcalDetId/interface/EEDetId.h"
0023 #include "DataFormats/EgammaReco/interface/BasicClusterShapeAssociation.h"
0024 #include "DataFormats/EgammaCandidates/interface/ElectronFwd.h"
0025 #include "DataFormats/EgammaCandidates/interface/Electron.h"
0026 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
0027 #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
0028 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
0029 #include "Geometry/Records/interface/CaloGeometryRecord.h"
0030 
0031 #include "CLHEP/Matrix/GenMatrix.h"
0032 #include "CLHEP/Matrix/Matrix.h"
0033 #include "CLHEP/Matrix/Vector.h"
0034 class EcalEleCalibLooper : public edm::EDLooper {
0035 public:
0036   //! ctor
0037   explicit EcalEleCalibLooper(const edm::ParameterSet &);
0038   //! dtor
0039   ~EcalEleCalibLooper() override;
0040   void beginOfJob() override;
0041   void endOfJob() override;
0042   void startingNewLoop(unsigned int) override;
0043   Status duringLoop(const edm::Event &, const edm::EventSetup &) override;
0044   Status endOfLoop(const edm::EventSetup &, unsigned int iCounter) override;
0045 
0046 private:
0047   //DS to divide in Regions
0048   int EBRegionId(const int, const int) const;
0049   int EERegionId(const int, const int) const;
0050   //DS to define the regions for each cristal
0051   void EBRegionDefinition();
0052   void EERegionDefinition();
0053   //DS defines the limit for the tan of phi
0054   double giveLimit(int);
0055 
0056   //DS checks if the values of ics and ips are in EE or not
0057   int EEregionCheck(const int, const int) const;
0058   int EBregionCheck(const int eta, const int phi) const;
0059 
0060   //!LP Change the coordinate system
0061   int etaShifter(const int) const;
0062 
0063 private:
0064   //! EcalBarrel Input Collection name
0065   const edm::InputTag m_barrelAlCa;
0066   //! EcalEndcap Input Collection name
0067   const edm::InputTag m_endcapAlCa;
0068   //! To take the electrons
0069   edm::InputTag m_ElectronLabel;
0070 
0071   //! reconstruction window size
0072   const int m_recoWindowSidex;
0073   const int m_recoWindowSidey;
0074 
0075   //! eta size of the sub-matrix
0076   const int m_etaWidth;  //PG sub matrix size and borders
0077   //! eta size of the additive border to the sub-matrix
0078   //    int m_etaBorder ; //FIXME
0079   //! phi size of the sub-matrix
0080   const int m_phiWidthEB;
0081   //! phi size of the additive border to the sub-matrix
0082   //    int m_phiBorderEB //FIXME;
0083 
0084   //! eta start of the region of interest
0085   const int m_etaStart;  //PG ECAL region to be calibrated
0086   //! eta end of the region of interest
0087   const int m_etaEnd;
0088   //! phi start of the region of interest
0089   const int m_phiStartEB;
0090   //! phi end of the region of interest
0091   const int m_phiEndEB;
0092   //!DS For the EE
0093   const int m_radStart;
0094   const int m_radEnd;
0095   const int m_radWidth;
0096   //FIXME    int m_radBorder ;
0097   const int m_phiStartEE;
0098   const int m_phiEndEE;
0099   const int m_phiWidthEE;
0100 
0101   //! maximum number of events per crystal
0102   const int m_maxSelectedNumPerXtal;
0103 
0104   //! single blocks calibrators
0105   std::vector<VEcalCalibBlock *> m_EcalCalibBlocks;
0106   //! minimum energy per crystal cut
0107   const double m_minEnergyPerCrystal;
0108   //! maximum energy per crystal cut
0109   const double m_maxEnergyPerCrystal;
0110   //! minimum coefficient accepted (RAW)
0111   const double m_minCoeff;
0112   //! maximum coefficient accepted (RAW)
0113   const double m_maxCoeff;
0114   //! to exclude the blocksolver
0115   const int m_usingBlockSolver;
0116 
0117   //!the maps of  recalib coeffs
0118   EcalIntercalibConstantMap m_barrelMap;
0119   EcalIntercalibConstantMap m_endcapMap;
0120 
0121   //! DS sets the number of loops to do
0122   const unsigned int m_loops;
0123   //The map Filler
0124   VFillMap *m_MapFiller;
0125 
0126   //DS number of regions in the Endcap
0127   inline int EEregionsNum() const;
0128   //DS number of regions in the barrel
0129   inline int EBregionsNum() const;
0130 
0131   std::vector<int> m_regions;
0132 
0133   std::vector<DetId> m_barrelCells;
0134   std::vector<DetId> m_endcapCells;
0135 
0136   std::map<int, int> m_xtalRegionId;
0137   std::map<int, int> m_xtalPositionInRegion;
0138   std::map<int, int> m_xtalNumOfHits;
0139 
0140   bool isfirstcall_;
0141 
0142   //! ED token
0143   const edm::EDGetTokenT<EBRecHitCollection> m_ebRecHitToken;
0144   const edm::EDGetTokenT<EERecHitCollection> m_eeRecHitToken;
0145   const edm::EDGetTokenT<reco::GsfElectronCollection> m_gsfElectronToken;
0146   //! ES token
0147   const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> m_geometryToken;
0148 };
0149 #endif
0150 #endif