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.5 by buchmann, Sun Mar 18 17:53:29 2012 UTC vs.
Revision 1.7 by buchmann, Fri Mar 23 12:04:29 2012 UTC

# Line 24 | Line 24 | using namespace std;
24  
25   using namespace PlottingSetup;
26  
27 + namespace SUSYScanSpace {
28 +  vector<string> loaded_files;
29 +  int SUSYscantype;
30 + }
31 +
32   void susy_scan_axis_labeling(TH2F *histo) {
33    histo->GetXaxis()->SetTitle("m_{#Chi_{2}^{0}}-m_{LSP}");
34    histo->GetXaxis()->CenterTitle();
# Line 67 | Line 72 | void set_SUSY_style() {
72   }
73  
74   bool delete_any_cached_scans() {
75 +  
76 +  
77 +  /*
78    //This should only be called via CRAB
79    cout << "   Deleting all cached files." << endl;
80    gSystem->Exec("ls -ltrh | grep root");
81    char hostname[1023];
82    gethostname(hostname,1023);
83 <  if((Contains(hostname,"t3ui")||Contains(hostname,"t3wn"))) return false;
84 <  else {
83 >  if(!((Contains(hostname,"t3ui")||Contains(hostname,"t3wn"))))
84 >  {
85          vector<string> all_files;
86          char currentpath[1024];
87          TString directory=TString(getcwd(currentpath,1024));
# Line 86 | Line 94 | bool delete_any_cached_scans() {
94                    gSystem->Exec(((string)"rm "+all_files[ifile]).c_str());
95                  }
96          }
97 <  return true;
97 >        return true;
98 >  }
99 >  */
100 >  if(SUSYScanSpace::SUSYscantype==mSUGRA) {
101 >    cout << "Going to purge files in local_storage that have been loaded!" << endl;
102 >    for(int i=0;i<SUSYScanSpace::loaded_files.size();i++) {
103 >      gSystem->Exec(((string)"rm "+SUSYScanSpace::loaded_files[i]).c_str());
104 >      dout << "      Purging : Deleted file " << SUSYScanSpace::loaded_files[i] << endl;
105 >    }
106    }
107 +  return true;
108   }  
109  
110   bool initialized_t2=false;
# Line 103 | Line 120 | void load_scan_sample(int a, int b, int
120    char hostname[1023];
121    gethostname(hostname,1023);
122    string samplename;
123 <  if((Contains(hostname,"t3ui")||Contains(hostname,"t3wn"))) { // local case
123 >  if((Contains(hostname,"t3ui")||Contains(hostname,"t3wn"))&&scantype!=mSUGRA) { // local case
124      filetoload << "/shome/buchmann/ntuples/"<<PlottingSetup::ScanSampleDirectory;
125      if(scantype==mSUGRA) {
126        //filetoload << "/mSUGRA_clean_splitup_" << any2string(a) << "_" << any2string(b) << ".root";
# Line 161 | Line 178 | void load_scan_sample(int a, int b, int
178      if(scantype==SMS) newfilename << "local_storage/SMS_clean_splitup_" << any2string(a) << "_" << any2string(b) << ".root";
179      if(scantype==GMSB) newfilename << "local_storage/GMSB_clean_splitup_" << any2string(a) << "_" << any2string(b) << ".root";
180      
181 <    if(!Contains(((scansample.collection)[(scansample.collection).size()-1]).filename,"_"+any2string(a)+"_"+any2string(b))||(a==0&&b==0)&&!initialized_t2) {
181 >    SUSYScanSpace::SUSYscantype=scantype;
182 >    
183 >    if((scansample.collection).size()==0||!Contains(((scansample.collection)[(scansample.collection).size()-1]).filename,"_"+any2string(a)+"_"+any2string(b))||(a==0&&b==0)&&!initialized_t2) {
184          dout << "The last sample is NOT the same one as the current one, possibly popping off last one and downloading as well as adding the new one." << endl;
185          while((scansample.collection).size()>0) {
186             scansample.RemoveLastSample();
# Line 170 | Line 189 | void load_scan_sample(int a, int b, int
189          scanfileindex=(scansample.collection).size();
190          //New: Loading file when necessary, not before (avoiding high memory usage and startup times)
191          if(1) {
173 //        delete_any_cached_scans();
192            if(!doesROOTFileExist(newfilename.str())) {
193              dout << "Going to download the scan file with the following copy command: " << copyfile.str() << endl;
194 <            gSystem->Exec(copyfile.str().c_str()); // download it if it hasn't been downloaded before
194 >            int retcode = gSystem->Exec(copyfile.str().c_str()); // download it if it hasn't been downloaded before
195 >            if(retcode==0) SUSYScanSpace::loaded_files.push_back(newfilename.str()); // adding it to the list of loaded files (will be deleted once we finish running
196            }
197            if(doesROOTFileExist(newfilename.str())) {
198                  initialized_t2=true;
# Line 355 | Line 374 | void establish_SUSY_limits(string mcjzb,
374    }
375  
376    prepare_scan_axis(limitmap,scantype);
377 +  gSystem->Exec("mkdir -p output");
378    TFile *outputfile=new TFile(("output/DistributedLimitsFromSystematics_job"+string(any2string(jobnumber))+"_of_"+string(any2string(njobs))+".root").c_str(),"UPDATE");//needs to be "UPDATE" as we can get to this point for different JZB cuts and don't want to erase the previous data :-)
379    outputfile->cd();
380    limitmap->Write();
# Line 943 | Line 963 | void scan_SUSY_parameter_space(string mc
963    for(int ibin=0;ibin<jzb_cut.size();ibin++) {
964      scan_SUSY_parameter_space(mcjzb,datajzb,jzb_cut,requireZ, peakerror, ibin, njobs, jobnumber,systonly,effonly);
965    }
966 +  delete_any_cached_scans();// tidy up ...
967   }
968  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines