ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/cbrown/AnalysisFramework/Plotting/Modules/Systematics.C
(Generate patch)

Comparing UserCode/cbrown/AnalysisFramework/Plotting/Modules/Systematics.C (file contents):
Revision 1.51 by buchmann, Thu Nov 10 15:16:32 2011 UTC vs.
Revision 1.54 by pablom, Wed Nov 23 16:39:56 2011 UTC

# Line 154 | Line 154 | TH1F* plotEff(TTree* events, TCut kbase,
154          // Define new histogram
155          char hname[30]; sprintf(hname,"hJzbEff%d",count);
156          char hname2[30]; sprintf(hname2,"hJzbEff%d",count2);
157 <        TH1F* hJzbEff = new TH1F(hname,"JZB selection efficiency ; JZB (GeV/c); Efficiency",nBins,jzbMin,jzbMax);
158 <        TH1F* hJzbEff2= new TH1F(hname2,"JZB selection efficiency ; JZB (GeV/c); Efficiency",1,-14000,14000);
157 >        TH1F* hJzbEff = new TH1F(hname,"JZB selection efficiency ; JZB [GeV]; Efficiency",nBins,jzbMin,jzbMax);
158 >        TH1F* hJzbEff2= new TH1F(hname2,"JZB selection efficiency ; JZB [GeV]; Efficiency",1,-14000,14000);
159          Float_t step = (jzbMax-jzbMin)/static_cast<Float_t>(nBins);
160  
161          if(flipped==0) events->Draw((mcjzbexpression+">>"+(string)hname2).c_str(),("genJZB>-400"&&kbase),"goff");
# Line 179 | Line 179 | TH1F* plotEff(TTree* events, TCut kbase,
179   }
180  
181  
182 +
183   //________________________________________________________________________________________
184   // Master Formula
185   void master_formula(std::vector<float> eff, float &errHi, float &errLo) {
# Line 308 | Line 309 | void  MCPartialefficiency(TTree *events,
309     }
310    
311     char jzbSelStr[256]; sprintf(jzbSelStr,"%f",jzbSel);
312 +   char metSel[256]; sprintf(metSel, "met[4] > %f", jzbSel);
313 +   string metSelection(metSel);
314     // All acceptance cuts at gen. level
315     //TCut kbase("abs(genMll-91.2)<20&&genNjets>2&&genZPt>0&&genJZB"+geq_or_leq()+TString(jzbSelStr)+"&&genId1==-genId2");
316     TCut kbase("");
# Line 320 | Line 323 | void  MCPartialefficiency(TTree *events,
323     TCut njets(cutnJets);
324     TCut jzbp;
325     TCut jzbn;
326 +   TCut met(("pfJetGoodNum > 1 && abs(mll-91.2) < 10.0 && id1 == id2 &&" + metSelection).c_str());
327     if(flipped==0) {
328          jzbp=TCut((TString(mcjzb)+geq_or_leq()+TString(jzbSelStr)));
329          jzbn=TCut((TString(mcjzb)+ngeq_or_leq()+TString("-")+TString(jzbSelStr)));
# Line 327 | Line 331 | void  MCPartialefficiency(TTree *events,
331          jzbp=TCut(TString(mcjzb)+ngeq_or_leq()+TString("-")+TString(jzbSelStr));
332          jzbn=TCut(TString(mcjzb)+geq_or_leq()+TString(jzbSelStr));
333     }
334 <   float ntotal = events->Draw("pt1", kbase, "goff");
334 >   float ntotal = events->Draw("pt1", addcut.c_str(), "goff");
335     TCut theCut;
336     switch(type) {
337       case 1:
# Line 342 | Line 346 | void  MCPartialefficiency(TTree *events,
346       case 4:
347         theCut = kbase+massId+njets+jzbn;
348         break;
349 +     case 5:
350 +       theCut = kbase + met;
351 +       break;
352       default:
353         theCut = kbase+massId+njets+jzbn;
354         break;
355     }  
356 <      
356 >  
357     string stheCut(theCut);
358     char var[20];
359     sprintf(var, "pdfW[%d]", k);
# Line 369 | Line 376 | void  MCPartialefficiency(TTree *events,
376     result=(sel)/ntotal;
377     resulterr=TMath::Sqrt(sel/ntotal*(1+sel/ntotal)/ntotal);
378  
379 +   delete effh;
380   }
381  
382   //____________________________________________________________________________________
# Line 429 | Line 437 | Value MCefficiency(TTree *events,float &
437          TH1F *effh= new TH1F("effh","effh",1,-14000,14000);
438          if(k>=0)events->Draw((mcjzbexpression+">>effh").c_str(), TCut(newPosSide.c_str())*PlottingSetup::Weight,"goff");
439          else events->Draw((mcjzbexpression+">>effh").c_str(), TCut((sposSide+"&&(id1==id2)").c_str())*PlottingSetup::Weight,"goff");//the OSSF condition is added for the offpeak analysis, in onpeak case it's there already but doesn't change anything.
440 +
441          Float_t sel = effh->Integral();
442          Float_t nsel=0;
443          
# Line 455 | Line 464 | Value MCefficiency(TTree *events,float &
464          sel = sel/normFactor;
465          nsel = nsel/normFactor;
466  
458 //      events->Draw(mcjzbexpression.c_str(),kbase,"goff");
459 //      Float_t tot = events->GetSelectedRows();
467          Float_t tot = Neventsinfile;
468          
469          Value result_wo_signalcont;
# Line 572 | Line 579 | void doJZBscale(TTree *events, float &do
579  
580   //________________________________________________________________________
581   // JZB response (true/reco. vs. true)
582 < void JZBresponse(TTree *events, bool requireZ, float &resp, float &resperr, int flipped, string addcut="", bool isMET = kFALSE, Float_t myJzbMax = 200., Int_t nPeriods = 9 ) {
582 > void JZBresponse(TTree *events, string name, bool requireZ, float &resp, float &resperr, int flipped, string addcut="", bool isMET = kFALSE, Float_t myJzbMax = 200., Int_t nPeriods = 9 ) {
583          
584          jzbMin = 20;
585          flag_this_change(__FUNCTION__,__LINE__,false);//PlottingSetup::RestrictToMassPeak
# Line 665 | Line 672 | void do_systematics_for_one_file(TTree *
672    if(!automatized) dout << "Jet energy scale (JES): " << std::endl;
673    float jesup,jesdown;
674    JZBjetScale(events,jesdown,jesup,informalname,flipped,requireZ,addcut);
675 <  
675 >
676    if(!automatized) dout << "JZB scale: " << std::endl;
677    float scaleup,scaledown,scalesyst;
678    doJZBscale(events,scaledown,scaleup,scalesyst,JZBScaleUncert,informalname,flipped,requireZ,addcut);
# Line 674 | Line 681 | void do_systematics_for_one_file(TTree *
681    float resp,resperr;
682    if(PlottingSetup::computeJZBresponse) {
683          if(!automatized) dout << "JZB response: " << std::endl;
684 <        if(!ismSUGRA) JZBresponse(events,requireZ,resp,resperr,flipped,addcut);
684 >        if(!ismSUGRA) JZBresponse(events,informalname,requireZ,resp,resperr,flipped,addcut);
685    }
686  
687    if(!automatized) dout << "Pileup: " << std::endl;
# Line 737 | Line 744 | vector<vector<float> > compute_systemati
744    automatized=true;
745    vector< vector<float> > systematics;
746    for (int isignal=0; isignal<signalsamples.collection.size();isignal++) {
747 <      dout << "Looking at signal " << (signalsamples.collection)[isignal].filename << endl;
748 <      for(int ibin=0;ibin<bins.size();ibin++) {
749 <        jzbSel=bins[ibin];
750 <        geqleq="geq";
751 <        do_systematics_for_one_file((signalsamples.collection)[isignal].events,(signalsamples.collection)[isignal].Nentries,(signalsamples.collection)[isignal].samplename,systematics,flipped,mcjzb,datajzb,mcpeakerror,requireZ);
752 <      }//end of bin loop
747 >    dout << "Looking at signal " << (signalsamples.collection)[isignal].filename << endl;
748 >    for(int ibin=0;ibin<bins.size();ibin++) {
749 >      jzbSel=bins[ibin];
750 >      geqleq="geq";
751 >      do_systematics_for_one_file((signalsamples.collection)[isignal].events,(signalsamples.collection)[isignal].Nentries,(signalsamples.collection)[isignal].samplename,systematics,flipped,mcjzb,datajzb,mcpeakerror,requireZ);
752 >    }//end of bin loop
753    }//end of signal loop
754    return systematics;
755   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines