sysCalc erases the weights produced with reweight_card.dat?

Asked by vivida

 Dear Madgraph5_aMC@NLO authors,

   At CMS, we would like to produce signal LHE files that
 contain weights corresponding to different signal decay widths.

 To do that, we set different signal decay widths in the Cards/reweight_card.dat.

 We could get weights that correspond to different widths OK.
 Here is one example:
 http://syu.web.cern.ch/syu/RSGraviton_hh_hbbhbb_M500_narrow.lhe.txt

 But once we run sysCalc on the LHE file with decay-width weights, all
 the decay-width weights are erased and replaced with the PDF/scale
 weights.

 Do we know of a way to put in PDF/scale/alphas weights together with
 other weights that are not produced by SysCalc?

 Thanks!!

  --
  best,

  Shin-Shan Eiko Yu
  Associate Professor,
  Department of Physics,
  National Central University,
  Taiwan

  CERN phone: +41 22 76 79377
  CERN postal address:

  32-3C06 (Mailbox J21710)
  CH-1211 Geneve 23
  Switzerland

Question information

Language:
English Edit question
Status:
Answered
For:
MadGraph5_aMC@NLO Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:

This question was reopened

Revision history for this message
Olivier Mattelaer (olivier-mattelaer) said :
#1

Hi,

Actually, the order of running of the code —when everything is done built in in madgraph— is
to first run SysCalc and then to run the reweighing module.
In that order, the reweighing module is preserving the weight provided by SysCalc.

Is it possible to follow that order for you?
It might not be trivial to make the change in SysCalc to preserver the previous weight.

Cheers,

Olivier

On 11 Jan 2015, at 14:31, vivida <email address hidden> wrote:

> New question #260491 on MadGraph5_aMC@NLO:
> https://answers.launchpad.net/mg5amcnlo/+question/260491
>
>
> Dear Madgraph5_aMC@NLO authors,
>
> At CMS, we would like to produce signal LHE files that
> contain weights corresponding to different signal decay widths.
>
> To do that, we set different signal decay widths in the Cards/reweight_card.dat.
>
> We could get weights that correspond to different widths OK.
> Here is one example:
> http://syu.web.cern.ch/syu/RSGraviton_hh_hbbhbb_M500_narrow.lhe.txt
>
> But once we run sysCalc on the LHE file with decay-width weights, all
> the decay-width weights are erased and replaced with the PDF/scale
> weights.
>
>
> Do we know of a way to put in PDF/scale/alphas weights together with
> other weights that are not produced by SysCalc?
>
> Thanks!!
>
>
> --
> best,
>
> Shin-Shan Eiko Yu
> Associate Professor,
> Department of Physics,
> National Central University,
> Taiwan
>
> CERN phone: +41 22 76 79377
> CERN postal address:
>
> 32-3C06 (Mailbox J21710)
> CH-1211 Geneve 23
> Switzerland
>
>
>
>
> --
> You received this question notification because you are an answer
> contact for MadGraph5_aMC@NLO.

Revision history for this message
vivida (eikoyu) said :
#2

 Hi Oliviver,
   Sorry, how to run reweight_card when there's already a produced LHE file?

 I see the instruction says:

./bin/madevent reweight RUN_NAME -f

Does this RUN_NAME correspond to the folder name under Events?

 If yes, which name of LHE file is the reweighing job assumming when running the command above?

 events.lhe? or unweighted_events.lhe?

 Thanks!!

 Eiko

Revision history for this message
Olivier Mattelaer (olivier-mattelaer) said :
#3

Hi Eiko,

> Does this RUN_NAME correspond to the folder name under Events?

Yes it is.

> If yes, which name of LHE file is the reweighing job assumming when
> running the command above?
>
> events.lhe? or unweighted_events.lhe?

unweighted_events.lhe

Cheers,

Olivier

On 13 Jan 2015, at 11:07, vivida <email address hidden> wrote:

> Question #260491 on MadGraph5_aMC@NLO changed:
> https://answers.launchpad.net/mg5amcnlo/+question/260491
>
> Status: Answered => Solved
>
> vivida confirmed that the question is solved:
>
> Hi Oliviver,
> Sorry, how to run reweight_card when there's already a produced LHE file?
>
> I see the instruction says:
>
> ./bin/madevent reweight RUN_NAME -f
>
> Does this RUN_NAME correspond to the folder name under Events?
>
> If yes, which name of LHE file is the reweighing job assumming when
> running the command above?
>
> events.lhe? or unweighted_events.lhe?
>
> Thanks!!
>
> Eiko
>
> --
> You received this question notification because you are an answer
> contact for MadGraph5_aMC@NLO.

Revision history for this message
vivida (eikoyu) said :
#4

Hi Olivier,

  I just renamed the output file of sysCalc to unweighted_events.lhe, put it back in the Events/run_01 folder and
run

./bin/madevent reweight run_01 -f

This is the input file I used:
http://syu.web.cern.ch/syu/test.lhe.txt

Now, the weights from width variation are written, but the previous PDF/scale weights are erased instead ..

Eiko

Revision history for this message
Olivier Mattelaer (olivier-mattelaer) said :
#5

Hi Eiko,

Sorry for the delay.

The following patch should avoid the reweighting to remove the pre-existing weight:

=== modified file 'madgraph/various/lhe_parser.py'
--- madgraph/various/lhe_parser.py 2014-12-10 18:36:11 +0000
+++ madgraph/various/lhe_parser.py 2015-01-29 16:27:25 +0000
@@ -227,12 +227,12 @@
         self.reweight_order = []
         start, stop = self.tag.find('<rwgt>'), self.tag.find('</rwgt>')
         if start != -1 != stop :
- pattern = re.compile(r'''<\s*wgt id=\'(?P<id>[^\']+)\'\s*>\s*(?P<val>[\ded+-.]*)\s*</wgt>''')
+ pattern = re.compile(r'''<\s*wgt id=(?:\'|\")(?P<id>[^\'\"]+)(?:\'|\")\s*>\s*(?P<val>[\ded+-.]*)\s*</wgt>''')
             data = pattern.findall(self.tag)
             try:
                 self.reweight_data = dict([(pid, float(value)) for (pid, value) in data
                                            if not self.reweight_order.append(pid)])
- # the if is to create the order file on the flight
+ # the if is to create the order file on the flight
             except ValueError, error:
                 raise Exception, 'Event File has unvalid weight. %s' % error
             self.tag = self.tag[:start] + self.tag[stop+7:]
@@ -443,8 +443,7 @@
             if set(self.reweight_data.keys()) != set(self.reweight_order):
                 self.reweight_order += [k for k in self.reweight_data.keys() \
                                                 if k not in self.reweight_order]
-
-
+
             reweight_str = '<rwgt>\n%s\n</rwgt>' % '\n'.join(
                         '<wgt id=\'%s\'> %+13.7e </wgt>' % (i, float(self.reweight_data[i]))
                         for i in self.reweight_order)

Cheers and thanks,

Olivier

Can you help with this problem?

Provide an answer of your own, or ask vivida for more information if necessary.

To post a message you must log in.