StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
CSMStatusUtils.h
1 
2 #ifndef CSMSTATUSUTILS_H
3 #define CSMSTATUSUTILS_H
4 
5 #include "TObject.h"
6 #include "TH2.h"
7 #include "TTree.h"
8 
9 #include <map>
10 #include <set>
11 #include <vector>
12 #include <string>
13 
14 //#include "StEEmcUtil/database/StEEmcDb.h"
15 class StEEmcDb;
16 
17 class CSMStatusUtils : public TObject {
18  public:
19  CSMStatusUtils() {mZerobit=512;}
20  ~CSMStatusUtils() {}
21 
22  // analysis functions
23  Int_t createStatusHistograms(TString directory);
24  Int_t analyseStatusHistogram(TH2F* hist);
25  Int_t initializeHistFileFromDir(TString directory, TString filter);
26  Int_t saveStatusTablesToASCII(TString directory,int runnumber=0);
27  Int_t saveAbbreviatedStatusTablesToASCII(TString directory);
28  Int_t readTablesFromASCII(TString directory, TString filter);
29 
30  Int_t getNumberOfChangedTowers(Int_t runnumber);
31 
32  TH2F* makeStatusVersusTimePlot();
33  void plotAllStatuses(TString rootfiledir="/star/data05/scratch/relyea/2005/DONE/",int year=2005,int runstart=0);
34  Int_t makeCombinedStatusTable(std::vector<Short_t>& statusVector);
35 
36  Int_t makeStatusPlots(TString plotDir);
37 
38  void setDetectorFlavor(TString flavor="bemc");
39  void setDb( StEEmcDb *db ) { m_eedb = db;}
40 
41  void writeHtmlHeaderBadTowerList(std::ofstream& out,Int_t runnumber);
42  void writeHtmlFooterBadTowerList(std::ofstream& out);
43  void writeHtmlHeaderSummary(std::ofstream& out);
44  void writeHtmlFooterSummary(std::ofstream& out);
45 
46  private:
47  std::map<Int_t,std::string> mHistFileMap;
48  std::map<Int_t,std::vector<Short_t>*> mEEMCRunStatusMap;
49  std::map<Int_t,std::vector<Short_t>*> mBEMCRunStatusMap;
50  std::map<Int_t,Int_t> mRunTimestampMap;
51  std::map<Int_t,Int_t> mRunDatestampMap;
52  std::map<Int_t,Bool_t> mFillEndMap;
53  std::map<Int_t,std::vector<Short_t>*>* mRunStatusMapPtr;
54  TString mDetectorFlavor;
55  int mDetectorSize;
56  int mDetectorActualSize;
57  int eemcCrateMap[6][120];
58  StEEmcDb *m_eedb;
59 
60  Short_t mZerobit;
61 
62  TString getDateTimeString(int runnumber,TTree* ttree=0);
63  void findFillEnds();
64  void setDateTimeInfo(int runnumber,TTree* ttree);
65  void writePedestals(Int_t runNumber, TString directory,
66  std::vector<Short_t>& statusVector,
67  std::vector<Float_t>& pedestalmean,
68  std::vector<Float_t>& pedestalwidth,
69  std::vector<Float_t>& pedestalchi);
70  Int_t analyseStatusHistogram(TH2F* hist, TString directory,
71  Float_t& averageNumberOfHitsPerChannel,
72  Int_t dateStamp,
73  Int_t timeStamp,
74  std::vector<Short_t>& statusVector,
75  std::vector<Float_t>& pedestalmean,
76  std::vector<Float_t>& pedestalwidth,
77  std::vector<Float_t>& pedestalchi,
78  TH1F* hHotTower=0, TH1F* hPedMean=0, TH1F* hPedWidth=0);
79 
80  ClassDef(CSMStatusUtils,0)
81 };
82 
83 #endif
Int_t makeStatusPlots(TString plotDir)