Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: New tuple tools #129

Open
wants to merge 112 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
e6d4be9
Create TupleTool
laurenyeomans May 10, 2018
8929905
Rename TupleTools to TUPLETOOLS.MD
laurenyeomans May 10, 2018
d868190
Rename TUPLETOOLS.MD to TUPLETOOLS.md
laurenyeomans May 10, 2018
4213464
Rename TUPLETOOLS.md to first_analysis_steps/TUPLETOOLS.md
laurenyeomans May 10, 2018
b90345f
Delete TUPLETOOLS.md
laurenyeomans May 10, 2018
2eaca60
Create TupleTools.md
laurenyeomans May 10, 2018
d3e3f06
Update TupleTools.md
PhillipMarshall May 10, 2018
2b6546d
Update TupleTools.md
PhillipMarshall May 10, 2018
218c18c
Update TupleTools.md
PhillipMarshall May 10, 2018
bf35a5a
Update TupleTools.md
PhillipMarshall May 10, 2018
0191e38
Update TupleTools.md
PhillipMarshall May 10, 2018
d7e8bfa
Added in a test Tuple
May 10, 2018
211d22f
Added to summary
May 10, 2018
2530aee
Edited
May 10, 2018
d91e66b
added
May 10, 2018
a913f12
d
laurenyeomans May 10, 2018
689bd33
added tuples to the summary
laurenyeomans May 10, 2018
6b066b6
sdkfn:
laurenyeomans May 10, 2018
e637c7f
Update
PhillipMarshall May 10, 2018
060a322
update
PhillipMarshall May 10, 2018
0455de8
Merge branch 'NEW_TupleTools' of https://github.com/PhillipMarshall/s…
PhillipMarshall May 10, 2018
7499984
update
PhillipMarshall May 11, 2018
62cc8ed
Update
PhillipMarshall May 11, 2018
02ed430
stuff in lists
laurenyeomans May 11, 2018
0f1367a
Update TupleTools.md
laurenyeomans May 11, 2018
ea645fe
Update TupleTools.md
laurenyeomans May 11, 2018
e3f2457
Update TupleTools.md
laurenyeomans May 11, 2018
2ed1bd4
Update
PhillipMarshall May 11, 2018
464c0fe
Update TupleTools.md
PhillipMarshall May 11, 2018
93929ed
Merge branch 'NEW_TupleTools' of https://github.com/PhillipMarshall/s…
PhillipMarshall May 11, 2018
a781825
update
PhillipMarshall May 11, 2018
c81bdb3
update
PhillipMarshall May 11, 2018
f3fd157
added descriptions
laurenyeomans May 11, 2018
e3a32ca
Update TupleTools.md
PhillipMarshall May 11, 2018
218269b
bam
PhillipMarshall May 11, 2018
271a508
woooo
PhillipMarshall May 11, 2018
fd22f6a
nice
PhillipMarshall May 11, 2018
17a47d9
Delete MCTupleToolPID.md
laurenyeomans May 11, 2018
22da4fd
Delete MCTupleToolPID2.md
laurenyeomans May 11, 2018
5f987dd
yay
PhillipMarshall May 11, 2018
138e155
Update TupleTools.md
laurenyeomans May 11, 2018
9c6bbfa
Update TupleTools.md
laurenyeomans May 11, 2018
4d35640
Update TupleTools.md
laurenyeomans May 11, 2018
2baa3e3
Update TupleTools.md
laurenyeomans May 11, 2018
5186762
Update TupleTools.md
laurenyeomans May 11, 2018
6d76d98
Update TupleTools.md
laurenyeomans May 11, 2018
1721429
Update TupleTools.md
laurenyeomans May 11, 2018
75fe769
Update TupleTools.md
laurenyeomans May 11, 2018
4d634b4
Update TupleTools.md
laurenyeomans May 11, 2018
7d2575f
Update TupleTools.md
laurenyeomans May 11, 2018
e1cdace
Update TupleTools.md
PhillipMarshall May 11, 2018
65457cf
Update TupleTools.md
PhillipMarshall May 11, 2018
1d4830c
Update TupleTools.md
PhillipMarshall May 11, 2018
765656e
Update TupleTools.md
PhillipMarshall May 11, 2018
4b0a8d1
Update TupleTools.md
PhillipMarshall May 11, 2018
e4531eb
Update TupleTools.md
PhillipMarshall May 11, 2018
1dd05a8
Update TupleTools.md
PhillipMarshall May 11, 2018
0fca831
Update TupleTools.md
PhillipMarshall May 11, 2018
a3445b6
Update SUMMARY.md
PhillipMarshall May 11, 2018
3946917
Update TupleTools.md
laurenyeomans May 11, 2018
2d9c0ee
Update TupleTools.md
laurenyeomans May 11, 2018
983cbcf
Update TupleTools.md
laurenyeomans May 11, 2018
208c69a
Update TupleTools.md
laurenyeomans May 11, 2018
d4baf91
Update TupleTools.md
laurenyeomans May 11, 2018
8b01ddc
Update TupleTools.md
laurenyeomans May 11, 2018
1eb1571
Update TupleTools.md
laurenyeomans May 11, 2018
a7fb5b5
Update TupleTools.md
PhillipMarshall May 11, 2018
8e7a12b
Update TupleTools.md
PhillipMarshall May 11, 2018
1962a06
jbjb
PhillipMarshall May 11, 2018
5681363
Merge branch 'NEW_TupleTools' of https://github.com/PhillipMarshall/s…
PhillipMarshall May 11, 2018
62ff54b
Update TupleTools.md
laurenyeomans May 11, 2018
e19b512
Update SUMMARY.md
PhillipMarshall May 11, 2018
ba2691b
fr
PhillipMarshall May 11, 2018
cf2d41f
Update TupleTools.md
PhillipMarshall May 11, 2018
6976d9c
Update TupleTools.md
PhillipMarshall May 11, 2018
e48b591
Update TupleTools.md
PhillipMarshall May 11, 2018
d7f5e48
Update TupleTools.md
PhillipMarshall May 11, 2018
e3263f6
Update TupleTools.md
PhillipMarshall May 11, 2018
befe8ef
Update TupleTools.md
laurenyeomans May 11, 2018
971407b
Update TupleTools.md
PhillipMarshall May 11, 2018
1c8aae6
Update TupleTools.md
PhillipMarshall May 11, 2018
4b18b98
Update TupleTools.md
PhillipMarshall May 11, 2018
db7839b
Update TupleTools.md
PhillipMarshall May 11, 2018
e86ec66
Update TupleTools.md
PhillipMarshall May 11, 2018
2b060b7
Update TupleTools.md
laurenyeomans May 11, 2018
dd8f9d5
Update TupleTools.md
PhillipMarshall May 11, 2018
a851cad
Update TupleTools.md
PhillipMarshall May 11, 2018
cc73647
Update TupleTools.md
PhillipMarshall May 11, 2018
24a4467
Update TupleTools.md
PhillipMarshall May 11, 2018
c5c75f8
Update TupleTools.md
laurenyeomans May 11, 2018
5eb735e
Update TupleTools.md
PhillipMarshall May 11, 2018
885bfa2
Update TupleTools.md
laurenyeomans May 11, 2018
b9fd101
Update TupleTools.md
PhillipMarshall May 11, 2018
693d478
Update TupleTools.md
PhillipMarshall May 11, 2018
f99e1e2
Update TupleTools.md
PhillipMarshall May 11, 2018
78bdd55
Update TupleTools.md
laurenyeomans May 11, 2018
987086c
Update TupleTools.md
PhillipMarshall May 11, 2018
2431989
Update TupleTools.md
PhillipMarshall May 11, 2018
4a1bee7
Update TupleTools.md
PhillipMarshall May 11, 2018
65d113a
Update TupleTools.md
PhillipMarshall May 11, 2018
776bbb4
Update TupleTools.md
PhillipMarshall May 11, 2018
032faf1
Rename TupleTools.md to TupleToolsList.md
PhillipMarshall May 11, 2018
8292da8
Update TupleToolsList.md
PhillipMarshall May 11, 2018
5929e37
Update TupleToolsList.md
PhillipMarshall May 11, 2018
384283d
Update TupleToolsList.md
PhillipMarshall May 11, 2018
06b2c24
Update TupleToolsList.md
PhillipMarshall May 11, 2018
05ba814
Update TupleToolsList.md
PhillipMarshall May 11, 2018
3a18f43
Update TupleToolsList.md
PhillipMarshall May 11, 2018
2c2200a
Update TupleToolsList.md
PhillipMarshall May 11, 2018
53007dc
Rename TupleToolsList.md to TupleTools.md
PhillipMarshall May 11, 2018
d5ae356
Update TupleTools.md
PhillipMarshall May 14, 2018
56780c6
Update TupleTools.md
PhillipMarshall May 14, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 15 additions & 16 deletions SUMMARY.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# Summary

* [The LHCb Starterkit](README.md)
* [Contributing](CONTRIBUTING.md)

----
* [Contributing](CONTRIBUTING.md)

-----
* [First analysis steps](first-analysis-steps/README.md)
* [Pre-workshop checklist](first-analysis-steps/prerequisites.md)
* [Goals of the course](first-analysis-steps/introduction-to-course.md)
Expand All @@ -18,6 +17,7 @@
* [Running a minimal DaVinci job locally](first-analysis-steps/minimal-dv-job.md)
* [Running DaVinci on the grid](first-analysis-steps/davinci-grid.md)
* [TupleTools and branches](first-analysis-steps/add-tupletools.md)
* [TupleTools](first-analysis-steps/TupleTools.md)
* [How do I use DecayTreeFitter?](first-analysis-steps/decay-tree-fitter.md)
* [More Ganga](first-analysis-steps/ganga-data.md)
* [Storing large files on EOS](first-analysis-steps/eos-storage.md)
Expand All @@ -27,31 +27,30 @@
* [Early career, gender and diversity](first-analysis-steps/ecgd.md)
* [Contribute to this lesson](first-analysis-steps/contributing-lesson.md)

----

-----
* [Second analysis steps](second-analysis-steps/README.md)
* [Using git to develop LHCb software](second-analysis-steps/lb-git.md)
* [Building your own decay](second-analysis-steps/building-decays.md)
* [The Selection Framework](second-analysis-steps/building-decays-part0.md)
* [A Historical Approach](second-analysis-steps/building-decays-part1.md)
* [Modern Selection Framework](second-analysis-steps/building-decays-part2.md)
* [The Selection Framework](second-analysis-steps/building-decays-part0.md)
* [A Historical Approach](second-analysis-steps/building-decays-part1.md)
* [Modern Selection Framework](second-analysis-steps/building-decays-part2.md)
* [What to do when something fails](second-analysis-steps/fixing-errors.md)
* [Run a different stripping line on simulated data](second-analysis-steps/rerun-stripping.md)
* [Replace a mass hypothesis](second-analysis-steps/switch-mass-hypo.md)
* [Reuse particles from a decay tree](second-analysis-steps/filter-in-trees.md)
* [The simulation framework](second-analysis-steps/simulation.md)
* [Introduction: The basics of Gauss](second-analysis-steps/simulation-intro.md)
* [Getting the correct option files](second-analysis-steps/simulation-running-gauss.md)
* [Controlling the decay](second-analysis-steps/simulation-dkfiles.md)
* [Advanced: Controlling the decay](second-analysis-steps/simulation-advanced-dkfiles.md)
* [Modifying generator cuts](second-analysis-steps/simulation-gencuts.md)
* [Fast simulation options](second-analysis-steps/simulation-fastsim.md)
* [Introduction: The basics of Gauss](second-analysis-steps/simulation-intro.md)
* [Getting the correct option files](second-analysis-steps/simulation-running-gauss.md)
* [Controlling the decay](second-analysis-steps/simulation-dkfiles.md)
* [Advanced: Controlling the decay](second-analysis-steps/simulation-advanced-dkfiles.md)
* [Modifying generator cuts](second-analysis-steps/simulation-gencuts.md)
* [Fast simulation options](second-analysis-steps/simulation-fastsim.md)
* [HLT intro](second-analysis-steps/hlt-intro.md)
* [TisTos DIY](second-analysis-steps/tistos-diy.md)
* [Ganga Scripting](second-analysis-steps/ganga-scripting.md)
* [Managing files in Ganga](second-analysis-steps/managing-files-with-ganga.md)
* [Analysis automation: snakemake](second-analysis-steps/analysis-automation-snakemake.md)

----
-----
* [Download PDF](ref://starterkit-lessons.pdf)

* [Download PDF](ref://starterkit-lessons.pdf)
65 changes: 65 additions & 0 deletions first-analysis-steps/DecayTrees/MCTupleToolAngles.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// Include files
#include "gsl/gsl_sys.h"

// from Gaudi
#include "GaudiKernel/PhysicalConstants.h"
#include "GaudiKernel/Vector3DTypes.h"

// local
#include "MCTupleToolAngles.h"

#include "GaudiAlg/Tuple.h"
#include "GaudiAlg/TupleObj.h"

#include "Event/MCParticle.h"

using namespace LHCb;
//-----------------------------------------------------------------------------
// Implementation file for class : MCTupleToolAngles
//
// 2009-01-19 : Patrick Koppenburg
//-----------------------------------------------------------------------------

// Declaration of the Tool Factory
DECLARE_COMPONENT( MCTupleToolAngles )

//=============================================================================
// Standard constructor, initializes variables
//=============================================================================
MCTupleToolAngles::MCTupleToolAngles( const std::string& type,
const std::string& name,
const IInterface* parent )
: TupleToolBase ( type, name , parent )
{
declareInterface<IMCParticleTupleTool>(this);
}

//=============================================================================
// Destructor
//=============================================================================
MCTupleToolAngles::~MCTupleToolAngles() {}

//=============================================================================
// Fill
//=============================================================================
StatusCode MCTupleToolAngles::fill( const LHCb::MCParticle* mother
, const LHCb::MCParticle* mcp
, const std::string& head
, Tuples::Tuple& tuple )
{
const std::string prefix=fullName(head);

bool test = true;

double cosT =-999.;

if ( 0!=mcp && 0!=mother && mcp!=mother ) cosT = cosTheta(mother->momentum(), mcp->momentum() );
// fill the tuple:
test &= tuple->column( prefix+"_TRUECosTheta", cosT );
if(isVerbose()) test &= tuple->column( prefix+"_TRUETheta", acos(cosT) );
if ( msgLevel(MSG::DEBUG) && 0!=mcp && 0!=mother)
debug() << mother->particleID().pid() << " " << mother->momentum() << " "
<< mcp->particleID().pid() << " " << mcp->momentum() << endmsg ;

return StatusCode(test);
}
60 changes: 60 additions & 0 deletions first-analysis-steps/DecayTrees/MCTupleToolAngles.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// $Id: MCTupleToolAngles.h,v 1.3 2010-01-26 15:39:25 rlambert Exp $
#ifndef MCTUPLETOOLANGLES_H
#define MCTUPLETOOLANGLES_H 1

// Include files
// from Gaudi
#include "DecayTreeTupleBase/TupleToolBase.h"
#include "Kernel/IMCParticleTupleTool.h" // Interface
#include "Math/Boost.h"
#include "GaudiKernel/Vector4DTypes.h"

/** @class MCTupleToolAngles MCTupleToolAngles.h
*
* Fill MC Particle with decay angle in mother frame
*
* - head_TRUECosTheta : angle in mother's frame
*
* \sa TupleToolAngles, DecayTreeTuple, MCDecayTreeTuple
*
* @author Patrick Koppenburg
* @date 2009-01-19
*/

class MCTupleToolAngles : public TupleToolBase,
virtual public IMCParticleTupleTool
{

public:

/// Standard constructor
MCTupleToolAngles( const std::string& type,
const std::string& name,
const IInterface* parent);

virtual ~MCTupleToolAngles( ); ///< Destructor

StatusCode fill( const LHCb::MCParticle*
, const LHCb::MCParticle*
, const std::string&
, Tuples::Tuple& ) override;

private:

inline double cosTheta( const Gaudi::LorentzVector& mother,
const Gaudi::LorentzVector& mcp )
{
ROOT::Math::Boost boost( mother.BoostToCM() );
const Gaudi::XYZVector boostedParticle = (boost( mcp )).Vect().unit();
const Gaudi::XYZVector boostedMother = mother.Vect().unit();
double cosT = boostedParticle.Dot(boostedMother) ;
if (msgLevel(MSG::VERBOSE)) verbose() << mother << " "
<< mcp << " " << boostedMother
<< " " << boostedParticle
<< " " << cosT << endmsg ;
return cosT;
}

};

#endif // MCTUPLETOOLANGLES_H
68 changes: 68 additions & 0 deletions first-analysis-steps/DecayTrees/MCTupleToolDalitz.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// Include files

#include <set>
#include <string>

// local
#include "MCTupleToolDalitz.h"

//-----------------------------------------------------------------------------
// Implementation file for class : MCTupleToolDalitz
//
// 2009-02-17 : Patrick Koppenburg
//-----------------------------------------------------------------------------

// Declaration of the Tool Factory
DECLARE_COMPONENT( MCTupleToolDalitz )

//=============================================================================
// Standard constructor, initializes variables
//=============================================================================
MCTupleToolDalitz::MCTupleToolDalitz( const std::string& type,
const std::string& name,
const IInterface* parent )
: TupleToolBase ( type, name , parent )
, m_ppSvc(0)
{
declareInterface<IMCParticleTupleTool>(this);

}
//=============================================================================
// Destructor
//=============================================================================
MCTupleToolDalitz::~MCTupleToolDalitz() {}

//=============================================================================
//=============================================================================
// Fill
//=============================================================================
StatusCode MCTupleToolDalitz::fill( const LHCb::MCParticle* mother
, const LHCb::MCParticle* part
, const std::string& head
, Tuples::Tuple& tuple )
{
const std::string prefix=fullName(head);

if (0==part) return StatusCode::FAILURE ;
if (msgLevel(MSG::DEBUG)) debug() << "Decay of " << part->particleID().pid() << " with mother " << mother << endmsg ;
LHCb::MCParticle::ConstVector dauts ;
for ( SmartRefVector<LHCb::MCVertex>::const_iterator iv = part->endVertices().begin() ;
iv != part->endVertices().end() ; ++iv){
if (!(*iv)->isDecay()) continue ;
if (msgLevel(MSG::VERBOSE)) verbose() << "Decay vertex of type " << (*iv)->type() << " with "
<< (*iv)->products().size() << " products" << endmsg ;
const SmartRefVector< LHCb::MCParticle > pr = (*iv)->products() ;
for ( SmartRefVector< LHCb::MCParticle >::const_iterator ip = pr.begin() ; ip != pr.end() ; ++ip){
if (msgLevel(MSG::VERBOSE)) verbose() << "Pushing back " << (*ip)->particleID().pid() << endmsg ;
dauts.push_back(*ip);
}
break ;
}

if ( 2>=dauts.size() ){
return Warning("Will not fill Dalitz of two body decay "+prefix,StatusCode::SUCCESS,0);
}

return fill(dauts,"MC",tuple,(part->particleID().pid()<0)) ;

}
51 changes: 51 additions & 0 deletions first-analysis-steps/DecayTrees/MCTupleToolDalitz.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// $Id: MCTupleToolDalitz.h,v 1.3 2010-01-26 15:39:25 rlambert Exp $
#ifndef MCTUPLETOOLDALITZ_H
#define MCTUPLETOOLDALITZ_H 1

// Include files
// from Gaudi
#include "Kernel/IMCParticleTupleTool.h"
#include "DecayTreeTupleBase/TupleToolBase.h"
#include "Kernel/Escape.h"
#include "Event/MCParticle.h"
#include "GaudiAlg/Tuple.h"
#include "GaudiAlg/TupleObj.h"
#include "Kernel/IParticlePropertySvc.h"
#include "Kernel/ParticleProperty.h"

// Boost
#include <boost/lexical_cast.hpp>

/** @class MCTupleToolDalitz MCTupleToolDalitz.h
*
* Fills square masses of all combinations of direct daughters
*
* @author Patrick Koppenburg
* @date 2009-02-17
*/
class MCTupleToolDalitz : public TupleToolBase,
virtual public IMCParticleTupleTool
{

public:

/// Standard constructor
MCTupleToolDalitz( const std::string& type,
const std::string& name,
const IInterface* parent);

virtual ~MCTupleToolDalitz( ); ///< Destructor

/// The filling method
StatusCode fill( const LHCb::MCParticle*
, const LHCb::MCParticle*
, const std::string&
, Tuples::Tuple& ) override;

private:

// Horrid way of sharing code. Should use inheritance instead ...
#include "TupleToolDalitz.icpp"

};
#endif // MCTUPLETOOLDALITZ_H
Loading