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