11 #include "hcategory.h"
88 for(Int_t s=0;s<6;s++) {
102 Error(
"HEmcClusterF::init()",
"No Emc Detector");
112 Error(
"HEmcClusterF::init()",
"Cal EMC input missing");
118 Warning(
"HEmcClusterF::init()",
"Cluster RPC input missing");
138 for(Int_t s=0;s<6;s++) {
162 Double_t xyz2 = xy2 + p->
getZ()*p->
getZ();
163 thetaEmcLab[s][c] = TMath::ATan2(TMath::Sqrt(xy2),p->
getZ())*TMath::RadToDeg();
177 for(Int_t sec=0;sec<6;sec++) {
182 for(Int_t e=0; e<nEmcCal; e++) {
208 Float_t posNorm =
energy[cell];
210 Float_t yPos =
cellYmod[cell]*energy[cell];
211 Float_t errXYPos = energy[cell]*energy[cell];
212 Float_t time0 = cal->
getTime();
213 Float_t clustEnergy = energy[cell];
214 Float_t clustEnErr = calsim==NULL ? 0. : TMath::Power(calsim->
getSigmaEnergy(),2);
215 Float_t timeSum = time0*energy[cell];
216 Float_t timeError = calsim==NULL ? 0. : TMath::Power(calsim->
getSigmaTime()*energy[cell],2);
218 Float_t qualityDThDPh,qualityDTime;
220 Int_t nMatchedCells = pRpcClusF==NULL ? 0 : 1;
235 for(Int_t i=0;i<8;i++) {
237 if(celli < 0)
continue;
238 if(
flagUsed[celli] != 0 )
continue;
240 if(cali == NULL)
continue;
244 Float_t dT0corr = tCorrI - time0;
245 if(dT0corr < timeCutMin || dT0corr >
timeCutMax)
continue;
247 Float_t dTcorr = tCorrI - tCorrN;
248 if(dTcorr < timeCutMin || dTcorr > timeCutMax)
continue;
255 timeError += TMath::Power(calsim->
getSigmaTime()*energy[celli],2);
262 posNorm += energy[celli];
263 xPos +=
cellXmod[celli]*energy[celli];
264 yPos +=
cellYmod[celli]*energy[celli];
265 errXYPos += energy[celli]*energy[celli];
267 timeSum += tCorrI*energy[celli];
268 clustEnergy += energy[celli];
274 Float_t qualityDThDPhI,qualityDTimeI;
276 if(pRpcClus != NULL) {
277 if(pRpcClus == pRpcClusF) nMatchedCells++;
278 else if(dist0 < 1.9) {
280 if(pRpcClusF == NULL) {
281 pRpcClusF = pRpcClus;
282 qualityDThDPh = qualityDThDPhI;
283 qualityDTime = qualityDTimeI;
294 timeSum /= clustEnergy;
295 timeError = TMath::Sqrt(timeError)/clustEnergy;
299 errXYPos =
sigmaXYmod*TMath::Sqrt(errXYPos)/posNorm;
307 if(pCluster == NULL) {
308 Warning(
"execute",
"S.%i No HEmcCluster slot available",sec+1);
312 for(Int_t s=0;s<size;s++)
pClustCells[s]->setClusterIndex(clustIndex);
328 pCluster->
setXYZLab(pos.getX(),pos.getY(),pos.getZ());
329 Double_t xy = TMath::Sqrt(pos.getX()*pos.getX() + pos.getY()*pos.getY());
330 Double_t
theta = TMath::ATan2(xy,pos.getZ())*TMath::RadToDeg();
331 Double_t
phi = TMath::ATan2(pos.getY(),pos.getX())*TMath::RadToDeg();
332 if(phi < 0.) phi += 360.;
336 if(pRpcClusF != NULL) {
345 map<Int_t,Float_t>clTrackEnergy;
346 for(Int_t ind=0;ind<size;ind++) {
349 if(ntr < 1)
continue;
350 for(Int_t i=0;i<ntr;i++) {
357 vector<pair<Int_t,Float_t> > vEn(clTrackEnergy.begin(),clTrackEnergy.end());
358 if(vEn.size() > 1) sort(vEn.begin(),vEn.end(),
cmpEnergy);
359 for(UInt_t i = 0; i < vEn.size(); i++) pClusterSim->
setTrack(vEn[i].first,vEn[i].second);
375 Float_t sigmaPh =
sigmaPhi[sec][cell];
377 Float_t sigmaTm = calsim==NULL ? 0.0 : calsim->
getSigmaTime();
380 qualityDThDPh = 1000000.;
381 qualityDTime = 1000000.;
383 Int_t nRpc =
fRpcCat->getEntries();
384 for(Int_t
n=0;
n<nRpc;
n++) {
391 Float_t deltaX = pemc->
getX()-xrl;
392 Float_t deltaY = pemc->
getY()-yrl;
393 Float_t deltaZ = pemc->
getZ()-zrl;
394 Float_t distRpcEmc = TMath::Sqrt(deltaX*deltaX+deltaY*deltaY+deltaZ*deltaZ);
395 Float_t timeCorr = distRpcEmc/TMath::Sqrt(xrl*xrl+yrl*yrl+zrl*zrl) * rpc->
getTof();
396 Float_t timeRpc = rpc->
getTof() + timeCorr;
400 Float_t dPhSig = (phEmc - rpc->
getPhi())/sigmaPh;
401 Float_t dThdPh = TMath::Sqrt(dThSig*dThSig + dPhSig*dPhSig);
411 dTOFc /= TMath::Sqrt(sigmaTm*sigmaTm + sigTof*sigTof);
412 if(TMath::Abs(dTOFc) >
dTimeCut)
continue;
416 if(TMath::Abs(dTOFc) < TMath::Abs(qualityDTime)) {
417 qualityDThDPh = dThdPh;
418 qualityDTime = dTOFc;
432 if(cellMax<0 ||
energy[cell] >
energy[cellMax]) cellMax = cell;
441 return TMath::Sqrt(dCol*dCol+dRow*dRow);
445 Char_t dColumn[8] = {-1,+1, 0, 0, -1,-1, +1,+1};
446 Char_t dRow[8] = { 0, 0, -1,+1, -1,+1, -1,+1};
Float_t getTrackEnergy(Short_t n) const
void getXYZLab(Float_t &x, Float_t &y, Float_t &z)
void setCellList(Int_t ncs, UChar_t *list)
virtual Bool_t addCategory(Cat_t aCat, HCategory *cat, Option_t opt[])=0
HGeomTransform & getTransform()
Float_t cellYmod[emcMaxComponents]
UChar_t listClustCell[emcMaxComponents]
Float_t cellXmod[emcMaxComponents]
Float_t sigmaPhi[6][emcMaxComponents]
Float_t energy[emcMaxComponents]
void setSigmaXYMod(Float_t sigma)
HGeomCompositeVolume * getRefVolume()
Short_t getNTracks(void) const
Float_t getSigmaEnergy(void) const
Float_t getEnergy(void) const
HGeomVector * emcCellsLab[6][emcMaxComponents]
HModGeomPar * getModule(const Int_t, const Int_t)
void setMatchedRpc(Bool_t f=kTRUE)
void setQualDThDPh(Float_t q)
void setSigmaEnergy(Float_t e)
void setXYZLab(Float_t x, Float_t y, Float_t z)
Float_t phiEmcLab[6][emcMaxComponents]
Int_t maxEnergyCell(void) const
HRuntimeDb * getRuntimeDb(void)
HEvent *& getCurrentEvent(void)
Char_t getRow(void) const
ClassImp(HDbColumn) HDbColumn
Short_t getStatus(void) const
Float_t thetaEmcLab[6][emcMaxComponents]
void setSigmaTime(Float_t t)
void setIndex(Short_t ind)
void setXYMod(Float_t x, Float_t y)
void setRpcIndex(Short_t i)
HSpectrometer * getSetup(void)
HDetector * getDetector(const Char_t *name)
const Cat_t catEmcCluster
HEmcCal * pClustCells[emcMaxComponents]
Char_t getColumn(void) const
void setTrack(Int_t trackNumber, Float_t energy)
void setQualDTime(Float_t q)
void setNMatchedCells(UChar_t n)
const Int_t emcMaxColumns
void setEnergy(Float_t e)
Float_t getTime(void) const
const Cat_t catRpcCluster
Int_t getNearbyCell(Int_t cell, Int_t i) const
HParSet * getContainer(const Text_t *)
Float_t sigmaTheta[6][emcMaxComponents]
Int_t getTrack(Short_t n=0) const
UChar_t getCell(void) const
Char_t flagUsed[emcMaxComponents]
HCategory * buildMatrixCategory(const Text_t *, Float_t)
const Int_t emcMaxComponents
void setRpcTrack(Int_t tr)
HEmcCal * pSecECells[emcMaxComponents]
virtual HCategory * getCategory(Cat_t aCat)=0
HGeomTransform & getLabTransform()
void setMaxEnergy(Float_t e)
HRpcCluster * rpcMatch(HEmcCal *cal, Float_t &qualityDThDPh, Float_t &qualityDTime)
Char_t getSector(void) const
Float_t calcDist(HEmcCal *cal1, HEmcCal *cal2) const
Float_t getSigmaTime(void) const
static bool cmpEnergy(pair< Int_t, Float_t > p1, pair< Int_t, Float_t > p2)
HGeomVolume * getComponent(const Int_t)