//-------------------------------------------------------------------------- // Description: // Class PndEmcErrorMatrix // Calculate Error Matrix for the given EmcCluster // with parametrization defined by the given parameter PndEmcErrorMatrixPar // //------------------------------------------------------------------------ #include "PndEmcErrorMatrix.h" #include "PndEmcErrorMatrixPar.h" #include "TSystem.h" #include PndEmcErrorMatrix::PndEmcErrorMatrix(): fErrorMatrixParObject(new PndEmcErrorMatrixParObject()) { } void PndEmcErrorMatrix::Init(PndEmcErrorMatrixParObject *par) { fErrorMatrixParObject=par; } void PndEmcErrorMatrix::InitFromFile(Int_t geomVersion) { TString fFileName; switch (geomVersion){ case 1: case 17: case 19: // correspond to geometries "emc_module12.dat","emc_module3new.root","emc_module4_StraightGeo24.4.root","emc_module5_fsc.root" fFileName="emc_error_matrix_1.root"; break; default: std::cout<<"Error matrix for EMC geometry: "<Getenv("VMCWORKDIR"); emc_error_file_name+="/input/"; emc_error_file_name+=fFileName; std::cout<<"EMC error matrix is read from: "<GetObject("PndEmcErrorMatrixParObject",fErrorMatrixParObject); if(fErrorMatrixParObject == NULL){ std::cout << "-E- PndEmcErrorMatrix: Could not get Emc error matrix information from file " << emc_error_file_name<< std::endl; } } } PndEmcErrorMatrix::~PndEmcErrorMatrix(){} PndEmcErrorMatrixParObject* PndEmcErrorMatrix::GetParObject() { return fErrorMatrixParObject; } TMatrixD PndEmcErrorMatrix::GetErrorMatrix(const PndEmcCluster &cluster) const { Double_t clEnergy=cluster.energy(); Double_t clTheta=cluster.theta(); Double_t clPhi=cluster.phi(); // In which part of EMC the cluster is located // 1,2 - barrel, 3 - fwd endcap, 4- backward endcap, 5 - shashlyk Int_t module=cluster.GetModule(); enum {barrel, fwcap, bwcap, fsc}; Int_t clusterInComponent=-1; //in which detector component is the cluster if( (module==1)||(module==2) ){ clusterInComponent = barrel; }else if( module==3 ){ clusterInComponent = fwcap; }else if( module==4 ){ clusterInComponent = bwcap; }else if( module==5 ){ clusterInComponent = fsc; }else{ std::cout<<"Incorrect EMC module in PndEmcErrorMatrix"<GetErrorMatrix(clusterInComponent, pars); Double_t engParA, engPower, engConst, engQuadr, pos1ParA, pos1Power, pos1Const, pos2ParA, pos2Power, pos2Const; engParA=pars[0]; engPower=pars[1]; engConst=pars[2]; engQuadr=pars[3]; pos1ParA=pars[4]; pos1Power=pars[5]; pos1Const=pars[6]; pos2ParA=pars[7]; pos2Power=pars[8]; pos2Const=pars[9]; //errors on position are estimated w/ respect to //nominal z=100. (for fwcap, bwcap, fsc) ---> dx(z) and dy(z) //and //nominal R=100. (for barrel) ---> dz(r) and dphi(r) //calculated errors are scaled with the following factors // Double_t barrelRadius=54.; Double_t bwCapPosZ = 56.; Double_t fwCapPosZ = 208.2; Double_t fscPosZ = 780.; Double_t scaleFactor[4]; scaleFactor[bwcap]=bwCapPosZ/100.; scaleFactor[barrel]=barrelRadius/100.; scaleFactor[fwcap]=fwCapPosZ/100.; scaleFactor[fsc]=fscPosZ/100.; Double_t energyMinCutOff[4]={ 0.1, 0.1, 0.1, 0.5 }; Double_t energyMaxCutOff[4]={ 1.5, 5., 7., 7. }; Double_t eng=clEnergy; if(clEnergy>energyMaxCutOff[clusterInComponent]) eng=energyMaxCutOff[clusterInComponent]; if(clEnergy