Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ana::Prod4DQFailCheck Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-12-03/CAFAna/Cuts/Prod4DQFailCheck.h"

Inheritance diagram for ana::Prod4DQFailCheck:
ana::Prod4DQFailCheckBase

Public Member Functions

 Prod4DQFailCheck ()
 
bool operator() (const caf::SRSpillProxy *sp) const
 

Protected Member Functions

void InitialiseSets (const caf::SRSpillProxy *sp) const
 
bool GetCutResult (const caf::SRSpillProxy *sp) const
 

Protected Attributes

const int fNumiTrig = 0
 
const int fCosmTrig = 2
 
const int fFDId = 2
 
const int fIsMC = 1
 
int fFirstTrigger = -99
 
int fFirstIsMC = -99
 
std::unordered_set< std::vector< std::size_t >, VectorHashfSet_Spills_RS
 
std::unordered_set< std::vector< std::size_t >, VectorHashfSet_Spills_RSE
 

Detailed Description

Definition at line 39 of file Prod4DQFailCheck.h.

Constructor & Destructor Documentation

ana::Prod4DQFailCheck::Prod4DQFailCheck ( )
inline

Member Function Documentation

bool ana::Prod4DQFailCheckBase::GetCutResult ( const caf::SRSpillProxy sp) const
protectedinherited

Definition at line 75 of file Prod4DQFailCheck.cxx.

References febshutoff_auto::end, caf::Proxy< caf::SRSpill >::evt, ana::Prod4DQFailCheckBase::fCosmTrig, ana::Prod4DQFailCheckBase::fFirstTrigger, ana::Prod4DQFailCheckBase::fSet_Spills_RS, ana::Prod4DQFailCheckBase::fSet_Spills_RSE, ana::Prod4DQFailCheckBase::InitialiseSets(), caf::Proxy< caf::SRSpill >::run, and caf::Proxy< caf::SRSpill >::subrun.

Referenced by ana::Prod4DQFailCheckBase::VectorHash::operator()(), and operator()().

76  {
77  InitialiseSets(sp);
78 
79  bool isBad_RS = (fSet_Spills_RS .find({sp->run, sp->subrun})!=fSet_Spills_RS .end());
80  if(fFirstTrigger==fCosmTrig) return !(isBad_RS);
81  else{
82  bool isBad_RSE = (fSet_Spills_RSE.find({sp->run, sp->subrun, sp->evt})!=fSet_Spills_RSE.end());
83  return !(isBad_RS || isBad_RSE);
84  }
85  }
void InitialiseSets(const caf::SRSpillProxy *sp) const
caf::Proxy< unsigned int > evt
Definition: SRProxy.h:1367
std::unordered_set< std::vector< std::size_t >, VectorHash > fSet_Spills_RS
std::unordered_set< std::vector< std::size_t >, VectorHash > fSet_Spills_RSE
caf::Proxy< unsigned int > subrun
Definition: SRProxy.h:1410
caf::Proxy< unsigned int > run
Definition: SRProxy.h:1406
void ana::Prod4DQFailCheckBase::InitialiseSets ( const caf::SRSpillProxy sp) const
protectedinherited

Definition at line 11 of file Prod4DQFailCheck.cxx.

References om::cerr, confusionMatrixTree::count, om::cout, caf::Proxy< caf::SRSpill >::det, allTimeWatchdog::endl, ana::Prod4DQFailCheckBase::fCosmTrig, ana::Prod4DQFailCheckBase::fFDId, ana::Prod4DQFailCheckBase::fFirstTrigger, ana::Prod4DQFailCheckBase::fNumiTrig, ana::Prod4DQFailCheckBase::fSet_Spills_RS, ana::Prod4DQFailCheckBase::fSet_Spills_RSE, ana::run, string, ana::subrun, and caf::Proxy< caf::SRSpill >::trigger.

Referenced by ana::Prod4DQFailCheckBase::GetCutResult(), and ana::Prod4DQFailCheckBase::VectorHash::operator()().

12  {
13  int thisTrig = sp->trigger;
14  int thisDet = sp->det;
15  if(fFirstTrigger==-99) fFirstTrigger = thisTrig;
16  if(fFirstTrigger!=thisTrig){
17  std::cerr << "TRIGGER STREAM SWITCH, SPILL CUTS WILL NO LONGER BE APPLIED CORRECTLY!" << std::endl;
18  std::abort();
19  }
20  if(fFDId!=thisDet){
21  std::cerr << "NEAR DETECTOR LABEL! THIS CUT ONLY APPLIES TO FD!" << std::endl;
22  std::abort();
23  }
24 
25  if(fSet_Spills_RS.size()>0) return;
26 
27  std::cout << "\n\n\nAPPLYING SPILL CUTS MOTIVATED BY PROD4 SPILL INFO\n\n\n" << std::endl;
28 
29  std::string s_BaseDir = "/cvmfs/nova.osgstorage.org/analysis/3flavor/Cuts/";
30  std::string s_FName_RS = "";
31  std::string s_FName_RSE = "";
32  if(thisTrig==fCosmTrig){
33  s_FName_RS = "SpillTreeFile_kFailsStandardDQCuts_full_WithPatch_ForCosmics_Including_dbmask_RunSubrun_NonDegen.txt";
34  }
35  else if(thisTrig==fNumiTrig){
36  s_FName_RS = "dbmask_RunSubrun_NonDegen.txt";
37  s_FName_RSE = "SpillTreeFile_kFailsStandardDQCuts_full_WithPatch.txt";
38  }
39  else{
40  std::cerr << "TRIGGER TYPE NOT RECOGNISED!" << std::endl;
41  std::abort();
42  }
43 
44  std::ifstream f_SpillList;
45  f_SpillList.open(s_BaseDir+s_FName_RS);
46  std::size_t event, isgoodspill, run, subrun;
47  std::size_t count = 0;
48  while(f_SpillList >> run >> subrun){
49  std::vector<std::size_t> vec_Spill;
50  vec_Spill = {run, subrun};
51  fSet_Spills_RS.insert(vec_Spill);
52  count++;
53  }
54  f_SpillList.close();
55 
56  //std::cout << "COMPARING RS CONTAINER SIZES: " << fSet_Spills_RS.size() << " " << count << std::endl;
57  if(fSet_Spills_RS.size() < count) std::cout << "\n\n\nWARNING!!! SET HAS FEWER LINES THAN INPUT FILE\n\n\n";
58 
59  if(s_FName_RSE!=""){
60  count = 0;
61  f_SpillList.open(s_BaseDir+s_FName_RSE);
62  while(f_SpillList >> event >> isgoodspill >> run >> subrun){
63  std::vector<std::size_t> vec_Spill;
64  vec_Spill = {run, subrun, event};
65  fSet_Spills_RSE.insert(vec_Spill);
66  count++;
67  }
68  //std::cout << "COMPARING RSE CONTAINER SIZES: " << fSet_Spills_RSE.size() << " " << count << std::endl;
69  if(fSet_Spills_RSE.size() < count) std::cout << "\n\n\nWARNING!!! SET HAS FEWER LINES THAN INPUT FILE\n\n\n";
70  }
71 
72  return;
73  }
OStream cerr
Definition: OStream.cxx:7
caf::Proxy< unsigned char > trigger
Definition: SRProxy.h:1411
std::unordered_set< std::vector< std::size_t >, VectorHash > fSet_Spills_RS
std::unordered_set< std::vector< std::size_t >, VectorHash > fSet_Spills_RSE
OStream cout
Definition: OStream.cxx:6
int run
Definition: NusVarsTemp.cxx:51
caf::Proxy< caf::Det_t > det
Definition: SRProxy.h:1361
int subrun
Definition: NusVarsTemp.cxx:52
enum BeamMode string
bool ana::Prod4DQFailCheck::operator() ( const caf::SRSpillProxy sp) const

Definition at line 87 of file Prod4DQFailCheck.cxx.

References om::cerr, allTimeWatchdog::endl, ana::Prod4DQFailCheckBase::fFirstIsMC, ana::Prod4DQFailCheckBase::fIsMC, ana::Prod4DQFailCheckBase::GetCutResult(), caf::Proxy< caf::SRSpill >::ismc, and ana::kStandardDQCuts.

88  {
89  int thisIsMC = sp->ismc;
90  if(fFirstIsMC==-99) fFirstIsMC = thisIsMC;
91  if(fFirstIsMC!=thisIsMC){
92  std::cerr << "SWITCH BETWEEN DATA AND MC, SPILL CUTS WILL NO LONGER BE APPLIED CORRECTLY!" << std::endl;
93  std::abort();
94  }
95 
96  // IF RUNNING OVER MC, GO BACK TO THE STANDARD DQ CUTS.
97  if(thisIsMC==fIsMC) return kStandardDQCuts(sp);
98  return GetCutResult(sp);
99  }
OStream cerr
Definition: OStream.cxx:7
bool GetCutResult(const caf::SRSpillProxy *sp) const
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
caf::Proxy< bool > ismc
Definition: SRProxy.h:1378

Member Data Documentation

const int ana::Prod4DQFailCheckBase::fCosmTrig = 2
protectedinherited
const int ana::Prod4DQFailCheckBase::fFDId = 2
protectedinherited

Definition at line 31 of file Prod4DQFailCheck.h.

Referenced by ana::Prod4DQFailCheckBase::InitialiseSets().

int ana::Prod4DQFailCheckBase::fFirstIsMC = -99
mutableprotectedinherited

Definition at line 34 of file Prod4DQFailCheck.h.

Referenced by operator()().

int ana::Prod4DQFailCheckBase::fFirstTrigger = -99
mutableprotectedinherited
const int ana::Prod4DQFailCheckBase::fIsMC = 1
protectedinherited

Definition at line 32 of file Prod4DQFailCheck.h.

Referenced by operator()().

const int ana::Prod4DQFailCheckBase::fNumiTrig = 0
protectedinherited

Definition at line 29 of file Prod4DQFailCheck.h.

Referenced by ana::Prod4DQFailCheckBase::InitialiseSets().

std::unordered_set<std::vector<std::size_t>,VectorHash> ana::Prod4DQFailCheckBase::fSet_Spills_RS
mutableprotectedinherited
std::unordered_set<std::vector<std::size_t>,VectorHash> ana::Prod4DQFailCheckBase::fSet_Spills_RSE
mutableprotectedinherited

The documentation for this class was generated from the following files: