14 #include "TPrincipal.h" 17 #include "canvas/Persistency/Common/FindManyP.h" 18 #include "canvas/Persistency/Common/FindOneP.h" 25 , fCalorimetryAlg (p.
get<
fhicl::ParameterSet>(
"CalorimetryAlg"))
26 , fMakeAnaTree (p.
get<
bool>(
"MakeAnaTree"))
27 , fMakeWeightTree (p.
get<
bool>(
"MakeWeightTree"))
33 fFile.open(
"events.txt");
122 fWeightTree[2] =
tfs->make<TTree>(
"nc",
"a Tree for MVA");
123 fWeightTree[3] =
tfs->make<TTree>(
"cc",
"a Tree for MVA");
124 for (
int i = 0; i<4; ++i){
125 fWeightTree[i]->Branch(
"run",&
run,
"run/I");
126 fWeightTree[i]->Branch(
"subrun",&
subrun,
"subrun/I");
127 fWeightTree[i]->Branch(
"event",&
event,
"event/I");
128 fWeightTree[i]->Branch(
"itype",&
itype,
"itype/I");
131 fWeightTree[i]->Branch(
"oscpro",&
fOscPro,
"oscpro/F");
132 fWeightTree[i]->Branch(
"weight",&
weight,
"weight/F");
133 fWeightTree[i]->Branch(
"evtcharge",&
evtcharge,
"evtcharge/F");
134 fWeightTree[i]->Branch(
"ntrack",&
ntrack,
"ntrack/F");
135 fWeightTree[i]->Branch(
"maxtrklength",&
maxtrklength,
"maxtrklength/F");
136 fWeightTree[i]->Branch(
"avgtrklength",&
avgtrklength,
"avgtrklength/F");
137 fWeightTree[i]->Branch(
"trkdedx",&
trkdedx,
"trkdedx/F");
138 fWeightTree[i]->Branch(
"trkrch",&
trkrch,
"trkrch/F");
139 fWeightTree[i]->Branch(
"trkrt",&
trkrt,
"trkrt/F");
140 fWeightTree[i]->Branch(
"trkfr",&
trkfr,
"trkfr/F");
141 fWeightTree[i]->Branch(
"trkpida",&
trkpida_save,
"trkpida/F");
142 fWeightTree[i]->Branch(
"nshower",&
nshower,
"nshower/F");
143 fWeightTree[i]->Branch(
"showerdedx",&
showerdedx,
"showerdedx/F");
144 fWeightTree[i]->Branch(
"eshower",&
eshower,
"eshower/F");
145 fWeightTree[i]->Branch(
"frshower",&
frshower,
"frshower/F");
146 fWeightTree[i]->Branch(
"nhitspershw",&
nhitspershw,
"nhitspershw/F");
147 fWeightTree[i]->Branch(
"shwlength",&
shwlength,
"shwlength/F");
148 fWeightTree[i]->Branch(
"shwmax",&
shwmax,
"shwmax/F");
149 fWeightTree[i]->Branch(
"fract_5_wires",&
fract_5_wires,
"fract_5_wires/F");
150 fWeightTree[i]->Branch(
"fract_10_wires",&
fract_10_wires,
"fract_10_wires/F");
151 fWeightTree[i]->Branch(
"fract_50_wires",&
fract_50_wires,
"fract_50_wires/F");
152 fWeightTree[i]->Branch(
"fract_100_wires",&
fract_100_wires,
"fract_100_wires/F");
153 fWeightTree[i]->Branch(
"shwdis",&
shwdis,
"shwdis/F");
154 fWeightTree[i]->Branch(
"shwdisx",&
shwdisx,
"shwdisx/F");
155 fWeightTree[i]->Branch(
"shwdisy",&
shwdisy,
"shwdisy/F");
156 fWeightTree[i]->Branch(
"shwdisz",&
shwdisz,
"shwdisz/F");
157 fWeightTree[i]->Branch(
"shwcosx",&
shwcosx,
"shwcosx/F");
158 fWeightTree[i]->Branch(
"shwcosy",&
shwcosy,
"shwcosy/F");
159 fWeightTree[i]->Branch(
"shwcosz",&
shwcosz,
"shwcosz/F");
160 fWeightTree[i]->Branch(
"trkcosx",&
trkcosx,
"trkcosx/F");
161 fWeightTree[i]->Branch(
"trkcosy",&
trkcosy,
"trkcosy/F");
162 fWeightTree[i]->Branch(
"trkcosz",&
trkcosz,
"trkcosz/F");
163 fWeightTree[i]->Branch(
"ET",&
ET,
"ET/F");
171 mva_nue_osc =
tfs->make<TH1D>(
"mva_nue_osc",
"mva_nue_osc",mva_bins,-1,1);
172 mva_nc =
tfs->make<TH1D>(
"mva_nc",
"mva_nc",mva_bins,-1,1);
173 mva_numu =
tfs->make<TH1D>(
"mva_numu",
"mva_numu",mva_bins,-1,1);
174 mva_nue_beam =
tfs->make<TH1D>(
"mva_nue_beam",
"mva_nue_beam",mva_bins,-1,1);
175 mva_nutau =
tfs->make<TH1D>(
"mva_nutau",
"mva_nutau",mva_bins,-1,1);
177 mva_numu_nue =
tfs->make<TH1D>(
"mva_numu_nue",
"mva_numu_nue",mva_bins,-1,1);
178 mva_nue_nue =
tfs->make<TH1D>(
"mva_nue_nue",
"mva_nue_nue",mva_bins,-1,1);
179 mva_numu_numu =
tfs->make<TH1D>(
"mva_numu_numu",
"mva_numu_numu",mva_bins,-1,1);
180 mva_nue_numu =
tfs->make<TH1D>(
"mva_nue_numu",
"mva_nue_numu",mva_bins,-1,1);
181 mva_numu_nutau =
tfs->make<TH1D>(
"mva_numu_nutau",
"mva_numu_nutau",mva_bins,-1,1);
182 mva_nue_nutau =
tfs->make<TH1D>(
"mva_nue_nutau",
"mva_nue_nutau",mva_bins,-1,1);
184 enu_nc =
tfs->make<TH1D>(
"enu_nc",
"enu_nc",100,0,100);
185 enu_numu_nue =
tfs->make<TH1D>(
"enu_numu_nue",
"enu_numu_nue",100,0,100);
186 enu_nue_nue =
tfs->make<TH1D>(
"enu_nue_nue",
"enu_nue_nue",100,0,100);
188 enu_nue_numu =
tfs->make<TH1D>(
"enu_nue_numu",
"enu_nue_numu",100,0,100);
195 mva_nue_beam->Sumw2();
198 mva_numu_nue->Sumw2();
199 mva_nue_nue->Sumw2();
200 mva_numu_numu->Sumw2();
201 mva_nue_numu->Sumw2();
202 mva_numu_nutau->Sumw2();
203 mva_nue_nutau->Sumw2();
206 enu_numu_nue->Sumw2();
207 enu_nue_nue->Sumw2();
208 enu_numu_numu->Sumw2();
209 enu_nue_numu->Sumw2();
210 enu_numu_nutau->Sumw2();
211 enu_nue_nutau->Sumw2();
214 char name[5][100] = {
"#nu_{e}^{osc}",
"NC",
"#nu_{#mu} CC",
"#nu_{e}^{beam}",
"#nu_{#tau} CC"};
219 enu[i] =
tfs->make<TH1D>(Form(
"enu_%d",i),name[i],80,0,20);
221 enu_osc[i] =
tfs->make<TH1D>(Form(
"enu_osc_%d",i),name[i],160,0,20);
223 hvtxx[i] =
tfs->make<TH1D>(Form(
"hvtxx_%d",i), name[i],100,-10,10);
224 hvtxy[i] =
tfs->make<TH1D>(Form(
"hvtxy_%d",i), name[i],100,-10,10);
225 hvtxz[i] =
tfs->make<TH1D>(Form(
"hvtxz_%d",i), name[i],100,-10,10);
229 htrklen[i] =
tfs->make<TH1D>(Form(
"htrklen_%d",i), name[i],100,0,600);
231 htrkdedx[i] =
tfs->make<TH1D>(Form(
"htrkdedx_%d",i), name[i], 100,0,20);
233 hrch[i] =
tfs->make<TH1D>(Form(
"hrch_%d",i),name[i],100,0,1);
235 hrt[i] =
tfs->make<TH1D>(Form(
"hrt_%d",i),name[i],100,0,1);
237 hpida[i] =
tfs->make<TH1D>(Form(
"hpida_%d",i),name[i],100,0,50);
239 hnshw[i] =
tfs->make<TH1D>(Form(
"hnshw_%d",i),name[i],20,0,20);
241 heshw[i] =
tfs->make<TH1D>(Form(
"heshw_%d",i),name[i],100,0,10);
243 hshwdedx[i] =
tfs->make<TH1D>(Form(
"hshwdedx_%d",i),name[i],100,0,20);
245 hdisx[i] =
tfs->make<TH1D>(Form(
"hdisx_%d",i),name[i],100,-20,20);
247 hdisy[i] =
tfs->make<TH1D>(Form(
"hdisy_%d",i),name[i],100,-20,20);
249 hdisz[i] =
tfs->make<TH1D>(Form(
"hdisz_%d",i),name[i],100,-20,20);
251 hfrshower[i] =
tfs->make<TH1D>(Form(
"hfrshower_%d",i),name[i],110,0,1.1);
253 hnhitspershw[i] =
tfs->make<TH1D>(Form(
"hnhitspershw_%d",i),name[i],100,0,20);
255 hevtcharge[i] =
tfs->make<TH1D>(Form(
"hevtcharge_%d",i),name[i],100,0,3e6);
257 hfr100w[i] =
tfs->make<TH1D>(Form(
"hfr100w_%d",i),name[i],110,0,1.1);
261 fPOT =
tfs->make<TTree>(
"pottree",
"pot tree");
262 fPOT->Branch(
"pot",&
pot,
"pot/D");
263 fPOT->Branch(
"run",&
run,
"run/I");
302 <<
" returned " <<
result;
376 pot = potListHandle->totpot;
459 bool findvtx =
false;
511 unsigned int ntracks_notvtx(0);
512 if(findvtx && ntracks_reco>0){
514 double Edir[3] = {0.,0.,0.};
516 for (
int i = 0; i<
nshws; ++i){
553 ET = std::sqrt( Edir[0]*Edir[0] + Edir[1]*Edir[1] );
592 std::vector<std::vector<std::map<int,float> > > vtrktick(
fGeom->
NTPC());
593 for (
size_t i = 0; i<
fGeom->
NTPC(); ++i){
594 vtrktick[i].resize(3);
610 for (
int i = 0; i<
nshws; ++i){
645 int shwwire0 = 100000;
649 for (
int i = 0; i<
nhits && i<40000; ++i){
693 std::vector<float> shwph;
694 if (shwwire1>=shwwire0){
695 shwph.resize(shwwire1-shwwire0+1,0);
706 int ipl[2] = {-1,-1};
707 int maxhits[2] = {0,0};
710 for (
int i = 0; i<3; ++i){
713 for (
size_t j = 0; j<
fGeom->
NTPC(); ++j){
714 tothits += vtrktick[j][i].size();
716 if (tothits>maxhits[0]){
718 maxhits[1] = maxhits[0];
721 maxhits[0] = tothits;
725 else if (tothits>maxhits[1]){
726 maxhits[1] = tothits;
755 float ipl_evtcharge = 0;
757 std::vector<float> vhitq;
758 for (
int i = 0; i<
nhits && i<40000; ++i){
759 for (
int j = 0; j<2; ++j){
786 std::sort(vhitq.begin(), vhitq.end());
789 for (
size_t i = 0; i<vhitq.size(); ++i){
790 if (i<vhitq.size()/2){
798 hrt[
itype]->Fill(TMath::Min(
float(0.999999),qtrk/qall),
oscpro*norm);
802 if(ipl_evtcharge!=0)
trkfr = qtrk/ipl_evtcharge;
805 std::cout <<
"Erroneous track charge fraction: " <<
trkfr 806 <<
" = " << qtrk <<
" / " << ipl_evtcharge <<
std::endl;
824 int totalshwhits = 0;
825 std::map<int,int> shwwires;
829 for (
int i = 0; i<
nhits && i<40000; ++i){
842 if (shwwires.size()){
855 for (
size_t i = 0; i<shwph.size(); ++i){
856 if (shwph[i]>maxshw){
860 totshwph += shwph[i];
861 float ph_5_wires = 0;
862 float ph_10_wires = 0;
863 float ph_50_wires = 0;
864 float ph_100_wires = 0;
865 for (
size_t j = i; j<i+100&&j<shwph.size(); ++j){
867 ph_5_wires += shwph[j];
870 ph_10_wires += shwph[j];
873 ph_50_wires += shwph[j];
876 ph_100_wires += shwph[j];
960 mf::LogVerbatim(
"MVASelect") <<
" Not found in fiducial volume. nvtx=" <<
nvtx <<
" True vtx = (" 997 float mass = 814.308*1.4e3/1e6;
999 float pot_nu = 1.09125e+23;
1000 float pot_nue = 1.05555e+23;
1001 float pot_nutau = 2.83966e+23;
1003 pot_nu = 1.89753e+23;
1004 pot_nue = 1.80693e+23;
1005 pot_nutau = 4.19518e+23;
1008 float potpermwyr = 1.47e21/1.07;
1009 float pot = 150*potpermwyr/mass;
1012 norm = pot/(pot_nu+pot_nue+pot_nutau);
1024 norm = pot/pot_nutau;
1027 norm = pot/pot_nutau;
1033 std::cout <<
"Unknown oscillation: " 1043 float osc_dm2=0.002457;
1051 osceq =
new TF1(
"f2",
"sin(1.267*[0]*[1]/x)*sin(1.267*[0]*[1]/x)",0.,120.);
1052 osceq->SetParameters(osc_dm2,osc_L);
1059 float NumuSurvival ;
1075 NumuToNue =
pow(sin(th23),2)*
pow(sin(2*th13),2)*osceq->Eval(TMath::Abs(NuE)) ;
1077 NueSurvival = 1-
pow(sin(2*th13),2)*osceq->Eval(TMath::Abs(NuE)) ;
1082 NumuSurvival = 1-(
pow(cos(th13),2)*
pow(sin(2*th23),2)+
pow(sin(th23),4)*
pow(sin(2*th13),2))*osceq->Eval(TMath::Abs(NuE)) ;
1087 NumuToNutau = 1 - NumuSurvival - NumuToNue;
1088 NueToNutau = 1 - NueSurvival - NumuToNue;
1090 NueToNumu = NumuToNue;
1096 OscProb = NumuToNue;
1099 OscProb = NueSurvival;
1102 OscProb = NumuSurvival;
1105 OscProb = NueToNumu;
1108 OscProb = NumuToNutau;
1111 OscProb = NueToNutau;
1114 std::cout <<
"Unknown oscillation: " 1131 const sim::ParticleList& plist = pi_serv->
ParticleList();
1141 taulife = detProp.ElectronLifetime();
1145 std::vector<art::Ptr<raw::RawDigit> > rawlist;
1151 std::vector<art::Ptr<recob::Wire>> wirelist;
1157 std::vector<art::Ptr<recob::Hit> > hitlist;
1163 std::vector<art::Ptr<recob::Track> > tracklist;
1165 if (trackListHandle)
1169 std::vector<art::Ptr<recob::Vertex> > vtxlist;
1175 std::vector<art::Ptr<recob::Shower>> shwlist;
1181 std::vector<art::Ptr<recob::OpFlash> > flashlist;
1183 if (flashListHandle)
1188 art::FindManyP<recob::Hit, recob::TrackHitMeta> fmthm(trackListHandle, evt,
fTrackModuleLabel);
1206 for (
size_t i = 0; i<wirelist.size(); ++i){
1209 for(
const auto& range : signalROI.
get_ranges()){
1210 const std::vector<float>& signal = range.data();
1212 for (
size_t j = 0; j<signal.size(); ++j){
1220 nhits = hitlist.size();
1224 hit_plane[i] = hitlist[i]->WireID().Plane;
1225 hit_wire[i] = hitlist[i]->WireID().Wire;
1226 hit_tpc[i] = hitlist[i]->WireID().TPC;
1230 hit_startT[i] = hitlist[i]->PeakTimeMinusRMS();
1231 hit_endT[i] = hitlist[i]->PeakTimePlusRMS();
1242 std::tie(trackStart, trackEnd) = tracklist[i]->Extent();
1243 larStart = tracklist[i]->VertexDirection();
1244 larEnd = tracklist[i]->EndDirection();
1246 trkid[i] = tracklist[i]->ID();
1259 trklen[i] = tracklist[i]->Length();
1260 if (fmthm.isValid()){
1261 auto vhit = fmthm.at(i);
1262 auto vmeta = fmthm.data(i);
1263 for (
size_t h = 0;
h < vhit.size(); ++
h){
1266 if (vmeta[
h]->Dx()){
1274 else if (fmth.isValid()){
1275 std::vector< art::Ptr<recob::Hit> > vhit = fmth.at(i);
1276 for (
size_t h = 0;
h < vhit.size(); ++
h){
1282 if (fmcal.isValid()){
1283 unsigned maxnumhits = 0;
1284 std::vector<const anab::Calorimetry*> calos = fmcal.at(i);
1285 for (
auto const&
calo : calos){
1286 if (
calo->PlaneID().isValid){
1288 if (
calo->dEdx().size()>maxnumhits){
1289 maxnumhits =
calo->dEdx().size();
1293 int used_trkres = 0;
1294 for (
size_t ip = 0; ip<
calo->dEdx().size(); ++ip){
1295 if (
calo->ResidualRange()[ip]<30){
1296 pida +=
calo->dEdx()[ip]*
pow(
calo->ResidualRange()[ip],0.42);
1300 if (used_trkres) pida/=used_trkres;
1305 if (!
isdata&&fmth.isValid()){
1308 std::vector< art::Ptr<recob::Hit> > allHits = fmth.at(i);
1310 std::map<int,double> trkide;
1311 for(
size_t h = 0;
h < allHits.size(); ++
h){
1314 for(
size_t e = 0;
e < TrackIDs.size(); ++
e){
1315 trkide[TrackIDs[
e].trackID] += TrackIDs[
e].energy;
1323 if ((ii->second)>maxe){
1325 TrackID = ii->first;
1336 float sum_energy = 0;
1342 double mindis = 1e10;
1344 for(
size_t h = 0;
h < allHits.size(); ++
h){
1347 std::vector<art::Ptr<recob::SpacePoint> > spts = fmhs.at(hit.
key());
1354 x = spts[0]->XYZ()[0];
1355 y = spts[0]->XYZ()[1];
1356 z = spts[0]->XYZ()[2];
1361 for(
size_t h = 0;
h < allHits.size(); ++
h){
1364 std::vector<art::Ptr<recob::SpacePoint> > spts = fmhs.at(hit.
key());
1366 if (sqrt(
pow(spts[0]->XYZ()[0]-x,2)+
1367 pow(spts[0]->XYZ()[1]-y,2)+
1368 pow(spts[0]->XYZ()[2]-z,2))<3){
1371 for(
size_t e = 0;
e < TrackIDs.size(); ++
e){
1373 toten+=TrackIDs[
e].energy;
1376 sum_energy += toten;
1407 if ( pitch && numhits ) {
1418 nvtx = vtxlist.size();
1420 Double_t xyz[3] = {};
1421 vtxlist[i]->XYZ(xyz);
1422 for (
size_t j = 0; j<3; ++j)
vtx[i][j] = xyz[j];
1426 if (shwListHandle.isValid()){
1429 nshws = shwlist.size();
1432 shwid[i] = shwlist[i]->ID();
1433 shwdcosx[i] = shwlist[i]->Direction().X();
1434 shwdcosy[i] = shwlist[i]->Direction().Y();
1435 shwdcosz[i] = shwlist[i]->Direction().Z();
1436 shwstartx[i] = shwlist[i]->ShowerStart().X();
1437 shwstarty[i] = shwlist[i]->ShowerStart().Y();
1438 shwstartz[i] = shwlist[i]->ShowerStart().Z();
1439 for (
size_t j = 0; j<(shwlist[i]->Energy()).
size(); ++j){
1440 shwenergy[i][j] = shwlist[i]->Energy()[j];
1442 for (
size_t j = 0; j<(shwlist[i]->dEdx()).
size(); ++j){
1443 shwdedx[i][j] = shwlist[i]->dEdx()[j];
1446 if (fmsh.isValid()){
1447 auto vhit = fmsh.at(i);
1448 for (
size_t h = 0;
h < vhit.size(); ++
h){
1454 if (!
isdata&&fmsh.isValid()){
1457 std::vector< art::Ptr<recob::Hit> > allHits = fmsh.at(i);
1458 std::map<int,double> trkide;
1459 for(
size_t h = 0;
h < allHits.size(); ++
h){
1462 for(
size_t e = 0;
e < TrackIDs.size(); ++
e){
1463 trkide[TrackIDs[
e].trackID] += TrackIDs[
e].energy;
1471 if ((ii->second)>maxe){
1473 TrackID = ii->first;
1501 std::vector<art::Ptr<simb::MCTruth> > mclist;
1503 if (mctruthListHandle)
1506 std::vector<art::Ptr<simb::MCFlux> > fluxlist;
1508 if (mcfluxListHandle)
1547 float mindist2 = 9999;
1554 for(
size_t i = 0; i < vtxlist.size(); ++i){
1555 Double_t xyz[3] = {};
1556 vtxlist[i]->XYZ(xyz);
1557 TVector3 vtxreco(xyz);
1559 if (dist2 < mindist2)
1570 for (
size_t i = 0; i < tracklist.size(); ++i){
1572 if (dist2 < mindist2)
1582 if (dist2 < mindist2)
1596 if (fluxlist.size()){
1608 std::vector<const simb::MCParticle* > geant_part;
1611 for(
size_t p = 0;
p < plist.size(); ++
p)
1614 geant_part.push_back(plist.Particle(
p));
1623 int geant_particle=0;
1628 for(
unsigned int i = 0; i < geant_part.size(); ++i ){
1631 if(geant_part[i]->Process()==pri)
1642 for(
unsigned int i = 0; i < geant_part.size(); ++i ){
1645 if(geant_part[i]->Process()==pri)
1652 Mother[i]=geant_part[i]->Mother();
1654 TrackId[i]=geant_part[i]->TrackId();
1656 pdg[i]=geant_part[i]->PdgCode();
1658 Eng[i]=geant_part[i]->E();
1661 Px[i]=geant_part[i]->Px();
1662 Py[i]=geant_part[i]->Py();
1663 Pz[i]=geant_part[i]->Pz();
1669 EndPointx[i]=geant_part[i]->EndPosition()[0];
1670 EndPointy[i]=geant_part[i]->EndPosition()[1];
1671 EndPointz[i]=geant_part[i]->EndPosition()[2];
1675 G4Process.push_back( geant_part[i]->Process() );
1683 Startdcosx[i] = geant_part[i]->Momentum(0).Px() / geant_part[i]->Momentum(0).P();
1684 Startdcosy[i] = geant_part[i]->Momentum(0).Py() / geant_part[i]->Momentum(0).P();
1685 Startdcosz[i] = geant_part[i]->Momentum(0).Pz() / geant_part[i]->Momentum(0).P();
1705 double vtx[3] = {posX, posY, posZ};
1706 bool inside =
false;
1713 double minx = tpcgeo.
MinX();
double maxx = tpcgeo.
MaxX();
1714 double miny = tpcgeo.
MinY();
double maxy = tpcgeo.
MaxY();
1715 double minz = tpcgeo.
MinZ();
double maxz = tpcgeo.
MaxZ();
1720 for (
size_t t = 0;
t < cryostat.
NTPC();
t++)
1723 if (tpcg.
MinX() < minx) minx = tpcg.
MinX();
1724 if (tpcg.
MaxX() > maxx) maxx = tpcg.
MaxX();
1725 if (tpcg.
MinY() < miny) miny = tpcg.
MinY();
1726 if (tpcg.
MaxY() > maxy) maxy = tpcg.
MaxY();
1727 if (tpcg.
MinZ() < minz) minz = tpcg.
MinZ();
1728 if (tpcg.
MaxZ() > maxz) maxz = tpcg.
MaxZ();
1734 double dista = fabs(minx - posX);
1735 double distb = fabs(posX - maxx);
1736 if ((posX > minx) && (posX < maxx) &&
1739 dista = fabs(maxy - posY);
1740 distb = fabs(posY - miny);
1741 if (inside && (posY > miny) && (posY < maxy) &&
1743 else inside =
false;
1746 dista = fabs(maxz - posZ);
1747 distb = fabs(posZ - minz);
1748 if (inside && (posZ > minz) && (posZ < maxz) &&
1750 else inside =
false;
1785 for (
int j = 0; j<3; ++j){
1786 trkke[i][j] = -9999;
1806 for (
int j = 0; j<3; ++j){
1920 fTree =
tfs->make<TTree>(
"nueana",
"analysis tree");
1928 fTree->Branch(
"trkid",
trkid,
"trkid[ntracks_reco]/I");
1929 fTree->Branch(
"trkstartx",
trkstartx,
"trkstartx[ntracks_reco]/F");
1930 fTree->Branch(
"trkstarty",
trkstarty,
"trkstarty[ntracks_reco]/F");
1931 fTree->Branch(
"trkstartz",
trkstartz,
"trkstartz[ntracks_reco]/F");
1932 fTree->Branch(
"trkendx",
trkendx,
"trkendx[ntracks_reco]/F");
1933 fTree->Branch(
"trkendy",
trkendy,
"trkendy[ntracks_reco]/F");
1934 fTree->Branch(
"trkendz",
trkendz,
"trkendz[ntracks_reco]/F");
1941 fTree->Branch(
"trklen",
trklen,
"trklen[ntracks_reco]/F");
1943 fTree->Branch(
"trkke",
trkke,
"trkke[ntracks_reco][3]/F");
1944 fTree->Branch(
"trkpida",
trkpida,
"trkpida[ntracks_reco][3]/F");
1945 fTree->Branch(
"trkg4id",
trkg4id,
"trkg4id[ntracks_reco]/I");
1946 fTree->Branch(
"trkg4pdg",
trkg4pdg,
"trkg4pdg[ntracks_reco]/I");
1952 fTree->Branch(
"shwid",
shwid,
"shwid[nshws]/I");
1960 fTree->Branch(
"shwdedx",
shwdedx,
"shwdedx[nshws][3]/F");
1974 fTree->Branch(
"hit_plane",
hit_plane,
"hit_plane[nhits_stored]/S");
1975 fTree->Branch(
"hit_tpc",
hit_tpc,
"hit_tpc[nhits_stored]/S");
1976 fTree->Branch(
"hit_wire",
hit_wire,
"hit_wire[nhits_stored]/S");
1978 fTree->Branch(
"hit_peakT",
hit_peakT,
"hit_peakT[nhits_stored]/F");
1982 fTree->Branch(
"hit_endT",
hit_endT,
"hit_endT[nhits_stored]/F");
1984 fTree->Branch(
"hit_dQds",
hit_dQds,
"hit_dQds[nhits_stored]/F");
1985 fTree->Branch(
"hit_dEds",
hit_dEds,
"hit_dEds[nhits_stored]/F");
1990 fTree->Branch(
"vtx",
vtx,
"vtx[nvtx][3]/F");
2019 fTree->Branch(
"pdg",
pdg,
"pdg[geant_list_size]/I");
2020 fTree->Branch(
"Eng",
Eng,
"Eng[geant_list_size]/F");
2021 fTree->Branch(
"Px",
Px,
"Px[geant_list_size]/F");
2022 fTree->Branch(
"Py",
Py,
"Py[geant_list_size]/F");
2023 fTree->Branch(
"Pz",
Pz,
"Pz[geant_list_size]/F");
2027 fTree->Branch(
"EndPointx",
EndPointx,
"EndPointx[geant_list_size]/F");
2028 fTree->Branch(
"EndPointy",
EndPointy,
"EndPointy[geant_list_size]/F");
2029 fTree->Branch(
"EndPointz",
EndPointz,
"EndPointz[geant_list_size]/F");
2030 fTree->Branch(
"Startdcosx",
Startdcosx,
"Startdcosx[geant_list_size]/F");
2031 fTree->Branch(
"Startdcosy",
Startdcosy,
"Startdcosy[geant_list_size]/F");
2032 fTree->Branch(
"Startdcosz",
Startdcosz,
"Startdcosz[geant_list_size]/F");
2033 fTree->Branch(
"N(((((((((umberDaughters",
NumberDaughters,
"NumberDaughters[geant_list_size]/I");
2034 fTree->Branch(
"Mother",
Mother,
"Mother[geant_list_size]/I");
2035 fTree->Branch(
"TrackId",
TrackId,
"TrackId[geant_list_size]/I");
double E(const int i=0) const
std::string fClusterModuleLabel
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
Float_t shwdcosy[kMaxShower]
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
constexpr std::uint32_t timeLow() const
Float_t flash_YWidth[kMaxFlash]
float trkg4startx[kMaxTrack]
Float_t hit_startT[kMaxHits]
const simb::MCNeutrino & GetNeutrino() const
double Py(const int i=0) const
std::string fWireModuleLabel
std::string fPOTModuleLabel
CryostatGeo const & GetElement(geo::CryostatID const &cryoid) const
Int_t hit_channel[kMaxHits]
float trkstartz[kMaxTrack]
void PrepareEvent(const art::Event &event)
Float_t EndPointz[kMaxPrimaries]
std::vector< sim::TrackIDE > HitToTrackIDEs(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
double Dist2(const TVector2 &v1, const TVector2 &v2)
Float_t EndPointx[kMaxPrimaries]
Handle< PROD > getHandle(SelectorBase const &) const
std::vector< TrackID > TrackIDs
const simb::MCParticle * TrackIdToParticle_P(int id) const
geo::WireID WireID() const
float trkstartx[kMaxTrack]
Float_t flash_abstime[kMaxFlash]
Float_t hit_dQds[kMaxHits]
Float_t shwstartx[kMaxShower]
void reconfigure(fhicl::ParameterSet const &p)
int shwbestplane[kMaxShower]
const simb::MCParticle & Nu() const
Float_t Startdcosz[kMaxPrimaries]
constexpr std::uint32_t timeHigh() const
simb::Origin_t Origin() const
double MinX() const
Returns the world x coordinate of the start of the box.
Geometry information for a single TPC.
Float_t Py[kMaxPrimaries]
double Px(const int i=0) const
Float_t StartPointx[kMaxPrimaries]
int TrackId[kMaxPrimaries]
float Norm(int ccnc, int nu0, int nu1, int subrun)
const range_list_t & get_ranges() const
Returns the internal list of non-void ranges.
std::vector< std::string > G4Process
Planes which measure Z direction.
Float_t hit_summedADC[kMaxHits]
float trkg4starty[kMaxTrack]
double MaxX() const
Returns the world x coordinate of the end of the box.
Float_t flash_YCenter[kMaxFlash]
Float_t shwdcosz[kMaxShower]
float trkenddcosz[kMaxTrack]
SigType_t SignalType(geo::PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC plane.
Float_t flash_TotalPE[kMaxFlash]
Geometry information for a single cryostat.
float trkke[kMaxTrack][3]
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
Float_t hit_peakT[kMaxHits]
art::ServiceHandle< art::TFileService > tfs
float trkg4initdedx[kMaxTrack]
void Run(const art::Event &evt, std::vector< double > &result, double &wgt)
unsigned int Nwires(unsigned int p, unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wires in the specified plane.
art framework interface to geometry description
MVAAlg(fhicl::ParameterSet const &p)
std::string fVertexModuleLabel
int TDCtick_t
Type representing a TDC tick.
Float_t Pz[kMaxPrimaries]
tracking::Vector_t Vector_t
geo::TPCID FindTPCAtPosition(double const worldLoc[3]) const
Returns the ID of the TPC at specified location.
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
constexpr int kMaxPrimaries
float trkstartdcosy[kMaxTrack]
float trkenddcosx[kMaxTrack]
Float_t shwstartz[kMaxShower]
std::string fRawDigitModuleLabel
Float_t flash_ZCenter[kMaxFlash]
std::string fCalorimetryModuleLabel
const simb::MCParticle & Lepton() const
Float_t flash_time[kMaxFlash]
float trkstartdcosx[kMaxTrack]
Short_t hit_wire[kMaxHits]
calo::CalorimetryAlg fCalorimetryAlg
Float_t shwstarty[kMaxShower]
std::string fHitsModuleLabel
Float_t hit_dEds[kMaxHits]
Float_t EndPointy[kMaxPrimaries]
double P(const int i=0) const
key_type key() const noexcept
T get(std::string const &key) const
std::vector< std::string > G4FinalProcess
double T(const int i=0) const
double MinZ() const
Returns the world z coordinate of the start of the box.
unsigned int NTPC() const
Number of TPCs in this cryostat.
CryostatGeo const & Cryostat(geo::CryostatID const &cryoid) const
Returns the specified cryostat.
SubRunNumber_t subRun() const
Float_t hit_endT[kMaxHits]
Float_t StartPointy[kMaxPrimaries]
Int_t hit_shwkey[kMaxHits]
The data type to uniquely identify a TPC.
PlaneID_t Plane
Index of the plane within its TPC.
Short_t hit_plane[kMaxHits]
int process_primary[kMaxPrimaries]
Float_t flash_width[kMaxFlash]
Float_t hit_charge[kMaxHits]
art::ServiceHandle< geo::Geometry > fGeom
auto norm(Vector const &v)
Return norm of the specified vector.
Detector simulation of raw signals on wires.
float trkstarty[kMaxTrack]
double MaxY() const
Returns the world y coordinate of the end of the box.
const sim::ParticleList & ParticleList() const
unsigned int NTPC(unsigned int cstat=0) const
Returns the total number of TPCs in the specified cryostat.
const simb::MCParticle & GetParticle(int i) const
std::string fShowerModuleLabel
float OscPro(int ccnc, int nu0, int nu1, float NuE)
bool HasTPC(geo::TPCID const &tpcid) const
Returns whether we have the specified TPC.
constexpr int kMaxVertices
double Vx(const int i=0) const
int trkbestplane[kMaxTrack]
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Float_t shwdcosx[kMaxShower]
bool insideFidVol(const double posX, const double posY, const double posZ)
const TPCGeo & TPC(unsigned int itpc) const
Return the itpc'th TPC in the cryostat.
std::string fFlashModuleLabel
double MaxZ() const
Returns the world z coordinate of the end of the box.
Float_t StartPointz[kMaxPrimaries]
tracking::Point_t Point_t
double TrackPitchInView(recob::Track const &track, geo::View_t view, size_t trajectory_point=0U)
Returns the projected length of track on a wire pitch step [cm].
Float_t vtx[kMaxVertices][3]
double Pz(const int i=0) const
double dEdx_AREA(detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, recob::Hit const &hit, double pitch, double T0=0) const
double Vz(const int i=0) const
int Mother[kMaxPrimaries]
EventNumber_t event() const
Short_t hit_tpc[kMaxHits]
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
std::string fTrackModuleLabel
float trkg4startz[kMaxTrack]
Float_t shwdedx[kMaxShower][3]
Float_t Startdcosx[kMaxPrimaries]
Int_t hit_trkkey[kMaxHits]
std::string fGenieGenModuleLabel
Float_t shwenergy[kMaxShower][3]
Float_t hit_resrange[kMaxHits]
Float_t Startdcosy[kMaxPrimaries]
auto const & get(AssnsNode< L, R, D > const &r)
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
double LifetimeCorrection(detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, double time, double T0=0) const
float trkenddcosy[kMaxTrack]
static constexpr double sr
double MinY() const
Returns the world y coordinate of the start of the box.
int NumberDaughters[kMaxPrimaries]
float trkpida[kMaxTrack][3]
Utility functions to extract information from recob::Track
void endSubRun(const art::SubRun &sr)
Float_t Px[kMaxPrimaries]
double Vy(const int i=0) const
QTextStream & endl(QTextStream &s)
Event finding and building.
Float_t flash_ZWidth[kMaxFlash]
Encapsulate the construction of a single detector plane.
float trkstartdcosz[kMaxTrack]
Signal from collection planes.
Float_t Eng[kMaxPrimaries]