Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HF ShowerLibrary producer update #9173

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
137 changes: 61 additions & 76 deletions SimG4CMS/ShowerLibraryProducer/interface/HcalForwardLibWriter.h
@@ -1,76 +1,61 @@
#ifndef SimG4CMS_ShowerLibraryProducer_HcalForwardLibWriter_h
#define SimG4CMS_ShowerLibraryProducer_HcalForwardLibWriter_h

// -*- C++ -*-
//
// Package: HcalForwardLibWriter
// Class: HcalForwardLibWriter
//
/**\class HcalForwardLibWriter HcalForwardLibWriter.h SimG4CMS/ShowerLibraryProducer/interface/HcalForwardLibWriter.h

Description: [one line class summary]

Implementation:
[Notes on implementation]
*/
//
// Original Author: Taylan Yetkin,510 1-004,+41227672815,
// Created: Thu Feb 9 13:02:38 CET 2012
//
//


// system include files
#include <memory>
#include <string>
#include <fstream>
#include <utility>
#include <vector>


// user include files
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDProducer.h"

#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"

#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/Exception.h"

#include "SimDataFormats/CaloHit/interface/HFShowerPhoton.h"
#include "SimDataFormats/CaloHit/interface/HFShowerLibraryEventInfo.h"

#include "TFile.h"
#include "TTree.h"

//
// class declaration
//

class HcalForwardLibWriter : public edm::EDProducer {
public:

struct FileHandle{
std::string name;
std::string id;
int momentum;
};

explicit HcalForwardLibWriter(const edm::ParameterSet&);
~HcalForwardLibWriter();

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

private:
virtual void produce(edm::Event&, const edm::EventSetup&) override;

void readUserData();

// ----------member data ---------------------------
std::string fDataFile;
std::vector<FileHandle> fFileHandle;
TFile* fFile;
TTree* fTree;
};
#endif
#ifndef SimG4CMS_ShowerLibraryProducer_HcalForwardLibWriter_h
#define SimG4CMS_ShowerLibraryProducer_HcalForwardLibWriter_h

#include <memory>
#include <string>
#include <fstream>
#include <utility>
#include <vector>

#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDAnalyzer.h"

#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"

#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

#include "SimDataFormats/CaloHit/interface/HFShowerPhoton.h"
#include "SimDataFormats/CaloHit/interface/HFShowerLibraryEventInfo.h"
#include "CommonTools/UtilAlgos/interface/TFileService.h"
#include "FWCore/ServiceRegistry/interface/Service.h"

#include "TFile.h"
#include "TTree.h"

using namespace edm;

class HcalForwardLibWriter : public edm::EDAnalyzer {
public:
struct FileHandle{
std::string name;
std::string id;
int momentum;
};
explicit HcalForwardLibWriter(const edm::ParameterSet&);
~HcalForwardLibWriter();

private:
virtual void beginJob() ;
virtual void analyze(const edm::Event&, const edm::EventSetup&);
virtual void endJob() ;
int readUserData();
int nbins;
int nshowers;

TFile* theFile;
TTree* theTree;
TFile* LibFile;
TTree* LibTree;

edm::Service<TFileService> fs;
std::string theDataFile;
std::vector<FileHandle> theFileHandle;

HFShowerLibraryEventInfo evtInfo;
HFShowerPhotonCollection emColl;
HFShowerPhotonCollection hadColl;

};
#endif