CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
HGCalHitCalibration Class Reference
Inheritance diagram for HGCalHitCalibration:
DQMEDAnalyzer edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 HGCalHitCalibration (const edm::ParameterSet &)
 
 ~HGCalHitCalibration () override
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
virtual void analyze (edm::Event const &, edm::EventSetup const &)
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual void dqmBeginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
virtual void dqmEndLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmEndRun (edm::Run const &, edm::EventSetup const &)
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &, edm::EventSetup const &) final
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () 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
 
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::vector< ModuleDescription const * > &modules, 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
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void fillWithRecHits (std::map< DetId, const HGCRecHit * > &, DetId, unsigned int, float, int &, float &)
 

Private Attributes

int algo_
 
edm::EDGetTokenT< std::vector< CaloParticle > > caloParticles_
 
int debug_
 
int depletion0_
 
edm::EDGetTokenT< std::vector< reco::GsfElectron > > electrons_
 
std::array< float, layers_Energy_layer_calib_
 
std::array< float, layers_Energy_layer_calib_fraction_
 
std::map< int, MonitorElement * > h_EoP_CPene_calib_fraction_
 
std::map< int, MonitorElement * > hgcal_ele_EoP_CPene_calib_fraction_
 
std::map< int, MonitorElement * > hgcal_EoP_CPene_calib_fraction_
 
std::map< int, MonitorElement * > hgcal_photon_EoP_CPene_calib_fraction_
 
edm::EDGetTokenT< std::vector< reco::PFCluster > > hgcalMultiClusters_
 
MonitorElementLayerOccupancy_
 
edm::EDGetTokenT< std::vector< reco::Photon > > photons_
 
bool rawRecHits_
 
edm::EDGetTokenT< HGCRecHitCollectionrecHitsBH_
 
edm::EDGetTokenT< HGCRecHitCollectionrecHitsEE_
 
edm::EDGetTokenT< HGCRecHitCollectionrecHitsFH_
 
hgcal::RecHitTools recHitTools_
 

Static Private Attributes

static int depletion1_ = 200
 
static int depletion2_ = 300
 
static int layers_ = 60
 

Additional Inherited Members

- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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<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)
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 43 of file HGCalHitCalibration.cc.

Constructor & Destructor Documentation

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

Definition at line 82 of file HGCalHitCalibration.cc.

References algo_, caloTruthCellsProducer_cfi::caloParticles, caloParticles_, depletion0_, hgcalTestNeighbor_cfi::detector, pwdgSkimBPark_cfi::electrons, electrons_, Energy_layer_calib_, Energy_layer_calib_fraction_, edm::ParameterSet::getParameter(), hgcalMultiClusters_, BPHMonitor_cfi::photons, photons_, recHitsBH_, EcalDeadCellBoundaryEnergyFilter_cfi::recHitsEE, recHitsEE_, recHitsFH_, and AlCaHLTBitMon_QueryRunRegistry::string.

83  : rawRecHits_(iConfig.getParameter<bool>("rawRecHits")), debug_(iConfig.getParameter<int>("debug")) {
84  auto detector = iConfig.getParameter<std::string>("detector");
85  auto recHitsEE = iConfig.getParameter<edm::InputTag>("recHitsEE");
86  auto recHitsFH = iConfig.getParameter<edm::InputTag>("recHitsFH");
87  auto recHitsBH = iConfig.getParameter<edm::InputTag>("recHitsBH");
88  auto caloParticles = iConfig.getParameter<edm::InputTag>("caloParticles");
89  auto hgcalMultiClusters = iConfig.getParameter<edm::InputTag>("hgcalMultiClusters");
90  auto electrons = iConfig.getParameter<edm::InputTag>("electrons");
91  auto photons = iConfig.getParameter<edm::InputTag>("photons");
92  if (detector == "all") {
93  recHitsEE_ = consumes<HGCRecHitCollection>(recHitsEE);
94  recHitsFH_ = consumes<HGCRecHitCollection>(recHitsFH);
95  recHitsBH_ = consumes<HGCRecHitCollection>(recHitsBH);
96  algo_ = 1;
97  } else if (detector == "EM") {
98  recHitsEE_ = consumes<HGCRecHitCollection>(recHitsEE);
99  algo_ = 2;
100  } else if (detector == "HAD") {
101  recHitsFH_ = consumes<HGCRecHitCollection>(recHitsFH);
102  recHitsBH_ = consumes<HGCRecHitCollection>(recHitsBH);
103  algo_ = 3;
104  }
105  depletion0_ = iConfig.getParameter<int>("depletionFine");
106  caloParticles_ = consumes<std::vector<CaloParticle> >(caloParticles);
107  hgcalMultiClusters_ = consumes<std::vector<reco::PFCluster> >(hgcalMultiClusters);
108  electrons_ = consumes<std::vector<reco::GsfElectron> >(electrons);
109  photons_ = consumes<std::vector<reco::Photon> >(photons);
110 
111  // size should be HGC layers 52 is enough
112  Energy_layer_calib_.fill(0.);
114 }
T getParameter(std::string const &) const
edm::EDGetTokenT< std::vector< CaloParticle > > caloParticles_
edm::EDGetTokenT< std::vector< reco::Photon > > photons_
std::array< float, layers_ > Energy_layer_calib_fraction_
edm::EDGetTokenT< std::vector< reco::PFCluster > > hgcalMultiClusters_
edm::EDGetTokenT< HGCRecHitCollection > recHitsFH_
edm::EDGetTokenT< HGCRecHitCollection > recHitsEE_
edm::EDGetTokenT< HGCRecHitCollection > recHitsBH_
edm::EDGetTokenT< std::vector< reco::GsfElectron > > electrons_
std::array< float, layers_ > Energy_layer_calib_
HGCalHitCalibration::~HGCalHitCalibration ( )
override

Definition at line 116 of file HGCalHitCalibration.cc.

116  {
117  // do anything here that needs to be done at desctruction time
118  // (e.g. close files, deallocate resources etc.)
119 }

Member Function Documentation

void HGCalHitCalibration::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 180 of file HGCalHitCalibration.cc.

References a, algo_, b, caloTruthCellsProducer_cfi::caloParticles, caloParticles_, bsc_activity_cfg::clusters, reco::CaloCluster::correctedEnergy(), debug_, reco::deltaR2(), DetId::det(), electrons_, reco::PFCluster::energy(), SimCluster::energy(), Energy_layer_calib_, Energy_layer_calib_fraction_, HcalObjRepresent::Fill(), fillWithRecHits(), DetId::Forward, edm::Event::getByToken(), hgcal::RecHitTools::getEventSetup(), hgcal::RecHitTools::getLayerWithOffset(), hgcal::RecHitTools::getSiThickness(), h_EoP_CPene_calib_fraction_, DetId::Hcal, HcalEndcap, hgcal_ele_EoP_CPene_calib_fraction_, hgcal_EoP_CPene_calib_fraction_, hgcal_photon_EoP_CPene_calib_fraction_, DetId::HGCalEE, DetId::HGCalHSc, DetId::HGCalHSi, hgcalMultiClusters_, HGCEE, HGCHEB, HGCHEF, SimCluster::hits_and_fractions(), mps_fire::i, IfLogTrace, edm::HandleBase::isValid(), LogDebug, or, muons2muons_cfi::photon, photons_, rawRecHits_, recHitsBH_, recHitsEE_, recHitsFH_, recHitTools_, SimCluster::simEnergy(), edm::SortedCollection< T, SORT >::size(), and DetId::subdetId().

180  {
181  using namespace edm;
182 
183  recHitTools_.getEventSetup(iSetup);
184 
185  Handle<HGCRecHitCollection> recHitHandleEE;
186  Handle<HGCRecHitCollection> recHitHandleFH;
187  Handle<HGCRecHitCollection> recHitHandleBH;
188 
189  Handle<std::vector<CaloParticle> > caloParticleHandle;
190  iEvent.getByToken(caloParticles_, caloParticleHandle);
191  const std::vector<CaloParticle>& caloParticles = *caloParticleHandle;
192 
193  Handle<std::vector<reco::PFCluster> > hgcalMultiClustersHandle;
194  iEvent.getByToken(hgcalMultiClusters_, hgcalMultiClustersHandle);
195 
196  Handle<std::vector<reco::GsfElectron> > PFElectronHandle;
197  iEvent.getByToken(electrons_, PFElectronHandle);
198 
199  Handle<std::vector<reco::Photon> > PFPhotonHandle;
200  iEvent.getByToken(photons_, PFPhotonHandle);
201 
202  // make a map detid-rechit
203  std::map<DetId, const HGCRecHit*> hitmap;
204  switch (algo_) {
205  case 1: {
206  iEvent.getByToken(recHitsEE_, recHitHandleEE);
207  iEvent.getByToken(recHitsFH_, recHitHandleFH);
208  iEvent.getByToken(recHitsBH_, recHitHandleBH);
209  const auto& rechitsEE = *recHitHandleEE;
210  const auto& rechitsFH = *recHitHandleFH;
211  const auto& rechitsBH = *recHitHandleBH;
212  for (unsigned int i = 0; i < rechitsEE.size(); ++i) {
213  hitmap[rechitsEE[i].detid()] = &rechitsEE[i];
214  }
215  for (unsigned int i = 0; i < rechitsFH.size(); ++i) {
216  hitmap[rechitsFH[i].detid()] = &rechitsFH[i];
217  }
218  for (unsigned int i = 0; i < rechitsBH.size(); ++i) {
219  hitmap[rechitsBH[i].detid()] = &rechitsBH[i];
220  }
221  break;
222  }
223  case 2: {
224  iEvent.getByToken(recHitsEE_, recHitHandleEE);
225  const HGCRecHitCollection& rechitsEE = *recHitHandleEE;
226  for (unsigned int i = 0; i < rechitsEE.size(); i++) {
227  hitmap[rechitsEE[i].detid()] = &rechitsEE[i];
228  }
229  break;
230  }
231  case 3: {
232  iEvent.getByToken(recHitsFH_, recHitHandleFH);
233  iEvent.getByToken(recHitsBH_, recHitHandleBH);
234  const auto& rechitsFH = *recHitHandleFH;
235  const auto& rechitsBH = *recHitHandleBH;
236  for (unsigned int i = 0; i < rechitsFH.size(); i++) {
237  hitmap[rechitsFH[i].detid()] = &rechitsFH[i];
238  }
239  for (unsigned int i = 0; i < rechitsBH.size(); i++) {
240  hitmap[rechitsBH[i].detid()] = &rechitsBH[i];
241  }
242  break;
243  }
244  default:
245  assert(false);
246  break;
247  }
248 
249  // loop over caloParticles
250  int seedDet = 0;
251  float seedEnergy = 0.;
252  IfLogTrace(debug_ > 0, "HGCalHitCalibration") << "Number of caloParticles: " << caloParticles.size() << std::endl;
253  for (const auto& it_caloPart : caloParticles) {
254  if (it_caloPart.g4Tracks()[0].eventId().event() != 0 or it_caloPart.g4Tracks()[0].eventId().bunchCrossing() != 0) {
255  LogDebug("HGCalHitCalibration") << "Excluding CaloParticles from event: "
256  << it_caloPart.g4Tracks()[0].eventId().event()
257  << " with BX: " << it_caloPart.g4Tracks()[0].eventId().bunchCrossing()
258  << std::endl;
259  continue;
260  }
261 
262  const SimClusterRefVector& simClusterRefVector = it_caloPart.simClusters();
263  Energy_layer_calib_.fill(0.);
265 
266  seedDet = 0;
267  seedEnergy = 0.;
268  for (const auto& it_sc : simClusterRefVector) {
269  const SimCluster& simCluster = (*(it_sc));
270  IfLogTrace(debug_ > 1, "HGCalHitCalibration")
271  << ">>> SC.energy(): " << simCluster.energy() << " SC.simEnergy(): " << simCluster.simEnergy() << std::endl;
272  const std::vector<std::pair<uint32_t, float> >& hits_and_fractions = simCluster.hits_and_fractions();
273 
274  // loop over hits
275  for (const auto& it_haf : hits_and_fractions) {
276  unsigned int hitlayer = recHitTools_.getLayerWithOffset(it_haf.first);
277  DetId hitid = (it_haf.first);
278  // dump raw RecHits and match
279  if (rawRecHits_) {
280  if ((hitid.det() == DetId::Forward &&
281  (hitid.subdetId() == HGCEE || hitid.subdetId() == HGCHEF || hitid.subdetId() == HGCHEB)) ||
282  (hitid.det() == DetId::HGCalEE) || (hitid.det() == DetId::HGCalHSi) || (hitid.det() == DetId::HGCalHSc) ||
283  (hitid.det() == DetId::Hcal && hitid.subdetId() == HcalEndcap))
284  fillWithRecHits(hitmap, hitid, hitlayer, it_haf.second, seedDet, seedEnergy);
285  }
286  } // end simHit
287  } // end simCluster
288 
289  auto sumCalibRecHitCalib_fraction =
290  std::accumulate(Energy_layer_calib_fraction_.begin(), Energy_layer_calib_fraction_.end(), 0.);
291  IfLogTrace(debug_ > 0, "HGCalHitCalibration")
292  << ">>> MC Energy: " << it_caloPart.energy() << " reco energy: " << sumCalibRecHitCalib_fraction << std::endl;
293  if (h_EoP_CPene_calib_fraction_.count(seedDet))
294  h_EoP_CPene_calib_fraction_[seedDet]->Fill(sumCalibRecHitCalib_fraction / it_caloPart.energy());
295 
296  // Loop on reconstructed SC.
297  const auto& clusters = *hgcalMultiClustersHandle;
298  float total_energy = 0.;
299  float max_dR2 = 0.0025;
300  auto closest =
301  std::min_element(clusters.begin(), clusters.end(), [&](const reco::PFCluster& a, const reco::PFCluster& b) {
302  auto dR2_a = reco::deltaR2(it_caloPart, a);
303  auto dR2_b = reco::deltaR2(it_caloPart, b);
304  auto ERatio_a = a.correctedEnergy() / it_caloPart.energy();
305  auto ERatio_b = b.correctedEnergy() / it_caloPart.energy();
306  // If both clusters are within 0.0025, mark as first (min) the
307  // element with the highest ratio against the SimCluster
308  if (dR2_a < max_dR2 && dR2_b < max_dR2)
309  return ERatio_a > ERatio_b;
310  return dR2_a < dR2_b;
311  });
312  if (closest != clusters.end() && reco::deltaR2(*closest, it_caloPart) < 0.01) {
313  total_energy = closest->correctedEnergy();
314  seedDet = recHitTools_.getSiThickness(closest->seed());
315  if (hgcal_EoP_CPene_calib_fraction_.count(seedDet)) {
316  hgcal_EoP_CPene_calib_fraction_[seedDet]->Fill(total_energy / it_caloPart.energy());
317  }
318  }
319 
320  auto closest_fcn = [&](auto const& a, auto const& b) {
321  auto dR2_a = reco::deltaR2(it_caloPart, a);
322  auto dR2_b = reco::deltaR2(it_caloPart, b);
323  auto ERatio_a = a.energy() / it_caloPart.energy();
324  auto ERatio_b = b.energy() / it_caloPart.energy();
325  // If both clusters are within 0.0025, mark as first (min) the
326  // element with the highest ratio against the SimCluster
327  if (dR2_a < max_dR2 && dR2_b < max_dR2)
328  return ERatio_a > ERatio_b;
329  return dR2_a < dR2_b;
330  };
331  // ELECTRONS in HGCAL
332  if (PFElectronHandle.isValid()) {
333  auto const& ele = (*PFElectronHandle);
334  auto closest = std::min_element(ele.begin(), ele.end(), closest_fcn);
335  if (closest != ele.end() &&
336  (closest->superCluster()->seed()->seed().det() == DetId::Forward ||
337  closest->superCluster()->seed()->seed().det() == DetId::HGCalEE) &&
338  reco::deltaR2(*closest, it_caloPart) < 0.01) {
339  seedDet = recHitTools_.getSiThickness(closest->superCluster()->seed()->seed());
340  if (hgcal_ele_EoP_CPene_calib_fraction_.count(seedDet)) {
341  hgcal_ele_EoP_CPene_calib_fraction_[seedDet]->Fill(closest->energy() / it_caloPart.energy());
342  }
343  }
344  }
345 
346  // PHOTONS in HGCAL
347  if (PFPhotonHandle.isValid()) {
348  auto const& photon = (*PFPhotonHandle);
349  auto closest = std::min_element(photon.begin(), photon.end(), closest_fcn);
350  if (closest != photon.end() &&
351  (closest->superCluster()->seed()->seed().det() == DetId::Forward ||
352  closest->superCluster()->seed()->seed().det() == DetId::HGCalEE) &&
353  reco::deltaR2(*closest, it_caloPart) < 0.01) {
354  seedDet = recHitTools_.getSiThickness(closest->superCluster()->seed()->seed());
355  if (hgcal_photon_EoP_CPene_calib_fraction_.count(seedDet)) {
356  hgcal_photon_EoP_CPene_calib_fraction_[seedDet]->Fill(closest->energy() / it_caloPart.energy());
357  }
358  }
359  }
360  } // end caloparticle
361 }
#define LogDebug(id)
edm::EDGetTokenT< std::vector< CaloParticle > > caloParticles_
edm::EDGetTokenT< std::vector< reco::Photon > > photons_
std::array< float, layers_ > Energy_layer_calib_fraction_
edm::EDGetTokenT< std::vector< reco::PFCluster > > hgcalMultiClusters_
std::map< int, MonitorElement * > hgcal_EoP_CPene_calib_fraction_
double correctedEnergy() const
Definition: CaloCluster.h:149
edm::EDGetTokenT< HGCRecHitCollection > recHitsFH_
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
Definition: PFCluster.h:46
edm::EDGetTokenT< HGCRecHitCollection > recHitsEE_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
std::map< int, MonitorElement * > hgcal_ele_EoP_CPene_calib_fraction_
#define IfLogTrace(cond, cat)
std::map< int, MonitorElement * > hgcal_photon_EoP_CPene_calib_fraction_
void getEventSetup(const edm::EventSetup &)
Definition: RecHitTools.cc:70
edm::EDGetTokenT< HGCRecHitCollection > recHitsBH_
Monte Carlo truth information used for tracking validation.
Definition: SimCluster.h:29
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
float energy() const
Energy. Note this is taken from the first SimTrack only.
Definition: SimCluster.h:104
bool isValid() const
Definition: HandleBase.h:70
double energy() const
cluster energy
Definition: PFCluster.h:78
hgcal::RecHitTools recHitTools_
float simEnergy() const
returns the accumulated sim energy in the cluster
Definition: SimCluster.h:196
std::float_t getSiThickness(const DetId &) const
Definition: RecHitTools.cc:179
Definition: DetId.h:17
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
unsigned int getLayerWithOffset(const DetId &) const
Definition: RecHitTools.cc:355
edm::EDGetTokenT< std::vector< reco::GsfElectron > > electrons_
std::map< int, MonitorElement * > h_EoP_CPene_calib_fraction_
double b
Definition: hdecay.h:118
HLT enums.
void fillWithRecHits(std::map< DetId, const HGCRecHit * > &, DetId, unsigned int, float, int &, float &)
size_type size() const
double a
Definition: hdecay.h:119
std::array< float, layers_ > Energy_layer_calib_
std::vector< std::pair< uint32_t, float > > hits_and_fractions() const
Returns list of rechit IDs and fractions for this SimCluster.
Definition: SimCluster.h:181
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
void HGCalHitCalibration::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  iRun,
edm::EventSetup const &   
)
overrideprivatevirtual

Implements DQMEDAnalyzer.

Definition at line 121 of file HGCalHitCalibration.cc.

References dqm::dqmstoreimpl::DQMStore::IBooker::book1D(), dqm::dqmstoreimpl::DQMStore::IBooker::cd(), depletion0_, depletion1_, depletion2_, h_EoP_CPene_calib_fraction_, hgcal_ele_EoP_CPene_calib_fraction_, hgcal_EoP_CPene_calib_fraction_, hgcal_photon_EoP_CPene_calib_fraction_, LayerOccupancy_, layers_, and dqm::dqmstoreimpl::DQMStore::IBooker::setCurrentFolder().

123  {
124  ibooker.cd();
125  ibooker.setCurrentFolder("HGCalHitCalibration");
126  h_EoP_CPene_calib_fraction_[depletion0_] = ibooker.book1D("h_EoP_CPene_100_calib_fraction", "", 1000, -0.5, 2.5);
127  h_EoP_CPene_calib_fraction_[depletion1_] = ibooker.book1D("h_EoP_CPene_200_calib_fraction", "", 1000, -0.5, 2.5);
128  h_EoP_CPene_calib_fraction_[depletion2_] = ibooker.book1D("h_EoP_CPene_300_calib_fraction", "", 1000, -0.5, 2.5);
130  ibooker.book1D("hgcal_EoP_CPene_100_calib_fraction", "", 1000, -0.5, 2.5);
132  ibooker.book1D("hgcal_EoP_CPene_200_calib_fraction", "", 1000, -0.5, 2.5);
134  ibooker.book1D("hgcal_EoP_CPene_300_calib_fraction", "", 1000, -0.5, 2.5);
136  ibooker.book1D("hgcal_ele_EoP_CPene_100_calib_fraction", "", 1000, -0.5, 2.5);
138  ibooker.book1D("hgcal_ele_EoP_CPene_200_calib_fraction", "", 1000, -0.5, 2.5);
140  ibooker.book1D("hgcal_ele_EoP_CPene_300_calib_fraction", "", 1000, -0.5, 2.5);
142  ibooker.book1D("hgcal_photon_EoP_CPene_100_calib_fraction", "", 1000, -0.5, 2.5);
144  ibooker.book1D("hgcal_photon_EoP_CPene_200_calib_fraction", "", 1000, -0.5, 2.5);
146  ibooker.book1D("hgcal_photon_EoP_CPene_300_calib_fraction", "", 1000, -0.5, 2.5);
147  LayerOccupancy_ = ibooker.book1D("LayerOccupancy", "", layers_, 0., (float)layers_);
148 }
std::map< int, MonitorElement * > hgcal_EoP_CPene_calib_fraction_
std::map< int, MonitorElement * > hgcal_ele_EoP_CPene_calib_fraction_
std::map< int, MonitorElement * > hgcal_photon_EoP_CPene_calib_fraction_
MonitorElement * LayerOccupancy_
std::map< int, MonitorElement * > h_EoP_CPene_calib_fraction_
void HGCalHitCalibration::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 365 of file HGCalHitCalibration.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), DEFINE_FWK_MODULE, HLT_2018_cff::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

365  {
367  desc.add<int>("debug", 0);
368  desc.add<bool>("rawRecHits", true);
369  desc.add<std::string>("detector", "all");
370  desc.add<int>("depletionFine", 100);
371  desc.add<edm::InputTag>("caloParticles", edm::InputTag("mix", "MergedCaloTruth"));
372  desc.add<edm::InputTag>("recHitsEE", edm::InputTag("HGCalRecHit", "HGCEERecHits"));
373  desc.add<edm::InputTag>("recHitsFH", edm::InputTag("HGCalRecHit", "HGCHEFRecHits"));
374  desc.add<edm::InputTag>("recHitsBH", edm::InputTag("HGCalRecHit", "HGCHEBRecHits"));
375  desc.add<edm::InputTag>("hgcalMultiClusters", edm::InputTag("particleFlowClusterHGCalFromMultiCl"));
376  desc.add<edm::InputTag>("electrons", edm::InputTag("ecalDrivenGsfElectronsFromMultiCl"));
377  desc.add<edm::InputTag>("photons", edm::InputTag("photonsFromMultiCl"));
378  descriptions.add("hgcalHitCalibrationDefault", desc);
379 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void HGCalHitCalibration::fillWithRecHits ( std::map< DetId, const HGCRecHit * > &  hitmap,
DetId  hitid,
unsigned int  hitlayer,
float  fraction,
int &  seedDet,
float &  seedEnergy 
)
private

Definition at line 150 of file HGCalHitCalibration.cc.

References debug_, TauDecayModes::dec, DetId::det(), HCALHighEnergyHPDFilter_cfi::energy, Energy_layer_calib_fraction_, dqm::impl::MonitorElement::Fill(), DetId::Forward, HLT_2018_cff::fraction, hgcal::RecHitTools::getLayerWithOffset(), hgcal::RecHitTools::getSiThickness(), DetId::HGCalEE, DetId::HGCalHSc, DetId::HGCalHSi, IfLogTrace, LayerOccupancy_, DetId::rawId(), recHitTools_, and DetId::subdetId().

Referenced by analyze().

155  {
156  if (hitmap.find(hitid) == hitmap.end()) {
157  // Hit was not reconstructed
158  IfLogTrace(debug_ > 0, "HGCalHitCalibration")
159  << ">>> Failed to find detid " << std::hex << hitid.rawId() << std::dec << " Det " << hitid.det() << " Subdet "
160  << hitid.subdetId() << std::endl;
161  return;
162  }
163  if ((hitid.det() != DetId::Forward) && (hitid.det() != DetId::HGCalEE) && (hitid.det() != DetId::HGCalHSi) &&
164  (hitid.det() != DetId::HGCalHSc)) {
165  IfLogTrace(debug_ > 0, "HGCalHitCalibration")
166  << ">>> Wrong type of detid " << std::hex << hitid.rawId() << std::dec << " Det " << hitid.det() << " Subdet "
167  << hitid.subdetId() << std::endl;
168  return;
169  }
170  unsigned int layer = recHitTools_.getLayerWithOffset(hitid);
171  assert(hitlayer == layer);
172  Energy_layer_calib_fraction_[layer] += hitmap[hitid]->energy() * fraction;
173  LayerOccupancy_->Fill(layer);
174  if (seedEnergy < hitmap[hitid]->energy()) {
175  seedEnergy = hitmap[hitid]->energy();
176  seedDet = recHitTools_.getSiThickness(hitid);
177  }
178 }
std::array< float, layers_ > Energy_layer_calib_fraction_
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
#define IfLogTrace(cond, cat)
void Fill(long long x)
MonitorElement * LayerOccupancy_
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
hgcal::RecHitTools recHitTools_
std::float_t getSiThickness(const DetId &) const
Definition: RecHitTools.cc:179
unsigned int getLayerWithOffset(const DetId &) const
Definition: RecHitTools.cc:355
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46

Member Data Documentation

int HGCalHitCalibration::algo_
private

Definition at line 64 of file HGCalHitCalibration.cc.

Referenced by analyze(), and HGCalHitCalibration().

edm::EDGetTokenT<std::vector<CaloParticle> > HGCalHitCalibration::caloParticles_
private

Definition at line 59 of file HGCalHitCalibration.cc.

Referenced by analyze(), and HGCalHitCalibration().

int HGCalHitCalibration::debug_
private

Definition at line 66 of file HGCalHitCalibration.cc.

Referenced by analyze(), and fillWithRecHits().

int HGCalHitCalibration::depletion0_
private

Definition at line 64 of file HGCalHitCalibration.cc.

Referenced by bookHistograms(), and HGCalHitCalibration().

int HGCalHitCalibration::depletion1_ = 200
staticprivate

Definition at line 68 of file HGCalHitCalibration.cc.

Referenced by bookHistograms().

int HGCalHitCalibration::depletion2_ = 300
staticprivate

Definition at line 69 of file HGCalHitCalibration.cc.

Referenced by bookHistograms().

edm::EDGetTokenT<std::vector<reco::GsfElectron> > HGCalHitCalibration::electrons_
private

Definition at line 61 of file HGCalHitCalibration.cc.

Referenced by analyze(), and HGCalHitCalibration().

std::array<float, layers_> HGCalHitCalibration::Energy_layer_calib_
private

Definition at line 78 of file HGCalHitCalibration.cc.

Referenced by analyze(), and HGCalHitCalibration().

std::array<float, layers_> HGCalHitCalibration::Energy_layer_calib_fraction_
private

Definition at line 79 of file HGCalHitCalibration.cc.

Referenced by analyze(), fillWithRecHits(), and HGCalHitCalibration().

std::map<int, MonitorElement*> HGCalHitCalibration::h_EoP_CPene_calib_fraction_
private

Definition at line 71 of file HGCalHitCalibration.cc.

Referenced by analyze(), and bookHistograms().

std::map<int, MonitorElement*> HGCalHitCalibration::hgcal_ele_EoP_CPene_calib_fraction_
private

Definition at line 73 of file HGCalHitCalibration.cc.

Referenced by analyze(), and bookHistograms().

std::map<int, MonitorElement*> HGCalHitCalibration::hgcal_EoP_CPene_calib_fraction_
private

Definition at line 72 of file HGCalHitCalibration.cc.

Referenced by analyze(), and bookHistograms().

std::map<int, MonitorElement*> HGCalHitCalibration::hgcal_photon_EoP_CPene_calib_fraction_
private

Definition at line 74 of file HGCalHitCalibration.cc.

Referenced by analyze(), and bookHistograms().

edm::EDGetTokenT<std::vector<reco::PFCluster> > HGCalHitCalibration::hgcalMultiClusters_
private

Definition at line 60 of file HGCalHitCalibration.cc.

Referenced by analyze(), and HGCalHitCalibration().

MonitorElement* HGCalHitCalibration::LayerOccupancy_
private

Definition at line 75 of file HGCalHitCalibration.cc.

Referenced by bookHistograms(), and fillWithRecHits().

int HGCalHitCalibration::layers_ = 60
staticprivate

Definition at line 77 of file HGCalHitCalibration.cc.

Referenced by bookHistograms().

edm::EDGetTokenT<std::vector<reco::Photon> > HGCalHitCalibration::photons_
private

Definition at line 62 of file HGCalHitCalibration.cc.

Referenced by analyze(), and HGCalHitCalibration().

bool HGCalHitCalibration::rawRecHits_
private

Definition at line 65 of file HGCalHitCalibration.cc.

Referenced by analyze().

edm::EDGetTokenT<HGCRecHitCollection> HGCalHitCalibration::recHitsBH_
private

Definition at line 58 of file HGCalHitCalibration.cc.

Referenced by analyze(), and HGCalHitCalibration().

edm::EDGetTokenT<HGCRecHitCollection> HGCalHitCalibration::recHitsEE_
private

Definition at line 56 of file HGCalHitCalibration.cc.

Referenced by analyze(), and HGCalHitCalibration().

edm::EDGetTokenT<HGCRecHitCollection> HGCalHitCalibration::recHitsFH_
private

Definition at line 57 of file HGCalHitCalibration.cc.

Referenced by analyze(), and HGCalHitCalibration().

hgcal::RecHitTools HGCalHitCalibration::recHitTools_
private

Definition at line 67 of file HGCalHitCalibration.cc.

Referenced by analyze(), and fillWithRecHits().