Skip to content

Commit

Permalink
Merged hgc-tpg-devel-CMSSW_9_4_0_pre2 from repository PFCal-dev with …
Browse files Browse the repository at this point in the history
…cms-merge-topic
  • Loading branch information
tstreble committed Feb 14, 2018
2 parents 66f2f62 + 12960a4 commit 85741b6
Show file tree
Hide file tree
Showing 35 changed files with 3,425 additions and 239 deletions.
2 changes: 1 addition & 1 deletion DataFormats/L1THGCal/interface/HGCalCluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


namespace l1t {

class HGCalCluster : public HGCalClusterT<l1t::HGCalTriggerCell> {

public:
Expand Down
197 changes: 157 additions & 40 deletions DataFormats/L1THGCal/interface/HGCalClusterT.h
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
#ifndef DataFormats_L1Trigger_HGCalClusterT_h
#define DataFormats_L1Trigger_HGCalClusterT_h

/* CMSSW */
#include "DataFormats/Common/interface/Ptr.h"
#include "DataFormats/Common/interface/PtrVector.h"
#include "DataFormats/GeometryVector/interface/GlobalPoint.h"
#include "DataFormats/L1Trigger/interface/L1Candidate.h"
#include "DataFormats/L1THGCal/interface/HGCalTriggerCell.h"
#include "DataFormats/L1THGCal/interface/ClusterShapes.h"
#include "Math/Vector3D.h"

/* ROOT */
#include "Math/Vector3D.h"

namespace l1t
{
template <class C> class HGCalClusterT : public L1Candidate
{

public:
typedef typename edm::PtrVector<C>::const_iterator const_iterator;
typedef typename std::vector<edm::Ptr<C>>::const_iterator const_iterator;

public:
HGCalClusterT(){}
Expand All @@ -43,63 +44,129 @@ namespace l1t
{
addConstituent(c);
}

~HGCalClusterT() {};
const edm::PtrVector<C>& constituents() const {return constituents_;}
const_iterator constituents_begin() const {return constituents_.begin();}
const_iterator constituents_end() const {return constituents_.end();}

const std::vector<edm::Ptr<C>>& constituents() const { return constituents_; }
const_iterator constituents_begin() const { return constituents_.begin(); }
const_iterator constituents_end() const { return constituents_.end(); }
unsigned size() const { return constituents_.size(); }

void addConstituent( const edm::Ptr<C>& c )
void addConstituent( const edm::Ptr<C>& c, bool updateCentre=true, float fraction=1. )
{
if( constituents_.empty() )
{
detId_ = HGCalDetId(c->detId());
seedMipPt_ = c->mipPt();
}

/* update cluster positions */
Basic3DVector<float> constituentCentre( c->position() );
Basic3DVector<float> clusterCentre( centre_ );
double cMipt = c->mipPt()*fraction;

clusterCentre = clusterCentre*mipPt_ + constituentCentre*c->mipPt();
if( mipPt_ + c->mipPt()!=0 )
if( constituents_.empty() )
{
clusterCentre /= ( mipPt_ + c->mipPt() ) ;
detId_ = HGCalDetId( c->detId() );
seedMipPt_ = cMipt;
/* if the centre will not be dynamically calculated
the seed centre is considere as cluster centre */
if( !updateCentre )
{
centre_ = c->position();
}
}
centre_ = GlobalPoint( clusterCentre );

if( clusterCentre.z()!=0 )
{
centreProj_= GlobalPoint( clusterCentre / clusterCentre.z() );
/* update cluster positions (IF requested) */
if( updateCentre ){
Basic3DVector<float> constituentCentre( c->position() );
Basic3DVector<float> clusterCentre( centre_ );

clusterCentre = clusterCentre*mipPt_ + constituentCentre*cMipt;
if( (mipPt_ + cMipt ) > 0 )
{
clusterCentre /= ( mipPt_ + cMipt );
}
centre_ = GlobalPoint( clusterCentre );

if( clusterCentre.z()!=0 )
{
centreProj_= GlobalPoint( clusterCentre / clusterCentre.z() );
}
}

/* update cluster energies */
mipPt_ += c->mipPt();
mipPt_ += cMipt;

int updatedPt = hwPt() + c->hwPt();
setHwPt(updatedPt);
int updatedPt = hwPt() + (int)(c->hwPt()*fraction);
setHwPt( updatedPt );

math::PtEtaPhiMLorentzVector updatedP4 ( p4() );
updatedP4 += c->p4();
updatedP4 += (c->p4()*fraction);
setP4( updatedP4 );

constituents_.push_back( c );
constituentsFraction_.push_back( fraction );

}

bool valid() const { return valid_;}
void setValid(bool valid) { valid_ = valid;}


void removeConstituent( const edm::Ptr<C>& c, bool updateCentre=true ){

/* remove the pointer to c from the std::vector */
double fraction=0;
bool constituentRemoved=false;
for( unsigned i=0; i<constituents_.size(); i++ )
{
if( constituents_[i] == c )
{
// remove constituent and get its fraction in the cluster
constituents_.erase( constituents_.begin()+i );
fraction = constituentsFraction_.at(i);
constituentsFraction_.erase( constituentsFraction_.begin()+i );
constituentRemoved=true;
break;
}
}

/* if a constituent has been removed update cluster info */
if( constituentRemoved ) {

/* update cluster positions (IF requested) */
double cMipt = c->mipPt()*fraction;
if( updateCentre ){
Basic3DVector<float> constituentCentre( c->position() );
Basic3DVector<float> clusterCentre( centre_ );

clusterCentre = clusterCentre*mipPt_ - constituentCentre*cMipt;
if( (mipPt_ - cMipt ) > 0 )
{
clusterCentre /= ( mipPt_ - cMipt ) ;
}
centre_ = GlobalPoint( clusterCentre );

if( clusterCentre.z() != 0 )
{
centreProj_= GlobalPoint( clusterCentre / clusterCentre.z() );
}

}

/* update cluster energies */
mipPt_ -= cMipt;

int updatedPt = hwPt() - ( c->hwPt()*fraction );
setHwPt( updatedPt );

math::PtEtaPhiMLorentzVector updatedP4 ( p4() );
updatedP4 -= ( c->p4()*fraction );
setP4( updatedP4 );

}

}

bool valid() const { return valid_; }
void setValid(bool valid) { valid_ = valid; }

double mipPt() const { return mipPt_; }
double seedMipPt() const { return seedMipPt_; }
uint32_t detId() const { return detId_.rawId(); }


/* distance in 'cm' */
double distance( const l1t::HGCalTriggerCell &tc ) const
{
return ( tc.position() - centre_ ).mag();
}
double distance( const l1t::HGCalTriggerCell &tc ) const { return ( tc.position() - centre_ ).mag(); }

const GlobalPoint& position() const { return centre_; }
const GlobalPoint& centre() const { return centre_; }
Expand Down Expand Up @@ -139,25 +206,75 @@ namespace l1t
uint32_t subdetId() const {return detId_.subdetId();}
uint32_t layer() const {return detId_.layer();}
int32_t zside() const {return detId_.zside();}



//shower shape

int showerLength() const { return showerLength_; }
int coreShowerLength() const { return coreShowerLength_; }
int firstLayer() const { return firstLayer_; }
int maxLayer() const { return maxLayer_; }
float eMax() const { return eMax_; }
float sigmaEtaEtaMax() const { return sigmaEtaEtaMax_; }
float sigmaPhiPhiMax() const { return sigmaPhiPhiMax_; }
float sigmaEtaEtaTot() const { return sigmaEtaEtaTot_; }
float sigmaPhiPhiTot() const { return sigmaPhiPhiTot_; }
float sigmaZZ() const { return sigmaZZ_; }
float sigmaRRTot() const { return sigmaRRTot_; }
float sigmaRRMax() const { return sigmaRRMax_; }
float sigmaRRMean() const { return sigmaRRMean_; }

void set_showerLength(int showerLength) { showerLength_ = showerLength;}
void set_coreShowerLength(int coreShowerLength) { coreShowerLength_ = coreShowerLength;}
void set_firstLayer(int firstLayer) { firstLayer_ = firstLayer;}
void set_maxLayer(int maxLayer) { maxLayer_ = maxLayer;}
void set_eMax(float eMax) { eMax_ = eMax;}
void set_sigmaEtaEtaMax(float sigmaEtaEtaMax) { sigmaEtaEtaMax_ = sigmaEtaEtaMax;}
void set_sigmaEtaEtaTot(float sigmaEtaEtaTot) { sigmaEtaEtaTot_ = sigmaEtaEtaTot;}
void set_sigmaPhiPhiMax(float sigmaPhiPhiMax) { sigmaPhiPhiMax_ = sigmaPhiPhiMax;}
void set_sigmaPhiPhiTot(float sigmaPhiPhiTot) { sigmaPhiPhiTot_ = sigmaPhiPhiTot;}
void set_sigmaRRMax(float sigmaRRMax) { sigmaRRMax_ = sigmaRRMax;}
void set_sigmaRRTot(float sigmaRRTot) { sigmaRRTot_ = sigmaRRTot;}
void set_sigmaRRMean(float sigmaRRMean) { sigmaRRMean_ = sigmaRRMean;}
void set_sigmaZZ(float sigmaZZ) { sigmaZZ_ = sigmaZZ;}

/* operators */
bool operator<(const HGCalClusterT<C>& cl) const {return mipPt() < cl.mipPt();}
bool operator>(const HGCalClusterT<C>& cl) const { return cl<*this; }
bool operator<=(const HGCalClusterT<C>& cl) const { return !(cl>*this); }
bool operator>=(const HGCalClusterT<C>& cl) const { return !(cl<*this); }


private:

bool valid_;
HGCalDetId detId_;
edm::PtrVector<C> constituents_;
HGCalDetId detId_;

std::vector<edm::Ptr<C>> constituents_; /* ???? possibly change this in something like */
std::vector<double> constituentsFraction_; /* vector<pair<edm::Ptr<C>,float>> ???? */

GlobalPoint centre_;
GlobalPoint centreProj_; // centre projected onto the first HGCal layer

double mipPt_;
double seedMipPt_;

//shower shape

int showerLength_;
int coreShowerLength_;
int firstLayer_;
int maxLayer_;
float eMax_;
float sigmaEtaEtaMax_;
float sigmaPhiPhiMax_;
float sigmaRRMax_;
float sigmaEtaEtaTot_;
float sigmaPhiPhiTot_;
float sigmaRRTot_;
float sigmaRRMean_;
float sigmaZZ_;

ClusterShapes shapes_;

};
Expand Down
17 changes: 12 additions & 5 deletions DataFormats/L1THGCal/src/classes_def.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

<lcgdict>
<class name="l1t::HGCFETriggerDigi" ClassVersion="10">
<version ClassVersion="10" checksum="3197268020"/>
Expand All @@ -21,16 +20,24 @@
<class name="edm::Wrapper<l1t::HGCalTowerBxCollection>"/>

<class name="l1t::HGCalClusterT<l1t::HGCalTriggerCell>" />
<class name="l1t::HGCalCluster" ClassVersion="10">
<version ClassVersion="10" checksum="607544984"/>
<class name="l1t::HGCalCluster" ClassVersion="14">
<version ClassVersion="14" checksum="3172278699"/>
<version ClassVersion="13" checksum="3397489079"/>
<version ClassVersion="12" checksum="623703096"/>
<version ClassVersion="11" checksum="354623225"/>
<version ClassVersion="10" checksum="607544984"/>
</class>
<class name="std::vector<l1t::HGCalCluster>" />
<class name="l1t::HGCalClusterBxCollection"/>
<class name="edm::Wrapper<l1t::HGCalClusterBxCollection>"/>

<class name="l1t::HGCalClusterT<l1t::HGCalCluster>" />
<class name="l1t::HGCalMulticluster" ClassVersion="10">
<version ClassVersion="10" checksum="1878482802"/>
<class name="l1t::HGCalMulticluster" ClassVersion="14">
<version ClassVersion="14" checksum="1863228147"/>
<version ClassVersion="13" checksum="816077951"/>
<version ClassVersion="12" checksum="4221677522"/>
<version ClassVersion="11" checksum="1508179045"/>
<version ClassVersion="10" checksum="1878482802"/>
</class>
<class name="std::vector<l1t::HGCalMulticluster>" />
<class name="l1t::HGCalMulticlusterBxCollection"/>
Expand Down
Loading

0 comments on commit 85741b6

Please sign in to comment.