hpstr
The Heavy Photon Search Toolkit for Reconstruction (hpstr) provides an interface to physics data from the HPS experiment saved in the LCIO format and converts it into an ROOT based format.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
MCAnaProcessor.cxx
Go to the documentation of this file.
1
6#include "MCAnaProcessor.h"
7#include <iostream>
8
9MCAnaProcessor::MCAnaProcessor(const std::string& name, Process& process) : Processor(name,process){}
10//TODO CHECK THIS DESTRUCTOR
12
13
14void MCAnaProcessor::configure(const ParameterSet& parameters) {
15 std::cout << "Configuring MCAnaProcessor" << std::endl;
16 try
17 {
18 debug_ = parameters.getInteger("debug");
19 anaName_ = parameters.getString("anaName");
20 partColl_ = parameters.getString("partColl");
21 trkrHitColl_ = parameters.getString("trkrHitColl");
22 ecalHitColl_ = parameters.getString("ecalHitColl");
23 histCfgFilename_ = parameters.getString("histCfg");
24 analysis_ = parameters.getString("analysis");
25 }
26 catch (std::runtime_error& error)
27 {
28 std::cout << error.what() << std::endl;
29 }
30}
31
32void MCAnaProcessor::initialize(TTree* tree) {
33 tree_= tree;
34 // init histos
39
40 // init TTree
41 tree_->SetBranchAddress(partColl_.c_str(), &mcParts_, &bmcParts_);
42 if (tree_->FindBranch(trkrHitColl_.c_str()))
43 tree_->SetBranchAddress(trkrHitColl_.c_str(), &mcTrkrHits_, &bmcTrkrHits_);
44 else
45 std::cout<<"WARNING: No tracker hit collection, will skip FillMCTrackerHits! "<<std::endl;
46
47 if ( tree_->FindBranch(ecalHitColl_.c_str()))
48 tree_->SetBranchAddress(ecalHitColl_.c_str(), &mcEcalHits_, &bmcEcalHits_);
49 else
50 std::cout<<"WARNING: No Ecal hit collection, will skip FillMCEcalHits"<<std::endl;
51
52}
53
64
66
68 delete histos;
69 histos = nullptr;
70}
71
#define DECLARE_PROCESSOR(CLASS)
Macro which allows the framework to construct a producer given its name during configuration.
Definition Processor.h:139
virtual void DefineHistos()
Definition of histograms from json config.
virtual void loadHistoConfig(const std::string histoConfigFile)
load histogram config
virtual void saveHistos(TFile *outF=nullptr, std::string folder="")
save histograms
Definition IEvent.h:7
description
Definition MCAnaHistos.h:20
void FillMCParticles(std::vector< MCParticle * > *mcParts, std::string analysis, float weight=1.)
description
void FillMCTrackerHits(std::vector< MCTrackerHit * > *mcTrkrHits, float weight=1.)
description
void FillMCEcalHits(std::vector< MCEcalHit * > *mcEcalHits, float weight=1.)
description
virtual void Define2DHistos()
description
Insert description here. more details.
std::vector< MCTrackerHit * > * mcTrkrHits_
description
MCAnaHistos * histos
std::string trkrHitColl_
description
std::string ecalHitColl_
description
int debug_
Debug Level.
MCAnaProcessor(const std::string &name, Process &process)
Constructor.
TBranch * bmcTrkrHits_
description
std::string anaName_
description
virtual void configure(const ParameterSet &parameters)
description
virtual void finalize()
description
TBranch * bmcEcalHits_
description
virtual void initialize(TTree *tree)
description
std::string analysis_
description
std::string partColl_
description
std::vector< MCEcalHit * > * mcEcalHits_
description
TBranch * bmcParts_
description
std::string histCfgFilename_
description
std::vector< MCParticle * > * mcParts_
description
description
Base class for all event processing components.
Definition Processor.h:34
TFile * outF_
Definition Processor.h:125
virtual bool process()
Process the histograms and generate analysis output.
Definition Processor.h:95