54 #include "StEEmcPointFitMaker.h"
55 #include "EEmcSectorFit.h"
56 #include "StEEmcPool/StEEmcA2EMaker/StEEmcA2EMaker.h"
57 #include "StEEmcUtil/StEEmcSmd/EEmcSmdGeom.h"
60 #include "StEEmcPool/StEEmcClusterMaker/StEEmcSmdCluster.h"
65 StEEmcPointFitMaker::StEEmcPointFitMaker(
const Char_t *n):
StEEmcPointMaker(n)
67 for ( Int_t sec=0;sec<12;sec++ )
89 for ( Int_t sec=0;sec<12;sec++ )
97 for ( Int_t i=0;i<12;i++ )
121 Float_t eproject = etowers * 0.007 * 1000.0;
122 Float_t nproject = eproject / 1.3;
126 TString uname=
"h";uname+=(sector+1<10)?
"0":
"";uname+=sector+1;uname+=
"U";
127 TString vname=
"h";vname+=(sector+1<10)?
"0":
"";vname+=sector+1;vname+=
"V";
128 TH1F *hU=
new TH1F(uname,
"SMD-u energy distribution [nmips]",288,0.,288.);
129 TH1F *hV=
new TH1F(vname,
"SMD-v energy distribution [nmips]",288,0.,288.);
133 if ( strip.
fail() )
continue;
134 hU->SetBinContent( strip.
index()+1, strip.
energy() * 1000.0 / 1.3 );
138 if ( strip.
fail() )
continue;
139 hV->SetBinContent( strip.
index()+1, strip.
energy() * 1000.0 / 1.3 );
148 if ( etowers < 1.0 )
return kStOK;
155 while ( nfit < 0.90 * nproject && nlast >= 4.0 && count <
mLimitFits ) {
158 Double_t res5umax=0.;
159 Double_t res5vmax=0.;
164 for ( Int_t i=0;i<288;i++ )
170 if ( res5u > res5umax ) {
174 if ( res5v > res5vmax ) {
181 if ( maxu<0 || maxv<0 ) {
185 if ( res5umax < 4.0 && res5vmax < 4.0 ) {
192 fitter -> AddCandidate( (res5umax+res5vmax)/2., 0.85, (Double_t)maxu+0.5, (Double_t)maxv+0.5 );
204 if ( count && count < 5 ) fitter -> TryPermutations();
216 if ( nlast < 4.0 )
break;
229 Double_t e1,s1,u1,v1;
233 Double_t e2,s2,u2,v2;
237 Float_t dist = TMath::Sqrt( (u1-u2)*(u1-u2) + (v1-v2)*(v1-v2) );
240 if ( e1 < 0.15 * e2 ) {
241 Float_t min_dist = TMath::Abs(s1) * 3.5;
242 if ( dist < min_dist ) drop[ifit]=
true;
246 if ( e2 < 0.15 * e1 ) {
247 Float_t min_dist = TMath::Abs(s2) * 3.5;
248 if ( dist < min_dist ) drop[jfit]=
true;
264 if ( drop[ifit] )
continue;
266 Double_t nmip,sigma,u,v;
270 point.
sigma( sigma );
273 point.
energy( (Float_t)(nmip * 1.3 / 0.007 / 1000.0) );
277 if ( !tower )
continue;
278 point.
tower( *tower );
280 point.
residueU( (Float_t)fitter -> Residual( (Int_t)u, 0, 60 ) * 1.3 / 1000.0 );
281 point.
residueV( (Float_t)fitter -> Residual( (Int_t)v, 1, 60 ) * 1.3 / 1000.0 );
286 uc.energy( (
float)(nmip * 1.3 / 1000.0) );
288 uc.sigma( (
float)sigma );
289 uc.sector ( sector );
291 uc.
key( mClusterId++ );
293 vc.energy( (
float)(nmip * 1.3 / 1000.0) );
294 vc.mean ( (
float)v );
295 vc.sigma( (
float)sigma );
297 vc.
key( mClusterId++ );
300 point.
energy( (
float)(nmip * 1.3 / 1000.0) );
314 for ( Int_t i=0;i<12;i++ )
323 for ( Int_t i=0;i<12;i++ )
327 for ( UInt_t i=0;i<
mPoints.size();i++ )
Float_t residueU() const
Get the residual in the U plane.
StEEmcA2EMaker * mEEanalysis
ADC2E.
void cluster(const StEEmcSmdCluster &c, Int_t plane)
Add an smd cluster to this point.
void shareEnergySmd()
Divide energy of eemc towers between identified smd points in proportion to the smd energy...
Base class for representing EEMC points.
void print() const
print summary
void energy(Float_t e, Int_t layer=0)
Set the energy of this point.
StEEmcPointVec_t mPoints
All fully reconstructed points.
void GetCandidate(Int_t i, Double_t &nmips, Double_t &width, Double_t &u, Double_t &v)
Returns the parameters of the fit to the ith gamma candidate.
Bool_t mPermutations
Do or don't do permutations.
EEmcSectorFit * mSectorFit[12]
Fits.
Int_t sector() const
Returns the sector.
void shareEnergySimple()
Divide energy of eemc towers between identified smd points (doesn't work as well as smd algo) ...
void print() const
Print summary.
StEEmcPoint point(Int_t ipoint)
Return a specified point.
Int_t FitSector(Int_t s)
Fit the specified sector.
StEEmcStrip & hitstrip(Int_t sec, Int_t pl, Int_t hit)
virtual void Clear(Option_t *opts="")
Clear the maker.
Int_t numberOfHitStrips(Int_t sector, Int_t plane) const
virtual Int_t Make()
Process event.
Class for building points from smd clusters.
Float_t u() const
Returns mean U position.
void fail(unsigned f)
Set a fail bit for this element.
Int_t mLimitFits
Maximum number of points to fit per sector.
Float_t energy(Int_t sector, Int_t layer) const
Float_t sigma() const
Returns the width.
void index(Int_t i)
Sets the index for this SMD strip, 0..287.
Base class for representing tower, preshower and postshower elements.
Float_t residueV() const
Get the residual in the V plane.
Double_t Residual(Int_t x, Int_t plane) const
Int_t key()
Return a unique key assigned by the cluster maker.
A base class for representing clusters of EEMC smd strips.
A class for finding EEMC points.
void tower(const StEEmcTower &t, Float_t w=1.)
Add a tower with specified weight to the point.
TVector3 getIntersection(Int_t iSec, Int_t iUStrip, Int_t iVStrip, const TVector3 &vertex) const
void position(const TVector3 &p)
Set the position of this point at the SMD plane.
StEEmcTower & tower(Int_t index, Int_t layer=0)
void GetLastCandidate(Double_t &nmips, Double_t &width, Double_t &u, Double_t &v)
Returns the parameters of the last candidate found.
void Clear(Option_t *opts="")
Clear old points.
void SetHistograms(TH1F *u, TH1F *v)
Set pointers to histograms which will be fit.
Float_t v() const
Returns mean V position.
Int_t numberOfCandidates()
Returns the number of gamma candidates.
EEmcSmdGeom * mEEsmd
Smd geometry.
void energy(Float_t e)
Set the energy (adc-ped+0.5)/gain for this element.
Bool_t doPermutations
Flag to determine if we test all permutations or not.
Base class for describing an endcap SMD strip.
Int_t mEnergyMode
Option for dividing energy.
virtual Int_t Init()
Initialize.
Simultaneous fit of two smd planes to N gammas.