Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-06-06 04:26:26

0001 // -*- C++ -*-
0002 //
0003 // Package:    Alignment/OfflineValidation
0004 // Class:      TkAlV0sAnalyzer
0005 //
0006 /*
0007  *\class TkAlV0sAnalyzer TkAlV0sAnalyzer.cc Alignment/TkAlV0sAnalyzer/plugins/TkAlV0sAnalyzer.cc
0008 
0009  Description: [one line class summary]
0010 
0011  Implementation:
0012      [Notes on implementation]
0013 */
0014 //
0015 // Original Author:  Marco Musich
0016 //         Created:  Thu, 14 Dec 2023 15:10:34 GMT
0017 //
0018 //
0019 
0020 // system include files
0021 #include <memory>
0022 
0023 // user include files
0024 #include "FWCore/Framework/interface/Frameworkfwd.h"
0025 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0026 
0027 #include "FWCore/Framework/interface/Event.h"
0028 #include "FWCore/Framework/interface/MakerMacros.h"
0029 
0030 #include "CommonTools/UtilAlgos/interface/TFileService.h"
0031 #include "DataFormats/Candidate/interface/Candidate.h"
0032 #include "DataFormats/Candidate/interface/VertexCompositeCandidate.h"
0033 #include "DataFormats/OnlineMetaData/interface/OnlineLuminosityRecord.h"
0034 #include "DataFormats/RecoCandidate/interface/RecoChargedCandidate.h"
0035 #include "DataFormats/Scalers/interface/LumiScalers.h"
0036 #include "DataFormats/TrackReco/interface/Track.h"
0037 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0038 #include "DataFormats/V0Candidate/interface/V0Candidate.h"
0039 #include "DataFormats/VertexReco/interface/Vertex.h"
0040 #include "DataFormats/VertexReco/interface/VertexFwd.h"
0041 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0042 #include "FWCore/ServiceRegistry/interface/Service.h"
0043 #include "FWCore/Utilities/interface/InputTag.h"
0044 #include "RecoVertex/VertexTools/interface/VertexDistance3D.h"
0045 
0046 #include "TH1F.h"
0047 #include "TH2F.h"
0048 #include "TProfile.h"
0049 #include "TLorentzVector.h"
0050 
0051 //
0052 // class declaration
0053 //
0054 
0055 using reco::TrackCollection;
0056 
0057 struct MEbinning {
0058   int nbins;
0059   double xmin;
0060   double xmax;
0061 };
0062 
0063 class TkAlV0sAnalyzer : public edm::one::EDAnalyzer<edm::one::SharedResources> {
0064 public:
0065   explicit TkAlV0sAnalyzer(const edm::ParameterSet&);
0066   ~TkAlV0sAnalyzer() override = default;
0067 
0068   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0069 
0070 private:
0071   template <typename T, typename... Args>
0072   T* book(const Args&... args) const;
0073   void beginJob() override;
0074   void analyze(const edm::Event&, const edm::EventSetup&) override;
0075 
0076   TH1F* bookHisto1D(std::string name, std::string title, std::string xaxis, std::string yaxis, MEbinning binning);
0077 
0078   TH2F* bookHisto2D(std::string name,
0079                     std::string title,
0080                     std::string xaxis,
0081                     std::string yaxis,
0082                     MEbinning xbinning,
0083                     MEbinning ybinning);
0084 
0085   TProfile* bookProfile(std::string name,
0086                         std::string title,
0087                         std::string xaxis,
0088                         std::string yaxis,
0089                         MEbinning xbinning,
0090                         MEbinning ybinning);
0091 
0092   void getHistoPSet(edm::ParameterSet pset, MEbinning& mebinning);
0093 
0094   void fillMonitoringHistos(const edm::Event& iEvent);
0095 
0096   // ----------member data ---------------------------
0097   const edm::EDGetTokenT<TrackCollection> tracksToken_;  //used to select what tracks to read from configuration file
0098   const edm::EDGetTokenT<reco::VertexCompositeCandidateCollection> vccToken_;
0099 
0100   const edm::EDGetTokenT<reco::BeamSpot> bsToken_;
0101   const edm::EDGetTokenT<reco::VertexCollection> pvToken_;
0102   const edm::EDGetTokenT<LumiScalersCollection> lumiscalersToken_;
0103   const edm::EDGetTokenT<OnlineLuminosityRecord> metaDataToken_;
0104   const bool forceSCAL_;
0105   const int pvNDOF_;
0106 
0107   // histograms
0108   edm::Service<TFileService> fs_;
0109 
0110   TH1F* h_diTrackMass;
0111   TH1F* h_V0Mass;
0112 
0113   TH1F* v0_N_;
0114   TH1F* v0_mass_;
0115   TH1F* v0_pt_;
0116   TH1F* v0_eta_;
0117   TH1F* v0_phi_;
0118   TH1F* v0_Lxy_;
0119   TH1F* v0_Lxy_wrtBS_;
0120   TH1F* v0_chi2oNDF_;
0121   TH1F* v0_deltaMass_;
0122 
0123   TProfile* v0_mass_vs_p_;
0124   TProfile* v0_mass_vs_pt_;
0125   TProfile* v0_mass_vs_eta_;
0126 
0127   TProfile* v0_deltaMass_vs_pt_;
0128   TProfile* v0_deltaMass_vs_eta_;
0129 
0130   TProfile* v0_Lxy_vs_deltaMass_;
0131   TProfile* v0_Lxy_vs_pt_;
0132   TProfile* v0_Lxy_vs_eta_;
0133 
0134   TH1F* n_vs_BX_;
0135   TProfile* v0_N_vs_BX_;
0136   TProfile* v0_mass_vs_BX_;
0137   TProfile* v0_Lxy_vs_BX_;
0138   TProfile* v0_deltaMass_vs_BX_;
0139 
0140   TH1F* n_vs_lumi_;
0141   TProfile* v0_N_vs_lumi_;
0142   TProfile* v0_mass_vs_lumi_;
0143   TProfile* v0_Lxy_vs_lumi_;
0144   TProfile* v0_deltaMass_vs_lumi_;
0145 
0146   TH1F* n_vs_PU_;
0147   TProfile* v0_N_vs_PU_;
0148   TProfile* v0_mass_vs_PU_;
0149   TProfile* v0_Lxy_vs_PU_;
0150   TProfile* v0_deltaMass_vs_PU_;
0151 
0152   TH1F* n_vs_LS_;
0153   TProfile* v0_N_vs_LS_;
0154 
0155   MEbinning mass_binning_;
0156   MEbinning pt_binning_;
0157   MEbinning eta_binning_;
0158   MEbinning Lxy_binning_;
0159   MEbinning chi2oNDF_binning_;
0160   MEbinning lumi_binning_;
0161   MEbinning pu_binning_;
0162   MEbinning ls_binning_;
0163 };
0164 
0165 static constexpr double piMass2 = 0.13957018 * 0.13957018;
0166 
0167 //
0168 // constructors and destructor
0169 //
0170 TkAlV0sAnalyzer::TkAlV0sAnalyzer(const edm::ParameterSet& iConfig)
0171     : tracksToken_(consumes<TrackCollection>(iConfig.getParameter<edm::InputTag>("tracks"))),
0172       vccToken_(consumes<reco::VertexCompositeCandidateCollection>(
0173           iConfig.getParameter<edm::InputTag>("vertexCompositeCandidates"))),
0174       bsToken_(consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("beamSpot"))),
0175       pvToken_(consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("primaryVertex"))),
0176       lumiscalersToken_(consumes<LumiScalersCollection>(iConfig.getParameter<edm::InputTag>("lumiScalers"))),
0177       metaDataToken_(consumes<OnlineLuminosityRecord>(iConfig.getParameter<edm::InputTag>("metadata"))),
0178       forceSCAL_(iConfig.getParameter<bool>("forceSCAL")),
0179       pvNDOF_(iConfig.getParameter<int>("pvNDOF")) {
0180   usesResource(TFileService::kSharedResource);
0181 
0182   v0_N_ = nullptr;
0183   v0_mass_ = nullptr;
0184   v0_pt_ = nullptr;
0185   v0_eta_ = nullptr;
0186   v0_phi_ = nullptr;
0187   v0_Lxy_ = nullptr;
0188   v0_Lxy_wrtBS_ = nullptr;
0189   v0_chi2oNDF_ = nullptr;
0190   v0_mass_vs_p_ = nullptr;
0191   v0_mass_vs_pt_ = nullptr;
0192   v0_mass_vs_eta_ = nullptr;
0193   v0_deltaMass_ = nullptr;
0194   v0_deltaMass_vs_pt_ = nullptr;
0195   v0_deltaMass_vs_eta_ = nullptr;
0196 
0197   v0_Lxy_vs_deltaMass_ = nullptr;
0198   v0_Lxy_vs_pt_ = nullptr;
0199   v0_Lxy_vs_eta_ = nullptr;
0200 
0201   n_vs_BX_ = nullptr;
0202   v0_N_vs_BX_ = nullptr;
0203   v0_mass_vs_BX_ = nullptr;
0204   v0_Lxy_vs_BX_ = nullptr;
0205   v0_deltaMass_vs_BX_ = nullptr;
0206 
0207   n_vs_lumi_ = nullptr;
0208   v0_N_vs_lumi_ = nullptr;
0209   v0_mass_vs_lumi_ = nullptr;
0210   v0_Lxy_vs_lumi_ = nullptr;
0211   v0_deltaMass_vs_lumi_ = nullptr;
0212 
0213   n_vs_PU_ = nullptr;
0214   v0_N_vs_PU_ = nullptr;
0215   v0_mass_vs_PU_ = nullptr;
0216   v0_Lxy_vs_PU_ = nullptr;
0217   v0_deltaMass_vs_PU_ = nullptr;
0218 
0219   n_vs_LS_ = nullptr;
0220   v0_N_vs_LS_ = nullptr;
0221 
0222   edm::ParameterSet histoPSet = iConfig.getParameter<edm::ParameterSet>("histoPSet");
0223   getHistoPSet(histoPSet.getParameter<edm::ParameterSet>("massPSet"), mass_binning_);
0224   getHistoPSet(histoPSet.getParameter<edm::ParameterSet>("ptPSet"), pt_binning_);
0225   getHistoPSet(histoPSet.getParameter<edm::ParameterSet>("etaPSet"), eta_binning_);
0226   getHistoPSet(histoPSet.getParameter<edm::ParameterSet>("LxyPSet"), Lxy_binning_);
0227   getHistoPSet(histoPSet.getParameter<edm::ParameterSet>("chi2oNDFPSet"), chi2oNDF_binning_);
0228   getHistoPSet(histoPSet.getParameter<edm::ParameterSet>("lumiPSet"), lumi_binning_);
0229   getHistoPSet(histoPSet.getParameter<edm::ParameterSet>("puPSet"), pu_binning_);
0230   getHistoPSet(histoPSet.getParameter<edm::ParameterSet>("lsPSet"), ls_binning_);
0231 }
0232 
0233 template <typename T, typename... Args>
0234 T* TkAlV0sAnalyzer::book(const Args&... args) const {
0235   T* t = fs_->make<T>(args...);
0236   return t;
0237 }
0238 
0239 void TkAlV0sAnalyzer::getHistoPSet(edm::ParameterSet pset, MEbinning& mebinning) {
0240   mebinning.nbins = pset.getParameter<int32_t>("nbins");
0241   mebinning.xmin = pset.getParameter<double>("xmin");
0242   mebinning.xmax = pset.getParameter<double>("xmax");
0243 }
0244 
0245 TH1F* TkAlV0sAnalyzer::bookHisto1D(
0246     std::string name, std::string title, std::string xaxis, std::string yaxis, MEbinning binning) {
0247   std::string title_w_axes = title + ";" + xaxis + ";" + yaxis;
0248   return book<TH1F>(name.c_str(), title_w_axes.c_str(), binning.nbins, binning.xmin, binning.xmax);
0249 }
0250 
0251 TH2F* TkAlV0sAnalyzer::bookHisto2D(
0252     std::string name, std::string title, std::string xaxis, std::string yaxis, MEbinning xbinning, MEbinning ybinning) {
0253   std::string title_w_axes = title + ";" + xaxis + ";" + yaxis;
0254   return book<TH2F>(name.c_str(),
0255                     title_w_axes.c_str(),
0256                     xbinning.nbins,
0257                     xbinning.xmin,
0258                     xbinning.xmax,
0259                     ybinning.nbins,
0260                     ybinning.xmin,
0261                     ybinning.xmax);
0262 }
0263 
0264 TProfile* TkAlV0sAnalyzer::bookProfile(
0265     std::string name, std::string title, std::string xaxis, std::string yaxis, MEbinning xbinning, MEbinning ybinning) {
0266   std::string title_w_axes = title + ";" + xaxis + ";" + yaxis;
0267   return book<TProfile>(
0268       name.c_str(), title_w_axes.c_str(), xbinning.nbins, xbinning.xmin, xbinning.xmax, ybinning.xmin, ybinning.xmax);
0269 }
0270 
0271 //
0272 // member functions
0273 //
0274 // ------------ method called for each event  ------------
0275 void TkAlV0sAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0276   using namespace edm;
0277 
0278   std::vector<const reco::Track*> myTracks;
0279 
0280   edm::Handle<reco::VertexCompositeCandidateCollection> vccHandle;
0281   iEvent.getByToken(vccToken_, vccHandle);
0282 
0283   if (vccHandle->empty())
0284     return;
0285 
0286   reco::VertexCompositeCandidateCollection v0s = *vccHandle.product();
0287 
0288   for (const auto& track : iEvent.get(tracksToken_)) {
0289     myTracks.emplace_back(&track);
0290   }
0291 
0292   // exclude multiple candidates
0293   if (myTracks.size() != 2)
0294     return;
0295 
0296   for (const auto& v0 : v0s) {
0297     float mass = v0.mass();
0298     h_V0Mass->Fill(mass);
0299 
0300     for (size_t i = 0; i < v0.numberOfDaughters(); ++i) {
0301       //LogPrint("AlignmentTrackFromVertexCompositeCandidateSelector") << "daughter: " << i << std::endl;
0302       const reco::Candidate* daughter = v0.daughter(i);
0303       const reco::RecoChargedCandidate* chargedDaughter = dynamic_cast<const reco::RecoChargedCandidate*>(daughter);
0304       if (chargedDaughter) {
0305         //LogPrint("AlignmentTrackFromVertexCompositeCandidateSelector") << "charged daughter: " << i << std::endl;
0306         const reco::TrackRef trackRef = chargedDaughter->track();
0307         if (trackRef.isNonnull()) {
0308           // LogPrint("AlignmentTrackFromVertexCompositeCandidateSelector")
0309           // << "charged daughter has non-null trackref: " << i << std::endl;
0310         }
0311       }
0312     }
0313   }
0314 
0315   const auto& tplus = myTracks[0]->charge() > 0 ? myTracks[0] : myTracks[1];
0316   const auto& tminus = myTracks[0]->charge() < 0 ? myTracks[0] : myTracks[1];
0317 
0318   TLorentzVector p4_tplus(tplus->px(), tplus->py(), tplus->pz(), sqrt((tplus->p() * tplus->p()) + piMass2));
0319   TLorentzVector p4_tminus(tminus->px(), tminus->py(), tminus->pz(), sqrt((tminus->p() * tminus->p()) + piMass2));
0320 
0321   const auto& V0p4 = p4_tplus + p4_tminus;
0322   float track_invMass = V0p4.M();
0323   h_diTrackMass->Fill(track_invMass);
0324 
0325   fillMonitoringHistos(iEvent);
0326 }
0327 
0328 void TkAlV0sAnalyzer::fillMonitoringHistos(const edm::Event& iEvent) {
0329   size_t bx = iEvent.bunchCrossing();
0330   n_vs_BX_->Fill(bx);
0331 
0332   float lumi = -1.;
0333   if (forceSCAL_) {
0334     edm::Handle<LumiScalersCollection> lumiScalers = iEvent.getHandle(lumiscalersToken_);
0335     if (lumiScalers.isValid() && !lumiScalers->empty()) {
0336       LumiScalersCollection::const_iterator scalit = lumiScalers->begin();
0337       lumi = scalit->instantLumi();
0338     }
0339   } else {
0340     edm::Handle<OnlineLuminosityRecord> metaData = iEvent.getHandle(metaDataToken_);
0341     if (metaData.isValid())
0342       lumi = metaData->instLumi();
0343   }
0344 
0345   n_vs_lumi_->Fill(lumi);
0346 
0347   edm::Handle<reco::BeamSpot> beamspotHandle = iEvent.getHandle(bsToken_);
0348   reco::BeamSpot const* bs = nullptr;
0349   if (beamspotHandle.isValid())
0350     bs = &(*beamspotHandle);
0351 
0352   edm::Handle<reco::VertexCollection> pvHandle = iEvent.getHandle(pvToken_);
0353   reco::Vertex const* pv = nullptr;
0354   size_t nPV = 0;
0355   if (pvHandle.isValid()) {
0356     pv = &pvHandle->front();
0357     //--- pv fake (the pv collection should have size==1 and the pv==beam spot)
0358     if (pv->isFake() ||
0359         pv->tracksSize() == 0
0360         // definition of goodOfflinePrimaryVertex
0361         || pv->ndof() < pvNDOF_ || pv->z() > 24.)
0362       pv = nullptr;
0363 
0364     for (const auto& v : *pvHandle) {
0365       if (v.isFake())
0366         continue;
0367       if (v.ndof() < pvNDOF_)
0368         continue;
0369       if (v.z() > 24.)
0370         continue;
0371       ++nPV;
0372     }
0373   }
0374   n_vs_PU_->Fill(nPV);
0375 
0376   float nLS = static_cast<float>(iEvent.id().luminosityBlock());
0377   n_vs_LS_->Fill(nLS);
0378 
0379   edm::Handle<reco::VertexCompositeCandidateCollection> v0Handle = iEvent.getHandle(vccToken_);
0380   int n = (v0Handle.isValid() ? v0Handle->size() : -1);
0381   v0_N_->Fill(n);
0382   v0_N_vs_BX_->Fill(bx, n);
0383   v0_N_vs_lumi_->Fill(lumi, n);
0384   v0_N_vs_PU_->Fill(nPV, n);
0385   v0_N_vs_LS_->Fill(nLS, n);
0386 
0387   if (!v0Handle.isValid() or n == 0)
0388     return;
0389 
0390   reco::VertexCompositeCandidateCollection v0s = *v0Handle.product();
0391   for (const auto& v0 : v0s) {
0392     float mass = v0.mass();
0393     float pt = v0.pt();
0394     float p = v0.p();
0395     float eta = v0.eta();
0396     float phi = v0.phi();
0397     int pdgID = v0.pdgId();
0398     float chi2oNDF = v0.vertexNormalizedChi2();
0399     GlobalPoint displacementFromPV =
0400         (pv == nullptr ? GlobalPoint(-9., -9., 0) : GlobalPoint((pv->x() - v0.vx()), (pv->y() - v0.vy()), 0.));
0401     GlobalPoint displacementFromBS =
0402         (bs == nullptr
0403              ? GlobalPoint(-9., -9., 0.)
0404              : GlobalPoint(-1 * ((bs->position().x() - v0.vx()) + (v0.vz() - bs->position().z()) * bs->dxdz()),
0405                            -1 * ((bs->position().y() - v0.vy()) + (v0.vz() - bs->position().z()) * bs->dydz()),
0406                            0));
0407     float lxy = (pv == nullptr ? -9. : displacementFromPV.perp());
0408     float lxyWRTbs = (bs == nullptr ? -9. : displacementFromBS.perp());
0409 
0410     v0_mass_->Fill(mass);
0411     v0_pt_->Fill(pt);
0412     v0_eta_->Fill(eta);
0413     v0_phi_->Fill(phi);
0414     v0_Lxy_->Fill(lxy);
0415     v0_Lxy_wrtBS_->Fill(lxyWRTbs);
0416     v0_chi2oNDF_->Fill(chi2oNDF);
0417 
0418     v0_mass_vs_p_->Fill(p, mass);
0419     v0_mass_vs_pt_->Fill(pt, mass);
0420     v0_mass_vs_eta_->Fill(eta, mass);
0421     v0_mass_vs_BX_->Fill(bx, mass);
0422     v0_mass_vs_lumi_->Fill(lumi, mass);
0423     v0_mass_vs_PU_->Fill(nPV, mass);
0424 
0425     v0_Lxy_vs_BX_->Fill(bx, lxy);
0426     v0_Lxy_vs_lumi_->Fill(lumi, lxy);
0427     v0_Lxy_vs_PU_->Fill(nPV, lxy);
0428 
0429     float PDGmass = -9999.;
0430     switch (pdgID) {
0431       case 130:              // K_s
0432       case 310:              // K_L
0433         PDGmass = 0.497614;  // GeV
0434         break;
0435       case 3122:             // Lambda
0436       case -3122:            // Lambda
0437         PDGmass = 1.115683;  // GeV
0438         break;
0439       case 4122:   // Lambda_c
0440       case -4122:  // Lambda_c
0441       case 5122:   // Lambda_b
0442       case -5122:  // Lambda_b
0443       default:
0444         break;
0445     }
0446     float delta = (PDGmass > 0. ? (mass - PDGmass) / PDGmass : -9.);
0447     v0_deltaMass_->Fill(delta);
0448     v0_deltaMass_vs_pt_->Fill(pt, delta);
0449     v0_deltaMass_vs_eta_->Fill(eta, delta);
0450     v0_deltaMass_vs_BX_->Fill(bx, delta);
0451     v0_deltaMass_vs_lumi_->Fill(lumi, delta);
0452     v0_deltaMass_vs_PU_->Fill(nPV, delta);
0453 
0454     v0_Lxy_vs_deltaMass_->Fill(delta, lxy);
0455     v0_Lxy_vs_pt_->Fill(pt, lxy);
0456     v0_Lxy_vs_eta_->Fill(eta, lxy);
0457   }
0458 }
0459 
0460 void TkAlV0sAnalyzer::beginJob() {
0461   h_diTrackMass = book<TH1F>(
0462       "diTrackMass", "V0 mass from tracks in Event", mass_binning_.nbins, mass_binning_.xmin, mass_binning_.xmax);
0463   h_V0Mass = book<TH1F>(
0464       "V0kMass", "Reconstructed V0 mass in Event", mass_binning_.nbins, mass_binning_.xmin, mass_binning_.xmax);
0465 
0466   MEbinning N_binning;
0467   N_binning.nbins = 15;
0468   N_binning.xmin = -0.5;
0469   N_binning.xmax = 14.5;
0470   v0_N_ = bookHisto1D("v0_N", "# v0", "# v0", "events", N_binning);
0471   v0_mass_ = bookHisto1D("v0_mass", "mass", "mass [GeV]", "events", mass_binning_);
0472   v0_pt_ = bookHisto1D("v0_pt", "pt", "p_{T} [GeV]", "events", pt_binning_);
0473   v0_eta_ = bookHisto1D("v0_eta", "eta", "#eta", "events", eta_binning_);
0474   MEbinning phi_binning;
0475   phi_binning.nbins = 34;
0476   phi_binning.xmin = -3.2;
0477   phi_binning.xmax = 3.2;
0478   v0_phi_ = bookHisto1D("v0_phi", "phi", "#phi [rad]", "events", phi_binning);
0479   v0_Lxy_ = bookHisto1D("v0_Lxy", "Lxy", "L_{xy} w.r.t. PV [cm]", "events", Lxy_binning_);
0480   v0_Lxy_wrtBS_ = bookHisto1D("v0_Lxy_wrtBS", "Lxy", "L_{xy} w.r.t. BS [cm]", "events", Lxy_binning_);
0481   v0_chi2oNDF_ = bookHisto1D("v0_chi2oNDF", "chi2oNDF", "vertex normalized #chi^{2}", "events", chi2oNDF_binning_);
0482 
0483   v0_mass_vs_p_ = bookProfile("v0_mass_vs_p", "mass vs p", "p [GeV]", "mass [GeV]", pt_binning_, mass_binning_);
0484   v0_mass_vs_pt_ = bookProfile("v0_mass_vs_pt", "mass vs pt", "p_{T} [GeV]", "mass [GeV]", pt_binning_, mass_binning_);
0485   v0_mass_vs_eta_ = bookProfile("v0_mass_vs_eta", "mass vs eta", "#eta", "mass [GeV]", eta_binning_, mass_binning_);
0486 
0487   MEbinning delta_binning;
0488   delta_binning.nbins = 150;
0489   delta_binning.xmin = -0.15;
0490   delta_binning.xmax = 0.15;
0491   v0_deltaMass_ = bookHisto1D("v0_deltaMass", "deltaMass", "m-m_{PDG}/m_{DPG}", "events", delta_binning);
0492   v0_deltaMass_vs_pt_ = bookProfile(
0493       "v0_deltaMass_vs_pt", "deltaMass vs pt", "p_{T} [GeV]", "m-m_{PDG}/m_{DPG}", pt_binning_, delta_binning);
0494   v0_deltaMass_vs_eta_ =
0495       bookProfile("v0_deltaMass_vs_eta", "deltaMass vs eta", "#eta", "m-m_{PDG}/m_{DPG}", eta_binning_, delta_binning);
0496 
0497   v0_Lxy_vs_deltaMass_ = bookProfile(
0498       "v0_Lxy_vs_deltaMass", "L_{xy} vs deltaMass", "m-m_{PDG}/m_{DPG}", "L_{xy} [cm]", delta_binning, Lxy_binning_);
0499   v0_Lxy_vs_pt_ =
0500       bookProfile("v0_Lxy_vs_pt", "L_{xy} vs p_{T}", "p_{T} [GeV]", "L_{xy} [cm]", pt_binning_, Lxy_binning_);
0501   v0_Lxy_vs_eta_ = bookProfile("v0_Lxy_vs_eta", "L_{xy} vs #eta", "#eta", "L_{xy} [cm]", eta_binning_, Lxy_binning_);
0502 
0503   MEbinning bx_binning;
0504   bx_binning.nbins = 3564;
0505   bx_binning.xmin = 0.5;
0506   bx_binning.xmax = 3564.5;
0507   n_vs_BX_ = bookHisto1D("n_vs_BX", "# events vs BX", "BX", "# events", bx_binning);
0508   v0_N_vs_BX_ = bookProfile("v0_N_vs_BX", "# v0 vs BX", "BX", "# v0", bx_binning, N_binning);
0509   v0_mass_vs_BX_ = bookProfile("v0_mass_vs_BX", "mass vs BX", "BX", "mass [GeV]", bx_binning, mass_binning_);
0510   v0_Lxy_vs_BX_ = bookProfile("v0_Lxy_vs_BX", "L_{xy} vs BX", "BX", "L_{xy} [cm]", bx_binning, Lxy_binning_);
0511   v0_deltaMass_vs_BX_ =
0512       bookProfile("v0_deltaMass_vs_BX", "deltaMass vs BX", "BX", "m-m_{PDG}/m_{DPG}", bx_binning, delta_binning);
0513 
0514   n_vs_lumi_ =
0515       bookHisto1D("n_vs_lumi", "# events vs lumi", "inst. lumi x10^{30} [Hz cm^{-2}]", "# events", lumi_binning_);
0516 
0517   v0_N_vs_lumi_ =
0518       bookProfile("v0_N_vs_lumi", "# v0 vs lumi", "inst. lumi x10^{30} [Hz cm^{-2}]", "# v0", lumi_binning_, N_binning);
0519 
0520   v0_mass_vs_lumi_ = bookProfile(
0521       "v0_mass_vs_lumi", "mass vs lumi", "inst. lumi x10^{30} [Hz cm^{-2}]", "mass [GeV]", lumi_binning_, mass_binning_);
0522 
0523   v0_Lxy_vs_lumi_ = bookProfile("v0_Lxy_vs_lumi",
0524                                 "L_{xy} vs lumi",
0525                                 "inst. lumi x10^{30} [Hz cm^{-2}]",
0526                                 "L_{xy} [cm]",
0527                                 lumi_binning_,
0528                                 Lxy_binning_);
0529 
0530   v0_deltaMass_vs_lumi_ = bookProfile("v0_deltaMass_vs_lumi",
0531                                       "deltaMass vs lumi",
0532                                       "inst. lumi x10^{30} [Hz cm^{-2}]",
0533                                       "m-m_{PDG}/m_{DPG}",
0534                                       lumi_binning_,
0535                                       delta_binning);
0536 
0537   n_vs_PU_ = bookHisto1D("n_vs_PU", "# events vs PU", "# good PV", "# events", pu_binning_);
0538   v0_N_vs_PU_ = bookProfile("v0_N_vs_PU", "# v0 vs PU", "# good PV", "# v0", pu_binning_, N_binning);
0539   v0_mass_vs_PU_ = bookProfile("v0_mass_vs_PU", "mass vs PU", "# good PV", "mass [GeV]", pu_binning_, mass_binning_);
0540   v0_Lxy_vs_PU_ = bookProfile("v0_Lxy_vs_PU", "L_{xy} vs PU", "# good PV", "L_{xy} [cm]", pu_binning_, Lxy_binning_);
0541   v0_deltaMass_vs_PU_ = bookProfile(
0542       "v0_deltaMass_vs_PU", "deltaMass vs PU", "# good PV", "m-m_{PDG}/m_{DPG}", pu_binning_, delta_binning);
0543 
0544   n_vs_LS_ = bookHisto1D("n_vs_LS", "# events vs LS", "LS", "# events", ls_binning_);
0545   v0_N_vs_LS_ = bookProfile("v0_N_vs_LS", "# v0 vs LS", "LS", "# v0", ls_binning_, N_binning);
0546 }
0547 
0548 // ------------ method fills 'descriptions' with the allowed parameters for the module  ------------
0549 void TkAlV0sAnalyzer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0550   edm::ParameterSetDescription desc;
0551   desc.add<edm::InputTag>("vertexCompositeCandidates", edm::InputTag("generalV0Candidates:Kshort"));
0552   desc.add<edm::InputTag>("tracks", edm::InputTag("ALCARECOTkAlKShortTracks"));
0553   desc.add<edm::InputTag>("beamSpot", edm::InputTag("offlineBeamSpot"));
0554   desc.add<edm::InputTag>("primaryVertex", edm::InputTag("offlinePrimaryVertices"));
0555   desc.add<edm::InputTag>("lumiScalers", edm::InputTag("scalersRawToDigi"));
0556   desc.add<edm::InputTag>("metadata", edm::InputTag("onlineMetaDataDigis"));
0557   desc.add<bool>("forceSCAL", false);
0558   desc.add<int>("pvNDOF", 4);
0559 
0560   {
0561     edm::ParameterSetDescription psd0;
0562     {
0563       edm::ParameterSetDescription psd1;
0564       psd1.add<int>("nbins", 3700);
0565       psd1.add<double>("xmin", 0.);
0566       psd1.add<double>("xmax", 14000.);
0567       psd0.add<edm::ParameterSetDescription>("lumiPSet", psd1);
0568     }
0569     {
0570       edm::ParameterSetDescription psd2;
0571       psd2.add<int>("nbins", 100);
0572       psd2.add<double>("xmin", 0.400);
0573       psd2.add<double>("xmax", 0.600);
0574       psd0.add<edm::ParameterSetDescription>("massPSet", psd2);
0575     }
0576     {
0577       edm::ParameterSetDescription psd3;
0578       psd3.add<int>("nbins", 100);
0579       psd3.add<double>("xmin", 0.);
0580       psd3.add<double>("xmax", 50.);
0581       psd0.add<edm::ParameterSetDescription>("ptPSet", psd3);
0582     }
0583     {
0584       edm::ParameterSetDescription psd4;
0585       psd4.add<int>("nbins", 60);
0586       psd4.add<double>("xmin", -3.);
0587       psd4.add<double>("xmax", 3.);
0588       psd0.add<edm::ParameterSetDescription>("etaPSet", psd4);
0589     }
0590     {
0591       edm::ParameterSetDescription psd5;
0592       psd5.add<int>("nbins", 350);
0593       psd5.add<double>("xmin", 0.);
0594       psd5.add<double>("xmax", 70.);
0595       psd0.add<edm::ParameterSetDescription>("LxyPSet", psd5);
0596     }
0597     {
0598       edm::ParameterSetDescription psd6;
0599       psd6.add<int>("nbins", 100);
0600       psd6.add<double>("xmin", 0.);
0601       psd6.add<double>("xmax", 30.);
0602       psd0.add<edm::ParameterSetDescription>("chi2oNDFPSet", psd6);
0603     }
0604     {
0605       edm::ParameterSetDescription psd7;
0606       psd7.add<int>("nbins", 100);
0607       psd7.add<double>("xmin", -0.5);
0608       psd7.add<double>("xmax", 99.5);
0609       psd0.add<edm::ParameterSetDescription>("puPSet", psd7);
0610     }
0611     {
0612       edm::ParameterSetDescription psd8;
0613       psd8.add<int>("nbins", 2000);
0614       psd8.add<double>("xmin", 0.);
0615       psd8.add<double>("xmax", 2000.);
0616       psd0.add<edm::ParameterSetDescription>("lsPSet", psd8);
0617     }
0618     desc.add<edm::ParameterSetDescription>("histoPSet", psd0);
0619   }
0620   descriptions.addWithDefaultLabel(desc);
0621 }
0622 
0623 //define this as a plug-in
0624 DEFINE_FWK_MODULE(TkAlV0sAnalyzer);