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

Delphes CMS pileup card doesn't work in expert mode #61

Closed
shubhani16 opened this issue Apr 4, 2022 · 22 comments
Closed

Delphes CMS pileup card doesn't work in expert mode #61

shubhani16 opened this issue Apr 4, 2022 · 22 comments
Assignees
Labels
Delphes Delphes interface 🦾ExpertMode Expert Mode

Comments

@shubhani16
Copy link

shubhani16 commented Apr 4, 2022

Hi

I have been trying to use delphes CMS pileup card with expert mode but it breaks down with the following errors:

**===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================

#0 0x00002ac44825260c in waitpid () from /lib64/libc.so.6
#1 0x00002ac4481cff62 in do_system () from /lib64/libc.so.6
#2 0x00002ac4421e68cb in TUnixSystem::StackTrace() () from /local/software/cern/ROOT_6.24.06/install/lib/libCore.so
#3 0x00002ac4421e3e75 in TUnixSystem::DispatchSignals(ESignals) () from /local/software/cern/ROOT_6.24.06/install/lib/libCore.so
#4
#5 0x00002ac446b550ec in fastjet::GridMedianBackgroundEstimator::set_particles(std::vector<fastjet::PseudoJet, std::allocatorfastjet::PseudoJet > const&) () at GridMedianBackgroundEstimator.cc:44
#6 0x00002ac44a663af3 in FastJetGridMedianEstimator::Process() () from /mainfs/scratch/sj1n19/MG5/MG5_aMC_v3_3_1/HEPTools/madanalysis5/madanalysis5/tools/SampleAnalyzer/ExternalSymLink/Lib/libDelphes.so
#7 0x00002ac44210da2f in TTask::ExecuteTasks(char const
) () from /local/software/cern/ROOT_6.24.06/install/lib/libCore.so
#8 0x00002ac44210dc57 in TTask::ExecuteTask(char const
) () from /local/software/cern/ROOT_6.24.06/install/lib/libCore.so
#9 0x00002ac44877b077 in MA5::DetectorDelphes::Execute(MA5::SampleFormat&, MA5::EventFormat&) () from /mainfs/scratch/sj1n19/MG5/MG5_aMC_v3_3_1/HEPTools/madanalysis5/madanalysis5/tools/SampleAnalyzer/Lib/libdelphes_for_ma5.so
#10 0x000000000040867c in main ()
===========================================================

The lines below might hint at the cause of the crash.
You may get help by asking at the ROOT forum https://root.cern.ch/forum
Only if you are really convinced it is a bug in ROOT then please submit a
report at https://root.cern.ch/bugs Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
===========================================================**
#5 0x00002ac446b550ec in fastjet::GridMedianBackgroundEstimator::set_particles(std::vector<fastjet::PseudoJet, std::allocatorfastjet::PseudoJet > const&) () at GridMedianBackgroundEstimator.cc:44
#6 0x00002ac44a663af3 in FastJetGridMedianEstimator::Process() () from /mainfs/scratch/sj1n19/MG5/MG5_aMC_v3_3_1/HEPTools/madanalysis5/madanalysis5/tools/SampleAnalyzer/ExternalSymLink/Lib/libDelphes.so
#7 0x00002ac44210da2f in TTask::ExecuteTasks(char const*) () from /local/software/cern/ROOT_6.24.06/install/lib/libCore.so
#8 0x00002ac44210dc57 in TTask::ExecuteTask(char const*) () from /local/software/cern/ROOT_6.24.06/install/lib/libCore.so
#9 0x00002ac44877b077 in MA5::DetectorDelphes::Execute(MA5::SampleFormat&, MA5::EventFormat&) () from /mainfs/scratch/sj1n19/MG5/MG5_aMC_v3_3_1/HEPTools/madanalysis5/madanalysis5/tools/SampleAnalyzer/Lib/libdelphes_for_ma5.so
#10 0x000000000040867c in main ()
===========================================================**

I am actually surprised that only pileup card doesn't work in expert mode but if I try to use just CMS card with fastjet it works perfectly fine. Any help would be much appreciated.

Thanks
Shubhani

@jackaraz
Copy link
Member

jackaraz commented Apr 4, 2022

Hi @shubhani16, could you please submit a proper bug report so that we can help you with your issue. You are not providing any information about the version of your system or packages you are using or details on what you are doing. There is no way we can help you if you don't provide accurate information. Please follow dedicated issue templates; they are designed to retrieve necessary information from you. Also, please use markdown syntax while reporting.

@shubhani16
Copy link
Author

shubhani16 commented Apr 4, 2022

Hi Jack

I am using:
madanalysis version : 1.9.32

Packages:
module load gcc/10.3.0
module load python/3.7.3
module load cern_root/6.24

My toolkit consists of using delphes with expert mode analysis code. So, all the delphes card are being kept in Input folder of the main directory which I then link in main.cpp. So I want to access jets after pileup has been added to the events. This all will be done in delphes CMS card with pileup. I then have lines in my code which access reco jets from the delphes run and then I just apply cuts there and plot some histograms.

My query is that when I use simple delphes CMS card with fastjet it works fine and my code can access the jets as usual with the packages mentioned above. But with pileup card it gives as mentioned before.

I hope this is useful.

Regards
Shubhani

@jackaraz
Copy link
Member

jackaraz commented Apr 4, 2022

Hi @shubhani16, could you provide us simple sample code and a small number of events (10 events would suffice) so that we can reproduce your problem? Also, have you tested with the latest ma5 release?

@shubhani16
Copy link
Author

Hi Jack

I actually have a 10k .hepmc file without ISR/FSR and mpi which is very small in size will that work for you otherwise I can quickly generate the 10 events file.

Regards
Shubhani

@shubhani16
Copy link
Author

Hi Jack

This is the link of the dropbox folder with my code and 10 events .hepmc file:
https://www.dropbox.com/scl/fo/kqlxye4reqsgrkb55hz5m/h?dl=0&rlkey=k844ln81dkca2g42qwj4mgrb0

Let me know of you need anything else.

Regards
Shubhani

@jackaraz
Copy link
Member

jackaraz commented Apr 4, 2022

Hi @shubhani16, in the TCL card I see that you are providing a MinBias.pileup sample but you are not providing this in the link that you just shared. Delphes needs a pileup file to generate the pileup. Are you providing this in your workflow?

@shubhani16
Copy link
Author

Hi Jack

Yes, I am providing this in my workflow with a full path to access the file. I have attached the file to the dropbox link so you can access it as well.

Thanks
Shubhani

@jackaraz
Copy link
Member

jackaraz commented Apr 4, 2022

Hi @shubhani16, we can not help you if you won't provide a generically written minimal example. Your code includes paths that are defined in your workspace and it's over 600 lines of code.

@shubhani16
Copy link
Author

Hi Jack

The only thing I want to test is to grab jets. I have attached a user.cpp file which only contains information about grabbing jets in execute function. Initialise function contains particle IDS which is making up most of the lines but nothing heavy there.
Hope this works.

@shubhani16
Copy link
Author

Hi

I hope all the information is there to run a check from your side, if not I can attach the code I have been using to do the check. Let me know if any other information is needed.

Regards
Shubhani

@BFuks
Copy link
Member

BFuks commented Apr 5, 2022

Dear Shubhani,

I have tried to process your events with this CMS Delphes card (that includes pileup) and that MinBias event sample. Everything worked out of the box, without yielding any crash.

Therefore, in order to understand better what is going on, I will need to know precisely what you do, so that I could reproduce it locally step by step. Please do not forget to include all files I would need to reproduce the issue. Thanks in advance.

Regards,

Benjamin

@shubhani16
Copy link
Author

shubhani16 commented Apr 5, 2022

Hi Benjamin

Thanks for the reply. This link all the files needed.

I have added the folder"ML_fatjetimages_delphes" that I use in madanalysis to run the code for better understanding.

Step 1: all the delphes CMS.tcl cards with/without pileup are stored in Input directory of the ML_fatjetimages_delphes folder.

Step2: I make changes in Makefile to add fastjet contribs to variable R plugin (This is not an issue as the same Makefile has been used for simple MA5 analysis without delphes.). Line added:

LIBFLAGS += -lfastjet_for_ma5
LIBFLAGS += -lzlib_for_ma5
LIBFLAGS += $(shell $(MA5_BASE)/tools/SampleAnalyzer/ExternalSymLink/Bin/fastjet-config --libs --plugins)
LIBFLAGS += -lVariableR

REQUIRED3 = $(MA5_BASE)/tools/SampleAnalyzer/Lib/libfastjet_for_ma5.so
REQUIRED4 = $(MA5_BASE)/tools/SampleAnalyzer/Lib/libzlib_for_ma5.so

Step 3: changes in main.cpp, here I just add the detector and the card that needs to be used (this main.cpp also works fine for without pileup and fastjet CMS card, infact when I was using the earlier version of MA5 card with pileup used to work just fine.)
Changes made:

// Getting pointer to the analyzer
  std::map<std::string, std::string> parametersA1;
  AnalyzerBase* analyzer1 =
      manager.InitializeAnalyzer("ML_fatjetimages_delphes","MadAnalysis5job.saf",parametersA1);
  if (analyzer1==0) return 1;

  // Getting pointer to the analyzer devoted to merging plots
  std::map<std::string, std::string> parametersA2;
  parametersA2["njets"]="4";
  parametersA2["ma5_mode"]="0";
  AnalyzerBase* analyzer2 =
      manager.InitializeAnalyzer("MergingPlots","MergingPlots.saf",parametersA2);
  if (analyzer2==0) return 1;

  //Getting pointer to the writer
  WriterBase* writer1 =
      manager.InitializeWriter("lhe","delphes_reco.lhe.gz");
  if (writer1==0) return 1;

  //Getting pointer to fast-simulation package
  std::map<std::string, std::string> parametersD1;
  parametersD1["output"]="1";
  DetectorBase* fastsim1 =
      manager.InitializeDetector("delphes","../Input/delphes_card_CMS_PileUp.tcl",parametersD1);
  if (fastsim1==0) return 1;

  // Post initialization (creates the new output directory structure)
  if(!manager.PostInitialize()) return 1;

these lines are added in while loop for looping over events:

if (!analyzer2->Execute(mySample,myEvent)) continue;
fastsim1->Execute(mySample,myEvent);
if (!analyzer1->Execute(mySample,myEvent)) continue;
writer1->WriteEvent(myEvent,mySample);

Step 4: grab the rec jets in the analysis code and apply the cuts.

Step 5: After all these changes I just do

source setup.sh
make
ls /file.hepmc > ch.txt
./MadAnalysisJob --check_event ch.txt

this gives me error that I have mentioned in first post. Packages used:
root/6.24
gcc/10.3.0
python/3.7.3
madanalysis version : 1.9.32

My dropbox folder contains the pileup card, a simpler code "user.cpp" , code that I have been using for the analysis for better understanding "ML_fatjetimages_delphes.cpp", main.cpp, Makefile, pileup file, hepmc file with 10 events(I can give a 10k events file if needed) and the MA5 folder with all the changes mentioned above for an insight of what I have done so far.

Let me know if you need any other information.

Thanks for the help much appreciated.

Shubhani

@jackaraz jackaraz added 🦾ExpertMode Expert Mode Delphes Delphes interface labels Apr 10, 2022
@BFuks
Copy link
Member

BFuks commented May 20, 2022

Dear Shubhani,

Sorry for coming back to you so late. Life is hectic here...

Can you try from a more standard example? In the code above, you add many additional options to the code, like fastjetcontrib, variableR, etc... and it is not clear what can generate the error. My advice is the following.

First, run a standard analysis with the default CMS card and pileup event file. If it works, then change the path to the card (to use the one you want) and to the pileup input file (to use the one you want).

If this works, then only you can start to add functionalities by modifying the makefile (substructure stuff).

Please try this out and let me know.

Cheers,

Benjamin

@shubhani16
Copy link
Author

Dear Benjamin

Sorry for the late reply.

I will give it a go without any fastjet contrib, using the default cms card and pileup file, and let you know whether that works or not.

Regards
Shubhani

@shubhani16
Copy link
Author

Hi Benjamin

I have tried using simple code analysis but it still gives me same error even after using default delphes card with pileup and Minbias.pileup file circulated with delphes folder.

Regards
Shubhani

@BFuks
Copy link
Member

BFuks commented Jun 14, 2022 via email

@shubhani16
Copy link
Author

Hi Benjamin

This is the link to the folder and the code is called bjet_analysis_delphes.cpp. It only contains grabbing of jets and plotting the number of jets in an event so very simple. Most of the lines will be made from hadronicIDs which shouldn't be a problem.

https://www.dropbox.com/scl/fo/kqlxye4reqsgrkb55hz5m/h?dl=0&rlkey=k844ln81dkca2g42qwj4mgrb0

Regards
Shubhani

@BFuks
Copy link
Member

BFuks commented Jun 30, 2022

Dear Shubhani,

I have created a standard working directory following what I wrote in my message from Apr 5. The commands are used are:

set main.fastsim.detector = atlas-ma5tune
set main.fastsim.pileup = MinBias
set main.fastsim.pileup = MinBias.pileup
set main.fastsim.pileup = <path-to-MA5>/tools/delphes/MinBias.pileup
import <path-to-some-HEPmc-sample>

Next, I have modified the code (user.cpp) to match your file bjet_analysis_delphes.cpp. More precisely, I have added the lines containing the definition of the RawJets and Jets collections, as well as one incude line (#include "fastjet/PseudoJet.hh").

Of course, I also had to modify the Makefile to add a link to the fastjet headers (CXXFLAGS += -I$(MA5_BASE)/tools/fastjet/include) and to the fastjet libraries ($(shell $(MA5_BASE)/tools/SampleAnalyzer/ExternalSymLink/Bin/fastjet-config --libs --plugins)).

Doing all this, the code works like a charm. I am therefore wondering what is wrong in what you have done. Do you mind reproducing the steps described in this message, and start from there? Thanks in advance.

Cheers,

Benjamin

@shubhani16
Copy link
Author

Hi Benjamin

Sorry for the late reply, I was away attending the conferences.

I will try what you have suggested above and see whether that works on my machine.

Thanks
Shubhani

@shubhani16
Copy link
Author

Also

I am only using delphes as the detector and then CMS card. I have not used ma5-tune detectors for my study. Will the above command still hold for delphes?

Regards
Shubhani

@BFuks
Copy link
Member

BFuks commented Sep 14, 2022

It should. Please try to reproduce what I did above as a starting point.

@jackaraz
Copy link
Member

jackaraz commented Dec 1, 2022

Closing this issue since there has been no activity since September.

@jackaraz jackaraz closed this as completed Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Delphes Delphes interface 🦾ExpertMode Expert Mode
Projects
None yet
Development

No branches or pull requests

3 participants