Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-12-16 00:33:23

0001 #ifndef SimG4CMS_ShowerLibraryProducer_HcalForwardLibWriter_h
0002 #define SimG4CMS_ShowerLibraryProducer_HcalForwardLibWriter_h
0003 
0004 #include <memory>
0005 #include <string>
0006 #include <fstream>
0007 #include <utility>
0008 #include <vector>
0009 
0010 #include "FWCore/Framework/interface/Frameworkfwd.h"
0011 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0012 
0013 #include "FWCore/Framework/interface/Event.h"
0014 #include "FWCore/Framework/interface/MakerMacros.h"
0015 
0016 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0017 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0018 
0019 #include "SimDataFormats/CaloHit/interface/HFShowerPhoton.h"
0020 #include "SimDataFormats/CaloHit/interface/HFShowerLibraryEventInfo.h"
0021 #include "CommonTools/UtilAlgos/interface/TFileService.h"
0022 #include "FWCore/ServiceRegistry/interface/Service.h"
0023 
0024 #include "TFile.h"
0025 #include "TTree.h"
0026 
0027 class HcalForwardLibWriter : public edm::one::EDAnalyzer<> {
0028 public:
0029   struct FileHandle {
0030     std::string name;
0031     std::string id;
0032     int momentum;
0033   };
0034   explicit HcalForwardLibWriter(const edm::ParameterSet&);
0035   ~HcalForwardLibWriter() override = default;
0036   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0037 
0038 private:
0039   void beginJob() override;
0040   void analyze(const edm::Event&, const edm::EventSetup&) override;
0041   void endJob() override;
0042   int readUserData();
0043   int nbins;
0044   int nshowers;
0045   int bsize;
0046   int splitlevel;
0047   int compressionAlgo;
0048   int compressionLevel;
0049 
0050   TFile* theFile;
0051   TTree* theTree;
0052   TFile* LibFile;
0053   TTree* LibTree;
0054   TBranch* emBranch;
0055   TBranch* hadBranch;
0056 
0057   std::string theDataFile;
0058   std::vector<FileHandle> theFileHandle;
0059 
0060   HFShowerLibraryEventInfo evtInfo;
0061   HFShowerPhotonCollection emColl;
0062   HFShowerPhotonCollection hadColl;
0063 };
0064 #endif