Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:00:05

0001 #ifndef CaloOnlineTools_EcalTools_EcalTPGAnalyzer_h
0002 #define CaloOnlineTools_EcalTools_EcalTPGAnalyzer_h
0003 // -*- C++ -*-
0004 //
0005 // Class:      EcalTPGAnalyzer
0006 //
0007 //
0008 // Original Author:  Pascal Paganini
0009 //
0010 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0011 #include "FWCore/Framework/interface/Event.h"
0012 #include "FWCore/Framework/interface/MakerMacros.h"
0013 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0014 #include "CondFormats/L1TObjects/interface/L1GtTriggerMask.h"
0015 #include "CondFormats/DataRecord/interface/L1GtTriggerMaskAlgoTrigRcd.h"
0016 #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
0017 #include "DataFormats/EcalDigi/interface/EcalTriggerPrimitiveDigi.h"
0018 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h"
0019 #include "Geometry/CaloTopology/interface/EcalTrigTowerConstituentsMap.h"
0020 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
0021 #include "Geometry/Records/interface/CaloGeometryRecord.h"
0022 #include <vector>
0023 #include <string>
0024 #include <TFile.h>
0025 #include <TTree.h>
0026 
0027 class CaloSubdetectorGeometry;
0028 
0029 // Auxiliary class
0030 class towerEner {
0031 public:
0032   float eRec_;
0033   int tpgEmul_[5];
0034   int tpgADC_;
0035   int iphi_, ieta_, nbXtal_;
0036   towerEner() : eRec_(0), tpgADC_(0), iphi_(-999), ieta_(-999), nbXtal_(0) {
0037     for (int i = 0; i < 5; i++)
0038       tpgEmul_[i] = 0;
0039   }
0040 };
0041 
0042 class EcalTPGAnalyzer : public edm::one::EDAnalyzer<edm::one::WatchRuns> {
0043 public:
0044   explicit EcalTPGAnalyzer(const edm::ParameterSet &);
0045   ~EcalTPGAnalyzer() override;
0046   void analyze(edm::Event const &, edm::EventSetup const &) override;
0047   void beginRun(edm::Run const &, edm::EventSetup const &) override;
0048   void endRun(edm::Run const &, edm::EventSetup const &) override;
0049 
0050 private:
0051   struct EcalTPGVariables {
0052     // event variables
0053     unsigned int runNb;
0054     unsigned int evtNb;
0055     unsigned int bxNb;
0056     unsigned int orbitNb;
0057     unsigned int nbOfActiveTriggers;
0058     int activeTriggers[128];
0059 
0060     // tower variables
0061     unsigned int nbOfTowers;  //max 4032 EB+EE
0062     int ieta[4032];
0063     int iphi[4032];
0064     int nbOfXtals[4032];
0065     int rawTPData[4032];
0066     int rawTPEmul1[4032];
0067     int rawTPEmul2[4032];
0068     int rawTPEmul3[4032];
0069     int rawTPEmul4[4032];
0070     int rawTPEmul5[4032];
0071     float eRec[4032];
0072   };
0073 
0074 private:
0075   TFile *file_;
0076   TTree *tree_;
0077   EcalTPGVariables treeVariables_;
0078 
0079   const edm::InputTag tpCollection_;
0080   const edm::InputTag tpEmulatorCollection_;
0081   const edm::InputTag digiCollectionEB_;
0082   const edm::InputTag digiCollectionEE_;
0083   const std::string gtRecordCollectionTag_;
0084 
0085   const edm::EDGetTokenT<L1GlobalTriggerReadoutRecord> l1GtReadoutRecordToken_;
0086   const edm::EDGetTokenT<EcalTrigPrimDigiCollection> tpToken_;
0087   const edm::EDGetTokenT<EcalTrigPrimDigiCollection> tpEmulToken_;
0088   const edm::EDGetTokenT<EBDigiCollection> ebDigiToken_;
0089   const edm::EDGetTokenT<EEDigiCollection> eeDigiToken_;
0090 
0091   const edm::ESGetToken<EcalTrigTowerConstituentsMap, IdealGeometryRecord> eTTMapToken_;
0092   const edm::ESGetToken<CaloSubdetectorGeometry, EcalBarrelGeometryRecord> ebGeometryToken_;
0093   const edm::ESGetToken<CaloSubdetectorGeometry, EcalEndcapGeometryRecord> eeGeometryToken_;
0094   const edm::ESGetToken<L1GtTriggerMask, L1GtTriggerMaskAlgoTrigRcd> l1GtMaskToken_;
0095 
0096   const bool allowTP_;
0097   const bool useEE_;
0098   const bool print_;
0099 
0100   const CaloSubdetectorGeometry *theBarrelGeometry_;
0101   const CaloSubdetectorGeometry *theEndcapGeometry_;
0102   const EcalTrigTowerConstituentsMap *eTTmap_;
0103 };
0104 
0105 #endif