Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:18:49

0001 #include "TChain.h"
0002 #include "iostream"
0003 #include "fstream"
0004 #include "iomanip"
0005 #include "vector"
0006 #include "map"
0007 
0008 struct sample {
0009   TString name;
0010   TChain *chain;
0011   Double_t nEvents;
0012   Double_t xSection;
0013 };
0014 
0015 void GetRates() {
0016   /* Function: GetRates()
0017      Produces a table with the rates for the samples being studied.  The table is written to the file indicated by myfile.  
0018      The variables used here are the ones found to be optimal in the new optimization.
0019   */
0020 
0021   Double_t luminosity = 1.0E32; // in cm^-2 s^-1
0022   Double_t conversion = 1.0E-27; // mb -> cm^2
0023 
0024   /* Set the cuts for which we calculate the rates */
0025   Double_t cutEt = 17.; // 19.
0026   Double_t cutHoE = 0.07; // 0.06
0027   Double_t cutEpMatch = 0.9; // 0.45
0028   Double_t cutItrack = 0.15; // 0.45
0029   /* ********************************************* */
0030 
0031   TString pathName = "SingleElecs"; // Egamma path to analyze: SingleElecs, RelaxedSingleElecs, DoubleElecs, RelaxedDoubleElecs, SinglePhots, etc.
0032                                     // Note: High and Very High EM start with the same L1 as RelaxedSingleElecs
0033   Int_t nCandsCut = 1; // Change the number of candidates that are required to pass cuts (should be 2 for double paths)
0034  
0035   ofstream myfile;
0036   myfile.open("RatesTableNewVars.txt"); // Output file name
0037 
0038   std::vector<sample> samples;
0039   sample thisSample;
0040   TString thisName;
0041   TChain *thisChain;
0042   Int_t sampleNum = 0;
0043 
0044   /* Set properties of input files */
0045   
0046   /* Sample input:
0047      thisChain = new TChain("Events");
0048      thisChain->Add("<path-to-root-file-1>");
0049      ...
0050      thisChain->Add("<path-to-root-file-N>");
0051      thisSample.name = "Name to be displayed in table";
0052      thisSample.chain=  thisChain;
0053      thisSample.nEvents = number of events in all files in chain combined;
0054      thisSample.xSection = cross section for process contributing to this chain;
0055      samples.push_back(thisSample);
0056   */
0057   
0058   thisChain = new TChain("Events");
0059   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_1.root");
0060   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_2.root");
0061   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_3.root");
0062   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_4.root");
0063   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_5.root");
0064   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_6.root");
0065   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_7.root");
0066   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_8.root");
0067   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_9.root");
0068   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_10.root");
0069   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_11.root");
0070   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_12.root");
0071   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_13.root");
0072   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_14.root");
0073   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_15.root");
0074   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_16.root");
0075   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_17.root");
0076   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_18.root");
0077   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_19.root");
0078   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_20.root");
0079   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_21.root");
0080   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_22.root");
0081   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_23.root");
0082   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_24.root");
0083   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_25.root");
0084   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_26.root");
0085   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_27.root");
0086   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_28.root");
0087   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_29.root");
0088   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_30.root");
0089   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_31.root");
0090   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_32.root");
0091   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_33.root");
0092   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_34.root");
0093   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_35.root");
0094   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_36.root");
0095   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_37.root");
0096   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_38.root");
0097   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_39.root");
0098   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_40.root");
0099   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_41.root");
0100   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_42.root");
0101   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_43.root");
0102   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_44.root");
0103   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_45.root");
0104   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_46.root");
0105   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_47.root");
0106   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_48.root");
0107   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_49.root");
0108   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_50.root");
0109   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_51.root");
0110   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_52.root");
0111   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_53.root");
0112   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_54.root");
0113   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_55.root");
0114   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_56.root");
0115   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_57.root");
0116   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_58.root");
0117   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_59.root");
0118   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_60.root");
0119   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_61.root");
0120   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_62.root");
0121   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_63.root");
0122   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_64.root");
0123   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_65.root");
0124   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_66.root");
0125   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_67.root");
0126   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_68.root");
0127   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_69.root");
0128   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_70.root");
0129   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_71.root");
0130   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_72.root");
0131   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_73.root");
0132   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_74.root");
0133   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_75.root");
0134   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_76.root");
0135   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_77.root");
0136   // thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_78.root");
0137   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_79.root");
0138   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_80.root");
0139   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_81.root");
0140   thisChain->Add("../test/HLTStudyData/crab_0_071206_144326/res/QCD-0-15-HLTVars_82.root");
0141   thisSample.name = "QCD 0-15";
0142   thisSample.chain = thisChain;
0143   thisSample.nEvents = 810000;
0144   thisSample.xSection = 52.0;
0145   samples.push_back(thisSample);
0146 
0147   thisChain = new TChain("Events");
0148   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-0.root");
0149   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-1.root");
0150   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-2.root");
0151   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-3.root");
0152   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-4.root");
0153   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-5.root");
0154   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-6.root");
0155   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-7.root");
0156   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-8.root");
0157   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-9.root");
0158   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-10.root");
0159   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-11.root");
0160   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-12.root");
0161   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-13.root");
0162   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-14.root");
0163   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-15.root");
0164   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-16.root");
0165   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-17.root");
0166   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-18.root");
0167   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-19.root");
0168   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-20.root");
0169   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-21.root");
0170   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-22.root");
0171   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-23.root");
0172   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-24.root");
0173   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-25.root");
0174   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-26.root");
0175   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-27.root");
0176   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-28.root");
0177   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-29.root");
0178   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-30.root");
0179   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-31.root");
0180   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-32.root");
0181   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-33.root");
0182   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-34.root");
0183   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-35.root");
0184   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-36.root");
0185   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-37.root");
0186   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-38.root");
0187   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-39.root");
0188   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-40.root");
0189   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-41.root");
0190   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-42.root");
0191   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-43.root");
0192   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-44.root");
0193   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-45.root");
0194   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-46.root");
0195   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-47.root");
0196   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-48.root");
0197   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-49.root");
0198   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-50.root");
0199   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-51.root");
0200   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-52.root");
0201   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-53.root");
0202   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-54.root");
0203   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-55.root");
0204   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-56.root");
0205   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-57.root");
0206   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-58.root");
0207   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-59.root");
0208   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-60.root");
0209   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-61.root");
0210   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-62.root");
0211   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-63.root");
0212   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-64.root");
0213   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-65.root");
0214   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-66.root");
0215   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-67.root");
0216   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-68.root");
0217   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-69.root");
0218   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-70.root");
0219   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-71.root");
0220   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-72.root");
0221   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-73.root");
0222   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-74.root");
0223   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-75.root");
0224   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-76.root");
0225   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-77.root");
0226   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-78.root");
0227   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-79.root");
0228   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-80.root");
0229   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-81.root");
0230   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-82.root");
0231   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-83.root");
0232   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-84.root");
0233   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-85.root");
0234   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-86.root");
0235   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-87.root");
0236   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-88.root");
0237   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-89.root");
0238   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-90.root");
0239   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-91.root");
0240   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-92.root");
0241   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-93.root");
0242   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-94.root");
0243   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-95.root");
0244   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-96.root");
0245   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-97.root");
0246   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-98.root");
0247   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-99.root");
0248   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-100.root");
0249   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-101.root");
0250   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-102.root");
0251   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-103.root");
0252   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-104.root");
0253   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-105.root");
0254   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-106.root");
0255   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-107.root");
0256   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-108.root");
0257   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-109.root");
0258   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-110.root");
0259   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-111.root");
0260   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-112.root");
0261   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-113.root");
0262   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-114.root");
0263   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-115.root");
0264   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-116.root");
0265   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-117.root");
0266   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-118.root");
0267   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-119.root");
0268   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-120.root");
0269   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-121.root");
0270   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-122.root");
0271   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-123.root");
0272   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-124.root");
0273   thisChain->Add("../test/HLTStudyData/QCD-15-20/QCD-15-20-HLTVars-125.root");
0274   thisSample.name = "QCD 15-20";
0275   thisSample.chain = thisChain;
0276   thisSample.nEvents = 1260000;
0277   thisSample.xSection = 1.46;
0278   samples.push_back(thisSample);
0279 
0280   thisChain = new TChain("Events");
0281   thisChain->Add("../../../../../CMSSW_1_6_0/src/HLTriggerOffline/Egamma/test/HLTStudyData/QCD-20-30-HLTVars.root");
0282   thisSample.name = "QCD 20-30";
0283   thisSample.chain = thisChain;
0284   thisSample.nEvents = 100000;
0285   thisSample.xSection = 6.32E-1;
0286   samples.push_back(thisSample);
0287 
0288   thisChain = new TChain("Events");
0289   thisChain->Add("../../../../../CMSSW_1_6_0/src/HLTriggerOffline/Egamma/test/HLTStudyData/QCD-30-50-HLTVars.root");
0290   thisSample.name = "QCD 30-50";
0291   thisSample.chain = thisChain;
0292   thisSample.nEvents = 100000;
0293   thisSample.xSection = 1.63E-1;
0294   samples.push_back(thisSample);
0295 
0296   thisChain = new TChain("Events");
0297   thisChain->Add("../../../../../CMSSW_1_6_0/src/HLTriggerOffline/Egamma/test/QCD-HLTVars-1.root");
0298   thisChain->Add("../../../../../CMSSW_1_6_0/src/HLTriggerOffline/Egamma/test/QCD-HLTVars-2.root");
0299   thisChain->Add("../../../../../CMSSW_1_6_0/src/HLTriggerOffline/Egamma/test/QCD-HLTVars-3.root");
0300   thisChain->Add("../../../../../CMSSW_1_6_0/src/HLTriggerOffline/Egamma/test/QCD-HLTVars-4.root");
0301   thisChain->Add("../../../../../CMSSW_1_6_0/src/HLTriggerOffline/Egamma/test/QCD-HLTVars-5.root");
0302   thisChain->Add("../../../../../CMSSW_1_6_0/src/HLTriggerOffline/Egamma/test/QCD-HLTVars-6.root");
0303   thisChain->Add("../../../../../CMSSW_1_6_0/src/HLTriggerOffline/Egamma/test/QCD-HLTVars-7.root");
0304   thisChain->Add("../../../../../CMSSW_1_6_0/src/HLTriggerOffline/Egamma/test/QCD-HLTVars-8.root");
0305   thisChain->Add("../../../../../CMSSW_1_6_0/src/HLTriggerOffline/Egamma/test/QCD-HLTVars-9.root");
0306   thisChain->Add("../../../../../CMSSW_1_6_0/src/HLTriggerOffline/Egamma/test/QCD-HLTVars-10.root");
0307   thisSample.name = "QCD 50-80";
0308   thisSample.chain = thisChain;
0309   thisSample.nEvents = 100000;
0310   thisSample.xSection = 2.16E-2;
0311   samples.push_back(thisSample);
0312 
0313   thisChain = new TChain("Events");;
0314   thisChain->Add("../../../../../CMSSW_1_6_0/src/HLTriggerOffline/Egamma/test/QCD-cfgs/QCD-HLTVars80120-0.root");
0315   thisChain->Add("../../../../../CMSSW_1_6_0/src/HLTriggerOffline/Egamma/test/QCD-cfgs/QCD-HLTVars80120-1.root");
0316   thisChain->Add("../../../../../CMSSW_1_6_0/src/HLTriggerOffline/Egamma/test/QCD-cfgs/QCD-HLTVars80120-2.root");
0317   thisChain->Add("../../../../../CMSSW_1_6_0/src/HLTriggerOffline/Egamma/test/QCD-cfgs/QCD-HLTVars80120-3.root");
0318   thisChain->Add("../../../../../CMSSW_1_6_0/src/HLTriggerOffline/Egamma/test/QCD-cfgs/QCD-HLTVars80120-4.root");
0319   thisChain->Add("../../../../../CMSSW_1_6_0/src/HLTriggerOffline/Egamma/test/QCD-cfgs/QCD-HLTVars80120-5.root");
0320   thisChain->Add("../../../../../CMSSW_1_6_0/src/HLTriggerOffline/Egamma/test/QCD-cfgs/QCD-HLTVars80120-6.root");
0321   thisChain->Add("../../../../../CMSSW_1_6_0/src/HLTriggerOffline/Egamma/test/QCD-cfgs/QCD-HLTVars80120-7.root");
0322   thisChain->Add("../../../../../CMSSW_1_6_0/src/HLTriggerOffline/Egamma/test/QCD-cfgs/QCD-HLTVars80120-8.root");
0323   thisChain->Add("../../../../../CMSSW_1_6_0/src/HLTriggerOffline/Egamma/test/QCD-cfgs/QCD-HLTVars80120-9.root");
0324   thisSample.name = "QCD 80-120";
0325   thisSample.chain = thisChain;
0326   thisSample.nEvents = 239993;
0327   thisSample.xSection = 3.08E-3;
0328   samples.push_back(thisSample);
0329 
0330   thisChain = new TChain("Events");;
0331   thisChain->Add("../../../../../CMSSW_1_6_0/src/HLTriggerOffline/Egamma/test/HLTStudyData/QCD-120-170-HLTVars-2.root");
0332   thisSample.name = "QCD 120-170";
0333   thisSample.chain = thisChain;
0334   thisSample.nEvents = 11092;
0335   thisSample.xSection = 4.94E-4;
0336   samples.push_back(thisSample);
0337 
0338   thisChain = new TChain("Events");;
0339   thisChain->Add("../../../../../CMSSW_1_6_0/src/HLTriggerOffline/Egamma/test/HLTStudyData/QCD-170-230-HLTVars-0.root");
0340   thisChain->Add("../../../../../CMSSW_1_6_0/src/HLTriggerOffline/Egamma/test/HLTStudyData/QCD-170-230-HLTVars-1.root");
0341   thisChain->Add("../../../../../CMSSW_1_6_0/src/HLTriggerOffline/Egamma/test/HLTStudyData/QCD-170-230-HLTVars-2.root");
0342   thisChain->Add("../../../../../CMSSW_1_6_0/src/HLTriggerOffline/Egamma/test/HLTStudyData/QCD-170-230-HLTVars-3.root");
0343   thisSample.name = "QCD 170-230";
0344   thisSample.chain = thisChain;
0345   thisSample.nEvents = 400000;
0346   thisSample.xSection = 1.01E-4;
0347   samples.push_back(thisSample);
0348 
0349   thisChain = new TChain("Events");;
0350   thisChain->Add("../../../../../CMSSW_1_6_0/src/HLTriggerOffline/Egamma/test/HLTStudyData/QCD-230-300-HLTVars-0.root");
0351   thisChain->Add("../../../../../CMSSW_1_6_0/src/HLTriggerOffline/Egamma/test/HLTStudyData/QCD-230-300-HLTVars-1.root");
0352   thisChain->Add("../../../../../CMSSW_1_6_0/src/HLTriggerOffline/Egamma/test/HLTStudyData/QCD-230-300-HLTVars-2.root");
0353   thisChain->Add("../../../../../CMSSW_1_6_0/src/HLTriggerOffline/Egamma/test/HLTStudyData/QCD-230-300-HLTVars-3.root");
0354   thisSample.name = "QCD 230-300";
0355   thisSample.chain = thisChain;
0356   thisSample.nEvents = 400000;
0357   thisSample.xSection = 2.45E-5;
0358   samples.push_back(thisSample);
0359 
0360   thisChain = new TChain("Events");;
0361   thisChain->Add("../../../../../CMSSW_1_6_0/src/HLTriggerOffline/Egamma/test/ZEE-HLTVars.root");
0362   thisSample.name = "Z->ee";
0363   thisSample.chain = thisChain;
0364   thisSample.nEvents = 3800;
0365   thisSample.xSection = 1.62E-6;
0366   samples.push_back(thisSample);
0367 
0368   thisChain = new TChain("Events");;
0369   thisChain->Add("../../../../../CMSSW_1_6_0/src/HLTriggerOffline/Egamma/test/HLTStudyData/WENU-HLTVars.root");
0370   thisSample.name = "W->ev";
0371   thisSample.chain = thisChain;
0372   thisSample.nEvents = 2000;
0373   thisSample.xSection = 1.72E-5;
0374   samples.push_back(thisSample);
0375 
0376   thisChain = new TChain("Events");;
0377   thisChain->Add("../../../../../CMSSW_1_6_0/src/HLTriggerOffline/Egamma/test/HLTStudyData/TTbar-HLTVars-1e.root");
0378   thisSample.name = "t-tbar";
0379   thisSample.chain = thisChain;
0380   thisSample.nEvents = 100000;
0381   thisSample.xSection = 8.33E-7;
0382   samples.push_back(thisSample);
0383    
0384   /* ****************************** */
0385 
0386   TString cutText = "", l1CutText = "";
0387 
0388   Double_t thisPass = 0., thisPassL1 = 0.;
0389   Double_t thisEff = 0., thisEffL1 = 0.;
0390   Double_t thisRate = 0., thisRateL1 = 0., rate = 0., rateL1 = 0.;
0391   Double_t thisEffErr = 0.;
0392   Double_t thisRateErr = 0., thisRateErrL1 = 0., rateErr = 0., rateErrL1 = 0.;
0393 
0394   /* Set the formula to apply cuts */
0395   cutText = "Sum$(";
0396   cutText += pathName;
0397   cutText += ".l1Match && ";
0398   cutText += pathName;
0399   cutText += ".Et > ";
0400   cutText += cutEt;
0401   cutText += " && ";
0402   cutText += pathName;
0403   cutText += ".IHcal / ";
0404   cutText += pathName;
0405   cutText += ".Et < ";
0406   cutText += cutHoE;
0407   cutText += " && ";
0408   cutText += pathName;
0409   cutText += ".pixMatch > 0 && fabs((1. - ";
0410   cutText += pathName;
0411   cutText += ".Eoverp) * sin(2.*atan(exp(-";
0412   cutText += pathName;
0413   cutText += ".eta))) / ";
0414   cutText += pathName;
0415   cutText += ".Et) < ";
0416   cutText += cutEpMatch;
0417   cutText += " && ";
0418   cutText += pathName;
0419   cutText += ".Itrack < ";
0420   cutText += cutItrack;
0421   cutText += ") >= "; // Change to >= 2 for double cuts
0422   cutText += nCandsCut;
0423 
0424   l1CutText = "Sum$(SingleElecsPT.Et > -999.) >= ";
0425   l1CutText += nCandsCut;
0426 
0427   /* Calculate raes and fill table */
0428   myfile<<"Rates and Efficiencies for Input Samples"<<endl;
0429   myfile<<"Name           X-Section (mb) Efficiency     Uncert.        L1 Rate (Hz)   Uncert. (Hz)   Rate (Hz)      Uncert. (Hz)"<<endl;
0430   myfile<<"--"<<endl;
0431   myfile.setf(ios::left);
0432   for (sampleNum = 0; sampleNum < (Int_t)samples.size(); sampleNum++) {
0433     thisPass = (Double_t)samples[sampleNum].chain->Draw("", cutText);
0434     thisPassL1 = (Double_t)samples[sampleNum].chain->Draw("", l1CutText);
0435     thisEff = thisPass / samples[sampleNum].nEvents;
0436     thisEffL1 = thisPassL1 / samples[sampleNum].nEvents;
0437     thisEffErr = sqrt(thisEff * (1. - thisEff) / samples[sampleNum].nEvents); // Simple binomial distribution uncertainty
0438     thisRate = thisEff * samples[sampleNum].xSection * luminosity * conversion;
0439     thisRateL1 = thisEffL1 * samples[sampleNum].xSection * luminosity * conversion;
0440     thisRateErr = thisEffErr * samples[sampleNum].xSection * luminosity * conversion;
0441     thisRateErrL1 = sqrt(thisEffL1 * (1. - thisEffL1) / samples[sampleNum].nEvents) * samples[sampleNum].xSection * luminosity * conversion;
0442     rate += thisRate;
0443     rateL1 += thisRateL1;
0444     rateErr = sqrt(rateErr*rateErr + thisRateErr*thisRateErr);
0445     rateErrL1 = sqrt(rateErrL1*rateErrL1 + thisRateErrL1*thisRateErrL1);
0446     thisName = samples[sampleNum].name;
0447     myfile<<setw(15)<<thisName<<setw(15)<<samples[sampleNum].xSection<<setw(15)<<setprecision(3)<<thisEff<<setw(15)<<setprecision(3)<<thisEffErr<<setw(15)<<setprecision(3)<<thisRateL1<<setw(15)<<setprecision(3)<<thisRateErrL1<<setw(15)<<setprecision(3)<<thisRate<<setw(15)<<setprecision(3)<<thisRateErr<<endl;
0448   }
0449   myfile<<"--"<<endl;
0450   myfile<<"Total                                                                                     "<<setw(15)<<setprecision(3)<<rate<<setw(15)<<setprecision(3)<<rateErr<<endl;
0451   myfile.close();
0452 }