ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/ProofAnalysisFramework/Run.prooflite.C
Revision: 1.2
Committed: Wed Aug 11 19:49:01 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

# Content
1 {{
2 ////////////////////////////////////////////////////////////////////////
3 //
4 // Run.prooflite.C
5 //
6 // Main macro to run over MiniTrees or TESCO Trees using PROOF Lite
7 // Edit the lines below to select tree type, input data sample, output
8 // file name...
9 //
10
11 ///////////////////////////////
12 // TREE TYPE
13 // define the data format: MiniTrees or TESCO
14 // uncomment the one to be used
15 //#define MiniTrees
16 #define TESCO
17
18 #ifdef MiniTrees
19 TDSet* dataset = new TDSet("TTree", "Tree");
20 #endif
21 #ifdef TESCO
22 TDSet* dataset = new TDSet("TTree", "Analysis", "/analyze");
23 #endif
24
25 ///////////////////////////////
26 // INPUT DATA SAMPLE
27 // Add the list of files to be proccessed by PROOF
28 // Ex. MiniTree...
29 // dataset->Add("/gpfs/csic_projects/cms/data/MiniTrees/CommonTrees3X_V02_091124/Trees_ZmumuJet_Pt15to20_HWW2MuPt2010Skim_MC31X_V3.root");
30 // Ex. TESCO Tree
31 dataset->Add("/gpfs/csic_projects/cms/jfernan/TESCOtrees/TTbarJets-madgraph-Spring10-v1.root");
32
33 ///////////////////////////////
34 // OUTPUT FILE NAME
35 // Specify the name of the file where you want your histograms to be saved
36 TString outputFile="histofile.root";
37
38 ///////////////////////////////
39 // PARAMETERS FOR MY ANALYSIS
40 // ... edit below until but is fixed...
41
42 ///////////////////////////////
43 // DYNAMIC HISTOGRAMS
44 // Specify the name of the histograms you would like to monitor as they are
45 // filled by PROOF
46 vector<TString> dynamicHistograms;
47 dynamicHistograms.push_back("fHmuPT");
48 //...
49
50 //
51 /////////////////////////////////////////////////////////////////////////
52
53 /////////////////////////////////////////////////////////////////////////
54 //
55 // Nothing should probably be edited beyond this point,
56 // unless you add some input parameters
57 //
58 #ifdef MiniTrees
59 TString selector = "MyAnalysisMiniTrees";
60 #endif
61 #ifdef TESCO
62 TString selector = "MyAnalysisTESCO";
63 #endif
64
65 // If ProofLite: 2 workers
66 TProof *p = TProof::Open(" ");
67
68 // Upload and enable packages
69 cout << ">> Uploading and enabling packages ..." << endl;
70 cout << " + TCounterUI" << endl;
71 p->UploadPackage("packages/TCounterUI.par",TProof::kRemoveOld);
72 p->EnablePackage("TCounterUI");
73 cout << " + InputParameters" << endl;
74 p->UploadPackage("packages/InputParameters.par",TProof::kRemoveOld);
75 p->EnablePackage("InputParameters");
76 cout << " + CMSAnalysisSelectorMiniTrees" << endl;
77 p->UploadPackage("packages/CMSAnalysisSelectorMiniTrees.par",TProof::kRemoveOld);
78 p->EnablePackage("CMSAnalysisSelectorMiniTrees");
79 cout << " + CMSAnalysisSelectorTESCO" << endl;
80 p->UploadPackage("packages/CMSAnalysisSelectorTESCO.par",TProof::kRemoveOld);
81 p->EnablePackage("CMSAnalysisSelectorTESCO");
82
83 //p->ShowPackages(kTRUE);
84 //p->ShowEnabledPackages(kTRUE);
85
86 ///////////////////////////////
87 // PARAMETERS FOR MY ANALYSIS
88 // ... edit here until bug is fixed
89 // Start adding input parameters
90 InputParameters *inputParameters = new InputParameters();
91 inputParameters->SetString("selection");
92 inputParameters->SetInt(1);
93 inputParameters->SetDouble(1.);
94 inputParameters->SetBool(0);
95 inputParameters->SetNamedString("sel1", "cut1"); inputParameters->SetNamedString("sel2", "cut2");
96 inputParameters->SetNamedInt("i1", 1); inputParameters->SetNamedInt("i2", 2); inputParameters->SetNamedInt("i3", 3);
97 inputParameters->SetNamedBool("b1", 0);
98 inputParameters->SetNamedDouble("d1", 1.); inputParameters->SetNamedDouble("d2", 2.);
99 // End adding input parameters
100
101 // Add the set of parameters to the input lists
102 p->AddInput(inputParameters);
103
104 // Add dynamic histograms (feedback)
105 if (dynamicHistograms.size() > 0) {
106 cout << ">> Adding dynamic histograms (Feedback)" << endl;
107 for (unsigned int i = 0; i < dynamicHistograms.size(); i++) {
108 cout << " + " << dynamicHistograms[i] << endl;
109 p->AddFeedback(dynamicHistograms[i]);
110 }
111 new TDrawFeedback(p);
112 }
113 else
114 cout << ">> No dynamic histograms (Feedback)" << endl;
115
116 // Processing...
117 cout << ">> Processing " << selector << " ..." << endl;
118 TString selectorcplus = selector;
119 selectorcplus+= ".C+";
120 p->Process(dataset,selectorcplus);
121
122 // Create the ouptut file and fill it
123 cout << ">> Saving results to " << outputFile << " ..." << endl;
124 TFile histoAnalisis(outputFile, "NEW");
125 TList* l = gProof->GetOutputList();
126 l->Write();
127 histoAnalisis.Close();
128
129 // This is used to have the objects available in the shell
130 cout << ">> You may directly access the following objects that you saved ..."
131 << endl;
132 TFile *f = TFile::Open(outputFile);
133 f->ls();
134 }}