All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
icarus::crt::CRTAutoVeto Class Reference
Inheritance diagram for icarus::crt::CRTAutoVeto:

Public Member Functions

 CRTAutoVeto (fhicl::ParameterSet const &p)
 
 CRTAutoVeto (CRTAutoVeto const &)=delete
 
 CRTAutoVeto (CRTAutoVeto &&)=delete
 
CRTAutoVetooperator= (CRTAutoVeto const &)=delete
 
CRTAutoVetooperator= (CRTAutoVeto &&)=delete
 
void analyze (art::Event const &e) override
 

Private Member Functions

bool IsAV (TVector3 const &point)
 
bool IsFV (TVector3 const &point)
 

Private Attributes

art::InputTag fGenLabel
 
art::InputTag fSimLabel
 
art::InputTag fCRTHitLabel
 
double fFidXOut
 
double fFidXIn
 
double fFidYTop
 
double fFidYBot
 
double fFidZUp
 
double fFidZDown
 
CRTBackTrackerbt
 
CRTCommonUtilscrtutil
 
geo::GeometryCore const * fGeoService
 
TEfficiency * fVetoEffAV
 
TEfficiency * fVetoEffFV
 
TEfficiency * fVetoEffAV_tot
 
TEfficiency * fVetoEffFV_tot
 
TTree * fTree
 
int fEvent
 
int fNumNu
 
int fNuPDG
 
float fNuE
 
bool fNuCC
 
bool fNuAV
 
bool fNuFV
 
vector< double > fNuXYZT
 
int fNuInt
 
int fNuMode
 
double fNuLepE
 
double fNuTheta
 
int fNHit
 
vector< int > fHitRegs
 
vector< vector< float > > fHitXYZT
 
vector< vector< int > > fHitPDGs
 
vector< int > fNHitPDGs
 
vector< int > fHitMaxPDG
 
vector< float > fDist
 
vector< float > fDelay
 

Detailed Description

Definition at line 60 of file CRTAutoVeto_module.cc.

Constructor & Destructor Documentation

CRTAutoVeto::CRTAutoVeto ( fhicl::ParameterSet const &  p)
explicit

Definition at line 131 of file CRTAutoVeto_module.cc.

132  : EDAnalyzer{p} ,
133  fGenLabel(p.get<art::InputTag>("GenLabel","generator")),
134  fSimLabel(p.get<art::InputTag>("SimLabel","largeant")),
135  fCRTHitLabel(p.get<art::InputTag>("CRTHitLabel","crthit")),
136  fFidXOut(p.get<double>("FiducialXOuter", 25.0)),
137  fFidXIn(p.get<double>("FiducialXInner", 0.0)),
138  fFidYTop(p.get<double>("FiducialYTop", 25.0)),
139  fFidYBot(p.get<double>("FiducialYBottom",25.0)),
140  fFidZUp(p.get<double>("FiducialZUpstream",30.0)),
141  fFidZDown(p.get<double>("FiducialZDownstream",50.0)),
142  bt(new CRTBackTracker(p.get<fhicl::ParameterSet>("CRTBackTrack"))),
143  crtutil(new CRTCommonUtils())
144 {
145  fGeoService = lar::providerFrom<geo::Geometry>();
146 
147  // Access ART's TFileService, which will handle creating and writing
148  // histograms and n-tuples for us.
149  art::ServiceHandle<art::TFileService> tfs;
150 
151  Double_t bins[14] = {0.2,0.35,0.5,0.65,0.8,0.95,1.1,1.3,1.5,1.75,2.,3.,5.,10.};
152  fVetoEffAV = new TEfficiency("effAV","#nu Veto Efficiency (AV)",13,bins);
153  fVetoEffFV = new TEfficiency("effFV","#nu Veto Efficiency (FV)",13,bins);
154  fVetoEffAV_tot = new TEfficiency("effAVTot","#nu Veto Efficiency (AV)",1,0,2);
155  fVetoEffFV_tot = new TEfficiency("effFVTot","#nu Veto Efficiency (FV)",1,0,2);
156 
157  //Tree
158  fTree = tfs->make<TTree>("VetoTree", "auto-veto info");
159  fTree->Branch("event", &fEvent, "event/I");
160  fTree->Branch("numNu", &fNumNu, "numNu/I");
161  fTree->Branch("nuPDG", &fNuPDG, "nuPDG/I");
162  fTree->Branch("nuE", &fNuE, "nuE/F");
163  fTree->Branch("cc", &fNuCC, "cc/O");
164  fTree->Branch("av", &fNuAV, "av/O");
165  fTree->Branch("fv", &fNuFV, "fv/O");
166  fTree->Branch("nuXYZT", &fNuXYZT);
167  fTree->Branch("nuLepE", &fNuLepE, "nuLepE/D");
168  fTree->Branch("nuTheta", &fNuTheta,"nuTheta/D");
169  fTree->Branch("nuMode", &fNuMode, "nuMode/I");
170  fTree->Branch("nuInt", &fNuInt, "nuInt/I");
171  fTree->Branch("nHit", &fNHit, "numHit/I");
172  fTree->Branch("hitReg", &fHitRegs);
173  fTree->Branch("hitXYZT", &fHitXYZT);
174  fTree->Branch("hitPDG", &fHitPDGs);
175  fTree->Branch("nHitPDG", &fNHitPDGs);
176  fTree->Branch("hitMaxPDG",&fHitMaxPDG);
177  fTree->Branch("dist", &fDist);
178  fTree->Branch("delay", &fDelay);
179 
180 }
pdgs p
Definition: selectors.fcl:22
vector< vector< int > > fHitPDGs
geo::GeometryCore const * fGeoService
vector< vector< float > > fHitXYZT
art::ServiceHandle< art::TFileService > tfs
icarus::crt::CRTAutoVeto::CRTAutoVeto ( CRTAutoVeto const &  )
delete
icarus::crt::CRTAutoVeto::CRTAutoVeto ( CRTAutoVeto &&  )
delete

Member Function Documentation

void CRTAutoVeto::analyze ( art::Event const &  e)
override

Definition at line 182 of file CRTAutoVeto_module.cc.

183 {
184 
185  auto const& mctruths = //vector of MCTruths from GENIE
186  *ev.getValidHandle<vector<simb::MCTruth>>(fGenLabel);
187 
188  auto const& simparticles = //vector of MCParticles from G4
189  *ev.getValidHandle<vector<simb::MCParticle>>(fSimLabel);
190 
191  auto const& crthits = //vector of CRTHits
192  *ev.getValidHandle<vector<sbn::crt::CRTHit>>(fCRTHitLabel);
193 
194  map< int, const simb::MCParticle*> particleMap;
195 
196  fEvent = ev.id().event();
197  fNumNu = mctruths.size();
198  fNHit = crthits.size();
199 
200  //loop over neutrinos
201  for(auto const& mctruth : mctruths) {
202 
203  auto const& nu = mctruth.GetNeutrino();
204 
205  fNuPDG = nu.Nu().PdgCode();
206  fNuE = nu.Nu().E();
207  fNuMode = nu.Mode();
208  fNuInt = nu.InteractionType();
209  fNuLepE = nu.Lepton().E();
210  fNuTheta = nu.Theta();
211 
212  fNuCC = false;
213  if(nu.CCNC()==0)
214  fNuCC = true;
215 
216  const TLorentzVector nuxyzt = mctruth.GetNeutrino().Nu().Position(0);
217  const TVector3 point = nuxyzt.Vect();
218  fNuXYZT = {nuxyzt.X(), nuxyzt.Y(), nuxyzt.Z(), nuxyzt.T()};
219  fNuAV = IsAV(point);
220  fNuFV = false;
221  if(fNuAV)
222  fNuFV = IsFV(point);
223 
224  }//for nus
225 
226  //loop over G4 tracks
227  for(auto const& particle : simparticles){
228 
229  particleMap[particle.TrackId()] = &particle;
230 
231  }//G4 tracks
232 
233  fHitRegs.clear();
234  fHitXYZT.clear();
235  fHitPDGs.clear();
236  fNHitPDGs.clear();
237  fHitMaxPDG.clear();
238  fDist.clear();
239  fDelay.clear();
240 
241  //loop over CRTHits
242  for(auto const& hit : crthits) {
243  std::cout << "found hit in region, " << hit.tagger << std::endl;
244  fHitRegs.push_back(crtutil->AuxDetRegionNameToNum(hit.tagger));
245  fHitXYZT.push_back({hit.x_pos,hit.y_pos,hit.z_pos,(float)(hit.ts0_ns-1.6e6)});
246  fHitPDGs.push_back({});
247 
248  int npdg=0;
249  for(const int id : bt->AllTrueIds(ev,hit)){
250  if(id<0) continue;
251  if(particleMap.find(id)==particleMap.end()) continue;
252  fHitPDGs.back().push_back(particleMap[id]->PdgCode());
253  npdg++;
254  }
255 
256  fNHitPDGs.push_back(npdg);
257  int maxid = bt->TrueIdFromTotalEnergy(ev,hit);
258  if(maxid<0 || particleMap.find(maxid)==particleMap.end())
259  fHitMaxPDG.push_back(INT_MAX);
260  else
261  fHitMaxPDG.push_back(particleMap[maxid]->PdgCode());
262 
263  float dist=0.;
264  for(int i=0; i<3; i++) dist+=pow(fHitXYZT.back()[i]-fNuXYZT[i],2);
265  fDist.push_back(sqrt(dist));
266  fDelay.push_back(fHitXYZT.back()[3]-fNuXYZT[3]);
267  }//for CRTHits
268 
269  fTree->Fill();
270 
271  //fill efficiency plots
272  if(fNuCC && fNuAV && fNumNu>0){
273  bool veto = false;
274  if(fNHit>0)
275  veto = true;
276  fVetoEffAV->Fill(veto,fNuE);
277  fVetoEffAV_tot->Fill(veto,1);
278  if(fNuFV){
279  fVetoEffFV->Fill(veto,fNuE);
280  fVetoEffFV_tot->Fill(veto,1);
281  }
282  }
283 
284 }//analyze
bool IsFV(TVector3 const &point)
bool IsAV(TVector3 const &point)
vector< vector< int > > fHitPDGs
process_name hit
Definition: cheaterreco.fcl:51
constexpr double dist(const TReal *x, const TReal *y, const unsigned int dimension)
std::vector< int > AllTrueIds(const art::Event &event, const CRTData &data)
int TrueIdFromTotalEnergy(const art::Event &event, const CRTData &data)
vector< vector< float > > fHitXYZT
BEGIN_PROLOG SN nu
BEGIN_PROLOG could also be cout
bool CRTAutoVeto::IsAV ( TVector3 const &  point)
private

Definition at line 286 of file CRTAutoVeto_module.cc.

286  {
287 
288  geo::CryostatGeo const& cryo0 = fGeoService->Cryostat(0);
289  geo::CryostatGeo const& cryo1 = fGeoService->Cryostat(1);
290  geo::TPCGeo const& tpc00 = cryo0.TPC(0);
291  geo::TPCGeo const& tpc01 = cryo0.TPC(1);
292  geo::TPCGeo const& tpc10 = cryo1.TPC(0);
293  geo::TPCGeo const& tpc11 = cryo1.TPC(1);
294 
295  if(tpc00.ContainsPosition(point) ||
296  tpc01.ContainsPosition(point) ||
297  tpc10.ContainsPosition(point) ||
298  tpc11.ContainsPosition(point) )
299  return true;
300 
301  return false;
302 }
Geometry information for a single TPC.
Definition: TPCGeo.h:38
Geometry information for a single cryostat.
Definition: CryostatGeo.h:43
geo::GeometryCore const * fGeoService
CryostatGeo const & Cryostat(geo::CryostatID const &cryoid) const
Returns the specified cryostat.
const TPCGeo & TPC(unsigned int itpc) const
Return the itpc&#39;th TPC in the cryostat.
Definition: CryostatGeo.cxx:93
bool ContainsPosition(geo::Point_t const &point, double wiggle=1.0) const
Returns whether this volume contains the specified point.
bool CRTAutoVeto::IsFV ( TVector3 const &  point)
private

Definition at line 304 of file CRTAutoVeto_module.cc.

304  {
305 
306  geo::CryostatGeo const& cryo0 = fGeoService->Cryostat(0);
307  geo::CryostatGeo const& cryo1 = fGeoService->Cryostat(1);
308  geo::TPCGeo const& tpc00 = cryo0.TPC(0);
309  geo::TPCGeo const& tpc01 = cryo0.TPC(1);
310  geo::TPCGeo const& tpc10 = cryo1.TPC(0);
311  geo::TPCGeo const& tpc11 = cryo1.TPC(1);
312 
313  if(tpc00.ContainsPosition(point)
314  && tpc00.InFiducialX(point.X(),fFidXOut,0.)
315  && tpc00.InFiducialY(point.Y(),fFidYBot,fFidYTop)
316  && tpc00.InFiducialZ(point.Z(),fFidZUp,fFidZDown) )
317  return true;
318  if(tpc01.ContainsPosition(point)
319  && tpc01.InFiducialX(point.X(),0.,fFidXIn)
320  && tpc01.InFiducialY(point.Y(),fFidYBot,fFidYTop)
321  && tpc01.InFiducialZ(point.Z(),fFidZUp,fFidZDown) )
322  return true;
323  if(tpc10.ContainsPosition(point)
324  && tpc10.InFiducialX(point.X(),fFidXIn,0.)
325  && tpc10.InFiducialY(point.Y(),fFidYBot,fFidYTop)
326  && tpc10.InFiducialZ(point.Z(),fFidZUp,fFidZDown) )
327  return true;
328  if(tpc11.ContainsPosition(point)
329  && tpc11.InFiducialX(point.X(),0.,fFidXOut)
330  && tpc11.InFiducialY(point.Y(),fFidYBot,fFidYTop)
331  && tpc11.InFiducialZ(point.Z(),fFidZUp,fFidZDown) )
332  return true;
333 
334  return false;
335 }
Geometry information for a single TPC.
Definition: TPCGeo.h:38
Geometry information for a single cryostat.
Definition: CryostatGeo.h:43
geo::GeometryCore const * fGeoService
CryostatGeo const & Cryostat(geo::CryostatID const &cryoid) const
Returns the specified cryostat.
bool InFiducialY(double y, double neg_margin, double pos_margin) const
Returns whether TPC fiducial volume contains world y coordinate.
const TPCGeo & TPC(unsigned int itpc) const
Return the itpc&#39;th TPC in the cryostat.
Definition: CryostatGeo.cxx:93
bool InFiducialX(double x, double neg_margin, double pos_margin) const
Returns whether TPC fiducial volume contains world x coordinate.
bool InFiducialZ(double z, double neg_margin, double pos_margin) const
Returns whether TPC fiducial volume contains world z coordinate.
bool ContainsPosition(geo::Point_t const &point, double wiggle=1.0) const
Returns whether this volume contains the specified point.
CRTAutoVeto& icarus::crt::CRTAutoVeto::operator= ( CRTAutoVeto const &  )
delete
CRTAutoVeto& icarus::crt::CRTAutoVeto::operator= ( CRTAutoVeto &&  )
delete

Member Data Documentation

CRTBackTracker* icarus::crt::CRTAutoVeto::bt
private

Definition at line 96 of file CRTAutoVeto_module.cc.

CRTCommonUtils* icarus::crt::CRTAutoVeto::crtutil
private

Definition at line 97 of file CRTAutoVeto_module.cc.

art::InputTag icarus::crt::CRTAutoVeto::fCRTHitLabel
private

Definition at line 85 of file CRTAutoVeto_module.cc.

vector<float> icarus::crt::CRTAutoVeto::fDelay
private

Definition at line 126 of file CRTAutoVeto_module.cc.

vector<float> icarus::crt::CRTAutoVeto::fDist
private

Definition at line 125 of file CRTAutoVeto_module.cc.

int icarus::crt::CRTAutoVeto::fEvent
private

Definition at line 107 of file CRTAutoVeto_module.cc.

double icarus::crt::CRTAutoVeto::fFidXIn
private

Definition at line 89 of file CRTAutoVeto_module.cc.

double icarus::crt::CRTAutoVeto::fFidXOut
private

Definition at line 88 of file CRTAutoVeto_module.cc.

double icarus::crt::CRTAutoVeto::fFidYBot
private

Definition at line 91 of file CRTAutoVeto_module.cc.

double icarus::crt::CRTAutoVeto::fFidYTop
private

Definition at line 90 of file CRTAutoVeto_module.cc.

double icarus::crt::CRTAutoVeto::fFidZDown
private

Definition at line 93 of file CRTAutoVeto_module.cc.

double icarus::crt::CRTAutoVeto::fFidZUp
private

Definition at line 92 of file CRTAutoVeto_module.cc.

art::InputTag icarus::crt::CRTAutoVeto::fGenLabel
private

Definition at line 83 of file CRTAutoVeto_module.cc.

geo::GeometryCore const* icarus::crt::CRTAutoVeto::fGeoService
private

Definition at line 98 of file CRTAutoVeto_module.cc.

vector<int> icarus::crt::CRTAutoVeto::fHitMaxPDG
private

Definition at line 124 of file CRTAutoVeto_module.cc.

vector<vector<int> > icarus::crt::CRTAutoVeto::fHitPDGs
private

Definition at line 122 of file CRTAutoVeto_module.cc.

vector<int> icarus::crt::CRTAutoVeto::fHitRegs
private

Definition at line 120 of file CRTAutoVeto_module.cc.

vector<vector<float> > icarus::crt::CRTAutoVeto::fHitXYZT
private

Definition at line 121 of file CRTAutoVeto_module.cc.

int icarus::crt::CRTAutoVeto::fNHit
private

Definition at line 119 of file CRTAutoVeto_module.cc.

vector<int> icarus::crt::CRTAutoVeto::fNHitPDGs
private

Definition at line 123 of file CRTAutoVeto_module.cc.

bool icarus::crt::CRTAutoVeto::fNuAV
private

Definition at line 112 of file CRTAutoVeto_module.cc.

bool icarus::crt::CRTAutoVeto::fNuCC
private

Definition at line 111 of file CRTAutoVeto_module.cc.

float icarus::crt::CRTAutoVeto::fNuE
private

Definition at line 110 of file CRTAutoVeto_module.cc.

bool icarus::crt::CRTAutoVeto::fNuFV
private

Definition at line 113 of file CRTAutoVeto_module.cc.

int icarus::crt::CRTAutoVeto::fNuInt
private

Definition at line 115 of file CRTAutoVeto_module.cc.

double icarus::crt::CRTAutoVeto::fNuLepE
private

Definition at line 117 of file CRTAutoVeto_module.cc.

int icarus::crt::CRTAutoVeto::fNumNu
private

Definition at line 108 of file CRTAutoVeto_module.cc.

int icarus::crt::CRTAutoVeto::fNuMode
private

Definition at line 116 of file CRTAutoVeto_module.cc.

int icarus::crt::CRTAutoVeto::fNuPDG
private

Definition at line 109 of file CRTAutoVeto_module.cc.

double icarus::crt::CRTAutoVeto::fNuTheta
private

Definition at line 118 of file CRTAutoVeto_module.cc.

vector<double> icarus::crt::CRTAutoVeto::fNuXYZT
private

Definition at line 114 of file CRTAutoVeto_module.cc.

art::InputTag icarus::crt::CRTAutoVeto::fSimLabel
private

Definition at line 84 of file CRTAutoVeto_module.cc.

TTree* icarus::crt::CRTAutoVeto::fTree
private

Definition at line 106 of file CRTAutoVeto_module.cc.

TEfficiency* icarus::crt::CRTAutoVeto::fVetoEffAV
private

Definition at line 100 of file CRTAutoVeto_module.cc.

TEfficiency* icarus::crt::CRTAutoVeto::fVetoEffAV_tot
private

Definition at line 102 of file CRTAutoVeto_module.cc.

TEfficiency* icarus::crt::CRTAutoVeto::fVetoEffFV
private

Definition at line 101 of file CRTAutoVeto_module.cc.

TEfficiency* icarus::crt::CRTAutoVeto::fVetoEffFV_tot
private

Definition at line 103 of file CRTAutoVeto_module.cc.


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