- //fGeomPtr->RelPosCellInSModule(digit->GetId(), idMax, dist, xyzi[0], xyzi[1], xyzi[2]);
- fGeomPtr->RelPosCellInSModule(digit->GetId(), dist, xyzi[0], xyzi[1], xyzi[2]);
-
- //Temporal patch, due to mapping problem, need to swap "y" in one of the 2 SM, although no effect in position calculation. GCB 05/2010
- if(fSharedCluster && fSuperModuleNumber != fGeomPtr->GetSuperModuleNumber(digit->GetId())) xyzi[1]*=-1;
-
- //printf("EvalLocalPosition Cell: Id %i, SM %i : dist %f Local x,y,z %f %f %f \n",
- // digit->GetId(), fGeomPtr->GetSuperModuleNumber(digit->GetId()), dist, xyzi[0], xyzi[1], xyzi[2]);
-
- if(logWeight > 0.0) w = TMath::Max( 0., logWeight + TMath::Log( fEnergyList[iDigit] / fAmp ));
- else w = fEnergyList[iDigit]; // just energy
-
- if(w>0.0) {
- wtot += w ;
- nstat++;
- for(i=0; i<3; i++ ) {
- clXYZ[i] += (w*xyzi[i]);
- clRmsXYZ[i] += (w*xyzi[i]*xyzi[i]);
- }
- }
- }
- // cout << " wtot " << wtot << endl;
- if ( wtot > 0 ) {
- // xRMS = TMath::Sqrt(x2m - xMean*xMean);
- for(i=0; i<3; i++ ) {
- clXYZ[i] /= wtot;
- if(nstat>1) {
- clRmsXYZ[i] /= (wtot*wtot);
- clRmsXYZ[i] = clRmsXYZ[i] - clXYZ[i]*clXYZ[i];
- if(clRmsXYZ[i] > 0.0) {
- clRmsXYZ[i] = TMath::Sqrt(clRmsXYZ[i]);
- } else clRmsXYZ[i] = 0;
- } else clRmsXYZ[i] = 0;
- }
- } else {
- for(i=0; i<3; i++ ) {
- clXYZ[i] = clRmsXYZ[i] = -1.;
- }
- }
- // clRmsXYZ[i] ??
-
-// // Cluster of one single digit, smear the position to avoid discrete position
-// // smear x and z with +- 3 cm to uniform (avoid discrete effects). Tower size is approx 6 cm.
-// // Rndm generates a number in ]0,1]
-// if (fMulDigit==1) {
-// clXYZ[0] += fGeomPtr->GetPhiTileSize()*(0.5 - gRandom->Rndm());
-// clXYZ[2] += fGeomPtr->GetEtaTileSize()*(0.5 - gRandom->Rndm());
-// }
-
- //Set position in local vector
- fLocPos.SetX(clXYZ[0]);
- fLocPos.SetY(clXYZ[1]);
- fLocPos.SetZ(clXYZ[2]);
-
- if (gDebug==2)
- printf("EvalLocalPosition Cluster: Local (x,y,z) = (%f,%f,%f) \n", fLocPos.X(), fLocPos.Y(), fLocPos.Z()) ;
-
+ fGeomPtr->RelPosCellInSModule(digit->GetId(), dist, xyzi[0], xyzi[1], xyzi[2]);
+
+ //Temporal patch, due to mapping problem, need to swap "y" in one of the 2 SM, although no effect in position calculation. GCB 05/2010
+ if(fSharedCluster && fSuperModuleNumber != fGeomPtr->GetSuperModuleNumber(digit->GetId())) xyzi[1]*=-1;
+
+ //printf("EvalLocalPosition Cell: Id %i, SM %i : dist %f Local x,y,z %f %f %f \n",
+ // digit->GetId(), fGeomPtr->GetSuperModuleNumber(digit->GetId()), dist, xyzi[0], xyzi[1], xyzi[2]);
+
+ if(logWeight > 0.0) w = TMath::Max( 0., logWeight + TMath::Log( fEnergyList[iDigit] / fAmp ));
+ else w = fEnergyList[iDigit]; // just energy
+
+ if(w>0.0) {
+ wtot += w ;
+ nstat++;
+ for(i=0; i<3; i++ ) {
+ clXYZ[i] += (w*xyzi[i]);
+ clRmsXYZ[i] += (w*xyzi[i]*xyzi[i]);
+ }
+ }
+ }
+ // cout << " wtot " << wtot << endl;
+ if ( wtot > 0 ) {
+ // xRMS = TMath::Sqrt(x2m - xMean*xMean);
+ for(i=0; i<3; i++ ) {
+ clXYZ[i] /= wtot;
+ if(nstat>1) {
+ clRmsXYZ[i] /= (wtot*wtot);
+ clRmsXYZ[i] = clRmsXYZ[i] - clXYZ[i]*clXYZ[i];
+ if(clRmsXYZ[i] > 0.0) {
+ clRmsXYZ[i] = TMath::Sqrt(clRmsXYZ[i]);
+ } else clRmsXYZ[i] = 0;
+ } else clRmsXYZ[i] = 0;
+ }
+ } else {
+ for(i=0; i<3; i++ ) {
+ clXYZ[i] = clRmsXYZ[i] = -1.;
+ }
+ }
+
+ // // Cluster of one single digit, smear the position to avoid discrete position
+ // // smear x and z with +- 3 cm to uniform (avoid discrete effects). Tower size is approx 6 cm.
+ // // Rndm generates a number in ]0,1]
+ // if (fMulDigit==1) {
+ // clXYZ[0] += fGeomPtr->GetPhiTileSize()*(0.5 - gRandom->Rndm());
+ // clXYZ[2] += fGeomPtr->GetEtaTileSize()*(0.5 - gRandom->Rndm());
+ // }
+
+ //Set position in local vector
+ fLocPos.SetX(clXYZ[0]);
+ fLocPos.SetY(clXYZ[1]);
+ fLocPos.SetZ(clXYZ[2]);
+
+ if (gDebug==2)
+ printf("EvalLocalPosition Cluster: Local (x,y,z) = (%f,%f,%f) \n", fLocPos.X(), fLocPos.Y(), fLocPos.Z()) ;
+