Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
#include "DQM/Physics/src/CentralityDQM.h"

#include <memory>

// DQM
#include "DQMServices/Core/interface/DQMStore.h"
#include "DQMServices/Core/interface/DQMEDAnalyzer.h"

// Framework
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/LuminosityBlock.h"
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"

// Centrality
#include "DataFormats/VertexReco/interface/Vertex.h"

using namespace edm;
using namespace reco;
using namespace hi;

//
// -- Constructor
//
CentralityDQM::CentralityDQM(const edm::ParameterSet& ps) {
  edm::LogInfo("CentralityDQM") << " Starting CentralityDQM "
                                << "\n";

  centralityTag_ = ps.getParameter<InputTag>("centralitycollection");
  centralityToken = consumes<reco::Centrality>(centralityTag_);

  centralityBinTag_ = (ps.getParameter<edm::InputTag>("centralitybincollection"));
  centralityBinToken = consumes<int>(centralityBinTag_);

  vertexTag_ = ps.getParameter<InputTag>("vertexcollection");
  vertexToken = consumes<std::vector<reco::Vertex> >(vertexTag_);

  eventplaneTag_ = ps.getParameter<InputTag>("eventplanecollection");
  eventplaneToken = consumes<reco::EvtPlaneCollection>(eventplaneTag_);

  // just to initialize
}

//
// -- Destructor
//
CentralityDQM::~CentralityDQM() {
  edm::LogInfo("CentralityDQM") << " Deleting CentralityDQM "
                                << "\n";
}

//
//  -- Book histograms
//
void CentralityDQM::bookHistograms(DQMStore::IBooker& bei, edm::Run const&, edm::EventSetup const&) {
  // void CentralityDQM::bookHistograms(DQMStore* bei){

  bei.setCurrentFolder("Physics/Centrality/");

  h_hiNpix = bei.book1D("h_hiNpix", "h_hiNpix", 750, 0, 75000);
  h_hiNpixelTracks = bei.book1D("h_hiNpixelTracks", "hiNpixelTracks", 500, 0, 5000);
  h_hiNtracks = bei.book1D("h_hiNtracks", "h_hiNtracks", 500, 0, 5000);
  h_hiNtracksPtCut = bei.book1D("h_hiNtracksPtCut", "h_hiNtracksPtCut", 500, 0, 5000);
  h_hiNtracksEtaCut = bei.book1D("h_hiNtracksEtaCut", "h_hiNtracksEtaCut", 500, 0, 5000);
  h_hiNtracksEtaPtCut = bei.book1D("h_hiNtracksEtaPtCut", "h_hiNtracksEtaPtCut", 500, 0, 5000);

  h_hiHF = bei.book1D("h_hiHF", "h_hiHF", 900, 0, 9000);
  h_hiHFplus = bei.book1D("h_hiHFplus", "h_hiHFplus", 900, 0, 9000);
  h_hiHFminus = bei.book1D("h_hiHFminus", "h_hiHFminus", 900, 0, 9000);
  h_hiHFplusEta4 = bei.book1D("h_hiHFplusEta4", "h_hiHFplusEta4", 900, 0, 9000);
  h_hiHFminusEta4 = bei.book1D("h_hiHFminusEta4", "h_hiHFminusEta4", 900, 0, 9000);

  h_hiHFhit = bei.book1D("h_hiHFhit", "h_hiHFhit", 3000, 0, 300000);
  h_hiHFhitPlus = bei.book1D("h_hiHFhitPlus", "h_hiHFhitPlus", 2000, 0, 200000);
  h_hiHFhitMinus = bei.book1D("h_hiHFhitMinus", "h_hiHFhitMinus", 2000, 0, 200000);

  h_hiEB = bei.book1D("h_hiEB", "h_hiEB", 600, 0, 6000);
  h_hiET = bei.book1D("h_hiET", "h_hiET", 600, 0, 6000);
  h_hiEE = bei.book1D("h_hiEE", "h_hiEE", 600, 0, 6000);
  h_hiEEplus = bei.book1D("h_hiEEplus", "h_hiEEplus", 600, 0, 6000);
  h_hiEEminus = bei.book1D("h_hiEEminus", "h_hiEEminus", 600, 0, 6000);
  h_hiZDC = bei.book1D("h_hiZDC", "h_hiZDC", 600, 0, 6000);
  h_hiZDCplus = bei.book1D("h_hiZDCplus", "h_hiZDCplus", 600, 0, 6000);
  h_hiZDCminus = bei.book1D("h_hiZDCminus", "h_hiZDCminus", 600, 0, 6000);
  h_hiPF = bei.book1D("h_hiPF", "h_hiPF", 900, 0, 9000);
  h_hiPFplus = bei.book1D("h_hiPFplus", "h_hiPFplus", 900, 0, 9000);
  h_hiPFminus = bei.book1D("h_hiPFminus", "h_hiPFminus", 900, 0, 9000);

  h_vertex_x = bei.book1D("h_vertex_x", "h_vertex_x", 400, -4, 4);
  h_vertex_y = bei.book1D("h_vertex_y", "h_vertex_y", 400, -4, 4);
  h_vertex_z = bei.book1D("h_vertex_z", "h_vertex_z", 400, -40, 40);

  h_cent_bin = bei.book1D("h_cent_bin", "h_cent_bin", 200, 0, 200);

  Double_t psirange = 4;
  bei.setCurrentFolder("Physics/Centrality/EventPlane/");
  h_ep_HFm2 = bei.book1D("h_ep_HFm2", "h_ep_HFm2", 800, -psirange, psirange);
  h_ep_HFp2 = bei.book1D("h_ep_HFp2", "h_ep_HFp2", 800, -psirange, psirange);
  h_ep_trackmid2 = bei.book1D("h_ep_trackmid2", "h_ep_trackmid2", 800, -psirange, psirange);
  h_ep_trackm2 = bei.book1D("h_ep_trackm2", "h_ep_trackm2", 800, -psirange, psirange);
  h_ep_trackp2 = bei.book1D("h_ep_trackp2", "h_ep_trackp2", 800, -psirange, psirange);
  h_ep_HFm3 = bei.book1D("h_ep_HFm3", "h_ep_HFm3", 800, -psirange, psirange);
  h_ep_HFp3 = bei.book1D("h_ep_HFp3", "h_ep_HFp3", 800, -psirange, psirange);
  h_ep_trackmid3 = bei.book1D("h_ep_trackmid3", "h_ep_trackmid3", 800, -psirange, psirange);
}

//
//  -- Analyze
//
void CentralityDQM::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
  using namespace edm;
  edm::Handle<reco::Centrality> cent;
  iEvent.getByToken(centralityToken, cent);  //_centralitytag comes from the cfg

  edm::Handle<int> cbin;
  iEvent.getByToken(centralityBinToken, cbin);

  // as an inputTag and is
  //"hiCentrality"
  edm::Handle<reco::EvtPlaneCollection> ep;
  iEvent.getByToken(eventplaneToken, ep);

  if (cent.isValid()) {
    int hibin = -999;
    if (cbin.isValid())
      hibin = *cbin;

    //  std::cout<<  " ------------------------------------- "  << hibin << std::endl;

    h_cent_bin->Fill(hibin);
    h_hiNpix->Fill(cent->multiplicityPixel());
    h_hiNpixelTracks->Fill(cent->NpixelTracks());
    h_hiNtracks->Fill(cent->Ntracks());  //

    h_hiNtracksPtCut->Fill(cent->NtracksPtCut());
    h_hiNtracksEtaCut->Fill(cent->NtracksEtaCut());
    h_hiNtracksEtaPtCut->Fill(cent->NtracksEtaPtCut());

    h_hiHF->Fill(cent->EtHFtowerSum());
    h_hiHFplus->Fill(cent->EtHFtowerSumPlus());
    h_hiHFminus->Fill(cent->EtHFtowerSumMinus());
    h_hiHFplusEta4->Fill(cent->EtHFtruncatedPlus());
    h_hiHFminusEta4->Fill(cent->EtHFtruncatedMinus());

    h_hiHFhit->Fill(cent->EtHFhitSum());
    h_hiHFhitPlus->Fill(cent->EtHFhitSumPlus());
    h_hiHFhitMinus->Fill(cent->EtHFhitSumMinus());

    h_hiZDC->Fill(cent->zdcSum());
    h_hiZDCplus->Fill(cent->zdcSumPlus());
    h_hiZDCminus->Fill(cent->zdcSumMinus());

    h_hiEEplus->Fill(cent->EtEESumPlus());
    h_hiEEminus->Fill(cent->EtEESumMinus());
    h_hiEE->Fill(cent->EtEESum());
    h_hiEB->Fill(cent->EtEBSum());
    h_hiET->Fill(cent->EtMidRapiditySum());

    h_hiPF->Fill(cent->EtPFhfSum());
    h_hiPFplus->Fill(cent->EtPFhfSumPlus());
    h_hiPFminus->Fill(cent->EtPFhfSumMinus());

    edm::Handle<std::vector<reco::Vertex> > vertex;
    iEvent.getByToken(vertexToken, vertex);
    h_vertex_x->Fill(vertex->begin()->x());
    h_vertex_y->Fill(vertex->begin()->y());
    h_vertex_z->Fill(vertex->begin()->z());
  }

  if (ep.isValid()) {
    EvtPlaneCollection::const_iterator rp = ep->begin();

    h_ep_HFm2->Fill(rp[HFm2].angle(0));
    h_ep_HFp2->Fill(rp[HFp2].angle(0));
    h_ep_trackmid2->Fill(rp[trackmid2].angle(0));
    h_ep_trackm2->Fill(rp[trackm2].angle(0));
    h_ep_trackp2->Fill(rp[trackp2].angle(0));

    h_ep_HFm3->Fill(rp[HFm3].angle(0));
    h_ep_HFp3->Fill(rp[HFp3].angle(0));
    h_ep_trackmid3->Fill(rp[trackmid3].angle(0));
  }
}