1 |
/**********************************************************************************
|
2 |
* @Project: SFrame - ROOT-based analysis framework
|
3 |
* @Package: SFrame
|
4 |
* @Class : LuminosityHandler
|
5 |
*
|
6 |
* @brief : This class contains all luminosity information and
|
7 |
* good-runs-list evaluations. The luminosity from data are
|
8 |
* computed via an input luminosity file and xml good-runs-list.
|
9 |
*
|
10 |
* @author : Martin Goebel (martin.goebel@desy.de)
|
11 |
*
|
12 |
**********************************************************************************/
|
13 |
|
14 |
#ifndef SFRAME_LuminosityHandler_H
|
15 |
#define SFRAME_LuminosityHandler_H
|
16 |
|
17 |
// STL include(s):
|
18 |
#include <iostream>
|
19 |
#include <iomanip>
|
20 |
#include <fstream>
|
21 |
#include <string>
|
22 |
#include <map>
|
23 |
|
24 |
// ROOT include(s):
|
25 |
#include "TNamed.h"
|
26 |
#include "TFile.h"
|
27 |
#include "TTree.h"
|
28 |
#include "TH1F.h"
|
29 |
#include "TRandom2.h"
|
30 |
|
31 |
// Local include(s)
|
32 |
#include "include/SLogger.h"
|
33 |
#include "LuminosityUtils.h"
|
34 |
|
35 |
using namespace LuminosityUtils;
|
36 |
|
37 |
using std::string;
|
38 |
using std::map;
|
39 |
using std::make_pair;
|
40 |
using std::cout;
|
41 |
using std::endl;
|
42 |
using std::setw;
|
43 |
|
44 |
class LuminosityHandler : public TNamed {
|
45 |
|
46 |
public:
|
47 |
|
48 |
LuminosityHandler( string name = "LuminosityHandler" );
|
49 |
~LuminosityHandler();
|
50 |
|
51 |
// Initialise
|
52 |
bool Initialise();
|
53 |
|
54 |
// Setter
|
55 |
//void SetGoodRunsList ( string grlName ) { m_grlName = grlName; }
|
56 |
void SetGRLPath ( string grlPath ) { m_grlPath = grlPath; }
|
57 |
void SetLumiFileName ( string lumiFileName ) { m_lumiFileName = lumiFileName; }
|
58 |
void SetTrigger ( string trigger ) { m_triggerName = trigger; }
|
59 |
void SetIntLumiPerBin ( float intLumiPerBin ) { m_intLumiPerBin = intLumiPerBin; } // in (pb)^-1
|
60 |
|
61 |
// Getter
|
62 |
//string GetGoodRunsLists ( ) { return m_grlName; }
|
63 |
//Root::TGoodRunsList* GetTGoodRunsLists ( ) { return &m_grl; }
|
64 |
string GetLumiFile ( ) { return m_lumiFileName; }
|
65 |
double GetTargetLumi ( ) { return m_targetLumi; } // in (pb)^-1
|
66 |
int GetNLumiBins ( ) { return m_NBins; }
|
67 |
int GetLumiBin ( UInt_t runNr, UInt_t lbNr );
|
68 |
double GetIntLumiInBin ( int bin );
|
69 |
RunNr_LbNr GetStartRunNrLbNr( int bin );
|
70 |
RunNr_LbNr GetEndRunNrLbNr ( int bin );
|
71 |
double GetIntLumiInLb ( UInt_t runNr, UInt_t lbNr );
|
72 |
double GetInstLumiPerLb ( UInt_t runNr, UInt_t lbNr ); // in 1e31 cm-2 s-1 = ub-1 s-1
|
73 |
double GetIntLumiInRange( UInt_t runNr1, UInt_t runNr2 );
|
74 |
double GetL1Prescale( UInt_t runNr, UInt_t lbNr );
|
75 |
double GetHLTPrescale( UInt_t runNr, UInt_t lbNr );
|
76 |
|
77 |
TH1F* GetLumiPerLumiBinHist();
|
78 |
void DumpLumiInfoIntoTxtFile();
|
79 |
TTree* GetTreeLuminosityPerRun();
|
80 |
UInt_t GetRandomRunNr();
|
81 |
|
82 |
// does lumiblock pass good runs list?
|
83 |
bool PassGoodRunsList( UInt_t runNr, UInt_t lbNr );
|
84 |
|
85 |
bool IsLumiCalc() { return m_isLumiCalc; }
|
86 |
|
87 |
void PrintUsedSetup();
|
88 |
|
89 |
private:
|
90 |
|
91 |
// logger
|
92 |
mutable SLogger m_logger;
|
93 |
|
94 |
// is lumi information available
|
95 |
bool m_isLumiCalc;
|
96 |
|
97 |
// general Luminosity plot
|
98 |
TH1F *m_lumiHist;
|
99 |
|
100 |
// dump to txt file only once
|
101 |
bool m_lumiTxtFirst;
|
102 |
|
103 |
// member variables
|
104 |
map< RunNr_LbNr, double > m_mapLbNr2IntLumi;
|
105 |
map< RunNr_LbNr, double > m_mapLbNr2InstLumi;
|
106 |
map< RunNr_LbNr, int > m_mapLbNr2LumiBin;
|
107 |
map< int, LumiBinInfo* > m_mapLumiBin2Info;
|
108 |
map< double, UInt_t > m_mapIntLumiRunNr;
|
109 |
map< RunNr_LbNr, double > m_mapLbNr2L1PS;
|
110 |
map< RunNr_LbNr, double > m_mapLbNr2HLTPS;
|
111 |
|
112 |
//string m_grlName;
|
113 |
string m_grlPath;
|
114 |
string m_lumiFileName;
|
115 |
string m_triggerName;
|
116 |
|
117 |
double m_intLumiPerBin;
|
118 |
double m_targetLumi;
|
119 |
|
120 |
int m_NBins;
|
121 |
|
122 |
// pointer to GoodRunsList
|
123 |
//Root::TGoodRunsList m_grl;
|
124 |
|
125 |
ClassDef(LuminosityHandler,1)
|
126 |
};
|
127 |
|
128 |
|
129 |
#endif // SFRAME_LuminosityHandler_H
|
130 |
|