CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
InvRingCalib Class Reference

ECAL TB 2006 calibration with matrix inversion technique. More...

#include <InvRingCalib.h>

Inheritance diagram for InvRingCalib:
edm::EDLooper edm::EDLooperBase edm::EDConsumerBase

Public Member Functions

void beginOfJob () override
 BeginOfJob. More...
 
Status duringLoop (const edm::Event &, const edm::EventSetup &) override
 duringLoop More...
 
void endOfJob () override
 
Status endOfLoop (const edm::EventSetup &, unsigned int iCounter) override
 
 InvRingCalib (const edm::ParameterSet &)
 ctor More...
 
void startingNewLoop (unsigned int) override
 startingNewLoop More...
 
 ~InvRingCalib () override
 dtor More...
 
- Public Member Functions inherited from edm::EDLooper
 EDLooper ()
 
 EDLooper (EDLooper const &)=delete
 
EDLooperoperator= (EDLooper const &)=delete
 
 ~EDLooper () override
 
- Public Member Functions inherited from edm::EDLooperBase
virtual void attachTo (ActivityRegistry &)
 Override this method if you need to monitor the state of the processing. More...
 
void beginOfJob (EventSetupImpl const &)
 
virtual void beginOfJob (EventSetup const &)
 
void copyInfo (ScheduleInfo const &)
 
void doBeginLuminosityBlock (LuminosityBlockPrincipal &, EventSetupImpl const &, ProcessContext *)
 
void doBeginRun (RunPrincipal &, EventSetupImpl const &, ProcessContext *)
 
Status doDuringLoop (EventPrincipal &eventPrincipal, EventSetupImpl const &es, ProcessingController &, StreamContext *)
 
void doEndLuminosityBlock (LuminosityBlockPrincipal &, EventSetupImpl const &, ProcessContext *)
 
Status doEndOfLoop (EventSetupImpl const &es)
 
void doEndRun (RunPrincipal &, EventSetupImpl const &, ProcessContext *)
 
void doStartingNewLoop ()
 
 EDLooperBase ()
 
 EDLooperBase (EDLooperBase const &)=delete
 
void esPrefetchAsync (WaitingTaskHolder iTask, EventSetupImpl const &iImpl, Transition iTrans, ServiceToken const &iToken) const
 
virtual std::set< eventsetup::EventSetupRecordKeymodifyingRecords () const
 
EDLooperBaseoperator= (EDLooperBase const &)=delete
 
void prefetchAsync (WaitingTaskHolder iTask, ServiceToken const &token, Transition iTrans, Principal const &iPrincipal, EventSetupImpl const &iImpl) const
 
void prepareForNextLoop (eventsetup::EventSetupProvider *esp)
 
void setActionTable (ExceptionToActionTable const *actionTable)
 
void setModuleChanger (ModuleChanger *)
 
 ~EDLooperBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

int EBRegId (const int)
 Gives back in which region you are: More...
 
void EBRegionDef ()
 Defines the regions in the barrel. More...
 
int EBRegionNum () const
 Number of regions in EB. More...
 
int EERegId (int)
 gives back in which region of the endcap you are. More...
 
void EERegionDef ()
 Defines the regions in the endcap. More...
 
int EERegionNum () const
 The number of regions in EE. More...
 
void EERingDef (const edm::EventSetup &)
 Defines the rins in the endcap. More...
 
void RegPrepare ()
 Prepares the EB regions;. More...
 

Private Attributes

bool isfirstcall_
 
const edm::InputTag m_barrelAlCa
 EcalBarrel Input Collection name. More...
 
std::vector< DetIdm_barrelCells
 geometry things used all over the file More...
 
EcalIntercalibConstantMap m_barrelMap
 
std::map< int, int > m_cellPhi
 
std::map< int, GlobalPointm_cellPos
 position of the cell, borders, coords etc... More...
 
const std::string m_EBcoeffFile
 coeffs filenames More...
 
const edm::EDGetTokenT< EBRecHitCollectionm_ebRecHitToken
 ED token. More...
 
const std::string m_EEcoeffFile
 
const edm::EDGetTokenT< EERecHitCollectionm_eeRecHitToken
 
const int m_EEZone
 endcap zone to be calibrated More...
 
const edm::InputTag m_ElectronLabel
 To take the electrons. More...
 
const edm::InputTag m_endcapAlCa
 EcalEndcap Input Collection name. More...
 
std::vector< DetIdm_endcapCells
 
EcalIntercalibConstantMap m_endcapMap
 
const int m_endRing
 
const int m_etaEnd
 eta end of the zone of interest More...
 
const int m_etaStart
 eta start of the zone of interest More...
 
const int m_etaWidth
 eta size of the regions More...
 
const edm::ESGetToken< CaloGeometry, CaloGeometryRecordm_geometryToken
 ES token. More...
 
const edm::EDGetTokenT< reco::GsfElectronCollectionm_gsfElectronToken
 
std::vector< VEcalCalibBlock * > m_IMACalibBlocks
 single blocks calibrators More...
 
unsigned int m_loops
 LP sets the number of loops to do. More...
 
VFillMapm_MapFiller
 The class that fills the map! More...
 
std::string m_mapFillerType
 
const double m_maxCoeff
 maximum coefficient accepted (RAW) More...
 
const double m_maxEnergyPerCrystal
 maximum energy per crystal cut More...
 
const int m_maxSelectedNumPerRing
 maximum number of events per Ring More...
 
const double m_minCoeff
 minimum coefficient accepted (RAW) More...
 
const double m_minEnergyPerCrystal
 minimum energy per crystal cut More...
 
const int m_recoWindowSidex
 reconstruction window size More...
 
const int m_recoWindowSidey
 
std::map< int, int > m_Reg
 EB regions vs. eta index. More...
 
std::map< int, int > m_RinginRegion
 association map between raw detIds and the number of the ring inside the region More...
 
std::map< int, int > m_RingNumOfHits
 number of events already read per Ring More...
 
const int m_startRing
 LP define the EE region to calibrate. More...
 
const int m_usingBlockSolver
 to exclude the blocksolver More...
 
std::map< int, int > m_xtalRegionId
 association map between raw detIds and Region More...
 
std::map< int, int > m_xtalRing
 association map between Raw detIds and Rings More...
 

Additional Inherited Members

- Public Types inherited from edm::EDLooperBase
enum  Status { kContinue, kStop }
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDLooperBase
ModuleChangermoduleChanger ()
 This only returns a non-zero value during the call to endOfLoop. More...
 
ScheduleInfo const * scheduleInfo () const
 This returns a non-zero value after the constructor has been called. More...
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

ECAL TB 2006 calibration with matrix inversion technique.

Author

Definition at line 30 of file InvRingCalib.h.

Constructor & Destructor Documentation

◆ InvRingCalib()

InvRingCalib::InvRingCalib ( const edm::ParameterSet iConfig)
explicit

ctor

Definition at line 26 of file InvRingCalib.cc.

References funct::abs(), qcdUeDQM_cfi::algorithm, cms::cuda::assert(), EBRegionNum(), EERegionNum(), beamvalidation::exit(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), mps_fire::i, createfilelist::int, m_EEZone, m_endRing, m_etaEnd, m_etaStart, m_etaWidth, m_IMACalibBlocks, m_loops, m_mapFillerType, m_startRing, and AlCaHLTBitMon_QueryRunRegistry::string.

27  : m_barrelAlCa(iConfig.getParameter<edm::InputTag>("barrelAlca")),
28  m_endcapAlCa(iConfig.getParameter<edm::InputTag>("endcapAlca")),
29  m_ElectronLabel(iConfig.getParameter<edm::InputTag>("ElectronLabel")),
30  m_recoWindowSidex(iConfig.getParameter<int>("recoWindowSidex")),
31  m_recoWindowSidey(iConfig.getParameter<int>("recoWindowSidey")),
32  m_minEnergyPerCrystal(iConfig.getParameter<double>("minEnergyPerCrystal")),
33  m_maxEnergyPerCrystal(iConfig.getParameter<double>("maxEnergyPerCrystal")),
34  m_etaStart(iConfig.getParameter<int>("etaStart")),
35  m_etaEnd(iConfig.getParameter<int>("etaEnd")),
36  m_etaWidth(iConfig.getParameter<int>("etaWidth")),
37  m_maxSelectedNumPerRing(iConfig.getParameter<int>("maxNumPerRing")),
38  m_minCoeff(iConfig.getParameter<double>("minCoeff")),
39  m_maxCoeff(iConfig.getParameter<double>("maxCoeff")),
40  m_usingBlockSolver(iConfig.getParameter<int>("usingBlockSolver")),
41  m_startRing(iConfig.getParameter<int>("startRing")),
42  m_endRing(iConfig.getParameter<int>("endRing")),
43  m_EBcoeffFile(iConfig.getParameter<std::string>("EBcoeffs")),
44  m_EEcoeffFile(iConfig.getParameter<std::string>("EEcoeffs")),
45  m_EEZone(iConfig.getParameter<int>("EEZone")),
46  m_ebRecHitToken(consumes<EBRecHitCollection>(m_barrelAlCa)),
47  m_eeRecHitToken(consumes<EERecHitCollection>(m_endcapAlCa)),
48  m_gsfElectronToken(consumes<reco::GsfElectronCollection>(m_ElectronLabel)),
50  //controls if the parameters inputed are correct
51  if ((m_etaEnd * m_etaStart) > 0)
53  if ((m_etaEnd * m_etaStart) < 0)
54  assert(!((m_etaEnd - m_etaStart - 1) % m_etaWidth));
55 
56  assert(m_etaStart >= -85 && m_etaStart <= 86);
57  assert(m_etaEnd >= m_etaStart && m_etaEnd <= 86);
58  assert(m_startRing > -1 && m_startRing <= 40);
60 
62  assert((abs(m_EEZone) <= 1));
63 
64  m_loops = (unsigned int)iConfig.getParameter<int>("loops") - 1;
65  //LP CalibBlock vector instantiation
66  edm::LogInfo("IML") << "[InvRingCalib][ctor] Calib Block";
67  std::string algorithm = iConfig.getParameter<std::string>("algorithm");
68  m_mapFillerType = iConfig.getParameter<std::string>("FillType");
69  int eventWeight = iConfig.getUntrackedParameter<int>("L3EventWeight", 1);
70 
71  for (int i = 0; i < EBRegionNum(); ++i) {
72  if (algorithm == "IMA")
74  else if (algorithm == "L3")
75  m_IMACalibBlocks.push_back(new L3CalibBlock(m_etaWidth, eventWeight));
76  else {
77  edm::LogError("building") << algorithm << " is not a valid calibration algorithm";
78  exit(1);
79  }
80  }
81  int EEBlocks = 0;
82  if (m_EEZone == 0)
83  EEBlocks = 2 * EERegionNum();
84  if (m_EEZone == 1 || m_EEZone == -1)
85  EEBlocks = EERegionNum();
86 
87  for (int i = 0; i < EEBlocks; ++i) {
88  if (algorithm == "IMA")
90  else if (algorithm == "L3")
91  m_IMACalibBlocks.push_back(new L3CalibBlock(m_etaWidth, eventWeight));
92  else {
93  edm::LogError("building") << algorithm << " is not a valid calibration algorithm";
94  exit(1);
95  }
96  }
97  edm::LogInfo("IML") << " [InvRingCalib][ctor] end of creator";
98 }
const edm::InputTag m_ElectronLabel
To take the electrons.
Definition: InvRingCalib.h:71
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const double m_maxEnergyPerCrystal
maximum energy per crystal cut
Definition: InvRingCalib.h:78
const int m_etaWidth
eta size of the regions
Definition: InvRingCalib.h:84
const edm::EDGetTokenT< EBRecHitCollection > m_ebRecHitToken
ED token.
Definition: InvRingCalib.h:131
const int m_endRing
Definition: InvRingCalib.h:109
const int m_usingBlockSolver
to exclude the blocksolver
Definition: InvRingCalib.h:97
const int m_startRing
LP define the EE region to calibrate.
Definition: InvRingCalib.h:108
const int m_EEZone
endcap zone to be calibrated
Definition: InvRingCalib.h:124
int EERegionNum() const
The number of regions in EE.
std::vector< VEcalCalibBlock * > m_IMACalibBlocks
single blocks calibrators
Definition: InvRingCalib.h:91
Log< level::Error, false > LogError
assert(be >=bs)
const double m_maxCoeff
maximum coefficient accepted (RAW)
Definition: InvRingCalib.h:95
const edm::EDGetTokenT< reco::GsfElectronCollection > m_gsfElectronToken
Definition: InvRingCalib.h:133
const double m_minCoeff
minimum coefficient accepted (RAW)
Definition: InvRingCalib.h:93
T getUntrackedParameter(std::string const &, T const &) const
int EBRegionNum() const
Number of regions in EB.
const edm::InputTag m_barrelAlCa
EcalBarrel Input Collection name.
Definition: InvRingCalib.h:67
const int m_recoWindowSidey
Definition: InvRingCalib.h:74
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > m_geometryToken
ES token.
Definition: InvRingCalib.h:135
const int m_etaEnd
eta end of the zone of interest
Definition: InvRingCalib.h:82
const int m_etaStart
eta start of the zone of interest
Definition: InvRingCalib.h:80
interface to the L3Univ class for testing
Definition: L3CalibBlock.h:24
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
unsigned int m_loops
LP sets the number of loops to do.
Definition: InvRingCalib.h:106
Log< level::Info, false > LogInfo
const edm::InputTag m_endcapAlCa
EcalEndcap Input Collection name.
Definition: InvRingCalib.h:69
const edm::EDGetTokenT< EERecHitCollection > m_eeRecHitToken
Definition: InvRingCalib.h:132
const double m_minEnergyPerCrystal
minimum energy per crystal cut
Definition: InvRingCalib.h:76
const int m_recoWindowSidex
reconstruction window size
Definition: InvRingCalib.h:73
const int m_maxSelectedNumPerRing
maximum number of events per Ring
Definition: InvRingCalib.h:87
const std::string m_EEcoeffFile
Definition: InvRingCalib.h:122
const std::string m_EBcoeffFile
coeffs filenames
Definition: InvRingCalib.h:121
std::string m_mapFillerType
Definition: InvRingCalib.h:127
def exit(msg="")

◆ ~InvRingCalib()

InvRingCalib::~InvRingCalib ( )
override

dtor

destructor

Definition at line 103 of file InvRingCalib.cc.

103 {}

Member Function Documentation

◆ beginOfJob()

void InvRingCalib::beginOfJob ( )
overridevirtual

BeginOfJob.

Reimplemented from edm::EDLooperBase.

Definition at line 108 of file InvRingCalib.cc.

References isfirstcall_.

108 { isfirstcall_ = true; }

◆ duringLoop()

edm::EDLooper::Status InvRingCalib::duringLoop ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

duringLoop

Implements edm::EDLooper.

Definition at line 129 of file InvRingCalib.cc.

References funct::abs(), EBRegionDef(), DetId::Ecal, EcalBarrel, EcalEndcap, EERegionDef(), EERingDef(), HcalObjRepresent::Fill(), VFillMap::fillMap(), dqmdumpme::first, CaloMiscalibMapEcal::get(), edm::EventSetup::getData(), EcalCondObjectContainer< T >::getMap(), SiStripPI::getMaximum(), EBDetId::ieta(), iEvent, EBDetId::iphi(), isfirstcall_, edm::HandleBase::isValid(), EEDetId::ix(), EEDetId::iy(), edm::EDLooperBase::kContinue, m_barrelCells, m_barrelMap, m_EBcoeffFile, m_ebRecHitToken, m_EEcoeffFile, m_eeRecHitToken, m_endcapCells, m_endcapMap, m_geometryToken, m_gsfElectronToken, m_IMACalibBlocks, m_MapFiller, m_mapFillerType, m_maxEnergyPerCrystal, m_minEnergyPerCrystal, m_recoWindowSidex, m_recoWindowSidey, m_RinginRegion, m_RingNumOfHits, m_xtalRegionId, m_xtalRing, METSkim_cff::Max, MillePedeFileConverter_cfg::out, MiscalibReaderFromXML::parseXMLMiscalibFile(), CaloMiscalibMapEcal::prefillMap(), edm::Handle< T >::product(), DetId::rawId(), and EEDetId::zside().

129  {
130  if (isfirstcall_) {
131  edm::LogInfo("IML") << "[InvRingCalib][beginOfJob]";
132  //gets the geometry from the event setup
133  const auto& geometry = iSetup.getData(m_geometryToken);
134  edm::LogInfo("IML") << "[InvRingCalib] Event Setup read";
135  //fills a vector with all the cells
136  m_barrelCells = geometry.getValidDetIds(DetId::Ecal, EcalBarrel);
137  m_endcapCells = geometry.getValidDetIds(DetId::Ecal, EcalEndcap);
138  //Defines the EB regions
139  edm::LogInfo("IML") << "[InvRingCalib] Defining Barrel Regions";
140  EBRegionDef();
141  //Defines what is a ring in the EE
142  edm::LogInfo("IML") << "[InvRingCalib] Defining endcap Rings";
143  EERingDef(iSetup);
144  //Defines the regions in the EE
145  edm::LogInfo("IML") << "[InvRingCalib] Defining endcap Regions";
146  EERegionDef();
147  if (m_mapFillerType == "Cluster")
154  &m_barrelMap,
155  &m_endcapMap);
156  if (m_mapFillerType == "Matrix")
163  &m_barrelMap,
164  &m_endcapMap);
165  edm::LogInfo("IML") << "[InvRingCalib] Initializing the coeffs";
166  //Sets the initial coefficients to 1.
167  //Graphs to check ring, regions and so on, not needed in the final version
168  TH2F EBRegion("EBRegion", "EBRegion", 171, -85, 86, 360, 1, 361);
169  TH2F EBRing("EBRing", "EBRing", 171, -85, 86, 360, 1, 361);
170  for (std::vector<DetId>::const_iterator it = m_barrelCells.begin(); it != m_barrelCells.end(); ++it) {
171  EBDetId eb(*it);
172  EBRing.Fill(eb.ieta(), eb.iphi(), m_RinginRegion[it->rawId()]);
173  EBRegion.Fill(eb.ieta(), eb.iphi(), m_xtalRegionId[it->rawId()]);
174  }
175 
176  TH2F EEPRegion("EEPRegion", "EEPRegion", 100, 1, 101, 100, 1, 101);
177  TH2F EEPRing("EEPRing", "EEPRing", 100, 1, 101, 100, 1, 101);
178  TH2F EEPRingReg("EEPRingReg", "EEPRingReg", 100, 1, 101, 100, 1, 101);
179  TH2F EEMRegion("EEMRegion", "EEMRegion", 100, 1, 101, 100, 1, 101);
180  TH2F EEMRing("EEMRing", "EEMRing", 100, 1, 101, 100, 1, 101);
181  TH2F EEMRingReg("EEMRingReg", "EEMRingReg", 100, 1, 101, 100, 1, 101);
182  // TH1F eta ("eta","eta",250,-85,165);
183  for (std::vector<DetId>::const_iterator it = m_endcapCells.begin(); it != m_endcapCells.end(); ++it) {
184  EEDetId ee(*it);
185  if (ee.zside() > 0) {
186  EEPRegion.Fill(ee.ix(), ee.iy(), m_xtalRegionId[ee.rawId()]);
187  EEPRing.Fill(ee.ix(), ee.iy(), m_xtalRing[ee.rawId()]);
188  EEPRingReg.Fill(ee.ix(), ee.iy(), m_RinginRegion[ee.rawId()]);
189  }
190  if (ee.zside() < 0) {
191  EEMRegion.Fill(ee.ix(), ee.iy(), m_xtalRegionId[ee.rawId()]);
192  EEMRing.Fill(ee.ix(), ee.iy(), m_xtalRing[ee.rawId()]);
193  EEMRingReg.Fill(ee.ix(), ee.iy(), m_RinginRegion[ee.rawId()]);
194  }
195  }
196 
197  // for (std::map<int,float>::iterator it=m_eta.begin();
198  // it!=m_eta.end();++it)
199  // eta.Fill(it->first,it->second);
200  TFile out("EBZone.root", "recreate");
201  EBRegion.Write();
202  EBRing.Write();
203  EEPRegion.Write();
204  EEPRing.Write();
205  EEPRingReg.Write();
206  EEMRegion.Write();
207  EEMRing.Write();
208  // eta.Write();
209  EEMRingReg.Write();
210  out.Close();
211  edm::LogInfo("IML") << "[InvRingCalib] Start to acquire the coeffs";
212  CaloMiscalibMapEcal EBmap;
213  EBmap.prefillMap();
214  MiscalibReaderFromXMLEcalBarrel barrelreader(EBmap);
215  if (!m_EBcoeffFile.empty())
216  barrelreader.parseXMLMiscalibFile(m_EBcoeffFile);
217  EcalIntercalibConstants costants(EBmap.get());
218  m_barrelMap = costants.getMap();
219  CaloMiscalibMapEcal EEmap;
220  EEmap.prefillMap();
221  MiscalibReaderFromXMLEcalEndcap endcapreader(EEmap);
222  if (!m_EEcoeffFile.empty())
223  endcapreader.parseXMLMiscalibFile(m_EEcoeffFile);
224  EcalIntercalibConstants EEcostants(EEmap.get());
225  m_endcapMap = EEcostants.getMap();
226 
227  isfirstcall_ = false;
228  } // if isfirstcall
229 
230  //gets the barrel recHits
231  double pSubtract = 0.;
232  double pTk = 0.;
233  const EcalRecHitCollection* barrelHitsCollection = nullptr;
234  edm::Handle<EBRecHitCollection> barrelRecHitsHandle;
235  iEvent.getByToken(m_ebRecHitToken, barrelRecHitsHandle);
236  barrelHitsCollection = barrelRecHitsHandle.product();
237 
238  if (!barrelRecHitsHandle.isValid()) {
239  edm::LogError("IML") << "[EcalEleCalibLooper] barrel rec hits not found";
240  return kContinue;
241  }
242 
243  //gets the endcap recHits
244  const EcalRecHitCollection* endcapHitsCollection = nullptr;
245  edm::Handle<EERecHitCollection> endcapRecHitsHandle;
246  iEvent.getByToken(m_eeRecHitToken, endcapRecHitsHandle);
247  endcapHitsCollection = endcapRecHitsHandle.product();
248 
249  if (!endcapRecHitsHandle.isValid()) {
250  edm::LogError("IML") << "[EcalEleCalibLooper] endcap rec hits not found";
251  return kContinue;
252  }
253 
254  //gets the electrons
256  iEvent.getByToken(m_gsfElectronToken, pElectrons);
257 
258  if (!pElectrons.isValid()) {
259  edm::LogError("IML") << "[EcalEleCalibLooper] electrons not found";
260  return kContinue;
261  }
262 
263  //loops over the electrons in the event
264  for (reco::GsfElectronCollection::const_iterator eleIt = pElectrons->begin(); eleIt != pElectrons->end(); ++eleIt) {
265  pSubtract = 0;
266  pTk = eleIt->trackMomentumAtVtx().R();
267  std::map<int, double> xtlMap;
268  DetId Max = 0;
269  if (std::abs(eleIt->eta()) < 1.49)
270  Max = EcalClusterTools::getMaximum(eleIt->superCluster()->hitsAndFractions(), barrelHitsCollection).first;
271  else
272  Max = EcalClusterTools::getMaximum(eleIt->superCluster()->hitsAndFractions(), endcapHitsCollection).first;
273  if (Max.det() == 0)
274  continue;
276  eleIt->superCluster()->hitsAndFractions(), Max, barrelHitsCollection, endcapHitsCollection, xtlMap, pSubtract);
277  if (m_xtalRegionId[Max.rawId()] == -1)
278  continue;
279  pSubtract += eleIt->superCluster()->preshowerEnergy();
280  ++m_RingNumOfHits[m_xtalRing[Max.rawId()]];
281  //fills the calibBlock
282  m_IMACalibBlocks.at(m_xtalRegionId[Max.rawId()])->Fill(xtlMap.begin(), xtlMap.end(), pTk, pSubtract);
283  }
284  return kContinue;
285 } //end of duringLoop
virtual void fillMap(const std::vector< std::pair< DetId, float > > &, const DetId, const EcalRecHitCollection *, const EcalRecHitCollection *, std::map< int, double > &xtlMap, double &)=0
The Map filler.
const double m_maxEnergyPerCrystal
maximum energy per crystal cut
Definition: InvRingCalib.h:78
const edm::EDGetTokenT< EBRecHitCollection > m_ebRecHitToken
ED token.
Definition: InvRingCalib.h:131
void EERingDef(const edm::EventSetup &)
Defines the rins in the endcap.
std::map< int, int > m_xtalRegionId
association map between raw detIds and Region
Definition: InvRingCalib.h:113
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
void EBRegionDef()
Defines the regions in the barrel.
T const * product() const
Definition: Handle.h:70
EcalIntercalibConstantMap m_endcapMap
Definition: InvRingCalib.h:104
void EERegionDef()
Defines the regions in the endcap.
std::vector< VEcalCalibBlock * > m_IMACalibBlocks
single blocks calibrators
Definition: InvRingCalib.h:91
Log< level::Error, false > LogError
const edm::EDGetTokenT< reco::GsfElectronCollection > m_gsfElectronToken
Definition: InvRingCalib.h:133
double getMaximum(TObjArray *array)
EcalIntercalibConstantMap m_barrelMap
Definition: InvRingCalib.h:103
int iEvent
Definition: GenABIO.cc:224
const int m_recoWindowSidey
Definition: InvRingCalib.h:74
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > m_geometryToken
ES token.
Definition: InvRingCalib.h:135
VFillMap * m_MapFiller
The class that fills the map!
Definition: InvRingCalib.h:63
const EcalIntercalibConstants & get()
std::vector< DetId > m_barrelCells
geometry things used all over the file
Definition: InvRingCalib.h:118
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
std::map< int, int > m_RinginRegion
association map between raw detIds and the number of the ring inside the region
Definition: InvRingCalib.h:115
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::map< int, int > m_xtalRing
association map between Raw detIds and Rings
Definition: InvRingCalib.h:111
Log< level::Info, false > LogInfo
Definition: DetId.h:17
const edm::EDGetTokenT< EERecHitCollection > m_eeRecHitToken
Definition: InvRingCalib.h:132
const double m_minEnergyPerCrystal
minimum energy per crystal cut
Definition: InvRingCalib.h:76
bool isValid() const
Definition: HandleBase.h:70
const int m_recoWindowSidex
reconstruction window size
Definition: InvRingCalib.h:73
const std::string m_EEcoeffFile
Definition: InvRingCalib.h:122
const std::string m_EBcoeffFile
coeffs filenames
Definition: InvRingCalib.h:121
std::vector< DetId > m_endcapCells
Definition: InvRingCalib.h:119
std::map< int, int > m_RingNumOfHits
number of events already read per Ring
Definition: InvRingCalib.h:89
std::string m_mapFillerType
Definition: InvRingCalib.h:127

◆ EBRegId()

int InvRingCalib::EBRegId ( const int  ieta)
private

Gives back in which region you are:

gives the region Id given ieta

Definition at line 533 of file InvRingCalib.cc.

References LEDCalibrationChannels::ieta, m_etaEnd, and m_Reg.

Referenced by EBRegionDef().

533  {
534  if (ieta < m_etaStart || ieta >= m_etaEnd)
535  return -1;
536  else
537  return (m_Reg[ieta]);
538 }
const int m_etaEnd
eta end of the zone of interest
Definition: InvRingCalib.h:82
std::map< int, int > m_Reg
EB regions vs. eta index.
Definition: InvRingCalib.h:126

◆ EBRegionDef()

void InvRingCalib::EBRegionDef ( )
private

Defines the regions in the barrel.

Definition at line 543 of file InvRingCalib.cc.

References EBRegId(), m_barrelCells, m_etaStart, m_etaWidth, m_RinginRegion, m_xtalRegionId, m_xtalRing, and RegPrepare().

Referenced by duringLoop().

543  {
544  RegPrepare();
545  for (std::vector<DetId>::const_iterator it = m_barrelCells.begin(); it != m_barrelCells.end(); ++it) {
546  EBDetId eb(it->rawId());
547  m_xtalRing[eb.rawId()] = eb.ieta();
548  m_xtalRegionId[eb.rawId()] = EBRegId(eb.ieta());
549  if (m_xtalRegionId[eb.rawId()] == -1)
550  continue;
551  m_RinginRegion[eb.rawId()] = (eb.ieta() - m_etaStart) % m_etaWidth;
552  }
553 }
const int m_etaWidth
eta size of the regions
Definition: InvRingCalib.h:84
std::map< int, int > m_xtalRegionId
association map between raw detIds and Region
Definition: InvRingCalib.h:113
std::vector< DetId > m_barrelCells
geometry things used all over the file
Definition: InvRingCalib.h:118
const int m_etaStart
eta start of the zone of interest
Definition: InvRingCalib.h:80
std::map< int, int > m_RinginRegion
association map between raw detIds and the number of the ring inside the region
Definition: InvRingCalib.h:115
void RegPrepare()
Prepares the EB regions;.
std::map< int, int > m_xtalRing
association map between Raw detIds and Rings
Definition: InvRingCalib.h:111
int EBRegId(const int)
Gives back in which region you are:

◆ EBRegionNum()

int InvRingCalib::EBRegionNum ( ) const
private

Number of regions in EB.

number of Ring in EB

Definition at line 512 of file InvRingCalib.cc.

References m_etaEnd, m_etaStart, and m_etaWidth.

Referenced by EERegionDef(), and InvRingCalib().

512  {
513  if ((m_etaEnd * m_etaStart) > 0)
514  return ((m_etaEnd - m_etaStart) / m_etaWidth);
515 
516  if ((m_etaEnd * m_etaStart) < 0)
517  return ((m_etaEnd - m_etaStart - 1) / m_etaWidth);
518 
519  return 0;
520 }
const int m_etaWidth
eta size of the regions
Definition: InvRingCalib.h:84
const int m_etaEnd
eta end of the zone of interest
Definition: InvRingCalib.h:82
const int m_etaStart
eta start of the zone of interest
Definition: InvRingCalib.h:80

◆ EERegId()

int InvRingCalib::EERegId ( int  id)
private

gives back in which region of the endcap you are.

Gives the Id of the region given the id of the xtal.

Definition at line 439 of file InvRingCalib.cc.

References l1ctLayer2EG_cff::id, m_EEZone, m_endRing, m_etaWidth, m_RinginRegion, m_startRing, m_xtalRing, relativeConstraints::ring, and EEDetId::zside().

Referenced by EERegionDef().

439  {
440  int reg;
441  int ring;
442  EEDetId ee(id);
443  //sets the reg to -1 if the ring doesn't exist or is outside the region of interest
444  if (m_xtalRing[id] == -1)
445  return -1;
446  //avoid the calibration in the wrong zside
447  if (m_EEZone == 1) {
448  if (ee.zside() < 0)
449  return -1;
450  ring = m_xtalRing[id] - 86;
451  if (ring >= m_endRing)
452  return -1;
453  if (ring < m_startRing)
454  return -1;
455  reg = (ring - m_startRing) / m_etaWidth;
457  return reg;
458  }
459  if (m_EEZone == -1) {
460  if (ee.zside() > 0)
461  return -1;
462  ring = m_xtalRing[id] - 125;
463  if (ring >= m_endRing)
464  return -1;
465  if (ring < m_startRing)
466  return -1;
467  reg = (ring - m_startRing) / m_etaWidth;
469  return reg;
470  }
471  if (ee.zside() > 0)
472  ring = m_xtalRing[id] - 86;
473  else
474  ring = m_xtalRing[id] - 125;
475  if (ring >= m_endRing)
476  return -1;
477  if (ring < m_startRing)
478  return -1;
479  reg = (ring - m_startRing) / m_etaWidth;
481  return reg;
482 }
const int m_etaWidth
eta size of the regions
Definition: InvRingCalib.h:84
const int m_endRing
Definition: InvRingCalib.h:109
const int m_startRing
LP define the EE region to calibrate.
Definition: InvRingCalib.h:108
const int m_EEZone
endcap zone to be calibrated
Definition: InvRingCalib.h:124
std::map< int, int > m_RinginRegion
association map between raw detIds and the number of the ring inside the region
Definition: InvRingCalib.h:115
std::map< int, int > m_xtalRing
association map between Raw detIds and Rings
Definition: InvRingCalib.h:111

◆ EERegionDef()

void InvRingCalib::EERegionDef ( )
private

Defines the regions in the endcap.

Loops over all the endcap xtals and sets for each xtal the value of the region the xtal is in, and the ringNumber inside the region

Definition at line 486 of file InvRingCalib.cc.

References EBRegionNum(), EERegId(), EERegionNum(), m_endcapCells, m_xtalRegionId, and EEDetId::zside().

Referenced by duringLoop().

486  {
487  int reg;
488  for (std::vector<DetId>::const_iterator endcapIt = m_endcapCells.begin(); endcapIt != m_endcapCells.end();
489  ++endcapIt) {
490  EEDetId ee(*endcapIt);
491  reg = EERegId(endcapIt->rawId());
492  //If the ring is not of interest saves only the region Id(-1)
493  if (reg == -1)
494  m_xtalRegionId[endcapIt->rawId()] = reg;
495  //sums the number of region in EB or EB+EE to have different regionsId in different regions
496  else {
497  if (ee.zside() > 0)
498  reg += EBRegionNum();
499  else
500  reg += EBRegionNum() + EERegionNum();
501  m_xtalRegionId[endcapIt->rawId()] = reg;
502  }
503  }
504 }
std::map< int, int > m_xtalRegionId
association map between raw detIds and Region
Definition: InvRingCalib.h:113
int EERegionNum() const
The number of regions in EE.
int EERegId(int)
gives back in which region of the endcap you are.
int EBRegionNum() const
Number of regions in EB.
std::vector< DetId > m_endcapCells
Definition: InvRingCalib.h:119

◆ EERegionNum()

int InvRingCalib::EERegionNum ( ) const
inlineprivate

The number of regions in EE.

Number of Regions in EE.

Definition at line 509 of file InvRingCalib.cc.

References m_endRing, m_etaWidth, and m_startRing.

Referenced by EERegionDef(), and InvRingCalib().

509 { return ((m_endRing - m_startRing) / m_etaWidth); }
const int m_etaWidth
eta size of the regions
Definition: InvRingCalib.h:84
const int m_endRing
Definition: InvRingCalib.h:109
const int m_startRing
LP define the EE region to calibrate.
Definition: InvRingCalib.h:108

◆ EERingDef()

void InvRingCalib::EERingDef ( const edm::EventSetup iSetup)
private

Defines the rins in the endcap.

EE ring definition.

Definition at line 383 of file InvRingCalib.cc.

References DetId::Ecal, EcalEndcap, edm::EventSetup::getData(), CaloSubdetectorGeometry::getGeometry(), m_cellPhi, m_cellPos, m_endcapCells, m_geometryToken, m_xtalRing, DetId::rawId(), relativeConstraints::ring, EEDetId::validDetId(), EEDetId::XYMODE, and EEDetId::zside().

Referenced by duringLoop().

383  {
384  //Gets the geometry of the endcap
385  const auto& geometry = iSetup.getData(m_geometryToken);
386  const CaloSubdetectorGeometry* endcapGeometry = geometry.getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
387  //for every xtal gets the position Vector and the phi position
388 
389  // for (std::vector<DetId>::const_iterator barrelIt = m_barrelCells.begin();
390  // barrelIt!=m_barrelCells.end();
391  // ++barrelIt) {
392  // const CaloCellGeometry *cellGeometry = barrelGeometry->getGeometry(*barrelIt);
393  // GlobalPoint point;
394  // EBDetId eb (*barrelIt);
395  // point=cellGeometry->getPosition();
396  // m_eta[eb.ieta()]=point.eta() ; //cellGeometry->getPosition().eta();
397  // }
398  for (std::vector<DetId>::const_iterator endcapIt = m_endcapCells.begin(); endcapIt != m_endcapCells.end();
399  ++endcapIt) {
400  auto cellGeometry = endcapGeometry->getGeometry(*endcapIt);
401  m_cellPos[endcapIt->rawId()] = cellGeometry->getPosition();
402  m_cellPhi[endcapIt->rawId()] = cellGeometry->getPosition().phi();
403  }
404  //takes the first 39 xtals at a fixed y varying the x coordinate and saves their eta coordinate
405  float eta_ring[39];
406  for (int ring = 0; ring < 39; ring++)
407  if (EEDetId::validDetId(ring, 50, 1)) {
408  EEDetId det = EEDetId(ring, 50, 1, EEDetId::XYMODE);
409  eta_ring[ring] = m_cellPos[det.rawId()].eta();
410  }
411  //defines the bonduary of the rings as the average eta of a xtal
412  double etaBonduary[40];
413  etaBonduary[0] = 1.49;
414  etaBonduary[39] = 4.0;
415  for (int ring = 1; ring < 39; ++ring)
416  etaBonduary[ring] = (eta_ring[ring] + eta_ring[ring - 1]) / 2.;
417  //assign to each xtal a ring number
418  int CRing;
419  for (int ring = 0; ring < 39; ring++)
420  for (std::vector<DetId>::const_iterator endcapIt = m_endcapCells.begin(); endcapIt != m_endcapCells.end();
421  ++endcapIt) {
422  if (fabs(m_cellPos[endcapIt->rawId()].eta()) > etaBonduary[ring] &&
423  fabs(m_cellPos[endcapIt->rawId()].eta()) < etaBonduary[ring + 1]) {
424  EEDetId ee(*endcapIt);
425  if (ee.zside() > 0)
426  CRing = ring + 86;
427  else
428  CRing = ring + 125;
429  m_xtalRing[endcapIt->rawId()] = CRing;
430  // m_eta[CRing]=m_cellPos[endcapIt->rawId()].eta();
431  }
432  }
433  return;
434 }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
static const int XYMODE
Definition: EEDetId.h:335
std::map< int, GlobalPoint > m_cellPos
position of the cell, borders, coords etc...
Definition: InvRingCalib.h:99
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > m_geometryToken
ES token.
Definition: InvRingCalib.h:135
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
std::map< int, int > m_xtalRing
association map between Raw detIds and Rings
Definition: InvRingCalib.h:111
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
std::map< int, int > m_cellPhi
Definition: InvRingCalib.h:100
std::vector< DetId > m_endcapCells
Definition: InvRingCalib.h:119

◆ endOfJob()

void InvRingCalib::endOfJob ( )
overridevirtual

Reimplemented from edm::EDLooperBase.

Definition at line 360 of file InvRingCalib.cc.

References EcalBarrel, EcalEndcap, m_barrelCells, m_barrelMap, m_endcapCells, m_endcapMap, and calibXMLwriter::writeLine().

360  {
361  edm::LogInfo("IML") << "[InvMatrixCalibLooper][endOfJob] saving calib coeffs";
362  calibXMLwriter barrelWriter(EcalBarrel);
363  calibXMLwriter endcapWriter(EcalEndcap);
364  for (std::vector<DetId>::const_iterator barrelIt = m_barrelCells.begin(); barrelIt != m_barrelCells.end();
365  ++barrelIt) {
366  EBDetId eb(*barrelIt);
367  barrelWriter.writeLine(eb, m_barrelMap[eb]);
368  }
369  for (std::vector<DetId>::const_iterator endcapIt = m_endcapCells.begin(); endcapIt != m_endcapCells.end();
370  ++endcapIt) {
371  EEDetId ee(*endcapIt);
372  endcapWriter.writeLine(ee, m_endcapMap[ee]);
373  }
374 }
EcalIntercalibConstantMap m_endcapMap
Definition: InvRingCalib.h:104
EcalIntercalibConstantMap m_barrelMap
Definition: InvRingCalib.h:103
std::vector< DetId > m_barrelCells
geometry things used all over the file
Definition: InvRingCalib.h:118
Log< level::Info, false > LogInfo
std::vector< DetId > m_endcapCells
Definition: InvRingCalib.h:119

◆ endOfLoop()

edm::EDLooper::Status InvRingCalib::endOfLoop ( const edm::EventSetup ,
unsigned int  iCounter 
)
overridevirtual

Called after the system has finished one loop over the events. Thar argument is a count of how many loops have been processed before this loo. For the first time through the events the argument will be 0.

Implements edm::EDLooperBase.

Definition at line 290 of file InvRingCalib.cc.

References corrVsCorr::filename, RemoveAddSevLevel::flag, cms::cuda::for(), edm::EDLooperBase::kContinue, edm::EDLooperBase::kStop, m_barrelCells, m_barrelMap, m_endcapCells, m_endcapMap, m_IMACalibBlocks, m_loops, m_maxCoeff, m_minCoeff, m_RinginRegion, m_RingNumOfHits, m_usingBlockSolver, m_xtalRegionId, m_xtalRing, and MillePedeFileConverter_cfg::out.

290  {
291  std::map<int, double> InterRings;
292  edm::LogInfo("IML") << "[InvMatrixCalibLooper][endOfLoop] Start to invert the matrixes";
293  //call the autoexplaining "solve" method for every calibBlock
294  for (std::vector<VEcalCalibBlock*>::iterator calibBlock = m_IMACalibBlocks.begin();
295  calibBlock != m_IMACalibBlocks.end();
296  ++calibBlock)
297  (*calibBlock)->solve(m_usingBlockSolver, m_minCoeff, m_maxCoeff);
298 
299  edm::LogInfo("IML") << "[InvRingLooper][endOfLoop] Starting to write the coeffs";
300  TH1F* coeffDistr = new TH1F("coeffdistr", "coeffdistr", 100, 0.7, 1.4);
301  TH1F* coeffMap = new TH1F("coeffRingMap", "coeffRingMap", 250, -85, 165);
302  TH1F* ringDistr = new TH1F("ringDistr", "ringDistr", 250, -85, 165);
303  TH1F* RingFill = new TH1F("RingFill", "RingFill", 250, -85, 165);
304  for (std::map<int, int>::const_iterator it = m_xtalRing.begin(); it != m_xtalRing.end(); ++it)
305  ringDistr->Fill(it->second + 0.1);
306 
307  int ID;
308  std::map<int, int> flag;
309  for (std::map<int, int>::const_iterator it = m_xtalRing.begin(); it != m_xtalRing.end(); ++it)
310  flag[it->second] = 0;
311 
312  for (std::vector<DetId>::const_iterator it = m_barrelCells.begin(); it != m_barrelCells.end(); ++it) {
313  ID = it->rawId();
314  if (m_xtalRegionId[ID] == -1)
315  continue;
316  if (flag[m_xtalRing[ID]])
317  continue;
318  flag[m_xtalRing[ID]] = 1;
319  RingFill->Fill(m_xtalRing[ID], m_RingNumOfHits[m_xtalRing[ID]]);
320  InterRings[m_xtalRing[ID]] = m_IMACalibBlocks.at(m_xtalRegionId[ID])->at(m_RinginRegion[ID]);
321  coeffMap->Fill(m_xtalRing[ID] + 0.1, InterRings[m_xtalRing[ID]]);
322  coeffDistr->Fill(InterRings[m_xtalRing[ID]]);
323  }
324 
325  for (std::vector<DetId>::const_iterator it = m_endcapCells.begin(); it != m_endcapCells.end(); ++it) {
326  ID = it->rawId();
327  if (m_xtalRegionId[ID] == -1)
328  continue;
329  if (flag[m_xtalRing[ID]])
330  continue;
331  flag[m_xtalRing[ID]] = 1;
332  InterRings[m_xtalRing[ID]] = m_IMACalibBlocks.at(m_xtalRegionId[ID])->at(m_RinginRegion[ID]);
333  RingFill->Fill(m_xtalRing[ID], m_RingNumOfHits[m_xtalRing[ID]]);
334  coeffMap->Fill(m_xtalRing[ID], InterRings[m_xtalRing[ID]]);
335  coeffDistr->Fill(InterRings[m_xtalRing[ID]]);
336  }
337 
338  char filename[80];
339  sprintf(filename, "coeff%d.root", iCounter);
340  TFile out(filename, "recreate");
341  coeffDistr->Write();
342  coeffMap->Write();
343  ringDistr->Write();
344  RingFill->Write();
345  out.Close();
346  for (std::vector<DetId>::const_iterator it = m_barrelCells.begin(); it != m_barrelCells.end(); ++it) {
347  m_barrelMap[*it] *= InterRings[m_xtalRing[it->rawId()]];
348  }
349  for (std::vector<DetId>::const_iterator it = m_endcapCells.begin(); it != m_endcapCells.end(); ++it)
350  m_endcapMap[*it] *= InterRings[m_xtalRing[it->rawId()]];
351  if (iCounter < m_loops - 1)
352  return kContinue;
353  else
354  return kStop;
355 }
std::map< int, int > m_xtalRegionId
association map between raw detIds and Region
Definition: InvRingCalib.h:113
const int m_usingBlockSolver
to exclude the blocksolver
Definition: InvRingCalib.h:97
for(int i=first, nt=offsets[nh];i< nt;i+=gridDim.x *blockDim.x)
uint32_t ID
Definition: Definitions.h:24
EcalIntercalibConstantMap m_endcapMap
Definition: InvRingCalib.h:104
std::vector< VEcalCalibBlock * > m_IMACalibBlocks
single blocks calibrators
Definition: InvRingCalib.h:91
const double m_maxCoeff
maximum coefficient accepted (RAW)
Definition: InvRingCalib.h:95
const double m_minCoeff
minimum coefficient accepted (RAW)
Definition: InvRingCalib.h:93
EcalIntercalibConstantMap m_barrelMap
Definition: InvRingCalib.h:103
std::vector< DetId > m_barrelCells
geometry things used all over the file
Definition: InvRingCalib.h:118
std::map< int, int > m_RinginRegion
association map between raw detIds and the number of the ring inside the region
Definition: InvRingCalib.h:115
unsigned int m_loops
LP sets the number of loops to do.
Definition: InvRingCalib.h:106
std::map< int, int > m_xtalRing
association map between Raw detIds and Rings
Definition: InvRingCalib.h:111
Log< level::Info, false > LogInfo
std::map< int, CalibCoeff > coeffMap
std::vector< DetId > m_endcapCells
Definition: InvRingCalib.h:119
std::map< int, int > m_RingNumOfHits
number of events already read per Ring
Definition: InvRingCalib.h:89

◆ RegPrepare()

void InvRingCalib::RegPrepare ( )
private

Prepares the EB regions;.

Divides the barrel in region, necessary to take into account the missing 0 xtal

Definition at line 523 of file InvRingCalib.cc.

References mps_fire::i, dqmdumpme::k, m_etaEnd, m_etaStart, m_etaWidth, and m_Reg.

Referenced by EBRegionDef().

523  {
524  int k = 0;
525  for (int i = m_etaStart; i < m_etaEnd; ++i) {
526  if (i == 0)
527  continue;
528  m_Reg[i] = k / m_etaWidth;
529  ++k;
530  }
531 }
const int m_etaWidth
eta size of the regions
Definition: InvRingCalib.h:84
const int m_etaEnd
eta end of the zone of interest
Definition: InvRingCalib.h:82
std::map< int, int > m_Reg
EB regions vs. eta index.
Definition: InvRingCalib.h:126
const int m_etaStart
eta start of the zone of interest
Definition: InvRingCalib.h:80

◆ startingNewLoop()

void InvRingCalib::startingNewLoop ( unsigned int  ciclo)
overridevirtual

startingNewLoop

Implements edm::EDLooperBase.

Definition at line 113 of file InvRingCalib.cc.

References m_IMACalibBlocks, m_RingNumOfHits, m_xtalRing, and relativeConstraints::ring.

113  {
114  edm::LogInfo("IML") << "[InvMatrixCalibLooper][Start] entering loop " << ciclo;
115  for (std::vector<VEcalCalibBlock*>::iterator calibBlock = m_IMACalibBlocks.begin();
116  calibBlock != m_IMACalibBlocks.end();
117  ++calibBlock) {
118  //LP empties the energies vector, to fill DuringLoop.
119  (*calibBlock)->reset();
120  }
121  for (std::map<int, int>::const_iterator ring = m_xtalRing.begin(); ring != m_xtalRing.end(); ++ring)
122  m_RingNumOfHits[ring->second] = 0;
123  return;
124 }
std::vector< VEcalCalibBlock * > m_IMACalibBlocks
single blocks calibrators
Definition: InvRingCalib.h:91
std::map< int, int > m_xtalRing
association map between Raw detIds and Rings
Definition: InvRingCalib.h:111
Log< level::Info, false > LogInfo
std::map< int, int > m_RingNumOfHits
number of events already read per Ring
Definition: InvRingCalib.h:89

Member Data Documentation

◆ isfirstcall_

bool InvRingCalib::isfirstcall_
private

Definition at line 128 of file InvRingCalib.h.

Referenced by beginOfJob(), and duringLoop().

◆ m_barrelAlCa

const edm::InputTag InvRingCalib::m_barrelAlCa
private

EcalBarrel Input Collection name.

Definition at line 67 of file InvRingCalib.h.

◆ m_barrelCells

std::vector<DetId> InvRingCalib::m_barrelCells
private

geometry things used all over the file

Definition at line 118 of file InvRingCalib.h.

Referenced by duringLoop(), EBRegionDef(), endOfJob(), and endOfLoop().

◆ m_barrelMap

EcalIntercalibConstantMap InvRingCalib::m_barrelMap
private

association map between coeff and ring coeffs for the single xtals

Definition at line 103 of file InvRingCalib.h.

Referenced by duringLoop(), endOfJob(), and endOfLoop().

◆ m_cellPhi

std::map<int, int> InvRingCalib::m_cellPhi
private

Definition at line 100 of file InvRingCalib.h.

Referenced by EERingDef().

◆ m_cellPos

std::map<int, GlobalPoint> InvRingCalib::m_cellPos
private

position of the cell, borders, coords etc...

Definition at line 99 of file InvRingCalib.h.

Referenced by EERingDef().

◆ m_EBcoeffFile

const std::string InvRingCalib::m_EBcoeffFile
private

coeffs filenames

Definition at line 121 of file InvRingCalib.h.

Referenced by duringLoop().

◆ m_ebRecHitToken

const edm::EDGetTokenT<EBRecHitCollection> InvRingCalib::m_ebRecHitToken
private

ED token.

Definition at line 131 of file InvRingCalib.h.

Referenced by duringLoop().

◆ m_EEcoeffFile

const std::string InvRingCalib::m_EEcoeffFile
private

Definition at line 122 of file InvRingCalib.h.

Referenced by duringLoop().

◆ m_eeRecHitToken

const edm::EDGetTokenT<EERecHitCollection> InvRingCalib::m_eeRecHitToken
private

Definition at line 132 of file InvRingCalib.h.

Referenced by duringLoop().

◆ m_EEZone

const int InvRingCalib::m_EEZone
private

endcap zone to be calibrated

Definition at line 124 of file InvRingCalib.h.

Referenced by EERegId(), and InvRingCalib().

◆ m_ElectronLabel

const edm::InputTag InvRingCalib::m_ElectronLabel
private

To take the electrons.

Definition at line 71 of file InvRingCalib.h.

◆ m_endcapAlCa

const edm::InputTag InvRingCalib::m_endcapAlCa
private

EcalEndcap Input Collection name.

Definition at line 69 of file InvRingCalib.h.

◆ m_endcapCells

std::vector<DetId> InvRingCalib::m_endcapCells
private

Definition at line 119 of file InvRingCalib.h.

Referenced by duringLoop(), EERegionDef(), EERingDef(), endOfJob(), and endOfLoop().

◆ m_endcapMap

EcalIntercalibConstantMap InvRingCalib::m_endcapMap
private

Definition at line 104 of file InvRingCalib.h.

Referenced by duringLoop(), endOfJob(), and endOfLoop().

◆ m_endRing

const int InvRingCalib::m_endRing
private

Definition at line 109 of file InvRingCalib.h.

Referenced by EERegId(), EERegionNum(), and InvRingCalib().

◆ m_etaEnd

const int InvRingCalib::m_etaEnd
private

eta end of the zone of interest

Definition at line 82 of file InvRingCalib.h.

Referenced by EBRegId(), EBRegionNum(), InvRingCalib(), and RegPrepare().

◆ m_etaStart

const int InvRingCalib::m_etaStart
private

eta start of the zone of interest

Definition at line 80 of file InvRingCalib.h.

Referenced by EBRegionDef(), EBRegionNum(), InvRingCalib(), and RegPrepare().

◆ m_etaWidth

const int InvRingCalib::m_etaWidth
private

eta size of the regions

Definition at line 84 of file InvRingCalib.h.

Referenced by EBRegionDef(), EBRegionNum(), EERegId(), EERegionNum(), InvRingCalib(), and RegPrepare().

◆ m_geometryToken

const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> InvRingCalib::m_geometryToken
private

ES token.

Definition at line 135 of file InvRingCalib.h.

Referenced by duringLoop(), and EERingDef().

◆ m_gsfElectronToken

const edm::EDGetTokenT<reco::GsfElectronCollection> InvRingCalib::m_gsfElectronToken
private

Definition at line 133 of file InvRingCalib.h.

Referenced by duringLoop().

◆ m_IMACalibBlocks

std::vector<VEcalCalibBlock *> InvRingCalib::m_IMACalibBlocks
private

single blocks calibrators

Definition at line 91 of file InvRingCalib.h.

Referenced by duringLoop(), endOfLoop(), InvRingCalib(), and startingNewLoop().

◆ m_loops

unsigned int InvRingCalib::m_loops
private

LP sets the number of loops to do.

Definition at line 106 of file InvRingCalib.h.

Referenced by endOfLoop(), and InvRingCalib().

◆ m_MapFiller

VFillMap* InvRingCalib::m_MapFiller
private

The class that fills the map!

Definition at line 63 of file InvRingCalib.h.

Referenced by duringLoop().

◆ m_mapFillerType

std::string InvRingCalib::m_mapFillerType
private

Definition at line 127 of file InvRingCalib.h.

Referenced by duringLoop(), and InvRingCalib().

◆ m_maxCoeff

const double InvRingCalib::m_maxCoeff
private

maximum coefficient accepted (RAW)

Definition at line 95 of file InvRingCalib.h.

Referenced by endOfLoop().

◆ m_maxEnergyPerCrystal

const double InvRingCalib::m_maxEnergyPerCrystal
private

maximum energy per crystal cut

Definition at line 78 of file InvRingCalib.h.

Referenced by duringLoop().

◆ m_maxSelectedNumPerRing

const int InvRingCalib::m_maxSelectedNumPerRing
private

maximum number of events per Ring

Definition at line 87 of file InvRingCalib.h.

◆ m_minCoeff

const double InvRingCalib::m_minCoeff
private

minimum coefficient accepted (RAW)

Definition at line 93 of file InvRingCalib.h.

Referenced by endOfLoop().

◆ m_minEnergyPerCrystal

const double InvRingCalib::m_minEnergyPerCrystal
private

minimum energy per crystal cut

Definition at line 76 of file InvRingCalib.h.

Referenced by duringLoop().

◆ m_recoWindowSidex

const int InvRingCalib::m_recoWindowSidex
private

reconstruction window size

Definition at line 73 of file InvRingCalib.h.

Referenced by duringLoop().

◆ m_recoWindowSidey

const int InvRingCalib::m_recoWindowSidey
private

Definition at line 74 of file InvRingCalib.h.

Referenced by duringLoop().

◆ m_Reg

std::map<int, int> InvRingCalib::m_Reg
private

EB regions vs. eta index.

Definition at line 126 of file InvRingCalib.h.

Referenced by EBRegId(), and RegPrepare().

◆ m_RinginRegion

std::map<int, int> InvRingCalib::m_RinginRegion
private

association map between raw detIds and the number of the ring inside the region

Definition at line 115 of file InvRingCalib.h.

Referenced by duringLoop(), EBRegionDef(), EERegId(), and endOfLoop().

◆ m_RingNumOfHits

std::map<int, int> InvRingCalib::m_RingNumOfHits
private

number of events already read per Ring

Definition at line 89 of file InvRingCalib.h.

Referenced by duringLoop(), endOfLoop(), and startingNewLoop().

◆ m_startRing

const int InvRingCalib::m_startRing
private

LP define the EE region to calibrate.

Definition at line 108 of file InvRingCalib.h.

Referenced by EERegId(), EERegionNum(), and InvRingCalib().

◆ m_usingBlockSolver

const int InvRingCalib::m_usingBlockSolver
private

to exclude the blocksolver

Definition at line 97 of file InvRingCalib.h.

Referenced by endOfLoop().

◆ m_xtalRegionId

std::map<int, int> InvRingCalib::m_xtalRegionId
private

association map between raw detIds and Region

Definition at line 113 of file InvRingCalib.h.

Referenced by duringLoop(), EBRegionDef(), EERegionDef(), and endOfLoop().

◆ m_xtalRing

std::map<int, int> InvRingCalib::m_xtalRing
private

association map between Raw detIds and Rings

Definition at line 111 of file InvRingCalib.h.

Referenced by duringLoop(), EBRegionDef(), EERegId(), EERingDef(), endOfLoop(), and startingNewLoop().