SpillCuts.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include "CAFAna/Core/Cut.h"
5 
6 namespace ana
7 {
9 
11 
12  /// Same as kTightBeamQualityCuts but without any check on spill.hornI
14 
15  /// Cut out events with a noisy detector or with parts missing
16  extern const SpillCut kStandardDQCuts;
17 
18  // Prod4 motivated FD DQ Cut.
19  // Full details can be found in docdb-45047
20  // ***IN THE CASE OF DATA:***
21  // Cut removes spills (in NuMI stream) and subruns (in cosmic stream) which would have failed
22  // kStandardDQCuts in Production4.
23  // Cut also removes runs / subruns affected by dbmask issue. docdb-44668. (Entire subrun
24  // removed even in NuMI stream).
25  // ***IN THE CASE OF MC (NuMI and CRY):***
26  // The cut is identical to kStandardDQCuts.
27  // DO NOT USE ON TNE ND (Macro will fail.)
29 
30  extern const SpillCut kGoodSpill;
31  extern const SpillCut kComplete;
32  extern const SpillCut kMissingDCM;
33  extern const SpillCut kOutofSync;
34 
35  //Quick and dirty stopgap to filter bad runs
36  extern const SpillCut kRunsFilter;
37 
38  //Cut to remove any spill with a gap in the diblock mask.
40 
41  //Cut to remove any spills that do not have any continuous segments larger then four diblocks
43 
44  // Now, make sure that the spill RHC flag matches what it should be, based on
45  // run numbers
47 
48  /// Apply this unless you're doing something special
49  const SpillCut kStandardSpillCuts = kStandardDQCuts
50  && kTightBeamQualityCuts
51  && kRunsFilter
52  && kRemoveSmallMasks
54 
55  /// Whether this spill is horn-off according to spill.is0HC
56  extern const SpillCut kHornOff;
57 
58  /// Spill cuts appropriate for use with 0HC data. Ensures the running mode is
59  /// truly 0HC. Reproduces usual spill cuts without a horn current check.
60  const SpillCut kStandardSpillCuts0HC = kStandardDQCuts &&
61  kTightBeamQualityCuts0HC &&
62  kRunsFilter &&
63  kRemoveSmallMasks &&
64  kHornOff;
65 
66  // Standard spill cut which uses the Prod4 DQ spill quality information. See extern declaration above
67  // for details.
68  // DO NOT USE ON TNE ND (Macro will fail.)
69  const SpillCut kStandardSpillCuts_FD_Prod4MotivatedDQ = kStandardDQCuts_FD_Prod4Motivated
70  && kTightBeamQualityCuts
71  && kRunsFilter
72  && kRemoveSmallMasks
74 
75 } // namespace
const SpillCut kStandardSpillCuts_FD_Prod4MotivatedDQ
Definition: SpillCuts.h:69
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
const SpillCut kRunsFilter([](const caf::SRSpillProxy *s){static std::set< int > warned;if(s->det!=caf::kFARDET) return true;if(kFilteredRunList.find(s->run)==kFilteredRunList.end()) return true;else{ if(!warned.count(s->run)&&!s->ismc) std::cout<<"\n!!WARNING!!Event in Run "<< s->run<<" was removed by manual bad runs list \n"<<"(CAFAna/Cuts/FilteredRunList.h).\n"<<"THIS SHOULD NOT HAPPEN!! REPORT INCIDENT TO DQ \n"<<"AND PRODUCTION GROUPS SO THIS RUN CAN BE LOGGED IN \n"<<"THE DATABASE WHERE IT IS SUPPOSED TO BE AND NOT IN \n"<<"A TEXT FILE!!!"<< std::endl;warned.insert(s->run);return false;}})
Definition: SpillCuts.h:36
const SpillCut kRemoveGappyDBMask([](const caf::SRSpillProxy *spill){if(spill->det!=caf::kFARDET) return true;std::bitset< 14 > binary(spill->dibmask);bool nogap=true;for(int i=0;i< 14;++i){int dbcount=i+1;if(dbcount >=spill->dibfirst && dbcount<=spill->diblast && binary[i]==0) nogap=false;}return nogap;})
Definition: SpillCuts.h:39
const SpillCut kStandardDQCuts_FD_Prod4Motivated
const SpillCut kGoodSpill([](const caf::SRSpillProxy *spill){if(spill->dcmedgematchfrac==0 &&spill->fracdcm3hits==0 &&spill->nmissingdcmslg==0) return bool(spill->isgoodspill);return true;})
Definition: SpillCuts.h:30
const SpillCut kHornPolarityCheck([](const caf::SRSpillProxy *sr){if(sr->ismc) return true;int run=sr->run;if(sr->trigger==2) return true;bool shouldBeRHC=false;if(sr->det==1){if((run > 11631 &&run< 11668)|| (run > 11920 &&run< 11926)|| (run > 12086 &&run< 12290)|| (run > 12516 &&run< 12795)|| (run > 12955 &&run< 13132)){shouldBeRHC=true;}}else{if((run > 23419 &&run< 23671)|| (run > 24587 &&run< 24614)|| (run > 25412 &&run< 26686)|| (run > 28036 &&run< 30227)|| (run > 31167 &&run< 32398)){shouldBeRHC=true;}} return(sr->isRHC==shouldBeRHC);})
Definition: SpillCuts.h:46
const SpillCut kRemoveSmallMasks([](const caf::SRSpillProxy *spill){if(spill->det!=caf::kFARDET) return true;std::bitset< 14 > binary(spill->dibmask);int masksize=0;for(int i=0;i< 14;++i){if(binary[i]) masksize++;else{if(masksize >=4) return true;masksize=0;}}if(masksize >=4) return true;return false;})
Definition: SpillCuts.h:42
const SpillCut kTightBeamQualityCuts([](const caf::SRSpillProxy *s){if(s->ismc) return true; if(s->trigger==2) return true;if(s->spilltimesec==0 &&s->deltaspilltimensec==0 &&s->widthx==0) return bool(s->isgoodspill);if(std::abs(s->deltaspilltimensec) > 0.5e9) return false;if(s->spillpot< 2e12) return false;if(s->hornI< -202|| s->hornI >-198) return false;if(s->posx< -2.00|| s->posx >+2.00) return false;if(s->posy< -2.00|| s->posy >+2.00) return false;return kBeamWidthCut(s);})
Definition: SpillCuts.h:10
const SpillCut kHornOff([](const caf::SRSpillProxy *sr){return sr->is0HC;})
Whether this spill is horn-off according to spill.is0HC.
Definition: SpillCuts.h:56
const SpillCut kOutofSync([](const caf::SRSpillProxy *spill){if(spill->det==caf::kFARDET &&!spill->ismc &&spill->dcmedgematchfrac<=0.2) return false;return true;})
Definition: SpillCuts.h:33
const SpillCut kTightBeamQualityCuts0HC([](const caf::SRSpillProxy *s){if(s->ismc) return true; if(s->trigger==2) return true;if(s->spilltimesec==0 &&s->deltaspilltimensec==0 &&s->widthx==0) return bool(s->isgoodspill);if(std::abs(s->deltaspilltimensec) > 0.5e9) return false;if(s->spillpot< 2e12) return false;if(s->posx< -2.00|| s->posx >+2.00) return false;if(s->posy< -2.00|| s->posy >+2.00) return false;return kBeamWidthCut(s);})
Same as kTightBeamQualityCuts but without any check on spill.hornI.
Definition: SpillCuts.h:13
const SpillCut kLooseBeamQualityCuts([](const caf::SRSpillProxy *s){if(s->ismc) return true; if(s->trigger==2) return true;if(std::abs(s->deltaspilltimensec) > 1e9) return false;if(s->spillpot< 0.5e12) return false;if(s->hornI< -205|| s->hornI >-195) return false;if(s->posx< -2.00|| s->posx >+2.00) return false;if(s->posy< -2.00|| s->posy >+2.00) return false;return kBeamWidthCut(s);})
Definition: SpillCuts.h:8
const SpillCut kStandardDQCuts([](const caf::SRSpillProxy *spill){if(spill->dcmedgematchfrac==0 &&spill->fracdcm3hits==0 &&spill->nmissingdcmslg==0) return bool(spill->isgoodspill); if(spill->det==caf::kNEARDET && (spill->fracdcm3hits > 0.45|| spill->nmissingdcms > 0)) return false; if(spill->eventincomplete) return false; if(spill->det==caf::kFARDET && spill->nmissingdcmslg > 0) return false; if(spill->det==caf::kFARDET && !spill->ismc && spill->dcmedgematchfrac<=0.2) return false;return true;})
Cut out events with a noisy detector or with parts missing.
Definition: SpillCuts.h:16
const SpillCut kMissingDCM([](const caf::SRSpillProxy *spill){ if(spill->det==caf::kNEARDET && (spill->fracdcm3hits > 0.45|| spill->nmissingdcms > 0)) return false;if(spill->det==caf::kFARDET &&spill->nmissingdcmslg > 0) return false;return true;})
Definition: SpillCuts.h:32
const SpillCut kComplete([](const caf::SRSpillProxy *spill){if(spill->eventincomplete) return false;return true;})
Definition: SpillCuts.h:31
const SpillCut kStandardSpillCuts0HC
Definition: SpillCuts.h:60
const SpillCut kStandardSpillCuts
Apply this unless you&#39;re doing something special.
Definition: SpillCuts.h:49
Template for Cut and SpillCut.
Definition: Cut.h:15