77 rawRecHits_(iConfig.getParameter<bool>(
"rawRecHits")),
78 cutOnPt_(iConfig.getParameter<bool>(
"cutOnPt")),
79 cutValue_(iConfig.getParameter<double>(
"cutValue")) {
86 if (detector==
"all") {
88 }
else if (detector==
"EM") {
90 }
else if (detector==
"HAD") {
96 std::string particle[6] = {
"All",
"Electron",
"Muon",
"Photon",
"ChgHad",
"NeutHad"};
98 for (
int k=0;
k<6; ++
k) {
99 sprintf(name,
"h_EoP_CPene_100_calib_fraction_%s",particle[
k].c_str());
101 sprintf(name,
"h_EoP_CPene_200_calib_fraction_%s",particle[
k].c_str());
103 sprintf(name,
"h_EoP_CPene_300_calib_fraction_%s",particle[
k].c_str());
105 sprintf(name,
"h_LayerOccupancy_%s",particle[
k].c_str());
109 for (
int k=0;
k<3; ++
k) {
110 sprintf(name,
"h_missHit_%s",dets[
k].c_str());
133 const std::vector<CaloParticle>&
caloParticles = *caloParticleHandle;
134 const int pdgId[3] = {11, 13, 22};
137 int mhit[3] = {0,0,0};
138 for (
auto it_caloPart = caloParticles.begin();
139 it_caloPart != caloParticles.end(); ++it_caloPart) {
140 double cut = (
cutOnPt_) ? it_caloPart->pt() : it_caloPart->energy();
143 if (
std::abs(it_caloPart->pdgId()) == pdgId[0]) type = 1;
144 else if (
std::abs(it_caloPart->pdgId()) == pdgId[1]) type = 2;
145 else if (it_caloPart->pdgId() == pdgId[2]) type = 3;
146 else if (it_caloPart->threeCharge() != 0) type = 4;
154 float seedEnergy = 0.;
155 int simClusterCount = 0;
157 for (
const auto & simCluster : simClusterRefVector) {
160 std::cout <<
">>> simCluster.energy() = " << simCluster->energy() << std::endl;
162 const std::vector<std::pair<uint32_t,float> > hits_and_fractions = simCluster->hits_and_fractions();
165 for (
auto it_haf = hits_and_fractions.begin();
166 it_haf != hits_and_fractions.end(); ++it_haf) {
168 DetId hitid = (it_haf->first);
173 (
algo_ == 1 || algo_ == 2)) {
176 for (
auto it_hit = rechitsEE.
begin();
177 it_hit < rechitsEE.
end(); ++it_hit) {
180 if (detid == hitid) {
182 if (hitlayer != layer) {
184 std::cout <<
" recHit ID problem EE " << std::endl;
191 if(seedEnergy < it_hit->energy()){
192 seedEnergy = it_hit->energy();
198 if (!found) ++mhit[0];
201 (algo_ == 1 || algo_ == 3)) {
204 for (
auto it_hit = rechitsFH.
begin();
205 it_hit < rechitsFH.
end(); ++it_hit) {
208 if (detid == hitid) {
210 if (hitlayer != layer) {
212 std::cout <<
" recHit ID problem FH " << std::endl;
219 if(seedEnergy < it_hit->energy()){
220 seedEnergy = it_hit->energy();
226 if (!found) ++mhit[1];
229 (algo_ == 1 || algo_ == 3)) {
232 for (
auto it_hit = rechitsBH.
begin();
233 it_hit < rechitsBH.
end(); ++it_hit) {
236 if (detid == hitid) {
238 if (hitlayer != layer) {
240 std::cout <<
" recHit ID problem BH " << std::endl;
247 if (seedEnergy < it_hit->energy()){
248 seedEnergy = it_hit->energy();
254 if (!found) ++mhit[2];
261 float sumCalibRecHitCalib_fraction = 0;
266 double ebyp = sumCalibRecHitCalib_fraction / it_caloPart->energy();
270 }
else if (seedDet == 200) {
273 }
else if (seedDet == 300){
290 desc.
add<
bool>(
"rawRecHits",
true);
291 desc.
add<
bool>(
"cutOnPt",
true);
292 desc.
add<
double>(
"cutValue",10.0);
293 descriptions.
add(
"hgcalHitCalibration",desc);
static const std::string kSharedResource
T getParameter(std::string const &) const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< HGCRecHitCollection > _recHitsBH
HGCalHitCalibration(const edm::ParameterSet &)
edm::EDGetTokenT< std::vector< CaloParticle > > _caloParticles
edm::EDGetTokenT< HGCRecHitCollection > _recHitsFH
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
Abs< T >::type abs(const T &t)
TH1F * h_LayerOccupancy_[6]
ParameterDescriptionBase * add(U const &iLabel, T const &value)
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
virtual void beginJob() override
TH1F * h_EoP_CPene_300_calib_fraction_[6]
const_iterator end() const
virtual void endJob() override
edm::EDGetTokenT< HGCRecHitCollection > _recHitsEE
std::vector< float > Energy_layer_calib_fraction
void add(std::string const &label, ParameterSetDescription const &psetDescription)
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
hgcal::RecHitTools recHitTools
TH1F * h_EoP_CPene_200_calib_fraction_[6]
std::vector< float > Energy_layer_calib
Detector det() const
get the detector field from this detid
TH1F * h_EoP_CPene_100_calib_fraction_[6]
const_iterator begin() const