67 |
|
addcut << "(TMath::Abs("<<massgluname<<"-"<<mglu<<")<5)&&(TMath::Abs("<<massLSPname<<"-"<<mlsp<<")<5)"; |
68 |
|
cout << "About to calculate the process efficiencies " << endl; |
69 |
|
///-------------------------------------------------------------------------------------------------------------- |
70 |
+ |
cout << "Addcut : " << addcut.str() << endl; |
71 |
+ |
float m0trees = PlottingSetup::mgluend; |
72 |
+ |
float m12trees = PlottingSetup::mLSPend; |
73 |
+ |
int a = int((PlottingSetup::ScanXzones*mlsp)/(m12trees+1)); |
74 |
+ |
int b = int((PlottingSetup::ScanYzones*mglu)/(m0trees+1)); |
75 |
+ |
int scanfileindex=PlottingSetup::ScanYzones*a+b; |
76 |
+ |
cout << "Going to load file with Xzone=" << a << " and Yzone=" << b << endl; |
77 |
+ |
stringstream filetoload; |
78 |
+ |
filetoload << "/shome/buchmann/ntuples/"; |
79 |
+ |
filetoload << "mSUGRA/mSUGRA_clean_splitup_" << any2string(a) << "_" << any2string(b) << ".root"; |
80 |
+ |
if(!Contains(((scansample.collection)[(scansample.collection).size()-1]).filename,"_"+any2string(a)+"_"+any2string(b))) { |
81 |
+ |
cout << "The last sample is NOT the same one as the current one, possibly popping off last one and adding the new one." << endl; |
82 |
+ |
if((scansample.collection).size()>1) { |
83 |
+ |
scansample.RemoveLastSample(); |
84 |
+ |
} |
85 |
+ |
scanfileindex=(scansample.collection).size(); |
86 |
+ |
//New: Loading file when necessary, not before (avoiding high memory usage and startup times) |
87 |
+ |
if(scanfileindex!=0) scansample.AddSample(filetoload.str(),"scansample",1,1,false,true,scanfileindex,kRed); |
88 |
+ |
} else { |
89 |
+ |
cout << "Last sample is the same as the current one. Recycling it." << endl; |
90 |
+ |
scanfileindex=(scansample.collection).size()-1; |
91 |
+ |
} |
92 |
+ |
|
93 |
+ |
// The following lines actually compute the cross section |
94 |
|
for(int iproc=1;iproc<=10;iproc++) { |
95 |
|
float process_xs = GetXSecForPointAndChannel(mglu,mlsp,xsec,iproc); |
96 |
|
stringstream addcutplus; |
97 |
|
addcutplus<<addcut.str()<<"&&(process=="<<iproc<<")"; |
98 |
< |
(scansample.collection)[0].events->Draw("eventNum",addcutplus.str().c_str(),"goff");//we extract the number of events at this points (m0,m12) which pertain to process i |
99 |
< |
float nprocessevents = (scansample.collection)[0].events->GetSelectedRows(); |
98 |
> |
(scansample.collection)[scanfileindex].events->Draw("eventNum",addcutplus.str().c_str(),"goff"); |
99 |
> |
float nprocessevents = (scansample.collection)[scanfileindex].events->GetSelectedRows(); |
100 |
|
float nselectedprocessevents,nselectedprocesseventserr; |
101 |
< |
cout << "nprocessevents = " << nprocessevents << endl; |
102 |
< |
MCefficiency((scansample.collection)[0].events,nselectedprocessevents,nselectedprocesseventserr,mcjzb,requireZ,1,addcutplus.str(),-1);//1 is the number to normalize to :-) |
101 |
> |
bool bautomatized=automatized; |
102 |
> |
automatized=true; |
103 |
> |
cout << " Process " << iproc << " : "; |
104 |
> |
MCefficiency((scansample.collection)[scanfileindex].events,nselectedprocessevents,nselectedprocesseventserr,mcjzb,requireZ,1,addcutplus.str(),-1);//1 is the number to normalize to :-) |
105 |
> |
automatized=bautomatized; |
106 |
|
float weight=0; |
107 |
|
if(nprocessevents>0) { |
108 |
|
weight=(nselectedprocessevents)/(nprocessevents); |
109 |
|
weightedpointxs+=weight*process_xs; |
110 |
|
totalselected+=nselectedprocessevents; |
84 |
– |
totalevents+=nprocessevents; |
111 |
|
} |
112 |
+ |
totalevents+=nprocessevents; |
113 |
|
} |
114 |
< |
if(totalselected>0) { |
114 |
> |
if(totalselected>0 && weightedpointxs>0) { |
115 |
|
weightedpointxs/=(totalselected/totalevents); |
116 |
+ |
cout << " --> Total cross section: " << weightedpointxs << endl; |
117 |
|
return weightedpointxs; |
118 |
|
} else { |
119 |
|
return 0.0; |
155 |
|
massgluname="M0"; // this is the "x axis" in the limit plot (like the gluino in the SMS case) |
156 |
|
massLSPname="M12"; // this is the "y axis" in the limit plot (like the LSP in the SMS case) |
157 |
|
mglustart=m0start; |
158 |
< |
xsec=getXsec("/scratch/buchmann/C/scale_xsection_nlo1.0_m0_m12_10_0_1v1.txt"); |
131 |
< |
write_warning(__FUNCTION__,"Don't have the correct XS file yet"); |
158 |
> |
xsec=getXsec(PlottingSetup::cbafbasedir+"/Plotting/Modules/external/scale_xsection_nlo1.0_m0_m12_10_0_1v1.txt"); |
159 |
|
mgluend=m0end; |
160 |
|
mglustep=m0step; |
161 |
|
mLSPstart=m12start; |
218 |
|
continue; |
219 |
|
} |
220 |
|
vector<float> sigmas; |
194 |
– |
//do_limit_wrapper(currmceff,currtoterr,ibin,mcjzb,sigmas,plotfilename); // no threading right now. |
221 |
|
sigmas=compute_one_upper_limit(currmceff,currtoterr,ibin,mcjzb,plotfilename,true); |
222 |
+ |
|
223 |
+ |
|
224 |
|
if(sigmas[0]>0) limitmap->Fill(mglu,mlsp,sigmas[0]); //anything else is an error code |
225 |
|
if(sigmas.size()>1) { |
226 |
|
explimitmap->Fill(mglu,mlsp,sigmas[1]); |
236 |
|
float rel_limit=0; |
237 |
|
float xs=get_xs(mglu,mlsp,massgluname,massLSPname,xsec,mcjzb,requireZ); |
238 |
|
if(xs>0) rel_limit=sigmas[0]/xs; |
211 |
– |
// stringstream addcut; |
212 |
– |
// addcut << "(TMath::Abs("<<massgluname<<"-"<<mglu<<")<5)&&(TMath::Abs("<<massLSPname<<"-"<<mlsp<<")<5)"; |
213 |
– |
// vector<float> xs_weights = processMCefficiency((scansample.collection)[0].events,mcjzb,requireZ,nevents, addcut.str()); |
239 |
|
exclmap->Fill(mglu,mlsp,rel_limit); |
240 |
|
xsmap->Fill(mglu,mlsp,xs); |
241 |
|
} |
413 |
|
dout << "This point ("<<ipoint<<") with configuration ("<<massgluname<<"="<<mglu<<" , "<<massLSPname<<"="<<mlsp << ") does not contain enough events and will be skipped."<< endl; |
414 |
|
continue; |
415 |
|
} else { |
416 |
< |
dout << "OK! This point ("<<ipoint<<") with configuration ("<<massgluname<<"="<<mglu<<" , "<<massLSPname<<"="<<mlsp << ") contains " << nevents << " and will therefore not be skipped."<< endl; |
416 |
> |
dout << "OK! This point ("<<ipoint<<") with configuration ("<<massgluname<<"="<<mglu<<" , "<<massLSPname<<"="<<mlsp << ") contains " << nevents << " and will therefore not be skipped. " << endl; |
417 |
> |
write_analysis_type(PlottingSetup::RestrictToMassPeak); |
418 |
|
} |
419 |
|
if(nevents!=0&&efficiencyonly) { |
420 |
|
Value effwosigcont = MCefficiency((scansample.collection)[scanfileindex].events,result,resulterr,mcjzb,requireZ,nevents,addcut.str(),-1); |