CheckBPHWriteDecay

Macros

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
#ifndef HeavyFlavorAnalysis_SpecificDecay_CheckBPHWriteDecay_h
#define HeavyFlavorAnalysis_SpecificDecay_CheckBPHWriteDecay_h

#include "HeavyFlavorAnalysis/RecoDecay/interface/BPHAnalyzerTokenWrapper.h"
#include "HeavyFlavorAnalysis/RecoDecay/interface/BPHTrackReference.h"

#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h"

#include "DataFormats/PatCandidates/interface/Muon.h"
#include "DataFormats/TrackReco/interface/Track.h"
#include "DataFormats/PatCandidates/interface/GenericParticle.h"
#include "DataFormats/PatCandidates/interface/CompositeCandidate.h"

#include <vector>
#include <map>
#include <string>
#include <iostream>
#include <fstream>

class TH1F;
class BPHRecoCandidate;

class CheckBPHWriteDecay : public BPHAnalyzerWrapper<BPHModuleWrapper::one_analyzer> {
public:
  explicit CheckBPHWriteDecay(const edm::ParameterSet& ps);
  ~CheckBPHWriteDecay() override = default;

  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

  void beginJob() override;
  void analyze(const edm::Event& ev, const edm::EventSetup& es) override;
  void endJob() override;

private:
  std::ostream* osPtr;
  unsigned int runNumber;
  unsigned int evtNumber;
  bool writePtr;

  std::vector<std::string> candsLabel;
  std::vector<BPHTokenWrapper<std::vector<pat::CompositeCandidate> > > candsToken;
  std::map<const pat::CompositeCandidate*, int> idMap;

  typedef edm::Ref<std::vector<reco::Vertex> > vertex_ref;
  typedef edm::Ref<pat::CompositeCandidateCollection> compcc_ref;

  void dump(std::ostream& os, const pat::CompositeCandidate& cand);
  template <class T>
  static void writeCartesian(std::ostream& os, const std::string& s, const T& v, bool endLine = true) {
    os << s << v.x() << " " << v.y() << " " << v.z();
    if (endLine)
      os << std::endl;
    return;
  }
  template <class T>
  static void writeCylindric(std::ostream& os, const std::string& s, const T& v, bool endLine = true) {
    os << s << v.pt() << " " << v.eta() << " " << v.phi();
    if (endLine)
      os << std::endl;
    return;
  }
};

#endif