Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to access genjets() in expert mode of MadAnalysis 5 v1.9.60. #266

Open
meena91 opened this issue Oct 15, 2024 · 12 comments
Open
Labels
❓question Further information is requested

Comments

@meena91
Copy link

meena91 commented Oct 15, 2024

Question

First I have produced tag_1_pythia8_events.hepmc.gz in MG5_aMC_v3_3_2  with Pythia8. Then I used Delphes v3.5.0 ./DelphesHepMC2 to convert HEP file into root files. I have saved genjets module FastJetFinder GenJetFinder { set InputArray NeutrinoFilter/filteredParticles set OutputArray genjets set JetAlgorithm 6 set ParameterR 0.4 set JetPTMin 1.0 }  "add Branch GenJetFinder/genjets GenJet Jet"in delphes card.  This is my loop in expert mode if (event.mc()!=0) { } if (event.rec()!=0 ) {std::cout << "Number of GenJets: " << event.rec()->genjets().size() << std::endl;} I am not getting error but genjets size is zero and there is no events for that. But I can see the events in delphes root files. Could you please help me in this case?

@meena91 meena91 added the ❓question Further information is requested label Oct 15, 2024
@BFuks
Copy link
Member

BFuks commented Oct 15, 2024

Hi,

You should run Delphes from MA5 directly.

Regards,

Benjamin

@meena91
Copy link
Author

meena91 commented Oct 15, 2024

Dear Bejnamin,

Thank you for your reply. But I did not understand how I have to run delphes from MA5. Could you please elaborate it.

Thank you in advance,
Meena

@meena91
Copy link
Author

meena91 commented Oct 15, 2024

Dear Benjamin,

I found some instruction
/bin/ma5 -R
set main.fastsim.package = delphes
set main.fastsim.detector = cms
import my_hepmc_file
submit delphes_run

It will run on default card, but I want to use delphes_card_FCCeeDetWithSiTracking.tcl and AntiKt algorithm both at gen and reco -level. Could you please help how I have to modify these instructions? 

Thank you in Advance,
Meena

@BFuks
Copy link
Member

BFuks commented Oct 15, 2024 via email

@meena91
Copy link
Author

meena91 commented Oct 16, 2024

Hi Benjamin,

I tried this way also, after  command "submit delphes_run" , I rename delphes_card_FCCeeDetWithSiTracking.tcl to delphes_cms.tcl in Input direcotry, then again I run Sample analyser on MG5_aMC_v3_3_2/MadAnalysis5/madanalysis5/delphes_run/Output/SAF/_defaultset/RecoEvents0_0/DelphesEvents.root
Still there is same issue not able to access event.rec()->genjets()  while there are enough entries/events in DelphesEvents.root.  But I am able to access other gen particle with PDGID code in event.mc().

@BFuks
Copy link
Member

BFuks commented Oct 16, 2024 via email

@meena91
Copy link
Author

meena91 commented Oct 16, 2024

In delphes card, this is the definition of genjets: add Branch GenJetFinder/genjets GenJet Jet
so, In delphes, I can only middle name ( GenJet ) from this Branch GenJetFinder/genjets GenJet Jet. So, yes, I can see, also I am attaching the screenshot of root file branch.

Another example for reco-level jets are saved as  "add Branch JetEnergyScale/jets Jet Jet" in delphes card. So, we can Jet in delphes.root file and I am able to access that from SampleAnalyzer MA expert mode.

Best Regards,
Meena
MA5_delphes_output

@BFuks
Copy link
Member

BFuks commented Oct 16, 2024 via email

@meena91
Copy link
Author

meena91 commented Oct 16, 2024

Hi Benjamin,

Yes, I saw same issue with default cms card also. I tried both method for Branch in card default one is "add Branch GenJetFinder/jets GenJet Jet" and "add Branch GenJetFinder/genjets GenJet Jet"

Best Regards,
Meena

@BFuks
Copy link
Member

BFuks commented Oct 17, 2024 via email

@meena91
Copy link
Author

meena91 commented Oct 17, 2024

Dear Benjamin,

I tried both method but did not work.
1st method :
Just uncommented the following lines in DelphesMemoryInterface.cpp and rerun the code but getting the same problem.

// --------------GenJet collection
if (genjetsArray!=0)
{
for (MAuint32 i=0;i<static_cast(genjetsArray->GetEntries());i++)
{
Candidate* cand = dynamic_cast<Candidate*>(genjetsArray->At(i));
if (cand==0)
{
ERROR << "impossible to access the " << i+1 << "th genjet" << endmsg;
continue;
}
RecJetFormat* genjet = myEvent.rec()->GetNewGenJet();
genjet->momentum_ = cand->Momentum;
genjet->btag_ = cand->BTag;
}
}

void DelphesMemoryInterface::Initialize(TFolder* delphesFolder,
const std::mapstd::string,std::string& table,
MAbool MA5card)
{
// DelphesMA5 card ?
delphesMA5card_=MA5card;

// Official Delphes collections
GenJet_ = GetCollection(delphesFolder,table,"GenJet");
......
}

2nd method: getting error that " no member named 'genjets' in 'MA5::MCParticleFormat''

for (MAuint32 i = 0; i < event.mc()->particles().size(); i++) {
const MCParticleFormat* part = &(event.mc()->particles()[i]);
cout<<" gen jets="<genjets().size<<endl;
}
error: no member named 'genjets' in 'MA5::MCParticleFormat'

Could you send me the modified DelphesMemoryInterface.cpp if I did not do it correctly.
Is there any further command need to run after modifying DelphesMemoryInterface.cpp and before the delphes_run ?

Best Regards,
Meena

@BFuks
Copy link
Member

BFuks commented Oct 17, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❓question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants