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

Comparing UserCode/cbrown/AnalysisFramework/Plotting/Modules/SUSYScan.C (file contents):
Revision 1.12 by buchmann, Mon Aug 15 12:38:15 2011 UTC vs.
Revision 1.13 by buchmann, Tue Aug 16 11:47:31 2011 UTC

# Line 185 | Line 185 | void efficiency_scan_in_susy_space(strin
185        }
186        else {
187          efficiencymap->Fill(mglu,mlsp,result);
188 +        efficiencymap->SetBinError(efficiencymap->FindBin(mglu,mlsp),resulterr);
189          dout << "      ok! Added efficiency " << result << " for mlsp=" << mlsp << " and mglu=" << mglu << endl;
190        }
191        
# Line 242 | Line 243 | void do_limit_wrapper(float mceff,float
243    int counter=0;
244    sleep(1); //waiting a second for the process to become active
245    while(counter<limitpatience*60 && isThreadActive) {
246 <    std::cout << "Checking round " << counter << std::endl;
246 >    std::cout << "Limits are being calculated; Checking round " << counter << " ( corresponds to " << seconds_to_time(counter) << " ) , patience will end in " << seconds_to_time(60*60*limitpatience-counter) << std::endl;
247      counter++;
248      sleep(1);
249    }
# Line 271 | Line 272 | void prepare_scan_axis(TH2 *variablemap)
272    variablemap->GetYaxis()->CenterTitle();
273   }
274  
275 < void scan_SUSY_parameter_space(string mcjzb,string datajzb,vector<float> jzb_cut,bool requireZ, float peakerror, int ibin,float njobs=-1, float jobnumber=-1, bool systematicsonly=false) {
275 > void scan_SUSY_parameter_space(string mcjzb,string datajzb,vector<float> jzb_cut,bool requireZ, float peakerror, int ibin,float njobs=-1, float jobnumber=-1, bool systematicsonly=false,bool efficiencyonly=false) {
276    bool runninglocally=true;
277    if(njobs>-1&&jobnumber>-1) {
278      runninglocally=false;
279 <    dout << "Running on the GRID (this is job " << jobnumber << "/" << njobs << ")" << endl;
279 >    dout << "Running on the GRID (this is job " << jobnumber << "/" << njobs << ") for a jzb cut at " << jzb_cut[ibin] << endl;
280    } else {
281      dout << "Running locally " << endl;
282      dout << "This will take a really, really long time - if  you want to see the results THIS week try running the LimitWorkerScript on the grid (DistributedModelCalculation/Limits/)" << endl;
# Line 303 | Line 304 | void scan_SUSY_parameter_space(string mc
304    TH2F *sysjesmap = new TH2F(("sysjes"+any2string(jzbSel)).c_str(),   "",(mgluend-mglustart)/mglustep+1,mglustart-0.5*mglustep,mgluend+0.5*mglustep,(mLSPend-mLSPstart)/mLSPstep+1,mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
305    TH2F *sysjsumap = new TH2F(("sysjsu"+any2string(jzbSel)).c_str(),   "",(mgluend-mglustart)/mglustep+1,mglustart-0.5*mglustep,mgluend+0.5*mglustep,(mLSPend-mLSPstart)/mLSPstep+1,mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
306    TH2F *sysresmap = new TH2F(("sysresmap"+any2string(jzbSel)).c_str(),"",(mgluend-mglustart)/mglustep+1,mglustart-0.5*mglustep,mgluend+0.5*mglustep,(mLSPend-mLSPstart)/mLSPstep+1,mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
307 <  
307 >  TH2F *efficiencymap = new TH2F("efficiencymap","",(mgluend-mglustart)/mglustep+1,mglustart-0.5*mglustep,mgluend+0.5*mglustep,(mLSPend-mLSPstart)/mLSPstep+1,mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
308 >  TH2F *Neventsmap    = new TH2F("Neventsmap","",   (mgluend-mglustart)/mglustep+1,mglustart-0.5*mglustep,mgluend+0.5*mglustep,(mLSPend-mLSPstart)/mLSPstep+1,mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
309    float rightmargin=gStyle->GetPadRightMargin();
310    gStyle->SetPadRightMargin(0.15);
311    
# Line 330 | Line 332 | void scan_SUSY_parameter_space(string mc
332          dout << "Limits can't be calculated for this configuration (mglu="<<mglu<<" , mlsp="<<mlsp << ") as either the efficiency or its error are not numbers! (result="<<result<<" and resulterr="<<resulterr<<")"<< endl;
333          continue;
334        } else {
335 <        dout << "Configuration (mglu="<<mglu<<" , mlsp="<<mlsp << ") passed the mcefficiency test; will compute systematics and limits now." << endl;
335 >        dout << "Configuration (mglu="<<mglu<<" , mlsp="<<mlsp << ") passed the mcefficiency test." << endl;
336 >      }
337 >      if(efficiencyonly) {
338 >        efficiencymap->Fill(mglu,mlsp,result);
339 >        Neventsmap->Fill(mglu,mlsp,result);
340 >        (scansample.collection)[0].events->Draw("eventNum",addcut.str().c_str(),"goff");
341 >        float nevents = (scansample.collection)[0].events->GetSelectedRows();
342 >        Neventsmap->Fill(mglu,mlsp,nevents);
343 >        continue;
344        }
345        do_systematics_for_one_file((scansample.collection)[0].events,"SUSY SCAN", systematics,mcjzb,datajzb,peakerror,requireZ, addcut.str());
346        float JZBcutat = systematics[0][0];
# Line 340 | Line 350 | void scan_SUSY_parameter_space(string mc
350        float sys_jsu  = systematics[0][6]; // JZB scale uncertainty
351        float sys_res  = systematics[0][7]; // resolution
352        
353 <      cout << "EXTRACTED THE FOLLOWING INFORMATION: mceff=" << mceff << " , toterr=" << toterr << " , sys_jes=" << sys_jes << " , sys_jsu=" << sys_jsu << " , sys_res = " << sys_res << endl;
353 > //      cout << "EXTRACTED THE FOLLOWING INFORMATION: mceff=" << mceff << " , toterr=" << toterr << " , sys_jes=" << sys_jes << " , sys_jsu=" << sys_jsu << " , sys_res = " << sys_res << endl;
354        
355        if(mceff!=mceff||toterr!=toterr) {
356          dout << "Limits can't be calculated for this configuration (mglu="<<mglu<<" , mlsp="<<mlsp << ") as either the efficiency or its error are not numbers! (mceff="<<mceff<<" and toterr="<<toterr<<")"<< endl;
357          continue;
358        } else {
359 <        if(!systematicsonly) {
359 >        if(!systematicsonly&&!efficiencyonly) {
360            dout << "Calculating limit now for m_{glu}="<<mglu << " and m_{lsp}="<<mlsp<<endl;
361            vector<float> sigmas;
362            do_limit_wrapper(mceff,toterr,ibin,mcjzb,sigmas);
# Line 356 | Line 366 | void scan_SUSY_parameter_space(string mc
366              dout << "A limit has been added at " << sigmas[0] << " for m_{glu}="<<mglu << " and m_{lsp}="<<mlsp<<endl;
367            } //end of if sigma is positive
368          //end of not systematics only condition
369 <        } else {
369 >        }
370 >        if(systematicsonly) {
371              sysjesmap->Fill(mglu,mlsp,sys_jes);
372              sysjsumap->Fill(mglu,mlsp,sys_jsu);
373              sysresmap->Fill(mglu,mlsp,sys_res);
# Line 370 | Line 381 | void scan_SUSY_parameter_space(string mc
381    prepare_scan_axis(sysjsumap);
382    prepare_scan_axis(sysresmap);
383    
384 <  if(!systematicsonly) {
384 >  if(!systematicsonly&&!efficiencyonly) {
385      limcanvas->cd();
386      limitmap->Draw("COLZ");
387      TText *title = write_title("Limits in LSP-Glu plane");
# Line 384 | Line 395 | void scan_SUSY_parameter_space(string mc
395        limitmap->Write();
396        outputfile->Close();
397      }
398 <  } else { // systematics only :
398 >  }
399 >  if(systematicsonly) { // systematics only :
400      limcanvas->cd();
401      sysjesmap->Draw("COLZ");
402      TText *title = write_title("Jet Energy scale in LSP-Glu plane");
# Line 413 | Line 425 | void scan_SUSY_parameter_space(string mc
425        outputfile->Close();
426      }
427    }//end of systematics only
428 +  if(efficiencyonly) {
429 +    limcanvas->cd();
430 +    efficiencymap->Draw("COLZ");
431 +    TText *title = write_title("Efficiencies in LSP-Glu plane");
432 +    title->Draw();
433 +    if(runninglocally) {
434 +      CompleteSave(limcanvas,"SUSYScan/Efficiency_geq"+any2string(jzb_cut[ibin]));
435 +    }
436 +    limcanvas->cd();
437 +    sysjesmap->Draw("COLZ");
438 +    TText *title2 = write_title("N(events) in LSP-Glu plane");
439 +    title2->Draw();
440 +    if(runninglocally) {
441 +      CompleteSave(limcanvas,"SUSYScan/Nevents_geq"+any2string(jzb_cut[ibin]));
442 +    }
443 +    if(!runninglocally) {
444 +      TFile *outputfile=new TFile(("output/DistributedSystematics_job"+string(any2string(jobnumber))+"_of_"+string(any2string(njobs))+".root").c_str(),"UPDATE");
445 +      Neventsmap->Write();
446 +      efficiencymap->Write();
447 +      outputfile->Close();
448 +    }
449 +  }//end of efficiencies only
450 +  delete limcanvas;
451   }
452  
453 < void scan_SUSY_parameter_space(string mcjzb,string datajzb,vector<float> jzb_cut,bool requireZ, float peakerror, float njobs=-1, float jobnumber=-1, bool systonly=false) {
453 > void scan_SUSY_parameter_space(string mcjzb,string datajzb,vector<float> jzb_cut,bool requireZ, float peakerror, float njobs=-1, float jobnumber=-1, bool systonly=false, bool effonly=false) {
454    dout << "Starting the SUSY scan now with all " << jzb_cut.size() << " bin(s)" << endl;
455    for(int ibin=0;ibin<jzb_cut.size();ibin++) {
456 <    scan_SUSY_parameter_space(mcjzb,datajzb,jzb_cut,requireZ, peakerror, ibin, njobs, jobnumber,systonly);
456 >    scan_SUSY_parameter_space(mcjzb,datajzb,jzb_cut,requireZ, peakerror, ibin, njobs, jobnumber,systonly,effonly);
457    }
458   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines