Changing StGammaMaker to return candidate momentum, energy, etc above a threshold

Changes to StGammaCandidate

 

Mike B changed StGammaCandidate by added a recluster function that will recluster a gamma candidate by including only towers above a certain threshold the function is below:

//////////////////////////////////////////////////
// Recluster, computing cluster positon, //
// momentum, and energy after exluding towers //
// below a given threshold (in GeV) //
//////////////////////////////////////////////////

void StGammaCandidate::recluster(TVector3 vertex, Float_t threshold, thresholdCut cut)
{

mEnergy = 0.0;
mPosition.SetPtEtaPhi(0, 0, 0);

for(Int_t i = 0; i < numberOfMyTowers(); ++i)
{

StGammaTower *t = mytower(i);

if(t->fail)continue;

if(cut == kMagnitude) if(t->energy < threshold) continue;
if(cut == kTransverse) if(t->pt() < threshold) continue;

TVector3 tower;
tower.SetPtEtaPhi(t->pt(), t->eta, t->phi);

mPosition += tower * t->energy;
mEnergy += t->energy;

}

mPosition *= 1.0 / mEnergy;

mMomentum = mPosition - vertex;
mMomentum.SetMag(mEnergy);

return;

}

 

So to change your gamma candidate momentum vector to include only towers above 200 MeV you do:

Float_t mGammaCanThreshold = 0.2;
for(int ican=0; ican<nGammaCandidates; ican++){
StGammaCandidate* myCan = GammaEvent->candidate(ican);
//"re-cluster this gamma candidate to only include towers > 200 MeV"
myCan->recluster(GammaEvent->vertex(),mGammaCanThreshold,StGammaCandidate::kMagnitude);
TVector3 myCanMom = myCan->momentum();

}

 If you wanted to use eT instead of energy you would call

myCan->recluster(GammaEvent->vertex(),mGammaCanThreshold,StGammaCandidate::kTransverse);

 or you could leave off StGammaCandidate::kTransverse entirely as transverse cuts are the default. 

Functions which calculate sums in a certain radius around the gamma candidate can be used similarly:

myCan->sumPt(0.7,mGammaCanThreshold,StGammaCandidate::kMagnitude)

 

Introduction

Right now the gamma maker works by associating towers and thin layers in the endcap that have adc values 3 sigma above pedestal with a candidate.  The 3x3 tower cluster of the candidate is defined by the cluster found by StEEmcPool/StEEmcClusterMaker/StMyClusterMaker.  All of the towers which define this cluster are stored in the mMyTowers vector for each candidate.  The gamma candidate position is given by the cluster's position and it's energy by the cluster's energy.  The momentum vector of the gamma candidate is corrected for the event vertex:

 position = cluster.position();
 TVector3 pcluster = position - mGammaEvent->vertex();
 pcluster.SetMag(cluster.energy());

The pre and post shower layers associated with the candidate are the pre and post shower layers associated with each tower in the tower cluster.  They are stored in mMyPresower1, etc.

The tracks associated with the candidate are the tracks that extrapolate to the tower cluster and are stored in the mMyTracks vector.

In the gamma maker, in addition to the "myTower", etc. variables there are also plain "tower" variables.  There are all towers, pre and post layers, and tracks within a cone of radius set by mRadius of the gamma candidates. 

What do we want to accomplish

It appears that applying different cuts to the energy of the towers, tracks, etc. associated with the gamma candidate gives better agreement between data and Monte Carlo.  All of this info can be extracted from the gamma trees as they are now.  We just need to change some accessor functions.  My proposal would be to change only these functions:

       TVector3 momentum() const { return mMomentum; }
        Float_t  energy() const { return mEnergy; }
        Float_t  pre1Energy() const { return mPre1Energy; }
        Float_t  pre2Energy() const { return mPre2Energy; }
        Float_t  postEnergy() const { return mPostEnergy; }
        Float_t  smduEnergy() const { return mSmduEnergy; }
        Float_t  smdvEnergy() const { return mSmdvEnergy; }
        Float_t  smdEtaEnergy() const { return mSmduEnergy; }
        Float_t  smdPhiEnergy() const { return mSmdvEnergy; }
 

to each accept a Float_t argument that is the minimum energy of towers or strips that should be included in the sum.  We should also change the functions that return the sum in some radius about the candidate to also accept a minimum energy parameter again of type Float_t that would be used to calculate the sums.

       Float_t sumPt( Float_t radius );
        Float_t sumTrackPt( Float_t radius );
        Float_t sumTowerPt( Float_t radius );
        Float_t sumPreshower1( Float_t radius );
        Float_t sumPreshower2( Float_t radius );
        Float_t sumPostshower( Float_t radius );

 

Note that with this scheme that functions like  Int_t numberOfTowers(){ return mTowers.GetLast()+1; }
 would still return the number of towers 3 sigma above pedestal.  You could access each tower with  StGammaTower *tower( Int_t i ){ return (StGammaTower*)mTowers.At(i); }.  This means that if you were to recalculate the tower energy sum by hand it would not necessary agree with what you get from the functions above unless you apply the same cuts in your sum.

Right now there are functions in the gamma maker that return in number of towers and tracks above a certain transverse energy/momentum.  For consistency with the above, I would like to change these to energy and momentum instead.  I'm talking about:

 Int_t numberOfTracks( Float_t radius, Float_t minMomentum = 0. );//note: AB, change to momentum for\
 consistency with above
        Int_t numberOfTowers( Float_t radius, Float_t minEnergy = 0. );//note: AB, change to energy for con\
sistency with above
 

the functions that calculate any energy-dependent sum of pre/post shower tiles already use energy and not transverse energy.

 

In the photon meeting we talked about changing the tower sums to return, by default, a sum using only those towers above 200 MeV because this is the convention used by the jet people.  This would, however, break backwards compatibility (like the issue above).  We could change this default to zero if someone feels that strongly about it.

I put a modified StGammaCandidate defintion/implementation that accomplishes that things above in my home area:

/star/u/aliceb/StGammaCandidate.cxx

/star/u/aliceb/StGammaCandidate.h