Skip to content

Commit cc67711

Browse files
committed
added some lines to pint MC signal to terminal
1 parent 529ac7e commit cc67711

5 files changed

Lines changed: 75 additions & 41 deletions

File tree

PWGDQ/Core/MCProng.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ void MCProng::SetUseANDonSourceBits(int generation, bool option /*=true*/)
104104
}
105105

106106
//________________________________________________________________________________________________________________
107-
void MCProng::SetDirectionOfGeneration(int generation, bool intime /*=false*/)
107+
void MCProng::SetSignalInTime(int generation, bool intime /*=false*/)
108108
{
109109
if (generation < 0 || generation >= fNGenerations) {
110110
return;

PWGDQ/Core/MCProng.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class MCProng
8787
void SetSources(int generation, uint64_t bits, uint64_t exclude = 0, bool useANDonSourceBits = true);
8888
void SetSourceBit(int generation, int sourceBit, bool exclude = false);
8989
void SetUseANDonSourceBits(int generation, bool option = true);
90-
void SetDirectionOfGeneration(int generation, bool intime = false); // set variable to check generations in time or back in time (default)
90+
void SetSignalInTime(int generation, bool intime = false); // set variable to check generations in time or back in time (default)
9191
void Print() const;
9292
bool TestPDG(int i, int pdgCode) const;
9393
bool ComparePDG(int pdg, int prongPDG, bool checkBothCharges = false, bool exclude = false) const;

PWGDQ/Core/MCSignal.h

Lines changed: 67 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -130,18 +130,20 @@ class MCSignal : public TNamed
130130
template <typename U, typename T>
131131
bool MCSignal::CheckProng(int i, bool checkSources, const U& mcStack, const T& track)
132132
{
133+
// // if generations are checked in time (grandmother->mother->daughter) reverse order of MCProng variables to start at the end
134+
// if (fProngs[i].fCheckGenerationsInTime) {
135+
// std::reverse(fProngs[i].fPDGcodes.begin(), fProngs[i].fPDGcodes.end());
136+
// std::reverse(fProngs[i].fCheckBothCharges.begin(), fProngs[i].fCheckBothCharges.end());
137+
// std::reverse(fProngs[i].fExcludePDG.begin(), fProngs[i].fExcludePDG.end());
138+
// std::reverse(fProngs[i].fSourceBits.begin(), fProngs[i].fSourceBits.end());
139+
// std::reverse(fProngs[i].fExcludeSource.begin(), fProngs[i].fExcludeSource.end());
140+
// std::reverse(fProngs[i].fUseANDonSourceBitMap.begin(), fProngs[i].fUseANDonSourceBitMap.end());
141+
// }
142+
133143
auto currentMCParticle = track;
144+
134145
// loop over the generations specified for this prong
135146
for (int j = 0; j < fProngs[i].fNGenerations; j++) {
136-
// if generations are checked in time (grandmother->mother->daughter) reverse order of MCProng variables to start at the end
137-
if (fProngs[i].fCheckGenerationsInTime) {
138-
std::reverse(fProngs[i].fPDGcodes.begin(), fProngs[i].fPDGcodes.end());
139-
std::reverse(fProngs[i].fCheckBothCharges.begin(), fProngs[i].fCheckBothCharges.end());
140-
std::reverse(fProngs[i].fExcludePDG.begin(), fProngs[i].fExcludePDG.end());
141-
std::reverse(fProngs[i].fSourceBits.begin(), fProngs[i].fSourceBits.end());
142-
std::reverse(fProngs[i].fExcludeSource.begin(), fProngs[i].fExcludeSource.end());
143-
std::reverse(fProngs[i].fUseANDonSourceBitMap.begin(), fProngs[i].fUseANDonSourceBitMap.end());
144-
}
145147
// check the PDG code
146148
if (!fProngs[i].TestPDG(j, currentMCParticle.pdgCode())) {
147149
return false;
@@ -160,42 +162,69 @@ bool MCSignal::CheckProng(int i, bool checkSources, const U& mcStack, const T& t
160162
// if checking back in time: look for mother
161163
// else (checking in time): look for daughter
162164
if (!fProngs[i].fCheckGenerationsInTime) {
163-
// make sure that a mother exists in the stack before moving one generation further in history
164-
if (!currentMCParticle.has_mothers() && j < fProngs[i].fNGenerations - 1) {
165-
return false;
166-
}
167-
if (currentMCParticle.has_mothers() && j < fProngs[i].fNGenerations - 1) {
168-
/*for (auto& m : mcParticle.mothers_as<aod::McParticles_001>()) {
169-
LOGF(debug, "M2 %d %d", mcParticle.globalIndex(), m.globalIndex());
170-
}*/
171-
currentMCParticle = currentMCParticle.template mothers_first_as<U>();
172-
// currentMCParticle = mcStack.iteratorAt(currentMCParticle.mothersIds()[0]);
173-
// currentMCParticle = currentMCParticle.template mother0_as<U>();
174-
}
165+
// if (currentMCParticle.has_mothers() > 0) {
166+
// printf("CheckGenInTime = %i \n", fProngs[i].fCheckGenerationsInTime);
167+
// printf("currentPart pdg = %i \n", currentMCParticle.pdgCode());
168+
// printf("fProng.NGenerations = %i \n", fProngs[i].fNGenerations);
169+
// for (int k = 0; k < fProngs[i].fNGenerations; k++) {
170+
// printf("fProng.pdg(kGen=%i) = %i \n", k, fProngs[i].fPDGcodes[k]);
171+
// }
172+
// printf("currentParticle.hasMothers = %i \n", currentMCParticle.has_mothers());
173+
174+
// make sure that a mother exists in the stack before moving one generation further in history
175+
if (!currentMCParticle.has_mothers() && j < fProngs[i].fNGenerations - 1) {
176+
return false;
177+
}
178+
if (currentMCParticle.has_mothers() && j < fProngs[i].fNGenerations - 1) {
179+
/*for (auto& m : mcParticle.mothers_as<aod::McParticles_001>()) {
180+
LOGF(debug, "M2 %d %d", mcParticle.globalIndex(), m.globalIndex());
181+
}*/
182+
currentMCParticle = currentMCParticle.template mothers_first_as<U>();
183+
// printf("changed to mother particle pdg = %i \n", currentMCParticle.pdgCode());
184+
// currentMCParticle = mcStack.iteratorAt(currentMCParticle.mothersIds()[0]);
185+
// currentMCParticle = currentMCParticle.template mother0_as<U>();
186+
}
187+
// }
175188
} else {
176-
// make sure that a daughter exists in the stack before moving one generation younger
177-
if (!currentMCParticle.has_daughters() && j < fProngs[i].fNGenerations - 1) {
178-
return false;
179-
}
180-
if (currentMCParticle.has_daughters() && j < fProngs[i].fNGenerations - 1) {
181-
currentMCParticle = currentMCParticle.template mothers_first_as<U>();
182-
// currentMCParticle = mcStack.iteratorAt(currentMCParticle.mothersIds()[0]);
183-
}
189+
// if (currentMCParticle.has_daughters() > 0) {
190+
// printf("CheckGenInTime = %i \n", fProngs[i].fCheckGenerationsInTime);
191+
// printf("currentPart pdg = %i \n", currentMCParticle.pdgCode());
192+
// printf("fProng.NGenerations = %i \n", fProngs[i].fNGenerations);
193+
// for (int k = 0; k < fProngs[i].fNGenerations; k++) {
194+
// printf("fProng.pdg(kGen=%i) = %i \n", k, fProngs[i].fPDGcodes[k]);
195+
// }
196+
// printf("currentParticle.hasDaugthers = %i \n", currentMCParticle.has_daughters());
197+
// make sure that a daughter exists in the stack before moving one generation younger
198+
if (!currentMCParticle.has_daughters() && j < fProngs[i].fNGenerations - 1) {
199+
return false;
200+
}
201+
if (currentMCParticle.has_daughters() && j < fProngs[i].fNGenerations - 1) {
202+
auto daughtersSlice = currentMCParticle.template daughters_as<U>();
203+
// printf("DaughtersSlice.size = %i \n", daughtersSlice.size());
204+
for (auto d : daughtersSlice) {
205+
// printf("daughterPart pdg = %i \n", d.pdgCode());
206+
currentMCParticle = d;
207+
// printf("changed currentPart pdg = %i \n", currentMCParticle.pdgCode());
208+
}
209+
// currentMCParticle = mcStack.iteratorAt(currentMCParticle.daughtersIds()[0]);
210+
}
211+
// printf(" -------------- \n");
212+
// }
184213
}
185214
}
186215

187216
if (checkSources) {
188217
currentMCParticle = track;
189218
for (int j = 0; j < fProngs[i].fNGenerations; j++) {
190219
// if generations are checked in time (grandmother->mother->daughter) reverse order of MCProng variables to start at the end
191-
if (fProngs[i].fCheckGenerationsInTime) {
192-
std::reverse(fProngs[i].fPDGcodes.begin(), fProngs[i].fPDGcodes.end());
193-
std::reverse(fProngs[i].fCheckBothCharges.begin(), fProngs[i].fCheckBothCharges.end());
194-
std::reverse(fProngs[i].fExcludePDG.begin(), fProngs[i].fExcludePDG.end());
195-
std::reverse(fProngs[i].fSourceBits.begin(), fProngs[i].fSourceBits.end());
196-
std::reverse(fProngs[i].fExcludeSource.begin(), fProngs[i].fExcludeSource.end());
197-
std::reverse(fProngs[i].fUseANDonSourceBitMap.begin(), fProngs[i].fUseANDonSourceBitMap.end());
198-
}
220+
// if (fProngs[i].fCheckGenerationsInTime) {
221+
// std::reverse(fProngs[i].fPDGcodes.begin(), fProngs[i].fPDGcodes.end());
222+
// std::reverse(fProngs[i].fCheckBothCharges.begin(), fProngs[i].fCheckBothCharges.end());
223+
// std::reverse(fProngs[i].fExcludePDG.begin(), fProngs[i].fExcludePDG.end());
224+
// std::reverse(fProngs[i].fSourceBits.begin(), fProngs[i].fSourceBits.end());
225+
// std::reverse(fProngs[i].fExcludeSource.begin(), fProngs[i].fExcludeSource.end());
226+
// std::reverse(fProngs[i].fUseANDonSourceBitMap.begin(), fProngs[i].fUseANDonSourceBitMap.end());
227+
// }
199228
if (!fProngs[i].fSourceBits[j]) {
200229
// no sources required for this generation
201230
continue;
@@ -262,7 +291,7 @@ bool MCSignal::CheckProng(int i, bool checkSources, const U& mcStack, const T& t
262291
return false;
263292
}
264293
if (currentMCParticle.has_daughters() && j < fProngs[i].fNGenerations - 1) {
265-
currentMCParticle = currentMCParticle.template mothers_first_as<U>();
294+
// currentMCParticle = currentMCParticle.template mothers_first_as<U>();
266295
// currentMCParticle = mcStack.iteratorAt(currentMCParticle.mothersIds()[0]);
267296
}
268297
}

PWGDQ/Core/MCSignalLibrary.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ MCSignal* o2::aod::dqmcsignals::GetMCSignal(const char* name)
284284
if (!nameStr.compare("eFromLMeeLFQ")) {
285285
MCProng prong(2, {11, 900}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false});
286286
//prong.SetSourceBit(0, MCProng::kPhysicalPrimary, false); // set source to be ALICE primary particles
287-
prong.SetDirectionOfGeneration(0, true); // set direction to check generation in time (true) or back in time (false)
287+
prong.SetSignalInTime(0, false); // set direction to check generation in time (true) or back in time (false)
288288
signal = new MCSignal(name, "Electrons from LF meson + quarkonia decays", {prong}, {-1}); //pi0,eta,eta',rho,omega,phi,jpsi,psi2s mesons
289289
return signal;
290290
}

PWGEM/Tasks/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,8 @@ o2physics_add_dpl_workflow(phoscluqa
1818
SOURCES phosCluQA.cxx
1919
PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore O2::DetectorsVertexing O2::PHOSBase
2020
COMPONENT_NAME Analysis)
21+
22+
o2physics_add_dpl_workflow(analysemcsignal
23+
SOURCES analysemcsignal.cxx
24+
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsBase O2Physics::AnalysisCore O2Physics::PWGDQCore
25+
COMPONENT_NAME Analysis)

0 commit comments

Comments
 (0)