69 |
|
bool delete_any_cached_scans() { |
70 |
|
//This should only be called via CRAB |
71 |
|
cout << " Deleting all cached files." << endl; |
72 |
+ |
gSystem->Exec("ls -ltrh | grep root"); |
73 |
|
char hostname[1023]; |
74 |
|
gethostname(hostname,1023); |
75 |
|
if((Contains(hostname,"t3ui")||Contains(hostname,"t3wn"))) return false; |
94 |
|
|
95 |
|
int srmcpretries=0; |
96 |
|
|
97 |
< |
void load_scan_sample(int a, int b, int &scanfileindex,int scantype) { |
97 |
> |
void load_scan_sample(int a, int b, int &scanfileindex,int scantype,bool isretry=false) { |
98 |
|
|
99 |
|
// There is no need to define your sample here. That is done in Setup.C where you define the loading directory! |
100 |
|
|
128 |
|
stringstream copyfile; |
129 |
|
copyfile << "lcg-cp -b -T srmv2 srm://storage01.lcg.cscs.ch:8443/srm/managerv2?SFN=/pnfs/lcg.cscs.ch/cms/trivcat/store/user/buchmann/bussola/" << PlottingSetup::ScanSampleDirectory; |
130 |
|
if(scantype==mSUGRA) copyfile << "/mSUGRA_clean_splitup_" << any2string(a) << "_" << any2string(b) << ".root " << "mSUGRA_clean_splitup_" << any2string(a) << "_" << any2string(b) << ".root "; |
131 |
< |
if(scantype==SMS) copyfile << "/SMS_clean_splitup_" << any2string(a) << "_" << any2string(b) << ".root " << "mSUGRA_clean_splitup_" << any2string(a) << "_" << any2string(b) << ".root "; |
132 |
< |
if(scantype==GMSB) copyfile << "/GMSB_clean_splitup_" << any2string(a) << "_" << any2string(b) << ".root " << "mSUGRA_clean_splitup_" << any2string(a) << "_" << any2string(b) << ".root "; |
131 |
> |
if(scantype==SMS) copyfile << "/SMS_clean_splitup_" << any2string(a) << "_" << any2string(b) << ".root " << "SMS_clean_splitup_" << any2string(a) << "_" << any2string(b) << ".root "; |
132 |
> |
if(scantype==GMSB) copyfile << "/GMSB_clean_splitup_" << any2string(a) << "_" << any2string(b) << ".root " << "GMSB_clean_splitup_" << any2string(a) << "_" << any2string(b) << ".root "; |
133 |
|
stringstream newfilename; |
134 |
|
if(scantype==mSUGRA) newfilename << "mSUGRA_clean_splitup_" << any2string(a) << "_" << any2string(b) << ".root"; |
135 |
|
if(scantype==SMS) newfilename << "SMS_clean_splitup_" << any2string(a) << "_" << any2string(b) << ".root"; |
142 |
|
} |
143 |
|
scanfileindex=(scansample.collection).size(); |
144 |
|
//New: Loading file when necessary, not before (avoiding high memory usage and startup times) |
145 |
< |
if(scanfileindex!=0) { |
145 |
> |
if(scanfileindex!=0||isretry) { |
146 |
|
delete_any_cached_scans(); |
147 |
|
dout << "Going to download the scan file with the following copy command: " << copyfile.str() << endl; |
148 |
|
gSystem->Exec(copyfile.str().c_str()); |
154 |
|
if(srmcpretries<5) { |
155 |
|
dout << "The file could not be loaded correctly - retrying!" << endl; |
156 |
|
sleep(5); |
157 |
< |
load_scan_sample(a,b,scanfileindex,scantype); |
157 |
> |
load_scan_sample(a,b,scanfileindex,scantype,true); |
158 |
|
} else { |
159 |
|
dout << "Have tried 5 times to load this sample. Giving up now and failing the program execution" << endl; |
160 |
|
assert(0); |
435 |
|
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); |
436 |
|
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); |
437 |
|
|
438 |
+ |
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); |
439 |
+ |
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); |
440 |
+ |
|
441 |
|
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); |
442 |
|
|
443 |
|
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); |
487 |
|
dout << "OK! This point ("<<ipoint<<") with configuration ("<<massgluname<<"="<<mglu<<" , "<<massLSPname<<"="<<mlsp << ") contains " << nevents << " and will therefore not be skipped. " << endl; |
488 |
|
write_analysis_type(PlottingSetup::RestrictToMassPeak); |
489 |
|
} |
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; |
500 |
+ |
|
501 |
+ |
|
502 |
|
if(nevents!=0&&(efficiencyonly||systematicsonly)) { |
503 |
|
Value effwosigcont = MCefficiency((scansample.collection)[scanfileindex].events,result,resulterr,flipped,mcjzb,requireZ,(int)nevents,addcut.str(),-1); |
504 |
|
if(result<0) { |
639 |
|
syspdfmap->Write(); |
640 |
|
systotmap->Write(); |
641 |
|
sysstatmap->Write(); |
642 |
+ |
imposedxmap->Write(); |
643 |
+ |
realxmap->Write(); |
644 |
|
Neventsmap->Write(); |
645 |
|
ipointmap->Write(); |
646 |
|
timemap->Write(); |
695 |
|
syspdfmap->Write(); |
696 |
|
systotmap->Write(); |
697 |
|
sysstatmap->Write(); |
698 |
+ |
imposedxmap->Write(); |
699 |
+ |
realxmap->Write(); |
700 |
|
timemap->Write(); |
701 |
|
outputfile->Close(); |
702 |
|
} |