File indexing completed on 2023-10-25 09:55:36
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef L1T_OmtfP1_TOOLS_DATAROOTDUMPER2_H_
0009 #define L1T_OmtfP1_TOOLS_DATAROOTDUMPER2_H_
0010
0011 #include "L1Trigger/L1TMuonOverlapPhase1/interface/Tools/EmulationObserverBase.h"
0012
0013 #include "FWCore/Framework/interface/Event.h"
0014 #include "FWCore/Framework/interface/EventSetup.h"
0015 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0016 #include "SimDataFormats/Track/interface/SimTrackContainer.h"
0017
0018 #include "TMap.h"
0019 #include "TArrayI.h"
0020 #include "TFile.h"
0021 #include "TH2.h"
0022
0023 #include <functional>
0024
0025 class TTree;
0026
0027 struct OmtfEvent {
0028 public:
0029 double muonPt = 0, muonEta = 0, muonPhi = 0;
0030 int muonCharge = 0;
0031
0032 int omtfCharge = 0, omtfProcessor = 0, omtfScore = 0;
0033 double omtfPt = 0, omtfEta = 0, omtfPhi = 0;
0034 unsigned int omtfQuality = 0, omtfRefLayer = 0;
0035 unsigned int omtfFiredLayers = 0;
0036
0037 float omtfPtCont = 0;
0038
0039 struct Hit {
0040 union {
0041 unsigned long rawData = 0;
0042
0043 struct {
0044 char layer;
0045 char quality;
0046 char z;
0047 char valid;
0048 short eta;
0049 short phiDist;
0050 };
0051 };
0052
0053 ~Hit() {}
0054 };
0055
0056 std::vector<unsigned long> hits;
0057 };
0058
0059 class DataROOTDumper2 : public EmulationObserverBase {
0060 public:
0061 DataROOTDumper2(const edm::ParameterSet& edmCfg, const OMTFConfiguration* omtfConfig, std::string rootFileName);
0062
0063 ~DataROOTDumper2() override;
0064
0065 void observeEventEnd(const edm::Event& iEvent,
0066 std::unique_ptr<l1t::RegionalMuonCandBxCollection>& finalCandidates) override;
0067
0068 void endJob() override;
0069
0070 private:
0071 void initializeTTree(std::string rootFileName);
0072 void saveTTree();
0073
0074 TFile* rootFile = nullptr;
0075 TTree* rootTree = nullptr;
0076
0077 OmtfEvent omtfEvent;
0078
0079 unsigned int evntCnt = 0;
0080
0081 TH1I* ptGenPos = nullptr;
0082 TH1I* ptGenNeg = nullptr;
0083
0084 std::vector<TH2*> hitVsPt;
0085 };
0086
0087 #endif