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