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.5 by buchmann, Mon Jul 25 06:49:34 2011 UTC vs.
Revision 1.6 by buchmann, Mon Jul 25 15:57:41 2011 UTC

# Line 214 | Line 214 | void efficiency_scan_in_susy_space(strin
214    CompleteSave(effcanvas,"SUSYScan/Nevents");
215   }
216  
217 < void scan_SUSY_parameter_space(string mcjzb,string datajzb,vector<float> jzb_cut,bool requireZ, float peakerror, int ibin) {
217 > 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) {
218 >  
219 >  bool runninglocally=true;
220 >  if(njobs>-1&&jobnumber>-1) {
221 >    runninglocally=false;
222 >    cout << "Running on the GRID (this is job " << jobnumber << "/" << njobs << ")" << endl;
223 >  } else {
224 >    cout << "Running locally " << endl;
225 >  }
226    
227    jzbSel=jzb_cut[ibin];
228    geqleq="geq";
# Line 234 | Line 242 | void scan_SUSY_parameter_space(string mc
242    
243    gStyle->SetPalette(100, MyPalette);
244    
245 <  TH2F *limitmap = new TH2F("limitmap","",(mgluend-mglustart)/mglustep+1,mglustart-0.5*mglustep,mgluend+0.5*mglustep,(mLSPend-mLSPstart)/mLSPstep+1,mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
245 >  TH2F *limitmap = new TH2F(("limitmap"+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);
246    
247    float rightmargin=gStyle->GetPadRightMargin();
248    gStyle->SetPadRightMargin(0.15);
249    
250    TCanvas *limcanvas = new TCanvas("limcanvas","Limit canvas");
251    
252 +  
253 +  int Npoints=0;
254 +  for(int mglu=mglustart;mglu<=mgluend;mglu+=mglustep) {
255 +    for (int mlsp=mLSPstart;mlsp<=mLSPend&&mlsp<=mglu;mlsp+=mLSPstep) Npoints++;
256 +  }
257 +  
258 +  int ipoint=-1;
259    for(int mglu=mglustart;mglu<=mgluend;mglu+=mglustep) {
260      for (int mlsp=mLSPstart;mlsp<=mLSPend&&mlsp<=mglu;mlsp+=mLSPstep)
261      {
262 +      ipoint++;
263 +      if(!runninglocally&&!do_this_point(ipoint,Npoints,jobnumber,njobs)) continue;
264        float result,resulterr;
265        stringstream addcut;
266        addcut << "(TMath::Abs("<<massgluname<<"-"<<mglu<<")<5)&&(TMath::Abs("<<massLSPname<<"-"<<mlsp<<")<5)";
267        vector<vector<float> > systematics;
268 +      MCefficiency((scansample.collection)[0].events,result,resulterr,mcjzb,requireZ,addcut.str());
269 +      if(result!=result||resulterr!=resulterr) {
270 +        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;
271 +        continue;
272 +      } else {
273 +        dout << "Configuration (mglu="<<mglu<<" , mlsp="<<mlsp << ") passed the mcefficiency test; will establish limits now." << endl;
274 +      }
275        do_systematics_for_one_file((scansample.collection)[0].events,"SUSY SCAN", systematics,mcjzb,datajzb,peakerror,requireZ, addcut.str());
276        float JZBcutat=systematics[0][0];
277        float mceff=systematics[0][1];
278        float toterr =systematics[0][4];
279        if(mceff!=mceff||toterr!=toterr) {
280 <        dout << "Limits can't be calculated in this configuration as either the efficiency or its error are not numbers! (mceff="<<mceff<<" and toterr="<<toterr<<")"<< endl;
280 >        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;
281          continue;
282        } else {
283 +        dout << "Calculating limit now for m_{glu}="<<mglu << " and m_{lsp}="<<mlsp<<endl;
284          vector<float> sigmas = compute_one_upper_limit(mceff,toterr,ibin,mcjzb);
285          limitmap->Fill(mglu,mlsp,sigmas[0]);
286          dout << "A limit has been added at " << sigmas[0] << " for m_{glu}="<<mglu << " and m_{lsp}="<<mlsp<<endl;
# Line 277 | Line 302 | void scan_SUSY_parameter_space(string mc
302    limitmap->Draw("COLZ");
303    TText *title = write_title("Limits in LSP-Glu plane");
304    title->Draw();
305 <  CompleteSave(limcanvas,"SUSYScan/Limits_JZB_geq"+any2string(jzb_cut[ibin]));
305 >  if(runninglocally) {
306 >    CompleteSave(limcanvas,"SUSYScan/Limits_JZB_geq"+any2string(jzb_cut[ibin]));
307 >  } else {
308 >    TFile *outputfile=new TFile(("output/DistributedLimits_job"+string(any2string(jobnumber))+"_of_"+string(any2string(njobs))+".root").c_str(),"UPDATE");
309 >    limitmap->Write();
310 >    outputfile->Close();
311 >  }
312   }
313  
314 < void scan_SUSY_parameter_space(string mcjzb,string datajzb,vector<float> jzb_cut,bool requireZ, float peakerror) {
314 > void scan_SUSY_parameter_space(string mcjzb,string datajzb,vector<float> jzb_cut,bool requireZ, float peakerror, float njobs=-1, float jobnumber=-1) {
315    for(int ibin=0;ibin<jzb_cut.size();ibin++) {
316 <    scan_SUSY_parameter_space(mcjzb,datajzb,jzb_cut,requireZ, peakerror, ibin);
316 >    scan_SUSY_parameter_space(mcjzb,datajzb,jzb_cut,requireZ, peakerror, ibin, njobs, jobnumber);
317    }
318 < }
318 > }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines