Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:08:02

0001 #include "DQM/Physics/src/CentralitypADQM.h"
0002 
0003 #include <memory>
0004 
0005 // DQM
0006 #include "DQMServices/Core/interface/DQMStore.h"
0007 #include "DQMServices/Core/interface/DQMEDAnalyzer.h"
0008 
0009 // Framework
0010 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0011 #include "FWCore/Framework/interface/Event.h"
0012 #include "FWCore/Framework/interface/EventSetup.h"
0013 #include "FWCore/Framework/interface/LuminosityBlock.h"
0014 #include "FWCore/ServiceRegistry/interface/Service.h"
0015 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0016 
0017 // Centrality
0018 #include "DataFormats/VertexReco/interface/Vertex.h"
0019 
0020 using namespace edm;
0021 using namespace reco;
0022 using namespace hi;
0023 
0024 //
0025 // -- Constructor
0026 //
0027 CentralitypADQM::CentralitypADQM(const edm::ParameterSet& ps) {
0028   edm::LogInfo("CentralitypADQM") << " Starting CentralitypADQM "
0029                                   << "\n";
0030 
0031   centralityTag_ = ps.getParameter<InputTag>("centralitycollection");
0032   centralityToken = consumes<reco::Centrality>(centralityTag_);
0033 
0034   vertexTag_ = ps.getParameter<InputTag>("vertexcollection");
0035   vertexToken = consumes<std::vector<reco::Vertex> >(vertexTag_);
0036   // just to initialize
0037 }
0038 
0039 //
0040 // -- Destructor
0041 //
0042 CentralitypADQM::~CentralitypADQM() {
0043   edm::LogInfo("CentralitypADQM") << " Deleting CentralitypADQM "
0044                                   << "\n";
0045 }
0046 
0047 //
0048 //  -- Book histograms
0049 //
0050 void CentralitypADQM::bookHistograms(DQMStore::IBooker& bei, edm::Run const&, edm::EventSetup const&) {
0051   // void CentralitypADQM::bookHistograms(DQMStore* bei){
0052 
0053   bei.setCurrentFolder("Physics/CentralitypA/");
0054 
0055   h_hiNpix = bei.book1D("h_hiNpix", "h_hiNpix", 750, 0, 75000);
0056   //  h_hiNpixelTracks = bei.book1D("h_hiNpixelTracks", "hiNpixelTracks", 500, 0, 5000);
0057   h_hiNtracks = bei.book1D("h_hiNtracks", "h_hiNtracks", 500, 0, 5000);
0058   h_hiNtracksPtCut = bei.book1D("h_hiNtracksPtCut", "h_hiNtracksPtCut", 500, 0, 5000);
0059   h_hiNtracksEtaCut = bei.book1D("h_hiNtracksEtaCut", "h_hiNtracksEtaCut", 500, 0, 5000);
0060   h_hiNtracksEtaPtCut = bei.book1D("h_hiNtracksEtaPtCut", "h_hiNtracksEtaPtCut", 500, 0, 5000);
0061 
0062   h_hiHF = bei.book1D("h_hiHF", "h_hiHF", 900, 0, 9000);
0063   h_hiHFplus = bei.book1D("h_hiHFplus", "h_hiHFplus", 900, 0, 9000);
0064   h_hiHFminus = bei.book1D("h_hiHFminus", "h_hiHFminus", 900, 0, 9000);
0065   h_hiHFplusEta4 = bei.book1D("h_hiHFplusEta4", "h_hiHFplusEta4", 900, 0, 9000);
0066   h_hiHFminusEta4 = bei.book1D("h_hiHFminusEta4", "h_hiHFminusEta4", 900, 0, 9000);
0067 
0068   h_hiHFhit = bei.book1D("h_hiHFhit", "h_hiHFhit", 3000, 0, 300000);
0069   h_hiHFhitPlus = bei.book1D("h_hiHFhitPlus", "h_hiHFhitPlus", 2000, 0, 200000);
0070   h_hiHFhitMinus = bei.book1D("h_hiHFhitMinus", "h_hiHFhitMinus", 2000, 0, 200000);
0071 
0072   h_hiEB = bei.book1D("h_hiEB", "h_hiEB", 600, 0, 6000);
0073   h_hiET = bei.book1D("h_hiET", "h_hiET", 600, 0, 6000);
0074   h_hiEE = bei.book1D("h_hiEE", "h_hiEE", 600, 0, 6000);
0075   h_hiEEplus = bei.book1D("h_hiEEplus", "h_hiEEplus", 600, 0, 6000);
0076   h_hiEEminus = bei.book1D("h_hiEEminus", "h_hiEEminus", 600, 0, 6000);
0077   h_hiZDC = bei.book1D("h_hiZDC", "h_hiZDC", 600, 0, 6000);
0078   h_hiZDCplus = bei.book1D("h_hiZDCplus", "h_hiZDCplus", 600, 0, 6000);
0079   h_hiZDCminus = bei.book1D("h_hiZDCminus", "h_hiZDCminus", 600, 0, 6000);
0080   h_hiPF = bei.book1D("h_hiPF", "h_hiPF", 900, 0, 9000);
0081   h_hiPFplus = bei.book1D("h_hiPFplus", "h_hiPFplus", 900, 0, 9000);
0082   h_hiPFminus = bei.book1D("h_hiPFminus", "h_hiPFminus", 900, 0, 9000);
0083 
0084   h_vertex_x = bei.book1D("h_vertex_x", "h_vertex_x", 400, -4, 4);
0085   h_vertex_y = bei.book1D("h_vertex_y", "h_vertex_y", 400, -4, 4);
0086   h_vertex_z = bei.book1D("h_vertex_z", "h_vertex_z", 400, -40, 40);
0087 }
0088 
0089 //  -- Analyze
0090 
0091 void CentralitypADQM::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0092   using namespace edm;
0093   edm::Handle<reco::Centrality> cent;
0094   iEvent.getByToken(centralityToken, cent);  //_centralitytag comes from the cfg
0095 
0096   if (cent.isValid()) {
0097     h_hiNpix->Fill(cent->multiplicityPixel());
0098     h_hiNtracks->Fill(cent->Ntracks());
0099 
0100     h_hiNtracksPtCut->Fill(cent->NtracksPtCut());
0101     h_hiNtracksEtaCut->Fill(cent->NtracksEtaCut());
0102     h_hiNtracksEtaPtCut->Fill(cent->NtracksEtaPtCut());
0103 
0104     h_hiHF->Fill(cent->EtHFtowerSum());
0105     h_hiHFplus->Fill(cent->EtHFtowerSumPlus());
0106     h_hiHFminus->Fill(cent->EtHFtowerSumMinus());
0107     h_hiHFplusEta4->Fill(cent->EtHFtruncatedPlus());
0108     h_hiHFminusEta4->Fill(cent->EtHFtruncatedMinus());
0109 
0110     h_hiHFhit->Fill(cent->EtHFhitSum());
0111     h_hiHFhitPlus->Fill(cent->EtHFhitSumPlus());
0112     h_hiHFhitMinus->Fill(cent->EtHFhitSumMinus());
0113 
0114     h_hiZDC->Fill(cent->zdcSum());
0115     h_hiZDCplus->Fill(cent->zdcSumPlus());
0116     h_hiZDCminus->Fill(cent->zdcSumMinus());
0117 
0118     h_hiEEplus->Fill(cent->EtEESumPlus());
0119     h_hiEEminus->Fill(cent->EtEESumMinus());
0120     h_hiEE->Fill(cent->EtEESum());
0121     h_hiEB->Fill(cent->EtEBSum());
0122     h_hiET->Fill(cent->EtMidRapiditySum());
0123 
0124     h_hiPF->Fill(cent->EtPFhfSum());
0125     h_hiPFplus->Fill(cent->EtPFhfSumPlus());
0126     h_hiPFminus->Fill(cent->EtPFhfSumMinus());
0127 
0128     edm::Handle<std::vector<reco::Vertex> > vertex;
0129     iEvent.getByToken(vertexToken, vertex);
0130     h_vertex_x->Fill(vertex->begin()->x());
0131     h_vertex_y->Fill(vertex->begin()->y());
0132     h_vertex_z->Fill(vertex->begin()->z());
0133   }
0134 }