FairRoot/PandaRoot
Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
PndEmcClusterSimpleCalibrator Class Reference

#include <PndEmcClusterCalibrator.h>

Inheritance diagram for PndEmcClusterSimpleCalibrator:
PndEmcAbsClusterCalibrator

Public Member Functions

 PndEmcClusterSimpleCalibrator (Int_t version=1)
 
virtual ~PndEmcClusterSimpleCalibrator ()
 
void Init ()
 
virtual Double_t Energy (PndEmcCluster *clust, Int_t pid=22)
 
virtual TVector3 Where (PndEmcCluster *clust, Int_t pid=22)
 

Protected Attributes

Int_t fVersion
 
TString fPath
 

Private Member Functions

 PndEmcClusterSimpleCalibrator (const PndEmcClusterSimpleCalibrator &L)
 
PndEmcClusterSimpleCalibratoroperator= (const PndEmcClusterSimpleCalibrator &)
 

Private Attributes

PndEmcClusterCalibrationParObjectfParObject
 

Detailed Description

Definition at line 101 of file PndEmcClusterCalibrator.h.

Constructor & Destructor Documentation

PndEmcClusterSimpleCalibrator::PndEmcClusterSimpleCalibrator ( Int_t  version = 1)

Definition at line 465 of file PndEmcClusterCalibrator.cxx.

References fParObject, PndEmcAbsClusterCalibrator::fPath, and TString.

465  :
467 {
468  fPath = getenv("VMCWORKDIR");
469  fPath += "/macro/params/";
470 
471  TString fileNamePhoton;
472  fileNamePhoton.Form("emc_correction_par_gamma_%i.root",version);
473  fileNamePhoton=fPath+fileNamePhoton;
474  TFile *fPhoton;
475 
476 // TString fileNameElectron;
477 // TString fileNamePion;
478 // fileNameElectron.Form("emc_correction_par_electron_%i.root",version);
479 // fileNamePion.Form("emc_correction_par_pion_%i.root",version);
480 // fileNameElectron=fPath+fileNameElectron;
481 // fileNamePion=fPath+fileNamePion;
482 // TFile *fElectron, *fPion;
483 
484  fPhoton = new TFile(fileNamePhoton,"READ");
485  if (fPhoton->IsZombie())
486  {
487  std::cout<<"EMC cluster correction file "<<fileNamePhoton<<" for photons does not exist for given version"<<std::endl;
488  } else
489  {
490  // Photon
491  fPhoton->GetObject("PndEmcClusterCalibrationParObject",fParObject);
492  if(fParObject == NULL){
493  std::cout << "-E- PndEmcClusterSimpleCalibrator: Could not get Emc cluster calibration information from file " << fPhoton << std::endl;
494  } else
495  {
496  std::cout<<"EMC photon calibration parameters are read succesfully"<<std::endl;
497  }
498  }
499 // fElectron = new TFile(fileNameElectron,"READ");
500 // if (fElectron->IsZombie())
501 // {
502 // std::cout<<"EMC cluster correction file "<<fileNameElectron<<" for electrons does not exist for given version"<<std::endl;
503 // } else
504 // {
505 // // Photon
506 // fElectron->GetObject("PndEmcClusterCalibrationParObject",fParObject);
507 // if(fParObject == NULL){
508 // std::cout << "-E- PndEmcClusterSimpleCalibrator: Could not get Emc cluster calibration information from file " << fElectron<< std::endl;
509 // }
510 // }
511 //
512 // fPion = new TFile(fileNamePion,"READ");
513 // if (fPion->IsZombie())
514 // {
515 // std::cout<<"EMC cluster correction file "<<fileNamePion<<" for pions does not exist for given version"<<std::endl;
516 // } else
517 // {
518 // // Photon
519 // fPion->GetObject("PndEmcClusterCalibrationParObject",fParObject);
520 // if(fParObject == NULL){
521 // std::cout << "-E- PndEmcClusterSimpleCalibrator: Could not get Emc cluster calibration information from file " << fPion << std::endl;
522 // }
523 // }
524 }
PndEmcClusterCalibrationParObject * fParObject
PndEmcClusterSimpleCalibrator::~PndEmcClusterSimpleCalibrator ( )
virtual

Definition at line 628 of file PndEmcClusterCalibrator.cxx.

629 {
630 }
PndEmcClusterSimpleCalibrator::PndEmcClusterSimpleCalibrator ( const PndEmcClusterSimpleCalibrator L)
private

Member Function Documentation

Double_t PndEmcClusterSimpleCalibrator::Energy ( PndEmcCluster clust,
Int_t  pid = 22 
)
virtual

Implements PndEmcAbsClusterCalibrator.

Definition at line 531 of file PndEmcClusterCalibrator.cxx.

References cos(), Double_t, PndEmcCluster::energy(), exp(), fParObject, PndEmcClusterCalibrationParObject::GetCalibrationPar(), log(), p1, p2, Pi, sqrt(), and PndEmcCluster::where().

532 {
533  if (pid!=22)
534  {
535  std::cout<<"PndEmcClusterSimpleCalibrator:: EMC Cluster energy correction is not defined for pid="<<pid<<". Photon correction is used"<<std::endl;
536  }
537 
538  Double_t e=clust->energy();
539  TVector3 clusterPosition= clust->where();
540  Double_t theta_cluster=clusterPosition.Theta();
541 
542  Double_t e1=e;
543  Double_t theta1=theta_cluster;
544 
545  if ( (clusterPosition.Z() < 180.0)&&(theta_cluster<141.*TMath::Pi()/180.))
546  {
547  if (e<0.03) e1 = 0.03;
548  if (e>8.0) e1 = 8.0 ;
549  }
550 
551  if ( (clusterPosition.Z() < 180.0)&&(theta_cluster>141.*TMath::Pi()/180.))
552  {
553  if (e<0.03) e1 = 0.03;
554  if (e>2.0) e1 = 2.0 ;
555  }
556 
557  if (clusterPosition.Z() > 180.0)
558  {
559  if (e<0.01) e1 = 0.01;
560  if (e>16.0) e1 = 16.0 ;
561  }
562 
563  Int_t iParSet; // EMC component and energy range (1 - barrel (below 1 GeV, 2 -barrel (above 1 geV, 3 -forward endcap, 4 -backward endcap, 5 -shashlyk) )
564 
565  if ( clusterPosition.Z() > 500.0)
566  {
567  iParSet=5;
568  }
569  else if ( (clusterPosition.Z() < 180.0)&&(theta_cluster>141.*TMath::Pi()/180.))
570  {
571  iParSet=4;
572  }
573  else if ( (clusterPosition.Z() < 180.0)&&(theta_cluster<141.*TMath::Pi()/180.))
574  {
575  if (e1<1.0)
576  iParSet=1;
577  else
578  iParSet=2;
579  }
580  else
581  {
582  iParSet=3;
583  }
584 
585  Double_t pars[10];
586  fParObject->GetCalibrationPar(iParSet, pars);
587 
588  double p0, p1, p2, p3, p4, p5, p6, p7, p8, p9;
589  double eout;
590 
591  if (iParSet==5)
592  {
593  p0=pars[0];
594  p1=pars[1];
595  p2=pars[2];
596  p3=pars[3];
597  p4=pars[4];
598  eout=(p0-p1/sqrt(e1)+p2/e1+p3/(e1*e1)-p4/(e1*sqrt(e1)))*e;
599  } else
600  {
601  p0=pars[0];
602  p1=pars[1];
603  p2=pars[2];
604  p3=pars[3];
605  p4=pars[4];
606  p5=pars[5];
607  p6=pars[6];
608  p7=pars[7];
609  p8=pars[8];
610  p9=pars[9];
611 
612  double factor1= p0
613  +p1*log(e1)
614  +p2*log(e1)*log(e1)
615  +p3*log(e1)*log(e1)*log(e1)
616  +p4*cos(theta1)
617  +p5*cos(theta1)*cos(theta1)
618  +p6*cos(theta1)*cos(theta1)*cos(theta1)
619  +p7*cos(theta1)*cos(theta1)*cos(theta1)*cos(theta1)
620  +p8*cos(theta1)*cos(theta1)*cos(theta1)*cos(theta1)*cos(theta1)
621  +p9*log(e1)*cos(theta1);
622  eout=e* exp(factor1);
623  }
624 
625  return eout;
626 }
friend F32vec4 cos(const F32vec4 &a)
Definition: P4_F32vec4.h:112
TVector3 where() const
friend F32vec4 exp(const F32vec4 &a)
Definition: P4_F32vec4.h:109
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
int pid()
friend F32vec4 log(const F32vec4 &a)
Definition: P4_F32vec4.h:110
void GetCalibrationPar(Int_t iParSet, Double_t *pars)
Double_t
TPad * p2
Definition: hist-t7.C:117
virtual Double_t energy() const
TPad * p1
Definition: hist-t7.C:116
Double_t Pi
PndEmcClusterCalibrationParObject * fParObject
void PndEmcClusterSimpleCalibrator::Init ( )
inline

Definition at line 107 of file PndEmcClusterCalibrator.h.

107 {};
PndEmcClusterSimpleCalibrator& PndEmcClusterSimpleCalibrator::operator= ( const PndEmcClusterSimpleCalibrator )
inlineprivate

Definition at line 117 of file PndEmcClusterCalibrator.h.

117 {return *this;};
TVector3 PndEmcClusterSimpleCalibrator::Where ( PndEmcCluster clust,
Int_t  pid = 22 
)
virtual

Implements PndEmcAbsClusterCalibrator.

Definition at line 526 of file PndEmcClusterCalibrator.cxx.

References PndEmcCluster::where().

527 {
528  return clust->where();
529 }
TVector3 where() const

Member Data Documentation

PndEmcClusterCalibrationParObject* PndEmcClusterSimpleCalibrator::fParObject
private

Definition at line 114 of file PndEmcClusterCalibrator.h.

Referenced by Energy(), and PndEmcClusterSimpleCalibrator().

TString PndEmcAbsClusterCalibrator::fPath
protectedinherited
Int_t PndEmcAbsClusterCalibrator::fVersion
protectedinherited

Definition at line 49 of file PndEmcClusterCalibrator.h.


The documentation for this class was generated from the following files: