Merge lp:~ma5/madanalysis5/v1.1.7beta into lp:madanalysis5

Proposed by Benjamin Fuks
Status: Merged
Approved by: Benjamin Fuks
Approved revision: 76
Merged at revision: 58
Proposed branch: lp:~ma5/madanalysis5/v1.1.7beta
Merge into: lp:madanalysis5
Diff against target: 4711 lines (+2146/-1099)
64 files modified
README (+2/-2)
bin/ma5 (+2/-2)
madanalysis/IOinterface/job_writer.py (+8/-1)
madanalysis/IOinterface/multiparticle_reader.py (+6/-2)
madanalysis/IOinterface/particle_reader.py (+7/-6)
madanalysis/UpdateNotes.txt (+49/-0)
madanalysis/configuration/beauty_identification.py (+1/-1)
madanalysis/configuration/clustering_configuration.py (+1/-2)
madanalysis/configuration/tau_identification.py (+5/-45)
madanalysis/core/config_checker.py (+27/-2)
madanalysis/core/expert_mode.py (+4/-3)
madanalysis/core/main.py (+40/-7)
madanalysis/input/reco_default.txt (+2/-1)
madanalysis/interpreter/cmd_import.py (+1/-1)
madanalysis/interpreter/cmd_reset.py (+1/-1)
madanalysis/interpreter/interpreter.py (+2/-2)
madanalysis/interpreter/interpreter_base.py (+47/-0)
madanalysis/job/job_execute.py (+26/-0)
madanalysis/job/job_initialize.py (+384/-7)
madanalysis/job/job_plot.py (+6/-0)
madanalysis/layout/histogram.py (+2/-1)
madanalysis/layout/histogram_frequency_core.py (+1/-1)
madanalysis/layout/plotflow.py (+1/-2)
tools/SampleAnalyzer/Analyzer/AnalyzerBase.h (+3/-3)
tools/SampleAnalyzer/Analyzer/MergingPlots.cpp (+2/-0)
tools/SampleAnalyzer/Core/Configuration.cpp (+31/-0)
tools/SampleAnalyzer/Core/Configuration.h (+24/-0)
tools/SampleAnalyzer/Core/ProgressBar.cpp (+44/-16)
tools/SampleAnalyzer/Core/ProgressBar.h (+34/-16)
tools/SampleAnalyzer/Core/SampleAnalyzer.cpp (+11/-8)
tools/SampleAnalyzer/Core/xdr_istream.cpp (+2/-2)
tools/SampleAnalyzer/DataFormat/MCParticleFormat.h (+4/-2)
tools/SampleAnalyzer/DataFormat/RecEventFormat.h (+17/-15)
tools/SampleAnalyzer/DataFormat/RecParticleFormat.h (+2/-2)
tools/SampleAnalyzer/DataFormat/RecTauFormat.h (+12/-0)
tools/SampleAnalyzer/Filter/FilterBase.h (+2/-2)
tools/SampleAnalyzer/JetClustering/JetClustererBase.h (+13/-1)
tools/SampleAnalyzer/JetClustering/JetClusteringFastJet.cpp (+247/-24)
tools/SampleAnalyzer/JetClustering/JetClusteringFastJet.h (+8/-0)
tools/SampleAnalyzer/JetClustering/TaggerBase.cpp (+2/-0)
tools/SampleAnalyzer/JetClustering/TaggerBase.h (+1/-1)
tools/SampleAnalyzer/JetClustering/TauTagger.cpp (+9/-111)
tools/SampleAnalyzer/JetClustering/TauTagger.h (+5/-3)
tools/SampleAnalyzer/JetClustering/bTagger.cpp (+3/-43)
tools/SampleAnalyzer/JetClustering/bTagger.h (+1/-1)
tools/SampleAnalyzer/JetClustering/cTagger.h (+1/-1)
tools/SampleAnalyzer/Makefile (+0/-89)
tools/SampleAnalyzer/Reader/HEPMCReader.cpp (+66/-12)
tools/SampleAnalyzer/Reader/HEPMCReader.h (+1/-1)
tools/SampleAnalyzer/Reader/LHCOReader.cpp (+30/-29)
tools/SampleAnalyzer/Reader/ReaderTextBase.cpp (+2/-0)
tools/SampleAnalyzer/Service/CompilationService.h (+30/-0)
tools/SampleAnalyzer/Service/Physics.h (+10/-2)
tools/SampleAnalyzer/Writer/LHCOParticleFormat.cpp (+98/-0)
tools/SampleAnalyzer/Writer/LHCOParticleFormat.h (+64/-0)
tools/SampleAnalyzer/Writer/LHCOWriter.cpp (+216/-350)
tools/SampleAnalyzer/Writer/LHCOWriter.h (+9/-10)
tools/SampleAnalyzer/Writer/LHEParticleFormat.cpp (+115/-0)
tools/SampleAnalyzer/Writer/LHEParticleFormat.h (+71/-0)
tools/SampleAnalyzer/Writer/LHEWriter.cpp (+284/-257)
tools/SampleAnalyzer/Writer/LHEWriter.h (+9/-6)
tools/SampleAnalyzer/Writer/WriterBase.h (+3/-1)
tools/SampleAnalyzer/Writer/WriterTextBase.cpp (+28/-1)
tools/SampleAnalyzer/Writer/WriterTextBase.h (+7/-1)
To merge this branch: bzr merge lp:~ma5/madanalysis5/v1.1.7beta
Reviewer Review Type Date Requested Status
Eric Conte Approve
Review via email: mp+169179@code.launchpad.net

Commit message

- LHCO output
 - Compatibility with pythia-8 output
 - Improvement of the jet clustering / object identification
 - Few bug fixes
 - Photons added in the reco mode

Description of the change

 - LHCO output
 - Compatibility with pythia-8 output
 - Improvement of the jet clustering / object identification
 - Few bug fixes
 - Photons added in the reco mode

To post a comment you must log in.
Revision history for this message
Eric Conte (eric-conte) wrote :

release validated !

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'README'
2--- README 2013-05-17 17:10:55 +0000
3+++ README 2013-06-13 12:22:26 +0000
4@@ -15,10 +15,10 @@
5 # but WITHOUT ANY WARRANTY; without even the implied warranty of
6 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 # GNU General Public License for more details.
8-#
9+#
10 # You should have received a copy of the GNU General Public License
11 # along with MadAnalysis 5. If not, see <http://www.gnu.org/licenses/>
12-#
13+#
14 ################################################################################
15
16
17
18=== modified file 'bin/ma5' (properties changed: -x to +x)
19--- bin/ma5 2013-05-17 16:41:08 +0000
20+++ bin/ma5 2013-06-13 12:22:26 +0000
21@@ -113,8 +113,8 @@
22
23 # Release version
24 # Do not touch it !!!!!
25-main.version = "1.1.6"
26-main.date = "2013/05/17"
27+main.version = "1.1.25"
28+main.date = "2013/06/13"
29
30 # Checking arguments
31 import getopt
32
33=== modified file 'madanalysis/IOinterface/job_writer.py'
34--- madanalysis/IOinterface/job_writer.py 2013-05-17 07:04:14 +0000
35+++ madanalysis/IOinterface/job_writer.py 2013-06-13 12:22:26 +0000
36@@ -253,7 +253,10 @@
37 if self.output!="":
38 file.write(' //Getting pointer to the writer\n')
39 file.write(' WriterBase* writer1 = \n')
40- file.write(' manager.InitializeWriter("lhe","'+self.output+'");\n')
41+ if self.output.lower().endswith('lhe') or self.output.lower().endswith('lhe.gz'):
42+ file.write(' manager.InitializeWriter("lhe","'+self.output+'");\n')
43+ elif self.output.lower().endswith('lhco') or self.output.lower().endswith('lhco.gz'):
44+ file.write(' manager.InitializeWriter("lhco","'+self.output+'");\n')
45 file.write(' if (writer1==0) return 1;\n\n')
46 if self.clustering.algorithm!="none":
47 file.write(' //Getting pointer to the clusterer\n')
48@@ -958,11 +961,15 @@
49 if not dataset.weighted_events:
50 weighted_events=" --no_event_weight"
51
52+ # Release
53+ release = ' --ma5_version="' + self.main.version + ';' + self.main.date + '"'
54+
55 # Running SampleAnalyzer
56 res=os.system('cd '\
57 +self.path+'/Output/'+name+';'\
58 +' ../../Build/'\
59 +'MadAnalysis5Job '+weighted_events +\
60+ release +\
61 ' ../../Input/'+name+'.list')
62
63 return True
64
65=== modified file 'madanalysis/IOinterface/multiparticle_reader.py'
66--- madanalysis/IOinterface/multiparticle_reader.py 2013-05-17 06:19:22 +0000
67+++ madanalysis/IOinterface/multiparticle_reader.py 2013-06-13 12:22:26 +0000
68@@ -29,12 +29,13 @@
69
70 class MultiparticleReader():
71
72- def __init__(self,path,cmd_define,level=MA5RunningType.PARTON):
73+ def __init__(self,path,cmd_define,level=MA5RunningType.PARTON,forced=False):
74 self.cmd_define = cmd_define
75 self.npart = 0
76 self.path = path
77 self.isopen = False
78 self.level = level
79+ self.forced = forced
80
81 def Load(self):
82 if self.level==MA5RunningType.PARTON:
83@@ -54,6 +55,8 @@
84 return False
85 self.Read()
86 self.Close()
87+ self.AddSpecialMultiparticles()
88+ self.Close()
89
90 def OpenPartonLevel(self):
91
92@@ -160,7 +163,7 @@
93 logging.debug("Extracting a multiparticle labelled by ["+split[0]+"] with a PDG-id : "+str(split[2:]))
94
95 #feed multiparticle
96- self.cmd_define.fill(split[0],split[2:])
97+ self.cmd_define.fill(split[0],split[2:],self.forced)
98 self.npart += 1
99
100
101@@ -172,6 +175,7 @@
102 text += item + " "
103 logging.error(text)
104
105+
106 def AddSpecialMultiparticles(self):
107 # Creating invisible and hadronic multiparticles (mandatory in parton and hadron level)
108 if self.level==MA5RunningType.RECO:
109
110=== modified file 'madanalysis/IOinterface/particle_reader.py'
111--- madanalysis/IOinterface/particle_reader.py 2013-05-17 06:19:22 +0000
112+++ madanalysis/IOinterface/particle_reader.py 2013-06-13 12:22:26 +0000
113@@ -29,12 +29,13 @@
114
115 class ParticleReader():
116
117- def __init__(self,path,cmd_define,level=MA5RunningType.PARTON):
118+ def __init__(self,path,cmd_define,level=MA5RunningType.PARTON,forced=False):
119 self.cmd_define = cmd_define
120- self.npart = 0
121- self.path = path
122- self.level = level
123- self.isopen = False
124+ self.npart = 0
125+ self.path = path
126+ self.level = level
127+ self.isopen = False
128+ self.forced = forced
129
130 def Load(self):
131 if self.level==MA5RunningType.PARTON:
132@@ -162,7 +163,7 @@
133 logging.debug("Extracting a particle labelled by ["+split[1]+"] with a PDG-id : "+split[0])
134
135 #feed particle
136- self.cmd_define.fill(split[1],[split[0]])
137+ self.cmd_define.fill(split[1],[split[0]],self.forced)
138 self.npart += 1
139
140 @staticmethod
141
142=== modified file 'madanalysis/UpdateNotes.txt'
143--- madanalysis/UpdateNotes.txt 2013-05-17 16:41:08 +0000
144+++ madanalysis/UpdateNotes.txt 2013-06-13 12:22:26 +0000
145@@ -1,5 +1,54 @@
146 Update notes for MadAnalysis 5 (in reverse time order)
147
148+76 1.1.25 (2013/06/13) econte: fixing one bug related to progress bar occuring on some plateforms
149+
150+75 1.1.24 (2013/06/12) econte: adding compilation service + remove warnings
151+
152+74 1.1.23 (2013/06/12) econte: adding MA5/SampleAnalyzer version and date to LHE and LHCO output
153+
154+73 1.1.22 (2013/06/12) econte: change operation order in ma5commit
155+
156+72 1.1.21 (2013/06/12) econte: fixing bugs with label definition in RECO mode + adding version
157+ number to SampleAnalyzer
158+
159+71 1.1.20 (2013/06/12) econte: fix bug with usage of zlib from tools folder + release/date stamp
160+ inside SampleAnalyzer
161+
162+70 1.1.19 (2013/06/12) econte: small fix related to the progress bar display
163+
164+69 1.1.18 (2013/06/12) econte: fixing bugs (zlib + numpy) + display progress bar
165+
166+70 1.1.19 (2013/06/12) econte: fixing bugs (numpy, zlib) + progress bar display
167+
168+69 1.1.18 (2013/06/12) econte: fixing bugs with numpy + fixing bugs with gzip + fixing bugs with
169+ Progress bar [to validate]
170+
171+68 1.1.17 (2013/06/10) bfuks: Bug fixes: progress bar on macosx + empty histogram display
172+
173+67 1.1.16 (2013/06/01) econte: 2 files missed in the previous commit
174+
175+66 1.1.15 (2013/05/31) econte: finalizing jet-clustering with exclusiveId option and full
176+ compatibility with Pythia8
177+
178+65 1.1.14 (2013/05/26) econte: validation LHCO format
179+
180+64 1.1.13 (2013/05/24) econte: improving jetclustering + adding photons in NPID plot + nb of read
181+ events + surprise
182+
183+63 1.1.12 (2013/05/21) econte: first implementation of the exclusive id
184+
185+62 1.1.11 (2013/05/21) econte: adding changes to LHCOWriter + fixing warning appearing in Adam's
186+ computer
187+
188+61 1.1.10 (2013/05/19) econte: fixing bug with LHCO reader + implementing LHCO output (only
189+ kinematics part is validated) + beautiful headers for LHCO + LHE
190+
191+60 1.1.9 (2013/05/18) econte: test
192+
193+59 1.1.8 (2013/05/17) bfuks: test
194+
195+58 1.1.7 (2013/05/17) bfuks: initializating 1.1.7
196+
197 54 1.1.6 (2013/05/17) ma5team: - Many bug fixes (special thanks to Adam Alloul and Jose Ruiz).
198 - Simplified LHE output added, LHCO writer at the beta level.
199 - Clustering and b, c and tau (mis)ident. improved.
200
201=== modified file 'madanalysis/configuration/beauty_identification.py'
202--- madanalysis/configuration/beauty_identification.py 2013-05-17 06:19:22 +0000
203+++ madanalysis/configuration/beauty_identification.py 2013-06-13 12:22:26 +0000
204@@ -26,7 +26,7 @@
205 class BeautyIdentification():
206
207 default_matching_dr = 0.5
208- default_exclusive = False
209+ default_exclusive = True
210 default_efficiency = 1.
211 default_misid_cjet = 0.
212 default_misid_ljet = 0.
213
214=== modified file 'madanalysis/configuration/clustering_configuration.py'
215--- madanalysis/configuration/clustering_configuration.py 2013-05-17 06:19:22 +0000
216+++ madanalysis/configuration/clustering_configuration.py 2013-06-13 12:22:26 +0000
217@@ -50,7 +50,7 @@
218 self.algorithm = "none"
219 self.beauty = BeautyIdentification()
220 self.tau = TauIdentification()
221- self.exclusive_id = False
222+ self.exclusive_id = True
223
224
225 def Display(self):
226@@ -189,7 +189,6 @@
227 if parameter=="exclusive_id":
228 if value=="true":
229 self.exclusive_id=True
230- logging.warning("This functionnality is not available yet.")
231 elif value=="false":
232 self.exclusive_id=False
233 else:
234
235=== modified file 'madanalysis/configuration/tau_identification.py'
236--- madanalysis/configuration/tau_identification.py 2013-05-17 06:19:22 +0000
237+++ madanalysis/configuration/tau_identification.py 2013-06-13 12:22:26 +0000
238@@ -26,41 +26,28 @@
239 class TauIdentification():
240
241 default_matching_dr = 0.5
242- default_exclusive = False
243+ default_exclusive = True
244 default_efficiency = 1.
245 default_misid_ljet = 0.
246-
247
248- userVariables = { "tau_id.matching_dr" : [str(default_matching_dr)],\
249- "tau_id.exclusive" : [str(default_exclusive)],\
250- "tau_id.efficiency" : [str(default_efficiency)],\
251+ userVariables = { "tau_id.efficiency" : [str(default_efficiency)],\
252 "tau_id.misid_ljet" : [str(default_misid_ljet)]\
253 }
254
255+
256 def __init__(self):
257- self.matching_dr = TauIdentification.default_matching_dr
258- self.exclusive = TauIdentification.default_exclusive
259 self.efficiency = TauIdentification.default_efficiency
260 self.misid_ljet = TauIdentification.default_misid_ljet
261
262
263 def Display(self):
264 logging.info(" + hadronic-tau identification:")
265- self.user_DisplayParameter("tau_id.matching_dr")
266- self.user_DisplayParameter("tau_id.exclusive")
267 self.user_DisplayParameter("tau_id.efficiency")
268 self.user_DisplayParameter("tau_id.misid_ljet")
269
270
271 def user_DisplayParameter(self,parameter):
272- if parameter=="tau_id.matching_dr":
273- logging.info(" + DeltaR matching = "+str(self.matching_dr))
274- elif parameter=="tau_id.exclusive":
275- msg="false"
276- if self.exclusive:
277- msg="true"
278- logging.info(" + exclusive algo = "+msg)
279- elif parameter=="tau_id.efficiency":
280+ if parameter=="tau_id.efficiency":
281 logging.info(" + id efficiency = "+str(self.efficiency))
282 elif parameter=="tau_id.misid_ljet":
283 logging.info(" + mis-id efficiency (light quarks) = "+str(self.misid_ljet))
284@@ -70,12 +57,7 @@
285
286 def SampleAnalyzerConfigString(self):
287 mydict = {}
288- mydict['tau_id.matching_dr'] = str(self.matching_dr)
289 mydict['tau_id.efficiency'] = str(self.efficiency)
290- if self.exclusive:
291- mydict['tau_id.exclusive'] = '1'
292- else:
293- mydict['tau_id.exclusive'] = '0'
294 mydict['tau_id.misid_ljet'] = str(self.misid_ljet)
295 return mydict
296
297@@ -92,30 +74,8 @@
298
299
300 def user_SetParameter(self,parameter,value):
301- # matching deltar
302- if parameter=="tau_id.matching_dr":
303- try:
304- number = float(value)
305- except:
306- logging.error("the 'matching deltaR' must be a float value.")
307- return False
308- if number<=0:
309- logging.error("the 'matching deltaR' cannot be negative or null.")
310- return False
311- self.matching_dr=number
312-
313- # exclusive
314- elif parameter=="tau_id.exclusive":
315- if value == "true":
316- self.exclusive=True
317- elif value == "false":
318- self.exclusive=False
319- else:
320- logging.error("'exclusive' possible values are : 'true', 'false'")
321- return False
322-
323 # efficiency
324- elif parameter=="tau_id.efficiency":
325+ if parameter=="tau_id.efficiency":
326 try:
327 number = float(value)
328 except:
329
330=== modified file 'madanalysis/core/config_checker.py'
331--- madanalysis/core/config_checker.py 2013-05-17 06:19:22 +0000
332+++ madanalysis/core/config_checker.py 2013-06-13 12:22:26 +0000
333@@ -314,6 +314,23 @@
334 os.environ['LIBRARY_PATH'] = os.environ['LIBRARY_PATH'] + \
335 ":" + item
336 break
337+
338+ # If not, test if it is there locally
339+ if not find:
340+ item = self.ma5dir+'/tools/zlib/lib/'
341+ files=glob.glob(item+"/libz.so")
342+ files.extend(glob.glob(item+"/libz.a"))
343+ files.extend(glob.glob(item+"/libz.dylib"))
344+ if len(files)!=0:
345+ self.configLinux.libraries['ZLib']=files[0]+":"+str(os.stat(files[0]).st_mtime)
346+ find=True
347+ os.environ['LD_LIBRARY_PATH'] = os.environ['LD_LIBRARY_PATH'] + \
348+ ":" + item
349+ os.environ['DYLD_LIBRARY_PATH'] = os.environ['DYLD_LIBRARY_PATH'] + \
350+ ":" + item
351+ os.environ['LIBRARY_PATH'] = os.environ['LIBRARY_PATH'] + \
352+ ":" + item
353+ # Not fail -> Warning
354 if not find:
355 self.PrintFAIL(warning=True)
356 logging.warning("Library called 'libz' not found. Gzip format will be disabled.")
357@@ -327,9 +344,16 @@
358 if len(files)!=0:
359 self.configLinux.headers['ZLib']=files[0]+":"+str(os.stat(files[0]).st_mtime)
360 find=True
361- os.environ['CPLUS_INCLUDE_PATH'] = os.environ['CPLUS_INCLUDE_PATH'] + \
362- ":" + item
363+ os.environ['CPLUS_INCLUDE_PATH'] = os.environ['CPLUS_INCLUDE_PATH'] + ":" + item
364 break
365+
366+ # If not, test if it is there locally
367+ if not find:
368+ find=os.path.isfile(self.ma5dir+'/tools/zlib/include/zlib.h')
369+ if find:
370+ os.environ['CPLUS_INCLUDE_PATH'] = os.environ['CPLUS_INCLUDE_PATH'] + ":" + \
371+ self.ma5dir+'/tools/zlib/include/'
372+
373 if not find:
374 self.PrintFAIL(warning=True)
375 logging.warning("Header file called 'zlib.h' not found. Gzip format will be disabled.")
376@@ -369,6 +393,7 @@
377 if(len(files))!=0:
378 find = True
379 self.configLinux.fastjet_version = commands.getstatusoutput('fastjet-config --version')[1]
380+
381 # If not, test if it is there locally
382 if not find:
383 find=os.path.isfile(self.ma5dir+'/tools/fastjet/bin/fastjet-config')
384
385=== modified file 'madanalysis/core/expert_mode.py'
386--- madanalysis/core/expert_mode.py 2013-05-17 06:19:22 +0000
387+++ madanalysis/core/expert_mode.py 2013-06-13 12:22:26 +0000
388@@ -35,7 +35,6 @@
389 def __init__(self,main):
390 self.main=main
391 self.path=""
392- self.dir=""
393 self.forbiddenpaths=[]
394 self.forbiddenpaths.append(os.path.normpath(self.main.ma5dir+'/lib'))
395 self.forbiddenpaths.append(os.path.normpath(self.main.ma5dir+'/bin'))
396@@ -45,8 +44,10 @@
397 logging.info("\nWelcome to the expert mode of MadAnalysis")
398 logging.info("Please enter a folder for creating an empty SampleAnalyzer job")
399 answer=raw_input("Answer: ")
400- self.dir = answer
401- self.path = os.path.normpath(self.main.currentdir+'/'+answer)
402+ self.path = os.path.expanduser(answer)
403+ if not self.path.startswith('/'):
404+ self.path = self.main.currentdir+'/'+self.path
405+ self.path = os.path.normpath(self.path)
406
407 # Checking folder
408 if self.path in self.forbiddenpaths:
409
410=== modified file 'madanalysis/core/main.py'
411--- madanalysis/core/main.py 2013-05-17 06:19:22 +0000
412+++ madanalysis/core/main.py 2013-06-13 12:22:26 +0000
413@@ -50,10 +50,13 @@
414 userVariables = { "currentdir" : [], \
415 "normalize" : ["none","lumi","lumi_weight"], \
416 "lumi" : [], \
417- "SBratio" : ['"S/B"','"B/S"','"S/(S+B)"','"B/(B+S)"','"S/sqrt(S+B)"','"B/sqrt(B+S)"'], \
418+ "SBratio" : ['"S/B"','"B/S"',\
419+ '"S/(S+B)"','"B/(B+S)"',\
420+ '"S/sqrt(S+B)"','"B/sqrt(B+S)"'], \
421 "SBerror" : [], \
422 "stacking_method" : ["stack","superimpose","normalize2one"], \
423- "outputfile" : ['"output.lhe.gz"'] }
424+ "outputfile" : ['"output.lhe.gz"','"output.lhco.gz"'] \
425+ }
426
427 SBformula = { 'S/B' : '1./(B**2)*sqrt(B**2*ES**2+S**2*EB**2)', \
428 'S/(S+B)' : '1./(S+B)**2*sqrt(B**2*ES**2+S**2*EB**2)', \
429@@ -291,11 +294,41 @@
430 quoteTag=True
431 if quoteTag:
432 value=value[1:-1]
433- if not value.lower().endswith(".lhe") and not value.lower().endswith(".lhe.gz"):
434- logging.error("LHE format (*.lhe) and compressed LHE format (*.lhe.gz) are the only possible formats for output.")
435- return False
436- self.output = value
437- return
438+ valuemin = value.lower()
439+
440+ # Compressed file
441+ if valuemin.endswith(".gz") and not self.libZIP:
442+ logging.error("Compressed formats (*.gz) are not available. "\
443+ + "Please install zlib with the command line:")
444+ logging.error(" install zlib")
445+ return False
446+
447+ # LHE
448+ if valuemin.endswith(".lhe") or valuemin.endswith(".lhe.gz"):
449+ self.output = value
450+ return
451+
452+ # LHCO
453+ elif valuemin.endswith(".lhco") or valuemin.endswith(".lhco.gz"):
454+ if self.mode == MA5RunningType.RECO:
455+ self.output = value
456+ return
457+ elif self.mode == MA5RunningType.PARTON:
458+ logging.error("LHCO format is not available in PARTON mode.")
459+ return False
460+ elif self.mode == MA5RunningType.HADRON:
461+ if self.clustering.algorithm == "none":
462+ logging.error("Please select a jet-clustering algorithm before requesting a LHCO file output.")
463+ logging.error("Command: set main.merging.algorithm = ")
464+ return False
465+ else:
466+ self.output = value
467+ return
468+
469+ else:
470+ logging.error("Output format is not available. Extension allowed: " +\
471+ ".lhe .lhe.gz .lhco .lhco.gz")
472+ return False
473
474 # other
475 else:
476
477=== modified file 'madanalysis/input/reco_default.txt'
478--- madanalysis/input/reco_default.txt 2013-04-14 20:56:15 +0000
479+++ madanalysis/input/reco_default.txt 2013-06-13 12:22:26 +0000
480@@ -7,7 +7,8 @@
481 15 ta-
482 -15 ta+
483 21 j
484+ 22 a
485 5 b
486 1 nb
487 100 met
488-101 mht
489\ No newline at end of file
490+101 mht
491
492=== modified file 'madanalysis/interpreter/cmd_import.py'
493--- madanalysis/interpreter/cmd_import.py 2013-05-17 06:19:22 +0000
494+++ madanalysis/interpreter/cmd_import.py 2013-06-13 12:22:26 +0000
495@@ -163,7 +163,7 @@
496 # Loading particles
497 input = ParticleReader(self.main.ma5dir,cmd_define,self.main.mode)
498 input.Load()
499- input = MultiparticleReader(self.main.ma5dir,cmd_define,self.main.mode)
500+ input = MultiparticleReader(self.main.ma5dir,cmd_define,self.main.mode,self.main.forced)
501 input.Load()
502
503 # Reset history
504
505=== modified file 'madanalysis/interpreter/cmd_reset.py'
506--- madanalysis/interpreter/cmd_reset.py 2013-05-17 06:19:22 +0000
507+++ madanalysis/interpreter/cmd_reset.py 2013-06-13 12:22:26 +0000
508@@ -85,7 +85,7 @@
509 # Loading particles
510 input = ParticleReader(self.main.ma5dir,cmd_define,self.main.mode)
511 input.Load()
512- input = MultiparticleReader(self.main.ma5dir,cmd_define,self.main.mode)
513+ input = MultiparticleReader(self.main.ma5dir,cmd_define,self.main.mode,self.main.forced)
514 input.Load()
515
516
517
518=== modified file 'madanalysis/interpreter/interpreter.py'
519--- madanalysis/interpreter/interpreter.py 2013-05-17 06:19:22 +0000
520+++ madanalysis/interpreter/interpreter.py 2013-06-13 12:22:26 +0000
521@@ -282,7 +282,7 @@
522 input.Load()
523
524 def InitializeMultiparticle(self):
525- input = MultiparticleReader(self.main.ma5dir,self.cmd_define,self.main.mode)
526+ input = MultiparticleReader(self.main.ma5dir,self.cmd_define,self.main.mode,self.main.forced)
527 input.Load()
528
529 # PreLoop
530@@ -474,5 +474,5 @@
531 if line[-1] in [' ','\t']:
532 return '', line, len(line),len(enidx)
533 return text, line, begidx, endidx
534-
535+
536
537
538=== modified file 'madanalysis/interpreter/interpreter_base.py'
539--- madanalysis/interpreter/interpreter_base.py 2013-05-17 06:19:22 +0000
540+++ madanalysis/interpreter/interpreter_base.py 2013-06-13 12:22:26 +0000
541@@ -103,6 +103,12 @@
542 # --> removing additionnal whitespace characters
543 line = line.lstrip()
544
545+ # pattern design
546+ if len(line)==4 and \
547+ line[0]=='m' and line[1]=='u' and line[2]=='f' and line[3]=='!':
548+ self.pattern_design()
549+ return ''
550+
551 # Add the line to the history
552 # except for useless commands (empty history, help calls and comments)
553 if line != "history" and \
554@@ -334,3 +340,44 @@
555 else:
556 out.append(data)
557 return out
558+
559+
560+ def pattern_design(self):
561+ pattern=[]
562+ pattern.append('32-32-32-32-32-32-32-32-95-95-95-95-95-32')
563+ pattern.append('32-32-32-32-32-95-45-126-126-32-32-32-32-32-126-126-45-95-47-47-32')
564+ pattern.append('32-32-32-47-126-32-32-32-32-32-32-32-32-32-32-32-32-32-126-92-32')
565+ pattern.append('32-32-124-32-32-32-32-32-32-32-32-32-32-32-32-32-32-95-32-32-124-95-32')
566+ pattern.append('32-124-32-32-32-32-32-32-32-32-32-95-45-45-126-126-126-32-41-126-126-32-41-95-95-95-32')
567+ pattern.append('92-124-32-32-32-32-32-32-32-32-47-32-32-32-95-95-95-32-32-32-95-45-126-32-32-32-126-45-39-95-32')
568+ pattern.append('92-32-32-32-32-32-32-32-32-32-32-95-45-126-32-32-32-126-45-95-32-32-32-32-32-32-32-32-32-92-32')
569+ pattern.append('124-32-32-32-32-32-32-32-32-32-47-32-32-32-32-32-32-32-32-32-92-32-32-32-32-32-32-32-32-32-124-32')
570+ pattern.append('124-32-32-32-32-32-32-32-32-124-32-32-32-32-32-32-32-32-32-32-32-124-32-32-32-32-32-40-79-32-32-124-32')
571+ pattern.append('32-124-32-32-32-32-32-32-124-32-32-32-32-32-32-32-32-32-32-32-32-32-124-32-32-32-32-32-32-32-32-124-32')
572+ pattern.append('32-32-124-32-32-32-32-32-32-124-32-32-32-79-41-32-32-32-32-32-32-32-32-124-32-32-32-32-32-32-32-124-32')
573+ pattern.append('32-32-47-124-32-32-32-32-32-32-124-32-32-32-32-32-32-32-32-32-32-32-124-32-32-32-32-32-32-32-47-32')
574+ pattern.append('32-32-47-32-92-32-95-45-45-95-32-92-32-32-32-32-32-32-32-32-32-47-45-95-32-32-32-95-45-126-41-32')
575+ pattern.append('32-32-32-32-47-126-32-32-32-32-92-32-126-45-95-32-32-32-95-45-126-32-32-32-126-126-126-95-95-47-32')
576+ pattern.append('32-32-32-124-32-32-32-124-92-32-32-126-45-95-32-126-126-126-32-95-45-126-126-45-45-45-126-32-32-92-32')
577+ pattern.append('32-32-32-124-32-32-32-124-32-124-32-32-32-32-126-45-45-126-126-32-32-47-32-92-32-32-32-32-32-32-126-45-39-95-32')
578+ pattern.append('32-32-32-124-32-32-32-92-32-124-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-126-45-39-95-32')
579+ pattern.append('32-32-32-32-92-32-32-32-126-45-124-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-126-126-45-45-95-95-32-95-45-126-126-45-44-32')
580+ pattern.append('32-32-32-32-32-126-45-95-32-32-32-124-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-47-32-32-32-32-32-124-32')
581+ pattern.append('32-32-32-32-32-32-32-32-126-126-45-45-124-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-47-32')
582+ pattern.append('32-32-32-32-32-32-32-32-32-32-124-32-32-124-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-47-32')
583+ pattern.append('32-32-32-32-32-32-32-32-32-32-124-32-32-32-124-32-32-32-32-32-32-32-32-32-32-32-32-32-32-95-32-32-32-32-32-32-32-32-32-32-32-32-95-45-126-32')
584+ pattern.append('32-32-32-32-32-32-32-32-32-32-124-32-32-47-126-126-45-45-95-32-32-32-95-95-45-45-45-126-126-32-32-32-32-32-32-32-32-32-32-95-45-126-32')
585+ pattern.append('32-32-32-32-32-32-32-32-32-32-124-32-32-92-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-32-95-95-45-45-126-126-32')
586+ pattern.append('32-32-32-32-32-32-32-32-32-32-124-32-32-124-126-126-45-45-95-95-32-32-32-32-32-95-95-95-45-45-45-126-126-32')
587+ pattern.append('32-32-32-32-32-32-32-32-32-32-124-32-32-124-32-32-32-32-32-32-126-126-126-126-126-32')
588+ pattern.append('32-32-32-32-32-32-32-32-32-32-124-32-32-124-32')
589+
590+ for word in pattern:
591+ msg=""
592+ words = word.split('-')
593+ for i in range(len(words)):
594+ msg+=chr((int(words[i])))
595+ logging.info("\x1b[1m"+"\x1b[32m"+msg+"\x1b[0m")
596+ logging.info("")
597+
598+
599
600=== modified file 'madanalysis/job/job_execute.py'
601--- madanalysis/job/job_execute.py 2013-05-17 06:19:22 +0000
602+++ madanalysis/job/job_execute.py 2013-06-13 12:22:26 +0000
603@@ -162,6 +162,24 @@
604 container+'.push_back(&(event.rec()->electrons()[i]));\n')
605
606
607+def WriteFillWithPhotonContainer(part,file,rank,status):
608+
609+ # If PTrank, no fill
610+ if part.PTrank!=0:
611+ return
612+
613+ # Skipping if already defined
614+ if InstanceName.Find('P_'+part.name+rank+status):
615+ return
616+
617+ # Getting container name
618+ container=InstanceName.Get('P_'+part.name+rank+status)
619+
620+ # Put photon
621+ if part.particle.Find(22):
622+ file.write(' '+container+'.push_back(&(event.rec()->photons()[i]));\n')
623+
624+
625 def WriteFillWithMuonContainer(part,file,rank,status):
626
627 # If PTrank, no fill
628@@ -299,6 +317,14 @@
629 file.write(' }\n')
630 InstanceName.Clear()
631
632+ # Filling with photons
633+ file.write(' for (UInt_t i=0;i<event.rec()->photons().size();i++)\n')
634+ file.write(' {\n')
635+ for item in part_list:
636+ WriteFillWithPhotonContainer(item[0],file,item[1],item[2])
637+ file.write(' }\n')
638+ InstanceName.Clear()
639+
640 # Filling with electrons
641 file.write(' for (UInt_t i=0;i<event.rec()->electrons().size();i++)\n')
642 file.write(' {\n')
643
644=== modified file 'madanalysis/job/job_initialize.py'
645--- madanalysis/job/job_initialize.py 2013-05-17 06:19:22 +0000
646+++ madanalysis/job/job_initialize.py 2013-06-13 12:22:26 +0000
647@@ -45,13 +45,390 @@
648 file.write('{\n')
649
650 # mcConfig initialization
651- #if main.mode!=MA5RunningType.RECO: FOR ALL MODES !!!!
652- file.write(' // Initializing PhysicsService for MC\n')
653- file.write(' PHYSICS->mcConfig().Reset();\n\n')
654- WriteHadronicList(file,main)
655- file.write('\n')
656- WriteInvisibleList(file,main)
657- file.write('\n')
658+ if main.mode!=MA5RunningType.RECO:
659+ file.write(' // Initializing PhysicsService for MC\n')
660+ file.write(' PHYSICS->mcConfig().Reset();\n\n')
661+ WriteHadronicList(file,main)
662+ file.write('\n')
663+ WriteInvisibleList(file,main)
664+ file.write('\n')
665+ else:
666+ file.write(' // Initializing PhysicsService for MC\n')
667+ file.write(' PHYSICS->mcConfig().Reset();\n\n')
668+ file.write('\n')
669+ file.write(' // definition of the multiparticle "hadronic"\n')
670+ file.write(' PHYSICS->mcConfig().AddHadronicId(-20543);\n')
671+ file.write(' PHYSICS->mcConfig().AddHadronicId(-20533);\n')
672+ file.write(' PHYSICS->mcConfig().AddHadronicId(-20523);\n')
673+ file.write(' PHYSICS->mcConfig().AddHadronicId(-20513);\n')
674+ file.write(' PHYSICS->mcConfig().AddHadronicId(-20433);\n')
675+ file.write(' PHYSICS->mcConfig().AddHadronicId(-20423);\n')
676+ file.write(' PHYSICS->mcConfig().AddHadronicId(-20413);\n')
677+ file.write(' PHYSICS->mcConfig().AddHadronicId(-20323);\n')
678+ file.write(' PHYSICS->mcConfig().AddHadronicId(-20313);\n')
679+ file.write(' PHYSICS->mcConfig().AddHadronicId(-20213);\n')
680+ file.write(' PHYSICS->mcConfig().AddHadronicId(-10543);\n')
681+ file.write(' PHYSICS->mcConfig().AddHadronicId(-10541);\n')
682+ file.write(' PHYSICS->mcConfig().AddHadronicId(-10533);\n')
683+ file.write(' PHYSICS->mcConfig().AddHadronicId(-10531);\n')
684+ file.write(' PHYSICS->mcConfig().AddHadronicId(-10523);\n')
685+ file.write(' PHYSICS->mcConfig().AddHadronicId(-10521);\n')
686+ file.write(' PHYSICS->mcConfig().AddHadronicId(-10513);\n')
687+ file.write(' PHYSICS->mcConfig().AddHadronicId(-10511);\n')
688+ file.write(' PHYSICS->mcConfig().AddHadronicId(-10433);\n')
689+ file.write(' PHYSICS->mcConfig().AddHadronicId(-10431);\n')
690+ file.write(' PHYSICS->mcConfig().AddHadronicId(-10423);\n')
691+ file.write(' PHYSICS->mcConfig().AddHadronicId(-10421);\n')
692+ file.write(' PHYSICS->mcConfig().AddHadronicId(-10413);\n')
693+ file.write(' PHYSICS->mcConfig().AddHadronicId(-10411);\n')
694+ file.write(' PHYSICS->mcConfig().AddHadronicId(-10323);\n')
695+ file.write(' PHYSICS->mcConfig().AddHadronicId(-10321);\n')
696+ file.write(' PHYSICS->mcConfig().AddHadronicId(-10313);\n')
697+ file.write(' PHYSICS->mcConfig().AddHadronicId(-10311);\n')
698+ file.write(' PHYSICS->mcConfig().AddHadronicId(-10213);\n')
699+ file.write(' PHYSICS->mcConfig().AddHadronicId(-10211);\n')
700+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5554);\n')
701+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5544);\n')
702+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5542);\n')
703+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5534);\n')
704+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5532);\n')
705+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5524);\n')
706+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5522);\n')
707+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5514);\n')
708+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5512);\n')
709+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5503);\n')
710+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5444);\n')
711+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5442);\n')
712+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5434);\n')
713+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5432);\n')
714+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5424);\n')
715+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5422);\n')
716+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5414);\n')
717+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5412);\n')
718+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5403);\n')
719+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5401);\n')
720+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5342);\n')
721+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5334);\n')
722+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5332);\n')
723+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5324);\n')
724+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5322);\n')
725+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5314);\n')
726+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5312);\n')
727+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5303);\n')
728+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5301);\n')
729+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5242);\n')
730+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5232);\n')
731+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5224);\n')
732+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5222);\n')
733+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5214);\n')
734+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5212);\n')
735+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5203);\n')
736+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5201);\n')
737+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5142);\n')
738+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5132);\n')
739+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5122);\n')
740+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5114);\n')
741+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5112);\n')
742+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5103);\n')
743+ file.write(' PHYSICS->mcConfig().AddHadronicId(-5101);\n')
744+ file.write(' PHYSICS->mcConfig().AddHadronicId(-4444);\n')
745+ file.write(' PHYSICS->mcConfig().AddHadronicId(-4434);\n')
746+ file.write(' PHYSICS->mcConfig().AddHadronicId(-4432);\n')
747+ file.write(' PHYSICS->mcConfig().AddHadronicId(-4424);\n')
748+ file.write(' PHYSICS->mcConfig().AddHadronicId(-4422);\n')
749+ file.write(' PHYSICS->mcConfig().AddHadronicId(-4414);\n')
750+ file.write(' PHYSICS->mcConfig().AddHadronicId(-4412);\n')
751+ file.write(' PHYSICS->mcConfig().AddHadronicId(-4403);\n')
752+ file.write(' PHYSICS->mcConfig().AddHadronicId(-4334);\n')
753+ file.write(' PHYSICS->mcConfig().AddHadronicId(-4332);\n')
754+ file.write(' PHYSICS->mcConfig().AddHadronicId(-4324);\n')
755+ file.write(' PHYSICS->mcConfig().AddHadronicId(-4322);\n')
756+ file.write(' PHYSICS->mcConfig().AddHadronicId(-4314);\n')
757+ file.write(' PHYSICS->mcConfig().AddHadronicId(-4312);\n')
758+ file.write(' PHYSICS->mcConfig().AddHadronicId(-4303);\n')
759+ file.write(' PHYSICS->mcConfig().AddHadronicId(-4301);\n')
760+ file.write(' PHYSICS->mcConfig().AddHadronicId(-4232);\n')
761+ file.write(' PHYSICS->mcConfig().AddHadronicId(-4224);\n')
762+ file.write(' PHYSICS->mcConfig().AddHadronicId(-4222);\n')
763+ file.write(' PHYSICS->mcConfig().AddHadronicId(-4214);\n')
764+ file.write(' PHYSICS->mcConfig().AddHadronicId(-4212);\n')
765+ file.write(' PHYSICS->mcConfig().AddHadronicId(-4203);\n')
766+ file.write(' PHYSICS->mcConfig().AddHadronicId(-4201);\n')
767+ file.write(' PHYSICS->mcConfig().AddHadronicId(-4132);\n')
768+ file.write(' PHYSICS->mcConfig().AddHadronicId(-4122);\n')
769+ file.write(' PHYSICS->mcConfig().AddHadronicId(-4114);\n')
770+ file.write(' PHYSICS->mcConfig().AddHadronicId(-4112);\n')
771+ file.write(' PHYSICS->mcConfig().AddHadronicId(-4103);\n')
772+ file.write(' PHYSICS->mcConfig().AddHadronicId(-4101);\n')
773+ file.write(' PHYSICS->mcConfig().AddHadronicId(-3334);\n')
774+ file.write(' PHYSICS->mcConfig().AddHadronicId(-3324);\n')
775+ file.write(' PHYSICS->mcConfig().AddHadronicId(-3322);\n')
776+ file.write(' PHYSICS->mcConfig().AddHadronicId(-3314);\n')
777+ file.write(' PHYSICS->mcConfig().AddHadronicId(-3312);\n')
778+ file.write(' PHYSICS->mcConfig().AddHadronicId(-3303);\n')
779+ file.write(' PHYSICS->mcConfig().AddHadronicId(-3224);\n')
780+ file.write(' PHYSICS->mcConfig().AddHadronicId(-3222);\n')
781+ file.write(' PHYSICS->mcConfig().AddHadronicId(-3214);\n')
782+ file.write(' PHYSICS->mcConfig().AddHadronicId(-3212);\n')
783+ file.write(' PHYSICS->mcConfig().AddHadronicId(-3203);\n')
784+ file.write(' PHYSICS->mcConfig().AddHadronicId(-3201);\n')
785+ file.write(' PHYSICS->mcConfig().AddHadronicId(-3122);\n')
786+ file.write(' PHYSICS->mcConfig().AddHadronicId(-3114);\n')
787+ file.write(' PHYSICS->mcConfig().AddHadronicId(-3112);\n')
788+ file.write(' PHYSICS->mcConfig().AddHadronicId(-3103);\n')
789+ file.write(' PHYSICS->mcConfig().AddHadronicId(-3101);\n')
790+ file.write(' PHYSICS->mcConfig().AddHadronicId(-2224);\n')
791+ file.write(' PHYSICS->mcConfig().AddHadronicId(-2214);\n')
792+ file.write(' PHYSICS->mcConfig().AddHadronicId(-2212);\n')
793+ file.write(' PHYSICS->mcConfig().AddHadronicId(-2203);\n')
794+ file.write(' PHYSICS->mcConfig().AddHadronicId(-2114);\n')
795+ file.write(' PHYSICS->mcConfig().AddHadronicId(-2112);\n')
796+ file.write(' PHYSICS->mcConfig().AddHadronicId(-2103);\n')
797+ file.write(' PHYSICS->mcConfig().AddHadronicId(-2101);\n')
798+ file.write(' PHYSICS->mcConfig().AddHadronicId(-1114);\n')
799+ file.write(' PHYSICS->mcConfig().AddHadronicId(-1103);\n')
800+ file.write(' PHYSICS->mcConfig().AddHadronicId(-545);\n')
801+ file.write(' PHYSICS->mcConfig().AddHadronicId(-543);\n')
802+ file.write(' PHYSICS->mcConfig().AddHadronicId(-541);\n')
803+ file.write(' PHYSICS->mcConfig().AddHadronicId(-535);\n')
804+ file.write(' PHYSICS->mcConfig().AddHadronicId(-533);\n')
805+ file.write(' PHYSICS->mcConfig().AddHadronicId(-531);\n')
806+ file.write(' PHYSICS->mcConfig().AddHadronicId(-525);\n')
807+ file.write(' PHYSICS->mcConfig().AddHadronicId(-523);\n')
808+ file.write(' PHYSICS->mcConfig().AddHadronicId(-521);\n')
809+ file.write(' PHYSICS->mcConfig().AddHadronicId(-515);\n')
810+ file.write(' PHYSICS->mcConfig().AddHadronicId(-513);\n')
811+ file.write(' PHYSICS->mcConfig().AddHadronicId(-511);\n')
812+ file.write(' PHYSICS->mcConfig().AddHadronicId(-435);\n')
813+ file.write(' PHYSICS->mcConfig().AddHadronicId(-433);\n')
814+ file.write(' PHYSICS->mcConfig().AddHadronicId(-431);\n')
815+ file.write(' PHYSICS->mcConfig().AddHadronicId(-425);\n')
816+ file.write(' PHYSICS->mcConfig().AddHadronicId(-423);\n')
817+ file.write(' PHYSICS->mcConfig().AddHadronicId(-421);\n')
818+ file.write(' PHYSICS->mcConfig().AddHadronicId(-415);\n')
819+ file.write(' PHYSICS->mcConfig().AddHadronicId(-413);\n')
820+ file.write(' PHYSICS->mcConfig().AddHadronicId(-411);\n')
821+ file.write(' PHYSICS->mcConfig().AddHadronicId(-325);\n')
822+ file.write(' PHYSICS->mcConfig().AddHadronicId(-323);\n')
823+ file.write(' PHYSICS->mcConfig().AddHadronicId(-321);\n')
824+ file.write(' PHYSICS->mcConfig().AddHadronicId(-315);\n')
825+ file.write(' PHYSICS->mcConfig().AddHadronicId(-313);\n')
826+ file.write(' PHYSICS->mcConfig().AddHadronicId(-311);\n')
827+ file.write(' PHYSICS->mcConfig().AddHadronicId(-215);\n')
828+ file.write(' PHYSICS->mcConfig().AddHadronicId(-213);\n')
829+ file.write(' PHYSICS->mcConfig().AddHadronicId(-211);\n')
830+ file.write(' PHYSICS->mcConfig().AddHadronicId(111);\n')
831+ file.write(' PHYSICS->mcConfig().AddHadronicId(113);\n')
832+ file.write(' PHYSICS->mcConfig().AddHadronicId(115);\n')
833+ file.write(' PHYSICS->mcConfig().AddHadronicId(130);\n')
834+ file.write(' PHYSICS->mcConfig().AddHadronicId(211);\n')
835+ file.write(' PHYSICS->mcConfig().AddHadronicId(213);\n')
836+ file.write(' PHYSICS->mcConfig().AddHadronicId(215);\n')
837+ file.write(' PHYSICS->mcConfig().AddHadronicId(221);\n')
838+ file.write(' PHYSICS->mcConfig().AddHadronicId(223);\n')
839+ file.write(' PHYSICS->mcConfig().AddHadronicId(225);\n')
840+ file.write(' PHYSICS->mcConfig().AddHadronicId(310);\n')
841+ file.write(' PHYSICS->mcConfig().AddHadronicId(311);\n')
842+ file.write(' PHYSICS->mcConfig().AddHadronicId(313);\n')
843+ file.write(' PHYSICS->mcConfig().AddHadronicId(315);\n')
844+ file.write(' PHYSICS->mcConfig().AddHadronicId(321);\n')
845+ file.write(' PHYSICS->mcConfig().AddHadronicId(323);\n')
846+ file.write(' PHYSICS->mcConfig().AddHadronicId(325);\n')
847+ file.write(' PHYSICS->mcConfig().AddHadronicId(331);\n')
848+ file.write(' PHYSICS->mcConfig().AddHadronicId(333);\n')
849+ file.write(' PHYSICS->mcConfig().AddHadronicId(335);\n')
850+ file.write(' PHYSICS->mcConfig().AddHadronicId(411);\n')
851+ file.write(' PHYSICS->mcConfig().AddHadronicId(413);\n')
852+ file.write(' PHYSICS->mcConfig().AddHadronicId(415);\n')
853+ file.write(' PHYSICS->mcConfig().AddHadronicId(421);\n')
854+ file.write(' PHYSICS->mcConfig().AddHadronicId(423);\n')
855+ file.write(' PHYSICS->mcConfig().AddHadronicId(425);\n')
856+ file.write(' PHYSICS->mcConfig().AddHadronicId(431);\n')
857+ file.write(' PHYSICS->mcConfig().AddHadronicId(433);\n')
858+ file.write(' PHYSICS->mcConfig().AddHadronicId(435);\n')
859+ file.write(' PHYSICS->mcConfig().AddHadronicId(441);\n')
860+ file.write(' PHYSICS->mcConfig().AddHadronicId(443);\n')
861+ file.write(' PHYSICS->mcConfig().AddHadronicId(445);\n')
862+ file.write(' PHYSICS->mcConfig().AddHadronicId(511);\n')
863+ file.write(' PHYSICS->mcConfig().AddHadronicId(513);\n')
864+ file.write(' PHYSICS->mcConfig().AddHadronicId(515);\n')
865+ file.write(' PHYSICS->mcConfig().AddHadronicId(521);\n')
866+ file.write(' PHYSICS->mcConfig().AddHadronicId(523);\n')
867+ file.write(' PHYSICS->mcConfig().AddHadronicId(525);\n')
868+ file.write(' PHYSICS->mcConfig().AddHadronicId(531);\n')
869+ file.write(' PHYSICS->mcConfig().AddHadronicId(533);\n')
870+ file.write(' PHYSICS->mcConfig().AddHadronicId(535);\n')
871+ file.write(' PHYSICS->mcConfig().AddHadronicId(541);\n')
872+ file.write(' PHYSICS->mcConfig().AddHadronicId(543);\n')
873+ file.write(' PHYSICS->mcConfig().AddHadronicId(545);\n')
874+ file.write(' PHYSICS->mcConfig().AddHadronicId(551);\n')
875+ file.write(' PHYSICS->mcConfig().AddHadronicId(553);\n')
876+ file.write(' PHYSICS->mcConfig().AddHadronicId(555);\n')
877+ file.write(' PHYSICS->mcConfig().AddHadronicId(1103);\n')
878+ file.write(' PHYSICS->mcConfig().AddHadronicId(1114);\n')
879+ file.write(' PHYSICS->mcConfig().AddHadronicId(2101);\n')
880+ file.write(' PHYSICS->mcConfig().AddHadronicId(2103);\n')
881+ file.write(' PHYSICS->mcConfig().AddHadronicId(2112);\n')
882+ file.write(' PHYSICS->mcConfig().AddHadronicId(2114);\n')
883+ file.write(' PHYSICS->mcConfig().AddHadronicId(2203);\n')
884+ file.write(' PHYSICS->mcConfig().AddHadronicId(2212);\n')
885+ file.write(' PHYSICS->mcConfig().AddHadronicId(2214);\n')
886+ file.write(' PHYSICS->mcConfig().AddHadronicId(2224);\n')
887+ file.write(' PHYSICS->mcConfig().AddHadronicId(3101);\n')
888+ file.write(' PHYSICS->mcConfig().AddHadronicId(3103);\n')
889+ file.write(' PHYSICS->mcConfig().AddHadronicId(3112);\n')
890+ file.write(' PHYSICS->mcConfig().AddHadronicId(3114);\n')
891+ file.write(' PHYSICS->mcConfig().AddHadronicId(3122);\n')
892+ file.write(' PHYSICS->mcConfig().AddHadronicId(3201);\n')
893+ file.write(' PHYSICS->mcConfig().AddHadronicId(3203);\n')
894+ file.write(' PHYSICS->mcConfig().AddHadronicId(3212);\n')
895+ file.write(' PHYSICS->mcConfig().AddHadronicId(3214);\n')
896+ file.write(' PHYSICS->mcConfig().AddHadronicId(3222);\n')
897+ file.write(' PHYSICS->mcConfig().AddHadronicId(3224);\n')
898+ file.write(' PHYSICS->mcConfig().AddHadronicId(3303);\n')
899+ file.write(' PHYSICS->mcConfig().AddHadronicId(3312);\n')
900+ file.write(' PHYSICS->mcConfig().AddHadronicId(3314);\n')
901+ file.write(' PHYSICS->mcConfig().AddHadronicId(3322);\n')
902+ file.write(' PHYSICS->mcConfig().AddHadronicId(3324);\n')
903+ file.write(' PHYSICS->mcConfig().AddHadronicId(3334);\n')
904+ file.write(' PHYSICS->mcConfig().AddHadronicId(4101);\n')
905+ file.write(' PHYSICS->mcConfig().AddHadronicId(4103);\n')
906+ file.write(' PHYSICS->mcConfig().AddHadronicId(4112);\n')
907+ file.write(' PHYSICS->mcConfig().AddHadronicId(4114);\n')
908+ file.write(' PHYSICS->mcConfig().AddHadronicId(4122);\n')
909+ file.write(' PHYSICS->mcConfig().AddHadronicId(4132);\n')
910+ file.write(' PHYSICS->mcConfig().AddHadronicId(4201);\n')
911+ file.write(' PHYSICS->mcConfig().AddHadronicId(4203);\n')
912+ file.write(' PHYSICS->mcConfig().AddHadronicId(4212);\n')
913+ file.write(' PHYSICS->mcConfig().AddHadronicId(4214);\n')
914+ file.write(' PHYSICS->mcConfig().AddHadronicId(4222);\n')
915+ file.write(' PHYSICS->mcConfig().AddHadronicId(4224);\n')
916+ file.write(' PHYSICS->mcConfig().AddHadronicId(4232);\n')
917+ file.write(' PHYSICS->mcConfig().AddHadronicId(4301);\n')
918+ file.write(' PHYSICS->mcConfig().AddHadronicId(4303);\n')
919+ file.write(' PHYSICS->mcConfig().AddHadronicId(4312);\n')
920+ file.write(' PHYSICS->mcConfig().AddHadronicId(4314);\n')
921+ file.write(' PHYSICS->mcConfig().AddHadronicId(4322);\n')
922+ file.write(' PHYSICS->mcConfig().AddHadronicId(4324);\n')
923+ file.write(' PHYSICS->mcConfig().AddHadronicId(4332);\n')
924+ file.write(' PHYSICS->mcConfig().AddHadronicId(4334);\n')
925+ file.write(' PHYSICS->mcConfig().AddHadronicId(4403);\n')
926+ file.write(' PHYSICS->mcConfig().AddHadronicId(4412);\n')
927+ file.write(' PHYSICS->mcConfig().AddHadronicId(4414);\n')
928+ file.write(' PHYSICS->mcConfig().AddHadronicId(4422);\n')
929+ file.write(' PHYSICS->mcConfig().AddHadronicId(4424);\n')
930+ file.write(' PHYSICS->mcConfig().AddHadronicId(4432);\n')
931+ file.write(' PHYSICS->mcConfig().AddHadronicId(4434);\n')
932+ file.write(' PHYSICS->mcConfig().AddHadronicId(4444);\n')
933+ file.write(' PHYSICS->mcConfig().AddHadronicId(5101);\n')
934+ file.write(' PHYSICS->mcConfig().AddHadronicId(5103);\n')
935+ file.write(' PHYSICS->mcConfig().AddHadronicId(5112);\n')
936+ file.write(' PHYSICS->mcConfig().AddHadronicId(5114);\n')
937+ file.write(' PHYSICS->mcConfig().AddHadronicId(5122);\n')
938+ file.write(' PHYSICS->mcConfig().AddHadronicId(5132);\n')
939+ file.write(' PHYSICS->mcConfig().AddHadronicId(5142);\n')
940+ file.write(' PHYSICS->mcConfig().AddHadronicId(5201);\n')
941+ file.write(' PHYSICS->mcConfig().AddHadronicId(5203);\n')
942+ file.write(' PHYSICS->mcConfig().AddHadronicId(5212);\n')
943+ file.write(' PHYSICS->mcConfig().AddHadronicId(5214);\n')
944+ file.write(' PHYSICS->mcConfig().AddHadronicId(5222);\n')
945+ file.write(' PHYSICS->mcConfig().AddHadronicId(5224);\n')
946+ file.write(' PHYSICS->mcConfig().AddHadronicId(5232);\n')
947+ file.write(' PHYSICS->mcConfig().AddHadronicId(5242);\n')
948+ file.write(' PHYSICS->mcConfig().AddHadronicId(5301);\n')
949+ file.write(' PHYSICS->mcConfig().AddHadronicId(5303);\n')
950+ file.write(' PHYSICS->mcConfig().AddHadronicId(5312);\n')
951+ file.write(' PHYSICS->mcConfig().AddHadronicId(5314);\n')
952+ file.write(' PHYSICS->mcConfig().AddHadronicId(5322);\n')
953+ file.write(' PHYSICS->mcConfig().AddHadronicId(5324);\n')
954+ file.write(' PHYSICS->mcConfig().AddHadronicId(5332);\n')
955+ file.write(' PHYSICS->mcConfig().AddHadronicId(5334);\n')
956+ file.write(' PHYSICS->mcConfig().AddHadronicId(5342);\n')
957+ file.write(' PHYSICS->mcConfig().AddHadronicId(5401);\n')
958+ file.write(' PHYSICS->mcConfig().AddHadronicId(5403);\n')
959+ file.write(' PHYSICS->mcConfig().AddHadronicId(5412);\n')
960+ file.write(' PHYSICS->mcConfig().AddHadronicId(5414);\n')
961+ file.write(' PHYSICS->mcConfig().AddHadronicId(5422);\n')
962+ file.write(' PHYSICS->mcConfig().AddHadronicId(5424);\n')
963+ file.write(' PHYSICS->mcConfig().AddHadronicId(5432);\n')
964+ file.write(' PHYSICS->mcConfig().AddHadronicId(5434);\n')
965+ file.write(' PHYSICS->mcConfig().AddHadronicId(5442);\n')
966+ file.write(' PHYSICS->mcConfig().AddHadronicId(5444);\n')
967+ file.write(' PHYSICS->mcConfig().AddHadronicId(5503);\n')
968+ file.write(' PHYSICS->mcConfig().AddHadronicId(5512);\n')
969+ file.write(' PHYSICS->mcConfig().AddHadronicId(5514);\n')
970+ file.write(' PHYSICS->mcConfig().AddHadronicId(5522);\n')
971+ file.write(' PHYSICS->mcConfig().AddHadronicId(5524);\n')
972+ file.write(' PHYSICS->mcConfig().AddHadronicId(5532);\n')
973+ file.write(' PHYSICS->mcConfig().AddHadronicId(5534);\n')
974+ file.write(' PHYSICS->mcConfig().AddHadronicId(5542);\n')
975+ file.write(' PHYSICS->mcConfig().AddHadronicId(5544);\n')
976+ file.write(' PHYSICS->mcConfig().AddHadronicId(5554);\n')
977+ file.write(' PHYSICS->mcConfig().AddHadronicId(10111);\n')
978+ file.write(' PHYSICS->mcConfig().AddHadronicId(10113);\n')
979+ file.write(' PHYSICS->mcConfig().AddHadronicId(10211);\n')
980+ file.write(' PHYSICS->mcConfig().AddHadronicId(10213);\n')
981+ file.write(' PHYSICS->mcConfig().AddHadronicId(10221);\n')
982+ file.write(' PHYSICS->mcConfig().AddHadronicId(10223);\n')
983+ file.write(' PHYSICS->mcConfig().AddHadronicId(10311);\n')
984+ file.write(' PHYSICS->mcConfig().AddHadronicId(10313);\n')
985+ file.write(' PHYSICS->mcConfig().AddHadronicId(10321);\n')
986+ file.write(' PHYSICS->mcConfig().AddHadronicId(10323);\n')
987+ file.write(' PHYSICS->mcConfig().AddHadronicId(10331);\n')
988+ file.write(' PHYSICS->mcConfig().AddHadronicId(10333);\n')
989+ file.write(' PHYSICS->mcConfig().AddHadronicId(10411);\n')
990+ file.write(' PHYSICS->mcConfig().AddHadronicId(10413);\n')
991+ file.write(' PHYSICS->mcConfig().AddHadronicId(10421);\n')
992+ file.write(' PHYSICS->mcConfig().AddHadronicId(10423);\n')
993+ file.write(' PHYSICS->mcConfig().AddHadronicId(10431);\n')
994+ file.write(' PHYSICS->mcConfig().AddHadronicId(10433);\n')
995+ file.write(' PHYSICS->mcConfig().AddHadronicId(10441);\n')
996+ file.write(' PHYSICS->mcConfig().AddHadronicId(10443);\n')
997+ file.write(' PHYSICS->mcConfig().AddHadronicId(10511);\n')
998+ file.write(' PHYSICS->mcConfig().AddHadronicId(10513);\n')
999+ file.write(' PHYSICS->mcConfig().AddHadronicId(10521);\n')
1000+ file.write(' PHYSICS->mcConfig().AddHadronicId(10523);\n')
1001+ file.write(' PHYSICS->mcConfig().AddHadronicId(10531);\n')
1002+ file.write(' PHYSICS->mcConfig().AddHadronicId(10533);\n')
1003+ file.write(' PHYSICS->mcConfig().AddHadronicId(10541);\n')
1004+ file.write(' PHYSICS->mcConfig().AddHadronicId(10543);\n')
1005+ file.write(' PHYSICS->mcConfig().AddHadronicId(10551);\n')
1006+ file.write(' PHYSICS->mcConfig().AddHadronicId(10553);\n')
1007+ file.write(' PHYSICS->mcConfig().AddHadronicId(20113);\n')
1008+ file.write(' PHYSICS->mcConfig().AddHadronicId(20213);\n')
1009+ file.write(' PHYSICS->mcConfig().AddHadronicId(20223);\n')
1010+ file.write(' PHYSICS->mcConfig().AddHadronicId(20313);\n')
1011+ file.write(' PHYSICS->mcConfig().AddHadronicId(20323);\n')
1012+ file.write(' PHYSICS->mcConfig().AddHadronicId(20333);\n')
1013+ file.write(' PHYSICS->mcConfig().AddHadronicId(20413);\n')
1014+ file.write(' PHYSICS->mcConfig().AddHadronicId(20423);\n')
1015+ file.write(' PHYSICS->mcConfig().AddHadronicId(20433);\n')
1016+ file.write(' PHYSICS->mcConfig().AddHadronicId(20443);\n')
1017+ file.write(' PHYSICS->mcConfig().AddHadronicId(20513);\n')
1018+ file.write(' PHYSICS->mcConfig().AddHadronicId(20523);\n')
1019+ file.write(' PHYSICS->mcConfig().AddHadronicId(20533);\n')
1020+ file.write(' PHYSICS->mcConfig().AddHadronicId(20543);\n')
1021+ file.write(' PHYSICS->mcConfig().AddHadronicId(20553);\n')
1022+ file.write(' PHYSICS->mcConfig().AddHadronicId(100443);\n')
1023+ file.write(' PHYSICS->mcConfig().AddHadronicId(100553);\n')
1024+ file.write(' PHYSICS->mcConfig().AddHadronicId(9900440);\n')
1025+ file.write(' PHYSICS->mcConfig().AddHadronicId(9900441);\n')
1026+ file.write(' PHYSICS->mcConfig().AddHadronicId(9900443);\n')
1027+ file.write(' PHYSICS->mcConfig().AddHadronicId(9900551);\n')
1028+ file.write(' PHYSICS->mcConfig().AddHadronicId(9900553);\n')
1029+ file.write(' PHYSICS->mcConfig().AddHadronicId(9910441);\n')
1030+ file.write(' PHYSICS->mcConfig().AddHadronicId(9910551);\n')
1031+ file.write('\n')
1032+ file.write(' // definition of the multiparticle "invisible"\n')
1033+ file.write(' PHYSICS->mcConfig().AddInvisibleId(-16);\n')
1034+ file.write(' PHYSICS->mcConfig().AddInvisibleId(-14);\n')
1035+ file.write(' PHYSICS->mcConfig().AddInvisibleId(-12);\n')
1036+ file.write(' PHYSICS->mcConfig().AddInvisibleId(12);\n')
1037+ file.write(' PHYSICS->mcConfig().AddInvisibleId(14);\n')
1038+ file.write(' PHYSICS->mcConfig().AddInvisibleId(16);\n')
1039+ file.write(' PHYSICS->mcConfig().AddInvisibleId(1000022);\n')
1040+ file.write('\n')
1041+
1042
1043 # recConfig initialization
1044 if main.mode==MA5RunningType.RECO:
1045
1046=== modified file 'madanalysis/job/job_plot.py'
1047--- madanalysis/job/job_plot.py 2013-05-17 06:19:22 +0000
1048+++ madanalysis/job/job_plot.py 2013-06-13 12:22:26 +0000
1049@@ -88,6 +88,12 @@
1050 # RECO mode
1051 else:
1052
1053+ # photons
1054+ file.write(' for (unsigned int i=0;i<event.rec()->photons().size();i++)\n')
1055+ file.write(' {\n')
1056+ file.write(' H'+str(ihisto)+'_->Fill(22,__event_weight__);\n')
1057+ file.write(' }\n')
1058+
1059 # electrons
1060 file.write(' for (unsigned int i=0;i<event.rec()->electrons().size();i++)\n')
1061 file.write(' {\n')
1062
1063=== modified file 'madanalysis/layout/histogram.py'
1064--- madanalysis/layout/histogram.py 2013-05-17 06:19:22 +0000
1065+++ madanalysis/layout/histogram.py 2013-06-13 12:22:26 +0000
1066@@ -24,7 +24,6 @@
1067
1068 from madanalysis.layout.histogram_core import HistogramCore
1069 import logging
1070-import numpy
1071
1072
1073 class Histogram:
1074@@ -49,6 +48,8 @@
1075
1076 def FinalizeReading(self,main,dataset):
1077
1078+ import numpy
1079+
1080 # Statistics
1081 self.summary.nevents = self.positive.nevents + self.negative.nevents
1082 self.summary.nentries = self.positive.nentries + self.negative.nentries
1083
1084=== modified file 'madanalysis/layout/histogram_frequency_core.py'
1085--- madanalysis/layout/histogram_frequency_core.py 2013-05-17 06:19:22 +0000
1086+++ madanalysis/layout/histogram_frequency_core.py 2013-06-13 12:22:26 +0000
1087@@ -23,11 +23,11 @@
1088
1089
1090 import logging
1091-import numpy
1092
1093 class HistogramFrequencyCore:
1094
1095 def __init__(self):
1096+ import numpy
1097 self.integral = 0
1098 self.nevents = 0
1099 self.entries = 0
1100
1101=== modified file 'madanalysis/layout/plotflow.py'
1102--- madanalysis/layout/plotflow.py 2013-05-17 06:19:22 +0000
1103+++ madanalysis/layout/plotflow.py 2013-06-13 12:22:26 +0000
1104@@ -164,7 +164,6 @@
1105
1106 # Loop over datasets and histos
1107 for ind in range(0,len(histos)):
1108-
1109 # Scaling
1110 histos[ind].Scale(scales[ind])
1111
1112@@ -396,7 +395,7 @@
1113 stack = THStack("mystack","")
1114 ntot = 0
1115 for item in histos:
1116- ntot+=item.GetEntries()
1117+ ntot+=item.Integral()
1118 stack.Add(item)
1119
1120 # Drawing
1121
1122=== modified file 'tools/SampleAnalyzer/Analyzer/AnalyzerBase.h'
1123--- tools/SampleAnalyzer/Analyzer/AnalyzerBase.h 2013-05-17 06:19:22 +0000
1124+++ tools/SampleAnalyzer/Analyzer/AnalyzerBase.h 2013-06-13 12:22:26 +0000
1125@@ -94,10 +94,10 @@
1126
1127 /// Initialize (common part to all analyses)
1128 bool PreInitialize(const std::string& outputName,
1129- bool weighted_events=false)
1130+ const Configuration* cfg)
1131 {
1132- weighted_events_ = weighted_events;
1133- out_.Initialize(outputName.c_str());
1134+ weighted_events_ = cfg->IsNoEventWeight();
1135+ out_.Initialize(cfg,outputName.c_str());
1136 return true;
1137 }
1138
1139
1140=== modified file 'tools/SampleAnalyzer/Analyzer/MergingPlots.cpp'
1141--- tools/SampleAnalyzer/Analyzer/MergingPlots.cpp 2013-05-17 06:19:22 +0000
1142+++ tools/SampleAnalyzer/Analyzer/MergingPlots.cpp 2013-06-13 12:22:26 +0000
1143@@ -27,6 +27,7 @@
1144 #include "SampleAnalyzer/Analyzer/MergingPlots.h"
1145 #include "SampleAnalyzer/Core/Configuration.h"
1146 #include "SampleAnalyzer/Service/Physics.h"
1147+#include "SampleAnalyzer/Service/CompilationService.h"
1148
1149 //STL headers
1150 #include <sstream>
1151@@ -201,6 +202,7 @@
1152 void MergingPlots::ExtractDJRwithFortran(const std::vector<fastjet::PseudoJet>& inputs,std::vector<Double_t>& DJRvalues)
1153 {
1154 double PP[512][4];
1155+ UNUSED(PP);
1156 for (unsigned int i=0;i<inputs.size();i++)
1157 {
1158 PP[i][0]=inputs[i].px();
1159
1160=== modified file 'tools/SampleAnalyzer/Core/Configuration.cpp'
1161--- tools/SampleAnalyzer/Core/Configuration.cpp 2013-05-17 06:19:22 +0000
1162+++ tools/SampleAnalyzer/Core/Configuration.cpp 2013-06-13 12:22:26 +0000
1163@@ -36,6 +36,14 @@
1164
1165
1166 // -----------------------------------------------------------------------------
1167+// Initializing static data members
1168+// -----------------------------------------------------------------------------
1169+// DO NOT TOUCH THESE LINES
1170+const std::string Configuration::sampleanalyzer_version_ = "1.1.25";
1171+const std::string Configuration::sampleanalyzer_date_ = "2013/06/13";
1172+// DO NOT TOUCH THESE LINES
1173+
1174+// -----------------------------------------------------------------------------
1175 // PrintSyntax
1176 // -----------------------------------------------------------------------------
1177 void Configuration::PrintSyntax()
1178@@ -94,6 +102,22 @@
1179 // weighted event
1180 else if (option=="--no_event_weight") no_event_weight_ = true;
1181
1182+ // version
1183+ else if (option.find("--ma5_version=")==0)
1184+ {
1185+ std::string stamp = option.substr(14,std::string::npos);
1186+ std::size_t result = stamp.find(";");
1187+ if (result==std::string::npos)
1188+ {
1189+ WARNING << "MA5 version '" << stamp << "' is not valid." << std::endl;
1190+ }
1191+ else
1192+ {
1193+ pythoninterface_version_ = stamp.substr(0,result);
1194+ pythoninterface_date_ = stamp.substr(result+1,std::string::npos);
1195+ }
1196+ }
1197+
1198 // unknown option
1199 else
1200 {
1201@@ -116,6 +140,13 @@
1202 // -----------------------------------------------------------------------------
1203 void Configuration::Display()
1204 {
1205+ INFO << " - version: " << sampleanalyzer_version_ << " (" << sampleanalyzer_date_ << ") ";
1206+ if ((sampleanalyzer_version_!=pythoninterface_version_ && pythoninterface_version_!="") ||
1207+ (sampleanalyzer_date_!=pythoninterface_date_ && pythoninterface_version_!=""))
1208+ INFO << "[ python interface version: " << pythoninterface_version_
1209+ << " (" << pythoninterface_date_ << ") ]";
1210+ INFO << endmsg;
1211+
1212 INFO << " - general: ";
1213
1214 // Is there option ?
1215
1216=== modified file 'tools/SampleAnalyzer/Core/Configuration.h'
1217--- tools/SampleAnalyzer/Core/Configuration.h 2013-05-17 06:19:22 +0000
1218+++ tools/SampleAnalyzer/Core/Configuration.h 2013-06-13 12:22:26 +0000
1219@@ -44,6 +44,14 @@
1220 // -------------------------------------------------------------
1221 private:
1222
1223+ /// SampleAnalyzer version
1224+ static const std::string sampleanalyzer_version_;
1225+ static const std::string sampleanalyzer_date_;
1226+
1227+ /// Python interface version
1228+ std::string pythoninterface_version_;
1229+ std::string pythoninterface_date_;
1230+
1231 /// option : check event mode
1232 Bool_t check_event_;
1233
1234@@ -76,6 +84,22 @@
1235 /// Help message
1236 void PrintSyntax();
1237
1238+ /// Accessor to the sampleanalyzer date
1239+ const std::string& GetSampleAnalyzerDate() const
1240+ {return sampleanalyzer_date_;}
1241+
1242+ /// Accessor to the sampleanalyzer version
1243+ const std::string& GetSampleAnalyzerVersion() const
1244+ {return sampleanalyzer_version_;}
1245+
1246+ /// Accessor to the python interface date
1247+ const std::string& GetPythonInterfaceDate() const
1248+ {return sampleanalyzer_date_;}
1249+
1250+ /// Accessor to the python interface version
1251+ const std::string& GetPythonInterfaceVersion() const
1252+ {return sampleanalyzer_version_;}
1253+
1254 /// Accessor to the input name
1255 const std::string& GetInputFileName() const
1256 {return input_list_name_;}
1257
1258=== modified file 'tools/SampleAnalyzer/Core/ProgressBar.cpp'
1259--- tools/SampleAnalyzer/Core/ProgressBar.cpp 2013-05-17 06:19:22 +0000
1260+++ tools/SampleAnalyzer/Core/ProgressBar.cpp 2013-06-13 12:22:26 +0000
1261@@ -23,6 +23,8 @@
1262
1263
1264 // STL headers
1265+#include <cstdlib>
1266+
1267 // SampleAnalyzer headers
1268 #include "SampleAnalyzer/Core/ProgressBar.h"
1269 #include "SampleAnalyzer/Service/LogStream.h"
1270@@ -30,7 +32,7 @@
1271 using namespace MA5;
1272
1273
1274-const std::string ProgressBar::header(" => progress ");
1275+const std::string ProgressBar::header(" => progress: ");
1276
1277
1278 // -----------------------------------------------------------------------------
1279@@ -63,14 +65,22 @@
1280 // std::cout << "eric Indicator_=" << Indicator_ << std::endl;
1281
1282 /// Saving previous stream buffer related to std::cout
1283- oldstreambuf_ = std::cout.rdbuf();
1284+ oldstreambuf_cout_ = std::cout.rdbuf();
1285 std::cout.flush();
1286+ oldstreambuf_cerr_ = std::cerr.rdbuf();
1287+ std::cerr.flush();
1288+ oldstreambuf_clog_ = std::clog.rdbuf();
1289+ std::clog.flush();
1290
1291 /// Assigning a new stream buffer with spy
1292- newstreambuf_ = new SpyStreamBuffer(oldstreambuf_);
1293- std::cout.rdbuf(newstreambuf_);
1294-
1295- // std::cout << "muf Indicator_=" << Indicator_ << std::endl;
1296+ newstreambuf_cout_ = new SpyStreamBuffer(oldstreambuf_cout_);
1297+ std::cout.rdbuf(newstreambuf_cout_);
1298+
1299+ newstreambuf_cerr_ = new SpyStreamBuffer(oldstreambuf_cerr_);
1300+ std::cout.rdbuf(newstreambuf_cerr_);
1301+
1302+ newstreambuf_clog_ = new SpyStreamBuffer(oldstreambuf_clog_);
1303+ std::cout.rdbuf(newstreambuf_clog_);
1304
1305 }
1306
1307@@ -120,22 +130,30 @@
1308 todisplay[ind+1]='>';
1309 todisplay[Nstep_+1]=']'; // overwrite the character '>' if ind=Nstep_
1310
1311+ bool newline=false;
1312 // Go back to the line ?
1313 if (ind!=0 && !FirstTime_)
1314 {
1315- std::vector<char> last_chars = newstreambuf_->get_last_chars();
1316- if (last_chars[0] != '\n') std::cout << std::endl;
1317- else if (last_chars[5] == 93 && last_chars[4] == 27 &&
1318- last_chars[3] == 91 && last_chars[2] == 48 &&
1319- last_chars[1] == 109) std::cout << "\b\r";
1320+ if (!newstreambuf_cout_->GetProgressBarMode()) newline=true;
1321+ if (!newstreambuf_cerr_->GetProgressBarMode()) newline=true;
1322+ if (!newstreambuf_clog_->GetProgressBarMode()) newline=true;
1323 }
1324- FirstTime_=false;
1325
1326 // Adding header
1327+ unsigned int toremove = (header+todisplay).size();
1328 todisplay = header + "\x1b[34m"+ todisplay + "\x1b[0m";
1329
1330 // Displaying
1331- std::cout << todisplay << std::endl;
1332+ newstreambuf_cout_->SetProgressBarMode(false);
1333+ newstreambuf_cerr_->SetProgressBarMode(false);
1334+ newstreambuf_clog_->SetProgressBarMode(false);
1335+ if (newline) std::cout << std::endl;
1336+ else if (!FirstTime_) std::cout << std::string(toremove,'\b');
1337+ std::cout << todisplay;
1338+ newstreambuf_cout_->SetProgressBarMode(true);
1339+ newstreambuf_cerr_->SetProgressBarMode(true);
1340+ newstreambuf_clog_->SetProgressBarMode(true);
1341+ FirstTime_=false;
1342 }
1343
1344
1345@@ -149,11 +167,21 @@
1346
1347 // Display the indicator with a status of 100% ?
1348 if (!MuteEnd_) Display(Nstep_);
1349+ newstreambuf_cout_->SetProgressBarMode(false);
1350+ newstreambuf_cerr_->SetProgressBarMode(false);
1351+ newstreambuf_clog_->SetProgressBarMode(false);
1352+ std::cout << std::endl;
1353
1354 // Restoring the initial stream buffer
1355- std::cout.rdbuf(oldstreambuf_);
1356- oldstreambuf_=0;
1357- if (newstreambuf_!=0) delete newstreambuf_;
1358+ std::cout.rdbuf(oldstreambuf_cout_);
1359+ std::cerr.rdbuf(oldstreambuf_cerr_);
1360+ std::clog.rdbuf(oldstreambuf_clog_);
1361+ oldstreambuf_cout_=0;
1362+ oldstreambuf_cerr_=0;
1363+ oldstreambuf_clog_=0;
1364+ if (newstreambuf_cout_!=0) delete newstreambuf_cout_;
1365+ if (newstreambuf_cerr_!=0) delete newstreambuf_cerr_;
1366+ if (newstreambuf_clog_!=0) delete newstreambuf_clog_;
1367
1368 // Reset the progress bar
1369 Reset();
1370
1371=== modified file 'tools/SampleAnalyzer/Core/ProgressBar.h'
1372--- tools/SampleAnalyzer/Core/ProgressBar.h 2013-05-17 06:19:22 +0000
1373+++ tools/SampleAnalyzer/Core/ProgressBar.h 2013-06-13 12:22:26 +0000
1374@@ -56,30 +56,36 @@
1375 public:
1376
1377 /// Constructor
1378- SpyStreamBuffer(std::streambuf* buf) : buf(buf)
1379+ SpyStreamBuffer(std::streambuf* buf) : buf_(buf)
1380 {
1381- last_chars.resize(7,traits_type::eof());
1382+ add_endl_=false;
1383 // no buffering, overflow on every char
1384 setp(0, 0);
1385 }
1386
1387- /// Getting last character
1388- const std::vector<char>& get_last_chars() const
1389- { return last_chars; }
1390+ /// Set ProgressBar mode
1391+ void SetProgressBarMode(bool status=true)
1392+ { add_endl_=status; }
1393+
1394+ /// Accessor to ProgressBar mode status
1395+ bool GetProgressBarMode() const
1396+ { return add_endl_; }
1397
1398 /// Overflow method
1399 virtual int_type overflow(int_type c)
1400 {
1401- buf->sputc(c);
1402- for (unsigned int i=(last_chars.size()-1);i>0;i--)
1403- last_chars[i]=last_chars[i-1];
1404- last_chars[0] = c;
1405+ if (add_endl_)
1406+ {
1407+ buf_->sputc('\n');
1408+ add_endl_=false;
1409+ }
1410+ buf_->sputc(c);
1411 return c;
1412 }
1413 private:
1414
1415- std::streambuf* buf;
1416- std::vector<char> last_chars;
1417+ std::streambuf* buf_;
1418+ bool add_endl_;
1419 };
1420
1421 // -------------------------------------------------------------
1422@@ -112,10 +118,14 @@
1423 std::vector<Long64_t> Thresholds_;
1424
1425 /// Pointer to the new stream buffer
1426- SpyStreamBuffer* newstreambuf_;
1427+ SpyStreamBuffer* newstreambuf_cout_;
1428+ SpyStreamBuffer* newstreambuf_cerr_;
1429+ SpyStreamBuffer* newstreambuf_clog_;
1430
1431 /// Pointer to the old stream buffer
1432- std::streambuf* oldstreambuf_;
1433+ std::streambuf* oldstreambuf_cout_;
1434+ std::streambuf* oldstreambuf_cerr_;
1435+ std::streambuf* oldstreambuf_clog_;
1436
1437 static const std::string header;
1438
1439@@ -127,14 +137,22 @@
1440 /// Constructor without argument
1441 ProgressBar()
1442 {
1443- newstreambuf_=0;
1444- oldstreambuf_=0;
1445+ newstreambuf_cout_=0;
1446+ newstreambuf_cerr_=0;
1447+ newstreambuf_clog_=0;
1448+ oldstreambuf_cout_=0;
1449+ oldstreambuf_cerr_=0;
1450+ oldstreambuf_clog_=0;
1451 Reset();
1452 }
1453
1454 /// Destructor
1455 ~ProgressBar()
1456- { if (newstreambuf_!=0) delete newstreambuf_; }
1457+ {
1458+ if (newstreambuf_cout_!=0) delete newstreambuf_cout_;
1459+ if (newstreambuf_cerr_!=0) delete newstreambuf_cerr_;
1460+ if (newstreambuf_clog_!=0) delete newstreambuf_clog_;
1461+ }
1462
1463 /// Reset
1464 void Reset()
1465
1466=== modified file 'tools/SampleAnalyzer/Core/SampleAnalyzer.cpp'
1467--- tools/SampleAnalyzer/Core/SampleAnalyzer.cpp 2013-05-17 06:19:22 +0000
1468+++ tools/SampleAnalyzer/Core/SampleAnalyzer.cpp 2013-06-13 12:22:26 +0000
1469@@ -27,15 +27,14 @@
1470 #include "SampleAnalyzer/Writer/SAFWriter.h"
1471 #include "SampleAnalyzer/Service/ExceptionService.h"
1472 #include "SampleAnalyzer/Service/TimeService.h"
1473-#include "SampleAnalyzer/Service/Terminate.h"
1474 #include "SampleAnalyzer/Service/PDGService.h"
1475 #include "SampleAnalyzer/Service/Terminate.h"
1476+#include "SampleAnalyzer/Service/CompilationService.h"
1477
1478
1479 using namespace MA5;
1480
1481-
1482-/// Constructor withtout arguments
1483+/// Constructor without arguments
1484 SampleAnalyzer::SampleAnalyzer()
1485 {
1486 // Initializing service
1487@@ -49,7 +48,7 @@
1488 progressBar_=0;
1489
1490 // Header
1491- INFO << " * SampleAnalyzer 2.0 for MadAnalysis 5 - Welcome.";
1492+ INFO << " * SampleAnalyzer for MadAnalysis 5 - Welcome.";
1493 INFO << endmsg;
1494
1495 }
1496@@ -74,7 +73,7 @@
1497 std::string filename = cfg_.GetInputListName();
1498
1499 // Checks if a file has been provided
1500- INFO << " - extracting event samples..." << endmsg;
1501+ INFO << " - extracting the list of event samples..." << endmsg;
1502 std::ifstream input(filename.c_str());
1503 if (!input)
1504 {
1505@@ -151,7 +150,7 @@
1506
1507 // Initialize (common part to all analyses)
1508 if (!myAnalysis->PreInitialize(outputname,
1509- cfg_.IsNoEventWeight()))
1510+ &cfg_))
1511 {
1512 ERROR << "problem during the pre-initialization of the analysis called '"
1513 << name << "'" << endmsg;
1514@@ -195,7 +194,7 @@
1515
1516 // Initialize (common part to all filters)
1517 if (!myFilter->PreInitialize(outputname,
1518- cfg_.IsNoEventWeight()))
1519+ &cfg_))
1520 {
1521 ERROR << "problem during the pre-initialization of the filter called '"
1522 << name << "'" << endmsg;
1523@@ -237,7 +236,7 @@
1524 writers_.push_back(myWriter);
1525
1526 // Initializing
1527- if (!myWriter->Initialize(outputname))
1528+ if (!myWriter->Initialize(&cfg_,outputname))
1529 {
1530 ERROR << "problem during the initialization of the writer called '"
1531 << name << "'" << endmsg;
1532@@ -302,6 +301,10 @@
1533 if (progressBar_!=0)
1534 {
1535 progressBar_->Finalize();
1536+ INFO << " => total number of events: " << counter_read_[file_index_-1]
1537+ << " ( analyzed: " << counter_passed_[file_index_-1]
1538+ << " ; skipped: " << counter_read_[file_index_-1] - counter_passed_[file_index_-1]
1539+ << " ) " << endmsg;
1540 }
1541
1542 // Next file
1543
1544=== modified file 'tools/SampleAnalyzer/Core/xdr_istream.cpp'
1545--- tools/SampleAnalyzer/Core/xdr_istream.cpp 2013-05-17 06:19:22 +0000
1546+++ tools/SampleAnalyzer/Core/xdr_istream.cpp 2013-06-13 12:22:26 +0000
1547@@ -115,7 +115,7 @@
1548 {
1549 if (eof()) return (*this);
1550
1551- UInt_t n;
1552+ UInt_t n=0;
1553 (*this)>>n;
1554 Float_t* vp = reinterpret_cast<Float_t*>(&n);
1555 v=*vp;
1556@@ -130,7 +130,7 @@
1557 {
1558 if (eof()) return (*this);
1559
1560- ULong64_t n;
1561+ ULong64_t n=0;
1562 (*this)>>n;
1563 Double_t* vp = reinterpret_cast<Double_t*>(&n);
1564 v=*vp;
1565
1566=== modified file 'tools/SampleAnalyzer/DataFormat/MCParticleFormat.h'
1567--- tools/SampleAnalyzer/DataFormat/MCParticleFormat.h 2013-05-17 06:19:22 +0000
1568+++ tools/SampleAnalyzer/DataFormat/MCParticleFormat.h 2013-06-13 12:22:26 +0000
1569@@ -70,7 +70,8 @@
1570 /// 2 intermediate state, 1 final state)
1571 UInt_t mothup1_; /// first mother index
1572 UInt_t mothup2_; /// second mother index
1573- Int_t extra_;
1574+ Int_t extra1_;
1575+ Int_t extra2_;
1576
1577 std::vector<MCParticleFormat*> Daughters_;
1578
1579@@ -96,7 +97,8 @@
1580 {
1581 momentum_.SetPxPyPzE(0.,0.,0.,0.);
1582 ctau_=0.; spin_=0.; pdgid_=0;
1583- statuscode_=0; mothup1_=0; mothup2_=0; mother1_=0; mother2_=0; extra_=0;
1584+ statuscode_=0; mothup1_=0; mothup2_=0; mother1_=0; mother2_=0;
1585+ extra1_=0; extra2_=0;
1586 }
1587
1588 /// Print particle informations
1589
1590=== modified file 'tools/SampleAnalyzer/DataFormat/RecEventFormat.h'
1591--- tools/SampleAnalyzer/DataFormat/RecEventFormat.h 2013-05-17 06:19:22 +0000
1592+++ tools/SampleAnalyzer/DataFormat/RecEventFormat.h 2013-06-13 12:22:26 +0000
1593@@ -48,6 +48,7 @@
1594 class ROOTReader;
1595 class TauTagger;
1596 class bTagger;
1597+class JetClusteringFastJet;
1598
1599 class RecEventFormat
1600 {
1601@@ -56,6 +57,7 @@
1602 friend class ROOTReader;
1603 friend class TauTagger;
1604 friend class bTagger;
1605+ friend class JetClusteringFastJet;
1606
1607 // -------------------------------------------------------------
1608 // data members
1609@@ -90,19 +92,19 @@
1610 Double_t THT_;
1611
1612 /// Monte Carlo taus decaying hadronically
1613- std::vector<MCParticleFormat*> MCHadronicTaus_;
1614+ std::vector<const MCParticleFormat*> MCHadronicTaus_;
1615
1616 /// Monte Carlo taus decaying into muon
1617- std::vector<MCParticleFormat*> MCMuonicTaus_;
1618+ std::vector<const MCParticleFormat*> MCMuonicTaus_;
1619
1620 /// Monte Carlo taus decaying into electron
1621- std::vector<MCParticleFormat*> MCElectronicTaus_;
1622+ std::vector<const MCParticleFormat*> MCElectronicTaus_;
1623
1624 /// Monte Carlo b-quarks
1625- std::vector<MCParticleFormat*> MCBquarks_;
1626+ std::vector<const MCParticleFormat*> MCBquarks_;
1627
1628 /// Monte Carlo c-quarks
1629- std::vector<MCParticleFormat*> MCCquarks_;
1630+ std::vector<const MCParticleFormat*> MCCquarks_;
1631
1632
1633 // -------------------------------------------------------------
1634@@ -146,23 +148,23 @@
1635 const Double_t& THT() const {return THT_;}
1636
1637 /// Accessor to the Monte Carlo taus decaying hadronically
1638- const std::vector<MCParticleFormat*>& MCHadronicTaus() const
1639+ const std::vector<const MCParticleFormat*>& MCHadronicTaus() const
1640 {return MCHadronicTaus_;}
1641
1642 /// Accessor to Monte Carlo taus decaying into muon
1643- const std::vector<MCParticleFormat*>& MCMuonicTaus() const
1644+ const std::vector<const MCParticleFormat*>& MCMuonicTaus() const
1645 {return MCMuonicTaus_;}
1646
1647 /// Accessor to Monte Carlo taus decaying into electron
1648- const std::vector<MCParticleFormat*>& MCElectronicTaus() const
1649+ const std::vector<const MCParticleFormat*>& MCElectronicTaus() const
1650 {return MCElectronicTaus_;}
1651
1652 /// Accessor to Monte Carlo b-quarks
1653- const std::vector<MCParticleFormat*>& MCBquarks() const
1654+ const std::vector<const MCParticleFormat*>& MCBquarks() const
1655 {return MCBquarks_;}
1656
1657 /// Accessor to Monte Carlo c-quarks
1658- const std::vector<MCParticleFormat*>& MCCquarks() const
1659+ const std::vector<const MCParticleFormat*>& MCCquarks() const
1660 {return MCCquarks_;}
1661
1662 /// Accessor to the electron collection
1663@@ -193,23 +195,23 @@
1664 Double_t& THT() {return THT_;}
1665
1666 /// Accessor to the Monte Carlo taus decaying hadronically
1667- std::vector<MCParticleFormat*>& MCHadronicTaus()
1668+ std::vector<const MCParticleFormat*>& MCHadronicTaus()
1669 {return MCHadronicTaus_;}
1670
1671 /// Accessor to Monte Carlo taus decaying into muon
1672- std::vector<MCParticleFormat*>& MCMuonicTaus()
1673+ std::vector<const MCParticleFormat*>& MCMuonicTaus()
1674 {return MCMuonicTaus_;}
1675
1676 /// Accessor to Monte Carlo taus decaying into electron
1677- std::vector<MCParticleFormat*>& MCElectronicTaus()
1678+ std::vector<const MCParticleFormat*>& MCElectronicTaus()
1679 {return MCElectronicTaus_;}
1680
1681 /// Accessor to Monte Carlo b-quarks
1682- std::vector<MCParticleFormat*>& MCBquarks()
1683+ std::vector<const MCParticleFormat*>& MCBquarks()
1684 {return MCBquarks_;}
1685
1686 /// Accessor to Monte Carlo c-quarks
1687- std::vector<MCParticleFormat*>& MCCquarks()
1688+ std::vector<const MCParticleFormat*>& MCCquarks()
1689 {return MCCquarks_;}
1690
1691 /// Clearing all information
1692
1693=== modified file 'tools/SampleAnalyzer/DataFormat/RecParticleFormat.h'
1694--- tools/SampleAnalyzer/DataFormat/RecParticleFormat.h 2013-05-17 06:19:22 +0000
1695+++ tools/SampleAnalyzer/DataFormat/RecParticleFormat.h 2013-06-13 12:22:26 +0000
1696@@ -53,7 +53,7 @@
1697 protected:
1698
1699 Float_t HEoverEE_; /// hadronic energy over electromagnetic energy
1700- MCParticleFormat* mc_ ; /// mother generated particle
1701+ const MCParticleFormat* mc_ ; /// mother generated particle
1702
1703 // -------------------------------------------------------------
1704 // method members
1705@@ -94,7 +94,7 @@
1706 const MCParticleFormat* mc() const {return mc_;}
1707
1708 /// Mutator relatied to matched Monte Carlo particle
1709- void setMc(MCParticleFormat* mc) {mc_=mc;}
1710+ void setMc(const MCParticleFormat* mc) {mc_=mc;}
1711
1712 /// Accessor to hadronic energy / electromagnetic energy ratio
1713 const Float_t& HEoverEE() const {return HEoverEE_;}
1714
1715=== modified file 'tools/SampleAnalyzer/DataFormat/RecTauFormat.h'
1716--- tools/SampleAnalyzer/DataFormat/RecTauFormat.h 2013-05-17 06:19:22 +0000
1717+++ tools/SampleAnalyzer/DataFormat/RecTauFormat.h 2013-06-13 12:22:26 +0000
1718@@ -98,13 +98,25 @@
1719 const Float_t charge() const
1720 { if (charge_) return +1.; else return -1.; }
1721
1722+ /// Mutator to the electric charge
1723+ void setCharge(Float_t charge )
1724+ { if (charge>0) charge_=true; else charge_=false; }
1725+
1726 /// Accessor to the number of tracks
1727 const UShort_t ntracks() const
1728 { return ntracks_; }
1729
1730+ /// Mutator to the number of tracks
1731+ void setNtracks(UShort_t ntracks)
1732+ { ntracks_=ntracks; }
1733+
1734 /// Accessor to the decay mode
1735 const Int_t DecayMode() const
1736 { return DecayMode_; }
1737+
1738+ /// Mutator to the decay mode
1739+ void setDecayMode(Int_t mode)
1740+ { DecayMode_=mode; }
1741 };
1742
1743 }
1744
1745=== modified file 'tools/SampleAnalyzer/Filter/FilterBase.h'
1746--- tools/SampleAnalyzer/Filter/FilterBase.h 2013-05-17 06:19:22 +0000
1747+++ tools/SampleAnalyzer/Filter/FilterBase.h 2013-06-13 12:22:26 +0000
1748@@ -93,10 +93,10 @@
1749
1750 /// Initialize (common part to all analyses)
1751 bool PreInitialize(const std::string& outputName,
1752- bool weighted_events=false)
1753+ const Configuration* cfg)
1754 {
1755 outputName_ = outputName;
1756- weighted_events_ = weighted_events;
1757+ weighted_events_ = cfg->IsNoEventWeight();
1758 return true;
1759 }
1760
1761
1762=== modified file 'tools/SampleAnalyzer/JetClustering/JetClustererBase.h'
1763--- tools/SampleAnalyzer/JetClustering/JetClustererBase.h 2013-05-17 06:19:22 +0000
1764+++ tools/SampleAnalyzer/JetClustering/JetClustererBase.h 2013-06-13 12:22:26 +0000
1765@@ -55,7 +55,7 @@
1766 /// Is the jet clustering exclusive ?
1767 Bool_t Exclusive_;
1768
1769- /// Exclusive id for tau-elec-jet
1770+ /// Exclusive id for tau-elec-photon-jet
1771 Bool_t ExclusiveId_;
1772
1773 /// Tagger
1774@@ -63,6 +63,12 @@
1775 cTagger* myCtagger_;
1776 TauTagger* myTAUtagger_;
1777
1778+ UInt_t muon;
1779+ UInt_t electron;
1780+ UInt_t tauH;
1781+ UInt_t tauM;
1782+ UInt_t tauE;
1783+ UInt_t photon;
1784
1785 //--------------------------------------------------------------------------
1786 // method members
1787@@ -81,6 +87,12 @@
1788 myBtagger_ = 0;
1789 myCtagger_ = 0;
1790 myTAUtagger_ = 0;
1791+ muon=0;
1792+ electron=0;
1793+ tauH=0;
1794+ tauM=0;
1795+ tauE=0;
1796+ photon=0;
1797 }
1798
1799 /// Destructor
1800
1801=== modified file 'tools/SampleAnalyzer/JetClustering/JetClusteringFastJet.cpp'
1802--- tools/SampleAnalyzer/JetClustering/JetClusteringFastJet.cpp 2013-05-17 06:19:22 +0000
1803+++ tools/SampleAnalyzer/JetClustering/JetClusteringFastJet.cpp 2013-06-13 12:22:26 +0000
1804@@ -27,13 +27,230 @@
1805
1806 using namespace MA5;
1807
1808+
1809+void JetClusteringFastJet::GetFinalState(const MCParticleFormat* part, std::set<const MCParticleFormat*>& finalstates)
1810+{
1811+ for (unsigned int i=0; i<part->Daughters().size(); i++)
1812+ {
1813+ if (PHYSICS->IsFinalState(part->Daughters()[i])) finalstates.insert(part->Daughters()[i]);
1814+ else return GetFinalState(part->Daughters()[i],finalstates);
1815+ }
1816+}
1817+
1818+Bool_t JetClusteringFastJet::IsLast(const MCParticleFormat* part, EventFormat& myEvent)
1819+{
1820+ for (unsigned int i=0; i<part->Daughters().size(); i++)
1821+ {
1822+ if (part->Daughters()[i]->pdgid()==part->pdgid()) return false;
1823+ }
1824+ return true;
1825+}
1826+
1827+
1828+Bool_t JetClusteringFastJet::IrrelevantPhoton(const MCParticleFormat* part)
1829+{
1830+ if (part->mother1()==0) return false;
1831+
1832+ // Checking mother
1833+ UInt_t absid = std::abs(part->mother1()->pdgid());
1834+
1835+ if (absid==15) return true;
1836+ else return IrrelevantPhoton(part->mother1());
1837+}
1838+
1839+Bool_t JetClusteringFastJet::ComingFromHadronDecay(const MCParticleFormat* part)
1840+{
1841+ // Weird case ? Safety: removing this case
1842+ if (part->mother1()==0) return true;
1843+ // std::cout << "part " << part->pdgid() << " <- " << part->mother1()->pdgid() << std::endl;
1844+ // Checking mother
1845+ Bool_t had = PHYSICS->IsHadronic(part->mother1()->pdgid()) && part->mother1()->pdgid()!=21;
1846+ if (had && part->mother1()->mother1()==0) return false;
1847+ else if (had) return true;
1848+ else return ComingFromHadronDecay(part->mother1());
1849+}
1850+
1851+
1852 bool JetClusteringFastJet::Execute(SampleFormat& mySample, EventFormat& myEvent)
1853 {
1854- if (mySample.mc()==0 || myEvent.mc()==0) return false;
1855+ if (mySample.mc()==0 || myEvent.mc()==0) return false;
1856 if (mySample.rec()==0) mySample.InitializeRec();
1857 if (myEvent.rec() ==0) myEvent.InitializeRec();
1858+
1859+ // Reseting the reconstructed event
1860 myEvent.rec()->Reset();
1861
1862+ // Veto
1863+ std::vector<bool> vetos(myEvent.mc()->particles().size(),false);
1864+ std::set<const MCParticleFormat*> vetos2;
1865+
1866+ // Filling the dataformat with electron/muon
1867+ for (unsigned int i=0;i<myEvent.mc()->particles().size();i++)
1868+ {
1869+ const MCParticleFormat& part = myEvent.mc()->particles()[i];
1870+ UInt_t absid = std::abs(part.pdgid());
1871+
1872+ // Rejecting particle with a null pt (initial state ?)
1873+ if (part.pt()<1e-10) continue;
1874+
1875+ // Treating intermediate particles
1876+ if (PHYSICS->IsInterState(part))
1877+ {
1878+ // rejecting not interesting particles
1879+ if (absid!=5 && absid!=4 && absid!=15) continue;
1880+
1881+ // keeping the last particle with the same id in the decay chain
1882+ if (!IsLast(&part, myEvent)) continue;
1883+
1884+ // looking for b quarks
1885+ if (absid==5)
1886+ {
1887+ bool found=false;
1888+ for (unsigned int j=0;j<myEvent.rec()->MCBquarks_.size();j++)
1889+ {
1890+ if (myEvent.rec()->MCBquarks_[j]==&(part))
1891+ {found=true; break;}
1892+ }
1893+ if (!found) myEvent.rec()->MCBquarks_.push_back(&(part));
1894+ }
1895+
1896+ // looking for c quarks
1897+ else if (absid==4)
1898+ {
1899+ bool found=false;
1900+ for (unsigned int j=0;j<myEvent.rec()->MCCquarks_.size();j++)
1901+ {
1902+ if (myEvent.rec()->MCCquarks_[j]==&(part))
1903+ {found=true; break;}
1904+ }
1905+ if (!found) myEvent.rec()->MCCquarks_.push_back(&(part));
1906+ }
1907+
1908+ // looking for taus
1909+ else if (absid==15)
1910+ {
1911+ // rejecting particle if coming from hadronization
1912+ if (ComingFromHadronDecay(&part)) continue;
1913+
1914+ // Looking taus daughters id
1915+ bool leptonic = true;
1916+ bool muonic = false;
1917+ bool electronic = false;
1918+ for (unsigned int j=0;j<part.Daughters().size();j++)
1919+ {
1920+ UInt_t pdgid = std::abs(part.Daughters()[j]->pdgid());
1921+ if (pdgid==13) muonic=true;
1922+ else if (pdgid==11) electronic=true;
1923+ else if (pdgid!=22 /*photons*/ &&
1924+ !(pdgid>=11 && pdgid<=16) /*neutrinos*/)
1925+ leptonic=false;
1926+ }
1927+ if (!leptonic) {muonic=false; electronic=false;}
1928+
1929+ // Saving taus decaying into muons (only one copy)
1930+ if (muonic)
1931+ {
1932+ bool found=false;
1933+ for (unsigned int j=0;j<myEvent.rec()->MCMuonicTaus_.size();j++)
1934+ {
1935+ if (myEvent.rec()->MCMuonicTaus_[j]==&(part))
1936+ {found=true; break;}
1937+ }
1938+ if (!found) myEvent.rec()->MCMuonicTaus_.push_back(&(part));
1939+ }
1940+
1941+ // Saving taus decaying into electrons (only one copy)
1942+ else if (electronic)
1943+ {
1944+ bool found=false;
1945+ for (unsigned int j=0;j<myEvent.rec()->MCElectronicTaus_.size();j++)
1946+ {
1947+ if (myEvent.rec()->MCElectronicTaus_[j]==&(part))
1948+ {found=true; break;}
1949+ }
1950+ if (!found) myEvent.rec()->MCElectronicTaus_.push_back(&(part));
1951+ }
1952+
1953+ // Saving taus decaying into hadrons (only copy)
1954+ else
1955+ {
1956+ bool found=false;
1957+ for (unsigned int j=0;j<myEvent.rec()->MCHadronicTaus_.size();j++)
1958+ {
1959+ if (myEvent.rec()->MCHadronicTaus_[j]==&(part))
1960+ {found=true; break;}
1961+ }
1962+ if (!found)
1963+ {
1964+ // Saving the hadrons in MC container
1965+ myEvent.rec()->MCHadronicTaus_.push_back(&(part));
1966+
1967+ // Applying efficiency
1968+ if (!myTAUtagger_->IsIdentified()) continue;
1969+
1970+ // Creating reco hadronic taus
1971+ RecTauFormat* myTau = myEvent.rec()->GetNewTau();
1972+ if (part.pdgid()>0) myTau->setCharge(-1.);
1973+ else myTau->setCharge(+1.);
1974+ myTau->setMomentum(part.momentum());
1975+ myTau->setMc(&part);
1976+ myTau->setDecayMode(PHYSICS->GetTauDecayMode(myTau->mc()));
1977+ if (myTau->DecayMode()<=0) myTau->setNtracks(0); // ERROR case
1978+ else if (myTau->DecayMode()==7 ||
1979+ myTau->DecayMode()==9) myTau->setNtracks(3); // 3-Prong
1980+ else myTau->setNtracks(1); // 1-Prong
1981+
1982+ // Searching final state
1983+ GetFinalState(&part,vetos2);
1984+ }
1985+ }
1986+ }
1987+ }
1988+
1989+ // Keeping only final states
1990+ else if (PHYSICS->IsFinalState(part))
1991+ {
1992+ // rejecting not interesting particles
1993+ if (absid!=22 && absid!=11 && absid!=13) continue;
1994+
1995+ // rejecting particle if coming from hadronization
1996+ if (ExclusiveId_ && ComingFromHadronDecay(&part)) continue;
1997+
1998+ // Muons
1999+ if (absid==13)
2000+ {
2001+ vetos[i]=true;
2002+ RecLeptonFormat * muon = myEvent.rec()->GetNewMuon();
2003+ muon->setMomentum(part.momentum());
2004+ muon->setMc(&(part));
2005+ if (part.pdgid()==13) muon->SetCharge(-1);
2006+ else muon->SetCharge(+1);
2007+ }
2008+
2009+ // Electrons
2010+ else if (absid==11)
2011+ {
2012+ vetos[i]=true;
2013+ RecLeptonFormat * elec = myEvent.rec()->GetNewElectron();
2014+ elec->setMomentum(part.momentum());
2015+ elec->setMc(&(part));
2016+ if (part.pdgid()==11) elec->SetCharge(-1);
2017+ else elec->SetCharge(+1);
2018+ }
2019+
2020+ // Photons
2021+ else if (absid==22)
2022+ {
2023+ if (IrrelevantPhoton(&part)) continue;
2024+ vetos[i]=true;
2025+ RecPhotonFormat * photon = myEvent.rec()->GetNewPhoton();
2026+ photon->setMomentum(part.momentum());
2027+ photon->setMc(&(part));
2028+ }
2029+ }
2030+
2031+ }
2032+
2033 double & TET = myEvent.rec()->TET();
2034 double & THT = myEvent.rec()->THT();
2035
2036@@ -41,10 +258,21 @@
2037 std::vector<fastjet::PseudoJet> inputs;
2038 for (unsigned int i=0;i<myEvent.mc()->particles().size();i++)
2039 {
2040+ const MCParticleFormat& part = myEvent.mc()->particles()[i];
2041+
2042 // Selecting input for jet clustering
2043 if (myEvent.mc()->particles()[i].statuscode()!=1) continue;
2044 if (PHYSICS->IsInvisible(myEvent.mc()->particles()[i])) continue;
2045- if (fabs(myEvent.mc()->particles()[i].pdgid())==13) continue;
2046+
2047+ // ExclusiveId mode
2048+ if (ExclusiveId_)
2049+ {
2050+ if (vetos[i]) continue;
2051+ if (vetos2.find(&part)!=vetos2.end()) continue;
2052+ }
2053+
2054+ // NonExclusive Id mode
2055+ else if (std::abs(myEvent.mc()->particles()[i].pdgid())==13) continue;
2056
2057 // Filling good particle for clustering
2058 inputs.push_back(
2059@@ -90,40 +318,35 @@
2060 for (unsigned int j=0;j<constituents.size();j++)
2061 {
2062 jet->AddConstituent(constituents[j].user_index());
2063- // if (fabs(myEvent.mc()->particles()[constituents[j].user_index()].pdgid())==11) continue;
2064+ // if (std::abs(myEvent.mc()->particles()[constituents[j].user_index()].pdgid())==11) continue;
2065 if (PDG->IsCharged(myEvent.mc()->particles()[constituents[j].user_index()].pdgid())) tracks++;
2066 }
2067 jet->ntracks_ = tracks;
2068 }
2069
2070- // Filling the dataformat with electron/muon
2071- for (unsigned int i=0;i<myEvent.mc()->particles().size();i++)
2072+
2073+ if (ExclusiveId_)
2074 {
2075- if (myEvent.mc()->particles()[i].statuscode()!=1) continue;
2076- if (fabs(myEvent.mc()->particles()[i].pdgid())==13)
2077- {
2078- RecLeptonFormat * muon = myEvent.rec()->GetNewMuon();
2079- muon->setMomentum(myEvent.mc()->particles()[i].momentum());
2080- muon->setMc(&(myEvent.mc()->particles()[i]));
2081- if (myEvent.mc()->particles()[i].pdgid()==13) muon->SetCharge(-1);
2082- else muon->SetCharge(+1);
2083- }
2084- else if (fabs(myEvent.mc()->particles()[i].pdgid())==11)
2085- {
2086- RecLeptonFormat * elec = myEvent.rec()->GetNewElectron();
2087- elec->setMomentum(myEvent.mc()->particles()[i].momentum());
2088- elec->setMc(&(myEvent.mc()->particles()[i]));
2089- if (myEvent.mc()->particles()[i].pdgid()==11) elec->SetCharge(-1);
2090- else elec->SetCharge(+1);
2091+ for (unsigned int i=0;i<myEvent.rec()->electrons().size();i++)
2092+ {
2093+ (*MET) -= myEvent.rec()->electrons()[i].momentum();
2094+ TET += myEvent.rec()->electrons()[i].pt();
2095+ }
2096+ for (unsigned int i=0;i<myEvent.rec()->photons().size();i++)
2097+ {
2098+ (*MET) -= myEvent.rec()->photons()[i].momentum();
2099+ TET += myEvent.rec()->photons()[i].pt();
2100+ }
2101+ for (unsigned int i=0;i<myEvent.rec()->taus().size();i++)
2102+ {
2103+ (*MET) -= myEvent.rec()->taus()[i].momentum();
2104+ TET += myEvent.rec()->taus()[i].pt();
2105 }
2106 }
2107
2108-
2109 for (unsigned int i=0;i<myEvent.rec()->muons().size();i++)
2110 {
2111 (*MET) -= myEvent.rec()->muons()[i].momentum();
2112- // MET->momentum().SetPx(MET->momentum().Px() - myEvent.rec()->muons()[i].px());
2113- // MET->momentum().SetPy(MET->momentum().Py() - myEvent.rec()->muons()[i].py());
2114 TET += myEvent.rec()->muons()[i].pt();
2115 }
2116
2117
2118=== modified file 'tools/SampleAnalyzer/JetClustering/JetClusteringFastJet.h'
2119--- tools/SampleAnalyzer/JetClustering/JetClusteringFastJet.h 2013-05-17 06:19:22 +0000
2120+++ tools/SampleAnalyzer/JetClustering/JetClusteringFastJet.h 2013-06-13 12:22:26 +0000
2121@@ -55,6 +55,7 @@
2122 /// Jet definition
2123 fastjet::JetDefinition JetDefinition_;
2124
2125+
2126 //---------------------------------------------------------------------------------
2127 // method members
2128 //---------------------------------------------------------------------------------
2129@@ -74,6 +75,13 @@
2130 /// Initialization
2131 virtual bool Initialize(const std::map<std::string,std::string>& options)=0;
2132
2133+ private:
2134+ Bool_t IsLast(const MCParticleFormat* part, EventFormat& myEvent);
2135+ Bool_t ComingFromHadronDecay(const MCParticleFormat* part);
2136+ Bool_t IrrelevantPhoton(const MCParticleFormat* part);
2137+ void GetFinalState(const MCParticleFormat* part, std::set<const MCParticleFormat*>& finalstates);
2138+
2139+
2140 };
2141
2142 }
2143
2144=== modified file 'tools/SampleAnalyzer/JetClustering/TaggerBase.cpp'
2145--- tools/SampleAnalyzer/JetClustering/TaggerBase.cpp 2013-05-17 06:19:22 +0000
2146+++ tools/SampleAnalyzer/JetClustering/TaggerBase.cpp 2013-06-13 12:22:26 +0000
2147@@ -35,6 +35,8 @@
2148 }
2149
2150
2151+
2152+
2153 void TaggerBase::SetParameter(const std::string& key,
2154 const std::string& value,
2155 std::string header)
2156
2157=== modified file 'tools/SampleAnalyzer/JetClustering/TaggerBase.h'
2158--- tools/SampleAnalyzer/JetClustering/TaggerBase.h 2013-05-17 06:19:22 +0000
2159+++ tools/SampleAnalyzer/JetClustering/TaggerBase.h 2013-06-13 12:22:26 +0000
2160@@ -79,7 +79,7 @@
2161 }
2162
2163 /// Destructor
2164- ~TaggerBase()
2165+ virtual ~TaggerBase()
2166 {}
2167
2168 /// Matching using dr
2169
2170=== modified file 'tools/SampleAnalyzer/JetClustering/TauTagger.cpp'
2171--- tools/SampleAnalyzer/JetClustering/TauTagger.cpp 2013-05-17 06:19:22 +0000
2172+++ tools/SampleAnalyzer/JetClustering/TauTagger.cpp 2013-06-13 12:22:26 +0000
2173@@ -28,116 +28,10 @@
2174
2175 void TauTagger::Method1 (SampleFormat& mySample, EventFormat& myEvent)
2176 {
2177- // loop on the particles searching for tau
2178- for (unsigned int i=0;i<myEvent.mc()->particles().size();i++)
2179- {
2180- // Keeping only taus
2181- if (fabs(myEvent.mc()->particles()[i].pdgid())!=15) continue;
2182-
2183- // Removing initial states
2184- if (PHYSICS->IsInitialState(myEvent.mc()->particles()[i])) continue;
2185-
2186- // Removing final states
2187- if (PHYSICS->IsFinalState(myEvent.mc()->particles()[i])) continue;
2188-
2189- // Keeping the last taus in the decay chain
2190- if (!IsLast(&myEvent.mc()->particles()[i], myEvent)) continue;
2191-
2192- // Removing taus decaying to leptons
2193- bool leptonic=true;
2194- bool muonic=false;
2195- bool electronic=false;
2196- for (unsigned int j=0;j<myEvent.mc()->particles()[i].Daughters().size();j++)
2197- {
2198- unsigned int pdgid =
2199- std::abs(myEvent.mc()->particles()[i].Daughters()[j]->pdgid());
2200- if (pdgid==13) muonic=true;
2201- else if (pdgid==11) electronic=true;
2202- if (pdgid!=22 && !(pdgid>=11 && pdgid<=18)) {leptonic=false;}
2203- }
2204- if (leptonic && muonic)
2205- {
2206- bool found=false;
2207- for (unsigned int j=0;j<myEvent.rec()->MCMuonicTaus_.size();j++)
2208- {
2209- if (myEvent.rec()->MCMuonicTaus_[j]==&(myEvent.mc()->particles()[i]))
2210- {found=true; break;}
2211- }
2212- if (!found)
2213- myEvent.rec()->MCMuonicTaus_.push_back(&(myEvent.mc()->particles()[i]));
2214- }
2215- else if (leptonic && electronic)
2216- {
2217- bool found=false;
2218- for (unsigned int j=0;j<myEvent.rec()->MCElectronicTaus_.size();j++)
2219- {
2220- if (myEvent.rec()->MCElectronicTaus_[j]==&(myEvent.mc()->particles()[i]))
2221- {found=true; break;}
2222- }
2223- if (!found)
2224- myEvent.rec()->MCElectronicTaus_.push_back(&(myEvent.mc()->particles()[i]));
2225- }
2226- else if (!leptonic)
2227- {
2228- bool found=false;
2229- for (unsigned int j=0;j<myEvent.rec()->MCHadronicTaus_.size();j++)
2230- {
2231- if (myEvent.rec()->MCHadronicTaus_[j]==&(myEvent.mc()->particles()[i]))
2232- {found=true; break;}
2233- }
2234- if (!found)
2235- myEvent.rec()->MCHadronicTaus_.push_back(&(myEvent.mc()->particles()[i]));
2236-
2237- }
2238- }
2239-
2240- // Matching MCtaus and RECtaus
2241- std::vector<std::pair<RecJetFormat*,MCParticleFormat*> > Candidates;
2242- for (unsigned int i=0;i<myEvent.rec()->MCHadronicTaus_.size();i++)
2243- {
2244- RecJetFormat* tag = 0;
2245- Double_t DeltaRmax = DeltaRmax_;
2246-
2247- // loop on the jets
2248- for (unsigned int j=0;j<myEvent.rec()->jets().size();j++)
2249- {
2250- // if (myEvent.rec()->jets()[j].ntracks()!=1 &&
2251- // myEvent.rec()->jets()[j].ntracks()!=3) continue;
2252-
2253- // Calculating Delta R
2254- Float_t DeltaR =
2255- myEvent.rec()->MCHadronicTaus_[i]->dr(myEvent.rec()->jets()[j]);
2256-
2257- if (DeltaR <= DeltaRmax)
2258- {
2259- if(Exclusive_)
2260- {
2261- tag = &(myEvent.rec()->jets()[j]);
2262- DeltaRmax = DeltaR;
2263- }
2264- else Candidates.push_back(
2265- std::make_pair(& myEvent.rec()->jets()[j],
2266- myEvent.rec()->MCHadronicTaus_[i]) );
2267- }
2268- }
2269- if (Exclusive_ && tag!=0)
2270- Candidates.push_back(std::make_pair(tag,
2271- myEvent.rec()->MCHadronicTaus_[i]));
2272- }
2273-
2274- // Performing efficiency
2275- for (unsigned int i=0;i<Candidates.size();i++)
2276- {
2277- if (!IsIdentified()) continue;
2278- Candidates[i].first->mc_ = Candidates[i].second;
2279- RecTauFormat* myTau = myEvent.rec()->GetNewTau();
2280- Jet2Tau(Candidates[i].first, myTau, myEvent);
2281- // myEvent.rec()->jets().erase((std::vector<RecJetFormat>::iterator) Candidates[j-1]);
2282- }
2283-
2284 // Performing mis-id
2285 if (doMisefficiency_)
2286 {
2287+ std::vector<unsigned int> toRemove;
2288 for (unsigned int i=0;i<myEvent.rec()->jets().size();i++)
2289 {
2290 // keeping only light jets
2291@@ -149,8 +43,14 @@
2292 {
2293 RecTauFormat* myTau = myEvent.rec()->GetNewTau();
2294 Jet2Tau(&myEvent.rec()->jets()[i], myTau, myEvent);
2295+ toRemove.push_back(i);
2296 }
2297 }
2298+ for (unsigned int i =0;i<toRemove.size();i++)
2299+ {
2300+ myEvent.rec()->jets().erase(myEvent.rec()->jets().begin()
2301+ + toRemove[i]);
2302+ }
2303 }
2304
2305 }
2306@@ -338,8 +238,8 @@
2307 charge += PDG->GetCharge(myEvent.mc()->particles()[myJet->Constituents_[i]].pdgid());
2308 }
2309
2310- if (charge == 3) myTau->charge_ = true;
2311- else if (charge == -3) myTau->charge_ = false;
2312+ if (charge>0) myTau->charge_ = true;
2313+ else if (charge<=0) myTau->charge_ = false;
2314 }
2315
2316
2317@@ -378,8 +278,6 @@
2318 std::string TauTagger::GetParameters()
2319 {
2320 std::stringstream str;
2321- str << "dR=" << DeltaRmax_ << " ; ";
2322- if (Exclusive_) str << "Exclusive ; "; else str << "Inclusive ; ";
2323 str << "IDeff=" << Efficiency_;
2324 str << " ; MisID(q)=" << misid_ljet_;
2325 return str.str();
2326
2327=== modified file 'tools/SampleAnalyzer/JetClustering/TauTagger.h'
2328--- tools/SampleAnalyzer/JetClustering/TauTagger.h 2013-05-17 06:19:22 +0000
2329+++ tools/SampleAnalyzer/JetClustering/TauTagger.h 2013-06-13 12:22:26 +0000
2330@@ -27,7 +27,7 @@
2331
2332 //SampleAnalyser headers
2333 #include "SampleAnalyzer/JetClustering/TaggerBase.h"
2334-
2335+#include <TH1F.h>
2336
2337 namespace MA5
2338 {
2339@@ -44,7 +44,7 @@
2340
2341 /// Apply misefficiency
2342 Bool_t doMisefficiency_;
2343-
2344+ // TH1F* htest;
2345
2346 //---------------------------------------------------------------------------------
2347 // method members
2348@@ -56,10 +56,12 @@
2349 {
2350 misid_ljet_=0.0;
2351 doMisefficiency_=false;
2352+ // htest = new TH1F("eric","eric",10,0,10);
2353 }
2354
2355 /// Destructor
2356- ~TauTagger () { }
2357+ virtual ~TauTagger ()
2358+ { /*htest->SaveAs("Alloul.root");*/ }
2359
2360 /// Matching using dr
2361 virtual void Method1 (SampleFormat& mySample, EventFormat& myEvent);
2362
2363=== modified file 'tools/SampleAnalyzer/JetClustering/bTagger.cpp'
2364--- tools/SampleAnalyzer/JetClustering/bTagger.cpp 2013-05-17 06:19:22 +0000
2365+++ tools/SampleAnalyzer/JetClustering/bTagger.cpp 2013-06-13 12:22:26 +0000
2366@@ -29,49 +29,6 @@
2367 {
2368 std::vector<RecJetFormat*> Candidates;
2369
2370- // loop on the particles searching for b
2371- for (unsigned int i=0;i<myEvent.mc()->particles().size();i++)
2372- {
2373- // Keeping only b-quark
2374- if (std::abs(myEvent.mc()->particles()[i].pdgid())!=5 &&
2375- std::abs(myEvent.mc()->particles()[i].pdgid())!=4) continue;
2376-
2377- // Removing initial states
2378- if (PHYSICS->IsInitialState(myEvent.mc()->particles()[i])) continue;
2379-
2380- // Removing final states
2381- if (PHYSICS->IsFinalState(myEvent.mc()->particles()[i])) continue;
2382-
2383- // Keeping the last taus in the decay chain
2384- if (!IsLast(&myEvent.mc()->particles()[i], myEvent)) continue;
2385-
2386- // b-quark already defined ?
2387- if (std::abs(myEvent.mc()->particles()[i].pdgid())==5)
2388- {
2389- bool found=false;
2390- for (unsigned int j=0;j<myEvent.rec()->MCBquarks_.size();j++)
2391- {
2392- if (myEvent.rec()->MCBquarks_[j]==&(myEvent.mc()->particles()[i]))
2393- {found=true; break;}
2394- }
2395- if (!found)
2396- myEvent.rec()->MCBquarks_.push_back(&(myEvent.mc()->particles()[i]));
2397- }
2398-
2399- // c-quark already defined ?
2400- else if (std::abs(myEvent.mc()->particles()[i].pdgid())==4)
2401- {
2402- bool found=false;
2403- for (unsigned int j=0;j<myEvent.rec()->MCCquarks_.size();j++)
2404- {
2405- if (myEvent.rec()->MCCquarks_[j]==&(myEvent.mc()->particles()[i]))
2406- {found=true; break;}
2407- }
2408- if (!found)
2409- myEvent.rec()->MCCquarks_.push_back(&(myEvent.mc()->particles()[i]));
2410- }
2411- }
2412-
2413 // Matching b-quarks to jets
2414 for (unsigned int i=0;i<myEvent.rec()->MCBquarks_.size();i++)
2415 {
2416@@ -81,6 +38,7 @@
2417 // loop on the jets
2418 for (unsigned int j=0;j<myEvent.rec()->jets().size();j++)
2419 {
2420+ if (myEvent.rec()->jets()[j].pt()<1e-10) continue;
2421 Float_t DeltaR = myEvent.rec()->MCBquarks_[i]->dr(myEvent.rec()->jets()[j]);
2422
2423 if (DeltaR <= DeltaRmax)
2424@@ -112,6 +70,8 @@
2425 // loop on the jets
2426 for (unsigned int j=0;j<myEvent.rec()->jets().size();j++)
2427 {
2428+ if (myEvent.rec()->jets()[j].pt()<1e-10) continue;
2429+
2430 Float_t DeltaR =
2431 myEvent.rec()->MCCquarks_[i]->dr(myEvent.rec()->jets()[j]);
2432
2433
2434=== modified file 'tools/SampleAnalyzer/JetClustering/bTagger.h'
2435--- tools/SampleAnalyzer/JetClustering/bTagger.h 2013-05-17 06:19:22 +0000
2436+++ tools/SampleAnalyzer/JetClustering/bTagger.h 2013-06-13 12:22:26 +0000
2437@@ -62,7 +62,7 @@
2438 }
2439
2440 /// Destructor
2441- ~bTagger() {}
2442+ virtual ~bTagger() {}
2443
2444 /// Matching using dr
2445 virtual void Method1 (SampleFormat& mySample, EventFormat& myEvent);
2446
2447=== modified file 'tools/SampleAnalyzer/JetClustering/cTagger.h'
2448--- tools/SampleAnalyzer/JetClustering/cTagger.h 2013-05-17 06:19:22 +0000
2449+++ tools/SampleAnalyzer/JetClustering/cTagger.h 2013-06-13 12:22:26 +0000
2450@@ -45,7 +45,7 @@
2451 cTagger() {}
2452
2453 /// Destructor
2454- ~cTagger () {}
2455+ virtual ~cTagger () {}
2456
2457 /// Matching using dr
2458 virtual void Method1 (SampleFormat& mySample, EventFormat& myEvent);
2459
2460=== removed file 'tools/SampleAnalyzer/Makefile'
2461--- tools/SampleAnalyzer/Makefile 2013-04-19 17:21:55 +0000
2462+++ tools/SampleAnalyzer/Makefile 1970-01-01 00:00:00 +0000
2463@@ -1,89 +0,0 @@
2464-################################################################################
2465-# MAKEFILE DEVOTED TO SAMPLE ANALYZER LIBRARY #
2466-################################################################################
2467-
2468-# Compilators
2469-GCC = g++
2470-
2471-# Options for compilation
2472-CXXFASTJET = $(shell fastjet-config --cxxflags --plugins)
2473-CXXFLAGS = -Wall -O3 $(shell root-config --cflags) -I./../ -DZIP_USE -DFASTJET_USE $(CXXFASTJET)
2474-
2475-# Files
2476-SRCS = $(wildcard */*.cpp)
2477-HDRS = $(wildcard */*.h)
2478-OBJS = $(SRCS:.cpp=.o)
2479-
2480-# Name of the library
2481-PROGRAM = SampleAnalyzer
2482-
2483-# Defining colours
2484-GREEN = "\\033[1;32m"
2485-RED = "\\033[1;31m"
2486-PINK = "\\033[1;35m"
2487-BLUE = "\\033[1;34m"
2488-YELLOW = "\\033[1;33m"
2489-CYAN = "\\033[1;36m"
2490-NORMAL = "\\033[0;39m"
2491-
2492-# All target
2493-all: header compile_header compile link_header link
2494-
2495-# Header target
2496-header:
2497- @echo -e $(YELLOW)"--------------------------------------------------"
2498- @echo -e " Building SampleAnalyzer library "
2499- @echo -e "--------------------------------------------------"$(NORMAL)
2500-
2501-# Compile_header target
2502-compile_header:
2503- @echo -e $(YELLOW)"--------------------------------------------------"
2504- @echo -e " Compilation "
2505- @echo -e "--------------------------------------------------"$(NORMAL)
2506-
2507-# Link_header target
2508-link_header:
2509- @echo -e $(YELLOW)"--------------------------------------------------"
2510- @echo -e " Final linking "
2511- @echo -e "--------------------------------------------------"$(NORMAL)
2512-
2513-# clean_header target
2514-clean_header:
2515- @echo -e $(YELLOW)"--------------------------------------------------"
2516- @echo -e " Removing intermediate files from building "
2517- @echo -e "--------------------------------------------------"$(NORMAL)
2518-
2519-# mrproper_header target
2520-mrproper_header:
2521- @echo -e $(YELLOW)"--------------------------------------------------"
2522- @echo -e " Cleaning all the project "
2523- @echo -e "--------------------------------------------------"$(NORMAL)
2524-
2525-# Precompile target
2526-precompile:
2527-
2528-# Compile target
2529-compile: precompile $(OBJS)
2530-
2531-# Link target
2532-link: $(OBJS)
2533- ar -ruc Lib/lib$(PROGRAM).a $(OBJS)
2534-
2535-# Phony target
2536-.PHONY: do_clean header compile_header link_header
2537-
2538-# Clean target
2539-clean: clean_header do_clean
2540-
2541-# Do clean target
2542-do_clean:
2543- @rm -f $(OBJS) Reader/FACdict.*
2544-
2545-# Mr Proper target
2546-mrproper: mrproper_header do_mrproper
2547-
2548-# Do Mr Proper target
2549-do_mrproper: do_clean
2550- @rm -f Lib/lib$(PROGRAM).a
2551- @rm -f compilation.log linking.log cleanup.log *~ */*~
2552-
2553
2554=== modified file 'tools/SampleAnalyzer/Reader/HEPMCReader.cpp'
2555--- tools/SampleAnalyzer/Reader/HEPMCReader.cpp 2013-05-17 06:19:22 +0000
2556+++ tools/SampleAnalyzer/Reader/HEPMCReader.cpp 2013-06-13 12:22:26 +0000
2557@@ -133,6 +133,7 @@
2558 }
2559
2560
2561+
2562 // -----------------------------------------------------------------------------
2563 // FinalizeEvent
2564 // -----------------------------------------------------------------------------
2565@@ -150,11 +151,39 @@
2566 mySample.mc()->set_xsection(value);
2567 mySample.mc()->set_xsection_error(err_value);
2568
2569- // Mother pointer assignment
2570+ // Computing met, mht, ...
2571 for (unsigned int i=0; i<myEvent.mc()->particles_.size();i++)
2572 {
2573 MCParticleFormat& part = myEvent.mc()->particles_[i];
2574
2575+ // Setting mother
2576+ if (part.extra1_!=part.extra2_)
2577+ {
2578+ unsigned int nmother=0;
2579+ for (unsigned int j=0; j < myEvent.mc()->particles_.size();j++)
2580+ {
2581+ if (i==j) continue;
2582+ if (part.extra1_ == myEvent.mc()->particles_[j].extra2_)
2583+ {
2584+ // set daughter
2585+ myEvent.mc()->particles_[j].Daughters_.push_back(&part);
2586+
2587+ // set mother
2588+ nmother++;
2589+ if (nmother==1) part.mother1_=&(myEvent.mc()->particles()[j]);
2590+ else if (nmother==2) part.mother2_=&(myEvent.mc()->particles()[j]);
2591+ else
2592+ {
2593+ if (warnmother_)
2594+ {
2595+ WARNING << "Number of mothers greather than 2 : " << nmother << endmsg;
2596+ warnmother_=false;
2597+ }
2598+ }
2599+ }
2600+ }
2601+ }
2602+
2603 // MET, MHT, TET, THT
2604 if (part.statuscode()==1 && !PHYSICS->IsInvisible(part))
2605 {
2606@@ -410,12 +439,12 @@
2607 // FillEventParticleLine
2608 // -----------------------------------------------------------------------------
2609 void HEPMCReader::FillEventParticleLine(const std::string& line,
2610- EventFormat& myEvent)
2611+ EventFormat& myEvent)
2612 {
2613 std::stringstream str;
2614 str << line;
2615
2616- double tmp; // temporary variable to fill in LorentzVector
2617+ double tmp; // temporary variable to fill in LorentzVector
2618
2619 // Get a new particle
2620 MCParticleFormat * part = myEvent.mc()->GetNewParticle();
2621@@ -432,9 +461,8 @@
2622 str >> part->statuscode_;
2623 str >> tmp;
2624 str >> tmp;
2625- str >> part->extra_;
2626-
2627- SetMother(part, myEvent);
2628+ str >> part->extra2_;
2629+ part->extra1_=current_vertex_.barcode_;
2630 }
2631
2632 // -----------------------------------------------------------------------------
2633@@ -460,19 +488,45 @@
2634 //--------------------------------------------------------------------------
2635 // SetMother
2636 //--------------------------------------------------------------------------
2637-void HEPMCReader::SetMother(MCParticleFormat* part, EventFormat& myEvent)
2638+void HEPMCReader::SetMother(MCParticleFormat* const part, EventFormat& myEvent)
2639 {
2640+ /* std::cout << current_vertex_.barcode_ << std::endl;
2641+
2642+ // No history
2643 if (myEvent.mc()->particles().size()==0) return;
2644-
2645+
2646+ //ERIC orphan special treatment
2647+ if (part->extra_==current_vertex_.barcode_) return;
2648+
2649+ std::cout << "---------------------------------------------" << std::endl;
2650+ for (unsigned int i=0;i<myEvent.mc()->particles().size();i++)
2651+ {
2652+ std::cout << "i=" << i << "\t" << myEvent.mc()->particles()[i].pdgid() << " from ";
2653+ if (myEvent.mc()->particles()[i].mother1()!=0) std::cout << myEvent.mc()->particles()[i].mother1()->pdgid();
2654+ std::cout << " extra=" << myEvent.mc()->particles()[i].extra_ << " current=" << current_vertex_.barcode_ << std::endl;
2655+ std::cout << std::endl;
2656+ }
2657+
2658+
2659 unsigned int nmother=0;
2660- for (unsigned int i =0; i<(myEvent.mc()->particles().size()-1);i++)
2661+ for (unsigned int i=0;i<(myEvent.mc()->particles().size()-1);i++)
2662 {
2663 if(myEvent.mc()->particles()[i].extra_==current_vertex_.barcode_)
2664 {
2665 nmother++;
2666- if(nmother==1) part->mother1_=&(myEvent.mc()->particles()[i]);
2667- else if(nmother==2) part->mother2_=&(myEvent.mc()->particles()[i]);
2668- else { if (warnmother_) {WARNING << "Number of mothers greather than 2 : " << nmother << endmsg; warnmother_=false;} }
2669+ if (nmother==1) part->mother1_=&(myEvent.mc()->particles()[i]);
2670+ else if (nmother==2) part->mother2_=&(myEvent.mc()->particles()[i]);
2671+ else
2672+ {
2673+ if (warnmother_)
2674+ {
2675+ WARNING << "Number of mothers greather than 2 : " << nmother << endmsg;
2676+ warnmother_=false;
2677+ }
2678+ }
2679 }
2680 }
2681+
2682+ if (part->pdgid()==-24) {std::cout << "MMMMHHH" << std::endl; ComingFromHadronDecay(part); }
2683+ */
2684 }
2685
2686=== modified file 'tools/SampleAnalyzer/Reader/HEPMCReader.h'
2687--- tools/SampleAnalyzer/Reader/HEPMCReader.h 2013-05-17 06:19:22 +0000
2688+++ tools/SampleAnalyzer/Reader/HEPMCReader.h 2013-06-13 12:22:26 +0000
2689@@ -96,7 +96,7 @@
2690 void FillEventPDFInfo(const std::string& line, SampleFormat& mySample, EventFormat& myEvent);
2691 void FillEventParticleLine(const std::string& line, EventFormat& myEvent);
2692 void FillEventVertexLine(const std::string& line, EventFormat& myEvent);
2693- void SetMother(MCParticleFormat* part, EventFormat& myEvent);
2694+ void SetMother(MCParticleFormat* const part, EventFormat& myEvent);
2695 Bool_t FillWeightNames(const std::string& line);
2696 Bool_t FillHeavyIons(const std::string& line);
2697
2698
2699=== modified file 'tools/SampleAnalyzer/Reader/LHCOReader.cpp'
2700--- tools/SampleAnalyzer/Reader/LHCOReader.cpp 2013-05-17 07:13:44 +0000
2701+++ tools/SampleAnalyzer/Reader/LHCOReader.cpp 2013-06-13 12:22:26 +0000
2702@@ -65,49 +65,49 @@
2703
2704 bool EndOfLoop = false;
2705
2706-// Declarging a new string for line
2707+ // Declarging a new string for line
2708 std::string line;
2709 std::string tmp;
2710
2711 do
2712- {
2713- std::stringstream str;
2714- str.str("");
2715-
2716-
2717- if (!ReadLine(line))
2718- {
2719- EndOfFile_=true;
2720- return StatusCode::KEEP;
2721- }
2722- str << line;
2723- str >> tmp;
2724-
2725- if (saved_)
2726- {
2727- FillEventInitLine(savedline_,myEvent);
2728- saved_=false;
2729- }
2730-
2731- if(tmp=="0")
2732- {
2733- if(firstevent_ )
2734+ {
2735+ std::stringstream str;
2736+ str.str("");
2737+
2738+ if (!ReadLine(line))
2739+ {
2740+ EndOfFile_=true;
2741+ return StatusCode::KEEP;
2742+ }
2743+ str << line;
2744+ str >> tmp;
2745+
2746+ if (saved_)
2747+ {
2748+ FillEventInitLine(savedline_,myEvent);
2749+ saved_=false;
2750+ }
2751+
2752+ if(tmp=="0")
2753+ {
2754+ if(firstevent_ )
2755 {
2756 FillEventInitLine(line,myEvent);
2757+ firstevent_=false;
2758+ continue;
2759 }
2760- else
2761+ else
2762 {
2763 EndOfLoop = true;
2764 savedline_=line;
2765 saved_=true;
2766 continue;
2767 }
2768- }
2769+ }
2770
2771- FillEventParticleLine(line,myEvent);
2772+ FillEventParticleLine(line,myEvent);
2773
2774- firstevent_=false;
2775- }
2776+ }
2777 while(!EndOfLoop);
2778
2779 // Normal end
2780@@ -280,6 +280,7 @@
2781 // 9th column : isolation
2782 str >> tmp;
2783 muon->sumPT_isol_=std::floor(tmp);
2784+
2785 Float_t ET_PT=tmp-muon->sumPT_isol_;
2786 Bool_t test=false;
2787 for (unsigned int j=0;j<5;j++)
2788@@ -291,7 +292,7 @@
2789 break;
2790 }
2791 }
2792- if (test) muon->sumET_isol_=std::floor(ET_PT)*muon->sumPT_isol_;
2793+ if (test) muon->sumET_isol_=std::floor(ET_PT)*muon->pt();
2794 else muon->sumET_isol_=0;
2795 }
2796
2797
2798=== modified file 'tools/SampleAnalyzer/Reader/ReaderTextBase.cpp'
2799--- tools/SampleAnalyzer/Reader/ReaderTextBase.cpp 2013-05-17 06:19:22 +0000
2800+++ tools/SampleAnalyzer/Reader/ReaderTextBase.cpp 2013-06-13 12:22:26 +0000
2801@@ -233,6 +233,8 @@
2802 Long64_t ReaderTextBase::GetPosition()
2803 {
2804 if (input_==0) return 0;
2805+#ifdef ZIP_USE
2806 if (compress_) return gzinput_->tellg();
2807+#endif
2808 else return input_->tellg();
2809 }
2810
2811=== added file 'tools/SampleAnalyzer/Service/CompilationService.h'
2812--- tools/SampleAnalyzer/Service/CompilationService.h 1970-01-01 00:00:00 +0000
2813+++ tools/SampleAnalyzer/Service/CompilationService.h 2013-06-13 12:22:26 +0000
2814@@ -0,0 +1,30 @@
2815+////////////////////////////////////////////////////////////////////////////////
2816+//
2817+// Copyright (C) 2012-2013 Eric Conte, Benjamin Fuks
2818+// The MadAnalysis development team, email: <ma5team@iphc.cnrs.fr>
2819+//
2820+// This file is part of MadAnalysis 5.
2821+// Official website: <https://launchpad.net/madanalysis5>
2822+//
2823+// MadAnalysis 5 is free software: you can redistribute it and/or modify
2824+// it under the terms of the GNU General Public License as published by
2825+// the Free Software Foundation, either version 3 of the License, or
2826+// (at your option) any later version.
2827+//
2828+// MadAnalysis 5 is distributed in the hope that it will be useful,
2829+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2830+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2831+// GNU General Public License for more details.
2832+//
2833+// You should have received a copy of the GNU General Public License
2834+// along with MadAnalysis 5. If not, see <http://www.gnu.org/licenses/>
2835+//
2836+////////////////////////////////////////////////////////////////////////////////
2837+
2838+
2839+#ifndef TIMER_SERVICE_H
2840+#define TIMER_SERVICE_H
2841+
2842+#define UNUSED(expr) do {(void)(expr);} while(0);
2843+
2844+#endif
2845
2846=== modified file 'tools/SampleAnalyzer/Service/Physics.h'
2847--- tools/SampleAnalyzer/Service/Physics.h 2013-05-17 06:19:22 +0000
2848+++ tools/SampleAnalyzer/Service/Physics.h 2013-06-13 12:22:26 +0000
2849@@ -132,7 +132,8 @@
2850 /// Is Initial State
2851 Bool_t IsInitialState(const MCParticleFormat& part) const
2852 {
2853- return (part.statuscode()==initialstate_);
2854+ // return (part.statuscode()==initialstate_);
2855+ return (part.statuscode()==-1 || (part.statuscode()>=11 && part.statuscode()<=19));
2856 }
2857
2858 /// Is Final State
2859@@ -144,7 +145,7 @@
2860 /// Is Inter State
2861 Bool_t IsInterState(const MCParticleFormat& part) const
2862 {
2863- return (part.statuscode()!=finalstate_ && part.statuscode()!=initialstate_);
2864+ return (!IsInitialState(part) && !IsFinalState(part));
2865 }
2866
2867 /// Is Initial State
2868@@ -225,6 +226,13 @@
2869 if (found==mcConfig_.hadronic_ids_.end()) return false; else return true;
2870 }
2871
2872+ /// Is hadronic ?
2873+ inline bool IsHadronic(Int_t pdgid) const
2874+ {
2875+ std::set<Int_t>::iterator found = mcConfig_.hadronic_ids_.find(pdgid);
2876+ if (found==mcConfig_.hadronic_ids_.end()) return false; else return true;
2877+ }
2878+
2879 /// Is invisible ?
2880 inline bool IsInvisible(const MCParticleFormat& part) const
2881 {
2882
2883=== added file 'tools/SampleAnalyzer/Writer/LHCOParticleFormat.cpp'
2884--- tools/SampleAnalyzer/Writer/LHCOParticleFormat.cpp 1970-01-01 00:00:00 +0000
2885+++ tools/SampleAnalyzer/Writer/LHCOParticleFormat.cpp 2013-06-13 12:22:26 +0000
2886@@ -0,0 +1,98 @@
2887+////////////////////////////////////////////////////////////////////////////////
2888+//
2889+// Copyright (C) 2012-2013 Eric Conte, Benjamin Fuks
2890+// The MadAnalysis development team, email: <ma5team@iphc.cnrs.fr>
2891+//
2892+// This file is part of MadAnalysis 5.
2893+// Official website: <https://launchpad.net/madanalysis5>
2894+//
2895+// MadAnalysis 5 is free software: you can redistribute it and/or modify
2896+// it under the terms of the GNU General Public License as published by
2897+// the Free Software Foundation, either version 3 of the License, or
2898+// (at your option) any later version.
2899+//
2900+// MadAnalysis 5 is distributed in the hope that it will be useful,
2901+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2902+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2903+// GNU General Public License for more details.
2904+//
2905+// You should have received a copy of the GNU General Public License
2906+// along with MadAnalysis 5. If not, see <http://www.gnu.org/licenses/>
2907+//
2908+////////////////////////////////////////////////////////////////////////////////
2909+
2910+
2911+// STL headers
2912+#include <sstream>
2913+#include <iomanip>
2914+
2915+// SampleAnalyzer headers
2916+#include "SampleAnalyzer/Writer/LHCOParticleFormat.h"
2917+
2918+using namespace MA5;
2919+
2920+// -----------------------------------------------------------------------------
2921+// Header
2922+// -----------------------------------------------------------------------------
2923+const std::string LHCOParticleFormat::header = " # typ eta phi pt jmas ntrk btag had/em dum1 dum2";
2924+
2925+
2926+// -----------------------------------------------------------------------------
2927+// Print a particle line
2928+// -----------------------------------------------------------------------------
2929+void LHCOParticleFormat::Print(UInt_t num, std::ostream* out)
2930+{
2931+ *out << std::setw(3) << std::right << num;
2932+ *out << " ";
2933+ *out << std::setw(2) << std::right << id;
2934+ *out << " ";
2935+ *out << std::fixed;
2936+ unsigned int pres = out->precision();
2937+ out->precision(3);
2938+ double myeta = eta;
2939+ if (myeta>9) myeta=9.999;
2940+ else if (myeta<-9) myeta=-9.999;
2941+ *out << std::setw(6) << std::right << myeta; // -X.YYY
2942+ *out << " ";
2943+ *out << std::setw(6) << std::right << phi; // -X.YYY
2944+ *out << " ";
2945+ *out << std::setw(8) << std::right << pt; // XXXX.YYY
2946+ *out << " ";
2947+ *out << std::setw(6) << std::right << jmass; // -X.YYY
2948+ *out << " ";
2949+ double myntrk = ntrk;
2950+ if (myntrk>9) myntrk=9.999;
2951+ else if (myntrk<-9) myntrk=-9.999;
2952+ *out << std::setw(6) << std::right << myntrk; // -X.YYY
2953+ *out << " ";
2954+ *out << std::setw(5) << std::right << btag; // X.YYY
2955+ *out << " ";
2956+ out->precision(2);
2957+ *out << std::setw(5) << std::right << hadem; // XX.YY
2958+ *out << " ";
2959+ *out << std::setw(5) << std::right << 0.; // -X.YY
2960+ *out << " ";
2961+ *out << std::setw(5) << std::right << 0.; // -X.YY
2962+ out->precision(pres);
2963+ *out << std::endl;
2964+}
2965+
2966+
2967+// -----------------------------------------------------------------------------
2968+// Print the event header
2969+// -----------------------------------------------------------------------------
2970+void LHCOParticleFormat::WriteEventHeader(unsigned int numEvent,
2971+ std::ostream* out)
2972+{
2973+ // Particle number
2974+ *out << std::setw(3) << std::right << 0;
2975+ *out << " ";
2976+
2977+ // Event number
2978+ *out << std::setw(10) << std::right << numEvent+1;
2979+ *out << " ";
2980+
2981+ // Trigger word
2982+ *out << std::setw(6) << std::right << 0;
2983+ *out << std::endl;
2984+}
2985
2986=== added file 'tools/SampleAnalyzer/Writer/LHCOParticleFormat.h'
2987--- tools/SampleAnalyzer/Writer/LHCOParticleFormat.h 1970-01-01 00:00:00 +0000
2988+++ tools/SampleAnalyzer/Writer/LHCOParticleFormat.h 2013-06-13 12:22:26 +0000
2989@@ -0,0 +1,64 @@
2990+////////////////////////////////////////////////////////////////////////////////
2991+//
2992+// Copyright (C) 2012-2013 Eric Conte, Benjamin Fuks
2993+// The MadAnalysis development team, email: <ma5team@iphc.cnrs.fr>
2994+//
2995+// This file is part of MadAnalysis 5.
2996+// Official website: <https://launchpad.net/madanalysis5>
2997+//
2998+// MadAnalysis 5 is free software: you can redistribute it and/or modify
2999+// it under the terms of the GNU General Public License as published by
3000+// the Free Software Foundation, either version 3 of the License, or
3001+// (at your option) any later version.
3002+//
3003+// MadAnalysis 5 is distributed in the hope that it will be useful,
3004+// but WITHOUT ANY WARRANTY; without even the implied warranty of
3005+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3006+// GNU General Public License for more details.
3007+//
3008+// You should have received a copy of the GNU General Public License
3009+// along with MadAnalysis 5. If not, see <http://www.gnu.org/licenses/>
3010+//
3011+////////////////////////////////////////////////////////////////////////////////
3012+
3013+
3014+#ifndef LHCO_PARTICLE_FORMAT_h
3015+#define LHCO_PARTICLE_FORMAT_h
3016+
3017+// STL headers
3018+#include <iostream>
3019+#include <string>
3020+
3021+// ROOT headers
3022+#include <Rtypes.h>
3023+
3024+namespace MA5
3025+{
3026+
3027+class LHCOParticleFormat
3028+{
3029+
3030+ // -------------------------------------------------------------
3031+ // data members
3032+ // -------------------------------------------------------------
3033+ public:
3034+
3035+ UInt_t id;
3036+ Float_t eta;
3037+ Float_t phi;
3038+ Float_t pt;
3039+ Float_t jmass;
3040+ Float_t ntrk;
3041+ Float_t btag;
3042+ Float_t hadem;
3043+
3044+ static const std::string header;
3045+
3046+ void Print(UInt_t num, std::ostream* out);
3047+ static void WriteEventHeader(unsigned int numEvent,std::ostream* out);
3048+};
3049+
3050+
3051+}
3052+
3053+#endif
3054
3055=== modified file 'tools/SampleAnalyzer/Writer/LHCOWriter.cpp'
3056--- tools/SampleAnalyzer/Writer/LHCOWriter.cpp 2013-05-17 06:19:22 +0000
3057+++ tools/SampleAnalyzer/Writer/LHCOWriter.cpp 2013-06-13 12:22:26 +0000
3058@@ -31,105 +31,93 @@
3059
3060 using namespace MA5;
3061
3062-std::string LHCOWriter::FortranFormat_SimplePrecision(Float_t value,UInt_t precision)
3063-{
3064- std::stringstream str;
3065- str.precision(precision);
3066- std::string word;
3067-
3068- Bool_t negative=false;
3069- if (value<0) {negative=true; value*=-1;}
3070-
3071- Int_t exponent = 0;
3072- if (value!=0)
3073- {
3074- for (; value > 1.0; exponent++) value/=10.;
3075- for (; value < 0.0; exponent--) value*=10.;
3076- }
3077-
3078- str << std::uppercase << std::fixed << value << "E";
3079- if (exponent>=0) str << "+"; else str << "-";
3080- if (abs(exponent)<10) str << "0";
3081- str << abs(exponent);
3082- str >> word;
3083- if (!negative) return word;
3084- else return "-"+word;
3085-}
3086-
3087-
3088-std::string LHCOWriter::FortranFormat_DoublePrecision(Double_t value,UInt_t precision)
3089-{
3090- std::stringstream str;
3091- str.precision(precision);
3092- std::string word;
3093-
3094- Bool_t negative=false;
3095- if (value<0) {negative=true; value*=-1;}
3096-
3097- Int_t exponent = 0;
3098- if (value!=0)
3099- {
3100- for (; value > 1.0; exponent++) value/=10.;
3101- for (; value < 0.0; exponent--) value*=10.;
3102- }
3103-
3104- str << std::uppercase << std::fixed << value << "E";
3105- if (exponent>=0) str << "+"; else str << "-";
3106- if (abs(exponent)<10) str << "0";
3107- str << abs(exponent);
3108- str >> word;
3109- if (!negative) return word;
3110- else return "-"+word;
3111-}
3112-
3113
3114 /// Read the sample
3115 bool LHCOWriter::WriteHeader(const SampleFormat& mySample)
3116 {
3117- // Opening tag
3118- *output_ << "<LesHouchesEvents version=""1.0"">" << std::endl;
3119-
3120- // Header block
3121- *output_ << "<header>" << std::endl;
3122- *output_ << "<!--" << std::endl;
3123- *output_ << "#*********************************************************************" << std::endl;
3124- *output_ << "# *" << std::endl;
3125- *output_ << "# This file has been produced by MadAnalysis 5 *" << std::endl;
3126- *output_ << "# *" << std::endl;
3127- *output_ << "#....................................................................*" << std::endl;
3128- *output_ << "" << std::endl;
3129+ // MA5 logo
3130+ WriteMA5header();
3131+
3132+ // LHCO format tag
3133+ *output_ << "#<MA5Format> LHCO format </MA5Format>" << std::endl;
3134+
3135+ // Python interface version
3136+ *output_ << "#<MadAnalysis5Version> " << cfg_->GetPythonInterfaceVersion()
3137+ << " " << cfg_->GetPythonInterfaceDate()
3138+ << "</MadAnalysis5Version>" << std::endl;
3139+
3140+ // SampleAnalyzer version
3141+ *output_ << "#<SampleAnalyzerVersion> "<< cfg_->GetSampleAnalyzerVersion()
3142+ << " " << cfg_->GetSampleAnalyzerVersion()
3143+ << " </SampleAnalyzerVersion>" << std::endl;
3144+
3145+ // Explanation about the LHCO
3146+ *output_ << "#<FormatDescription>" << std::endl;
3147+ *output_ << "#################################################################################" << std::endl;
3148+ *output_ << "# Each event begins with a header row. Meaning of the different columns: #" << std::endl;
3149+ *output_ << "# the following: #" << std::endl;
3150+ *output_ << "# - column 1: label '0' indicating the beginning a new event. #" << std::endl;
3151+ *output_ << "# - column 2: event number. #" << std::endl;
3152+ *output_ << "# - column 3: triggering information. For files produced by MadAnalysis, this #" << std::endl;
3153+ *output_ << "# value is set to 0. #" << std::endl;
3154+ *output_ << "# #" << std::endl;
3155+ *output_ << "# The rest of the rows are the physics objects in the events. Meaning of the #" << std::endl;
3156+ *output_ << "# different columns: #" << std::endl;
3157+ *output_ << "# - column 1: row number #" << std::endl;
3158+ *output_ << "# - column 2: type of physics object. The possible values are: #" << std::endl;
3159+ *output_ << "# 0 = photon, 1 = electron, 2 = muon, #" << std::endl;
3160+ *output_ << "# 3 = hadronically-decaying tau, 4 = jet, 6 = MET #" << std::endl;
3161+ *output_ << "# - column 3: pseudorapidity (eta) of the physics object #" << std::endl;
3162+ *output_ << "# - column 4: azimuthal angle (phi) of the physics object #" << std::endl;
3163+ *output_ << "# - column 5: transverse momentum (pt) of the physics object #" << std::endl;
3164+ *output_ << "# - column 6: mass of the physics object. Required information to #" << std::endl;
3165+ *output_ << "# reconstruct the four-vector momentum of jets. #" << std::endl;
3166+ *output_ << "# - column 7: #" << std::endl;
3167+ *output_ << "# + case of a jet: number of tracks associated with the object. #" << std::endl;
3168+ *output_ << "# + case of an electron/muon: electric charge. #" << std::endl;
3169+ *output_ << "# + case of an hadronically-decaying tau: electric charge times the number of #" << std::endl;
3170+ *output_ << "# tracks associated with the object. #" << std::endl;
3171+ *output_ << "# Usual values: +/-1 , +/-3. #" << std::endl;
3172+ *output_ << "# + other cases: 0. #" << std::endl;
3173+ *output_ << "# - column 8: #" << std::endl;
3174+ *output_ << "# + case of a jet: b-jet tag. Allowed values are: #" << std::endl;
3175+ *output_ << "# 0 = no identified b-jet, #" << std::endl;
3176+ *output_ << "# 1 = b-jet identified by a loose tagger algorithm, #" << std::endl;
3177+ *output_ << "# 2 = b-jet identified by a tight tagger algorithm #" << std::endl;
3178+ *output_ << "# (the value 2 is not used by MadAnalysis 5). #" << std::endl;
3179+ *output_ << "# + case of a muon: the value indicates the row number of the closest jet #" << std::endl;
3180+ *output_ << "# in DeltaR. #" << std::endl;
3181+ *output_ << "# + other cases: 0. #" << std::endl;
3182+ *output_ << "# - column 9: #" << std::endl;
3183+ *output_ << "# + case of jet/electron/photon: ratio of the hadronic versus #" << std::endl;
3184+ *output_ << "# electromagnetic energy deposited in the #" << std::endl;
3185+ *output_ << "# calorimeters cells associated to the object. #" << std::endl;
3186+ *output_ << "# It is typically > 1 for a jet and < 1 for an #" << std::endl;
3187+ *output_ << "# electron or a photon. #" << std::endl;
3188+ *output_ << "# + case of muon: value related to muon isolation. The format of this value #" << std::endl;
3189+ *output_ << "# is XXX.YYY. The integer part (XXX) is the summed transverse #" << std::endl;
3190+ *output_ << "# momentum of tracks in a DeltaR-cone (typically DeltaR=0.4), #" << std::endl;
3191+ *output_ << "# excluding the muon track. The decimal part (YYY) is the #" << std::endl;
3192+ *output_ << "# ratio of the transverse energy in the same DeltaR-cone to #" << std::endl;
3193+ *output_ << "# the transverse momentum of the muon. #" << std::endl;
3194+ *output_ << "# + in other cases: 0. #" << std::endl;
3195+ *output_ << "# - column 10: empty column, added for possible use. #" << std::endl;
3196+ *output_ << "# - column 11: empty column, added for possible use. #" << std::endl;
3197+ *output_ << "#################################################################################" << std::endl;
3198+ *output_ << "#</FormatDescription>" << std::endl;
3199
3200 if (mySample.mc()!=0)
3201 {
3202- *output_ << "Original header:" << std::endl;
3203+ *output_ << "#Original header:" << std::endl;
3204 *output_ << "" << std::endl;
3205
3206 for (unsigned int i=0;i<mySample.mc()->header().size();i++)
3207- *output_ << mySample.mc()->header()[i] << std::endl;
3208+ *output_ << "#" << mySample.mc()->header()[i] << std::endl;
3209 }
3210
3211+ // One line to remind the meaning of each line
3212 *output_ << " #" << std::endl;
3213- // *output_ << " ## More info on LHCO files: "
3214- // << "http://cp3wks05.fynu.ucl.ac.be/Manual/lhco.html" << std::endl;
3215- *output_ << " # eventNum triggerWord" << std::endl;
3216- *output_ << " # typ ";
3217- *output_ << std::setw(18) << std::right << "eta";
3218- *output_ << " ";
3219- *output_ << std::setw(18) << std::right << "phi";
3220- *output_ << " ";
3221- *output_ << std::setw(18) << std::right << "pt";
3222- *output_ << " ";
3223- *output_ << std::setw(18) << std::right << "jmass";
3224- *output_ << " ";
3225- *output_ << std::setw(5) << std::right << "ntracks";
3226- *output_ << " ";
3227- *output_ << std::setw(4) << std::right << "btag";
3228- *output_ << " ";
3229- *output_ << std::setw(7) << std::right << "had/em";
3230- *output_ << " ";
3231- *output_ << std::setw(4) << std::right << "dum1";
3232- *output_ << " ";
3233- *output_ << std::setw(4) << std::right << "dum2" << std::endl;
3234+ *output_ << LHCOParticleFormat::header << std::endl;
3235
3236 return true;
3237 }
3238@@ -138,67 +126,78 @@
3239 bool LHCOWriter::WriteEvent(const EventFormat& myEvent,
3240 const SampleFormat& mySample)
3241 {
3242- // Event header
3243- *output_ << "0" << std::endl;
3244+ // FirstEvent
3245+ if (counter_==0)
3246+ {
3247+ WriteHeader(mySample);
3248+ }
3249
3250 // Skipping event if no reconstructed object
3251 if (myEvent.rec()==0) return true;
3252
3253- // Counter of particles
3254- unsigned int npart=0;
3255-
3256- // Writing electrons
3257+ // Event header
3258+ LHCOParticleFormat::WriteEventHeader(counter_,output_);
3259+
3260+ // Particle container in LHCO format
3261+ std::vector<LHCOParticleFormat> PartTable;
3262+ PartTable.reserve( myEvent.rec()->photons().size() +
3263+ myEvent.rec()->electrons().size() +
3264+ myEvent.rec()->muons().size() +
3265+ myEvent.rec()->taus().size() +
3266+ myEvent.rec()->jets().size() + 1 /*MET*/);
3267+
3268+ // Writing photons (=0)
3269+ for (unsigned int i=0;i<myEvent.rec()->photons().size();i++)
3270+ {
3271+ PartTable.push_back(LHCOParticleFormat());
3272+ WritePhoton(myEvent.rec()->photons()[i],&PartTable.back());
3273+ }
3274+
3275+ // Writing electrons (=1)
3276 for (unsigned int i=0;i<myEvent.rec()->electrons().size();i++)
3277 {
3278- npart++;
3279- WriteElectron(myEvent.rec()->electrons()[i],npart);
3280+ PartTable.push_back(LHCOParticleFormat());
3281+ WriteElectron(myEvent.rec()->electrons()[i],&PartTable.back());
3282 }
3283
3284- // Writing muons
3285+ // Writing muons (=2)
3286 for (unsigned int i=0;i<myEvent.rec()->muons().size();i++)
3287 {
3288- npart++;
3289- WriteMuon(myEvent.rec()->muons()[i],npart);
3290+ PartTable.push_back(LHCOParticleFormat());
3291+ WriteMuon(myEvent.rec()->muons()[i],&PartTable.back(),myEvent.rec(),
3292+ myEvent.rec()->photons().size()+
3293+ myEvent.rec()->electrons().size()+
3294+ myEvent.rec()->muons().size());
3295 }
3296
3297- // Writing taus
3298+ // Writing taus (=3)
3299 for (unsigned int i=0;i<myEvent.rec()->taus().size();i++)
3300 {
3301- npart++;
3302- WriteTau(myEvent.rec()->taus()[i],npart);
3303+ PartTable.push_back(LHCOParticleFormat());
3304+ WriteTau(myEvent.rec()->taus()[i],&PartTable.back());
3305 }
3306
3307- // Writing jets
3308+ // Writing jets (=4)
3309 for (unsigned int i=0;i<myEvent.rec()->jets().size();i++)
3310 {
3311- npart++;
3312- WriteJet(myEvent.rec()->jets()[i],npart);
3313+ PartTable.push_back(LHCOParticleFormat());
3314+ WriteJet(myEvent.rec()->jets()[i],&PartTable.back());
3315 }
3316
3317- // Writing MET
3318- npart++;
3319- WriteMET(myEvent.rec()->MET(),npart);
3320-
3321- return true;
3322-}
3323-
3324-
3325-/// Finalize the event
3326-bool LHCOWriter::WriteEventHeader(const SampleFormat& mySample,unsigned int numEvent)
3327-{
3328- // Particle number
3329- *output_ << std::setw(3) << std::right << 0;
3330- *output_ << " ";
3331-
3332- // Event number
3333- *output_ << std::setw(18) << std::right << numEvent;
3334- *output_ << " ";
3335-
3336- // Trigger word
3337- *output_ << std::setw(18) << std::right << 0;
3338-
3339- return true;
3340-}
3341+ // Writing MET (=6)
3342+ PartTable.push_back(LHCOParticleFormat());
3343+ WriteMET(myEvent.rec()->MET(),&PartTable.back());
3344+
3345+ // Printing the table
3346+ for (UInt_t i=0;i<PartTable.size();i++) PartTable[i].Print(i+1,output_);
3347+
3348+ // Incremeting event counter
3349+ counter_++;
3350+
3351+ return true;
3352+}
3353+
3354+
3355
3356
3357 /// Finalize the event
3358@@ -208,93 +207,48 @@
3359 }
3360
3361
3362-void LHCOWriter::WriteJet(const RecJetFormat& jet,unsigned int partNum)
3363+void LHCOWriter::WriteJet(const RecJetFormat& jet,
3364+ LHCOParticleFormat* lhco)
3365 {
3366- // Particle number
3367- *output_ << std::setw(3) << std::right << partNum;
3368- *output_ << " ";
3369-
3370- // Particle type
3371- *output_ << std::setw(3) << std::right << 4;
3372- *output_ << " ";
3373-
3374- // eta
3375- *output_ << std::setw(18) << std::right
3376- << LHCOWriter::FortranFormat_DoublePrecision(jet.momentum().Eta())
3377- << " ";
3378-
3379- // phi
3380- *output_ << std::setw(18) << std::right
3381- << LHCOWriter::FortranFormat_DoublePrecision(jet.momentum().Phi())
3382- << " ";
3383-
3384- // pt
3385- *output_ << std::setw(18) << std::right
3386- << LHCOWriter::FortranFormat_DoublePrecision(jet.momentum().Pt())
3387- << " ";
3388-
3389- // mass
3390- *output_ << std::setw(18) << std::right
3391- << LHCOWriter::FortranFormat_DoublePrecision(jet.momentum().M())
3392- << " ";
3393-
3394- // ntracks
3395- *output_ << std::setw(5) << std::right
3396- << LHCOWriter::FortranFormat_DoublePrecision(jet.ntracks())
3397- << " ";
3398-
3399- // b tagging
3400- if (jet.btag()) *output_ << " 1.0 ";
3401- else *output_ << " 0.0 ";
3402-
3403- // HE/EE
3404- *output_ << std::setw(7) << std::right
3405- << LHCOWriter::FortranFormat_DoublePrecision(jet.HEoverEE())
3406- << " ";
3407-
3408- // dummy1 & dummy2
3409- *output_ << "0.00 0.00";
3410-
3411- // end
3412- *output_ << std::endl;
3413+ lhco->id = 4;
3414+ lhco->eta = jet.momentum().Eta();
3415+ lhco->phi = jet.momentum().Phi();
3416+ lhco->pt = jet.momentum().Pt();
3417+ lhco->jmass = jet.momentum().M();
3418+ lhco->ntrk = jet.ntracks();
3419+ if (jet.btag()) lhco->btag = 1.0; else lhco->btag = 0.0;
3420+ lhco->hadem = jet.HEoverEE();
3421 }
3422
3423-void LHCOWriter::WriteMuon(const RecLeptonFormat& muon,unsigned int partNum)
3424+void LHCOWriter::WriteMuon(const RecLeptonFormat& muon,
3425+ LHCOParticleFormat* lhco,
3426+ const RecEventFormat* myEvent,
3427+ unsigned int npart)
3428 {
3429- // Particle number
3430- *output_ << std::setw(3) << std::right << partNum;
3431- *output_ << " ";
3432-
3433- // Particle type
3434- *output_ << std::setw(3) << std::right << 2;
3435- *output_ << " ";
3436-
3437- // eta
3438- *output_ << std::setw(18) << std::right
3439- << LHCOWriter::FortranFormat_DoublePrecision(muon.momentum().Eta())
3440- << " ";
3441-
3442- // phi
3443- *output_ << std::setw(18) << std::right
3444- << LHCOWriter::FortranFormat_DoublePrecision(muon.momentum().Phi())
3445- << " ";
3446-
3447- // pt
3448- *output_ << std::setw(18) << std::right
3449- << LHCOWriter::FortranFormat_DoublePrecision(muon.momentum().Pt())
3450- << " ";
3451-
3452- // mass
3453- *output_ << std::setw(18) << std::right
3454- << LHCOWriter::FortranFormat_DoublePrecision(muon.momentum().M())
3455- << " ";
3456-
3457- // electric charge
3458- if (muon.charge()>0) *output_ << " +1.0 ";
3459- else *output_ << " -1.0 ";
3460-
3461- // null
3462- *output_ << "0.0 ";
3463+ lhco->id = 2;
3464+ lhco->eta = muon.momentum().Eta();
3465+ lhco->phi = muon.momentum().Phi();
3466+ lhco->pt = muon.momentum().Pt();
3467+ lhco->jmass = muon.momentum().M();
3468+ if (muon.charge()>0) lhco->ntrk=+1.; else lhco->ntrk=-1.;
3469+
3470+ //------------- the closest jet ---------------
3471+ unsigned int theClosestJet=0;
3472+ Double_t minDeltaR=-1;
3473+ for (unsigned int i=0;i<myEvent->jets().size();i++)
3474+ {
3475+ if (myEvent->jets()[i].pt()==0) continue;
3476+ Double_t DeltaR=muon.dr(myEvent->jets()[i]);
3477+ if (i==0 || DeltaR<minDeltaR)
3478+ {
3479+ theClosestJet=i;
3480+ minDeltaR=DeltaR;
3481+ }
3482+ }
3483+ if (minDeltaR<0) lhco->btag = 0.;
3484+ else lhco->btag = theClosestJet+npart+1;
3485+
3486+ //---------------- isolation ------------------
3487
3488 // isolation : sumPT_isol
3489 double isolation = 0;
3490@@ -302,147 +256,59 @@
3491
3492 // isolation : sumET_isol
3493 double ET_PT = 0;
3494- if (muon.sumPT_isol()!=0) ET_PT=muon.sumET_isol()/muon.sumPT_isol();
3495- ET_PT=std::floor(ET_PT);
3496+ if (muon.pt()!=0) ET_PT=muon.sumET_isol()/muon.pt();
3497
3498 // gathering isolation variables
3499- bool test=false;
3500- for (unsigned int j=0;j<5;j++)
3501- {
3502- ET_PT/=10;
3503- if (ET_PT<1.)
3504- {
3505- test=true;
3506- break;
3507- }
3508- }
3509- if (!test) ET_PT=0;
3510+ if (ET_PT>100) ET_PT=0.99; else ET_PT=ET_PT/100.;
3511+
3512 isolation+=ET_PT;
3513- *output_ << std::setw(7) << std::right
3514- << LHCOWriter::FortranFormat_DoublePrecision(isolation)
3515- << " ";
3516-
3517- // dummy1 & dummy2
3518- *output_ << "0.00 0.00";
3519-
3520- // end
3521- *output_ << std::endl;
3522-}
3523-
3524-void LHCOWriter::WriteElectron(const RecLeptonFormat& electron, unsigned int partNum)
3525-{
3526- // Particle number
3527- *output_ << std::setw(3) << std::right << partNum;
3528- *output_ << " ";
3529-
3530- // Particle type
3531- *output_ << std::setw(3) << std::right << 1;
3532- *output_ << " ";
3533-
3534- // eta
3535- *output_ << std::setw(18) << std::right
3536- << LHCOWriter::FortranFormat_DoublePrecision(electron.momentum().Eta()) << " ";
3537-
3538- // phi
3539- *output_ << std::setw(18) << std::right
3540- << LHCOWriter::FortranFormat_DoublePrecision(electron.momentum().Phi()) << " ";
3541-
3542- // pt
3543- *output_ << std::setw(18) << std::right
3544- << LHCOWriter::FortranFormat_DoublePrecision(electron.momentum().Pt()) << " ";
3545-
3546- // mass
3547- *output_ << std::setw(18) << std::right
3548- << LHCOWriter::FortranFormat_DoublePrecision(electron.momentum().M()) << " ";
3549-
3550- // electric charge
3551- if (electron.charge()>0) *output_ << " +1.0 ";
3552- else *output_ << " -1.0 ";
3553-
3554- // null
3555- *output_ << "0.0 ";
3556-
3557- // HE/EE
3558- *output_ << std::setw(18) << std::right
3559- << LHCOWriter::FortranFormat_DoublePrecision(electron.HEoverEE())
3560- << " ";
3561-
3562- // dummy1 & dummy2
3563- *output_ << "0.00 0.00";
3564-
3565- // end
3566- *output_ << std::endl;
3567-}
3568-
3569-void LHCOWriter::WriteTau(const RecTauFormat& tau, unsigned int partNum)
3570-{
3571- // Particle number
3572- *output_ << std::setw(3) << std::right << partNum;
3573- *output_ << " ";
3574-
3575- // Particle type
3576- *output_ << std::setw(3) << std::right << 3;
3577- *output_ << " ";
3578-
3579- // eta
3580- *output_ << std::setw(18) << std::right
3581- << LHCOWriter::FortranFormat_DoublePrecision(tau.momentum().Eta()) << " ";
3582-
3583- // phi
3584- *output_ << std::setw(18) << std::right
3585- << LHCOWriter::FortranFormat_DoublePrecision(tau.momentum().Phi()) << " ";
3586-
3587- // pt
3588- *output_ << std::setw(18) << std::right
3589- << LHCOWriter::FortranFormat_DoublePrecision(tau.momentum().Pt()) << " ";
3590-
3591- // mass
3592- *output_ << std::setw(18) << std::right
3593- << LHCOWriter::FortranFormat_DoublePrecision(tau.momentum().M()) << " ";
3594-
3595- // electric charge
3596- if (tau.charge()>0) *output_ << " +1.0 ";
3597- else *output_ << " -1.0 ";
3598-
3599- // HE/EE
3600- *output_ << std::setw(18) << std::right
3601- << LHCOWriter::FortranFormat_DoublePrecision(tau.HEoverEE()) << " ";
3602-
3603- // dummy1 & dummy2
3604- *output_ << "0.00 0.00";
3605-
3606- // end
3607- *output_ << std::endl;
3608-}
3609-
3610-void LHCOWriter::WriteMET(const ParticleBaseFormat& met, unsigned int partNum)
3611-{
3612- // Particle number
3613- *output_ << std::setw(3) << std::right << partNum;
3614- *output_ << " ";
3615-
3616- // Particle type
3617- *output_ << std::setw(3) << std::right << 6;
3618- *output_ << " ";
3619-
3620- // no eta for met
3621- *output_ << std::setw(18) << std::right
3622- << LHCOWriter::FortranFormat_DoublePrecision(0)
3623- << " ";
3624-
3625- // phi
3626- *output_ << std::setw(18) << std::right
3627- << LHCOWriter::FortranFormat_DoublePrecision(met.phi())
3628- << " ";
3629-
3630- // et
3631- *output_ << std::setw(18) << std::right
3632- << LHCOWriter::FortranFormat_DoublePrecision(met.et())
3633- << " ";
3634-
3635- // dummy1 & dummy2
3636- *output_ << "0.00 0.00";
3637-
3638- // end
3639- *output_ << std::endl;
3640+ lhco->hadem = isolation;
3641+}
3642+
3643+void LHCOWriter::WriteElectron(const RecLeptonFormat& electron,
3644+ LHCOParticleFormat* lhco)
3645+{
3646+ lhco->id = 1;
3647+ lhco->eta = electron.momentum().Eta();
3648+ lhco->phi = electron.momentum().Phi();
3649+ lhco->pt = electron.momentum().Pt();
3650+ lhco->jmass = electron.momentum().M();
3651+ if (electron.charge()>0) lhco->ntrk=+1.; else lhco->ntrk=-1.;
3652+ lhco->btag = 0.;
3653+ lhco->hadem = electron.HEoverEE();
3654+}
3655+
3656+void LHCOWriter::WritePhoton(const RecPhotonFormat& photon,
3657+ LHCOParticleFormat* lhco)
3658+{
3659+ lhco->id = 0;
3660+ lhco->eta = photon.momentum().Eta();
3661+ lhco->phi = photon.momentum().Phi();
3662+ lhco->pt = photon.momentum().Pt();
3663+ lhco->jmass = photon.momentum().M();
3664+ lhco->ntrk = 0.;
3665+ lhco->btag = 0.;
3666+ lhco->hadem = photon.HEoverEE();
3667+}
3668+
3669+void LHCOWriter::WriteTau(const RecTauFormat& tau,
3670+ LHCOParticleFormat* lhco)
3671+{
3672+ lhco->id = 3;
3673+ lhco->eta = tau.momentum().Eta();
3674+ lhco->phi = tau.momentum().Phi();
3675+ lhco->pt = tau.momentum().Pt();
3676+ lhco->jmass = tau.momentum().M();
3677+ if (tau.charge()>0) lhco->ntrk=tau.ntracks(); else lhco->ntrk=-tau.ntracks();
3678+ lhco->btag = 0.;
3679+ lhco->hadem = tau.HEoverEE();
3680+}
3681+
3682+void LHCOWriter::WriteMET(const ParticleBaseFormat& met,
3683+ LHCOParticleFormat* lhco)
3684+{
3685+ lhco->id = 6;
3686+ lhco->eta = 0.;
3687+ lhco->phi = met.phi();
3688+ lhco->pt = met.pt();
3689 }
3690
3691=== modified file 'tools/SampleAnalyzer/Writer/LHCOWriter.h'
3692--- tools/SampleAnalyzer/Writer/LHCOWriter.h 2013-05-17 06:19:22 +0000
3693+++ tools/SampleAnalyzer/Writer/LHCOWriter.h 2013-06-13 12:22:26 +0000
3694@@ -32,6 +32,7 @@
3695
3696 // SampleAnalyzer headers
3697 #include "SampleAnalyzer/Writer/WriterTextBase.h"
3698+#include "SampleAnalyzer/Writer/LHCOParticleFormat.h"
3699
3700 namespace MA5
3701 {
3702@@ -44,7 +45,7 @@
3703 // -------------------------------------------------------------
3704 protected:
3705
3706-
3707+ UInt_t counter_;
3708
3709 // -------------------------------------------------------------
3710 // method members
3711@@ -53,7 +54,7 @@
3712
3713 /// Constructor without argument
3714 LHCOWriter() : WriterTextBase()
3715- {}
3716+ { counter_=0; }
3717
3718 /// Destructor
3719 virtual ~LHCOWriter()
3720@@ -71,17 +72,15 @@
3721
3722 private:
3723
3724- static std::string FortranFormat_SimplePrecision(Float_t value,UInt_t precision=7);
3725- static std::string FortranFormat_DoublePrecision(Double_t value,UInt_t precision=11);
3726
3727 // Writing a reconstructed jet
3728
3729- bool WriteEventHeader(const SampleFormat& mySample,unsigned int);
3730- void WriteJet(const RecJetFormat& jet,unsigned int);
3731- void WriteMuon(const RecLeptonFormat& muon,unsigned int);
3732- void WriteElectron(const RecLeptonFormat& electron,unsigned int);
3733- void WriteTau(const RecTauFormat& tau,unsigned int);
3734- void WriteMET(const ParticleBaseFormat& met,unsigned int);
3735+ void WriteJet(const RecJetFormat& jet, LHCOParticleFormat* lhco);
3736+ void WriteMuon(const RecLeptonFormat& muon, LHCOParticleFormat* lhco, const RecEventFormat* myEvent, unsigned int npart);
3737+ void WriteElectron(const RecLeptonFormat& electron, LHCOParticleFormat* lhco);
3738+ void WritePhoton(const RecPhotonFormat& photon, LHCOParticleFormat* lhco);
3739+ void WriteTau(const RecTauFormat& tau, LHCOParticleFormat* lhco);
3740+ void WriteMET(const ParticleBaseFormat& met, LHCOParticleFormat* lhco);
3741
3742
3743 };
3744
3745=== added file 'tools/SampleAnalyzer/Writer/LHEParticleFormat.cpp'
3746--- tools/SampleAnalyzer/Writer/LHEParticleFormat.cpp 1970-01-01 00:00:00 +0000
3747+++ tools/SampleAnalyzer/Writer/LHEParticleFormat.cpp 2013-06-13 12:22:26 +0000
3748@@ -0,0 +1,115 @@
3749+////////////////////////////////////////////////////////////////////////////////
3750+//
3751+// Copyright (C) 2012-2013 Eric Conte, Benjamin Fuks
3752+// The MadAnalysis development team, email: <ma5team@iphc.cnrs.fr>
3753+//
3754+// This file is part of MadAnalysis 5.
3755+// Official website: <https://launchpad.net/madanalysis5>
3756+//
3757+// MadAnalysis 5 is free software: you can redistribute it and/or modify
3758+// it under the terms of the GNU General Public License as published by
3759+// the Free Software Foundation, either version 3 of the License, or
3760+// (at your option) any later version.
3761+//
3762+// MadAnalysis 5 is distributed in the hope that it will be useful,
3763+// but WITHOUT ANY WARRANTY; without even the implied warranty of
3764+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3765+// GNU General Public License for more details.
3766+//
3767+// You should have received a copy of the GNU General Public License
3768+// along with MadAnalysis 5. If not, see <http://www.gnu.org/licenses/>
3769+//
3770+////////////////////////////////////////////////////////////////////////////////
3771+
3772+
3773+// STL headers
3774+#include <sstream>
3775+#include <iomanip>
3776+#include <cstdlib>
3777+
3778+// SampleAnalyzer headers
3779+#include "SampleAnalyzer/Writer/LHEParticleFormat.h"
3780+
3781+using namespace MA5;
3782+
3783+
3784+// -----------------------------------------------------------------------------
3785+// FortranFormat_SimplePrecision
3786+// -----------------------------------------------------------------------------
3787+std::string LHEParticleFormat::FortranFormat_SimplePrecision(Float_t value,UInt_t precision)
3788+{
3789+ std::stringstream str;
3790+ str.precision(precision);
3791+ std::string word;
3792+
3793+ Bool_t negative=false;
3794+ if (value<0) {negative=true; value*=-1;}
3795+
3796+ Int_t exponent = 0;
3797+ if (value!=0)
3798+ {
3799+ for (; value > 1.0; exponent++) value/=10.;
3800+ for (; value < 0.0; exponent--) value*=10.;
3801+ }
3802+
3803+ str << std::uppercase << std::fixed << value << "E";
3804+ if (exponent>=0) str << "+"; else str << "-";
3805+ if (std::abs(exponent)<10) str << "0";
3806+ str << std::abs(exponent);
3807+ str >> word;
3808+ if (!negative) return word;
3809+ else return "-"+word;
3810+}
3811+
3812+
3813+// -----------------------------------------------------------------------------
3814+// FortranFormat_DoublePrecision
3815+// -----------------------------------------------------------------------------
3816+std::string LHEParticleFormat::FortranFormat_DoublePrecision(Double_t value,UInt_t precision)
3817+{
3818+ std::stringstream str;
3819+ str.precision(precision);
3820+ std::string word;
3821+
3822+ Bool_t negative=false;
3823+ if (value<0) {negative=true; value*=-1;}
3824+
3825+ Int_t exponent = 0;
3826+ if (value!=0)
3827+ {
3828+ for (; value > 1.0; exponent++) value/=10.;
3829+ for (; value < 0.0; exponent--) value*=10.;
3830+ }
3831+
3832+ str << std::uppercase << std::fixed << value << "E";
3833+ if (exponent>=0) str << "+"; else str << "-";
3834+ if (std::abs(exponent)<10) str << "0";
3835+ str << std::abs(exponent);
3836+ str >> word;
3837+ if (!negative) return word;
3838+ else return "-"+word;
3839+}
3840+
3841+
3842+// -----------------------------------------------------------------------------
3843+// Print a particle line
3844+// -----------------------------------------------------------------------------
3845+void LHEParticleFormat::Print(UInt_t num, std::ostream* out)
3846+{
3847+ *out << std::setw(9) << std::right << id << " ";
3848+ *out << std::setw(4) << std::right << status << " ";
3849+ *out << std::setw(4) << std::right << mother1 << " ";
3850+ *out << std::setw(4) << std::right << mother2 << " ";
3851+ *out << std::setw(4) << std::right << color1 << " ";
3852+ *out << std::setw(4) << std::right << color2 << " ";
3853+ *out << std::setw(18) << std::right << FortranFormat_DoublePrecision(px) << " ";
3854+ *out << std::setw(18) << std::right << FortranFormat_DoublePrecision(py) << " ";
3855+ *out << std::setw(18) << std::right << FortranFormat_DoublePrecision(pz) << " ";
3856+ *out << std::setw(18) << std::right << FortranFormat_DoublePrecision(e) << " ";
3857+ *out << std::setw(18) << std::right << FortranFormat_DoublePrecision(m) << " ";
3858+ *out << std::setw(2) << std::right << std::showpoint << ctau << " ";
3859+ *out << std::setw(3) << std::right << std::showpoint << spin;
3860+ *out << std::endl;
3861+}
3862+
3863+
3864
3865=== added file 'tools/SampleAnalyzer/Writer/LHEParticleFormat.h'
3866--- tools/SampleAnalyzer/Writer/LHEParticleFormat.h 1970-01-01 00:00:00 +0000
3867+++ tools/SampleAnalyzer/Writer/LHEParticleFormat.h 2013-06-13 12:22:26 +0000
3868@@ -0,0 +1,71 @@
3869+////////////////////////////////////////////////////////////////////////////////
3870+//
3871+// Copyright (C) 2012-2013 Eric Conte, Benjamin Fuks
3872+// The MadAnalysis development team, email: <ma5team@iphc.cnrs.fr>
3873+//
3874+// This file is part of MadAnalysis 5.
3875+// Official website: <https://launchpad.net/madanalysis5>
3876+//
3877+// MadAnalysis 5 is free software: you can redistribute it and/or modify
3878+// it under the terms of the GNU General Public License as published by
3879+// the Free Software Foundation, either version 3 of the License, or
3880+// (at your option) any later version.
3881+//
3882+// MadAnalysis 5 is distributed in the hope that it will be useful,
3883+// but WITHOUT ANY WARRANTY; without even the implied warranty of
3884+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3885+// GNU General Public License for more details.
3886+//
3887+// You should have received a copy of the GNU General Public License
3888+// along with MadAnalysis 5. If not, see <http://www.gnu.org/licenses/>
3889+//
3890+////////////////////////////////////////////////////////////////////////////////
3891+
3892+
3893+#ifndef LHE_PARTICLE_FORMAT_h
3894+#define LHE_PARTICLE_FORMAT_h
3895+
3896+// STL headers
3897+#include <iostream>
3898+#include <string>
3899+
3900+// ROOT headers
3901+#include <Rtypes.h>
3902+
3903+namespace MA5
3904+{
3905+
3906+class LHEParticleFormat
3907+{
3908+
3909+ // -------------------------------------------------------------
3910+ // data members
3911+ // -------------------------------------------------------------
3912+ public:
3913+
3914+ Int_t id;
3915+ Int_t status;
3916+ UInt_t mother1;
3917+ UInt_t mother2;
3918+ UInt_t color1;
3919+ UInt_t color2;
3920+ Float_t px;
3921+ Float_t py;
3922+ Float_t pz;
3923+ Float_t e;
3924+ Float_t m;
3925+ Float_t ctau;
3926+ Float_t spin;
3927+
3928+ static std::string FortranFormat_SimplePrecision(Float_t value,
3929+ UInt_t precision=7);
3930+ static std::string FortranFormat_DoublePrecision(Double_t value,
3931+ UInt_t precision=11);
3932+
3933+ void Print(UInt_t num, std::ostream* out);
3934+};
3935+
3936+
3937+}
3938+
3939+#endif
3940
3941=== modified file 'tools/SampleAnalyzer/Writer/LHEWriter.cpp'
3942--- tools/SampleAnalyzer/Writer/LHEWriter.cpp 2013-05-17 06:19:22 +0000
3943+++ tools/SampleAnalyzer/Writer/LHEWriter.cpp 2013-06-13 12:22:26 +0000
3944@@ -88,16 +88,14 @@
3945 // Opening tag
3946 *output_ << "<LesHouchesEvents version=""1.0"">" << std::endl;
3947
3948- // Header block
3949+ // Header tag
3950 *output_ << "<header>" << std::endl;
3951 *output_ << "<!--" << std::endl;
3952- *output_ << "#*********************************************************************" << std::endl;
3953- *output_ << "# *" << std::endl;
3954- *output_ << "# This file has been produced by MadAnalysis 5 *" << std::endl;
3955- *output_ << "# *" << std::endl;
3956- *output_ << "#....................................................................*" << std::endl;
3957- *output_ << "" << std::endl;
3958- // Explanation about the Simplified LHE
3959+
3960+ // MA5 logo
3961+ WriteMA5header();
3962+
3963+ // LHE format
3964 if (mySample.rec()!=0)
3965 {
3966 *output_ << "<MA5Format> Simplified LHE format </MA5Format>" << std::endl;
3967@@ -106,79 +104,106 @@
3968 {
3969 *output_ << "<MA5Format> LHE format </MA5Format>" << std::endl;
3970 }
3971+
3972+ // Python interface version
3973+ *output_ << "<MadAnalysis5Version> " << cfg_->GetPythonInterfaceVersion()
3974+ << " " << cfg_->GetPythonInterfaceDate()
3975+ << "</MadAnalysis5Version>" << std::endl;
3976+
3977+ // SampleAnalyzer version
3978+ *output_ << "<SampleAnalyzerVersion> "<< cfg_->GetSampleAnalyzerVersion()
3979+ << " " << cfg_->GetSampleAnalyzerVersion()
3980+ << " </SampleAnalyzerVersion>" << std::endl;
3981+
3982+ // Explanation about the LHE
3983 *output_ << "<FormatDescription>" << std::endl;
3984- *output_ << "The original Les Houches Event (LHE) format is defined in hep-ph/0609017" << std::endl;
3985- *output_ << "" << std::endl;
3986- *output_ << "The <init> ... </init> block contains global information about the samples given as a single line:" << std::endl;
3987- *output_ << " IDBMUP1 IDBMUP2 EBMUP1 EBMUP2 PDFGUP1 PDFGUP2 PDFSUP1 PDFSUP1 PDFSUP2 IDWTUP NPRUP" << std::endl;
3988- *output_ << "with:" << std::endl;
3989- *output_ << " - IDBMUP1: PDG code of the first beam" << std::endl;
3990- *output_ << " - IDBMUP2: PDG code of the second beam" << std::endl;
3991- *output_ << " - EBMUP1: energy of the first beam" << std::endl;
3992- *output_ << " - EBMUP2: energy of the second beam" << std::endl;
3993- *output_ << " - PDFGUP1: author group of the PDF employed for the first beam" << std::endl;
3994- *output_ << " - PDFGUP2: author group of the PDF employed for the second beam" << std::endl;
3995- *output_ << " - PDFSUP1: id of the PDF set employed for the first beam" << std::endl;
3996- *output_ << " - PDFSUP2: id of the PDF set employed for the second beam" << std::endl;
3997- *output_ << " - IDWTUP: weighting strategy" << std::endl;
3998- *output_ << " - NPRUP: number of physics processes involved during the generation of the sample" << std::endl;
3999- *output_ << "; the following lines give detailed process information (one line for each process):" << std::endl;
4000- *output_ << " XSECUP XERRUP XMAXUP LPRUP" << std::endl;
4001- *output_<< "with:" << std::endl;
4002- *output_ << " - XSECUP: cross section" << std::endl;
4003- *output_ << " - XERRUP: cross section error" << std::endl;
4004- *output_ << " - XMAXUP: maximum event weight" << std::endl;
4005- *output_ << " - LPRUP: process id" << std::endl;
4006- *output_ << "" << std::endl;
4007- *output_ << "Each event is described by an <event> ... </event> block. This block always starts by a single line containing general information on the event:" << std::endl;
4008- *output_ << " NUP IDPRUP XWGTUP SCALUP AQEDUP AQCDUP" << std::endl;
4009- *output_ << "with:" << std::endl;
4010- *output_ << " - NUP: number of particles" << std::endl;
4011- *output_ << " - IDPRUP: process id" << std::endl;
4012- *output_ << " - XWGTUP: event weight" << std::endl;
4013- *output_ << " - SCALUP: scale" << std::endl;
4014- *output_ << " - AQEDUP: alpha QED" << std::endl;
4015- *output_ << " - AQCDUP: alpha QCD" << std::endl;
4016- *output_ << "This line is then followed by one line for each particle in the event:" << std::endl;
4017- *output_ << " IDUP ISTUP MOTHUP1 MOTHUP2 ICOLUP1 ICOLUP2 PUP1 PUP2 PUP3 PUP4 PUP5 VTIMUP SPINUP" << std::endl;
4018- *output_ << "with:" << std::endl;
4019- *output_ << " - IDUP: PDG code" << std::endl;
4020- *output_ << " - ISTUP: status code" << std::endl;
4021- *output_ << " - MOTHUP1: index of the first mother particle" << std::endl;
4022- *output_ << " - MOTHUP2: index of the second mother particle" << std::endl;
4023- *output_ << " - ICOLUP1: first color tag" << std::endl;
4024- *output_ << " - ICOLUP2: second color tag" << std::endl;
4025- *output_ << " - PUP1: PX [GeV/c]" << std::endl;
4026- *output_ << " - PUP2: PY [GeV/c]" << std::endl;
4027- *output_ << " - PUP3: PZ [GeV/c]" << std::endl;
4028- *output_ << " - PUP4: E [GeV]" << std::endl;
4029- *output_ << " - PUP5: M [GeV/c^2] (a space-like virtuality is denoted by a negative mass)" << std::endl;
4030- *output_ << " - VTIMUP: c tau" << std::endl;
4031- *output_ << " - SPINUP: cosine of the angle between the spin vector of the particle and its three-momentum" << std::endl;
4032+ *output_ << "#################################################################################" << std::endl;
4033+ *output_ << "# The original Les Houches Event (LHE) format is defined in hep-ph/0609017 #" << std::endl;
4034+ *output_ << "#################################################################################" << std::endl;
4035+ *output_ << "# The <init> ... </init> block contains global information about the samples #" << std::endl;
4036+ *output_ << "# given as a single line: #" << std::endl;
4037+ *output_ << "# IDBM1 IDBM2 EBM1 EBM2 PDFG1 PDFG2 PDFS1 PDFS1 PDFS2 IDWT NPR #" << std::endl;
4038+ *output_ << "# with: #" << std::endl;
4039+ *output_ << "# - IDBM1: PDG code of the first beam. #" << std::endl;
4040+ *output_ << "# - IDBM2: PDG code of the second beam. #" << std::endl;
4041+ *output_ << "# - EBM1: energy of the first beam. #" << std::endl;
4042+ *output_ << "# - EBM2: energy of the second beam. #" << std::endl;
4043+ *output_ << "# - PDFG1: author group of the PDF employed for the first beam. #" << std::endl;
4044+ *output_ << "# - PDFG2: author group of the PDF employed for the second beam. #" << std::endl;
4045+ *output_ << "# - PDFS1: id of the PDF set employed for the first beam. #" << std::endl;
4046+ *output_ << "# - PDFS2: id of the PDF set employed for the second beam. #" << std::endl;
4047+ *output_ << "# - IDWT: weighting strategy. #" << std::endl;
4048+ *output_ << "# - NPR: number of physics processes involved during the generation of #" << std::endl;
4049+ *output_ << "# the sample. #" << std::endl;
4050+ *output_ << "# The following lines give detailed process information (one line for each #" << std::endl;
4051+ *output_ << "# process): #" << std::endl;
4052+ *output_ << "# XSEC XERR XMAX LPR #" << std::endl;
4053+ *output_ << "# with: #" << std::endl;
4054+ *output_ << "# - XSEC: cross section #" << std::endl;
4055+ *output_ << "# - XERR: cross section error #" << std::endl;
4056+ *output_ << "# - XMAX: maximum event weight #" << std::endl;
4057+ *output_ << "# - LPR: process id #" << std::endl;
4058+ *output_ << "#################################################################################" << std::endl;
4059+ *output_ << "# Each event is described by an <event> ... </event> block. This block always #" << std::endl;
4060+ *output_ << "# starts by a single line containing general information on the event: #" << std::endl;
4061+ *output_ << "# N IDPR XWGT SCAL AQED AQCD #" << std::endl;
4062+ *output_ << "# with: #" << std::endl;
4063+ *output_ << "# - N: number of particles #" << std::endl;
4064+ *output_ << "# - IDPR: process id #" << std::endl;
4065+ *output_ << "# - XWGT: event weight #" << std::endl;
4066+ *output_ << "# - SCAL: scale #" << std::endl;
4067+ *output_ << "# - AQED: alpha QED #" << std::endl;
4068+ *output_ << "# - AQCD: alpha QCD #" << std::endl;
4069+ *output_ << "# This line is then followed by one line for each particle in the event: #" << std::endl;
4070+ *output_ << "# ID IST MOTH1 MOTH2 ICOL1 ICOL2 P1 P2 P3 P4 P5 VTIM SPIN #" << std::endl;
4071+ *output_ << "# with: #" << std::endl;
4072+ *output_ << "# - ID: PDG code #" << std::endl;
4073+ *output_ << "# - IST: status code #" << std::endl;
4074+ *output_ << "# - MOTH1: row number corresponding to the first mother particle #" << std::endl;
4075+ *output_ << "# - MOTH2: row number corresponding to the second mother particle #" << std::endl;
4076+ *output_ << "# - ICOL1: first color tag #" << std::endl;
4077+ *output_ << "# - ICOL2: second color tag #" << std::endl;
4078+ *output_ << "# - P1: PX #" << std::endl;
4079+ *output_ << "# - P2: PY #" << std::endl;
4080+ *output_ << "# - P3: PZ #" << std::endl;
4081+ *output_ << "# - P4: E #" << std::endl;
4082+ *output_ << "# - P5: M (a space-like virtuality is denoted by a negative mass) #" << std::endl;
4083+ *output_ << "# - VTIM: c tau #" << std::endl;
4084+ *output_ << "# - SPIN: cosine of the angle between the spin vector of the particle and #" << std::endl;
4085+ *output_ << "# its three-momentum #" << std::endl;
4086+ *output_ << "#################################################################################" << std::endl;
4087
4088 // Explanation about the Simplified LHE
4089 if (mySample.rec()!=0)
4090 {
4091- *output_ << "" << std::endl;
4092- *output_ << "In the 'simplified LHE' format, there are three types of objects classified according to their statuscode:" << std::endl;
4093- *output_ << " - Objects with StatusCode = -1: initial interacting partons" << std::endl;
4094- *output_ << " - Objects with StatusCode = +3: particles produced during the hard process" << std::endl;
4095- *output_ << " - Objects with StatusCode = +1: reconstructed objects (after applying a fast simulation of a (possibly perfect) detector and a jet-clustering algorithm" << std::endl;
4096- *output_ << "When MadAnalysis is in charge of the reconstruction (i.e., applying the jet-clustering algorithm), the particle codes follow the conventions:" << std::endl;
4097- *output_ << " - particle with a PDG code = +11 or -11: electrons and positrons." <<std::endl;
4098- *output_ << " They can be isolated or not as well aspossibly issued from the hadronization process." << std::endl;
4099- *output_ << " - particle with a PDG code = +13 or -13: muons and antimuons." << std::endl;
4100- *output_ << " They can be isolated or not as well aspossibly issued from the hadronization process." << std::endl;
4101- *output_ << " - particle with a PDG code = +15 or -15: hadronically decaying (anti)taus." << std::endl;
4102- *output_ << " These consist of jets matching a hadronically decaying tau when inspecting the Monte Carlo history." << std::endl;
4103- *output_ << " (Mis)Identification efficiency can be possibly included." << std::endl;
4104- *output_ << " - particle with a PDG code = 5: b-jets." << std::endl;
4105- *output_ << " These consist of jets matching a b-quark when inspecting the Monte Carlo history." << std::endl;
4106- *output_ << " (Mis)Identification efficiency can be possibly included." << std::endl;
4107- *output_ << " - particle with a PDG code = 21: jets which are not b-tagged and taus which are not tau-tagged." << std::endl;
4108- *output_ << " the jet collection includes also electrons collection and hadronic taus collection" << std::endl;
4109- *output_ << " - particle with a PDG code = 12: the missing transverse energy." << std::endl;
4110- *output_ << " The missing transverse energy is computed as opposite to the sum of the four-momenta of all jets, electrons, muons and hadronic taus." << std::endl;
4111+ *output_ << "# In the 'simplified LHE' format, there are three types of objects classified #" << std::endl;
4112+ *output_ << "# according to their statuscode: #" << std::endl;
4113+ *output_ << "# - objects with StatusCode = -1: initial interacting partons. #" << std::endl;
4114+ *output_ << "# - objects with StatusCode = +3: particles produced during the hard process. #" << std::endl;
4115+ *output_ << "# - objects with StatusCode = +1: physics objects reconstructed by a fast #" << std::endl;
4116+ *output_ << "# detector simulation (or perfect detector). #" << std::endl;
4117+ *output_ << "# When MadAnalysis is in charge of the reconstruction (i.e., applying the #" << std::endl;
4118+ *output_ << "# jet-clustering algorithm), the particle codes follow the conventions: #" << std::endl;
4119+ *output_ << "# - particle with a PDG code = +11 or -11: electrons and positrons. #" << std::endl;
4120+ *output_ << "# They can be isolated or not as well as possibly issued from the #" << std::endl;
4121+ *output_ << "# hadronization process. #" << std::endl;
4122+ *output_ << "# - particle with a PDG code = +13 or -13: muons and antimuons. #" << std::endl;
4123+ *output_ << "# They can be isolated or not as well as possibly issued from the #" << std::endl;
4124+ *output_ << "# hadronization process. #" << std::endl;
4125+ *output_ << "# - particle with a PDG code = +15 or -15: hadronically decaying (anti)taus. #" << std::endl;
4126+ *output_ << "# These consist of jets matching a hadronically-decaying tau when #" << std::endl;
4127+ *output_ << "# inspecting the Monte Carlo history. (Mis)Identification efficiency can be #" << std::endl;
4128+ *output_ << "# possibly included. #" << std::endl;
4129+ *output_ << "# - particle with a PDG code = 5: b-jets. #" << std::endl;
4130+ *output_ << "# These consist of jets matching a b-quark when inspecting the Monte Carlo #" << std::endl;
4131+ *output_ << "# history. (Mis)Identification efficiency can be possibly included. #" << std::endl;
4132+ *output_ << "# - particle with a PDG code = 21: jets which are not b-tagged and taus which #" << std::endl;
4133+ *output_ << "# are not tau-tagged. The jet collection includes also electrons collection #" << std::endl;
4134+ *output_ << "# and hadronic taus collection #" << std::endl;
4135+ *output_ << "# - particle with a PDG code = 12: the missing transverse energy. #" << std::endl;
4136+ *output_ << "# The missing transverse energy is computed as opposite to the sum of the #" << std::endl;
4137+ *output_ << "# four-momenta of all jets, electrons, muons and hadronic taus. #" << std::endl;
4138+ *output_ << "#################################################################################" << std::endl;
4139 }
4140 *output_ << "</FormatDescription>" << std::endl;
4141 if (mySample.mc()!=0)
4142@@ -279,59 +304,43 @@
4143 // Event header
4144 *output_ << "<event>" << std::endl;
4145
4146- unsigned int counter = 0;
4147+ // Container for particles
4148+ std::vector<LHEParticleFormat> particles;
4149+ UInt_t counter=0;
4150
4151 // Writing MC particles : only MC info case
4152 // -> hypothesis : input = LHE
4153 if (myEvent.mc()!=0 && myEvent.rec()==0)
4154 {
4155- for (unsigned int i=0;i<myEvent.mc()->particles().size();i++) counter ++;
4156+ counter += myEvent.mc()->particles().size();
4157 }
4158
4159 // Writing MC particles : MC+REC info case
4160 // -> hypothesis : input = HEP
4161- if (myEvent.mc()!=0 && myEvent.rec()!=0)
4162+ else if (myEvent.mc()!=0 && myEvent.rec()!=0)
4163 {
4164- for (unsigned int i=4;i<myEvent.mc()->particles().size();i++)
4165+ for (unsigned int i=0;i<myEvent.mc()->particles().size();i++)
4166+ {
4167 if (myEvent.mc()->particles()[i].statuscode()==3 ||
4168 ( myEvent.mc()->particles()[i].statuscode()>=21 &&
4169 myEvent.mc()->particles()[i].statuscode()<=29)
4170 ) counter++;
4171+ }
4172+
4173 }
4174
4175 // Writing REC particles
4176 if (myEvent.rec()!=0)
4177 {
4178- if (myEvent.mc()==0)
4179- {
4180- for (unsigned int i=0;i<myEvent.rec()->muons().size();i++)
4181- counter++;
4182- for (unsigned int i=0;i<myEvent.rec()->electrons().size();i++)
4183- counter++;
4184- for (unsigned int i=0;i<myEvent.rec()->taus().size();i++)
4185- counter++;
4186- }
4187- else
4188- {
4189- for (unsigned int i=6;i<myEvent.mc()->particles().size();i++)
4190- {
4191- if ( (myEvent.mc()->particles()[i].statuscode()==3 ||
4192- ( myEvent.mc()->particles()[i].statuscode()>=21 &&
4193- myEvent.mc()->particles()[i].statuscode()<=29))&& (
4194- fabs(myEvent.mc()->particles()[i].pdgid())==11 ||
4195- fabs(myEvent.mc()->particles()[i].pdgid())==13 ||
4196- fabs(myEvent.mc()->particles()[i].pdgid())==15 ))
4197- {
4198- counter++;
4199- }
4200- }
4201- }
4202- for (unsigned int i=0;i<myEvent.rec()->jets().size();i++)
4203- counter++;
4204- counter++;
4205+ counter += myEvent.rec()->muons().size() +
4206+ myEvent.rec()->electrons().size() +
4207+ myEvent.rec()->taus().size() +
4208+ myEvent.rec()->photons().size() +
4209+ myEvent.rec()->jets().size() + 1 /*MET*/;
4210 }
4211
4212 // Writing event global information
4213+ particles.reserve(counter);
4214 WriteEventHeader(myEvent,counter);
4215
4216 // Writing MC particles : only MC info case
4217@@ -339,9 +348,14 @@
4218 if (myEvent.mc()!=0 && myEvent.rec()==0)
4219 {
4220 for (unsigned int i=0;i<myEvent.mc()->particles().size();i++)
4221+ {
4222+ particles.push_back(LHEParticleFormat());
4223 WriteParticle(myEvent.mc()->particles()[i],
4224 myEvent.mc()->particles()[i].mothup1_,
4225- myEvent.mc()->particles()[i].mothup2_);
4226+ myEvent.mc()->particles()[i].mothup2_,
4227+ 0,
4228+ particles.back());
4229+ }
4230 }
4231
4232 // Writing MC particles : MC+REC info case
4233@@ -350,20 +364,22 @@
4234 {
4235 for (unsigned int i=0;i<myEvent.mc()->particles().size();i++)
4236 {
4237- if ( myEvent.mc()->particles()[i].statuscode()>=11 &&
4238- myEvent.mc()->particles()[i].statuscode()<=19 )
4239- WriteParticle(myEvent.mc()->particles()[i],0,0,-1);
4240-
4241- else if (i>3 && i<6 && myEvent.mc()->particles()[i].statuscode()==3)
4242- WriteParticle(myEvent.mc()->particles()[i],0,0,-1);
4243+ if ( myEvent.mc()->particles()[i].statuscode()==-1 ||
4244+ ( myEvent.mc()->particles()[i].statuscode()>=11 &&
4245+ myEvent.mc()->particles()[i].statuscode()<=19 ))
4246+ {
4247+ particles.push_back(LHEParticleFormat());
4248+ WriteParticle(myEvent.mc()->particles()[i],0,0,-1, particles.back());
4249+ }
4250
4251 else if (myEvent.mc()->particles()[i].statuscode()==3 ||
4252 ( myEvent.mc()->particles()[i].statuscode()>=21 &&
4253 myEvent.mc()->particles()[i].statuscode()<=29))
4254 {
4255+ particles.push_back(LHEParticleFormat());
4256 Int_t moth1 = GetMotherIndex(myEvent.mc()->particles()[i].mothup1_);
4257 Int_t moth2 = GetMotherIndex(myEvent.mc()->particles()[i].mothup2_);
4258- WriteParticle(myEvent.mc()->particles()[i],moth1,moth2,3);
4259+ WriteParticle(myEvent.mc()->particles()[i],moth1,moth2,3, particles.back());
4260 }
4261 }
4262 }
4263@@ -371,40 +387,39 @@
4264 // Writing REC particles
4265 if (myEvent.rec()!=0)
4266 {
4267- // if (myEvent.mc()==0)
4268- {
4269- for (unsigned int i=0;i<myEvent.rec()->muons().size();i++)
4270- WriteMuon(myEvent.rec()->muons()[i]);
4271- for (unsigned int i=0;i<myEvent.rec()->electrons().size();i++)
4272- WriteElectron(myEvent.rec()->electrons()[i]);
4273- for (unsigned int i=0;i<myEvent.rec()->taus().size();i++)
4274- WriteTau(myEvent.rec()->taus()[i]);
4275- }
4276- /*
4277- else
4278- {
4279- for (unsigned int i=6;i<myEvent.mc()->particles().size();i++)
4280- {
4281- if ((myEvent.mc()->particles()[i].statuscode()==3 ||
4282- ( myEvent.mc()->particles()[i].statuscode()>=21 &&
4283- myEvent.mc()->particles()[i].statuscode()<=29)) && (
4284- fabs(myEvent.mc()->particles()[i].pdgid())==11 ||
4285- fabs(myEvent.mc()->particles()[i].pdgid())==13 ||
4286- fabs(myEvent.mc()->particles()[i].pdgid())==15 ))
4287- {
4288- WriteParticle(myEvent.mc()->particles()[i],0,0,1);
4289- }
4290- }
4291- }*/
4292-
4293+ for (unsigned int i=0;i<myEvent.rec()->muons().size();i++)
4294+ {
4295+ particles.push_back(LHEParticleFormat());
4296+ WriteMuon(myEvent.rec()->muons()[i],particles.back());
4297+ }
4298+ for (unsigned int i=0;i<myEvent.rec()->electrons().size();i++)
4299+ {
4300+ particles.push_back(LHEParticleFormat());
4301+ WriteElectron(myEvent.rec()->electrons()[i],particles.back());
4302+ }
4303+ for (unsigned int i=0;i<myEvent.rec()->taus().size();i++)
4304+ {
4305+ particles.push_back(LHEParticleFormat());
4306+ WriteTau(myEvent.rec()->taus()[i],particles.back());
4307+ }
4308 for (unsigned int i=0;i<myEvent.rec()->jets().size();i++)
4309- WriteJet(myEvent.rec()->jets()[i]);
4310- WriteMET(myEvent.rec()->MET());
4311+ {
4312+ particles.push_back(LHEParticleFormat());
4313+ WriteJet(myEvent.rec()->jets()[i],particles.back());
4314+ }
4315+ for (unsigned int i=0;i<myEvent.rec()->photons().size();i++)
4316+ {
4317+ particles.push_back(LHEParticleFormat());
4318+ WritePhoton(myEvent.rec()->photons()[i],particles.back());
4319+ }
4320+ particles.push_back(LHEParticleFormat());
4321+ WriteMET(myEvent.rec()->MET(),particles.back());
4322 }
4323
4324 // Event foot
4325+ for (unsigned int i=0;i<particles.size();i++) particles[i].Print(i+1, output_);
4326 *output_ << "</event>" << std::endl;
4327- return true;
4328+ return true;
4329 }
4330
4331
4332@@ -447,117 +462,129 @@
4333
4334
4335 /// Writing a particle
4336-bool LHEWriter::WriteParticle(const MCParticleFormat& myPart, Int_t mother1, Int_t mother2, Int_t statuscode )
4337-{
4338- *output_ << std::setw(9) << std::right << myPart.pdgid_ << " ";
4339- if (statuscode!=0) *output_ << std::setw(4) << std::right << statuscode << " ";
4340- else *output_ << std::setw(4) << std::right << myPart.statuscode_ << " ";
4341- *output_ << std::setw(4) << std::right << mother1 /*myPart.mothup1_*/ << " ";
4342- *output_ << std::setw(4) << std::right << mother2 /*myPart.mothup2_*/ << " ";
4343- *output_ << std::setw(4) << std::right << 0 << " ";
4344- *output_ << std::setw(4) << std::right << 0 << " ";
4345- *output_ << std::setw(18) << std::right << LHEWriter::FortranFormat_DoublePrecision(myPart.momentum_.Px()) << " ";
4346- *output_ << std::setw(18) << std::right << LHEWriter::FortranFormat_DoublePrecision(myPart.momentum_.Py()) << " ";
4347- *output_ << std::setw(18) << std::right << LHEWriter::FortranFormat_DoublePrecision(myPart.momentum_.Pz()) << " ";
4348- *output_ << std::setw(18) << std::right << LHEWriter::FortranFormat_DoublePrecision(myPart.momentum_.E()) << " ";
4349- *output_ << std::setw(18) << std::right << LHEWriter::FortranFormat_DoublePrecision(myPart.momentum_.M()) << " ";
4350- *output_ << std::setw(2) << std::right << std::showpoint << myPart.ctau_ << " ";
4351- *output_ << std::setw(3) << std::right << std::showpoint << myPart.spin_;
4352- *output_ << std::endl;
4353- return true;
4354-}
4355-
4356-
4357-void LHEWriter::WriteJet(const RecJetFormat& jet)
4358-{
4359- if (jet.btag()) *output_ << std::setw(9) << std::right << 5 << " ";
4360- else *output_ << std::setw(9) << std::right << 21 << " ";
4361- *output_ << std::setw(4) << std::right << 1 << " ";
4362- *output_ << std::setw(4) << std::right << 0 << " ";
4363- *output_ << std::setw(4) << std::right << 0 << " ";
4364- *output_ << std::setw(4) << std::right << 0 << " ";
4365- *output_ << std::setw(4) << std::right << 0 << " ";
4366- *output_ << std::setw(18) << std::right << LHEWriter::FortranFormat_DoublePrecision(jet.momentum().Px()) << " ";
4367- *output_ << std::setw(18) << std::right << LHEWriter::FortranFormat_DoublePrecision(jet.momentum().Py()) << " ";
4368- *output_ << std::setw(18) << std::right << LHEWriter::FortranFormat_DoublePrecision(jet.momentum().Pz()) << " ";
4369- *output_ << std::setw(18) << std::right << LHEWriter::FortranFormat_DoublePrecision(jet.momentum().E()) << " ";
4370- *output_ << std::setw(18) << std::right << LHEWriter::FortranFormat_DoublePrecision(jet.momentum().M()) << " ";
4371- *output_ << std::setw(2) << std::right << std::showpoint << 0. << " ";
4372- *output_ << std::setw(3) << std::right << std::showpoint << 0.;
4373- *output_ << std::endl;
4374-}
4375-
4376-void LHEWriter::WriteMuon(const RecLeptonFormat& muon)
4377-{
4378- if (muon.charge()>0) *output_ << std::setw(9) << std::right << -13 << " ";
4379- else *output_ << std::setw(9) << std::right << +13 << " ";
4380- *output_ << std::setw(4) << std::right << 1 << " ";
4381- *output_ << std::setw(4) << std::right << 0 << " ";
4382- *output_ << std::setw(4) << std::right << 0 << " ";
4383- *output_ << std::setw(4) << std::right << 0 << " ";
4384- *output_ << std::setw(4) << std::right << 0 << " ";
4385- *output_ << std::setw(18) << std::right << LHEWriter::FortranFormat_DoublePrecision(muon.momentum().Px()) << " ";
4386- *output_ << std::setw(18) << std::right << LHEWriter::FortranFormat_DoublePrecision(muon.momentum().Py()) << " ";
4387- *output_ << std::setw(18) << std::right << LHEWriter::FortranFormat_DoublePrecision(muon.momentum().Pz()) << " ";
4388- *output_ << std::setw(18) << std::right << LHEWriter::FortranFormat_DoublePrecision(muon.momentum().E()) << " ";
4389- *output_ << std::setw(18) << std::right << LHEWriter::FortranFormat_DoublePrecision(muon.momentum().M()) << " ";
4390- *output_ << std::setw(2) << std::right << std::showpoint << 0. << " ";
4391- *output_ << std::setw(3) << std::right << std::showpoint << 0.;
4392- *output_ << std::endl;
4393-}
4394-
4395-void LHEWriter::WriteElectron(const RecLeptonFormat& electron)
4396-{
4397- if (electron.charge()>0) *output_ << std::setw(9) << std::right << -11 << " ";
4398- else *output_ << std::setw(9) << std::right << +11 << " ";
4399- *output_ << std::setw(4) << std::right << 1 << " ";
4400- *output_ << std::setw(4) << std::right << 0 << " ";
4401- *output_ << std::setw(4) << std::right << 0 << " ";
4402- *output_ << std::setw(4) << std::right << 0 << " ";
4403- *output_ << std::setw(4) << std::right << 0 << " ";
4404- *output_ << std::setw(18) << std::right << LHEWriter::FortranFormat_DoublePrecision(electron.momentum().Px()) << " ";
4405- *output_ << std::setw(18) << std::right << LHEWriter::FortranFormat_DoublePrecision(electron.momentum().Py()) << " ";
4406- *output_ << std::setw(18) << std::right << LHEWriter::FortranFormat_DoublePrecision(electron.momentum().Pz()) << " ";
4407- *output_ << std::setw(18) << std::right << LHEWriter::FortranFormat_DoublePrecision(electron.momentum().E()) << " ";
4408- *output_ << std::setw(18) << std::right << LHEWriter::FortranFormat_DoublePrecision(electron.momentum().M()) << " ";
4409- *output_ << std::setw(2) << std::right << std::showpoint << 0. << " ";
4410- *output_ << std::setw(3) << std::right << std::showpoint << 0.;
4411- *output_ << std::endl;
4412-}
4413-
4414-void LHEWriter::WriteTau(const RecTauFormat& tau)
4415-{
4416- if (tau.charge()>0) *output_ << std::setw(9) << std::right << -15 << " ";
4417- else *output_ << std::setw(9) << std::right << +15 << " ";
4418- *output_ << std::setw(4) << std::right << 1 << " ";
4419- *output_ << std::setw(4) << std::right << 0 << " ";
4420- *output_ << std::setw(4) << std::right << 0 << " ";
4421- *output_ << std::setw(4) << std::right << 0 << " ";
4422- *output_ << std::setw(4) << std::right << 0 << " ";
4423- *output_ << std::setw(18) << std::right << LHEWriter::FortranFormat_DoublePrecision(tau.momentum().Px()) << " ";
4424- *output_ << std::setw(18) << std::right << LHEWriter::FortranFormat_DoublePrecision(tau.momentum().Py()) << " ";
4425- *output_ << std::setw(18) << std::right << LHEWriter::FortranFormat_DoublePrecision(tau.momentum().Pz()) << " ";
4426- *output_ << std::setw(18) << std::right << LHEWriter::FortranFormat_DoublePrecision(tau.momentum().E()) << " ";
4427- *output_ << std::setw(18) << std::right << LHEWriter::FortranFormat_DoublePrecision(tau.momentum().M()) << " ";
4428- *output_ << std::setw(2) << std::right << std::showpoint << 0. << " ";
4429- *output_ << std::setw(3) << std::right << std::showpoint << 0.;
4430- *output_ << std::endl;
4431-}
4432-
4433-void LHEWriter::WriteMET(const ParticleBaseFormat& met)
4434-{
4435- *output_ << std::setw(9) << std::right << 12 << " ";
4436- *output_ << std::setw(4) << std::right << 1 << " ";
4437- *output_ << std::setw(4) << std::right << 0 << " ";
4438- *output_ << std::setw(4) << std::right << 0 << " ";
4439- *output_ << std::setw(4) << std::right << 0 << " ";
4440- *output_ << std::setw(4) << std::right << 0 << " ";
4441- *output_ << std::setw(18) << std::right << LHEWriter::FortranFormat_DoublePrecision(met.px()) << " ";
4442- *output_ << std::setw(18) << std::right << LHEWriter::FortranFormat_DoublePrecision(met.py()) << " ";
4443- *output_ << std::setw(18) << std::right << LHEWriter::FortranFormat_DoublePrecision(0.) << " ";
4444- *output_ << std::setw(18) << std::right << LHEWriter::FortranFormat_DoublePrecision(met.pt()) << " ";
4445- *output_ << std::setw(18) << std::right << LHEWriter::FortranFormat_DoublePrecision(0.) << " ";
4446- *output_ << std::setw(2) << std::right << std::showpoint << 0. << " ";
4447- *output_ << std::setw(3) << std::right << std::showpoint << 0.;
4448- *output_ << std::endl;
4449+void LHEWriter::WriteParticle(const MCParticleFormat& myPart,
4450+ Int_t mother1, Int_t mother2,
4451+ Int_t statuscode, LHEParticleFormat& lhe)
4452+{
4453+ if (statuscode!=0) lhe.status = statuscode;
4454+ else lhe.status = myPart.statuscode_;
4455+ lhe.id = myPart.pdgid_;
4456+ lhe.mother1 = mother1;
4457+ lhe.mother2 = mother2;
4458+ lhe.color1 = 0;
4459+ lhe.color2 = 0;
4460+ lhe.px = myPart.momentum().Px();
4461+ lhe.py = myPart.momentum().Py();
4462+ lhe.pz = myPart.momentum().Pz();
4463+ lhe.e = myPart.momentum().E();
4464+ lhe.m = myPart.momentum().M();
4465+ lhe.ctau = myPart.ctau_;
4466+ lhe.spin = myPart.spin_;
4467+}
4468+
4469+
4470+void LHEWriter::WriteJet(const RecJetFormat& jet, LHEParticleFormat& lhe)
4471+{
4472+ if (jet.btag()) lhe.id = 5; else lhe.id = 21;
4473+ lhe.status = 1;
4474+ lhe.mother1 = 0;
4475+ lhe.mother2 = 0;
4476+ lhe.color1 = 0;
4477+ lhe.color2 = 0;
4478+ lhe.px = jet.momentum().Px();
4479+ lhe.py = jet.momentum().Py();
4480+ lhe.pz = jet.momentum().Pz();
4481+ lhe.e = jet.momentum().E();
4482+ lhe.m = jet.momentum().M();
4483+ lhe.ctau = 0.;
4484+ lhe.spin = 0.;
4485+}
4486+
4487+
4488+void LHEWriter::WriteMuon(const RecLeptonFormat& muon, LHEParticleFormat& lhe)
4489+{
4490+ if (muon.charge()>0) lhe.id = -13; else lhe.id = +13;
4491+ lhe.status = 1;
4492+ lhe.mother1 = 0;
4493+ lhe.mother2 = 0;
4494+ lhe.color1 = 0;
4495+ lhe.color2 = 0;
4496+ lhe.px = muon.momentum().Px();
4497+ lhe.py = muon.momentum().Py();
4498+ lhe.pz = muon.momentum().Pz();
4499+ lhe.e = muon.momentum().E();
4500+ lhe.m = muon.momentum().M();
4501+ lhe.ctau = 0.;
4502+ lhe.spin = 0.;
4503+}
4504+
4505+void LHEWriter::WriteElectron(const RecLeptonFormat& electron, LHEParticleFormat& lhe)
4506+{
4507+ if (electron.charge()>0) lhe.id = -11; else lhe.id = +11;
4508+ lhe.status = 1;
4509+ lhe.mother1 = 0;
4510+ lhe.mother2 = 0;
4511+ lhe.color1 = 0;
4512+ lhe.color2 = 0;
4513+ lhe.px = electron.momentum().Px();
4514+ lhe.py = electron.momentum().Py();
4515+ lhe.pz = electron.momentum().Pz();
4516+ lhe.e = electron.momentum().E();
4517+ lhe.m = electron.momentum().M();
4518+ lhe.ctau = 0.;
4519+ lhe.spin = 0.;
4520+}
4521+
4522+
4523+void LHEWriter::WritePhoton(const RecPhotonFormat& photon, LHEParticleFormat& lhe)
4524+{
4525+ lhe.id = 22;
4526+ lhe.status = 1;
4527+ lhe.mother1 = 0;
4528+ lhe.mother2 = 0;
4529+ lhe.color1 = 0;
4530+ lhe.color2 = 0;
4531+ lhe.px = photon.momentum().Px();
4532+ lhe.py = photon.momentum().Py();
4533+ lhe.pz = photon.momentum().Pz();
4534+ lhe.e = photon.momentum().E();
4535+ lhe.m = photon.momentum().M();
4536+ lhe.ctau = 0.;
4537+ lhe.spin = 0.;
4538+}
4539+
4540+
4541+void LHEWriter::WriteTau(const RecTauFormat& tau, LHEParticleFormat& lhe)
4542+{
4543+ if (tau.charge()>0) lhe.id = -15; else lhe.id = +15;
4544+ lhe.status = 1;
4545+ lhe.mother1 = 0;
4546+ lhe.mother2 = 0;
4547+ lhe.color1 = 0;
4548+ lhe.color2 = 0;
4549+ lhe.px = tau.momentum().Px();
4550+ lhe.py = tau.momentum().Py();
4551+ lhe.pz = tau.momentum().Pz();
4552+ lhe.e = tau.momentum().E();
4553+ lhe.m = tau.momentum().M();
4554+ lhe.ctau = 0.;
4555+ lhe.spin = 0.;
4556+}
4557+
4558+
4559+void LHEWriter::WriteMET(const ParticleBaseFormat& met, LHEParticleFormat& lhe)
4560+{
4561+ lhe.id = 12;
4562+ lhe.status = 1;
4563+ lhe.mother1 = 0;
4564+ lhe.mother2 = 0;
4565+ lhe.color1 = 0;
4566+ lhe.color2 = 0;
4567+ lhe.px = met.px();
4568+ lhe.py = met.py();
4569+ lhe.pz = 0.;
4570+ lhe.e = met.pt();
4571+ lhe.m = 0.;
4572+ lhe.ctau = 0.;
4573+ lhe.spin = 0.;
4574 }
4575
4576=== modified file 'tools/SampleAnalyzer/Writer/LHEWriter.h'
4577--- tools/SampleAnalyzer/Writer/LHEWriter.h 2013-05-17 06:19:22 +0000
4578+++ tools/SampleAnalyzer/Writer/LHEWriter.h 2013-06-13 12:22:26 +0000
4579@@ -32,6 +32,7 @@
4580
4581 // SampleAnalyzer headers
4582 #include "SampleAnalyzer/Writer/WriterTextBase.h"
4583+#include "SampleAnalyzer/Writer/LHEParticleFormat.h"
4584
4585 namespace MA5
4586 {
4587@@ -76,17 +77,19 @@
4588 unsigned int nevents);
4589
4590 /// Writing a particle
4591- bool WriteParticle(const MCParticleFormat& myPart, Int_t mother1, Int_t mother2, Int_t statuscode=0);
4592+ void WriteParticle(const MCParticleFormat& myPart, Int_t mother1, Int_t mother2,
4593+ Int_t statuscode, LHEParticleFormat& lhe);
4594
4595 static std::string FortranFormat_SimplePrecision(Float_t value,UInt_t precision=7);
4596 static std::string FortranFormat_DoublePrecision(Double_t value,UInt_t precision=11);
4597
4598 // Writing a reconstructed jet
4599- void WriteJet(const RecJetFormat& jet);
4600- void WriteMuon(const RecLeptonFormat& muon);
4601- void WriteElectron(const RecLeptonFormat& electron);
4602- void WriteTau(const RecTauFormat& tau);
4603- void WriteMET(const ParticleBaseFormat& met);
4604+ void WriteJet(const RecJetFormat& jet, LHEParticleFormat& lhe);
4605+ void WriteMuon(const RecLeptonFormat& muon, LHEParticleFormat& lhe);
4606+ void WriteElectron(const RecLeptonFormat& electron, LHEParticleFormat& lhe);
4607+ void WritePhoton(const RecPhotonFormat& photon, LHEParticleFormat& lhe);
4608+ void WriteTau(const RecTauFormat& tau, LHEParticleFormat& lhe);
4609+ void WriteMET(const ParticleBaseFormat& met, LHEParticleFormat& lhe);
4610
4611
4612 };
4613
4614=== modified file 'tools/SampleAnalyzer/Writer/WriterBase.h'
4615--- tools/SampleAnalyzer/Writer/WriterBase.h 2013-05-17 06:19:22 +0000
4616+++ tools/SampleAnalyzer/Writer/WriterBase.h 2013-06-13 12:22:26 +0000
4617@@ -36,6 +36,7 @@
4618 #include "SampleAnalyzer/DataFormat/EventFormat.h"
4619 #include "SampleAnalyzer/DataFormat/SampleFormat.h"
4620 #include "SampleAnalyzer/Service/Physics.h"
4621+#include "SampleAnalyzer/Core/Configuration.h"
4622
4623 // ROOT headers
4624 #include <TVector.h>
4625@@ -77,7 +78,8 @@
4626 }
4627
4628 /// Initialize (virtual pure)
4629- virtual bool Initialize(const std::string& filename) = 0;
4630+ virtual bool Initialize(const Configuration* cfg,
4631+ const std::string& filename) = 0;
4632
4633 /// Read the sample (virtual pure)
4634 virtual bool WriteHeader(const SampleFormat& mySample) = 0;
4635
4636=== modified file 'tools/SampleAnalyzer/Writer/WriterTextBase.cpp'
4637--- tools/SampleAnalyzer/Writer/WriterTextBase.cpp 2013-05-17 06:19:22 +0000
4638+++ tools/SampleAnalyzer/Writer/WriterTextBase.cpp 2013-06-13 12:22:26 +0000
4639@@ -37,8 +37,12 @@
4640 // -----------------------------------------------------------------------------
4641 // Initialize
4642 // -----------------------------------------------------------------------------
4643-bool WriterTextBase::Initialize(const std::string& rawfilename)
4644+bool WriterTextBase::Initialize(const Configuration* cfg,
4645+ const std::string& rawfilename)
4646 {
4647+ // Saving configuration file
4648+ cfg_ = cfg;
4649+
4650 // Is the file stored in Rfio
4651 rfio_ = ReaderBase::IsRfioMode(rawfilename);
4652
4653@@ -147,3 +151,26 @@
4654 return true;
4655 }
4656
4657+
4658+// -----------------------------------------------------------------------------
4659+// Header
4660+// -----------------------------------------------------------------------------
4661+void WriterTextBase::WriteMA5header()
4662+{
4663+ *output_ << "#################################################################################" << std::endl;
4664+ *output_ << "# THIS FILE HAS BEEN PRODUCED BY MADANALYSIS 5 #" << std::endl;
4665+ *output_ << "# ______ ______ #" << std::endl;
4666+ *output_ << "# /'\\_/`\\/\\ __ \\/\\ ___\\ #" << std::endl;
4667+ *output_ << "# /\\ \\ \\ \\_\\ \\ \\ \\__/ #" << std::endl;
4668+ *output_ << "# \\ \\ \\__\\ \\ \\ __ \\ \\___``\\ #" << std::endl;
4669+ *output_ << "# \\ \\ \\_/\\ \\ \\ \\/\\ \\/\\ \\_\\ \\ #" << std::endl;
4670+ *output_ << "# \\ \\_\\\\ \\_\\ \\_\\ \\_\\ \\____/ #" << std::endl;
4671+ *output_ << "# \\/_/ \\/_/\\/_/\\/_/\\/___/ #" << std::endl;
4672+ *output_ << "# #" << std::endl;
4673+ // *output_ << "# MA5 release : " + "%-24s" % main.version + "%+15s" % main.date + " #" << std::endl;
4674+ // *output_ << "# #" << std::endl;
4675+ *output_ << "# Comput. Phys. Commun. 184 (2013) 222-256 #" << std::endl;
4676+ *output_ << "# The MadAnalysis Development Team - Please visit us at #" << std::endl;
4677+ *output_ << "# https://launchpad.net/madanalysis5 #" << std::endl;
4678+ *output_ << "#################################################################################" << std::endl;
4679+}
4680
4681=== modified file 'tools/SampleAnalyzer/Writer/WriterTextBase.h'
4682--- tools/SampleAnalyzer/Writer/WriterTextBase.h 2013-05-17 06:19:22 +0000
4683+++ tools/SampleAnalyzer/Writer/WriterTextBase.h 2013-06-13 12:22:26 +0000
4684@@ -52,6 +52,8 @@
4685 /// Streaming for reading input
4686 std::ostream* output_;
4687
4688+ /// Configuration
4689+ const Configuration* cfg_;
4690
4691 // -------------------------------------------------------------
4692 // method members
4693@@ -71,7 +73,8 @@
4694 }
4695
4696 /// Initialize
4697- virtual bool Initialize(const std::string& filename);
4698+ virtual bool Initialize(const Configuration* cfg,
4699+ const std::string& filename);
4700
4701 /// Read the sample (virtual pure)
4702 virtual bool WriteHeader(const SampleFormat& mySample) = 0;
4703@@ -85,6 +88,9 @@
4704
4705 /// Finalize
4706 virtual bool Finalize();
4707+
4708+ /// MA5 logo
4709+ void WriteMA5header();
4710
4711 };
4712

Subscribers

People subscribed via source and target branches

to all changes: