#include "Stntuple/obj/TCesDataBlock.hh" #include "TCesClusterMaker.hh" Int_t TCesClusterMaker::ClusterWedgeFixed( Int_t wedge, Int_t side, Int_t view) { int seeds[128]; float e[128]; int n = (view==0? 32: 128); int nseg = (view==0? 2: 1); int istr = 0; float eScale = (view==0? 240.0 : 120.0); int i,j; for(int iseg=0; iseg0) istr=32; for(int ii=0; ii<128; ii++) seeds[ii]=0; int nseeds=0; // mark potential seeds if(view==0) { for(i=0; iGetWireData(side,wedge,i+istr)/eScale; } else { for(i=0; iGetStripData(side,wedge,i+istr)/eScale; } for(i=0; ifSeed) { seeds[i] |= 1; nseeds++; } } // end loop for marking seeds int highest; float emax; // mark the first seed emax = 0.0; highest=-1; for(i=0; iemax) { emax = e[i]; highest = i; } } // make clusters while( highest>=0 ) { float sume = 0.0; float sumex = 0.0; int firstStrip,lastStrip; // count back while not at end, not used, and within cluster firstStrip=highest; while(firstStrip>0 && (seeds[firstStrip-1]&4)==0 && (highest-firstStrip)<(fClusNStrips-1)) firstStrip--; lastStrip=highest; while(lastStrip<(n-1) && (seeds[lastStrip+1]&4)==0 && (lastStrip-highest)<(fClusNStrips-1)) lastStrip++; if( (lastStrip-firstStrip+1)>=fClusNStrips) { // then cluster found int nOnSide = fClusNStrips/2; if((lastStrip-highest)SetCode(code); clu->SetEnergy(sume); clu->SetCoord(sumex/sume); } else { // always mark the seed used or we will just come back to this seed seeds[highest] |= 4; } // find next seed emax = 0.0; highest=-1; for(i=0; iemax) { emax = e[i]; highest = i; } } } // end loop for making clusters } // end loop over segments return 0; } // end clustering Int_t TCesClusterMaker::ClusterWedgeVariable( Int_t wedge, Int_t side, Int_t view) { int seeds[128]; float e[128]; int n = (view==0? 32: 128); int nseg = (view==0? 2: 1); int istr = 0; float eScale = (view==0? 240.0 : 120.0); int i,j,k; for(int iseg=0; iseg0) istr=32; for(int ii=0; ii<128; ii++) seeds[ii]=0; int nseeds=0; // mark potential seeds if(view==0) { for(i=0; iGetWireData(side,wedge,i+istr)/eScale; } else { for(i=0; iGetStripData(side,wedge,i+istr)/eScale; } for(i=0; ifSeed && (i==0 || e[i-1]fShoulder) seeds[i] |= 2; } // end loop for marking seeds // check that the separation between peaks is good enough // to make separate clusters for(i=0; i=0 && (seeds[j]&1)==0 && (seeds[j]&2)!=0 ) j--; if(j<0 || (seeds[j]&2)==0) { // then just ran to edge for(k=j+1; kn || (seeds[j]&2)==0) { // then just ran to edge for(k=i+1; kSetCode(code); clu->SetEnergy(sume); clu->SetCoord(sumex/sume); } // endif this is a seed } // end loop for making clusters } // end loop over segments return 0; } // end clustering // channel # to local coord. x is always in increasing phi // unlike CES code. z is same as CDF z Float_t TCesClusterMaker::Coord(int side, int view, int wire) { if(view==0) { float x; int w = wire; if(wire>=32) w=wire-32; x = 1.45484*(float(w)-15.5); // edge wires are not ganged, therefore 1/2 pitch closer if(w==0) x += 1.45484/2.0; if(w==31) x -= 1.45484/2.0; if(side==0) x = -x; return x; } else { float z; int s = wire; if(s<64) { z = 6.16 + float(s)*1.667; } else { z = 121.183 + float(s-64)*2.007; } return (side==0? -z: z); } // endif on view } Int_t TCesClusterMaker::ClusterWedge(Int_t wedge, Int_t side, Int_t view) { int wed0=0,wed1=24,sid0=0,sid1=2,vew0=0,vew1=2; if(wedge>=0) { wed0=wedge; wed1=wedge+1;} if(side >=0) { sid0=side; sid1=side+1; } if(view >=0) { vew0=view; vew1=view+1; } int stat=0; for(int wed=wed0; wedWedge()==wedge) { if(side<0 || Cluster(i)->Side()==side) { if(view<0 || Cluster(i)->View()==view) { n++; } } } } return n; }