ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/UHHAnalysis/SFrameTools/include/LuminosityHandler.h
Revision: 1.1
Committed: Fri May 25 09:31:04 2012 UTC (12 years, 11 months ago) by peiffer
Content type: text/plain
Branch: MAIN
Log Message:
move files to SFrameTools

File Contents

# User Rev Content
1 peiffer 1.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 "core/include/SLogger.h"
33     #include "LuminosityUtils.h"
34     //#include "GoodRunsLists/include/TGoodRunsList.h"
35    
36     using namespace LuminosityUtils;
37    
38     using std::string;
39     using std::map;
40     using std::make_pair;
41     using std::cout;
42     using std::endl;
43     using std::setw;
44    
45     class LuminosityHandler : public TNamed {
46    
47     public:
48    
49     LuminosityHandler( string name = "LuminosityHandler" );
50     ~LuminosityHandler();
51    
52     // Initialise
53     bool Initialise();
54    
55     // Setter
56     //void SetGoodRunsList ( string grlName ) { m_grlName = grlName; }
57     void SetGRLPath ( string grlPath ) { m_grlPath = grlPath; }
58     void SetLumiFileName ( string lumiFileName ) { m_lumiFileName = lumiFileName; }
59     void SetTrigger ( string trigger ) { m_triggerName = trigger; }
60     void SetIntLumiPerBin ( float intLumiPerBin ) { m_intLumiPerBin = intLumiPerBin; } // in (pb)^-1
61    
62     // Getter
63     //string GetGoodRunsLists ( ) { return m_grlName; }
64     //Root::TGoodRunsList* GetTGoodRunsLists ( ) { return &m_grl; }
65     string GetLumiFile ( ) { return m_lumiFileName; }
66     double GetTargetLumi ( ) { return m_targetLumi; } // in (pb)^-1
67     int GetNLumiBins ( ) { return m_NBins; }
68     int GetLumiBin ( UInt_t runNr, UInt_t lbNr );
69     double GetIntLumiInBin ( int bin );
70     RunNr_LbNr GetStartRunNrLbNr( int bin );
71     RunNr_LbNr GetEndRunNrLbNr ( int bin );
72     double GetIntLumiInLb ( UInt_t runNr, UInt_t lbNr );
73     double GetInstLumiPerLb ( UInt_t runNr, UInt_t lbNr ); // in 1e31 cm-2 s-1 = ub-1 s-1
74     double GetIntLumiInRange( UInt_t runNr1, UInt_t runNr2 );
75     double GetL1Prescale( UInt_t runNr, UInt_t lbNr );
76     double GetHLTPrescale( UInt_t runNr, UInt_t lbNr );
77    
78     TH1F* GetLumiPerLumiBinHist();
79     void DumpLumiInfoIntoTxtFile();
80     TTree* GetTreeLuminosityPerRun();
81     UInt_t GetRandomRunNr();
82    
83     // does lumiblock pass good runs list?
84     bool PassGoodRunsList( UInt_t runNr, UInt_t lbNr );
85    
86     bool IsLumiCalc() { return m_isLumiCalc; }
87    
88     void PrintUsedSetup();
89    
90     private:
91    
92     // logger
93     mutable SLogger m_logger;
94    
95     // is lumi information available
96     bool m_isLumiCalc;
97    
98     // general Luminosity plot
99     TH1F *m_lumiHist;
100    
101     // dump to txt file only once
102     bool m_lumiTxtFirst;
103    
104     // member variables
105     map< RunNr_LbNr, double > m_mapLbNr2IntLumi;
106     map< RunNr_LbNr, double > m_mapLbNr2InstLumi;
107     map< RunNr_LbNr, int > m_mapLbNr2LumiBin;
108     map< int, LumiBinInfo* > m_mapLumiBin2Info;
109     map< double, UInt_t > m_mapIntLumiRunNr;
110     map< RunNr_LbNr, double > m_mapLbNr2L1PS;
111     map< RunNr_LbNr, double > m_mapLbNr2HLTPS;
112    
113     //string m_grlName;
114     string m_grlPath;
115     string m_lumiFileName;
116     string m_triggerName;
117    
118     double m_intLumiPerBin;
119     double m_targetLumi;
120    
121     int m_NBins;
122    
123     // pointer to GoodRunsList
124     //Root::TGoodRunsList m_grl;
125    
126     ClassDef(LuminosityHandler,1)
127     };
128    
129    
130     #endif // SFRAME_LuminosityHandler_H
131