# Avoiding wmLHEGEN Step

## Why Avoid wmLHEGEN Step

{% hint style="danger" %}
**Warning note for wmLHEGEN step.**\
There's a buggy-like issue with the CRAB publications. wmLHEGEN step gives you two output paths which are RAWSIMoutput and LHEoutput. Until last year, the two paths stored the corresponding output files correctly. For some unknown reason reported to hypernews [link1](https://hypernews.cern.ch/HyperNews/CMS/get/computing-tools/5909.html) [link2](https://hypernews.cern.ch/HyperNews/CMS/get/computing-tools/5954.html), there are some crazy mixups that the output files and the paths which makes it difficult to proceed further.\
\
There are two ways you can go around this issue :\
1\. Generate the LHE files from gridpacks and then start with GEN step giving the LHE files as an input (**RECOMMENDED**).\
2\. Double the number of events that you would like to produce and just use half of the RAWSIMoutput files (**NOT RECOMMENDED**).
{% endhint %}

### Instructions

1\. Untar the gridpacks and create LHE files from it. It should be **one LHE file** that contains the number of events you wish to distribute through CRAB.\
&#xNAN;_&#x65;.g.) If you want 200,000 events, the one LHE file should store 200,000 events. If matching/filtering efficiency is 40%, you will only get 200,000 X 0.4 = 80,000 events at the end._\
\
2\. Place the LHE file where could be accessed using XRootD.\
&#xNAN;_&#x65;.g.) root://eoscms.cern.ch//store/group/phys\_exotica/MCandInterpretations/LHEfiles/DMSimp\_monojet\_NLO\_Axial\_GQ0p25\_GDM1p0\_MY1-1000p0\_MXd-1p0.lhe_\
\
3\. Prepare a CSV file with inputs in following order to run GEN step (split with commas) :

1. **DATASETNAME** : Name of the dataset that will be used for DAS publication.\\
2. **GENFRAGMENT** : Generator fragment python file that will be used for hadronizer. It should be stored in skeleton/genfragments directory.\\
3. **NEVENTS** : Number of events in total that is stored in the LHE file.\\
4. **NSPLITJOBS** : Number of jobs that will be split into CRAB.\\
5. **INPUTLHE** : XrootD path to the LHE file.

```bash
# How your CSV file should look like if using LHE file as an input (MCandI_wmLHEGENexample_LHE.csv).
DMSimp_monojet_NLO_Axial_GQ0p25_GDM1p0_MY1-1000p0_MXd-1p0,Hadronizer_TuneCP5_13TeV_aMCatNLO_FXFX_5f_1j_max2j_LHE_pythia8_cff.py,16000,8,root://eoscms.cern.ch//store/group/phys_exotica/MCandInterpretations/LHEfiles/DMSimp_monojet_NLO_Axial_GQ0p25_GDM1p0_MY1-1000p0_MXd-1p0.lhe
DMSimp_monojet_NLO_Axial_GQ0p25_GDM1p0_MY1-100p0_MXd-1p0,Hadronizer_TuneCP5_13TeV_aMCatNLO_FXFX_5f_1j_max2j_LHE_pythia8_cff.py,16000,8,root://eoscms.cern.ch//store/group/phys_exotica/MCandInterpretations/LHEfiles/DMSimp_monojet_NLO_Axial_GQ0p25_GDM1p0_MY1-100p0_MXd-1p0.lhe
```

4\. Now go back to **How-to : Sample Production**, but keep in mind that when executing the **config\_GEN.py** file, **--inputLHE** option should be added.

```bash
# Example command to produce Full simulation, RunIISummer20UL16 campaign, LHE injected GEN samples.
cd FullSimulation/RunIISummer20UL16/GEN__CMSSW_10_6_18/src/
python config_GEN.py MCandI_wmLHEGENexample_LHE.csv --inputLHE
```
