ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/L1RpcTriggerAnalysis/macros/makePressureHumidityGraph.h
Revision: 1.1
Committed: Mon Aug 27 10:26:40 2012 UTC (12 years, 8 months ago) by cwiok
Content type: text/plain
Branch: MAIN
CVS Tags: Artur_11_07_2013_B, Artur_11_07_2013_A, Artur_11_07_2013, Artur_28_06_2013, Mikolaj_cmssw533, HEAD
Log Message:
Updated scripts for making the plots

File Contents

# User Rev Content
1 cwiok 1.1 //////////////////////////////////////////////////////////
2     // This class has been automatically generated on
3     // Tue Jun 12 14:50:31 2012 by ROOT version 5.32/00
4     // from TTree tree/tree
5     // found on file: nt0_all.root
6     //////////////////////////////////////////////////////////
7    
8     #ifndef makePressureHumidityGraph_h
9     #define makePressureHumidityGraph_h
10    
11     #include <TROOT.h>
12     #include <TChain.h>
13     #include <TFile.h>
14     #include <TGraphErrors.h>
15    
16     // Header file for the classes stored in the TTree if any.
17     #include <TObjString.h>
18     #include <TObject.h>
19     #include <TTimeStamp.h>
20    
21     #include <iostream>
22     #include <cstdio>
23     #include <string>
24     #include <fstream>
25    
26     // Fixed size dimensions of array or collections stored in the TTree if any.
27    
28     class makePressureHumidityGraph {
29     public :
30     TChain *fChain; //!pointer to the analyzed TTree or TChain
31     Int_t fCurrent; //!current Tree number in a TChain
32    
33     // Declaration of leaf types
34     //TObjString *DPNAME;
35     UInt_t fUniqueID;
36     UInt_t fBits;
37     TString fString;
38     Double_t VALUE;
39     Double_t RUNNUMBER;
40     //TTimeStamp *CHANGE_DATE;
41     Int_t fSec;
42     Int_t fNanoSec;
43     //TTimeStamp *STARTTIME;
44     // Int_t fSec;
45     // Int_t fNanoSec;
46     //TTimeStamp *STOPTIME;
47     // Int_t fSec;
48     // Int_t fNanoSec;
49    
50     // List of branches
51     TBranch *b_DPNAME_fUniqueID; //!
52     TBranch *b_DPNAME_fBits; //!
53     TBranch *b_DPNAME_fString; //!
54     TBranch *b_VALUE; //!
55     TBranch *b_RUNNUMBER; //!
56     TBranch *b_CHANGE_DATE_fSec; //!
57     TBranch *b_CHANGE_DATE_fNanoSec; //!
58     TBranch *b_STARTTIME_fSec; //!
59     TBranch *b_STARTTIME_fNanoSec; //!
60     TBranch *b_STOPTIME_fSec; //!
61     TBranch *b_STOPTIME_fNanoSec; //!
62    
63     // makePressureHumidityGraph(TTree *tree=0);
64     makePressureHumidityGraph(TChain *tree,
65     const char *finpRootfile=NULL, // WBM rootutple
66     const char *foutPressurePrefix="dummy_pressure",
67     const char *foutHumidityPrefix="dummy_humidity");
68     ~makePressureHumidityGraph();
69     virtual Int_t Cut(Long64_t entry);
70     virtual Int_t GetEntry(Long64_t entry);
71     virtual Long64_t LoadTree(Long64_t entry);
72     virtual void Init(TChain *tree);
73     virtual void Loop();
74     virtual Bool_t Notify();
75     virtual void Show(Long64_t entry = -1);
76    
77     private:
78     const char *foutPressurePrefix; // output text/root file name prefix
79     const char *foutHumidityPrefix; // output text/root file name prefix
80     // assumed typical p, rH measuremnt precision:
81     const double pressure_accuracy; // pressure in millibars
82     const double humidity_accuracy; // relative humidity in percents [0-100]%
83     };
84    
85     #endif
86    
87     #ifdef makePressureHumidityGraph_cxx
88     makePressureHumidityGraph::makePressureHumidityGraph(TChain *tree,
89     const char *inpRootfileList,
90     const char *outPressurePrefix,
91     const char *outHumidityPrefix)
92     : fChain(0),
93     foutPressurePrefix(outPressurePrefix),
94     foutHumidityPrefix(outHumidityPrefix),
95     pressure_accuracy(0.1), // resolution = 0.1 mbar
96     humidity_accuracy(0.1) // resolution = 0.1 percent
97     {
98     // if parameter tree is zero connect the rootfile
99     // used to generate this class and read the TTree.
100     if (tree == 0 && inpRootfileList && strlen(inpRootfileList)>0 ) {
101     TChain *newtree = new TChain("tree");
102     std::ifstream inp;
103     inp.open(inpRootfileList, std::ifstream::in);
104     while(inp.good()) {
105     TString name;
106     inp >> name;
107     if(name=="") continue;
108     newtree->AddFile(name.Data());
109     };
110     inp.close();
111     Init(newtree);
112     } else {
113     Init(tree);
114     }
115     }
116    
117     makePressureHumidityGraph::~makePressureHumidityGraph()
118     {
119     if (!fChain) return;
120     delete fChain->GetCurrentFile();
121     }
122    
123     Int_t makePressureHumidityGraph::GetEntry(Long64_t entry)
124     {
125     // Read contents of entry.
126     if (!fChain) return 0;
127     return fChain->GetEntry(entry);
128     }
129     Long64_t makePressureHumidityGraph::LoadTree(Long64_t entry)
130     {
131     // Set the environment to read one entry
132     if (!fChain) return -5;
133     Long64_t centry = fChain->LoadTree(entry);
134     if (centry < 0) return centry;
135     if (fChain->GetTreeNumber() != fCurrent) {
136     fCurrent = fChain->GetTreeNumber();
137     Notify();
138     }
139     return centry;
140     }
141    
142     void makePressureHumidityGraph::Init(TChain *tree)
143     {
144     // The Init() function is called when the selector needs to initialize
145     // a new tree or chain. Typically here the branch addresses and branch
146     // pointers of the tree will be set.
147     // It is normally not necessary to make changes to the generated
148     // code, but the routine can be extended by the user if needed.
149     // Init() will be called many times when running on PROOF
150     // (once per file to be processed).
151    
152     // Set branch addresses and branch pointers
153     if (!tree) return;
154     fChain = tree;
155     fCurrent = -1;
156     fChain->SetMakeClass(1);
157    
158     fChain->SetBranchAddress("fUniqueID", &fUniqueID, &b_DPNAME_fUniqueID);
159     fChain->SetBranchAddress("fBits", &fBits, &b_DPNAME_fBits);
160     fChain->SetBranchAddress("fString", &fString, &b_DPNAME_fString);
161     fChain->SetBranchAddress("VALUE", &VALUE, &b_VALUE);
162     fChain->SetBranchAddress("RUNNUMBER", &RUNNUMBER, &b_RUNNUMBER);
163     fChain->SetBranchAddress("fSec", &fSec, &b_CHANGE_DATE_fSec);
164     fChain->SetBranchAddress("fNanoSec", &fNanoSec, &b_CHANGE_DATE_fNanoSec);
165     // fChain->SetBranchAddress("fSec", &fSec, &b_STARTTIME_fSec);
166     // fChain->SetBranchAddress("fNanoSec", &fNanoSec, &b_STARTTIME_fNanoSec);
167     // fChain->SetBranchAddress("fSec", &fSec, &b_STOPTIME_fSec);
168     // fChain->SetBranchAddress("fNanoSec", &fNanoSec, &b_STOPTIME_fNanoSec);
169     Notify();
170     }
171    
172     Bool_t makePressureHumidityGraph::Notify()
173     {
174     // The Notify() function is called when a new file is opened. This
175     // can be either for a new TTree in a TChain or when when a new TTree
176     // is started when using PROOF. It is normally not necessary to make changes
177     // to the generated code, but the routine can be extended by the
178     // user if needed. The return value is currently not used.
179    
180     return kTRUE;
181     }
182    
183     void makePressureHumidityGraph::Show(Long64_t entry)
184     {
185     // Print contents of entry.
186     // If entry is not specified, print current entry
187     if (!fChain) return;
188     fChain->Show(entry);
189     }
190     Int_t makePressureHumidityGraph::Cut(Long64_t entry)
191     {
192     // This function may be called from Loop.
193     // returns 1 if entry is accepted.
194     // returns -1 otherwise.
195     return 1;
196     }
197     #endif // #ifdef makePressureHumidityGraph_cxx