1 #include "StMyClusterMaker.h"
3 #include "StEEmcPool/StEEmcA2EMaker/StEEmcA2EMaker.h"
7 #include "StMuDSTMaker/COMMON/StMuTrack.h"
9 #include "StMcEvent/StMcEvent.hh"
10 #include "StMcEvent/StMcTrack.hh"
11 #include "StMcEvent/StMcVertex.hh"
13 #include "StMessMgr.h"
21 mSmdSeedEnergy = 4.0 / 1000.0;
22 mSmdMinEnergy = 0.5 / 1000.0;
28 mSeedEnergy[0]=0.8; mMinEnergy[0]=0.1;
29 mSeedEnergy[1]=1.0/1000.0; mMinEnergy[1]=0.1/1000.0;
30 mSeedEnergy[2]=1.0/1000.0; mMinEnergy[2]=0.1/1000.0;
31 mSeedEnergy[3]=1.0/1000.0; mMinEnergy[3]=0.1/1000.0;
39 setDoBreakInflection(0);
40 setDoBreakTruncation(0);
44 mFloorParams[0]=0.;mFloorParams[1]=0.;
62 Int_t StMyClusterMaker::buildLayer(Int_t layer )
65 const Char_t *clayers[]={
"T",
"P",
"Q",
"R",
"U",
"V"};
67 LOG_DEBUG <<
" build clusters for layer=" << clayers[layer] << endm;
70 StEEmcTowerVec_t hits=mEEanalysis->
towers(layer);
73 std::sort( hits.begin(), hits.end());
75 std::reverse( hits.begin(), hits.end());
77 LOG_DEBUG<<
"searching for seeds in layer "<<clayers[layer]<<endm;
80 StEEmcTowerVec_t seeds;
81 for ( UInt_t i=0;i<hits.size();i++ )
84 if ( hits[i].fail() )
continue;
87 seeds.push_back(hits[i]);
91 LOG_DEBUG<<
"+ "<<hits[i].name()<<
" "<<hits[i].energy()<<endm;
95 LOG_DEBUG<<
"clustering"<<endm;
100 for ( Int_t i=0;i<720;i++ ) used[i]=
false;
101 for ( UInt_t i=0;i<seeds.size();i++ )
105 if ( tow.
fail() )
continue;
106 if ( used[tow.
index()] )
continue;
108 Int_t etabin_seed = tow.
etabin();
109 Int_t phibin_seed = tow.
phibin();
113 used[tow.
index()]=
true;
121 for ( UInt_t j=0;j<hits.size();j++ )
125 if ( used[ tow.
index() ] )
continue;
126 if ( tow.
fail() )
continue;
130 Int_t deta=TMath::Abs(etabin_seed - tow.
etabin());
131 if ( deta >
mEtaCut )
continue;
133 Int_t phi1=TMath::Max(phibin_seed,tow.
phibin());
134 Int_t phi2=TMath::Min(phibin_seed,tow.
phibin());
135 Int_t diff1 = phi1-phi2;
136 Int_t diff2 = phi2-phi1+60;
137 Int_t dphi=TMath::Min(diff1,diff2);
138 if ( dphi >
mPhiCut )
continue;
142 used[tow.
index()]=
true;
149 LOG_DEBUG<<
"+ key="<<c.key()<<
" seed="<<c.
tower(0).
name()<<
" energy="<<c.
energy()<<endm;
183 LOG_DEBUG <<
" building SMD clusters" << endm;
185 for ( Int_t sector=0;sector<12;sector++ ) {
188 for ( UInt_t ii=0;ii<mTowerClusters[sector][0].size();ii++ )
195 if ( etmax >= 4.5 ) {
196 mSmdSeedEnergy = ( seed_threshold + seed_slope * (etmax-4.5) ) / 1000.0;
206 for ( Int_t plane=0;plane<2;plane++ )
211 Int_t nstrips = (Int_t)mESmdGeom -> getEEmcSector( plane, sector ).stripPtrVec.size();
214 Bool_t used[288];
for (Int_t i=0;i<288;i++ ) used[i]=
false;
217 Float_t floor[288];
for ( Int_t i=0;i<288;i++ ) floor[i]=0.;
220 StEEmcStripVec_t strips=mEEanalysis->
strips(sector,plane);
222 std::sort(strips.begin(),strips.end());
224 std::reverse(strips.begin(),strips.end());
227 LOG_DEBUG <<
" sector=" << sector
228 <<
" plane=" << plane
229 <<
" nhit strips=" << strips.size()
232 StEEmcStripVec_t seeds;
234 Float_t emax_strip = 0.;
235 for ( UInt_t i=0;i<strips.size();i++ )
239 Int_t myindex = strips[i].index();
245 if ( myindex < 4 || myindex > nstrips-4 )
continue;
248 if ( strips[i].fail() )
continue;
253 if ( stripL->
fail() ) stripL = &mEEanalysis->
strip(sector,plane,myindex-2);
254 if ( stripR->
fail() ) stripR = &mEEanalysis->
strip(sector,plane,myindex+2);
259 seeds.push_back( strips[i] );
261 if ( strips[i].energy() > emax_strip )
263 emax_strip = strips[i].
energy();
270 LOG_DEBUG <<
" sector=" << sector
271 <<
" plane=" << plane
272 <<
" n seed strips=" << seeds.size()
280 for ( UInt_t i=0;i<seeds.size(); i++ )
285 Int_t myindex=seed.
index();
290 if ( used[myindex] )
continue;
299 Int_t break_inflection = 0;
301 Int_t break_energy = 0;
307 Float_t ecluster = cluster.energy();
308 Int_t fail_count = 0;
315 if ( istrip < nstrips ) {
317 if ( used[istrip] )
break;
320 Float_t energy=strip.
energy();
323 if ( istrip > 1 && istrip < nstrips-1 ) {
326 if ( strip_right.
energy() > strip_left.
energy() ) break_inflection++;
331 if ( !strip.
fail() ) {
351 if ( used[istrip] )
break;
354 Float_t energy=strip.
energy();
357 if ( istrip > 1 && istrip < nstrips-1 ) {
361 if ( strip_right.
energy() < strip_left.
energy() ) break_inflection++;
367 if ( !strip.
fail() ) {
380 if ( break_energy )
break;
386 Float_t etruncate = ecluster;
388 if ( cluster.energy() < etruncate && mBreakTruncation )
break;
393 if ( mBreakInflection && break_inflection )
break;
401 LOG_DEBUG <<
" adding " << cluster << endm;
402 Int_t index=seed.
index();
404 for ( Int_t ii=index-3;ii<=index+3; ii++ )
405 if ( ii>=0 && ii<288 ) used[ii]=1;
410 for ( Int_t ii=0;ii<288;ii++ )
412 Float_t f = mFloorParams[0] * cluster.energy() * TMath::Gaus( seed.
index()-ii, 0., mFloorParams[1] * cluster.sigma(), true );
TVector3 momentum() const
StEEmcTower & tower(Int_t t)
Get the specified tower within the cluster.
EEmc ADC –> energy maker.
virtual Int_t buildPreshowerClusters()
builder for preshower clusters (both layers)
virtual Int_t buildSmdClusters()
builder for smd clusters
void add(const StEEmcTower &t, Float_t weight=1.0)
virtual Int_t buildTowerClusters()
builder for tower clusters
StEEmcTowerVec_t & towers(Int_t layer=0)
StEEmcStrip & strip(Int_t sector, Int_t plane, Int_t strip)
void add(const StEEmcCluster &cluster)
Add a tower (pre/postshower) cluster to the list of clusters.
void name(const Char_t *n)
Set the name for this element.
StEEmcClusterVec_t & clusters(Int_t sec, Int_t layer)
Return a vector of tower clusters.
Int_t etabin() const
Returns the etabin of this tower, pre- or postshower element.
void fail(unsigned f)
Set a fail bit for this element.
StEEmcStripVec_t & strips(Int_t sec, Int_t pln)
Returns a vector of hit strips, given the sector and plane.
void index(Int_t i)
Sets the index for this SMD strip, 0..287.
Base class for representing tower, preshower and postshower elements.
Bool_t isNeighbor(const StEEmcTower &tower) const
Returns true if tower is adjacent to any tower in the cluster.
virtual const char * GetName() const
special overload
Int_t numberOfTowers() const
Get the number of towers in cluster.
A base class for representing clusters of EEMC smd strips.
virtual Int_t buildPostshowerClusters()
builder for postshower clusters
Float_t energy() const
Get energy of this cluster.
Int_t phibin() const
Returns the phibin of this tower.
A base class for describing clusters of EEMC towers.
void energy(Float_t e)
Set the energy (adc-ped+0.5)/gain for this element.
StEEmcCluster & cluster(Int_t sector, Int_t layer, Int_t index)
Base class for describing an endcap SMD strip.