EcalEleCalibLooper

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
/**
  * \file EcalEleCalibLooper.h
  * \class EcalEleCalibLooper
  * \brief ECAL TB 2006 calibration with matrix inversion technique
  * \author 
  *
*/
#ifndef __CINT__
#ifndef EcalEleCalibLooper_H
#define EcalEleCalibLooper_H
#include "Calibration/EcalCalibAlgos/interface/VEcalCalibBlock.h"
#include "FWCore/Framework/interface/EDLooper.h"
#include "FWCore/Framework/interface/Event.h"
#include "Calibration/EcalCalibAlgos/interface/VFillMap.h"
#include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h"
#include <string>
#include <vector>

#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
#include "DataFormats/DetId/interface/DetId.h"
#include "DataFormats/EcalDetId/interface/EBDetId.h"
#include "DataFormats/EcalDetId/interface/EEDetId.h"
#include "DataFormats/EgammaReco/interface/BasicClusterShapeAssociation.h"
#include "DataFormats/EgammaCandidates/interface/ElectronFwd.h"
#include "DataFormats/EgammaCandidates/interface/Electron.h"
#include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
#include "Geometry/CaloGeometry/interface/CaloGeometry.h"
#include "Geometry/Records/interface/CaloGeometryRecord.h"

#include "CLHEP/Matrix/GenMatrix.h"
#include "CLHEP/Matrix/Matrix.h"
#include "CLHEP/Matrix/Vector.h"
class EcalEleCalibLooper : public edm::EDLooper {
public:
  //! ctor
  explicit EcalEleCalibLooper(const edm::ParameterSet &);
  //! dtor
  ~EcalEleCalibLooper() override;
  void beginOfJob() override;
  void endOfJob() override;
  void startingNewLoop(unsigned int) override;
  Status duringLoop(const edm::Event &, const edm::EventSetup &) override;
  Status endOfLoop(const edm::EventSetup &, unsigned int iCounter) override;

private:
  //DS to divide in Regions
  int EBRegionId(const int, const int) const;
  int EERegionId(const int, const int) const;
  //DS to define the regions for each cristal
  void EBRegionDefinition();
  void EERegionDefinition();
  //DS defines the limit for the tan of phi
  double giveLimit(int);

  //DS checks if the values of ics and ips are in EE or not
  int EEregionCheck(const int, const int) const;
  int EBregionCheck(const int eta, const int phi) const;

  //!LP Change the coordinate system
  int etaShifter(const int) const;

private:
  //! EcalBarrel Input Collection name
  const edm::InputTag m_barrelAlCa;
  //! EcalEndcap Input Collection name
  const edm::InputTag m_endcapAlCa;
  //! To take the electrons
  edm::InputTag m_ElectronLabel;

  //! reconstruction window size
  const int m_recoWindowSidex;
  const int m_recoWindowSidey;

  //! eta size of the sub-matrix
  const int m_etaWidth;  //PG sub matrix size and borders
  //! eta size of the additive border to the sub-matrix
  //    int m_etaBorder ; //FIXME
  //! phi size of the sub-matrix
  const int m_phiWidthEB;
  //! phi size of the additive border to the sub-matrix
  //    int m_phiBorderEB //FIXME;

  //! eta start of the region of interest
  const int m_etaStart;  //PG ECAL region to be calibrated
  //! eta end of the region of interest
  const int m_etaEnd;
  //! phi start of the region of interest
  const int m_phiStartEB;
  //! phi end of the region of interest
  const int m_phiEndEB;
  //!DS For the EE
  const int m_radStart;
  const int m_radEnd;
  const int m_radWidth;
  //FIXME    int m_radBorder ;
  const int m_phiStartEE;
  const int m_phiEndEE;
  const int m_phiWidthEE;

  //! maximum number of events per crystal
  const int m_maxSelectedNumPerXtal;

  //! single blocks calibrators
  std::vector<VEcalCalibBlock *> m_EcalCalibBlocks;
  //! minimum energy per crystal cut
  const double m_minEnergyPerCrystal;
  //! maximum energy per crystal cut
  const double m_maxEnergyPerCrystal;
  //! minimum coefficient accepted (RAW)
  const double m_minCoeff;
  //! maximum coefficient accepted (RAW)
  const double m_maxCoeff;
  //! to exclude the blocksolver
  const int m_usingBlockSolver;

  //!the maps of  recalib coeffs
  EcalIntercalibConstantMap m_barrelMap;
  EcalIntercalibConstantMap m_endcapMap;

  //! DS sets the number of loops to do
  const unsigned int m_loops;
  //The map Filler
  VFillMap *m_MapFiller;

  //DS number of regions in the Endcap
  inline int EEregionsNum() const;
  //DS number of regions in the barrel
  inline int EBregionsNum() const;

  std::vector<int> m_regions;

  std::vector<DetId> m_barrelCells;
  std::vector<DetId> m_endcapCells;

  std::map<int, int> m_xtalRegionId;
  std::map<int, int> m_xtalPositionInRegion;
  std::map<int, int> m_xtalNumOfHits;

  bool isfirstcall_;

  //! ED token
  const edm::EDGetTokenT<EBRecHitCollection> m_ebRecHitToken;
  const edm::EDGetTokenT<EERecHitCollection> m_eeRecHitToken;
  const edm::EDGetTokenT<reco::GsfElectronCollection> m_gsfElectronToken;
  //! ES token
  const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> m_geometryToken;
};
#endif
#endif