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
SvtBl2DAnaProcessor.cxx
Go to the documentation of this file.
2#include "TBranch.h"
3#include <fstream>
4#include <map>
5
6SvtBl2DAnaProcessor::SvtBl2DAnaProcessor(const std::string& name, Process& process) : Processor(name,process){
8}
9
12
13
15 std::cout << "Configuring SvtBl2DAnaProcessor" << std::endl;
16 try
17 {
18 debug_ = parameters.getInteger("debug");
19 rawSvtHitsColl_ = parameters.getString("rawSvtHitsColl");
20 histCfgFilename_ = parameters.getString("histCfg");
21 triggerBankColl_ = parameters.getString("triggerBankColl");
22 triggerFilename_ = parameters.getString("triggerBankCfg");
23 }
24 catch (std::runtime_error& error)
25 {
26 std::cout << error.what() << std::endl;
27 }
28 std::cout << "TRIGGER FILE NAME: " << triggerFilename_ << std::endl;
29}
30
32 std::cout << "[SvtBl2DAnaProcessor] Initializing" << std::endl;
33 svtCondHistos = new Svt2DBlHistos("raw_hits", mmapper_);
34
35 std::cout << "[SvtBl2DAnaProcessor] Load JSON" << std::endl;
37
38 if (debug_ > 0) std::cout << "[SvtBl2DAnaProcessor] Define 2DHistos" << std::endl;
39 svtCondHistos->Svt2DBlHistos::DefineHistos();
40 if (debug_ > 0) std::cout << "[SvtBl2DAnaProcessor] Defined 2DHistos" << std::endl;
41
42 tree_ = tree;
43 tree_->SetBranchAddress(rawSvtHitsColl_.c_str(), &rawSvtHits_, &brawSvtHits_);
44 tree_->SetBranchAddress(triggerBankColl_.c_str(), &triggerBank_, &btriggerBank_);
45 if (debug_ > 0) std::cout << "[SvtBl2DAnaProcessor] TTree Initialized" << std::endl;
46
47 //Read triggerBankCollection configuration file to only run on specified triggers
48 if(!triggerFilename_.empty()){
49 std::ifstream i_file(triggerFilename_);
50 i_file >> triggers_;
51 i_file.close();
52 }
53}
54
56
57 TSData* tsdata = (TSData*) triggerBank_;
58
59 //Build binary map of triggers based on TSData.h
60 //make this just trigger map
61 //add random -> tsdata->ext.Pulsar
62 prescaledtriggerMap_["Single_0_Top"] = tsdata->prescaled.Single_0_Top;
63 prescaledtriggerMap_["Single_1_Top"] = tsdata->prescaled.Single_1_Top;
64 prescaledtriggerMap_["Single_2_Top"] = tsdata->prescaled.Single_2_Top;
65 prescaledtriggerMap_["Single_3_Top"] = tsdata->prescaled.Single_3_Top;
66 prescaledtriggerMap_["Single_0_Bot"] = tsdata->prescaled.Single_0_Bot;
67 prescaledtriggerMap_["Single_1_Bot"] = tsdata->prescaled.Single_1_Bot;
68 prescaledtriggerMap_["Single_2_Bot"] = tsdata->prescaled.Single_2_Bot;
69 prescaledtriggerMap_["Single_3_Bot"] = tsdata->prescaled.Single_3_Bot;
70 prescaledtriggerMap_["Pair_0 "] = tsdata->prescaled.Pair_0 ;
71 prescaledtriggerMap_["Pair_1 "] = tsdata->prescaled.Pair_1 ;
72 prescaledtriggerMap_["Pair_2 "] = tsdata->prescaled.Pair_2 ;
73 prescaledtriggerMap_["Pair_3 "] = tsdata->prescaled.Pair_3 ;
74 prescaledtriggerMap_["LED "] = tsdata->prescaled.LED ;
75 prescaledtriggerMap_["Cosmic "] = tsdata->prescaled.Cosmic ;
76 prescaledtriggerMap_["Hodoscope "] = tsdata->prescaled.Hodoscope ;
77 prescaledtriggerMap_["Pulser "] = tsdata->prescaled.Pulser ;
78 prescaledtriggerMap_["Mult_0 "] = tsdata->prescaled.Mult_0 ;
79 prescaledtriggerMap_["Mult_1 "] = tsdata->prescaled.Mult_1 ;
80 prescaledtriggerMap_["FEE_Top "] = tsdata->prescaled.FEE_Top ;
81 prescaledtriggerMap_["FEE_Bot "] = tsdata->prescaled.FEE_Bot ;
82
83 //dont need ext trigger map to require specific triggers
84 //unless we want to require randoms
85 exttriggerMap_["Single_0_Top"] = tsdata->ext.Single_0_Top;
86 exttriggerMap_["Single_1_Top"] = tsdata->ext.Single_1_Top;
87 exttriggerMap_["Single_2_Top"] = tsdata->ext.Single_2_Top;
88 exttriggerMap_["Single_3_Top"] = tsdata->ext.Single_3_Top;
89 exttriggerMap_["Single_0_Bot"] = tsdata->ext.Single_0_Bot;
90 exttriggerMap_["Single_1_Bot"] = tsdata->ext.Single_1_Bot;
91 exttriggerMap_["Single_2_Bot"] = tsdata->ext.Single_2_Bot;
92 exttriggerMap_["Single_3_Bot"] = tsdata->ext.Single_3_Bot;
93 exttriggerMap_["Pair_0 "] = tsdata->ext.Pair_0 ;
94 exttriggerMap_["Pair_1 "] = tsdata->ext.Pair_1 ;
95 exttriggerMap_["Pair_2 "] = tsdata->ext.Pair_2 ;
96 exttriggerMap_["Pair_3 "] = tsdata->ext.Pair_3 ;
97 exttriggerMap_["LED "] = tsdata->ext.LED ;
98 exttriggerMap_["Cosmic "] = tsdata->ext.Cosmic ;
99 exttriggerMap_["Hodoscope "] = tsdata->ext.Hodoscope ;
100 exttriggerMap_["Pulser "] = tsdata->ext.Pulser ;
101 exttriggerMap_["Mult_0 "] = tsdata->ext.Mult_0 ;
102 exttriggerMap_["Mult_1 "] = tsdata->ext.Mult_1 ;
103 exttriggerMap_["FEE_Top "] = tsdata->ext.FEE_Top ;
104 exttriggerMap_["FEE_Bot "] = tsdata->ext.FEE_Bot ;
105
106 bool triggerFound = false;
107 for (auto trigger : triggers_.items()){
108 if ( (prescaledtriggerMap_[trigger.key()] > 0) || (exttriggerMap_[trigger.key()]) > 0 ){
109 triggerFound = true;
110 }
111 }
112
113 if (!triggerFound)
114 return true;
115
117
118 return true;
119}
120
122 std::cout << "[SvtBl2DAnaProcessor] Finalizing" << std::endl;
124 delete svtCondHistos;
125 svtCondHistos = nullptr;
126}
127
#define DECLARE_PROCESSOR(CLASS)
Macro which allows the framework to construct a producer given its name during configuration.
Definition Processor.h:139
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
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
description
void FillHistograms(std::vector< RawSvtHit * > *rawSvtHits_, float weight=1.)
description
Insert description here. more details.
virtual void configure(const ParameterSet &parameters)
description
std::string triggerFilename_
trigger selection
virtual void finalize()
description
json triggers_
description
std::vector< RawSvtHit * > * rawSvtHits_
description
virtual void initialize(TTree *tree)
description
TBranch * btriggerBank_
description
TTree * tree_
description
std::string triggerBankColl_
description
Svt2DBlHistos * svtCondHistos
description
std::string histCfgFilename_
configuration parameters
TObject * triggerBank_
description
SvtBl2DAnaProcessor(const std::string &name, Process &process)
Constructor.
std::map< std::string, bool > prescaledtriggerMap_
description
std::map< std::string, bool > exttriggerMap_
description
std::string rawSvtHitsColl_
description
TBranch * brawSvtHits_
description
ModuleMapper * mmapper_
Initialize ModuleMapper.
tsBits prescaled
Definition TSData.h:66
tsBits ext
Definition TSData.h:67
bool Pulser
Definition TSData.h:58
bool Cosmic
Definition TSData.h:56
bool Single_1_Bot
Definition TSData.h:48
bool Pair_1
Definition TSData.h:52
bool Hodoscope
Definition TSData.h:57
bool Pair_2
Definition TSData.h:53
bool Single_1_Top
Definition TSData.h:44
bool Single_2_Bot
Definition TSData.h:49
bool Mult_0
Definition TSData.h:59
bool Single_0_Bot
Definition TSData.h:47
bool Single_2_Top
Definition TSData.h:45
bool Single_0_Top
Definition TSData.h:43
bool Single_3_Top
Definition TSData.h:46
bool Single_3_Bot
Definition TSData.h:50
bool Pair_3
Definition TSData.h:54
bool Mult_1
Definition TSData.h:60
bool FEE_Bot
Definition TSData.h:62
bool Pair_0
Definition TSData.h:51
bool FEE_Top
Definition TSData.h:61