Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-05-15 04:21:50

0001 /*
0002  * DataROOTDumper2.h
0003  *
0004  *  Created on: Dec 11, 2019
0005  *      Author: kbunkow
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 #include "L1Trigger/L1TMuonOverlapPhase1/interface/Tools/CandidateSimMuonMatcher.h"
0013 
0014 #include "FWCore/Framework/interface/Event.h"
0015 #include "FWCore/Framework/interface/EventSetup.h"
0016 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0017 #include "SimDataFormats/Track/interface/SimTrackContainer.h"
0018 
0019 #include "TMap.h"
0020 #include "TArrayI.h"
0021 #include "TFile.h"
0022 #include "TH2.h"
0023 
0024 #include <functional>
0025 
0026 class TTree;
0027 
0028 struct OmtfEvent {
0029 public:
0030   unsigned int eventNum = 0;
0031 
0032   //muonPt = 0 means that no muon was matched to the candidate
0033   short muonEvent = -1;
0034   float muonPt = 0, muonEta = 0, muonPhi = 0, muonPropEta = 0, muonPropPhi = 0;
0035   char muonCharge = 0;
0036   float muonDxy = 0;
0037   float muonRho = 0;
0038 
0039   float omtfPt = 0, omtfEta = 0, omtfPhi = 0, omtfUPt = 0;
0040   char omtfCharge = 0;
0041   char omtfProcessor = 0;
0042   short omtfScore = 0;
0043 
0044   short omtfHwEta = 0;
0045 
0046   char omtfQuality = 0;
0047   char omtfRefLayer = 0;
0048   char omtfRefHitNum = 0;
0049 
0050   unsigned int omtfFiredLayers = 0;
0051 
0052   bool killed = false;
0053 
0054   float deltaPhi = 0, deltaEta = 0;
0055 
0056   //float omtfPtCont = 0;
0057 
0058   struct Hit {
0059     union {
0060       unsigned long rawData = 0;
0061 
0062       struct {
0063         char layer;
0064         char quality;
0065         char z;
0066         char valid;
0067         short eta;
0068         short phiDist;
0069       };
0070     };
0071 
0072     ~Hit() {}
0073   };
0074 
0075   std::vector<unsigned long> hits;
0076 };
0077 
0078 class DataROOTDumper2 : public EmulationObserverBase {
0079 public:
0080   DataROOTDumper2(const edm::ParameterSet& edmCfg,
0081                   const OMTFConfiguration* omtfConfig,
0082                   CandidateSimMuonMatcher* candidateSimMuonMatcher);
0083 
0084   ~DataROOTDumper2() override;
0085 
0086   void observeProcesorEmulation(unsigned int iProcessor,
0087                                 l1t::tftype mtfType,
0088                                 const std::shared_ptr<OMTFinput>&,
0089                                 const AlgoMuons& algoCandidates,
0090                                 const AlgoMuons& gbCandidates,
0091                                 const std::vector<l1t::RegionalMuonCand>& candMuons) override;
0092 
0093   void observeEventEnd(const edm::Event& iEvent,
0094                        std::unique_ptr<l1t::RegionalMuonCandBxCollection>& finalCandidates) override;
0095 
0096   void endJob() override;
0097 
0098 private:
0099   void initializeTTree();
0100 
0101   CandidateSimMuonMatcher* candidateSimMuonMatcher = nullptr;
0102 
0103   TTree* rootTree = nullptr;
0104 
0105   OmtfEvent omtfEvent;
0106 
0107   unsigned int evntCnt = 0;
0108 
0109   TH1I* ptGenPos = nullptr;
0110   TH1I* ptGenNeg = nullptr;
0111 
0112   std::vector<TH2*> hitVsPt;
0113 
0114   bool dumpKilledOmtfCands = false;
0115 
0116   bool usePropagation = false;
0117 };
0118 
0119 #endif /* L1T_OmtfP1_TOOLS_DATAROOTDUMPER2_H_ */