1 #include "StEEmc2x2ClusterMaker.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.;
61 Int_t StEEmc2x2ClusterMaker::buildLayer(Int_t layer )
64 const Char_t *clayers[]={
"T",
"P",
"Q",
"R",
"U",
"V"};
66 LOG_INFO <<
" build clusters for layer=" << clayers[layer] << endm;
72 std::sort( hits.begin(), hits.end());
74 std::reverse( hits.begin(), hits.end());
76 LOG_DEBUG<<
"searching for seeds in layer "<<clayers[layer]<<endm;
79 StEEmcTowerVec_t seeds;
80 for ( UInt_t i=0;i<hits.size();i++ )
82 if ( hits[i].fail() )
continue;
84 seeds.push_back(hits[i]);
87 LOG_DEBUG<<
"+ "<<hits[i].name()<<
" "<<hits[i].energy()<<endm;
89 LOG_DEBUG<<
"clustering"<<endm;
100 int etaA[]={0, 0, 1, 1};
101 int etaB[]={0, 0,-1,-1};
102 int phiA[]={0, 1, 0, 1};
103 int phiB[]={0,-1, 0,-1};
105 Cluster Cluster0 = { 0, etaA, phiA, 0. };
106 Cluster Cluster1 = { 1, etaA, phiB, 0. };
107 Cluster Cluster2 = { 2, etaB, phiB, 0. };
108 Cluster Cluster3 = { 3, etaB, phiA, 0. };
109 Cluster Quads[]={Cluster0,Cluster1,Cluster2,Cluster3};
114 for ( Int_t i=0;i<720;i++ ) used[i]=
false;
116 for ( UInt_t i=0;i<seeds.size();i++ )
120 if ( tow.
fail() )
continue;
121 if ( used[tow.
index()] )
continue;
123 Int_t etabin_seed = tow.
etabin();
124 Int_t phibin_seed = tow.
phibin();
133 for ( Int_t j=0;j<4;j++ )
138 for ( Int_t k=0;k<4;k++ )
141 Int_t myeta = etabin_seed + Quads[j].etabins[k];
142 Int_t myphi = phibin_seed + Quads[j].phibins[k];
143 if ( myeta < 0 || myeta > 11 )
continue;
144 Int_t myindex = myeta + 12 * ( ( myphi + 60 ) % 60 );
145 if ( used[myindex] )
continue;
174 LOG_DEBUG<<
"+ key="<<c.key()<<
" seed="<<c.
tower(0).
name()<<
" energy="<<c.
energy()<<endm;
186 return buildLayer(0);
200 return buildLayer(3);
207 LOG_INFO <<
" building SMD clusters" << endm;
209 for ( Int_t sector=0;sector<12;sector++ ) {
212 for ( UInt_t ii=0;ii<mTowerClusters[sector][0].size();ii++ )
219 if ( etmax >= 4.5 ) {
220 mSmdSeedEnergy = ( seed_threshold + seed_slope * (etmax-4.5) ) / 1000.0;
230 for ( Int_t plane=0;plane<2;plane++ )
235 Int_t nstrips = (Int_t)mESmdGeom -> getEEmcSector( plane, sector ).stripPtrVec.size();
238 Bool_t used[288];
for (Int_t i=0;i<288;i++ ) used[i]=
false;
241 Float_t floor[288];
for ( Int_t i=0;i<288;i++ ) floor[i]=0.;
244 StEEmcStripVec_t strips=mEEanalysis->
strips(sector,plane);
246 std::sort(strips.begin(),strips.end());
248 std::reverse(strips.begin(),strips.end());
251 LOG_DEBUG <<
" sector=" << sector
252 <<
" plane=" << plane
253 <<
" nhit strips=" << strips.size()
256 StEEmcStripVec_t seeds;
258 Float_t emax_strip = 0.;
259 for ( UInt_t i=0;i<strips.size();i++ )
263 Int_t myindex = strips[i].index();
269 if ( myindex < 4 || myindex > nstrips-4 )
continue;
272 if ( strips[i].fail() )
continue;
277 if ( stripL->
fail() ) stripL=&mEEanalysis->
strip(sector,plane,myindex-2);
278 if ( stripR->
fail() ) stripR=&mEEanalysis->
strip(sector,plane,myindex+2);
282 seeds.push_back( strips[i] );
284 if ( strips[i].energy() > emax_strip )
286 emax_strip = strips[i].
energy();
293 LOG_DEBUG <<
" sector=" << sector
294 <<
" plane=" << plane
295 <<
" n seed strips=" << seeds.size()
303 for ( UInt_t i=0;i<seeds.size(); i++ )
308 Int_t myindex=seed.
index();
313 if ( used[myindex] )
continue;
322 Int_t break_inflection = 0;
324 Int_t break_energy = 0;
330 Float_t ecluster = cluster.energy();
331 Int_t fail_count = 0;
338 if ( istrip < nstrips ) {
340 if ( used[istrip] )
break;
343 Float_t energy=strip.
energy();
346 if ( istrip > 1 && istrip < nstrips-1 ) {
349 if ( strip_right.
energy() > strip_left.
energy() ) break_inflection++;
354 if ( !strip.
fail() ) {
374 if ( used[istrip] )
break;
377 Float_t energy=strip.
energy();
380 if ( istrip > 1 && istrip < nstrips-1 ) {
384 if ( strip_right.
energy() < strip_left.
energy() ) break_inflection++;
390 if ( !strip.
fail() ) {
403 if ( break_energy )
break;
409 Float_t etruncate = ecluster;
411 if ( cluster.energy() < etruncate && mBreakTruncation )
break;
416 if ( mBreakInflection && break_inflection )
break;
424 LOG_INFO <<
" adding " << cluster << endm;
425 Int_t index=seed.
index();
427 for ( Int_t ii=index-3;ii<=index+3; ii++ )
428 if ( ii>=0 && ii<288 ) used[ii]=1;
433 for ( Int_t ii=0;ii<288;ii++ )
435 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.
void add(const StEEmcTower &t, Float_t weight=1.0)
StEEmcTowerVec_t & towers(Int_t layer=0)
StEEmcStrip & strip(Int_t sector, Int_t plane, Int_t strip)
StEEmcA2EMaker * mEEanalysis
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.
virtual Int_t buildSmdClusters()
builder for smd clusters
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.
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.
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.
StEEmcTower & tower(Int_t index, Int_t layer=0)
virtual Int_t buildPostshowerClusters()
builder for postshower clusters
void energy(Float_t e)
Set the energy (adc-ped+0.5)/gain for this element.
virtual Int_t buildTowerClusters()
builder for tower clusters
virtual Int_t buildPreshowerClusters()
builder for preshower clusters (both layers)
StEEmcCluster & cluster(Int_t sector, Int_t layer, Int_t index)
Base class for describing an endcap SMD strip.