From a08d73d85603b778d3b47fd30521fc9ea8a2a854 Mon Sep 17 00:00:00 2001 From: Menglei Date: Fri, 26 Aug 2016 20:44:10 +0200 Subject: [PATCH 1/4] Add class RecHitCommonMode --- Reco/BuildFile.xml | 7 +- Reco/interface/RecHitCommonMode.h | 62 +++++ Reco/plugins/BuildFile.xml | 1 + .../RecHitPlotter_HighGain_CM_Correction.cc | 248 ++++++++++++++++++ Reco/python/hgcaltbrechitplotter_cfi.py | 4 + Reco/src/RecHitCommonMode.cc | 140 ++++++++++ test_cfg_2.py | 49 ++++ 7 files changed, 509 insertions(+), 2 deletions(-) create mode 100644 Reco/interface/RecHitCommonMode.h create mode 100644 Reco/plugins/RecHitPlotter_HighGain_CM_Correction.cc create mode 100644 Reco/src/RecHitCommonMode.cc create mode 100644 test_cfg_2.py diff --git a/Reco/BuildFile.xml b/Reco/BuildFile.xml index d787444..b417da8 100644 --- a/Reco/BuildFile.xml +++ b/Reco/BuildFile.xml @@ -1,5 +1,8 @@ + + + + + - - diff --git a/Reco/interface/RecHitCommonMode.h b/Reco/interface/RecHitCommonMode.h new file mode 100644 index 0000000..5efe4c1 --- /dev/null +++ b/Reco/interface/RecHitCommonMode.h @@ -0,0 +1,62 @@ +#ifndef HGCAL_RECO_RECHITCOMMONMODE_H +#define HGCAL_RECO_RECHITCOMMONMODE_H +// user include files +#include +#include +#include + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "HGCal/DataFormats/interface/HGCalTBRecHitCollections.h" +#include "HGCal/DataFormats/interface/HGCalTBDetId.h" +#include "HGCal/DataFormats/interface/HGCalTBRecHit.h" +#include "HGCal/Geometry/interface/HGCalTBCellVertices.h" +#include "HGCal/Geometry/interface/HGCalTBTopology.h" +#include "HGCal/CondObjects/interface/HGCalElectronicsMap.h" +#include "HGCal/DataFormats/interface/HGCalTBElectronicsId.h" +#include "HGCal/Geometry/interface/HGCalTBGeometryParameters.h" + +using namespace std; +// +// class declaration +// + +enum CellType{ + FullCell = 0, + CalibPad = 1, + HalfCell = 2, + MBandMerged = 3, + OuterCalib = 4 +}; + + +class RecHitCommonMode +{ + +public: + RecHitCommonMode(edm::Handle Rechits); + ~RecHitCommonMode(); + + void evaluate(); + float getCommonModeNoise(int layer, CellType type, int iu, int iv); + float getCommonModeNoise(int layer, CellType type, std::string const& = ""); + +private: + + edm::Handle Rechits_; + HGCalTBTopology IsCellValid; + HGCalTBCellVertices TheCell; + std::string mapfile_ = "HGCal/CondObjects/data/map_FNAL_16Layers.txt"; + struct { + HGCalElectronicsMap emap_; + } essource_; + int sensorsize = 128;// The geometry for a 256 cell sensor hasnt been implemted yet. Need a picture to do this. + std::pair CellCentreXY; + + TH1F* Full_Cell[MAXLAYERS]; + char name[50], title[50]; + float FullCell_CMNoise[MAXLAYERS], HalfCell_CMNoise[MAXLAYERS], CalibPad_CMNoise[MAXLAYERS], MB_CMNoise[MAXLAYERS], MergedCell_CMNoise[MAXLAYERS]; +}; + +#endif diff --git a/Reco/plugins/BuildFile.xml b/Reco/plugins/BuildFile.xml index 71c0e21..57943a2 100644 --- a/Reco/plugins/BuildFile.xml +++ b/Reco/plugins/BuildFile.xml @@ -9,5 +9,6 @@ + diff --git a/Reco/plugins/RecHitPlotter_HighGain_CM_Correction.cc b/Reco/plugins/RecHitPlotter_HighGain_CM_Correction.cc new file mode 100644 index 0000000..f78d912 --- /dev/null +++ b/Reco/plugins/RecHitPlotter_HighGain_CM_Correction.cc @@ -0,0 +1,248 @@ +// -*- C++ -*- +// +// Package: HGCal/RecHitPlotter_HighGain_CM_Correction +// Class: RecHitPlotter_HighGain_CM_Correction +// +/**\class RecHitPlotter_HighGain_CM_Correction RecHitPlotter_HighGain_CM_Correction.cc HGCal/RecHitPlotter_HighGain_CM_Correction/plugins/RecHitPlotter_HighGain_CM_Correction.cc + + Description: [one line class summary] + + Implementation: + [Notes on implementation] +*/ +// +// Original Author: Rajdeep Mohan Chatterjee +// Created: Mon, 15 Feb 2016 09:47:43 GMT +// +// + + +// system include files +#include +#include +#include "TH2Poly.h" +#include "TProfile.h" +#include "TH1F.h" +#include "TH2F.h" +// user include files +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "HGCal/DataFormats/interface/HGCalTBRecHitCollections.h" +#include "HGCal/DataFormats/interface/HGCalTBDetId.h" +#include "HGCal/DataFormats/interface/HGCalTBRecHit.h" +#include "HGCal/Geometry/interface/HGCalTBCellVertices.h" +#include "HGCal/Geometry/interface/HGCalTBTopology.h" +#include "CommonTools/UtilAlgos/interface/TFileService.h" +#include "HGCal/CondObjects/interface/HGCalElectronicsMap.h" +#include "HGCal/CondObjects/interface/HGCalCondObjectTextIO.h" +#include "HGCal/DataFormats/interface/HGCalTBElectronicsId.h" +#include "HGCal/Geometry/interface/HGCalTBGeometryParameters.h" +#include "HGCal/Reco/interface/RecHitCommonMode.h" + +using namespace std; +// +// class declaration +// + +// If the analyzer does not use TFileService, please remove +// the template argument to the base class so the class inherits +// from edm::one::EDAnalyzer<> and also remove the line from +// constructor "usesResource("TFileService");" +// This will improve performance in multithreaded jobs. + +static const double delta = 0.00001;//Add/subtract delta = 0.00001 to x,y of a cell centre so the TH2Poly::Fill doesnt have a problem at the edges where the centre of a half-hex cell passes through the sennsor boundary line. + +class RecHitPlotter_HighGain_CM_Correction : public edm::one::EDAnalyzer +{ + +public: + explicit RecHitPlotter_HighGain_CM_Correction(const edm::ParameterSet&); + ~RecHitPlotter_HighGain_CM_Correction(); + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + virtual void beginJob() override; + void analyze(const edm::Event& , const edm::EventSetup&) override; + virtual void endJob() override; + + // ----------member data --------------------------- + bool doCommonMode_CM_; + edm::EDGetToken HGCalTBRecHitCollection_; + HGCalTBTopology IsCellValid; + HGCalTBCellVertices TheCell; + std::string mapfile_ = "HGCal/CondObjects/data/map_FNAL_SB2_Layer16.txt"; + struct { + HGCalElectronicsMap emap_; + } essource_; + int sensorsize = 128;// The geometry for a 256 cell sensor hasnt been implemted yet. Need a picture to do this. + std::vector> CellXY; + std::pair CellCentreXY; + + TH2Poly *h_RecHit_layer[128]; + TH1F* Full_Cell[MAXLAYERS]; + TH1F* Half_Cell[MAXLAYERS]; + TH1F* MB_Cell[MAXLAYERS]; + TH1F* Calib_Pads[MAXLAYERS]; + TH1F* Merged_Cell[MAXLAYERS]; + TH1F *h_digi_layer_channel[MAXSKIROCS][64][MAXLAYERS]; + + TH1F* AllCells_Ped; + TH1F* AllCells_CM; + TH2F* Noise_2D_Profile; + char name[50], title[50]; +}; + +// +// constants, enums and typedefs +// + +// +// static data member definitions +// + +// +// constructors and destructor +// +RecHitPlotter_HighGain_CM_Correction::RecHitPlotter_HighGain_CM_Correction(const edm::ParameterSet& iConfig) +{ + //now do what ever initialization is needed + usesResource("TFileService"); + doCommonMode_CM_ = iConfig.getParameter("doCommonMode"); + edm::Service fs; + HGCalTBRecHitCollection_ = consumes(iConfig.getParameter("HGCALTBRECHITS")); + + +//Booking 2 "hexagonal" histograms to display the sum of Rechits and the Occupancy(Hit > 5 GeV) in 1 sensor in 1 layer. To include all layers soon. Also the 1D Rechits per cell in a sensor is booked here. + AllCells_Ped = fs->make("AllCells_Ped","AllCells_Ped",500,-250,250); + AllCells_CM = fs->make("AllCells_CM","AllCells_CM",500,-250,250); + sprintf(name, "Noise_2D_Profile_Layer"); + sprintf(title, "Noise 2D Profile Layer"); + Noise_2D_Profile = fs->make(name,title,2048,0,2048,8000,-4000,4000); + for(int ILayer=0;ILayermake(name, title, 1000,-500., 500.); + sprintf(name, "Half_Cell_Layer_%i",ILayer); + sprintf(title, "Half Cell Layer %i",ILayer); + Half_Cell[ILayer] = fs->make(name, title, 1000,-500., 500.); + sprintf(name, "MB_Cell_Layer_%i",ILayer); + sprintf(title, "MB Cell Layer %i",ILayer); + MB_Cell[ILayer] = fs->make(name, title, 1000,-500., 500.); + sprintf(name, "Calib_Pads_Layer_%i",ILayer); + sprintf(title, "Calib Pads Layer %i",ILayer); + Calib_Pads[ILayer] = fs->make(name, title, 1000,-500., 500.); + sprintf(name, "Merged_Cell_Layer_%i",ILayer); + sprintf(title, "Merged Cell Layer %i",ILayer); + Merged_Cell[ILayer] = fs->make(name, title, 1000,-500., 500.); + for(int ISkiroc = 1;ISkiroc<=MAXSKIROCS;ISkiroc++){ + for(int Channel=0; Channel<64;Channel++){ + sprintf(name, "Ski_%i_Channel_%i_Layer_%i",ISkiroc,Channel,ILayer); + sprintf(title, "Ski %i Channel %i Layer %i",ISkiroc,Channel,ILayer); + h_digi_layer_channel[ISkiroc-1][Channel][ILayer] = fs->make(name, title, 1000,-500., 500.); +/* + sprintf(name, "Ski_%i_Channel_%i_CM",ISkiroc,Channel); + sprintf(title, "Ski %i Channel %i CM",ISkiroc,Channel); + h_digi_layer_channel_CM[ISkiroc-1][Channel] = fs->make(name, title, 1000,-500., 500.,1000,-500., 500.); +*/ + } + } + } + +}//contructor ends here + + +RecHitPlotter_HighGain_CM_Correction::~RecHitPlotter_HighGain_CM_Correction() +{ + + // do anything here that needs to be done at desctruction time + // (e.g. close files, deallocate resources etc.) + +} + + +// +// member functions +// + +// ------------ method called for each event ------------ +void +RecHitPlotter_HighGain_CM_Correction::analyze(const edm::Event& event, const edm::EventSetup& setup) +{ + + using namespace edm; + + edm::Handle Rechits; + event.getByToken(HGCalTBRecHitCollection_, Rechits); + edm::Handle Rechits1; + event.getByToken(HGCalTBRecHitCollection_, Rechits1); + + RecHitCommonMode CM(Rechits); + CM.evaluate(); + + for(int iii = 0; iii < MAXLAYERS; iii++){ + if(CM.getCommonModeNoise(iii, CellType::FullCell) != 0) Full_Cell[iii]->Fill(CM.getCommonModeNoise(iii, CellType::FullCell)); + if(CM.getCommonModeNoise(iii, CellType::HalfCell) != 0) Half_Cell[iii]->Fill(CM.getCommonModeNoise(iii, CellType::HalfCell)); + if(CM.getCommonModeNoise(iii, CellType::MBandMerged, "MB") != 0) MB_Cell[iii]->Fill(CM.getCommonModeNoise(iii, CellType::MBandMerged, "MB")); + if(CM.getCommonModeNoise(iii, CellType::MBandMerged, "MergedCell") != 0) Merged_Cell[iii]->Fill(CM.getCommonModeNoise(iii, CellType::MBandMerged, "MergedCell")); + if(CM.getCommonModeNoise(iii, CellType::CalibPad) != 0) Calib_Pads[iii]->Fill(CM.getCommonModeNoise(iii, CellType::CalibPad)); + } + + for(auto RecHit : *Rechits) { + if(!IsCellValid.iu_iv_valid((RecHit.id()).layer(), (RecHit.id()).sensorIU(), (RecHit.id()).sensorIV(), (RecHit.id()).iu(), (RecHit.id()).iv(), sensorsize)) continue; + CellCentreXY = TheCell.GetCellCentreCoordinatesForPlots((RecHit.id()).layer(), (RecHit.id()).sensorIU(), (RecHit.id()).sensorIV(), (RecHit.id()).iu(), (RecHit.id()).iv(), sensorsize); + + uint32_t EID = essource_.emap_.detId2eid(RecHit.id()); + HGCalTBElectronicsId eid(EID); + if(!doCommonMode_CM_){ + h_digi_layer_channel[eid.iskiroc()-1][eid.ichan()][(RecHit.id()).layer() -1]->Fill(RecHit.energyHigh()); + Noise_2D_Profile->Fill((64*(eid.iskiroc()-1) + eid.ichan()),RecHit.energyHigh()); + } + else if(doCommonMode_CM_){ + AllCells_Ped->Fill(RecHit.energyHigh()); + CellType type = (CellType)((RecHit.id()).cellType()); + h_digi_layer_channel[eid.iskiroc()-1][eid.ichan()][(RecHit.id()).layer() -1]->Fill(RecHit.energyHigh() - CM.getCommonModeNoise((RecHit.id()).layer() - 1, type, (RecHit.id()).iu(), (RecHit.id()).iv())); + } + + Noise_2D_Profile->Fill((64*(eid.iskiroc()-1) + eid.ichan()),RecHit.energyHigh() - CM.getCommonModeNoise((RecHit.id()).layer() -1, CellType::FullCell)); + + } + + +}//analyze method ends here + + +// ------------ method called once each job just before starting event loop ------------ +void +RecHitPlotter_HighGain_CM_Correction::beginJob() +{ +HGCalCondObjectTextIO io(0); + edm::FileInPath fip(mapfile_); + if (!io.load(fip.fullPath(), essource_.emap_)) { + throw cms::Exception("Unable to load electronics map"); + } +} + +// ------------ method called once each job just after ending the event loop ------------ +void +RecHitPlotter_HighGain_CM_Correction::endJob() +{ + +} + +// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ +void +RecHitPlotter_HighGain_CM_Correction::fillDescriptions(edm::ConfigurationDescriptions& descriptions) +{ + //The following says we do not know what parameters are allowed so do no validation + // Please change this to state exactly what you do use, even if it is no parameters + edm::ParameterSetDescription desc; + desc.setUnknown(); + descriptions.addDefault(desc); +} + +//define this as a plug-in +DEFINE_FWK_MODULE(RecHitPlotter_HighGain_CM_Correction); diff --git a/Reco/python/hgcaltbrechitplotter_cfi.py b/Reco/python/hgcaltbrechitplotter_cfi.py index e591694..75de476 100644 --- a/Reco/python/hgcaltbrechitplotter_cfi.py +++ b/Reco/python/hgcaltbrechitplotter_cfi.py @@ -27,6 +27,10 @@ hgcaltbrechitsplotter_highgain_correlation_cm = cms.EDAnalyzer("RecHitPlotter_HighGain_Correlation_CM", HGCALTBRECHITS = cms.InputTag("hgcaltbrechits","","unpack" ) ) +hgcaltbrechitsplotter_highgain_cm_correction = cms.EDAnalyzer("RecHitPlotter_HighGain_CM_Correction", + HGCALTBRECHITS = cms.InputTag("hgcaltbrechits","","unpack" ), + doCommonMode = cms.bool(True) + ) FourLayerRecHitPlotterMax = cms.EDAnalyzer("FourLayerRecHitPlotterMax", HGCALTBRECHITS = cms.InputTag("hgcaltbrechits","","unpack" ) diff --git a/Reco/src/RecHitCommonMode.cc b/Reco/src/RecHitCommonMode.cc new file mode 100644 index 0000000..c62490b --- /dev/null +++ b/Reco/src/RecHitCommonMode.cc @@ -0,0 +1,140 @@ +#include "HGCal/Reco/interface/RecHitCommonMode.h" +using namespace std; +// +// class declaration +// + +RecHitCommonMode::RecHitCommonMode(edm::Handle Rechits) +{ + using namespace edm; + Rechits_ = Rechits; + + for(int iLayer(0);iLayerbegin(); rechit != Rechits_->end(); rechit++) { + CellCentreXY = TheCell.GetCellCentreCoordinatesForPlots((rechit->id()).layer(), (rechit->id()).sensorIU(), (rechit->id()).sensorIV(), (rechit->id()).iu(), (rechit->id()).iv(), sensorsize); + HGCalTBRecHit hit = (*rechit); + if(hit.energyHigh() > 100)continue; + CellType type = (CellType)((rechit->id()).cellType()); + if(type == FullCell){ + Full_Cell[(rechit->id()).layer() - 1]->Fill(hit.energyHigh()); + } + else if(type == HalfCell){ + Cell_counter_Half[(rechit->id()).layer() - 1]+= 1; + Average_Pedestal_Per_Event_Half[(rechit->id()).layer() - 1] += hit.energyHigh(); + } + else if(type == CalibPad){ + Cell_counter_Calib_Pad[(rechit->id()).layer() - 1]++; + Average_Pedestal_Per_Event_Calib_Pad[(rechit->id()).layer() - 1] += hit.energyHigh(); + } + else if(type == MBandMerged && ( ((rechit->id()).iu() == 4 && (rechit->id()).iv() == 3) || ((rechit->id()).iu() == -7 && (rechit->id()).iv() == 4) || ((rechit->id()).iu() == 7 && (rechit->id()).iv() == -3) || ((rechit->id()).iu() == -4 && (rechit->id()).iv() == -3) ) ){ + Cell_counter_MB[(rechit->id()).layer() - 1]+=1; + Average_Pedestal_Per_Event_MB[(rechit->id()).layer() - 1] += hit.energyHigh(); + } + else if(type == MBandMerged && ( ((rechit->id()).iu() == -4 && (rechit->id()).iv() == 6) || ((rechit->id()).iu() == -2 && (rechit->id()).iv() == 6) || ((rechit->id()).iu() == 4 && (rechit->id()).iv() == -7) || ((rechit->id()).iu() == 2 && (rechit->id()).iv() == -6) ) ){ + Cell_counter_Merged_Cell[(rechit->id()).layer() - 1]+=1; + Average_Pedestal_Per_Event_Merged_Cell[(rechit->id()).layer() - 1] += hit.energyHigh(); + } + } + + for(int iLayer(0);iLayerGetEntries() > 0){ + Full_Cell[iLayer]->Fit("gaus", "Q"); + FullCell_CMNoise[iLayer] = Full_Cell[iLayer]->GetFunction("gaus")->GetParameter(1); + } else { + FullCell_CMNoise[iLayer] = 0; + } + + if(Cell_counter_Calib_Pad[iLayer] > 0)CalibPad_CMNoise[iLayer] = Average_Pedestal_Per_Event_Calib_Pad[iLayer]/Cell_counter_Calib_Pad[iLayer]; + if(Cell_counter_Half[iLayer] > 0)HalfCell_CMNoise[iLayer] = Average_Pedestal_Per_Event_Half[iLayer]/Cell_counter_Half[iLayer]; + if(Cell_counter_MB[iLayer] > 0)MB_CMNoise[iLayer] = Average_Pedestal_Per_Event_MB[iLayer]/Cell_counter_MB[iLayer]; + if(Cell_counter_Merged_Cell[iLayer] > 0)MergedCell_CMNoise[iLayer] = Average_Pedestal_Per_Event_Merged_Cell[iLayer]/Cell_counter_Merged_Cell[iLayer]; + } +} + +float +RecHitCommonMode::getCommonModeNoise(int layer, CellType type, int iu, int iv) +{ + + float CMNoise(0); + switch(type){ + case FullCell: CMNoise = FullCell_CMNoise[layer]; break; + case CalibPad: CMNoise = CalibPad_CMNoise[layer]; break; + case HalfCell: CMNoise = HalfCell_CMNoise[layer]; break; + case MBandMerged: if( (iu == 4 && iv == 3) || ( iu == -7 && iv == 4) || ( iu == 7 && iv == -3) || ( iu == -4 && iv == -3) )CMNoise = MB_CMNoise[layer]; + else if ( (iu == -4 && iv == 6) || ( iu == -2 && iv == 6) || ( iu == 4 && iv == -7) || ( iu == 2 && iv == -6) )CMNoise = MergedCell_CMNoise[layer]; + + break; + case OuterCalib: CMNoise = FullCell_CMNoise[layer]; break; + default: CMNoise = 0; break; + }; + + return CMNoise; +} + + +float +RecHitCommonMode::getCommonModeNoise(int layer, CellType type, std::string const& subtype/*=""*/) +{ + if( (subtype != "") && (subtype != "MB") && (subtype != "MergedCell")){ + throw cms::Exception("InvalidCellType") << "Invalid cell subtype: " << subtype; + } + + float CMNoise(0); + switch(type){ + case FullCell: CMNoise = FullCell_CMNoise[layer]; break; + case CalibPad: CMNoise = CalibPad_CMNoise[layer]; break; + case HalfCell: CMNoise = HalfCell_CMNoise[layer]; break; + case MBandMerged: if(subtype == "MB")CMNoise = MB_CMNoise[layer]; + else if(subtype == "MergedCell")CMNoise = MergedCell_CMNoise[layer]; + break; + case OuterCalib: CMNoise = FullCell_CMNoise[layer]; break; + default: CMNoise = 0; break; + }; + + return CMNoise; +} + + + + + + + + + diff --git a/test_cfg_2.py b/test_cfg_2.py new file mode 100644 index 0000000..e0e4ff7 --- /dev/null +++ b/test_cfg_2.py @@ -0,0 +1,49 @@ +import FWCore.ParameterSet.Config as cms + +process = cms.Process("unpack") +process.load('HGCal.RawToDigi.hgcaltbdigis_cfi') +process.load('HGCal.RawToDigi.hgcaltbdigisplotter_cfi') +process.load('HGCal.Reco.hgcaltbrechitproducer_cfi') +process.load('HGCal.Reco.hgcaltbrechitplotter_cfi') + +process.source = cms.Source("HGCalTBTextSource", + run=cms.untracked.int32(1), ### maybe this should be read from the file +# fileNames=cms.untracked.vstring("file:Raw_data_New.txt") ### here a vector is provided, but in the .cc only the first one is used TO BE FIXED + fileNames=cms.untracked.vstring("file:/afs/cern.ch/user/r/rchatter/public/data/HGC_Output_563.txt") ### here a vector is provided, but in the .cc only the first one is used TO BE FIXED +) + +process.dumpRaw = cms.EDAnalyzer("DumpFEDRawDataProduct", + dumpPayload=cms.untracked.bool(True)) + +process.dumpDigi = cms.EDAnalyzer("HGCalDigiDump") + +process.output = cms.OutputModule("PoolOutputModule", + compressionAlgorithm = cms.untracked.string('LZMA'), + compressionLevel = cms.untracked.int32(4), + dataset = cms.untracked.PSet( + dataTier = cms.untracked.string('USER'), + filterName = cms.untracked.string('') + ), + #dropMetaData = cms.untracked.string('ALL'), + eventAutoFlushCompressedSize = cms.untracked.int32(15728640), + fastCloning = cms.untracked.bool(False), + fileName = cms.untracked.string('test_output.root'), #options.output), +# outputCommands = process.MICROAODSIMEventContent.outputCommands, +# overrideInputFileSplitLevels = cms.untracked.bool(True), +# SelectEvents = SelectEventsPSet + ) + +#process.TFileService = cms.Service("TFileService", fileName = cms.string("HGC_Output_563_Reco_Display.root") ) +#process.TFileService = cms.Service("TFileService", fileName = cms.string("HGC_Output_563_Digi.root") ) +process.TFileService = cms.Service("TFileService", fileName = cms.string("HGC_Output_563_Reco.root") ) +#process.TFileService = cms.Service("TFileService", fileName = cms.string("HGC_Output_563_Reco_Layer.root") ) +#process.TFileService = cms.Service("TFileService", fileName = cms.string("HGC_Output_563_Reco_Cluster.root") ) + + +#process.p =cms.Path(process.hgcaltbdigis*process.hgcaltbrechits*process.hgcaltbrechitsplotter_highgain_new) +#process.p =cms.Path(process.hgcaltbdigis*process.hgcaltbdigisplotter) +#process.p =cms.Path(process.hgcaltbdigis*process.hgcaltbrechits*process.hgcaltbrechitsplotter_highgain_correlation_cm) +process.p =cms.Path(process.hgcaltbdigis*process.hgcaltbrechits*process.hgcaltbrechitsplotter_highgain_cm_correction) +#process.p =cms.Path(process.hgcaltbdigis*process.hgcaltbrechits*process.FourLayerRecHitPlotterMax) +#process.p =cms.Path(process.hgcaltbdigis*process.hgcaltbrechits*process.LayerSumAnalyzer) +process.end = cms.EndPath(process.output) From faa07d9a00acf830e493037c1fa3bbaa05a63d81 Mon Sep 17 00:00:00 2001 From: Menglei Date: Fri, 26 Aug 2016 21:42:30 +0200 Subject: [PATCH 2/4] Add class RecHitCommonMode --- .../RecHitPlotter_HighGain_CM_Correction.cc | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/Reco/plugins/RecHitPlotter_HighGain_CM_Correction.cc b/Reco/plugins/RecHitPlotter_HighGain_CM_Correction.cc index f78d912..473930e 100644 --- a/Reco/plugins/RecHitPlotter_HighGain_CM_Correction.cc +++ b/Reco/plugins/RecHitPlotter_HighGain_CM_Correction.cc @@ -1,20 +1,7 @@ -// -*- C++ -*- -// -// Package: HGCal/RecHitPlotter_HighGain_CM_Correction -// Class: RecHitPlotter_HighGain_CM_Correction -// -/**\class RecHitPlotter_HighGain_CM_Correction RecHitPlotter_HighGain_CM_Correction.cc HGCal/RecHitPlotter_HighGain_CM_Correction/plugins/RecHitPlotter_HighGain_CM_Correction.cc - - Description: [one line class summary] - - Implementation: - [Notes on implementation] -*/ -// -// Original Author: Rajdeep Mohan Chatterjee -// Created: Mon, 15 Feb 2016 09:47:43 GMT -// +/* Modify RecHitPlotter_HighGain_Correlation_CM.cc to use the RecHitCommonMode class */ // +// Author: Menglei Sun +// Created: Fri, August 26 2016 // system include files From a7727bcb068961dcbf632f82c8ef03638e8277f9 Mon Sep 17 00:00:00 2001 From: Menglei Date: Tue, 6 Sep 2016 15:52:37 +0200 Subject: [PATCH 3/4] change the input of getCommonModeNoise to DetId --- Reco/interface/RecHitCommonMode.h | 2 +- Reco/plugins/RecHitPlotter_HighGain_CM_Correction.cc | 3 +-- Reco/src/RecHitCommonMode.cc | 7 +++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Reco/interface/RecHitCommonMode.h b/Reco/interface/RecHitCommonMode.h index 5efe4c1..a4a1685 100644 --- a/Reco/interface/RecHitCommonMode.h +++ b/Reco/interface/RecHitCommonMode.h @@ -39,7 +39,7 @@ class RecHitCommonMode ~RecHitCommonMode(); void evaluate(); - float getCommonModeNoise(int layer, CellType type, int iu, int iv); + float getCommonModeNoise(HGCalTBDetId id); float getCommonModeNoise(int layer, CellType type, std::string const& = ""); private: diff --git a/Reco/plugins/RecHitPlotter_HighGain_CM_Correction.cc b/Reco/plugins/RecHitPlotter_HighGain_CM_Correction.cc index 473930e..4a32a72 100644 --- a/Reco/plugins/RecHitPlotter_HighGain_CM_Correction.cc +++ b/Reco/plugins/RecHitPlotter_HighGain_CM_Correction.cc @@ -190,8 +190,7 @@ RecHitPlotter_HighGain_CM_Correction::analyze(const edm::Event& event, const edm } else if(doCommonMode_CM_){ AllCells_Ped->Fill(RecHit.energyHigh()); - CellType type = (CellType)((RecHit.id()).cellType()); - h_digi_layer_channel[eid.iskiroc()-1][eid.ichan()][(RecHit.id()).layer() -1]->Fill(RecHit.energyHigh() - CM.getCommonModeNoise((RecHit.id()).layer() - 1, type, (RecHit.id()).iu(), (RecHit.id()).iv())); + h_digi_layer_channel[eid.iskiroc()-1][eid.ichan()][(RecHit.id()).layer() -1]->Fill(RecHit.energyHigh() - CM.getCommonModeNoise(RecHit.id())); } Noise_2D_Profile->Fill((64*(eid.iskiroc()-1) + eid.ichan()),RecHit.energyHigh() - CM.getCommonModeNoise((RecHit.id()).layer() -1, CellType::FullCell)); diff --git a/Reco/src/RecHitCommonMode.cc b/Reco/src/RecHitCommonMode.cc index c62490b..a3d14be 100644 --- a/Reco/src/RecHitCommonMode.cc +++ b/Reco/src/RecHitCommonMode.cc @@ -88,9 +88,12 @@ RecHitCommonMode::evaluate() } float -RecHitCommonMode::getCommonModeNoise(int layer, CellType type, int iu, int iv) +RecHitCommonMode::getCommonModeNoise(HGCalTBDetId id) { - + int layer = id.layer() - 1; + CellType type = (CellType)(id.cellType()); + int iu = id.iu(); + int iv = id.iv(); float CMNoise(0); switch(type){ case FullCell: CMNoise = FullCell_CMNoise[layer]; break; From 411af56aff3ae8ed082ae1cb5585d5ee4d29dc75 Mon Sep 17 00:00:00 2001 From: Menglei Date: Tue, 6 Sep 2016 21:46:33 +0200 Subject: [PATCH 4/4] change the input of getCommonModeNoise to DetId --- Reco/plugins/RecHitPlotter_HighGain_CM_Correction.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Reco/plugins/RecHitPlotter_HighGain_CM_Correction.cc b/Reco/plugins/RecHitPlotter_HighGain_CM_Correction.cc index 4a32a72..e24d605 100644 --- a/Reco/plugins/RecHitPlotter_HighGain_CM_Correction.cc +++ b/Reco/plugins/RecHitPlotter_HighGain_CM_Correction.cc @@ -192,7 +192,7 @@ RecHitPlotter_HighGain_CM_Correction::analyze(const edm::Event& event, const edm AllCells_Ped->Fill(RecHit.energyHigh()); h_digi_layer_channel[eid.iskiroc()-1][eid.ichan()][(RecHit.id()).layer() -1]->Fill(RecHit.energyHigh() - CM.getCommonModeNoise(RecHit.id())); } - + Noise_2D_Profile->Fill((64*(eid.iskiroc()-1) + eid.ichan()),RecHit.energyHigh() - CM.getCommonModeNoise((RecHit.id()).layer() -1, CellType::FullCell)); }