Skip to content

Commit

Permalink
Make use of HGCal validation code for HFNose validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunanda committed Aug 31, 2018
1 parent d1d92b0 commit fd38d28
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 22 deletions.
57 changes: 35 additions & 22 deletions Validation/HGCalValidation/plugins/HGCalDigiValidation.cc
Expand Up @@ -14,6 +14,10 @@

#include "DataFormats/DetId/interface/DetId.h"
#include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h"
#include "DataFormats/ForwardDetId/interface/HFNoseDetId.h"
#include "DataFormats/ForwardDetId/interface/HGCalDetId.h"
#include "DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h"
#include "DataFormats/ForwardDetId/interface/HGCSiliconDetId.h"
#include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
#include "DataFormats/HcalDetId/interface/HcalDetId.h"
#include "DataFormats/HGCDigi/interface/HGCDigiCollections.h"
Expand Down Expand Up @@ -53,11 +57,11 @@ class HGCalDigiValidation : public DQMEDAnalyzer {
public:
struct digiInfo{
digiInfo() {
x = y = z = 0.0;
layer = adc = charge = 0;
x = y = z = charge = 0.0;
layer = adc = 0;
}
double x, y, z;
int layer, charge, adc;
double x, y, z, charge;
int layer, adc;
};

explicit HGCalDigiValidation(const edm::ParameterSet&);
Expand All @@ -73,12 +77,13 @@ class HGCalDigiValidation : public DQMEDAnalyzer {
void fillDigiInfo();
void fillOccupancyMap(std::map<int, int>& OccupancyMap, int layer);
template<class T1, class T2>
void digiValidation(const T1& detId, const T2* geom, int, uint16_t, double);
void digiValidation(const T1& detId, const T2* geom, int layer,
uint16_t adc, double charge);

// ----------member data ---------------------------
std::string nameDetector_;
edm::EDGetToken digiSource_;
bool ifHCAL_;
bool ifNose_, ifHCAL_;
int verbosity_, SampleIndx_;
int layers_, firstLayer_;

Expand All @@ -96,13 +101,17 @@ class HGCalDigiValidation : public DQMEDAnalyzer {

HGCalDigiValidation::HGCalDigiValidation(const edm::ParameterSet& iConfig) :
nameDetector_(iConfig.getParameter<std::string>("DetectorName")),
ifNose_(iConfig.getParameter<bool>("ifNose")),
ifHCAL_(iConfig.getParameter<bool>("ifHCAL")),
verbosity_(iConfig.getUntrackedParameter<int>("Verbosity",0)),
SampleIndx_(iConfig.getUntrackedParameter<int>("SampleIndx",5)),
SampleIndx_(iConfig.getUntrackedParameter<int>("SampleIndx",0)),
firstLayer_(1) {

auto temp = iConfig.getParameter<edm::InputTag>("DigiSource");
if (nameDetector_ == "HGCalEESensitive" || nameDetector_ == "HGCalHESiliconSensitive" || nameDetector_ == "HGCalHEScintillatorSensitive") {
if ((nameDetector_ == "HGCalEESensitive") ||
(nameDetector_ == "HGCalHESiliconSensitive") ||
(nameDetector_ == "HGCalHEScintillatorSensitive") ||
(nameDetector_ == "HFNoseSensitive")) {
digiSource_ = consumes<HGCalDigiCollection>(temp);
} else if (nameDetector_ == "HCal") {
if (ifHCAL_) digiSource_ = consumes<QIE11DigiCollection>(temp);
Expand All @@ -111,14 +120,16 @@ HGCalDigiValidation::HGCalDigiValidation(const edm::ParameterSet& iConfig) :
throw cms::Exception("BadHGCDigiSource")
<< "HGCal DetectorName given as " << nameDetector_ << " must be: "
<< "\"HGCalEESensitive\", \"HGCalHESiliconSensitive\", "
<< "\"HGCalHEScintillatorSensitive\", or \"HCal\"!";
<< "\"HGCalHEScintillatorSensitive\", \"HFNoseSensitive\", "
<< "or \"HCal\"!";
}
}

void HGCalDigiValidation::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.add<std::string>("DetectorName","HGCalEESensitive");
desc.add<edm::InputTag>("DigiSource",edm::InputTag("hgcalDigis","EE"));
desc.add<bool>("ifNose",false);
desc.add<bool>("ifHCAL",false);
desc.addUntracked<int>("Verbosity",0);
desc.addUntracked<int>("SampleIndx",0);
Expand All @@ -137,20 +148,23 @@ void HGCalDigiValidation::analyze(const edm::Event& iEvent,
edm::ESHandle<CaloGeometry> geom;
iSetup.get<CaloGeometryRecord>().get(geom);
if (!geom.isValid())
edm::LogVerbatim("HGCalValidation") << "HGCalDigiValidation: Cannot get valid "
<< "HGCalGeometry Object for " << nameDetector_;
edm::LogVerbatim("HGCalValidation") << "HGCalDigiValidation: Cannot get "
<< "valid Geometry Object for "
<< nameDetector_;
geom1 = geom.product();
} else {
edm::ESHandle<HGCalGeometry> geom;
iSetup.get<IdealGeometryRecord>().get(nameDetector_, geom);
if (!geom.isValid())
edm::LogVerbatim("HGCalValidation") << "HGCalDigiValidation: Cannot get valid "
<< "HGCalGeometry Object for " << nameDetector_;
edm::LogVerbatim("HGCalValidation") << "HGCalDigiValidation: Cannot get "
<< "valid Geometry Object for "
<< nameDetector_;
geom0 = geom.product();
HGCalGeometryMode::GeometryMode mode = geom0->topology().geomMode();
if ((mode == HGCalGeometryMode::Hexagon8) ||
(mode == HGCalGeometryMode::Hexagon8Full)) geomType = 1;
else if (mode == HGCalGeometryMode::Trapezoid) geomType = 2;
if (nameDetector_ == "HFNoseSensitive") geomType = 3;
}

unsigned int ntot(0), nused(0);
Expand All @@ -163,12 +177,13 @@ void HGCalDigiValidation::analyze(const edm::Event& iEvent,
edm::LogVerbatim("HGCalValidation") << nameDetector_ << " with "
<< theHGCEEDigiContainers->size()
<< " element(s)";

for (const auto & it: *(theHGCEEDigiContainers.product())) {
ntot++; nused++;
DetId detId = it.id();
int layer = ((geomType == 0) ? HGCalDetId(detId).layer() :
HGCSiliconDetId(detId).layer());
(geomType == 1) ?
HGCSiliconDetId(detId).layer() :
HFNoseDetId(detId).layer());
const HGCSample& hgcSample = it.sample(SampleIndx_);
uint16_t gain = hgcSample.toa();
uint16_t adc = hgcSample.data();
Expand All @@ -178,7 +193,7 @@ void HGCalDigiValidation::analyze(const edm::Event& iEvent,
fillDigiInfo();
} else {
edm::LogVerbatim("HGCalValidation") << "DigiCollection handle does not "
<< "exist for HGCEE!!!";
<< "exist for " << nameDetector_;
}
} else if ((nameDetector_ == "HGCalHESiliconSensitive") ||
(nameDetector_ == "HGCalHEScintillatorSensitive")) {
Expand All @@ -190,7 +205,6 @@ void HGCalDigiValidation::analyze(const edm::Event& iEvent,
edm::LogVerbatim("HGCalValidation") << nameDetector_ << " with "
<< theHGCHEDigiContainers->size()
<< " element(s)";

for (const auto & it: *(theHGCHEDigiContainers.product())) {
ntot++; nused++;
DetId detId = it.id();
Expand All @@ -206,7 +220,7 @@ void HGCalDigiValidation::analyze(const edm::Event& iEvent,
fillDigiInfo();
} else {
edm::LogVerbatim("HGCalValidation") << "DigiCollection handle does not "
<< "exist for HGCFH!!!";
<< "exist for " << nameDetector_;
}
} else if ((nameDetector_ == "HCal") && (!ifHCAL_)) {
//HGCalBH
Expand All @@ -217,7 +231,6 @@ void HGCalDigiValidation::analyze(const edm::Event& iEvent,
edm::LogVerbatim("HGCalValidation") << nameDetector_ << " with "
<< theHGCBHDigiContainers->size()
<< " element(s)";

for (const auto & it: *(theHGCBHDigiContainers.product())) {
ntot++; nused++;
HcalDetId detId = it.id();
Expand All @@ -231,7 +244,7 @@ void HGCalDigiValidation::analyze(const edm::Event& iEvent,
fillDigiInfo();
} else {
edm::LogWarning("HGCalValidation") << "DigiCollection handle does not "
<< "exist for HGCBH!!!";
<< "exist for " << nameDetector_;
}
} else if (nameDetector_ == "HCal") {
//HE
Expand Down Expand Up @@ -267,7 +280,7 @@ void HGCalDigiValidation::analyze(const edm::Event& iEvent,
fillDigiInfo();
} else {
edm::LogWarning("HGCalValidation") << "DigiCollection handle does not "
<< "exist for HGCBH!!!";
<< "exist for " << nameDetector_;
}
} else {
edm::LogWarning("HGCalValidation") << "invalid detector name !! "
Expand Down Expand Up @@ -298,7 +311,7 @@ void HGCalDigiValidation::digiValidation(const T1& detId, const T2* geom,
hinfo.y = global1.y();
hinfo.z = global1.z();
hinfo.adc = adc;
hinfo.charge = charge; //charges[0];
hinfo.charge = charge;
hinfo.layer = layer-firstLayer_;

if (verbosity_>1)
Expand Down
8 changes: 8 additions & 0 deletions Validation/HGCalValidation/python/HFNoseDigiValidation_cfi.py
@@ -0,0 +1,8 @@
import FWCore.ParameterSet.Config as cms

from Validation.HGCalValidation.hgcalDigiValidationEE_cfi import *

hfnoseDigiValidation = hgcalDigiValidationEE.clone(
DetectorName = cms.string("HFNoseSensitive"),
DigiSource = cms.InputTag("hgcalDigis","HFNoseDigis"))

6 changes: 6 additions & 0 deletions Validation/HGCalValidation/python/HFNoseSimHitClient_cfi.py
@@ -0,0 +1,6 @@
import FWCore.ParameterSet.Config as cms

from Validation.HGCalValidation.HGCalSimHitsClient_cfi import *

hfnoseSimHitClient = hgcalSimHitClientEE.clone(
DetectorName = cms.string("HFNoseSensitive"))
@@ -0,0 +1,7 @@
import FWCore.ParameterSet.Config as cms

from Validation.HGCalValidation.hgcalSimHitValidationEE_cfi import *

hfnoseSimHitValidationHEF = hgcalSimHitValidationEE.clone(
DetectorName = cms.string("HFNoseSensitive"),
CaloHitSource = cms.string("HFNoseHits"))
2 changes: 2 additions & 0 deletions Validation/HGCalValidation/test/BuildFile.xml
@@ -1,3 +1,4 @@
<use name="CalibFormats/HcalObjects"/>
<use name="CondFormats/GeometryObjects"/>
<use name="DataFormats/ForwardDetId"/>
<use name="DataFormats/HcalDetId"/>
Expand All @@ -7,6 +8,7 @@
<use name="FWCore/MessageLogger"/>
<use name="FWCore/PluginManager"/>
<use name="Geometry/HcalCommonData"/>
<use name="Geometry/HcalTowerAlgo"/>
<use name="Geometry/HGCalCommonData"/>
<use name="Geometry/HGCalGeometry"/>
<use name="Geometry/Records"/>
Expand Down

0 comments on commit fd38d28

Please sign in to comment.