Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
45 changes: 43 additions & 2 deletions src/triggers/EG_HTM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ namespace l1menu
namespace triggers
{

/** @brief Cross trigger of the SingleIsoEGEta and HTM triggers.
/** @brief Cross trigger of the SingleEGEta and HTM triggers.
*
* Combines the following triggers: <br/>
* L1_SingleIsoEG version 0 <br/>
* L1_SingleEG version 0 <br/>
* L1_HTM version 0 <br/>
*
* @author Individual triggers coded by Brian Winer, re-factored into a derived class of
Expand All @@ -26,6 +26,23 @@ namespace l1menu
virtual unsigned int version() const;
}; // end of version 0 class

/** @brief Cross trigger of the SingleEGEta and HTM triggers.
*
* Combines the following triggers: <br/>
* L1_SingleEG version 0 <br/>
* L1_HTM version 1 <br/>
*
* @author Individual triggers coded by Brian Winer, re-factored into a derived class of
* CrossTrigger by Mark Grimes (mark.grimes@bristol.ac.uk).
* @date 29/Mar/2014
*/
class EG_HTM_v1 : public l1menu::triggers::CrossTrigger
{
public:
EG_HTM_v1();
virtual const std::string name() const;
virtual unsigned int version() const;
}; // end of version 0 class

/* The REGISTER_TRIGGER macro will make sure that the given trigger is registered in the
* l1menu::TriggerTable when the program starts. I also want to provide some suggested binning
Expand All @@ -44,12 +61,36 @@ namespace l1menu
} // End of customisation lambda function
) // End of REGISTER_TRIGGER_AND_CUSTOMISE macro call

// No need to register suggested binning, it will use the binning for version 0
REGISTER_TRIGGER( EG_HTM_v1 )

} // end of namespace triggers

} // end of namespace l1menu


//
// Version 1
//
l1menu::triggers::EG_HTM_v1::EG_HTM_v1()
: CrossTrigger( new l1menu::triggers::SingleEGEta_v0, new l1menu::triggers::HTM_v1 )
{
// No operation besides passing the sub-triggers onto the base class
}

const std::string l1menu::triggers::EG_HTM_v1::name() const
{
return "L1_SingleEG_HTM";
}

unsigned int l1menu::triggers::EG_HTM_v1::version() const
{
return 1;
}

//
// Version 0
//
l1menu::triggers::EG_HTM_v0::EG_HTM_v0()
: CrossTrigger( new l1menu::triggers::SingleEGEta_v0, new l1menu::triggers::HTM_v0 )
{
Expand Down
84 changes: 84 additions & 0 deletions src/triggers/HTM.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "HTM.h"

#include <stdexcept>
#include <cmath>
#include "../implementation/RegisterTriggerMacro.h"
#include "l1menu/L1TriggerDPGEvent.h"
#include "UserCode/L1TriggerUpgrade/interface/L1AnalysisDataFormat.h"
Expand All @@ -27,6 +28,9 @@ namespace l1menu
} // End of customisation lambda function
) // End of REGISTER_TRIGGER_AND_CUSTOMISE macro call

// No need to register suggested binning, it will use the binning for version 0
REGISTER_TRIGGER( HTM_v1 )

} // end of namespace triggers

} // end of namespace l1menu
Expand All @@ -41,6 +45,86 @@ namespace l1menu
//----------------------------------------------------------------------------------------


//
// Version 1
//
l1menu::triggers::HTM_v1::HTM_v1()
: regionCut_(4), ptCut_(0)
{
// No operation besides the initialiser list
}

bool l1menu::triggers::HTM_v1::apply( const l1menu::L1TriggerDPGEvent& event ) const
{
const L1Analysis::L1AnalysisDataFormat& analysisDataFormat=event.rawEvent();
const bool* PhysicsBits=event.physicsBits();

bool raw = PhysicsBits[0]; // ZeroBias
if (! raw) return false;

double htmValueX=0.;
double htmValueY=0.;

// Calculate our own HT and HTM from the jets that survive the double jet removal.
for( int i=0; i<analysisDataFormat.Njet; i++ )
{
if( analysisDataFormat.Bxjet.at( i )==0 && !analysisDataFormat.Taujet.at(i) )
{
if( analysisDataFormat.Etajet.at( i )>=regionCut_ and analysisDataFormat.Etajet.at( i )<=(21-regionCut_) )
{
if( analysisDataFormat.Etjet[i]>=ptCut_ )
{
// Get the phi angle towers are 0-17 (this is probably not real mapping but OK for just magnitude of HTM
float phi=2*M_PI*(analysisDataFormat.Phijet.at( i )/18.);
htmValueX+=std::cos( phi )*analysisDataFormat.Etjet.at( i );
htmValueY+=std::sin( phi )*analysisDataFormat.Etjet.at( i );
} // Jet is of minimum pT
} //in proper eta range
} //correct beam crossing
} //loop over cleaned jets

if( std::sqrt( htmValueX*htmValueX+htmValueY*htmValueY ) < threshold1_ ) return false;
return true;
}

bool l1menu::triggers::HTM_v1::thresholdsAreCorrelated() const
{
return false;
}

unsigned int l1menu::triggers::HTM_v1::version() const
{
return 1;
}

const std::vector<std::string> l1menu::triggers::HTM_v1::parameterNames() const
{
// First get the values from the base class, then add the extra entry
std::vector<std::string> returnValue=HTM::parameterNames();
returnValue.push_back("regionCut");
returnValue.push_back("ptCut");
return returnValue;
}

float& l1menu::triggers::HTM_v1::parameter( const std::string& parameterName )
{
// Check if it's the parameter I've added, otherwise defer to the base class
if( parameterName=="regionCut" ) return regionCut_;
if( parameterName=="ptCut" ) return ptCut_;
else return HTM::parameter(parameterName);
}

const float& l1menu::triggers::HTM_v1::parameter( const std::string& parameterName ) const
{
// Check if it's the parameter I've added, otherwise defer to the base class
if( parameterName=="regionCut" ) return regionCut_;
if( parameterName=="ptCut" ) return ptCut_;
else return HTM::parameter(parameterName);
}

//
// Version 0
//
bool l1menu::triggers::HTM_v0::apply( const l1menu::L1TriggerDPGEvent& event ) const
{
const L1Analysis::L1AnalysisDataFormat& analysisDataFormat=event.rawEvent();
Expand Down
25 changes: 25 additions & 0 deletions src/triggers/HTM.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,31 @@ namespace l1menu
virtual bool thresholdsAreCorrelated() const;
}; // end of version 0 class


/** @brief HTM trigger where the jets are looped over here rather than in FullSample.
*
* Allows eta cuts to be applied here, rather than having a hard coded eta cut in FullSample.
* Also added a minimum pT value if the jet is to be used to calculate the vector sum.
*
* @author Mark Grimes, but just copied Brian's code from FullSample.cpp
* @date 28/Mar/2014
*/
class HTM_v1 : public HTM
{
public:
HTM_v1(); // Need a constructor to initiate regionCut_
virtual unsigned int version() const;
virtual bool apply( const l1menu::L1TriggerDPGEvent& event ) const;
virtual bool thresholdsAreCorrelated() const;
// Also need to override these because I've added a parameter
virtual const std::vector<std::string> parameterNames() const;
virtual float& parameter( const std::string& parameterName );
virtual const float& parameter( const std::string& parameterName ) const;
protected:
float regionCut_;
float ptCut_;
}; // end of version 1 class

} // end of namespace triggers

} // end of namespace l1menu
Expand Down
99 changes: 99 additions & 0 deletions src/triggers/HTT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,29 @@ namespace l1menu
virtual bool thresholdsAreCorrelated() const;
}; // end of version 0 class

/** @brief HTT trigger where the jets are looped over here rather than in FullSample.
*
* Allows eta cuts to be applied here, rather than having a hard coded eta cut in FullSample.
* Also added a minimum pT value if the jet is to be used to calculate the sum.
*
* @author Mark Grimes, but just copied Brian's code from FullSample.cpp
* @date 28/Mar/2014
*/
class HTT_v1 : public HTT
{
public:
HTT_v1(); // Need a constructor to initiate regionCut_
virtual unsigned int version() const;
virtual bool apply( const l1menu::L1TriggerDPGEvent& event ) const;
virtual bool thresholdsAreCorrelated() const;
// Also need to override these because I've added a parameter
virtual const std::vector<std::string> parameterNames() const;
virtual float& parameter( const std::string& parameterName );
virtual const float& parameter( const std::string& parameterName ) const;
protected:
float regionCut_;
float ptCut_;
}; // end of version 1 class

/* The REGISTER_TRIGGER macro will make sure that the given trigger is registered in the
* l1menu::TriggerTable when the program starts. I also want to provide some suggested binning
Expand All @@ -65,6 +88,9 @@ namespace l1menu
} // End of customisation lambda function
) // End of REGISTER_TRIGGER_AND_CUSTOMISE macro call

// No need to register suggested binning, it will use the binning for version 0
REGISTER_TRIGGER( HTT_v1 )


} // end of namespace triggers

Expand All @@ -80,6 +106,79 @@ namespace l1menu
//----------------------------------------------------------------------------------------


//
// Version 1
//
l1menu::triggers::HTT_v1::HTT_v1()
: regionCut_(4), ptCut_(0)
{
// No operation besides the initialiser list
}

bool l1menu::triggers::HTT_v1::apply( const l1menu::L1TriggerDPGEvent& event ) const
{
const L1Analysis::L1AnalysisDataFormat& analysisDataFormat=event.rawEvent();
const bool* PhysicsBits=event.physicsBits();

bool raw = PhysicsBits[0]; // ZeroBias
if (! raw) return false;

double httValue=0.;

// Calculate our own HT and HTM from the jets that survive the double jet removal.
for( int i=0; i<analysisDataFormat.Njet; i++ )
{
if( analysisDataFormat.Bxjet.at( i )==0 && !analysisDataFormat.Taujet.at(i) )
{
if( analysisDataFormat.Etajet.at( i )>=regionCut_ and analysisDataFormat.Etajet.at( i )<=(21-regionCut_) )
{
if( analysisDataFormat.Etjet[i]>=ptCut_ ) httValue+=analysisDataFormat.Etjet.at( i );
} //in proper eta range
} //correct beam crossing
} //loop over cleaned jets

if (httValue < threshold1_) return false;
return true;
}

bool l1menu::triggers::HTT_v1::thresholdsAreCorrelated() const
{
return false;
}

unsigned int l1menu::triggers::HTT_v1::version() const
{
return 1;
}

const std::vector<std::string> l1menu::triggers::HTT_v1::parameterNames() const
{
// First get the values from the base class, then add the extra entries
std::vector<std::string> returnValue=HTT::parameterNames();
returnValue.push_back("regionCut");
returnValue.push_back("ptCut");
return returnValue;
}

float& l1menu::triggers::HTT_v1::parameter( const std::string& parameterName )
{
// Check if it's the parameter I've added, otherwise defer to the base class
if( parameterName=="regionCut" ) return regionCut_;
if( parameterName=="ptCut" ) return ptCut_;
else return HTT::parameter(parameterName);
}

const float& l1menu::triggers::HTT_v1::parameter( const std::string& parameterName ) const
{
// Check if it's the parameter I've added, otherwise defer to the base class
if( parameterName=="regionCut" ) return regionCut_;
if( parameterName=="ptCut" ) return ptCut_;
else return HTT::parameter(parameterName);
}

//
// Version 0
//
bool l1menu::triggers::HTT_v0::apply( const l1menu::L1TriggerDPGEvent& event ) const
{
const L1Analysis::L1AnalysisDataFormat& analysisDataFormat=event.rawEvent();
Expand Down
41 changes: 41 additions & 0 deletions src/triggers/IsoEG_HTM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,23 @@ namespace l1menu
virtual unsigned int version() const;
}; // end of version 0 class

/** @brief Cross trigger of the SingleIsoEGEta and HTM triggers.
*
* Combines the following triggers: <br/>
* L1_SingleIsoEG version 0 <br/>
* L1_HTM version 1 <br/>
*
* @author Individual triggers coded by Brian Winer, re-factored into a derived class of
* CrossTrigger by Mark Grimes (mark.grimes@bristol.ac.uk).
* @date 29/Mar/2014
*/
class IsoEG_HTM_v1 : public l1menu::triggers::CrossTrigger
{
public:
IsoEG_HTM_v1();
virtual const std::string name() const;
virtual unsigned int version() const;
}; // end of version 0 class

/* The REGISTER_TRIGGER macro will make sure that the given trigger is registered in the
* l1menu::TriggerTable when the program starts. I also want to provide some suggested binning
Expand All @@ -44,12 +61,36 @@ namespace l1menu
} // End of customisation lambda function
) // End of REGISTER_TRIGGER_AND_CUSTOMISE macro call

// No need to register suggested binning, it will use the binning for version 0
REGISTER_TRIGGER( IsoEG_HTM_v1 )

} // end of namespace triggers

} // end of namespace l1menu


//
// Version 1
//
l1menu::triggers::IsoEG_HTM_v1::IsoEG_HTM_v1()
: CrossTrigger( new l1menu::triggers::SingleIsoEGEta_v0, new l1menu::triggers::HTM_v1 )
{
// No operation besides passing the sub-triggers onto the base class
}

const std::string l1menu::triggers::IsoEG_HTM_v1::name() const
{
return "L1_SingleIsoEG_HTM";
}

unsigned int l1menu::triggers::IsoEG_HTM_v1::version() const
{
return 1;
}

//
// Version 0
//
l1menu::triggers::IsoEG_HTM_v0::IsoEG_HTM_v0()
: CrossTrigger( new l1menu::triggers::SingleIsoEGEta_v0, new l1menu::triggers::HTM_v0 )
{
Expand Down
Loading