Merge lp:~ma5dev/madanalysis5/v1.5beta into lp:madanalysis5

Proposed by Eric Conte
Status: Merged
Merged at revision: 116
Proposed branch: lp:~ma5dev/madanalysis5/v1.5beta
Merge into: lp:madanalysis5
Diff against target: 1018 lines (+103/-851) (has conflicts)
6 files modified
bin/ma5 (+5/-0)
madanalysis/UpdateNotes.txt (+70/-0)
madanalysis/interpreter/interpreter.py (+26/-20)
tools/SampleAnalyzer/Commons/Base/Configuration.cpp (+2/-2)
tools/SampleAnalyzer/Interfaces/fastjet/JetClusteringFastJet.bak (+0/-345)
tools/SampleAnalyzer/Process/Analyzer/MergingPlots.bak (+0/-484)
Text conflict in bin/ma5
Text conflict in madanalysis/UpdateNotes.txt
To merge this branch: bzr merge lp:~ma5dev/madanalysis5/v1.5beta
Reviewer Review Type Date Requested Status
MadAnalysisTeam Pending
Review via email: mp+313621@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/ma5'
2--- bin/ma5 2016-12-12 11:48:45 +0000
3+++ bin/ma5 2016-12-20 15:49:11 +0000
4@@ -62,8 +62,13 @@
5
6 # Release version
7 # Do not touch it !!!!!
8+<<<<<<< TREE
9 version = "1.5"
10 date = "2016/12/12"
11+=======
12+version = "1.5.33"
13+date = "2016/12/20"
14+>>>>>>> MERGE-SOURCE
15
16 # Loading the MadAnalysis session
17 import madanalysis.core.launcher
18
19=== modified file 'madanalysis/UpdateNotes.txt'
20--- madanalysis/UpdateNotes.txt 2016-12-12 11:48:45 +0000
21+++ madanalysis/UpdateNotes.txt 2016-12-20 15:49:11 +0000
22@@ -1,5 +1,6 @@
23 Update notes for MadAnalysis 5 (in reverse time order)
24
25+<<<<<<< TREE
26 159 1.5 (2016/11/14) ma5team: - embedded into MadGraph
27 - FIFO mode for MadGraph
28 - No more RecastingTools
29@@ -10,6 +11,75 @@
30 - protections added for PADMA5tune and delphesMA5tune -> not
31 compatible with root 6
32 - extend the list of recasted analyses
33+=======
34+172 (2016/12/20) econte: y
35+
36+171 (2016/12/20) econte: restart in script mode
37+
38+170 (2016/12/19) econte: test
39+
40+169 (2016/12/19) econte: test
41+
42+168 (2016/12/19) econte: test
43+
44+167 (2016/12/19) econte: test
45+
46+166 (2016/12/19) econte: test
47+
48+165 (2016/12/19) econte: removed unuseless files
49+
50+159 1.5.25 (2016/11/14) fuks: Bug fix in the madgraph interface (multiparticles)
51+
52+158 1.5.24 (2016/10/28) fuks: Bug in the eflow isolation
53+
54+157 1.5.23 (2016/10/27) fuks: Fixing root detection issue
55+
56+153 1.5.22 (2016/09/21) fuks: Fixing matplotlib installation
57+
58+150 1.5.21 (2016/09/03) fuks: Fixing the mg5-ma5 interface
59+
60+149 1.5.20 (2016/09/03) fuks: fixing last few things for the mg5-ma5 interface
61+
62+148 1.5.19 (2016/09/02) fuks: ma5-mg5 interface
63+
64+147 1.5.18 (2016/09/01) fuks: small fixes for the mg5-ma5 interface
65+
66+146 1.5.17 (2016/09/01) fuks: Fixing fastjet plots for the mg5-ma5 interface
67+
68+145 1.5.16 (2016/09/01) fuks: ma5-mg5 interface
69+
70+144 1.5.15 (2016/09/01) fuks: Fixing installation options for the mg5-ma5 interface
71+
72+142 1.5.14 (2016/09/01) fuks: Protections added for PADMA5tune and delphesMA5tune -> not
73+ compatible with root 6
74+
75+141 1.5.13 (2016/09/01) fuks: gzip fix
76+
77+140 1.5.12 (2016/09/01) fuks: FIFO step 1
78+
79+137 1.5.11 (2016/08/30) fuks: Few bugs in the detection module
80+
81+133 1.5.10 (2016/08/30) fuks: Fixing last bugs for the ma5-mg5 interface
82+
83+131 1.5.9 (2016/08/30) fuks: Fixing ma5-mg5 interface issues
84+
85+127 1.5.8 (2016/08/30) fuks: Fixing issues related to the mg5_amc interface
86+
87+121 1.5.7 (2016/08/26) fuks: fixing a few bugs
88+
89+120 1.5.6 (2016/08/26) fuks: Fixing a few bugs
90+
91+119 1.5.5 (2016/08/24) fuks: Small bug with the colors
92+
93+118 1.5.4 (2016/07/24) fuks: Fixing bugs in the recasting module when negative weights are around
94+
95+117 1.5.3 (2016/07/24) fuks: Fixing a few bug in the recasting module (reading of the recasting
96+ card)
97+
98+115 1.6 (2016/07/23) fuks: No more RecastingTools
99+
100+114 1.5 (2016/07/23) fuks: Fixing the root detection with the delphes activation methods
101+>>>>>>> MERGE-SOURCE
102
103 111 1.4 (2016/07/20) ma5team: - Root is now optional and Pyroot is not a requirement anymore
104 - matplotlib can be used for the histograms
105
106=== modified file 'madanalysis/interpreter/interpreter.py'
107--- madanalysis/interpreter/interpreter.py 2016-12-08 10:28:55 +0000
108+++ madanalysis/interpreter/interpreter.py 2016-12-20 15:49:11 +0000
109@@ -200,29 +200,35 @@
110 # Restart
111 def do_restart(self, line):
112 """ sending a signal allowing to restart the interpreter """
113+
114+ # Restart not available in script mode
115+ # avoiding that the script is read from the beginning
116 if self.main.script:
117 logging.getLogger('MA5').warning("'restart' command is not allowed in script mode.")
118+ return None
119+
120+ # Asking the safety question
121+ YES=True
122+ if not Main.forced:
123+ logging.getLogger('MA5').warning("Are you sure to restart the MadAnalysis 5 session? (Y/N)")
124+ allowed_answers=['n','no','y','yes']
125+ answer=""
126+ while answer not in allowed_answers:
127+ answer=raw_input("Answer: ")
128+ answer=answer.lower()
129+ if answer=="no" or answer=="n":
130+ YES=False
131+ break
132+ elif answer=='yes' or answer=='y':
133+ YES=True
134+ break
135+
136+ # Restart?
137+ if YES:
138+ self.main.repeatSession=True
139+ return True
140 else:
141- YES=False
142- # Asking the safety question
143- if not Main.forced:
144- logging.getLogger('MA5').warning("Are you sure to restart the MadAnalysis 5 session? (Y/N)")
145- allowed_answers=['n','no','y','yes']
146- answer=""
147- while answer not in allowed_answers:
148- answer=raw_input("Answer: ")
149- answer=answer.lower()
150- if answer=="no" or answer=="n":
151- YES=False
152- break
153- elif answer=='yes' or answer=='y':
154- YES=True
155- break
156- if YES:
157- self.main.repeatSession=True
158- return True
159- else:
160- pass
161+ return None
162
163 def help_restart(self):
164 logging.getLogger('MA5').info(" Syntax: restart ")
165
166=== modified file 'tools/SampleAnalyzer/Commons/Base/Configuration.cpp'
167--- tools/SampleAnalyzer/Commons/Base/Configuration.cpp 2016-11-14 10:06:38 +0000
168+++ tools/SampleAnalyzer/Commons/Base/Configuration.cpp 2016-12-20 15:49:11 +0000
169@@ -40,8 +40,8 @@
170 // Initializing static data members
171 // -----------------------------------------------------------------------------
172 // DO NOT TOUCH THESE LINES
173-const std::string Configuration::sampleanalyzer_version_ = "1.5.25";
174-const std::string Configuration::sampleanalyzer_date_ = "2016/11/14";
175+const std::string Configuration::sampleanalyzer_version_ = "1.5.33";
176+const std::string Configuration::sampleanalyzer_date_ = "2016/12/20";
177 // DO NOT TOUCH THESE LINES
178
179 // -----------------------------------------------------------------------------
180
181=== removed file 'tools/SampleAnalyzer/Interfaces/fastjet/JetClusteringFastJet.bak'
182--- tools/SampleAnalyzer/Interfaces/fastjet/JetClusteringFastJet.bak 2014-05-30 16:41:57 +0000
183+++ tools/SampleAnalyzer/Interfaces/fastjet/JetClusteringFastJet.bak 1970-01-01 00:00:00 +0000
184@@ -1,345 +0,0 @@
185-////////////////////////////////////////////////////////////////////////////////
186-//
187-// Copyright (C) 2012-2013 Eric Conte, Benjamin Fuks
188-// The MadAnalysis development team, email: <ma5team@iphc.cnrs.fr>
189-//
190-// This file is part of MadAnalysis 5.
191-// Official website: <https://launchpad.net/madanalysis5>
192-//
193-// MadAnalysis 5 is free software: you can redistribute it and/or modify
194-// it under the terms of the GNU General Public License as published by
195-// the Free Software Foundation, either version 3 of the License, or
196-// (at your option) any later version.
197-//
198-// MadAnalysis 5 is distributed in the hope that it will be useful,
199-// but WITHOUT ANY WARRANTY; without even the implied warranty of
200-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
201-// GNU General Public License for more details.
202-//
203-// You should have received a copy of the GNU General Public License
204-// along with MadAnalysis 5. If not, see <http://www.gnu.org/licenses/>
205-//
206-////////////////////////////////////////////////////////////////////////////////
207-
208-
209-//SampleAnalyser headers
210-#include "SampleAnalyzer/Interfaces/fastjet/JetClusteringFastJet.h"
211-#include "SampleAnalyzer/Commons/Service/LoopService.h"
212-
213-//FastJet headers
214-#include <fastjet/ClusterSequence.hh>
215-#include <fastjet/PseudoJet.hh>
216-
217-using namespace MA5;
218-
219-
220-JetClusteringFastJet::JetClusteringFastJet(std::string Algo):JetClusterAlgoBase(Algo)
221-{ JetAlgorithm_=Algo; JetDefinition_=0; }
222-
223-JetClusteringFastJet::~JetClusteringFastJet()
224-{ if (JetDefinition_!=0) delete JetDefinition_; }
225-
226-
227-void JetClusteringFastJet::GetFinalState(const MCParticleFormat* part, std::set<const MCParticleFormat*>& finalstates)
228-{
229- for (unsigned int i=0; i<part->daughters().size(); i++)
230- {
231- if (PHYSICS->Id->IsFinalState(part->daughters()[i])) finalstates.insert(part->daughters()[i]);
232- else return GetFinalState(part->daughters()[i],finalstates);
233- }
234-}
235-
236-Bool_t JetClusteringFastJet::IsLast(const MCParticleFormat* part, EventFormat& myEvent)
237-{
238- for (unsigned int i=0; i<part->daughters().size(); i++)
239- {
240- if (part->daughters()[i]->pdgid()==part->pdgid()) return false;
241- }
242- return true;
243-}
244-
245-
246-bool JetClusteringFastJet::Execute(SampleFormat& mySample, EventFormat& myEvent)
247-{
248- // Veto
249- std::vector<bool> vetos(myEvent.mc()->particles().size(),false);
250- std::set<const MCParticleFormat*> vetos2;
251-
252- // Filling the dataformat with electron/muon
253- for (unsigned int i=0;i<myEvent.mc()->particles().size();i++)
254- {
255- const MCParticleFormat& part = myEvent.mc()->particles()[i];
256- UInt_t absid = std::abs(part.pdgid());
257-
258- // Rejecting particle with a null pt (initial state ?)
259- if (part.pt()<1e-10) continue;
260-
261- // Treating intermediate particles
262- if (PHYSICS->Id->IsInterState(part))
263- {
264- // rejecting not interesting particles
265- if (absid!=5 && absid!=4 && absid!=15) continue;
266-
267- // keeping the last particle with the same id in the decay chain
268- if (!IsLast(&part, myEvent)) continue;
269-
270- // looking for b quarks
271- if (absid==5)
272- {
273- bool found=false;
274- for (unsigned int j=0;j<myEvent.rec()->MCBquarks_.size();j++)
275- {
276- if (myEvent.rec()->MCBquarks_[j]==&(part))
277- {found=true; break;}
278- }
279- if (!found) myEvent.rec()->MCBquarks_.push_back(&(part));
280- }
281-
282- // looking for c quarks
283- else if (absid==4)
284- {
285- bool found=false;
286- for (unsigned int j=0;j<myEvent.rec()->MCCquarks_.size();j++)
287- {
288- if (myEvent.rec()->MCCquarks_[j]==&(part))
289- {found=true; break;}
290- }
291- if (!found) myEvent.rec()->MCCquarks_.push_back(&(part));
292- }
293-
294- // looking for taus
295- else if (absid==15)
296- {
297- // rejecting particle if coming from hadronization
298- if (LOOP->ComingFromHadronDecay(&part,mySample)) continue;
299-
300- // Looking taus daughters id
301- bool leptonic = true;
302- bool muonic = false;
303- bool electronic = false;
304- for (unsigned int j=0;j<part.daughters().size();j++)
305- {
306- UInt_t pdgid = std::abs(part.daughters()[j]->pdgid());
307- if (pdgid==13) muonic=true;
308- else if (pdgid==11) electronic=true;
309- else if (pdgid!=22 /*photons*/ &&
310- !(pdgid>=11 && pdgid<=16) /*neutrinos*/)
311- leptonic=false;
312- }
313- if (!leptonic) {muonic=false; electronic=false;}
314-
315- // Saving taus decaying into muons (only one copy)
316- if (muonic)
317- {
318- bool found=false;
319- for (unsigned int j=0;j<myEvent.rec()->MCMuonicTaus_.size();j++)
320- {
321- if (myEvent.rec()->MCMuonicTaus_[j]==&(part))
322- {found=true; break;}
323- }
324- if (!found) myEvent.rec()->MCMuonicTaus_.push_back(&(part));
325- }
326-
327- // Saving taus decaying into electrons (only one copy)
328- else if (electronic)
329- {
330- bool found=false;
331- for (unsigned int j=0;j<myEvent.rec()->MCElectronicTaus_.size();j++)
332- {
333- if (myEvent.rec()->MCElectronicTaus_[j]==&(part))
334- {found=true; break;}
335- }
336- if (!found) myEvent.rec()->MCElectronicTaus_.push_back(&(part));
337- }
338-
339- // Saving taus decaying into hadrons (only copy)
340- else
341- {
342- bool found=false;
343- for (unsigned int j=0;j<myEvent.rec()->MCHadronicTaus_.size();j++)
344- {
345- if (myEvent.rec()->MCHadronicTaus_[j]==&(part))
346- {found=true; break;}
347- }
348- if (!found)
349- {
350- // Saving the hadrons in MC container
351- myEvent.rec()->MCHadronicTaus_.push_back(&(part));
352-
353- // Applying efficiency
354- if (!myTAUtagger_->IsIdentified()) continue;
355-
356- // Creating reco hadronic taus
357- RecTauFormat* myTau = myEvent.rec()->GetNewTau();
358- if (part.pdgid()>0) myTau->setCharge(-1);
359- else myTau->setCharge(+1);
360- myTau->setMomentum(part.momentum());
361- myTau->setMc(&part);
362- myTau->setDecayMode(PHYSICS->GetTauDecayMode(myTau->mc()));
363- if (myTau->DecayMode()<=0) myTau->setNtracks(0); // ERROR case
364- else if (myTau->DecayMode()==7 ||
365- myTau->DecayMode()==9) myTau->setNtracks(3); // 3-Prong
366- else myTau->setNtracks(1); // 1-Prong
367-
368- // Searching final state
369- GetFinalState(&part,vetos2);
370- }
371- }
372- }
373- }
374-
375- // Keeping only final states
376- else if (PHYSICS->Id->IsFinalState(part))
377- {
378- // keeping only electron, muon and photon
379- if (absid!=22 && absid!=11 && absid!=13) continue;
380-
381- // rejecting particle if coming from hadronization
382- if (ExclusiveId_ && LOOP->ComingFromHadronDecay(&part,mySample)) continue;
383-
384- // Muons
385- if (absid==13)
386- {
387- vetos[i]=true;
388- RecLeptonFormat * muon = myEvent.rec()->GetNewMuon();
389- muon->setMomentum(part.momentum());
390- muon->setMc(&(part));
391- if (part.pdgid()==13) muon->SetCharge(-1);
392- else muon->SetCharge(+1);
393- }
394-
395- // Electrons
396- else if (absid==11)
397- {
398- vetos[i]=true;
399- RecLeptonFormat * elec = myEvent.rec()->GetNewElectron();
400- elec->setMomentum(part.momentum());
401- elec->setMc(&(part));
402- if (part.pdgid()==11) elec->SetCharge(-1);
403- else elec->SetCharge(+1);
404- }
405-
406- // Photons
407- else if (absid==22)
408- {
409- if (LOOP->IrrelevantPhoton(&part,mySample)) continue;
410- vetos[i]=true;
411- RecPhotonFormat * photon = myEvent.rec()->GetNewPhoton();
412- photon->setMomentum(part.momentum());
413- photon->setMc(&(part));
414- }
415- }
416- }
417-
418- double & TET = myEvent.rec()->TET();
419- double & THT = myEvent.rec()->THT();
420-
421- // Preparing inputs
422- std::vector<fastjet::PseudoJet> inputs;
423- for (unsigned int i=0;i<myEvent.mc()->particles().size();i++)
424- {
425- const MCParticleFormat& part = myEvent.mc()->particles()[i];
426-
427- // Selecting input for jet clustering
428- if (myEvent.mc()->particles()[i].statuscode()!=1) continue;
429- if (PHYSICS->Id->IsInvisible(myEvent.mc()->particles()[i])) continue;
430-
431- // ExclusiveId mode
432- if (ExclusiveId_)
433- {
434- if (vetos[i]) continue;
435- if (vetos2.find(&part)!=vetos2.end()) continue;
436- }
437-
438- // NonExclusive Id mode
439- else if (std::abs(myEvent.mc()->particles()[i].pdgid())==13) continue;
440-
441- // Filling good particle for clustering
442- inputs.push_back(
443- fastjet::PseudoJet ( myEvent.mc()->particles()[i].px(),
444- myEvent.mc()->particles()[i].py(),
445- myEvent.mc()->particles()[i].pz(),
446- myEvent.mc()->particles()[i].e() ));
447- inputs.back().set_user_index(i);
448- }
449-
450- // Clustering
451- fastjet::ClusterSequence clust_seq(inputs, *JetDefinition_);
452-
453- // Getting jets with PTmin = 0
454- std::vector<fastjet::PseudoJet> jets;
455- if (Exclusive_) jets = clust_seq.exclusive_jets(0.);
456- else jets = clust_seq.inclusive_jets(0.);
457-
458- // Calculating the MET
459- ParticleBaseFormat* MET = myEvent.rec()->GetNewMet();
460- ParticleBaseFormat* MHT = myEvent.rec()->GetNewMht();
461-
462- for (unsigned int i=0;i<jets.size();i++)
463- {
464- TLorentzVector q(jets[i].px(),jets[i].py(),jets[i].pz(),jets[i].e());
465- (*MET) -= q;
466- (*MHT) -= q;
467- THT += jets[i].pt();
468- TET += jets[i].pt();
469- }
470-
471- // Getting jets with PTmin
472- if (Exclusive_) jets = clust_seq.exclusive_jets(Ptmin_);
473- else jets = clust_seq.inclusive_jets(Ptmin_);
474-
475- // Filling the dataformat with jets
476- for (unsigned int i=0;i<jets.size();i++)
477- {
478- RecJetFormat * jet = myEvent.rec()->GetNewJet();
479- jet->setMomentum(TLorentzVector(jets[i].px(),jets[i].py(),jets[i].pz(),jets[i].e()));
480- std::vector<fastjet::PseudoJet> constituents = clust_seq.constituents(jets[i]);
481- UInt_t tracks = 0;
482- for (unsigned int j=0;j<constituents.size();j++)
483- {
484- jet->AddConstituent(constituents[j].user_index());
485- // if (std::abs(myEvent.mc()->particles()[constituents[j].user_index()].pdgid())==11) continue;
486- if (PDG->IsCharged(myEvent.mc()->particles()[constituents[j].user_index()].pdgid())) tracks++;
487- }
488- jet->ntracks_ = tracks;
489- }
490-
491-
492- if (ExclusiveId_)
493- {
494- for (unsigned int i=0;i<myEvent.rec()->electrons().size();i++)
495- {
496- (*MET) -= myEvent.rec()->electrons()[i].momentum();
497- TET += myEvent.rec()->electrons()[i].pt();
498- }
499- for (unsigned int i=0;i<myEvent.rec()->photons().size();i++)
500- {
501- (*MET) -= myEvent.rec()->photons()[i].momentum();
502- TET += myEvent.rec()->photons()[i].pt();
503- }
504- for (unsigned int i=0;i<myEvent.rec()->taus().size();i++)
505- {
506- (*MET) -= myEvent.rec()->taus()[i].momentum();
507- TET += myEvent.rec()->taus()[i].pt();
508- }
509- }
510-
511- for (unsigned int i=0;i<myEvent.rec()->muons().size();i++)
512- {
513- (*MET) -= myEvent.rec()->muons()[i].momentum();
514- TET += myEvent.rec()->muons()[i].pt();
515- }
516-
517- MET->momentum().SetPz(0.);
518- MET->momentum().SetE(MET->momentum().Pt());
519- MHT->momentum().SetPz(0.);
520- MHT->momentum().SetE(MHT->momentum().Pt());
521-
522- myBtagger_->Execute(mySample,myEvent);
523- myTAUtagger_->Execute(mySample,myEvent);
524-
525-
526- return true;
527-}
528-
529-
530
531=== removed file 'tools/SampleAnalyzer/Process/Analyzer/MergingPlots.bak'
532--- tools/SampleAnalyzer/Process/Analyzer/MergingPlots.bak 2014-05-30 09:59:33 +0000
533+++ tools/SampleAnalyzer/Process/Analyzer/MergingPlots.bak 1970-01-01 00:00:00 +0000
534@@ -1,484 +0,0 @@
535-////////////////////////////////////////////////////////////////////////////////
536-//
537-// Copyright (C) 2012-2013 Eric Conte, Benjamin Fuks
538-// The MadAnalysis development team, email: <ma5team@iphc.cnrs.fr>
539-//
540-// This file is part of MadAnalysis 5.
541-// Official website: <https://launchpad.net/madanalysis5>
542-//
543-// MadAnalysis 5 is free software: you can redistribute it and/or modify
544-// it under the terms of the GNU General Public License as published by
545-// the Free Software Foundation, either version 3 of the License, or
546-// (at your option) any later version.
547-//
548-// MadAnalysis 5 is distributed in the hope that it will be useful,
549-// but WITHOUT ANY WARRANTY; without even the implied warranty of
550-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
551-// GNU General Public License for more details.
552-//
553-// You should have received a copy of the GNU General Public License
554-// along with MadAnalysis 5. If not, see <http://www.gnu.org/licenses/>
555-//
556-////////////////////////////////////////////////////////////////////////////////
557-
558-
559-//SampleAnalyzer headers
560-#include "SampleAnalyzer/Process/Analyzer/MergingPlots.h"
561-#include "SampleAnalyzer/Commons/Base/Configuration.h"
562-#include "SampleAnalyzer/Commons/Service/Physics.h"
563-#include "SampleAnalyzer/Commons/Service/CompilationService.h"
564-
565-
566-//STL headers
567-#include <sstream>
568-
569-
570-using namespace MA5;
571-
572-/*
573-extern"C"
574-{
575- void ktclus_(int *imode, double PP[512][4], int* NN, double* ECUT, double Y[512]);
576-}
577-*/
578-
579-
580-bool MergingPlots::Initialize(const Configuration& cfg,
581- const std::map<std::string,std::string>& parameters)
582-{
583- // Options
584- merging_njets_=0;
585- merging_nqmatch_=4;
586- merging_nosingrad_=false;
587-
588- // Reading options
589- for (std::map<std::string,std::string>::const_iterator it=parameters.begin();
590- it!=parameters.end();it++)
591- {
592- if (it->first=="njets")
593- {
594- std::stringstream str;
595- str << it->second;
596- str >> merging_njets_;
597- }
598- else
599- {
600- WARNING << "parameter '" << it->first
601- << "' is unknown and will be ignored." << endmsg;
602- }
603- }
604-
605- // Initializing DJR plots
606- if (merging_njets_==0)
607- {
608- ERROR << "number of jets requested for DJR plots is zero" << endmsg;
609- return false;
610- }
611- DJR_.resize(merging_njets_);
612- for (unsigned int i=0;i<DJR_.size();i++)
613- {
614- std::stringstream str;
615- str << "DJR" << i+1;
616- std::string title;
617- str >> title;
618- DJR_[i].Initialize(DJR_.size()+1,title);
619- }
620-
621- // Initializing clustering algorithm
622- JetDefinition_ = new fastjet::JetDefinition(fastjet::kt_algorithm,1.0);
623- return true;
624-}
625-
626-
627-void MergingPlots::Execute(SampleFormat& mySample, const EventFormat& myEvent)
628-{
629- // Safety
630- if (mySample.mc()==0) return;
631- if (myEvent.mc()==0) return;
632-
633- // Getting number of additional jets in the event
634- UInt_t njets = ExtractJetNumber(myEvent.mc(),mySample.mc());
635- if (njets>DJR_.size()) return;
636-
637- // Preparing inputs
638- std::vector<fastjet::PseudoJet> inputs;
639- SelectParticles(inputs,myEvent.mc());
640-
641- // Getting DJR observables
642- std::vector<Double_t> DJRvalues(DJR_.size(),0.);
643- ExtractDJR(inputs,DJRvalues);
644-
645-
646- // Getting results
647- for (unsigned int i=0;i<DJR_.size();i++)
648- {
649- /* { double djr = std::log10(sqrt(DJRvalues[i]));
650- if (i==1 && njets==1 && djr > 1.8)
651- {
652- for (unsigned int j=0;j<myEvent->particles().size();j++)
653- {
654- bool accept=true;
655-
656- // Selecting partons (but not top quark)
657- if (fabs(myEvent->particles()[j].pdgid())>5 &&
658- myEvent->particles()[j].pdgid()!=21) accept=false;
659-
660- // Selecting final states
661- if (myEvent->particles()[j].statuscode()!=2) accept=false;
662-
663- // Selecting states not coming from proton (beam remnant)
664- if (myEvent->particles()[j].mothup1_==1) accept=false;
665- if (myEvent->particles()[j].mothup1_==2) accept=false;
666-
667- const MCParticleFormat* myPart = &(myEvent->particles()[j]);
668- bool test=true;
669- while (myPart->mother1()!=0)
670- {
671- if (myPart->mothup1_==1 || myPart->mothup1_==2)
672- { test=false; break;}
673- else if (myPart->mothup1_<=6)
674- { test=true; break;}
675- else if (myPart->mother1()->pdgid()==91 ||
676- myPart->mother1()->pdgid()==92)
677- {test=false; break;}
678- myPart = myPart->mother1();
679- }
680- if (!test) accept=false;
681-
682- if (fabs(myEvent->particles()[j].momentum().Rapidity())>5.0) accept=false;
683-
684- double PTJET=sqrt( myEvent->particles()[j].momentum().Px()*myEvent->particles()[j].momentum().Px() +
685- myEvent->particles()[j].momentum().Py()*myEvent->particles()[j].momentum().Py() );
686- double ETAJET=fabs(log(std::min((sqrt(PTJET*PTJET+myEvent->particles()[j].momentum().Pz()*myEvent->particles()[j].momentum().Pz())
687- +fabs( myEvent->particles()[j].momentum().Pz() ))/PTJET,1e5)));
688-
689-
690- std::cout << "i=" << j+1
691- << " ; id=" << myEvent->particles()[j].pdgid()
692- << " ; s=" << myEvent->particles()[j].statuscode()
693- << " ; m1=" << myEvent->particles()[j].mothup1_
694- << " ; m2=" << myEvent->particles()[j].mothup2_
695- << " ; eta=" << ETAJET
696- << " ; rap=" << myEvent->particles()[j].momentum().Rapidity();
697-
698- if (accept) std::cout << " - ACCEPT";
699- std::cout << std::endl;
700- }
701- // exit(1);
702- }
703- }
704- */
705- double djr = 0;
706- if (DJRvalues[i]>0) djr = std::log10(sqrt(DJRvalues[i]));
707- DJR_[i].total->Fill(djr);
708- DJR_[i].contribution[njets]->Fill(djr);
709- }
710-
711-}
712-
713-void MergingPlots::Finalize(const SampleFormat& summary, const std::vector<SampleFormat>& files)
714-{
715- // Saving plots into file
716- Write_TextFormat(out());
717-
718- // Deleting plots
719- for (unsigned int i=0;i<DJR_.size();i++)
720- {
721- DJR_[i].Finalize();
722- }
723- DJR_.clear();
724-
725- // Free memory allocation
726- if (JetDefinition_==0) delete JetDefinition_;
727-}
728-
729-
730-
731-
732-Double_t MergingPlots::rapidity(Double_t px, Double_t py, Double_t pz)
733-{
734- double PTJET = sqrt( px*px + py*py);
735- return fabs(log(std::min((sqrt(PTJET*PTJET+pz*pz)+fabs(pz ))/PTJET,1e5)));
736-}
737-
738-
739-void MergingPlots::ExtractDJRwithFortran(const std::vector<fastjet::PseudoJet>& inputs,std::vector<Double_t>& DJRvalues)
740-{
741- double PP[512][4];
742- UNUSED(PP);
743- for (unsigned int i=0;i<inputs.size();i++)
744- {
745- PP[i][0]=inputs[i].px();
746- PP[i][1]=inputs[i].py();
747- PP[i][2]=inputs[i].pz();
748- PP[i][3]=inputs[i].e();
749- }
750- // int IMODE = 4313;
751- // int NN = inputs.size();
752- // if (NN>512) NN=512;
753- // double ECUT=1.;
754- double Y[512];
755- for (unsigned int i=0;i<512;i++) Y[i]=0;
756- //if (NN!=0) ktclus_(&IMODE,PP,&NN,&ECUT,Y);
757-
758- for (unsigned int i=0;i<DJRvalues.size();i++)
759- DJRvalues[i]=Y[i];
760-}
761-
762-void MergingPlots::ExtractDJR(const std::vector<fastjet::PseudoJet>& inputs,std::vector<Double_t>& DJRvalues)
763-{
764- // JetDefinition_
765- fastjet::ClusterSequence sequence(inputs, *JetDefinition_);
766- for (unsigned int i=0;i<DJRvalues.size();i++)
767- DJRvalues[i]=sequence.exclusive_dmerge(i);
768-}
769-
770-
771-/// Saving merging plots in the text output file
772-void MergingPlots::Write_TextFormat(SAFWriter& output)
773-{
774- *output.GetStream() << "<MergingPlots>" << std::endl;
775- for (unsigned int i=0;i<DJR_.size();i++)
776- {
777- DJR_[i].total->Write_TextFormat(output.GetStream());
778- for (unsigned int j=0;j<DJR_[i].contribution.size();j++)
779- {
780- DJR_[i].contribution[j]->Write_TextFormat(output.GetStream());
781- }
782- }
783- *output.GetStream() << "</MergingPlots>" << std::endl;
784-}
785-
786-
787-Bool_t MergingPlots::SavePlots(const std::string& filename)
788-{
789- // Opening output file
790- TFile* output = TFile::Open(filename.c_str(),"UPDATE");
791- if (!output->IsOpen())
792- {
793- ERROR << "Output file called '" << filename
794- << "' is not found" << endmsg;
795- return false;
796- }
797-
798- // Writing ROOT file
799- Write_RootFormat(output);
800- return true;
801-}
802-
803-/// Saving merging plots in the ROOT output file
804-void MergingPlots::Write_RootFormat(TFile* output)
805-{
806- // Creating folder
807- output->mkdir("merging");
808- output->cd("merging");
809-
810- // Saving plots
811- std::pair<TH1F*,TH1F*> histo;
812- for (unsigned int i=0;i<DJR_.size();i++)
813- {
814- // Contribution
815- for (unsigned int j=0;j<DJR_[i].contribution.size();j++)
816- {
817- std::stringstream str;
818- str << "DJR" << i+1;
819- str << "_" << j << "jet";
820- std::string title;
821- str >> title;
822- histo.first = new TH1F((title+"_pos").c_str(),"",100,0,100);
823- histo.second = new TH1F((title+"_neg").c_str(),"",100,0,100);
824- DJR_[i].contribution[j]->Write_RootFormat(histo);
825- histo.first->Write();
826- histo.second->Write();
827- }
828-
829- // total
830- std::stringstream str;
831- str << "DJR" << i+1;
832- str << "_total";
833- std::string title;
834- str >> title;
835- histo.first = new TH1F((title+"_pos").c_str(),"",100,0,100);
836- histo.second = new TH1F((title+"_neg").c_str(),"",100,0,100);
837- DJR_[i].total->Write_RootFormat(histo);
838- histo.first->Write();
839- histo.second->Write();
840- }
841- output->cd("");
842-}
843-
844-/// Selecting particles for non-hadronized events
845-void MergingPlots::SelectParticles_NonHadronization(std::vector<fastjet::PseudoJet>& inputs, const MCEventFormat* myEvent)
846-{
847- for (unsigned int i=6;i<myEvent->particles().size();i++)
848- {
849- // Selecting partons (but not top quark)
850- if (fabs(myEvent->particles()[i].pdgid())>5 &&
851- myEvent->particles()[i].pdgid()!=21) continue;
852-
853- // Selecting final states
854- if (myEvent->particles()[i].statuscode()==3) continue;
855-
856- // Selecting states not coming from initial proton (beam remnant)
857- // or hadronization
858- const MCParticleFormat* myPart = &(myEvent->particles()[i]);
859- bool test=true;
860- while (myPart->mother1()!=0)
861- {
862- if (myPart->mothup1_==1 || myPart->mothup1_==2)
863- { test=false; break;}
864- else if (myPart->mothup1_<=6)
865- { test=true; break;}
866- else if (myPart->mother1()->pdgid()==91 ||
867- myPart->mother1()->pdgid()==92)
868- {test=false; break;}
869- myPart = myPart->mother1();
870- }
871- if (!test) continue;
872-
873- // Cut on the rapidity
874- double ETAJET = rapidity(myEvent->particles()[i].momentum().Px(),
875- myEvent->particles()[i].momentum().Py(),
876- myEvent->particles()[i].momentum().Pz());
877- if (fabs(ETAJET)>5) continue;
878-
879- // add the particle
880- inputs.push_back(fastjet::PseudoJet ( myEvent->particles()[i].px(),
881- myEvent->particles()[i].py(),
882- myEvent->particles()[i].pz(),
883- myEvent->particles()[i].e() ) );
884-
885- // labeling the particle
886- inputs.back().set_user_index(i);
887- }
888-}
889-
890-
891-/// Selecting particles for non-hadronized events
892-void MergingPlots::SelectParticles(std::vector<fastjet::PseudoJet>& inputs,
893- const MCEventFormat* myEvent)
894-{
895- for (unsigned int i=6;i<myEvent->particles().size();i++)
896- {
897- // Selecting partons (but not top quark)
898- if (fabs(myEvent->particles()[i].pdgid())>5 &&
899- myEvent->particles()[i].pdgid()!=21) continue;
900-
901- // Selecting final states
902- if (myEvent->particles()[i].statuscode()!=2) continue;
903-
904- // Selecting states not coming from initial proton (beam remnant)
905- // or hadronization
906- const MCParticleFormat* myPart = &(myEvent->particles()[i]);
907- bool test=true;
908- while (myPart->mother1()!=0)
909- {
910- if (myPart->mothup1_==1 || myPart->mothup1_==2)
911- { test=false; break;}
912- else if (myPart->mothup1_<=6)
913- { test=true; break;}
914- else if (myPart->mother1()->pdgid()==91 ||
915- myPart->mother1()->pdgid()==92)
916- {test=false; break;}
917- myPart = myPart->mother1();
918- }
919- if (!test) continue;
920-
921- // Cut on the rapidity
922- double ETAJET = rapidity(myEvent->particles()[i].momentum().Px(),
923- myEvent->particles()[i].momentum().Py(),
924- myEvent->particles()[i].momentum().Pz());
925- if (fabs(ETAJET)>5) continue;
926-
927- // Remove double counting
928- if (myEvent->particles()[i].mother1()!=0 && myPart->mother2()==0)
929- {
930- if (myEvent->particles()[i].pdgid()==myEvent->particles()[i].mother1()->pdgid() &&
931- myEvent->particles()[i].statuscode()==myEvent->particles()[i].mother1()->statuscode() &&
932- fabs(myEvent->particles()[i].px()-myEvent->particles()[i].mother1()->px())<1e-04 &&
933- fabs(myEvent->particles()[i].py()-myEvent->particles()[i].mother1()->py())<1e-04 &&
934- fabs(myEvent->particles()[i].pz()-myEvent->particles()[i].mother1()->pz())<1e-04 )
935- continue;
936- }
937-
938- // add the particle
939- inputs.push_back(fastjet::PseudoJet ( myEvent->particles()[i].px(),
940- myEvent->particles()[i].py(),
941- myEvent->particles()[i].pz(),
942- myEvent->particles()[i].e() ) );
943-
944- // labeling the particle
945- inputs.back().set_user_index(i);
946- }
947-}
948-
949-
950-
951-/// Number of jets
952-UInt_t MergingPlots::ExtractJetNumber( const MCEventFormat* myEvent,
953- MCSampleFormat* mySample)
954-{
955- UInt_t njets=0;
956- for (unsigned int i=6;i<myEvent->particles().size();i++)
957- {
958- const MCParticleFormat* myPart = &myEvent->particles()[i];
959-
960- // keep particles generated during the matrix element calculation
961- if (myPart->statuscode()!=3) continue;
962-
963- // keep only partons
964- if (abs(myPart->pdgid())>merging_nqmatch_ && myPart->pdgid()!=21) continue;
965-
966- // keep only jets whose mother is one of the initial parton
967- if (myPart->mother1()==0) continue;
968-
969- // coming from initial state ?
970- if (myPart->mothup1_>6 && (myPart->mothup1_==0 || myPart->mothup2_==0)) continue;
971-
972- // removing color singlet
973- /*
974- if (merging_nosingrad_)
975- {
976- for (unsigned int j=0;j<myEvent->particles().size();j++)
977- {
978- if (i!=j) continue;
979-
980- const MCParticleFormat* myPart2 = &myEvent->particles()[j];
981-
982- // keep particles generated during the matrix element calculation
983- if (myPart2->statuscode()!=3) continue;
984-
985- // keep only partons
986- if ( myPart2->pdgid()!=-myPart->pdgid() &&
987- (myPart2->pdgid()!=21 && myPart->pdgid()!=21)) continue;
988-
989- // only final states
990-
991- }
992- }
993- */
994-
995- // count particle
996- njets++;
997- }
998- /*
999- if (njets==3)
1000- {
1001- for (unsigned int i=0;i<myEvent->particles().size();i++)
1002- {
1003- if (fabs(myEvent->particles()[i].pdgid())>5 &&
1004- myEvent->particles()[i].pdgid()!=21) continue;
1005- if (myEvent->particles()[i].statuscode()==1) continue;
1006-
1007- std::cout << "i=" << i+1
1008- << " ; id=" << myEvent->particles()[i].pdgid()
1009- << " ; s=" << myEvent->particles()[i].statuscode()
1010- << " ; m1=" << myEvent->particles()[i].mothup1_
1011- << " ; m2=" << myEvent->particles()[i].mothup2_ << std::endl;
1012- }
1013- exit(1);
1014- }
1015- */
1016- return njets;
1017-}
1018-

Subscribers

People subscribed via source and target branches