00001
00010 #ifndef __CINT__
00011 #ifndef EcalEleCalibLooper_H
00012 #define EcalEleCalibLooper_H
00013 #include "Calibration/EcalCalibAlgos/interface/VEcalCalibBlock.h"
00014 #include "Calibration/Tools/interface/smartSelector.h"
00015 #include "FWCore/Framework/interface/EDLooper.h"
00016 #include "FWCore/Framework/interface/Event.h"
00017
00018 #include <iostream>
00019 #include <string>
00020 #include <vector>
00021
00022 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
00023 #include "DataFormats/DetId/interface/DetId.h"
00024 #include "DataFormats/EcalDetId/interface/EBDetId.h"
00025 #include "DataFormats/EcalDetId/interface/EEDetId.h"
00026 #include "DataFormats/EgammaReco/interface/BasicClusterShapeAssociation.h"
00027 #include "DataFormats/EgammaCandidates/interface/ElectronFwd.h"
00028 #include "DataFormats/EgammaCandidates/interface/Electron.h"
00029 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
00030 #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
00031
00032 #include "CLHEP/Matrix/GenMatrix.h"
00033 #include "CLHEP/Matrix/Matrix.h"
00034 #include "CLHEP/Matrix/Vector.h"
00035
00036 class EcalEleCalibLooper : public edm::EDLooper {
00037 public:
00038
00040 explicit EcalEleCalibLooper(const edm::ParameterSet&);
00042 ~EcalEleCalibLooper();
00043 void beginOfJob(const edm::EventSetup&) ;
00044 void endOfJob();
00045 void startingNewLoop(unsigned int) ;
00046 Status duringLoop(const edm::Event&, const edm::EventSetup&) ;
00047 Status endOfLoop(const edm::EventSetup&,unsigned int iCounter) ;
00048
00049
00050 private:
00051
00052 typedef reco::GsfElectronCollection::const_iterator eleIterator;
00053 typedef edm::Handle<reco::BasicClusterShapeAssociationCollection> HandleBasicCSAC;
00054
00055 DetId getMaxId(eleIterator EleIt,
00056 HandleBasicCSAC & barrelClShpHandle,
00057 HandleBasicCSAC & endcapClShpHandle);
00058
00059 DetId findMaxHit (const std::vector<DetId> & v1,
00060 const EBRecHitCollection* EBhits,
00061 const EERecHitCollection* EEhits) ;
00062
00063 void fillEBMap (EBDetId EBmax,
00064 const EcalRecHitCollection * barrelHitsCollection,
00065 std::map<int,double> & EBXtlMap,
00066 int EBNumberOfRegion, double & pSubtract ) ;
00067
00068 void fillEEMap (EEDetId EEmax,
00069 const EcalRecHitCollection * endcapHitsCollection,
00070 std::map<int,double> & EExtlMap,
00071 int EENumberOfRegion, double & pSubtract ) ;
00072
00073
00075 int makeReport (std::string baseName="output") ;
00077 int evalKaliX2Num () ;
00078
00080
00082
00083
00085 int findVoidLine (const CLHEP::HepMatrix & suspect) ;
00087
00088 int EBRegionId (const int, const int) const;
00089 int EERegionId (const int, const int) const;
00090
00091 void EBRegionDefinition ();
00092 void EERegionDefinition ();
00093
00094 double giveLimit (int);
00095
00096
00097 int EEregionCheck (const int, const int) const;
00098 int EBregionCheck (const int eta,const int phi) const;
00099
00101 int etaShifter (const int) const ;
00102
00103 private:
00104
00105
00107 edm::InputTag m_barrelAlCa ;
00109 edm::InputTag m_endcapAlCa ;
00110
00112 int m_recoWindowSide ;
00113
00115 int m_etaWidth ;
00117
00119 int m_phiWidthEB ;
00121
00122
00124 int m_etaStart ;
00126 int m_etaEnd ;
00128 int m_phiStartEB ;
00130 int m_phiEndEB ;
00132 int m_radStart ;
00133 int m_radEnd ;
00134 int m_radWidth ;
00135
00136 int m_phiStartEE ;
00137 int m_phiEndEE ;
00138 int m_phiWidthEE ;
00139 int m_EBxtlNum[170][360] ;
00140 int m_EBxtlReg[170][360] ;
00141 int m_EExtlNum[100][100] ;
00142 int m_EExtlReg[100][100] ;
00143
00145
00147
00149 int m_maxSelectedNumPerXtal ;
00151
00153
00155
00157
00159
00160
00162 std::vector<VEcalCalibBlock *> m_EcalCalibBlocks ;
00164 double m_minEnergyPerCrystal ;
00166 double m_maxEnergyPerCrystal ;
00168 double m_minCoeff ;
00170 double m_maxCoeff ;
00172 int m_usingBlockSolver ;
00173
00175 std::map<int,double> m_recalibMap ;
00176
00178 unsigned int m_loops ;
00180 edm::InputTag m_ElectronLabel ;
00181
00182
00183
00184 inline int EEregionsNum () const ;
00185
00186 inline int EBregionsNum () const ;
00187
00188 std::vector<int> m_regions;
00189
00190 std::vector<DetId> m_barrelCells;
00191 std::vector<DetId> m_endcapCells;
00192
00193 std::map<int,int> m_xtalRegionId ;
00194 std::map<int,int> m_xtalPositionInRegion ;
00195
00196 std::map <int,int> m_xtalNumOfHits;
00197
00198 };
00199 #endif
00200 #endif