179 if(sr->hdr.first_in_subrun){
184 if(sr->hdr.ismc)
fNReadouts += sr->hdr.ngenevt;
188 const int nbnb = sr->hdr.bnbinfo.size();
189 const int nnumi = sr->hdr.numiinfo.size();
190 if(nbnb > 0 && nnumi > 0){
191 std::cout <<
"SpectrumLoader: nonzero number of both BNB (" << nbnb
192 <<
") and NuMI (" << nnumi <<
") triggers. I'm confused"
202 if(sr->hdr.husk)
return;
207 if(!spillcutdef.first(sr))
continue;
208 for(
auto& spillweidef: spillcutdef.second){
209 const double wei = spillweidef.first(sr);
210 if(wei == 0)
continue;
211 for(
auto spillvardef: spillweidef.second){
212 if(spillvardef.first.IsMulti()){
213 for(
double val: spillvardef.first.GetMultiVar()(sr)){
214 for(
Spectrum*
s: spillvardef.second.spects) s->Fill(val, wei);
218 const double val = spillvardef.first.GetVar()(sr);
219 for(
Spectrum*
s: spillvardef.second.spects) s->Fill(val, wei);
227 const SpillCut& spillcut = spillcutdef.first;
229 const bool spillpass = spillcut(sr);
231 if(!spillpass)
continue;
238 CutVarCache<bool, Cut, caf::SRSliceProxy> nomCutCache;
239 CutVarCache<double, Var, caf::SRSliceProxy> nomWeiCache;
240 CutVarCache<double, Var, caf::SRSliceProxy> nomVarCache;
242 for(
auto& shiftdef: spillcutdef.second){
243 const SystShifts&
shift = shiftdef.first;
249 caf::SRProxySystController::BeginTransaction();
251 bool shifted =
false;
253 double systWeight = 1;
255 if(!shift.IsNominal()){
256 shift.Shift(&slc, systWeight);
259 shifted = caf::SRProxySystController::AnyShifted();
262 for(
auto& cutdef: shiftdef.second){
263 const Cut& cut = cutdef.first;
265 const bool pass = shifted ? cut(&slc) : nomCutCache.Get(cut, &slc);
269 for(
auto& weidef: cutdef.second){
270 const Var& weivar = weidef.first;
272 double wei = shifted ? weivar(&slc) : nomWeiCache.Get(weivar, &slc);
275 if(wei == 0)
continue;
277 for(
auto& vardef: weidef.second){
278 if(vardef.first.IsMulti()){
279 for(
double val: vardef.first.GetMultiVar()(&slc)){
286 const Var& var = vardef.first.GetVar();
288 const double val = shifted ? var(&slc) : nomVarCache.Get(var, &slc);
290 if(std::isnan(val) || std::isinf(val)){
291 std::cerr <<
"Warning: Bad value: " << val
292 <<
" returned from a Var. The input variable(s) could "
293 <<
"be NaN in the CAF, or perhaps your "
294 <<
"Var code computed 0/0?";
295 std::cout <<
" Not filling into this histogram for this slice." << std::endl;
299 for(
Spectrum*
s: vardef.second.spects) s->Fill(val, wei);
302 const double yval = rw->ReweightVar()(&slc);
304 if(std::isnan(yval) || std::isinf(yval)){
305 std::cerr <<
"Warning: Bad value: " << yval
306 <<
" for reweighting Var";
307 std::cout <<
". Not filling into histogram." << std::endl;
311 rw->fHist->Fill(val, yval, wei);
319 caf::SRProxySystController::Rollback();
BEGIN_PROLOG could also be cerr
friend class ReweightableSpectrum
caf::Proxy< caf::SRSlice > SRSliceProxy
_Var< caf::SRSliceProxy > Var
Representation of a variable to be retrieved from a caf::StandardRecord object.
_Cut< caf::SRSliceProxy > Cut
IDMap< SpillCut, IDMap< SpillVar, IDMap< SpillVarOrMultiVar, SpectList > > > fSpillHistDefs
[spillcut][spillwei][spillvar]
IDMap< SpillCut, IDMap< SystShifts, IDMap< Cut, IDMap< Var, IDMap< VarOrMultiVar, SpectList > > > > > fHistDefs
All the spectra that need to be filled.
_Cut< caf::SRSpillProxy > SpillCut
Equivalent of Cut acting on caf::SRSpill. For use in spill-by-spill data quality cuts.
then echo File list $list not found else cat $list while read file do echo $file sed s
BEGIN_PROLOG could also be cout