32 fFileName=
"emc_error_matrix_1.root";
35 std::cout<<
"Error matrix for EMC geometry: "<<geomVersion<<
" does not exist. Default is used."<<std::endl;
36 fFileName=
"emc_error_matrix_default.root";
39 TString emc_error_file_name = gSystem->Getenv(
"VMCWORKDIR");
40 emc_error_file_name+=
"/input/";
41 emc_error_file_name+=fFileName;
43 std::cout<<
"EMC error matrix is read from: "<<emc_error_file_name<<std::endl;
45 TFile *errorMatrixfile =
new TFile(emc_error_file_name.Data());
46 if(errorMatrixfile==NULL){
47 std::cout <<
"-E- PndEmcErrorMatrix: Could not open file " << emc_error_file_name <<
" for Emc error matrix parameters" << std::endl;
51 std::cout <<
"-E- PndEmcErrorMatrix: Could not get Emc error matrix information from file " << emc_error_file_name<< std::endl;
75 enum {barrel, fwcap, bwcap, fsc};
76 Int_t clusterInComponent=-1;
78 if( (module==1)||(module==2) ){
79 clusterInComponent = barrel;
80 }
else if( module==3 ){
81 clusterInComponent = fwcap;
82 }
else if( module==4 ){
83 clusterInComponent = bwcap;
84 }
else if( module==5 ){
85 clusterInComponent = fsc;
87 std::cout<<
"Incorrect EMC module in PndEmcErrorMatrix"<<std::endl;
96 Double_t engParA, engPower, engConst, engQuadr, pos1ParA, pos1Power, pos1Const, pos2ParA, pos2Power, pos2Const;
120 scaleFactor[bwcap]=bwCapPosZ/100.;
121 scaleFactor[barrel]=barrelRadius/100.;
122 scaleFactor[fwcap]=fwCapPosZ/100.;
123 scaleFactor[fsc]=fscPosZ/100.;
125 Double_t energyMinCutOff[4]={ 0.1, 0.1, 0.1, 0.5 };
126 Double_t energyMaxCutOff[4]={ 1.5, 5., 7., 7. };
128 if(clEnergy>energyMaxCutOff[clusterInComponent]) eng=energyMaxCutOff[clusterInComponent];
129 if(clEnergy<energyMinCutOff[clusterInComponent]) eng=energyMinCutOff[clusterInComponent];
133 Double_t errEnergy = engParA*engParA/pow(eng,engPower)
135 + pow(engQuadr/eng,2.0) ;
140 Double_t pos1Err= pow(pos1ParA,2.)/pow(eng,pos1Power)+pow(pos1Const,2.);
142 pos1Err*=scaleFactor[clusterInComponent];
144 Double_t pos2Err= pow(pos2ParA,2.)/pow(eng,pos2Power)+pow(pos2Const,2.);
146 if(clusterInComponent!=barrel)
147 pos2Err*=scaleFactor[clusterInComponent];
152 theError(0,0)=errEnergy*errEnergy;
153 theError(1,1)=pos1Err*pos1Err;
154 theError(2,2)=pos2Err*pos2Err;
165 if(clusterInComponent==barrel){
166 barrelRadius=scaleFactor[barrel]*100.;
173 trans(1,1)=-sin_theta*sin_theta/barrelRadius;
185 Double_t R=
fabs(scaleFactor[clusterInComponent]*100./cos_theta);
192 trans(1,1)= cos_theta * cos_phi /
R;
193 trans(1,2)= cos_theta * sin_phi /
R;
196 trans(2,1)= -sin_phi /(R*sin_theta);
197 trans(2,2)= cos_phi/(R*sin_theta);
217 double z_cluster = cluster.
where().Z();
218 double perp = cluster.
where().Perp();
219 double mag = cluster.
where().Mag();
220 double cos_theta = z_cluster / mag;
221 double sin_theta = perp / mag;
222 double sin_phi = cluster.
where().Y() / perp;
223 double cos_phi = cluster.
where().X() / perp;
224 double e=cluster.
energy();
229 toComp(0,0) = sin_theta * cos_phi * e/
p;
230 toComp(0,1) = p * cos_theta * cos_phi;
231 toComp(0,2) = -p * sin_theta * sin_phi;
233 toComp(1,0) = sin_theta * sin_phi * e/
p;
234 toComp(1,1) = p * cos_theta * sin_phi;
235 toComp(1,2) = p * sin_theta * cos_phi;
237 toComp(2,0) = cos_theta * e/
p;
238 toComp(2,1) = -p * sin_theta;
255 double z_cluster = cluster.
where().Z();
256 double perp = cluster.
where().Perp();
257 double mag = cluster.
where().Mag();
258 double cos_theta = z_cluster / mag;
259 double sin_theta = perp / mag;
260 double sin_phi = cluster.
where().Y() / perp;
261 double cos_phi = cluster.
where().X() / perp;
262 double e=cluster.
energy();
268 toComp(0,1) = mag * cos_theta * cos_phi;
269 toComp(0,2) = -mag* sin_theta * sin_phi;
270 toComp(0,3) = sin_theta * cos_phi;
272 toComp(1,1) = mag * cos_theta * sin_phi;
273 toComp(1,2) = mag * sin_theta * cos_phi;
274 toComp(1,3) = sin_theta * sin_phi;
276 toComp(2,1) = -mag * sin_theta;
278 toComp(2,3) = cos_theta;
279 toComp(3,0) = sin_theta * cos_phi;
280 toComp(3,1) = p * cos_theta * cos_phi;
281 toComp(3,2) = -p * sin_theta * sin_phi;
283 toComp(4,0) = sin_theta * sin_phi;
284 toComp(4,1) = p * cos_theta * sin_phi;
285 toComp(4,2) = p * sin_theta * cos_phi;
287 toComp(5,0) = cos_theta;
288 toComp(5,1) = -p * sin_theta;
307 TMatrixD result(m1.GetNrows(),m1.GetNrows());
312 for (
int r = 0;
r < m1.GetNrows();
r++) {
313 for (
int c = 0;
c <=
r;
c++) {
315 for (
int k = 0; k < m1.GetNcols(); k++) {
316 tmp += temp(
r,k)*m1(
c,k);
void Init(PndEmcErrorMatrixParObject *par)
friend F32vec4 cos(const F32vec4 &a)
Short_t GetModule() const
TMatrixD similarityWith(const TMatrixD &mat, const TMatrixD &m1)
void GetErrorMatrix(Int_t detectorComponent, Double_t *pars)
friend F32vec4 sin(const F32vec4 &a)
Container class for EMC error matrix parameter class is inherited from FairParGenericSet.
PndEmcErrorMatrixParObject * fErrorMatrixParObject
TMatrixD GetErrorP7(const PndEmcCluster &cluster) const
void InitFromFile(Int_t geomVersion)
TMatrixD Get4MomentumErrorMatrix(const PndEmcCluster &cluster) const
friend F32vec4 fabs(const F32vec4 &a)
a cluster (group of neighboring crystals) of hit emc crystals
virtual Double_t energy() const
PndEmcErrorMatrixParObject * GetParObject()
TMatrixT< double > TMatrixD
TMatrixD GetErrorMatrix(const PndEmcCluster &cluster) const