20 #include "TClonesArray.h"
54 std::vector<Int_t>::const_iterator digi_iter;
57 for (digi_iter=digiList.begin();digi_iter!=digiList.end();++digi_iter)
69 TVector3 clusterMomentum(0,0,0);
70 vector<Int_t>::const_iterator digi_iter;
71 TVector3 digiDirection;
75 for (digi_iter=digiList.begin();digi_iter!=digiList.end();++digi_iter)
78 digiDirection=digi->
where().Unit();
80 clusterMomentum=clusterMomentum+digiDirection*digiEnergy;
85 mass2=clEnergy*clEnergy-clusterMomentum.Mag2();
100 std::vector<Int_t>::const_iterator current;
104 if ( n==1 )
return( -999. );
114 for (current=digiList.begin();current!=digiList.end();++current)
124 maj+=t*(yy-theta_wtd)*e;
135 return( atan( maj ) );
141 if (!strcmp(method,
"lilo"))
144 }
else if (!strcmp(method,
"linear"))
150 std::cout<<
"Incorrect cluster position method: " << method.Data() <<std::endl;
159 TVector3 aVector(0,0,0);
161 std::vector<Int_t>::const_iterator current;
164 for (current=digiList.begin();current!=digiList.end();++current)
177 const PndEmcXtal *theGeom=tciXtalMap.find(theTCI)->second;
181 TVector3 centre(theGeom->
frontCentre() - TVector3(0.0,0.0,0.0));
183 double distanceOfPlane = normal.Dot(centre);
185 double amplitude = distanceOfPlane / normal.Dot(aVector.Unit());
187 aVector.SetMag(amplitude);
189 return TVector3( aVector.x(), aVector.y(), aVector.z() );
195 const double lClusEnergy=
Energy();
197 assert(lClusEnergy!=0);
199 TVector3 lLinSum( 0, 0, 0 );
203 std::vector<Int_t>::const_iterator current;
206 for (current=digiList.begin();current!=digiList.end();++current)
212 const TVector3 lDigiWhere=lDigi->
where();
214 const double lDigiEnergy=lDigi->
GetEnergy();
215 const double lLinWeight=lDigiEnergy/lClusEnergy;
217 lLinSum+=lLinWeight*lDigiWhere;
224 const PndEmcXtal *lGeom=tciXtalMap.find(lTCI)->second;
230 const TVector3 lVector = lCentre - lLinSum;
231 const double lLength = lNormal.Dot(lVector);
237 const TVector3 lUnit = lLinSum.Unit();
238 const double lMag = (lNormal.Dot(lCentre)/lNormal.Dot(lUnit));
239 lLinSum.SetMag(lMag);
252 const double lClusEnergy=
Energy();
254 assert(lClusEnergy!=0);
256 const double lOffset=
257 offsetParmA-offsetParmB*
exp(-offsetParmC*pow(lClusEnergy,1.171)) * pow(lClusEnergy,-0.534);
259 TVector3 lLiloPoint( 1, 1, 1 );
261 TVector3 lLinSum( 0, 0, 0 );
262 TVector3 lLogSum( 0, 0, 0 );
264 double lLogWeightSum=0;
267 bool lLogSecondTheta =
false;
268 bool lLogSecondPhi =
false;
269 int lLogFirstTheta = -666;
270 int lLogFirstPhi = -666;
272 std::vector<Int_t>::const_iterator current;
276 for (current=digiList.begin();current!=digiList.end();++current)
290 const TVector3 lDigiWhere=lDigi->
where();
294 const double lDigiEnergy=lDigi->
GetEnergy();
295 const double lLinWeight=lDigiEnergy/lClusEnergy;
296 const double lLogWeight=lOffset+
log(lLinWeight);
298 lLinSum+=lLinWeight*lDigiWhere;
301 lLogSum+=lLogWeight*lDigiWhere;
302 lLogWeightSum+=lLogWeight;
307 lLogFirstTheta=lDigiTheta;
308 lLogFirstPhi=lDigiPhi;
312 if(!lLogSecondTheta&&lDigiTheta!=lLogFirstTheta)
313 lLogSecondTheta=
true;
314 if(!lLogSecondPhi&&lDigiPhi!=lLogFirstPhi)
320 if(lLogNum>0) lLogSum*=1./lLogWeightSum;
323 lLiloPoint.SetTheta(lLogSecondTheta?lLogSum.Theta():lLinSum.Theta());
324 lLiloPoint.SetPhi(lLogSecondPhi?lLogSum.Phi():lLinSum.Phi());
331 const PndEmcXtal *lGeom=tciXtalMap.find(lTCI)->second;
335 const TVector3 lLiloVector = lLiloPoint;
339 const TVector3 lVector = lCentre - lLiloVector;
340 const double lLength = lNormal.Dot(lVector);
349 const TVector3 lUnit = lLiloVector.Unit();
350 const double lMag = (lNormal.Dot(lCentre)/lNormal.Dot(lUnit));
351 lLiloPoint.SetMag(lMag);
360 lLiloPoint.SetMag(lLogSum.Mag());
366 lLiloPoint.SetMag(lLinSum.Mag());
virtual ~PndEmcClusterProperties()
virtual Double_t GetEnergy() const
represents the reconstructed hit of one emc crystal
friend F32vec4 exp(const F32vec4 &a)
Int_t GetThetaInt() const
friend F32vec4 sqrt(const F32vec4 &a)
friend F32vec4 log(const F32vec4 &a)
const TVector3 & frontCentre() const
represents coordinates of one crystal
TVector3 Where(TString method, std::vector< Double_t > params)
const std::vector< Int_t > & DigiList() const
stores crystal index coordinates (x,y) or (theta,phi)
PndEmcClusterProperties(const PndEmcCluster &cluster, const TClonesArray *digiArray)
Double_t GetTheta() const
const TVector3 & normalToFrontFace() const
const PndEmcCluster & MyCluster() const
virtual Double_t Major_axis() const
const PndEmcTciXtalMap & GetTciXtalMap() const
a cluster (group of neighboring crystals) of hit emc crystals
PndEmcTwoCoordIndex * locateIndex(double theta, double phi) const
const TClonesArray * DigiArray() const
virtual double Phi1() const
virtual double Theta1() const
virtual Double_t Energy() const
TVector3 LiloWhere(std::vector< Double_t > params)
std::map< PndEmcTwoCoordIndex *, PndEmcXtal * > PndEmcTciXtalMap
virtual Double_t energy() const
const TVector3 & where() const
static PndEmcStructure * Instance()
PndEmcTwoCoordIndex * GetTCI() const
static Double_t FindPhiDiff(Double_t, Double_t)
virtual Double_t Mass() const