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.48 by buchmann, Wed Nov 9 14:18:17 2011 UTC vs.
Revision 1.50 by buchmann, Wed Nov 9 16:50:36 2011 UTC

# Line 149 | Line 149 | float allcontributionsplot(TTree* events
149   TH1F* plotEff(TTree* events, TCut kbase, TString informalname, int flipped) {
150          iplot++;
151          int count=iplot;
152 +        iplot++;
153 +        int count2=iplot;
154          // Define new histogram
155          char hname[30]; sprintf(hname,"hJzbEff%d",count);
156 <        TH1F* hJzbEff = new TH1F(hname,"JZB selection efficiency ; JZB (GeV/c); Efficiency",
157 <                                                         nBins,jzbMin,jzbMax);
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);
159          Float_t step = (jzbMax-jzbMin)/static_cast<Float_t>(nBins);
160 <        
161 <        if(flipped==0) events->Draw(mcjzbexpression.c_str(),"genJZB>-400"&&kbase,"goff");
162 <        else events->Draw(("-"+mcjzbexpression).c_str(),"genJZB>-14000"&&kbase,"goff");
163 <        Float_t maxEff = events->GetSelectedRows();
160 >
161 >        if(flipped==0) events->Draw((mcjzbexpression+">>"+(string)hname2).c_str(),("genJZB>-400"&&kbase),"goff");
162 >        else events->Draw(("-"+mcjzbexpression).c_str(),("genJZB<400"&&kbase),"goff");
163 >        Float_t maxEff = hJzbEff2->Integral();
164          if(verbose>0) dout << hname << " (" << informalname <<") " << maxEff <<  std::endl;
165          
166          if(verbose>0) dout <<  "JZB max = " << jzbMax << std::endl;
# Line 165 | Line 168 | TH1F* plotEff(TTree* events, TCut kbase,
168          char cut[256];
169          for ( Int_t iBin = 0; iBin<nBins; ++iBin ) {
170                  sprintf(cut,"genJZB>%3f",jzbMin+iBin*step);
171 <                events->Draw(mcjzbexpression.c_str(),TCut(cut)&&kbase,"goff");
172 <                Float_t eff = static_cast<Float_t>(events->GetSelectedRows())/maxEff;
173 <                //     dout << "COUCOU " << __LINE__ << std::endl;
171 >                if(flipped>0) sprintf(cut,"genJZB<-%3f",jzbMin+iBin*step);
172 >                if(flipped==0) events->Draw((mcjzbexpression+">>"+(string)hname2).c_str(),(TCut(cut)&&kbase),"goff");
173 >                if(flipped==1) events->Draw(("-"+mcjzbexpression+">>"+(string)hname2).c_str(),(TCut(cut)&&kbase),"goff");
174 >                Float_t eff = static_cast<Float_t>(hJzbEff2->Integral())/maxEff;
175                  hJzbEff->SetBinContent(iBin+1,eff);
176                  hJzbEff->SetBinError(iBin+1,TMath::Sqrt(eff*(1-eff)/maxEff));
177          }
178 +        delete hJzbEff2;
179          return hJzbEff;
175        
176        
180   }
181  
182  
# Line 424 | Line 427 | Value MCefficiency(TTree *events,float &
427          string emnewNegSide = "((id1!=id2)&&(" + snegSide + "))*" + svar; // only used for off peak analysis
428  
429          TH1F *effh= new TH1F("effh","effh",1,-14000,14000);
430 <        if(k>=0)events->Draw((mcjzbexpression+">>effh").c_str(), newPosSide.c_str(),"goff");
431 <        else events->Draw((mcjzbexpression+">>effh").c_str(), (sposSide+"&&(id1==id2)").c_str(),"goff");//the OSSF condition is added for the offpeak analysis, in onpeak case it's there already but doesn't change anything.
430 >        if(k>=0)events->Draw((mcjzbexpression+">>effh").c_str(), TCut(newPosSide.c_str())*PlottingSetup::Weight,"goff");
431 >        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.
432          Float_t sel = effh->Integral();
433          Float_t nsel=0;
434          
# Line 434 | Line 437 | Value MCefficiency(TTree *events,float &
437          if(ConsiderSignalContaminationForLimits) {
438            flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak
439            if(PlottingSetup::RestrictToMassPeak) {
440 <            events->Draw((mcjzbexpression+">>effh").c_str(), newNegSide.c_str(),"goff");
440 >            events->Draw((mcjzbexpression+">>effh").c_str(), (TCut(newNegSide.c_str()))*PlottingSetup::Weight,"goff");
441              nsel += effh->Integral();
442            } else {
443 <            events->Draw((mcjzbexpression+">>effh").c_str(), newNegSide.c_str(),"goff");
443 >            events->Draw((mcjzbexpression+">>effh").c_str(), (TCut(newNegSide.c_str()))*PlottingSetup::Weight,"goff");
444              nsel += effh->Integral();
445 <            events->Draw((mcjzbexpression+">>effh").c_str(), emnewPosSide.c_str(),"goff");
445 >            events->Draw((mcjzbexpression+">>effh").c_str(), (TCut(emnewPosSide.c_str()))*PlottingSetup::Weight,"goff");
446              nsel += effh->Integral();
447 <            events->Draw((mcjzbexpression+">>effh").c_str(), emnewNegSide.c_str(),"goff");
447 >            events->Draw((mcjzbexpression+">>effh").c_str(), (TCut(emnewNegSide.c_str()))*PlottingSetup::Weight,"goff");
448              nsel -= effh->Integral();
449            }
450          }
# Line 725 | Line 728 | void do_systematics_for_one_file(TTree *
728    if(fabs(jesup)>fabs(jesdown)) res.push_back(fabs(jesup)); else res.push_back(fabs(jesdown));
729    if(fabs(scaleup)>fabs(scaledown)) res.push_back(fabs(scaleup)); else res.push_back(fabs(scaledown));
730   //  res.push_back(fabs(resolution));
731 +  res.push_back(0.0);
732    res.push_back(mceff_nosigcont.getValue());
733    res.push_back(mceff_nosigcont.getError());
734    if(ismSUGRA) res.push_back(PDFuncert);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines