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

Comparing UserCode/cbrown/Development/Plotting/Modules/SUSYScan.C (file contents):
Revision 1.1 by buchmann, Mon Jan 30 14:46:25 2012 UTC vs.
Revision 1.2 by buchmann, Fri Mar 2 08:40:26 2012 UTC

# Line 172 | Line 172 | void load_scan_sample(int a, int b, int
172  
173   float get_xs(float &altxs, float mglu, float mlsp, string massgluname, string massLSPname, map <  pair<float, float>, map<string, float>  >  &xsec, string mcjzb, bool requireZ)  {
174    altxs=0;
175 +  bool HaveCorrectlyImplementedkFactorsFormSUGRA=false; // still need to work on k factors for mSUGRA!
176 +  assert(HaveCorrectlyImplementedkFactorsFormSUGRA);
177    for(int iproc=1;iproc<=10;iproc++) {
178      float process_xs = GetXSecForPointAndChannel(mglu,mlsp,xsec,iproc);
179      altxs+=process_xs;
# Line 262 | Line 264 | void establish_SUSY_limits(string mcjzb,
264    TH2F *totxsmap  = new TH2F((prefix+"absolutecrosssectionmap"+any2string(jzb_cut[ibin])).c_str(), "",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,(int)((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
265    TH2F *flipmap  = new TH2F((prefix+"limitflipmap"+any2string(jzb_cut[ibin])).c_str(), "",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,(int)((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
266  
265
267    
268    if(!fullerr || !mceff || !NEvents) {
269      write_error(__FUNCTION__,"The supplied systematics file did not contain the correct histograms - please check the file");
# Line 359 | Line 360 | void scan_SUSY_parameter_space(string mc
360    bool runninglocally=true;
361    if(njobs>-1&&jobnumber>-1) {
362      runninglocally=false;
363 +    dout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl;
364      dout << "Running on the GRID (this is job " << jobnumber << "/" << njobs << ") for a jzb cut at " << jzb_cut[ibin] << endl;
365    } else {
366      dout << "Running locally " << endl;
# Line 418 | Line 420 | void scan_SUSY_parameter_space(string mc
420    TH2F *exp1mlimitmap  = new TH2F((prefix+"exp1mlimitmap"+any2string(jzbSel)).c_str(), "",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);//expected limit - 1 sigma
421    TH2F *exp2mlimitmap  = new TH2F((prefix+"exp2mlimitmap"+any2string(jzbSel)).c_str(), "",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);//expected limit - 2 sigma
422    
423 <  TH2F *exclmap  =       new TH2F((prefix+"exclusionmap"+any2string(jzbSel)).c_str(), "",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
424 <  TH2F *sysjesmap =      new TH2F((prefix+"sysjes"+any2string(jzbSel)).c_str(),   "",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
425 <  TH2F *sysjsumap =      new TH2F((prefix+"sysjsu"+any2string(jzbSel)).c_str(),   "",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
426 <  TH2F *sysresmap =      new TH2F((prefix+"sysresmap"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
427 <  TH2F *efficiencymap =  new TH2F((prefix+"efficiencymap"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
428 <  TH2F *efficiencymapmet =  new TH2F((prefix+"efficiencymapmet"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
429 <  TH2F *efficiencymapAcc =  new TH2F((prefix+"efficiencymapAcc"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
430 <  TH2F *efficiencymapID =  new TH2F((prefix+"efficiencymapID"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
423 >  TH2F *exclmap        = new TH2F((prefix+"exclusionmap"+any2string(jzbSel)).c_str(), "",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
424 >  TH2F *sysjesmap      = new TH2F((prefix+"sysjes"+any2string(jzbSel)).c_str(),   "",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
425 >  TH2F *sysjsumap      = new TH2F((prefix+"sysjsu"+any2string(jzbSel)).c_str(),   "",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
426 >  TH2F *sysresmap      = new TH2F((prefix+"sysresmap"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
427 >  TH2F *efficiencymap  = new TH2F((prefix+"efficiencymap"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
428 >  TH2F *efficiencymapmet  =  new TH2F((prefix+"efficiencymapmet"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
429 >  TH2F *efficiencymapAcc  =  new TH2F((prefix+"efficiencymapAcc"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
430 >  TH2F *efficiencymapID   =  new TH2F((prefix+"efficiencymapID"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
431    TH2F *efficiencymapJets =  new TH2F((prefix+"efficiencymapJets"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
432    TH2F *efficiencymapSignal = new TH2F((prefix+"efficiencymapSignal"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
433 +  TH2F *efficiencymapContam = new TH2F((prefix+"efficiencymapContam"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
434    TH2F *noscefficiencymap = new TH2F((prefix+"noscefficiencymap"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
435 <  TH2F *Neventsmap    =  new TH2F((prefix+"Neventsmap"+any2string(jzbSel)).c_str(),"",   (int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
436 <  TH2F *ipointmap    =   new TH2F((prefix+"ipointmap"+any2string(jzbSel)).c_str(),"",   (int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
437 <  TH2F *syspdfmap =      new TH2F((prefix+"syspdfmap"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
438 <  TH2F *systotmap =      new TH2F((prefix+"systotmap"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
439 <  TH2F *sysstatmap =     new TH2F((prefix+"sysstatmap"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
435 >  TH2F *Neventsmap     = new TH2F((prefix+"Neventsmap"+any2string(jzbSel)).c_str(),"",   (int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
436 >  TH2F *ipointmap      = new TH2F((prefix+"ipointmap"+any2string(jzbSel)).c_str(),"",   (int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
437 >  TH2F *syspdfmap      = new TH2F((prefix+"syspdfmap"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
438 >  TH2F *systotmap      = new TH2F((prefix+"systotmap"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
439 >  TH2F *sysstatmap     = new TH2F((prefix+"sysstatmap"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
440  
441 <  TH2F *imposedxmap =    new TH2F((prefix+"imposedxmap"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
442 <  TH2F *realxmap =       new TH2F((prefix+"realxmap"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
441 >  TH2F *imposedxmap;
442 >  TH2F *realxmap;
443  
444 <  TH2F *timemap =        new TH2F((prefix+"timemap"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
444 >  TH2F *timemap        = new TH2F((prefix+"timemap"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
445 >  
446 >  TH2F *flipmap        = new TH2F((prefix+"flipmap"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
447    
448 <  TH2F *flipmap =        new TH2F((prefix+"flipmap"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
448 >  TH2F *nZmap    = new TH2F((prefix+"nZmap"+any2string(jzb_cut[ibin])).c_str(), "",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,(int)((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
449    
450 +  if(ibin==0) {
451 +    imposedxmap    = new TH2F((prefix+"imposedxmap").c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
452 +    realxmap       = new TH2F((prefix+"realxmap").c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
453 +  }
454 +
455 +  vector<int> susy_Zdecay_origin;
456 +  vector<TH2F*> h_susy_Zdecay_origin;
457 +  // we only generate these histograms IF we're dealing with the lowest cut! (we don't need them n times, they're the same for all of them)
458 +  for(int i=1000022;i<1000039;i++) {
459 +    if(ibin>0) continue;
460 +    susy_Zdecay_origin.push_back(i);
461 +    TH2F *susy_dec = new TH2F((prefix+"SUSY_Decay_From_"+any2string(i)+"_to_Z").c_str(), "",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,(int)((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
462 +    h_susy_Zdecay_origin.push_back(susy_dec);
463 +  }
464 +  for(int i=2000006;i<2000016;i++) {
465 +    if(ibin>0) continue;
466 +    susy_Zdecay_origin.push_back(i);
467 +    TH2F *susy_dec = new TH2F((prefix+"SUSY_Decay_From_"+any2string(i)+"_to_Z").c_str(), "",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,(int)((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
468 +    h_susy_Zdecay_origin.push_back(susy_dec);
469 +  }
470 +  
471 +  TH2F *PrimaryZSource    = new TH2F((prefix+"PrimaryZSource").c_str(), "",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,(int)((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
472 +  TH2F *SecondaryZSource    = new TH2F((prefix+"SecondaryZSource").c_str(), "",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,(int)((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
473 +
474   write_warning(__FUNCTION__,"CURRENTLY SWITCHING AUTOMATIZED MODE OFF!");automatized=false;
475  
476    float rightmargin=gStyle->GetPadRightMargin();
# Line 481 | Line 510 | write_warning(__FUNCTION__,"CURRENTLY SW
510        float nevents = (scansample.collection)[scanfileindex].events->GetSelectedRows();
511        vector<vector<float> > systematics;
512        if(nevents<10) {
513 <        dout << "This point ("<<ipoint<<") with configuration ("<<massgluname<<"="<<mglu<<" , "<<massLSPname<<"="<<mlsp << ") does not contain enough events and will be skipped."<< endl;
513 >        dout << "This point ("<<ipoint<<") with configuration ("<<massgluname<<"="<<mglu<<" , "<<massLSPname<<"="<<mlsp << ") does not contain enough events and will be \033[1;31m skipped \033[0m."<< endl;
514          continue;
515        } else {
516 <        dout << "OK! This point ("<<ipoint<<") with configuration ("<<massgluname<<"="<<mglu<<" , "<<massLSPname<<"="<<mlsp << ") contains " << nevents << " and will therefore not be skipped. " << endl;
517 <        write_analysis_type(PlottingSetup::RestrictToMassPeak);
516 >        dout << "OK! This point ("<<ipoint<<") with configuration ("<<massgluname<<"="<<mglu<<" , "<<massLSPname<<"="<<mlsp << ") contains " << nevents << " and will therefore \033[1;32m not be skipped \033[0m. " << endl;
517 >        if(PlottingSetup::RestrictToMassPeak==true) cout << "Analysis type: on-peak" << endl;
518 >        if(PlottingSetup::RestrictToMassPeak==false) cout << "Analysis type: offpeak" << endl;
519 >      }
520 >      float hitrecord=0;
521 >      int hitrecordholder=0;
522 >      float hitsecondplace=0;
523 >      int hitsecondplaceholder=0;
524 >      for(int imo=0;imo<susy_Zdecay_origin.size()&&ibin==0;imo++) {
525 >        if(ibin>0) continue;
526 >        int MotherParticlePDGid = susy_Zdecay_origin[imo];
527 >        (scansample.collection)[scanfileindex].events->Draw("eventNum",("("+addcut.str()+")&&(abs(SourceOfZ-"+any2string(MotherParticlePDGid)+")<0.5)").c_str(),"goff");
528 >        float hits = (scansample.collection)[scanfileindex].events->GetSelectedRows();
529 >        hits/=nevents;
530 >        h_susy_Zdecay_origin[imo]->SetBinContent(GlobalBin,hits);
531 >        if(hits>hitrecord) {
532 >          hitsecondplace=hitrecord;
533 >          hitsecondplaceholder=hitrecordholder;
534 >          hitrecord=hits;
535 >          hitrecordholder=imo;
536 >        }
537 >        if(hits<hitrecord&&hits>hitsecondplace) {
538 >          hitsecondplace=hits;
539 >          hitsecondplaceholder=imo;
540 >        }
541 >      }
542 >      if(ibin==0) {
543 >        PrimaryZSource->SetBinContent(GlobalBin,hitrecordholder);
544 >        SecondaryZSource->SetBinContent(GlobalBin,hitsecondplaceholder);
545 >      }
546 >      
547 >      if(ibin==0) {
548 >        TH1F *realxhisto = new TH1F("realxhisto","realxhisto",1000,0,1);
549 >        (scansample.collection)[scanfileindex].events->Draw("realx>>realxhisto",addcut.str().c_str(),"goff");
550 >        realxmap->SetBinContent(GlobalBin,realxhisto->GetMean());
551 >        realxmap->SetBinError(GlobalBin,realxhisto->GetRMS());
552 >        (scansample.collection)[scanfileindex].events->Draw("imposedx>>realxhisto",addcut.str().c_str(),"goff");
553 >        imposedxmap->SetBinContent(GlobalBin,realxhisto->GetMean());
554 >        imposedxmap->SetBinError(GlobalBin,realxhisto->GetRMS());
555 >        delete realxhisto;
556        }
490      TH1F *realxhisto = new TH1F("realxhisto","realxhisto",1000,0,1);
491      (scansample.collection)[scanfileindex].events->Draw("xSMS>>realxhisto",addcut.str().c_str(),"goff");
492      realxmap->SetBinContent(GlobalBin,realxhisto->GetMean());
493      realxmap->SetBinError(GlobalBin,realxhisto->GetRMS());
494      float impx=0.0;
495      if(Contains(((scansample.collection)[0].filename),"T5zz")) impx=0.5;
496      if(Contains(((scansample.collection)[0].filename),"T5zzl")) impx=0.75;
497      if(Contains(((scansample.collection)[0].filename),"T5zzh")) impx=0.25;
498      imposedxmap->SetBinContent(GlobalBin,impx);
499      delete realxhisto;
557  
558  
559        if(nevents!=0&&(efficiencyonly||systematicsonly)) {
560            Value effwosigcont = MCefficiency((scansample.collection)[scanfileindex].events,result,resulterr,flipped,mcjzb,requireZ,(int)nevents,addcut.str(),-1);
561 <          if(result<0) {
561 >          if(result<0&&allowflipping) {
562                  write_info(__FUNCTION__,"Found negative efficiency (signal distribution populating JZB<0 more than JZB>0) - flipping analysis!");
563                  flipped=1;
564                  MCefficiency((scansample.collection)[scanfileindex].events,result,resulterr,flipped,mcjzb,requireZ,(int)nevents,addcut.str(),-1);
# Line 511 | Line 568 | write_warning(__FUNCTION__,"CURRENTLY SW
568            flipmap->SetBinContent(GlobalBin,flipped);
569            noscefficiencymap->SetBinContent(GlobalBin,effwosigcont.getValue());
570            noscefficiencymap->SetBinError(GlobalBin,effwosigcont.getError());
571 +          efficiencymapContam->SetBinContent(GlobalBin,effwosigcont.getValue()-result);
572 +          efficiencymapContam->SetBinError(GlobalBin,TMath::Sqrt(effwosigcont.getError()+resulterr));
573            //Partial efficiencies
574            float resultAcc, resultID, resultJets, resultSignal, resultmet;
575            float resulterrAcc, resulterrID, resulterrJets, resulterrSignal, resulterrmet;
# Line 636 | Line 695 | write_warning(__FUNCTION__,"CURRENTLY SW
695        efficiencymapJets->Write();
696        efficiencymapSignal->Write();
697        noscefficiencymap->Write();
698 +      efficiencymapContam->Write();
699        syspdfmap->Write();
700        systotmap->Write();
701        sysstatmap->Write();
702 <      imposedxmap->Write();
703 <      realxmap->Write();
702 >      if(ibin==0) imposedxmap->Write();
703 >      if(ibin==0) realxmap->Write();
704        Neventsmap->Write();
705        ipointmap->Write();
706        timemap->Write();
707        outputfile->Close();
708 +      for(int i=0;i<susy_Zdecay_origin.size();i++) {
709 +        h_susy_Zdecay_origin[i]->Write();
710 +      }
711      }
712    }
713    if(systematicsonly) { // systematics only :
# Line 690 | Line 753 | write_warning(__FUNCTION__,"CURRENTLY SW
753        efficiencymapJets->Write();
754        efficiencymapSignal->Write();
755        noscefficiencymap->Write();
756 +      efficiencymapContam->Write();
757        Neventsmap->Write();
758        ipointmap->Write();
759        syspdfmap->Write();
760        systotmap->Write();
761        sysstatmap->Write();
762 <      imposedxmap->Write();
763 <      realxmap->Write();
762 >      if(ibin==0) imposedxmap->Write();
763 >      if(ibin==0) realxmap->Write();
764        timemap->Write();
765        outputfile->Close();
766 +      for(int i=0;i<susy_Zdecay_origin.size();i++) {
767 +        h_susy_Zdecay_origin[i]->Write();
768 +      }
769      }
770    }//end of systematics only
771    if(efficiencyonly) {
# Line 763 | Line 830 | write_warning(__FUNCTION__,"CURRENTLY SW
830        ipointmap->Write();
831        Neventsmap->Write();
832        noscefficiencymap->Write();
833 +      efficiencymapContam->Write();
834        efficiencymap->Write();
835        flipmap->Write();
836        efficiencymapmet->Write();
# Line 775 | Line 843 | write_warning(__FUNCTION__,"CURRENTLY SW
843      }
844    }//end of efficiencies only
845  
846 + for(int i=0;i<susy_Zdecay_origin.size();i++) {
847 +    delete h_susy_Zdecay_origin[i];
848 +  }
849 +  
850 +  delete PrimaryZSource;
851 +  delete SecondaryZSource;
852 +
853 +
854    delete limitmap;
855    delete exclmap;
856    delete sysjesmap;
857    delete sysjsumap;
858    delete sysresmap;
859    delete noscefficiencymap;
860 +  delete efficiencymapContam;
861    delete efficiencymap;
862    delete efficiencymapmet;
863    delete efficiencymapAcc;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines