ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/ProofAnalysisFramework/MyAnalysisMiniTrees.C
Revision: 1.2
Committed: Wed Aug 11 19:48:06 2010 UTC (14 years, 8 months ago) by iglezh
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
State: FILE REMOVED
Log Message:
Wrong place

File Contents

# User Rev Content
1 iglezh 1.1 #include "MyAnalysisMiniTrees.h"
2    
3     #include <iostream>
4    
5     MyAnalysisMiniTrees::MyAnalysisMiniTrees(TTree* tree):
6     CMSAnalysisSelectorMiniTrees(tree) {
7     }
8    
9     void MyAnalysisMiniTrees::Initialise() {
10     // Initialise() is called at the start of the query at the worker nodes
11     // where the analysis is going to run
12    
13     // Example of Accessing to different kind of Input Parameters
14     if ( mypar->GetString() ) ss = mypar->GetString();
15     ii = mypar->TheInt();
16     dd = mypar->TheDouble();
17     bb = mypar->TheBool();
18     if ( mypar->TheNamedString("sel1") ) sss = mypar->TheNamedString("sel1");
19     mypar->TheNamedInt("i1",iii);
20     mypar->TheNamedDouble("d1",ddd);
21     mypar->TheNamedBool("b1",bbb);
22    
23     // Histograms and counters need to be created here
24    
25     // Create a TH1F histogram: myhistogram is a pointer to TH1F
26     myHistogram = CreateH1F("myHistogram", "Number of Events", 21, -10., 10.);
27     // Create a TH1D histogram
28     // CreateH1D(const char* name, const char* title,
29     // Int_t nbinsx, Axis_t xlow, Axis_t xup)
30     // Create a TH2F histogram
31     // CreateH2F(const char* name, const char* title,
32     // Int_t nbinsx, Axis_t xlow, Axis_t xup,
33     // Int_t nbinsy, Axis_t ylow, Axis_t yup)
34    
35     // Create a counter: nEvents is a TCounterUI
36     // InitCounterUI(const char* name, const char* title, unsigned int init)
37     nEvents = InitCounterUI("nEvents","Number of analyzed events",0);
38     }
39    
40     void MyAnalysisMiniTrees::InsideLoop() {
41     // The InsideLoop() function is called for each entry in the tree to be processed
42    
43     (*nEvents)++;
44     myHistogram->Fill(1);
45     }
46    
47     void MyAnalysisMiniTrees::SetDataMembersAtTermination() {
48     // Get Data Members at the client-master (after finishing the analysis at the workers nodes)
49     // Only data members set here will be accesible at the client-master
50    
51     // Replace myHistogram with the name of your histo and repeat for each histo
52     myHistogram = ((TH1F*) FindOutput("myHistogram"));
53    
54     // Replace nEvents with the name of your counter and repeat for each counter
55     nEvents = ((TCounterUI*) FindOutput("nEvents"));
56     }
57    
58     void MyAnalysisMiniTrees::Summary() {
59    
60     // cout << "======" << endl;
61     // cout << "SUMARY" << endl;
62     // cout << "======" << endl;
63    
64     // cout << " My Input Parameters " << endl;
65     // if (mypar) mypar->DumpParms();
66    
67     cout << "------------------------------------------" << endl;
68     cout << *nEvents << " raw Events (no weighted) " << endl;
69     cout << "------------------------------------------" << endl;
70     }