File indexing completed on 2023-03-17 11:05:39
0001 #ifndef HeavyFlavorAnalysis_SpecificDecay_CheckBPHWriteDecay_h
0002 #define HeavyFlavorAnalysis_SpecificDecay_CheckBPHWriteDecay_h
0003
0004 #include "HeavyFlavorAnalysis/RecoDecay/interface/BPHAnalyzerTokenWrapper.h"
0005 #include "HeavyFlavorAnalysis/RecoDecay/interface/BPHTrackReference.h"
0006
0007 #include "FWCore/Framework/interface/Event.h"
0008 #include "FWCore/Framework/interface/EventSetup.h"
0009 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0010 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h"
0011
0012 #include "DataFormats/PatCandidates/interface/Muon.h"
0013 #include "DataFormats/TrackReco/interface/Track.h"
0014 #include "DataFormats/PatCandidates/interface/GenericParticle.h"
0015 #include "DataFormats/PatCandidates/interface/CompositeCandidate.h"
0016
0017 #include <vector>
0018 #include <map>
0019 #include <string>
0020 #include <iostream>
0021 #include <fstream>
0022
0023 class TH1F;
0024 class BPHRecoCandidate;
0025
0026 class CheckBPHWriteDecay : public BPHAnalyzerWrapper<BPHModuleWrapper::one_analyzer> {
0027 public:
0028 explicit CheckBPHWriteDecay(const edm::ParameterSet& ps);
0029 ~CheckBPHWriteDecay() override = default;
0030
0031 static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0032
0033 void beginJob() override;
0034 void analyze(const edm::Event& ev, const edm::EventSetup& es) override;
0035 void endJob() override;
0036
0037 private:
0038 std::ostream* osPtr;
0039 unsigned int runNumber;
0040 unsigned int evtNumber;
0041 bool writePtr;
0042
0043 std::vector<std::string> candsLabel;
0044 std::vector<BPHTokenWrapper<std::vector<pat::CompositeCandidate> > > candsToken;
0045 std::map<const pat::CompositeCandidate*, int> idMap;
0046
0047 typedef edm::Ref<std::vector<reco::Vertex> > vertex_ref;
0048 typedef edm::Ref<pat::CompositeCandidateCollection> compcc_ref;
0049
0050 void dump(std::ostream& os, const pat::CompositeCandidate& cand);
0051 template <class T>
0052 static void writeCartesian(std::ostream& os, const std::string& s, const T& v, bool endLine = true) {
0053 os << s << v.x() << " " << v.y() << " " << v.z();
0054 if (endLine)
0055 os << std::endl;
0056 return;
0057 }
0058 template <class T>
0059 static void writeCylindric(std::ostream& os, const std::string& s, const T& v, bool endLine = true) {
0060 os << s << v.pt() << " " << v.eta() << " " << v.phi();
0061 if (endLine)
0062 os << std::endl;
0063 return;
0064 }
0065 };
0066
0067 #endif