StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StFwdAnalysisMaker.h
1 #ifndef ST_FWD_ANALYSIS_MAKER_H
2 #define ST_FWD_ANALYSIS_MAKER_H
3 
4 #include <map>
5 
6 #include "StChain/StMaker.h"
7 
8 
9 class StFwdAnalysisMaker : public StMaker
10 {
11  public:
13  ~StFwdAnalysisMaker(){/* nada */};
14 
15  int Init();
16  int Finish();
17  int Make();
18  void Clear(const Option_t *opts = "");
19  void ProcessFwdTracks();
20  void ProcessFwdMuTracks();
21 
22  // StEvent analyzed by default
23  // call this to analyze the MuDst instead
24  void setMuDstInput() { mAnalyzeMuDst = true; }
25  void setLocalOutputFile( TString f ) { mLocalOutputFile = f; }
26 
27  protected:
28 
33  std::map<TString, TH1*> mHists;
34 
41  TH1* getHist( TString n ){
42  if (mHists.count(n))
43  return mHists[n];
44  LOG_ERROR << "Attempting to access non-existing histogram" << endm;
45  return new TH1F( "NULL", "NULL", 1, 0, 1 ); // returning nullptr can lead to seg fault, this fails softly
46  }
47 
52  bool mAnalyzeMuDst = false;
53  TString mLocalOutputFile;
54 
55  ClassDef(StFwdAnalysisMaker, 0);
56 };
57 
58 #endif
std::map< TString, TH1 * > mHists
Map of &lt;name (TString), histogram&gt;
bool mAnalyzeMuDst
Control whether the analysis uses StEvent (default) or MuDst as input.
TH1 * getHist(TString n)
Get the Hist object from the map.