StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEEmcClusterMaker.cxx
1 #include "StEEmcClusterMaker.h"
2 
3 #include <algorithm>
4 #include <iostream>
5 //#include "eeSinglePeak.h"
6 #include "TMath.h"
7 
8 
9 /* StEvent stuff */
10 #include "StEvent/StEvent.h"
11 #include "StEvent/StEmcCollection.h"
12 #include "StEvent/StEmcDetector.h"
13 #include "StEvent/StEmcModule.h"
14 #include "StEvent/StEmcClusterCollection.h"
15 #include "StEvent/StEmcCluster.h"
16 
17 
18 #define FIXED_SMD_SEED
19 //#define DYNAMIC_SMD_SEED
20 //#define SKIP_STAT
21 //#define LOOSE_CUTS
22 
23 #define DEBUG 0
24 
25 ClassImp(StEEmcClusterMaker);
26 
27 // ----------------------------------------------------------------------------
28 StEEmcClusterMaker::StEEmcClusterMaker(const Char_t *name):StMaker(name)
29 {
30 
32  mFillStEvent = 0;
33 
35  mSuppress = false;
36 
39  mClusterId = 0;
40 
42  const Float_t eseeds[] = { 0.6, 1.0/1000, 1.0/1000, 1.0/1000., 0.3/1000., 0.3/1000. };
43  for ( Int_t i = 0; i < 6; i++ ) seedEnergy( eseeds[i], i );
44 
45  mMaxExtent = 6;
46  mSeedFloor = 2.0;
47 
60 
61  StEEmcClusterVec_t t;
62  std::vector< StEEmcClusterVec_t > layers;
63  for ( Int_t i = 0; i < 4; i++ ) layers.push_back(t);
64  for ( Int_t i = 0; i < 12; i++ ) mTowerClusters.push_back(layers);
65 
66  StEEmcSmdClusterVec_t s;
67  std::vector< StEEmcSmdClusterVec_t > planes;
68  planes.push_back(s);
69  planes.push_back(s);
70  for ( Int_t i = 0; i < 12; i++ ) mSmdClusters.push_back(planes);
71 
72  StEEmcTowerVec_t tow;
73  std::vector< StEEmcTowerVec_t > lay;
74  for ( Int_t i = 0; i < 4; i++ ) lay.push_back(tow);
75  for ( Int_t i = 0; i < 12; i++ ) mSeedTowers.push_back(lay);
76 
77  mEEtow=new EEmcGeomSimple();
78  mEEsmd=EEmcSmdGeom::instance();
79  mEEmap=EEmcSmdMap::instance();
80 
81 }
82 
83 // ----------------------------------------------------------------------------
85 {
87  assert(mEEanalysis);
88 
89  return StMaker::Init();
90 }
91 
92 // ----------------------------------------------------------------------------
94 {
95 
97  if ( !buildTowerClusters() ) return kStWarn;
98 
100  if ( !buildSmdClusters() ) return kStWarn;
101 
103  if ( mFillStEvent ) fillStEvent();
104 
106  if ( mFillStEvent )
107  if ( !verifyStEvent() ) Warning("Make","StEvent not properly copied");
108 
109  return kStOK;
110 }
111 
112 // ----------------------------------------------------------------------------
113 void StEEmcClusterMaker::Clear( Option_t *opts )
114 {
115 
117  for ( Int_t sector=0; sector<12; sector++ ) {
118  for ( Int_t layer=0; layer<4; layer++ )
119  mTowerClusters[sector][layer].clear();
120  for ( Int_t plane=0; plane<2; plane++ )
121  mSmdClusters[sector][plane].clear();
122  }
123 
124  for ( Int_t i=0;i<6;i++ ) mNumberOfClusters[i]=0;
125 
126  mClusterId = 0;
127 
128  return;
129 }
130 
131 
132 // ----------------------------------------------------------------------------
134 {
135 
138  //static const Int_t layer=0;
139 
140 
142  for ( Int_t layer=0;layer<4;layer++)
143  {
144 
147  Float_t weights[720]; for ( Int_t i=0;i<720;i++ ) weights[i]=0.;
148 
150  StEEmcClusterVec_t myClusters;
151 
152 
154  StEEmcTowerVec_t towers = mEEanalysis -> towers( layer );
155 
156 
157 
159  std::sort(towers.begin(),towers.end());
161  std::reverse(towers.begin(),towers.end());
162 
163 
166  StEEmcTowerVec_t::iterator last = towers.begin();
167  while ( last != towers.end() ) {
168 
169  if ( (*last).energy() < mSeedEnergy[layer] ) break;
174  //$$$ mSeedTowers[layer][ (*last).sector() ].push_back((*last));
175 #if DEBUG
176  std::cout << "-- Seed tower ----------------------" << std::endl;
177  (*last).print();
178 #endif
179  last++;
180  }
181 
182  StEEmcTowerVec_t::iterator iter = towers.begin();
183  while ( iter != towers.end() ) {
184 
186  if ( iter==last ) break;
187 
188 
195  if ( weights[ (*iter).index() ] > 0. ) {
196  iter++;
197  continue;
198  }
199 
202  for ( Int_t in=0; in < (*iter).numberOfNeighbors(); in++ ) {
203  StEEmcTower t=(*iter).neighbor(in);
204  weights[ t.index() ] += (*iter).energy();
205  }
206 
207 
208  iter++;
209 
210  }// loop over towers to init weights
211 
212 
214  iter=towers.begin();
215  while ( iter != towers.end() ) {
216 
218  if ( iter==last ) break;
219 
223  if ( weights[ (*iter).index() ] > 0. ) {
224  iter++;
225  continue;
226  }
227 
229  StEEmcTower seed=(*iter);
230 #if DEBUG
231  std::cout << "--- Clustering ----------------" << std::endl;
232  seed.print();
233 #endif
234 
235  TVector3 momentum;
236  cluster.add(seed,1.0);
237  UInt_t sec,sub,eta;
238  sec=(UInt_t)seed.sector();
239  sub=(UInt_t)seed.subsector();
240  eta=(UInt_t)seed.etabin();
241  TVector3 d=mEEtow->getTowerCenter(sec,sub,eta).Unit();
242  momentum += ( seed.energy() * d );
243 
244  for ( Int_t in=0; in<seed.numberOfNeighbors(); in++ ) {
245  StEEmcTower t=seed.neighbor(in);
246  sec=(UInt_t)t.sector();
247  sub=(UInt_t)t.subsector();
248  eta=(UInt_t)t.etabin();
249  d=mEEtow->getTowerCenter(sec,sub,eta).Unit();
250  Float_t weight = seed.energy() / weights[ t.index() ];
251  momentum += ( t.energy() * d * weight );
252  cluster.add(t, weight);
253 #if DEBUG
254  std::cout << "adding " << t.name() << " E=" << t.energy() << " W=" << weight << std::endl;
255 #endif
256  }
257 
258 
260  cluster.momentum( momentum );
261  cluster.key( mClusterId++ );
262 #if DEBUG
263  cluster.print();
264 #endif
265 
266  mTowerClusters[ seed.sector() ][ layer ].push_back( cluster );
267  mNumberOfClusters[layer]++;
268 
269  iter++;
270 
271  }
272 
273  }// end of eventual loop over layers
274 
275 
276  return true;
277 
278 }
279 
280 // ----------------------------------------------------------------------------
281 #ifdef FIXED_SMD_SEED
283 {
284 
285  Int_t max_extent = mMaxExtent;
286 
287 
289  for ( Int_t sector=0; sector<12; sector++ )
291  for ( Int_t plane=0; plane<2; plane++ ) {
292 
294  Float_t floor[288]; for ( Int_t i=0; i<288; i++ ) floor[i]=0.;
295 
297  StEEmcStripVec_t strips=mEEanalysis->strips(sector,plane);
298  StEEmcStripVec_t seeds;
300  std::sort(strips.begin(),strips.end());
302  std::reverse(strips.begin(),strips.end());
303 
305  std::vector<Bool_t> seed_flags( strips.size(), false );
306 
308  Int_t nstrip=0;
309  Int_t nseeds=0;
310  StEEmcStripVec_t::iterator istrip=strips.begin();
311  while ( istrip!=strips.end() ) {
312 
313  Int_t index=(*istrip).index();
314  Float_t eseed=(*istrip).energy();
315 
317  if ( index <= 3 || index >= 283 ) {
318  istrip++;
319  nstrip++;
320  continue;
321  }
322 
324 #ifdef SKIP_STAT
325  if ( (*istrip).fail() || (*istrip).stat() ) {
326  istrip++;
327  nstrip++;
328  continue;
329  }
330 #endif
331 
334  if ( eseed < mSeedFloor*floor[ index ] + mSeedEnergy[4+plane] ) {
335  istrip++;
336  nstrip++;
337  continue;
338  }
339 
341  seeds.push_back( (*istrip) );
342  nstrip++;
343  nseeds++;
344 
345 #ifndef LOOSE_CUTS
346  for ( Int_t i=0; i < 288; i++ ) {
348 
349  Int_t dx=TMath::Abs(index-i);
350 
352  if ( dx<3 )
353  if ( eseed > floor[i] ) floor[i]=eseed;
354 
356  if ( dx<5 )
357  if ( 0.20 * eseed > floor[i] ) floor[i] = 0.2 * eseed;
358 
360  if ( dx<11 )
361  if ( 0.10 * eseed > floor[i] ) floor[i] = 0.1 * eseed;
362 
364  if ( dx<21 )
365  if ( 0.20*eseed > floor[i] ) floor[i] = 0.05 * eseed;
366 
367  }
368 #else
369  for ( Int_t i=0; i < 288; i++ ) {
371 
372  Int_t dx=TMath::Abs(index-i);
373 
375  if ( dx<7 )
376  if ( 0.05 * eseed > floor[i] ) floor[i] = 0.05 * eseed;
377 
378  }
379 
380 #endif
381  istrip++;
382 
383  }// found all seed strips
384 
385 
391  Bool_t owned[288]; for (Int_t i=0;i<288;i++) owned[i]=false;
392  Bool_t xseed[288]; for (Int_t i=0;i<288;i++) xseed[i]=false;
393 
394  StEEmcStripVec_t::iterator iseed=seeds.begin();
395  while ( iseed != seeds.end() ) {
396 
398  Int_t index=(*iseed).index();
399  if ( owned[index] || (mSuppress&&xseed[index]) ) {
400  iseed++;
401  continue;
402  }
403 
405  owned[index]=true;
406  xseed[index]=true;
410  cluster.add( (*iseed) );
411 
414  for ( Int_t i=index+1; i<=index+max_extent; i++ ) {
416  StEEmcStrip strip=mEEanalysis->strip(sector,plane,i);
418 #ifdef SKIP_STAT
419  if (strip.energy()<=0.&&!strip.fail()&&!strip.stat()) break;
420 #else
421  if ( strip.energy()<=0. ) break;
422 #endif
423  owned[ strip.index() ] = true;
425  xseed[ strip.index() ] = true;
427  cluster.add(strip);
428  }
429  for ( Int_t i=index-1; i>=index-max_extent; i-- ) {
431  StEEmcStrip strip=mEEanalysis->strip(sector,plane,i);
433 #ifdef SKIP_STAT
434  if (strip.energy()<=0.&&!strip.fail()&&!strip.stat()) break;
435 #else
436  if (strip.energy()<=0.) break;
437 #endif
438  owned[ strip.index() ] = true;
440  xseed[ strip.index() ] = true;
442  cluster.add(strip);
443  }
444 
446  if ( cluster.size() >= 3 ) {
447  cluster.key( mClusterId++ );
448  mSmdClusters[ sector ][ plane ].push_back(cluster);
449  mNumberOfClusters[4+plane]++;
450 
451  // disallow strips on either side of the cluster
452  // from forming seeds
453  Int_t ns=cluster.numberOfStrips();
454  Int_t left=999,right=-999;
455  for ( Int_t is=0;is<ns;is++ )
456  {
457  StEEmcStrip s=cluster.strip(is);
458  if ( s.index()<left ) left=s.index();
459  if ( s.index()>right ) right=s.index();
460  }
461 
462  xseed[left-1]=true;
463  xseed[left-2]=true;
464  xseed[right+1]=true;
465  xseed[right+2]=true;
466 
467  }
468 
469 
470  iseed++;
471  }
472 
473  }// loop over planes/sectors
474 
475  return true;
476 
477 }
478 #endif
479 #ifdef DYNAMIC_SMD_SEED
480 
482 {
483 
484  Int_t max_extent = mMaxExtent;
485 
486 
488  for ( Int_t sector=0; sector<12; sector++ )
489  {
490 
492  StEEmcClusterVec_t clist = clusters(sector,0);
493 
495  StEEmcStripVec_t seeds;
496 
498  for ( UInt_t iuv=0; iuv<2; iuv++ )
499  {
500 
502  StEEmcStripVec_t seeds;
503 
505  std::vector<Int_t> used(288,0);
506 
508  std::vector<Float_t> floor(288,0.);
509 
510 
512  for ( UInt_t ic=0; ic<clist.size(); ic++ )
513  {
514 
516  StEEmcCluster cluster=clist[ic];
517  Int_t sec=cluster.tower(0).sector();
518  Int_t sub=cluster.tower(0).subsector();
519  Int_t eta=cluster.tower(0).etabin();
520 
523  Float_t esmd = cluster.energy() * 0.0056;
524 
527  Float_t ethresh = esmd * 0.1;
528 
532  Int_t smin[2], smax[2];
533  mEEmap->getRangeU(sec,sub,eta, smin[0], smax[0] );
534  mEEmap->getRangeV(sec,sub,eta, smin[1], smax[1] );
535  smin[0]=TMath::Max(smin[0]-20,4);
536  smax[0]=TMath::Min(smax[0]+20,284);
537  smin[1]=TMath::Max(smin[1]-20,4);
538  smax[1]=TMath::Min(smax[1]+20,284);
539 
540 
543  for ( Int_t istrip=smin[iuv]; istrip<smax[iuv]; istrip++ )
544  {
545 
549  StEEmcStrip strip=mEEanalysis->strip(sector,iuv,istrip);
550 
553  Float_t mythresh=TMath::Max(ethresh, floor[istrip]);
554 
557  if ( strip.energy() > mythresh && !used[istrip] ) {
558 
559  seeds.push_back( strip );
560  used[istrip]++;
561  floor[istrip] = strip.energy();
562  for ( Int_t i=0; i<20; i++ ) {
563  if ( istrip+i<288 ) floor[istrip+i]+=0.10*strip.energy();
564  if ( istrip-i>0 ) floor[istrip-i]+=0.10*strip.energy();
565  }
566 
568  StEEmcSmdCluster smdc;
569  smdc.key( mClusterId++ );
570  Bool_t goL=1, goR=1;
571  for ( Int_t i=0; i<max_extent; i++ ) {
572  goL&=(istrip-i>0);
573  goR&=(istrip+i<287);
574 
575  if ( goL ) {
576  StEEmcStrip s=mEEanalysis->strip(sector,iuv,istrip-i);
577  if ( !s.stat() && !s.fail() ) {
578  goL&=s.energy()>0.;
579  if ( goL ) {
580  smdc.add(s);
581  used[istrip-i]=1;
582  }
583  }
584  }
585 
586  if ( goR ) {
587  StEEmcStrip s=mEEanalysis->strip(sector,iuv,istrip+i);
588  if ( !s.stat() && !s.fail() ) {
589  goR&=s.energy()>0.;
590  if ( goR ) {
591  smdc.add(s);
592  used[istrip+i]=1;
593  }
594  }
595  }
596 
597  }
598 
599  if ( smdc.numberOfStrips() > 2 )
600  mSmdClusters[ sector ][ iuv ].push_back( smdc );
601 
602  }
603 
604 
605  }
606 
607 
608  }
609 
610  }
611 
612  }
613 
614 }
615 
616 #endif
617 
618 // ----------------------------------------------------------------------------
619 
621 {
622 
623  StEvent *stevent=(StEvent*)GetInputDS("StEvent");
624  if ( !stevent ) {
625  Warning("fillStEvent","called, but no StEvent to be found");
626  return;
627  }
628 
629  std::cout << "Adding tower clusters to StEvent at " << stevent << std::endl;
630 
634  StEmcDetector *detector=stevent->emcCollection()->detector(kEndcapEmcTowerId);
635  if ( !detector )
636  {
637  Warning("fillStEvent","detector == NULL, MAJOR StEvent problem, continuing");
638  return;
639  }
640 
641 
649 
650  if ( mNumberOfClusters[0] > 0 )
651  {
652 
653 
658  StEmcClusterCollection *collect = detector -> cluster();
659  if ( !collect )
660  {
661  //Warning("fillStEvent","StEmcClusterCollection (towers) was NULL, so I'm creating one.");
662  collect = new StEmcClusterCollection();
663  detector->setCluster( collect );
664  }
665 
666  assert(collect);
667  collect->setDetector( kEndcapEmcTowerId );
668  collect->setClusterFinderId( 123 );
669  collect->setClusterFinderParamVersion( 123 );
670 
672  for ( Int_t isector=0; isector<12; isector++ )
673  {
674 
676  for ( UInt_t iclust=0; iclust<mTowerClusters[isector][0].size(); iclust++ )
677  {
678 
679  StEEmcCluster cl=(mTowerClusters[isector][0])[iclust];
680 
684  StEmcCluster *emccluster = new StEmcCluster();
685  emccluster->setEta( cl.momentum().Eta() );
686  emccluster->setPhi( cl.momentum().Phi() );
687  emccluster->setSigmaEta(-1.);
688  emccluster->setSigmaPhi(-1.);
689  emccluster->setEnergy( cl.energy() );
690  emccluster->SetUniqueID( cl.key() );
691 #if 1
692  for ( Int_t i=0; i< cl.numberOfTowers(); i++ )
693  {
694  StEmcRawHit *hit=cl.tower(i).stemc();
695  assert( hit );
696  emccluster->addHit( hit );
697  }
698 #endif
699 
700  collect->addCluster( emccluster );
701 
702 
704  mEtoEE[ emccluster ] = cl;
705  cl.stemc( emccluster );
706 
707  }
708 
709  }
710 
711  }
712 
713  else // if ( mNumberOfClusters[0] == 0 )
714  {
715 
716  detector->setCluster( NULL );
717 
718  }
719 
720 
721 
722 
724  // detector->setCluster( collect );
725 
729  detector=stevent->emcCollection()->detector(kEndcapEmcPreShowerId);
730  if ( !detector )
731  {
732  Warning("fillStEvent","detector == NULL for pre/post, no clusters for you");
733  }
734  else if ( mNumberOfClusters[1] > 0 ||
735  mNumberOfClusters[2] > 0 ||
736  mNumberOfClusters[3] > 0 )
737  {
738 
739  StEmcClusterCollection *pqr = detector -> cluster();
740  if ( !pqr )
741  {
742  //Warning("fillStEvent","StEmcClusterCollection (pre/post) was NULL, so I'm creating one.");
743  pqr = new StEmcClusterCollection();
744  detector->setCluster( pqr );
745  }
746  assert(pqr);
747  pqr -> setDetector( kEndcapEmcPreShowerId );
748  pqr -> setClusterFinderId( 123 );
749  pqr -> setClusterFinderParamVersion( 321 );
750 
752  for ( Int_t isector=0; isector<12; isector++ )
753 
755  for ( Int_t ilayer=1; ilayer<4; ilayer++ )
756 
758  for ( UInt_t iclust=0; iclust<mTowerClusters[isector][ilayer].size(); iclust++ )
759  {
760 
761  StEEmcCluster cl=(mTowerClusters[isector][ilayer])[iclust];
762 
766  StEmcCluster *emccluster = new StEmcCluster();
767  emccluster->setEta( cl.momentum().Eta() );
768  emccluster->setPhi( cl.momentum().Phi() );
769  emccluster->setSigmaEta(-1.);
770  emccluster->setSigmaPhi(-1.);
771  emccluster->setEnergy( cl.energy() );
772  emccluster->SetUniqueID( cl.key() );
773 #if 1
774  for ( Int_t i=0; i< cl.numberOfTowers(); i++ )
775  {
776  StEmcRawHit *hit=cl.tower(i).stemc();
777  assert( hit );
778  emccluster->addHit( hit );
779  }
780 #endif
781 
782 
783  pqr->addCluster( emccluster );
784 
785  mEtoEE[ emccluster ] = cl;
786  cl.stemc( emccluster );
787 
788  }
789 
790  }
791  else // if ( mNumberOfClusters[1, 2 OR 3] == 0 )
792  {
793 
794  detector->setCluster( NULL );
795 
796  }
797 
798 
802  StDetectorId ids[]={ kEndcapSmdUStripId, kEndcapSmdVStripId };
803 
804 
805  for ( Int_t iplane=0; iplane<2; iplane++ )
806  {
807 
808  detector=stevent->emcCollection()->detector(ids[iplane]);
809  if ( !detector )
810  {
811  Warning("fillStEvent","detector == NULL for smd plane, no clusters for you");
812  }
813  else if ( mNumberOfClusters[4+iplane] > 0 )
814  {
815 
816  StEmcClusterCollection *smdc = detector -> cluster();
817  if ( !smdc )
818  {
819  //Warning("fillStEvent","StEmcClusterCollection (smd) was NULL, so I'm creating one.");
820  smdc = new StEmcClusterCollection();
821  detector->setCluster( smdc );
822  }
823 
824  smdc->setDetector( ids[iplane] );
825  smdc->setClusterFinderId( 123 );
826  smdc->setClusterFinderParamVersion( 321 );
827 
828 
829  for ( Int_t isector=0; isector<12; isector++ )
830  {
831 
832  for ( UInt_t iclust=0; iclust<mSmdClusters[isector][iplane].size(); iclust++ )
833  {
834 
835  StEEmcSmdCluster cl = (mSmdClusters[isector][iplane])[iclust];
836 
837 
838  StEmcCluster *emccluster = new StEmcCluster();
839  emccluster->setEta( cl.mean() );
840  emccluster->setPhi( (Float_t)iplane );
841  emccluster->setSigmaEta(-1.);
842  emccluster->setSigmaPhi(-1.);
843  emccluster->setEnergy( cl.energy() );
844  emccluster->SetUniqueID( cl.key() );
845  for ( Int_t i=0; i< cl.numberOfStrips(); i++ )
846  {
847  StEmcRawHit *hit=cl.strip(i).stemc();
848  assert( hit );
849  emccluster->addHit( hit );
850  }
851  smdc->addCluster( emccluster );
852 
853  mEtoEEsmd[ emccluster ] = cl;
854  cl.stemc( emccluster );
855 
856  }
857 
858 
859  }
860 
861  }
862 
863  else
864  {
865  detector -> setCluster( NULL );
866  }
867 
868 
869 
870  }
871 
872 
873 }
874 
875 
876 
877 // ----------------------------------------------------------------------------
879  {
880 
882  StEvent *stevent=(StEvent*)GetInputDS("StEvent");
883  if ( !stevent ) {
884  Warning("verifyStEvent","No StEvent found.");
885  return true;
886  }
887  //StEmcCollection *emccollection=stevent->emcCollection();
888 
889  Bool_t go = true;
890 
891  StEmcDetector *detector=stevent->emcCollection()->detector(kEndcapEmcTowerId);
892  if ( !detector )
893  {
894  Warning("verifyStEvent","detector == NULL for towers");
895  return false;
896  }
897 
898 
899  StEmcClusterCollection *cc=detector->cluster();
900  if ( cc )
901  {
902 
903 
908 
909  Float_t emc_sum_towers = 0.;
910  Float_t eemc_sum_towers = 0.;
911 
912  StSPtrVecEmcCluster &emcClusters=cc->clusters();
913  for ( UInt_t i=0; i<emcClusters.size(); i++ )
914  {
915  StEmcCluster *cl=emcClusters[i];
916  assert(cl);
917  emc_sum_towers += cl->energy();
918  }
919 
920  for ( Int_t sec=0; sec<12; sec++ )
921  {
922 
923  for ( Int_t i=0; i<numberOfClusters(sec,0); i++ )
924  eemc_sum_towers += cluster(sec,0,i).energy();
925  }
926 
927  std::cout << "StEEmcClusterMaker tower checksum: ";
928  if ( emc_sum_towers == eemc_sum_towers ) {
929  std::cout << "passed";
930  }
931  else {
932  std::cout << "FAILED"; go=false;
933  }
934  std::cout << std::endl;
935 
936  }
937  else {
938 
939  std::cout << "StEEmcClusterMaker tower checksum: NULL collection, nclust=" << mNumberOfClusters[0] << std::endl;
940  go &= (mNumberOfClusters[0]==0);
941 
942  }
943 
948  Float_t emc_sum_smdu = 0.;
949  Float_t eemc_sum_smdu = 0.;
950 
951  detector=stevent->emcCollection()->detector(kEndcapSmdUStripId);
952  if ( !detector )
953  {
954  Warning("verifyStEvent","detector == NULL for smdu");
955  return false;
956  }
957 
958  cc=detector->cluster();
959  if ( cc )
960  {
961 
962  StSPtrVecEmcCluster &smduClusters=cc->clusters();
963 
964  for ( UInt_t i=0; i<smduClusters.size(); i++ )
965  {
966  StEmcCluster *cl=smduClusters[i];
967  assert(cl);
968  emc_sum_smdu += cl->energy();
969  }
970 
971 
972  for ( Int_t sec=0; sec<12; sec++ )
973  {
974 
975  for ( Int_t i=0; i<numberOfSmdClusters(sec,0); i++ )
976 
977  {
978  eemc_sum_smdu += smdcluster(sec,0,i).energy();
979 
980  }
981 
982  }
983 
984  std::cout << "StEEmcClusterMaker smdu checksum: ";
985  if ( emc_sum_smdu == eemc_sum_smdu ) {
986  std::cout << "passed";
987  }
988  else {
989  std::cout << "FAILED"; go=false;
990  }
991  std::cout << std::endl;
992 
993  }
994  else
995  {
996  std::cout << "StEEmcClusterMaker smdu checksum: NULL collection, nclust=" << mNumberOfClusters[4] << std::endl;
997  go &= (mNumberOfClusters[4]==0);
998  }
999 
1000 
1002 
1003  Float_t emc_sum_smdv = 0.;
1004  Float_t eemc_sum_smdv = 0.;
1005 
1006  detector=stevent->emcCollection()->detector(kEndcapSmdVStripId);
1007  if (!detector)
1008  {
1009  Warning("verifyStEvent","detector == NULL for smdv");
1010  return false;
1011  }
1012 
1013  cc=detector->cluster();
1014 
1015  if ( cc )
1016  {
1017 
1018  StSPtrVecEmcCluster &smdvClusters=cc->clusters();
1019 
1020  for ( UInt_t i=0; i<smdvClusters.size(); i++ )
1021  {
1022  StEmcCluster *cl=smdvClusters[i];
1023  assert(cl);
1024  emc_sum_smdv += cl->energy();
1025  }
1026 
1027 
1028  for ( Int_t sec=0; sec<12; sec++ )
1029  {
1030 
1031  for ( Int_t i=0; i<numberOfSmdClusters(sec,1); i++ )
1032 
1033  {
1034  eemc_sum_smdv += smdcluster(sec,1,i).energy();
1035 
1036  }
1037 
1038  }
1039 
1040  std::cout << "StEEmcClusterMaker smdv checksum: ";
1041  if ( emc_sum_smdv == eemc_sum_smdv ) {
1042  std::cout << "passed";
1043  }
1044  else {
1045  std::cout << "FAILED"; go=false;
1046  }
1047  std::cout << std::endl;
1048 
1049  }
1050  else
1051  {
1052  std::cout << "StEEmcClusterMaker smdv checksum: NULL collection, nclust=" << mNumberOfClusters[5] << std::endl;
1053  go &= (mNumberOfClusters[5]==0);
1054  }
1055 
1056 
1057 
1058  return go;
1059 }
1060 
1061 
1062 
1063 // ----------------------------------------------------------------------------
1065 {
1066 
1067  std::cout << "StEEmcClusterMaker::print()" << std::endl;
1068  const Char_t *names[] = { "tower", "pre1", "pre2", "post", "smdu", "smdv" };
1069  for ( Int_t i=0;i<6;i++ )
1070  {
1071 
1072  std::cout << "Number of " << names[i]
1073  << " clusters = " << mNumberOfClusters[i]
1074  << std::endl;
1075 
1076  }
1077 
1078  std::cout << "printout of tower clusters follows:" << std::endl;
1079  for ( Int_t sec=0;sec<12;sec++)
1080  for ( Int_t i=0;i<numberOfClusters(sec,0);i++ )
1081  {
1082  StEEmcCluster clust=cluster(sec,0,i);
1083  clust.print();
1084  // std::cout << "cluster.key()=" << clust.key() << std::endl;
1085  // std::cout << "cluster.eta()=" << clust.momentum().Eta() << std::endl;
1086  // std::cout << "cluster.phi()=" << clust.momentum().Phi() << std::endl;
1087  // std::cout << "cluster.energy()=" << clust.energy() << std::endl;
1088  }
1089 
1090 
1091 
1092 }
TVector3 momentum() const
Definition: StEEmcCluster.h:69
const StEEmcA2EMaker * mEEanalysis
ADC–&gt;E maker.
TVector3 getTowerCenter(const UInt_t sec, const UInt_t sub, const UInt_t etabin) const
Int_t mSuppress
Supress seeds adjacent to clusters.
virtual void Clear(Option_t *opts="")
Clear clusters for next event.
StEEmcTower & tower(Int_t t)
Get the specified tower within the cluster.
Definition: StEEmcCluster.h:79
Int_t numberOfNeighbors() const
get the number of neighboring towers
Definition: StEEmcTower.h:54
EEmc ADC –&gt; energy maker.
void stat(unsigned s)
Set a status bit for this element.
Definition: StEEmcElement.h:23
StEEmcClusterMaker(const Char_t *name="mEEclusters")
Int_t numberOfClusters(Int_t sec, Int_t layer) const
Return number of clusters for a given sector, layer.
void add(const StEEmcTower &t, Float_t weight=1.0)
std::vector< std::vector< StEEmcSmdClusterVec_t > > mSmdClusters
StEEmcCluster & cluster(Int_t sec, Int_t layer, Int_t index)
Return a specific cluster from a given sector, layer.
const EEmcSmdMap * mEEmap
const EEmcGeomSimple * mEEtow
Int_t numberOfSmdClusters(Int_t sec, Int_t plane) const
Return number of smd clusters for a given sector, plane.
const EEmcSmdGeom * mEEsmd
Int_t mNumberOfClusters[6]
Counts clusters for full eemc, 0=T, 1=P, 2=Q, 3=R, 4=U, 5=V.
void neighbor(StEEmcTower *n)
add a tower to list of neighbors
Definition: StEEmcTower.h:52
StEEmcStrip & strip(Int_t sector, Int_t plane, Int_t strip)
std::vector< std::vector< StEEmcClusterVec_t > > mTowerClusters
std::vector< std::vector< StEEmcTowerVec_t > > mSeedTowers
Float_t mSeedFloor
blah...
Bool_t mFillStEvent
Option to fill StEvent.
void name(const Char_t *n)
Set the name for this element.
Definition: StEEmcElement.h:27
void print() const
Prints cluster data.
Int_t etabin() const
Returns the etabin of this tower, pre- or postshower element.
Definition: StEEmcTower.h:45
void fail(unsigned f)
Set a fail bit for this element.
Definition: StEEmcElement.h:25
TString mAnalysisName
ADC–&gt;E maker name.
Int_t subsector() const
Returns subsector of this tower, pre- or postshower element.
Definition: StEEmcTower.h:43
virtual Bool_t buildSmdClusters()
Constructs smd clusters.
virtual Bool_t buildTowerClusters()
Constructs tower clusters.
StEEmcStripVec_t & strips(Int_t sec, Int_t pln)
Returns a vector of hit strips, given the sector and plane.
void print() const
Print a summary of this tower.
Definition: StEEmcTower.cxx:58
void index(Int_t i)
Sets the index for this SMD strip, 0..287.
Definition: StEEmcStrip.cxx:32
void index(Int_t i)
Definition: StEEmcTower.cxx:76
Base class for representing tower, preshower and postshower elements.
Definition: StEEmcTower.h:11
StEmcCluster * stemc()
virtual Int_t Init()
Initialize.
Float_t mSeedEnergy[6]
Seed energy for 0=T, 1=P, 2=Q, 3=R, 4=U, 5=V.
Int_t sector() const
Returns sector of this tower, pre- or postshower element.
Definition: StEEmcTower.h:41
Int_t mMaxExtent
Maximum distance from SMD seed strips.
Int_t key()
Return a unique key assigned by the cluster maker.
StEmcCluster * stemc()
Int_t numberOfTowers() const
Get the number of towers in cluster.
Definition: StEEmcCluster.h:76
Definition: Stypes.h:42
EEMC simple geometry.
Definition: Stypes.h:40
A base class for representing clusters of EEMC smd strips.
virtual Int_t Make()
Make clusters for this event.
Float_t energy() const
Get energy of this cluster.
Definition: StEEmcCluster.h:62
void print() const
Event summary.
std::map< const StEmcCluster *, StEEmcCluster > mEtoEE
Map StEEmcClusters to StEmcClusters.
Bool_t verifyStEvent() const
A base class for describing clusters of EEMC towers.
Definition: StEEmcCluster.h:50
std::map< const StEmcCluster *, StEEmcSmdCluster > mEtoEEsmd
... and for smd clusters
void seedEnergy(Float_t energy, Int_t layer=0)
void stemc(StEmcRawHit *h)
Sets pointer to the StEmcRawHit when processing an StEvent file.
Definition: StEEmcElement.h:43
StEEmcSmdCluster & smdcluster(Int_t sec, Int_t plane, Int_t index)
return a specific cluster from a given sector, plane
StEEmcClusterVec_t & clusters(Int_t sec, Int_t layer)
Return a vector of tower clusters.
void fillStEvent()
Fills StEvent cluster collections if the option is selected.
void energy(Float_t e)
Set the energy (adc-ped+0.5)/gain for this element.
Definition: StEEmcElement.h:21
StEEmcStrip & strip(Int_t s)
Returns the specified smd strip w/in the cluster.
Base class for describing an endcap SMD strip.
Definition: StEEmcStrip.h:8
Int_t mClusterId
Keep track of clusters.
A cluster maker for the EEMC.