1 #include "ND280AnalysisUtils.hxx" 2 #include "BasicUtils.hxx" 3 #include "CategoriesUtils.hxx" 4 #include "TreeConverterUtils.hxx" 14 std::string nutype_types[] = {
"#nu_{#mu}",
"#bar{#nu}_{#mu}",
"#nu_{e}",
"#bar{#nu}_{e}", NAMEOTHER};
15 int nutype_codes[] = {14 , -14 , 12 , -12 , CATOTHER};
16 int nutype_colors[] = {2 , 3 , 4 , 5 , COLOTHER};
17 const int NNUTYPE =
sizeof(nutype_types)/
sizeof(nutype_types[0]);
19 std::string part_types[] = {
"#mu^{-}",
"e^{-}",
"#pi^{-}",
"#mu^{+}",
"e^{+}",
"#pi^{+}",
"p" , NAMEOTHER};
20 int pdg[] = {13 , 11 , -211 , -13 , -11 , 211 , 2212, CATOTHER};
21 int part_colors[] = {2 , 3 , 4 , 7 , 6 , 31 , 8 , COLOTHER};
22 const int NPART =
sizeof(part_types)/
sizeof(part_types[0]);
24 std::string parent_types[] = {
"#mu^{-}",
"e^{-}",
"#pi^{-}",
"#mu^{+}",
"e^{+}",
"#pi^{+}",
"p",
"nu",
"gamma",
"#pi^{0}",
"n" , NAMEOTHER};
25 int parent_pdg[] = {13 , 11 , -211 , -13 , -11 , 211 , 2212, 0 , 22 , 111 , 2112, CATOTHER};
26 int parent_colors[] = {2 , 3 , 4 , 7 , 6 , 31 , 1 , 8 , 9 , 40 , 95 , COLOTHER};
27 const int NPARENT =
sizeof(parent_types)/
sizeof(parent_types[0]);
29 std::string reac_types[] = {
"CCQE", NAME2P2H,
"RES",
"DIS",
"COH",
"NC",
"#bar{#nu}_{#mu}",
"#nu_{e}, #bar{#nu}_{e}", NAMEOTHER, NAMEOUTFV};
30 int reac_codes[] = {0 , CAT2P2H , 1 , 2 , 3 , 4 , 5 , 6 , CATOTHER , CATOUTFV};
31 int reac_colors[] = {2 , COL2P2H , 3 , 4 , 7 , 6 , 31 , 65 , COLOTHER , COLOUTFV};
32 const int NREAC =
sizeof(reac_types)/
sizeof(reac_types[0]);
34 std::string reacCC_types[] = {
"CC",
"NC",
"#bar{#nu}_{#mu}",
"#nu_{e}, #bar{#nu}_{e}", NAMEOTHER, NAMEOUTFV};
35 int reacCC_codes[] = {1 , 4 , 5 , 6 , CATOTHER , CATOUTFV};
36 int reacCC_colors[] = {2 , 6 , 31 , 65 , COLOTHER , COLOUTFV};
37 const int NREACCC =
sizeof(reacCC_types)/
sizeof(reacCC_types[0]);
39 std::string reacnofv_types[] = {
"CCQE", NAME2P2H,
"RES",
"DIS",
"COH",
"NC",
"#bar{#nu}_{#mu}",
"#nu_{e}, #bar{#nu}_{e}", NAMEOTHER};
40 int reacnofv_codes[] = {0 , CAT2P2H , 1 , 2 , 3 , 4 , 5 , 6 , CATOTHER};
41 int reacnofv_colors[] = {2 , COL2P2H , 3 , 4 , 7 , 6 , 31 , 65 , COLOTHER};
42 const int NREACNOFV =
sizeof(reacnofv_types)/
sizeof(reacnofv_types[0]);
44 std::string topology_types[] = {
"CC-0#pi",
"CC-1#pi^{+}",
"CC-other", NAMEBKG, NAMEOUTFV};
45 int topology_codes[] = {0 , 1 , 2 , 3 , CATOUTFV};
46 int topology_colors[] = {2 , 4 , 7 , COLBKG , COLOUTFV};
47 const int NTOPOLOGY =
sizeof(topology_types)/
sizeof(topology_types[0]);
49 std::string topology_no1pi_types[] = {
"CC-0#pi",
"CC-N#pi", NAMEBKG, NAMEOUTFV};
50 int topology_no1pi_codes[] = {0 , 1 , 2 , CATOUTFV};
51 int topology_no1pi_colors[] = {2 , 3 , COLBKG , COLOUTFV};
52 const int NTOPOLOGYNO1PI =
sizeof(topology_no1pi_types)/
sizeof(topology_no1pi_types[0]);
54 std::string topology_withpi0_types[] = {
"CC-0#pi",
"CC-1#pi",
"CC-X#pi^{0}",
"CC-other", NAMEBKG, NAMEOUTFV};
55 int topology_withpi0_codes[] = {0 , 1 , 2 , 3 , 4 , CATOUTFV};
56 int topology_withpi0_colors[] = {2 , 4 , 31 , 65 , COLBKG , COLOUTFV};
57 const int NTOPOLOGYWITHPI0 =
sizeof(topology_withpi0_types)/
sizeof(topology_withpi0_types[0]);
59 std::string topology_ccpizero_types[] = {
"CC-1#pi^{0}",
"CC-#pi^{0}+X",
"CC-other", NAMEBKG, NAMEOUTFV};
60 int topology_ccpizero_codes[] = {0 , 1 , 2 , 3 , CATOUTFV};
61 int topology_ccpizero_colors[] = {2 , 4 , 7 , COLBKG , COLOUTFV};
62 const int NTOPOLOGYCCPIZERO =
sizeof(topology_ccpizero_types)/
sizeof(topology_ccpizero_types[0]);
64 std::string mectopology_types[] = {
"CC-0#pi-0p",
"CC-0#pi-1p",
"CC-0#pi-Np",
"CC-1#pi^{+}",
"CC-other", NAMEBKG, NAMEOUTFV};
65 int mectopology_codes[] = {0 , 1 , 2 , 3 , 4 , 5 , CATOUTFV};
66 int mectopology_colors[] = {2 , 3 , 4 , 7 , 31 , COLBKG , COLOUTFV};
67 const int NMECTOPOLOGY =
sizeof(mectopology_types)/
sizeof(mectopology_types[0]);
69 std::string target_types[] = {
"Carbon",
"Oxygen",
"Hydrogen",
"Aluminium",
"Iron",
"Copper",
"Zinc",
"Lead", NAMEOTHER,
"#splitline{coh on H}{bugzilla 1056}"};
70 int target_codes[] = {6 , 8 , 1 , 13 , 26 , 29 , 30 , 82 , CATOTHER, 0 };
71 int target_colors[] = {2 , 4 , 3 , 7 , 6 , 51 , 31 , 5 , COLOTHER, 40};
72 const int NTARGET =
sizeof(target_types)/
sizeof(target_types[0]);
74 std::string sense_types[] = {
"forward-correct",
"forward-wrong",
"backward-correct",
"backward-wrong",
"no z component",
"unknown"};
75 int sense_codes[] = {0 , 1 , 2 , 3 , 4 , 5 };
76 int sense_colors[] = {2 , 3 , 4 , 7 , 6 , 31 };
79 std::string detector_types[] = {
"TPC1",
"TPC2",
"TPC3",
"FGD1",
"FGD2",
"DsECAL",
"BrECAL",
"P0DECAL",
"P0D",
"SMRD", NAMEOTHER};
80 int detector_codes[] = {6,
92 int detector_colors[] = {2, 3, 4, 7, 6, 31, 51, 1, 65, 9, COLOTHER};
93 const int NDETECTOR =
sizeof(detector_types)/
sizeof(detector_types[0]);
95 std::string momrelerr_types[] = {
"0<momrelerr<0.05",
"0.05<momrelerr<0.1",
"0.1<momrelerr<0.2",
"0.2<momrelerr<0.3",
"0.3<momrelerr<0.4",
"0.4<momrelerr<0.5",
"0.5<momrelerr<0.6",
"0.6<momrelerr<0.8",
"0.8<momrelerr<1"};
96 int momrelerr_codes[] = { 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8};
97 int momrelerr_colors[] = { 1 , 2 , 4 , 3 , 6 , 7 , 31 , 5 , 8};
105 _categ->
AddCategory(prefix+
"particle", NPART, part_types, pdg, part_colors);
106 _categ->
AddCategory(prefix+
"parent", NPARENT, parent_types, parent_pdg, parent_colors);
107 _categ->
AddCategory(prefix+
"gparent", NPARENT, parent_types, parent_pdg, parent_colors);
108 _categ->
AddCategory(prefix+
"primary", NPARENT, parent_types, parent_pdg, parent_colors);
110 _categ->
AddCategory(prefix+
"nutype", NNUTYPE, nutype_types, nutype_codes, nutype_colors);
111 _categ->
AddCategory(prefix+
"nuparent", NPARENT, parent_types, parent_pdg, parent_colors);
112 _categ->
AddCategory(prefix+
"target", NTARGET, target_types, target_codes, target_colors);
113 _categ->
AddCategory(prefix+
"detector", NDETECTOR, detector_types, detector_codes, detector_colors);
115 _categ->
AddCategory(prefix+
"reaction", NREAC, reac_types, reac_codes, reac_colors);
116 _categ->
AddCategory(prefix+
"reactionCC", NREACCC, reacCC_types, reacCC_codes, reacCC_colors);
117 _categ->
AddCategory(prefix+
"reactionnofv", NREACNOFV, reacnofv_types, reacnofv_codes, reacnofv_colors);
118 _categ->
AddCategory(prefix+
"topology", NTOPOLOGY, topology_types, topology_codes, topology_colors);
119 _categ->
AddCategory(prefix+
"topology_no1pi", NTOPOLOGYNO1PI, topology_no1pi_types, topology_no1pi_codes, topology_no1pi_colors);
120 _categ->
AddCategory(prefix+
"topology_withpi0", NTOPOLOGYWITHPI0, topology_withpi0_types, topology_withpi0_codes, topology_withpi0_colors);
121 _categ->
AddCategory(prefix+
"topology_ccpizero", NTOPOLOGYCCPIZERO, topology_ccpizero_types, topology_ccpizero_codes, topology_ccpizero_colors);
122 _categ->
AddCategory(prefix+
"mectopology", NMECTOPOLOGY, mectopology_types, mectopology_codes, mectopology_colors);
131 reac_types[6] =
"#nu_{#mu}";
132 reacCC_types[2] =
"#nu_{#mu}";
133 reacnofv_types[6] =
"#nu_{#mu}";
134 mectopology_types[0] =
"CC-0#pi-0n";
135 mectopology_types[1] =
"CC-0#pi-1n";
136 mectopology_types[2] =
"CC-0#pi-Nn";
137 mectopology_types[3] =
"CC-1#pi^{-}";
138 topology_types[1] =
"CC-1#pi^{-}";
168 if ( ! IsAntinu && Nmuon <= 0)
return BKG;
169 if (IsAntinu && Nantimuon <= 0)
return BKG;
172 if (Nmeson == 0)
return CC_0pi_0meson;
176 if ( ! IsAntinu && Npipos == 1)
return CC_1pi_0meson;
177 else if (IsAntinu && Npineg == 1)
return CC_1pi_0meson;
200 if (topo == CC_other)
return 1;
201 else if (topo == BKG)
return 2;
225 if (topo == CC_other) {
226 if (Npi0 > 0)
return 2;
229 else if (topo == BKG)
return 4;
255 if ( ! IsAntinu && Nmuon <= 0)
return 3;
256 if (IsAntinu && Nantimuon <= 0)
return 3;
259 if (Npi0 == 1 && Nmeson == 1)
return 0;
262 else if (Npi0 > 0)
return 1;
289 if (topo == CC_0pi_0meson) {
291 if ( ! IsAntinu) Nnucleon = Nproton;
292 else Nnucleon = Nneutron;
293 if (Nnucleon == 0)
return 0;
294 if (Nnucleon == 1)
return 1;
295 if (Nnucleon > 1)
return 2;
297 else if (topo == CC_1pi_0meson)
return 3;
298 else if (topo == CC_other)
return 4;
299 else if (topo == BKG)
return 5;
300 else if (topo == CATOUTFV)
return CATOUTFV;
302 else std::cout <<
"Error in getting topology codes!" << std::endl;
325 void anaUtils::SetCategoriesDefaultCode(
const std::string& prefix,
const int code){
328 _categ->
SetCode(prefix +
"nutype" , code);
329 _categ->
SetCode(prefix +
"nuparent" , code);
330 _categ->
SetCode(prefix +
"detector" , code);
331 _categ->
SetCode(prefix +
"target" , code);
333 _categ->
SetCode(prefix +
"reaction" , code);
334 _categ->
SetCode(prefix +
"reactionCC" , code);
335 _categ->
SetCode(prefix +
"reactionnofv" , code);
336 _categ->
SetCode(prefix +
"topology" , code);
337 _categ->
SetCode(prefix +
"topology_no1pi" , code);
338 _categ->
SetCode(prefix +
"topology_withpi0" , code);
339 _categ->
SetCode(prefix +
"topology_ccpizero" , code);
340 _categ->
SetCode(prefix +
"mectopology" , code);
347 if ( ! track)
return;
353 SetCategoriesDefaultCode(prefix, CATSAND);
354 _categ->
SetCode(prefix +
"particle", CATSAND);
355 _categ->
SetCode(prefix +
"parent" , CATSAND);
356 _categ->
SetCode(prefix +
"gparent" , CATSAND);
357 _categ->
SetCode(prefix +
"primary" , CATSAND);
362 SetCategoriesDefaultCode(prefix, CATNOTRUTH);
363 _categ->
SetCode(prefix +
"particle", CATNOTRUTH);
364 _categ->
SetCode(prefix +
"parent" , CATNOTRUTH);
365 _categ->
SetCode(prefix +
"gparent" , CATNOTRUTH);
366 _categ->
SetCode(prefix +
"primary" , CATNOTRUTH);
381 _categ->
SetCode(prefix +
"particle", trueTrack->
PDG, CATOTHER);
386 _categ->
SetCode(prefix +
"primary", primary->
PDG, CATOTHER);
397 if ( ! trueVertexB)
return;
403 SetCategoriesDefaultCode(prefix, CATSAND);
407 SetCategoriesDefaultCode(prefix, CATNOTRUTH);
414 _categ->
SetCode(prefix +
"nutype", trueVertex->
NuPDG ,CATOTHER);
419 _categ->
SetCode(prefix +
"detector", Detector_tmp ,CATOTHER);
422 _categ->
SetCode(prefix +
"reaction",
GetReaction(*trueVertex,det,IsAntinu) ,CATOTHER);
423 _categ->
SetCode(prefix +
"reactionCC", GetReactionCC(*trueVertex,det,IsAntinu) ,CATOTHER);
424 _categ->
SetCode(prefix +
"reactionnofv", GetReactionNoFgdFv(*trueVertex,IsAntinu) ,CATOTHER);
426 _categ->
SetCode(prefix +
"topology_no1pi", GetTopology_no1pi(*trueVertex,det,IsAntinu) );
428 _categ->
SetCode(prefix +
"topology_ccpizero", GetTopologyCCPiZero(*trueVertex, det,IsAntinu) );
440 Int_t anaUtils::GetReactionNoFgdFv(
const AnaTrueVertex& trueVertex,
bool IsAntinu){
456 Int_t nutype = trueVertex.
NuPDG;
459 if (abs(nutype) == 12)
return 6;
462 else if (IsAntinu && nutype == 14)
return 5;
463 else if ( ! IsAntinu && nutype == -14)
return 5;
466 else if (abs(nutype) == 14) {
467 if (abs(reac) == 1)
return 0;
468 if (abs(reac) == 2 )
return CAT2P2H;
470 if (abs(reac) == 70 )
return CAT2P2H;
471 if (abs(reac) >10 && abs(reac)<14)
return 1;
472 if (abs(reac) >16 && abs(reac)<30)
return 2;
473 if (abs(reac) ==16)
return 3;
474 if (abs(reac) >30)
return 4;
492 return GetReactionNoFgdFv(trueVertex,IsAntinu);
505 if (reac >= 0 && reac < 4)
return 1;
506 else if (reac == CAT2P2H)
return 1;
538 Int_t anaUtils::GetReactionNoFgdFv_antinu(
const AnaTrueVertex& trueVertex) {
return GetReactionNoFgdFv(trueVertex,
true);}
AnaTrueVertexB * TrueVertex
Pointer to the AnaTrueVertexB of the interaction that created this AnaTrueParticleB.
Int_t GetTopology_withpi0(const AnaTrueVertex &trueVertex, const SubDetId::SubDetEnum det=SubDetId::kFGD1, bool IsAntinu=false)
Classify the topology type for nu-mu CC pi-zero analysis.
Representation of a global track.
Int_t NuPDG
The PDG code of the incoming neutrino.
Int_t LeptonPDG
The PDG code of the primary outgoing electron/muon.
void AddCategory(const std::string &name, int ntypes, std::string *names, int *codes, int *colors, bool multi=false, bool noWarning=false, bool addNOTRUTH=true, bool addSAND=true)
void SetCode(const std::string &categ, int code, int defaultcode=0)
Int_t NuParentPDG
Neutrino parent PDG code.
bool GetIsSandMC() const
Return whether this event is from Sand Monte Carlo or not.
Representation of a true Monte Carlo vertex.
Int_t GParentPDG
The PDG code of this particle's grandparent, or 0 if there is no grandparent.
AnaTrueObjectC * TrueObject
The link to the true oject that most likely generated this reconstructed object.
Int_t GetMECTopology(const AnaTrueVertex &trueVertex, const SubDetId::SubDetEnum det=SubDetId::kFGD1, bool IsAntinu=false)
Classify reaction topologies in special attention to MEC process.
Int_t TargetPDG
The PDG code of the target nucleus.
Int_t GetTopology(const AnaTrueVertex &trueVertex, const SubDetId::SubDetEnum det=SubDetId::kFGD1, bool IsAntinu=false)
Classify reaction topologies.
Int_t GetReaction(const AnaTrueVertex &trueVertex, const SubDetId::SubDetEnum det=SubDetId::kFGD1, bool IsAntinu=false)
Classify reaction types.
Int_t GetTopology_antinu(const AnaTrueVertex &trueVertex, const SubDetId::SubDetEnum det=SubDetId::kFGD1)
Classify reaction types for antinu.
Representation of a true Monte Carlo vertex.
Representation of a true Monte Carlo trajectory/particle.
void AddStandardAntiNumuCategories(const std::string &prefix="")
Add the standard categories only, given a prefix for their name.
Float_t Position[4]
The position the true interaction happened at.
SubDetEnum
Enumeration of all detector systems and subdetectors.
Int_t PDG
The PDG code of this particle.
Int_t ParentPDG
The PDG code of this particle's immediate parent, or 0 if there is no parent.
void FillCategories(AnaEventB *event, AnaTrack *track, const std::string &prefix, const SubDetId::SubDetEnum det=SubDetId::kFGD1, bool IsAntinu=false, bool useCATSAND=true)
Fill the track categories for color drawing.
AnaTrueParticleB * GetTrueParticleByID(const AnaEventB &event, int ID)
Get the AnaTrueParticleB in the current spill with the given ID. Return NULL if it can't be found...
void AddStandardCategories(const std::string &prefix="")
Add the standard categories only, given a prefix for their name.
AnaTrueParticleB * GetTrueParticle() const
Return a casted version of the AnaTrueObject associated.
bool InFiducialVolume(SubDetId::SubDetEnum det, const Float_t *pos, const Float_t *FVdefmin, const Float_t *FVdefmax)
Representation of a true Monte Carlo trajectory/particle.
void ConvertBitFieldToTrueParticleDetEnum(unsigned long det, int &trueDet)
Get highland style numbering for true objects.
Int_t GetTargetCode(const AnaTrueVertex *trueVertex)
Get the code for filling the target PDG category.
Int_t NPrimaryParticles[Int_t(ParticleId::kLast)+1]
Array to count the outgoing primary particles of each type (.