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

#include <PndPidBremCorrector.h>

Inheritance diagram for PndPidBremCorrector:

Public Member Functions

 PndPidBremCorrector ()
 
virtual ~PndPidBremCorrector ()
 
virtual InitStatus Init ()
 
virtual void Exec (Option_t *opt)
 
void SetStorageOfData (Bool_t p=kTRUE)
 
virtual void FinishTask ()
 
void SetOutputBranch (TString branch)
 

Private Member Functions

PndPidBremCorrected4MomAddBremCorrected4Mom ()
 
double GetSepPhotonE (PndPidCandidate *, std::vector< Int_t > &)
 
double GetMergPhotonE (PndPidCandidate *, std::vector< Int_t > &)
 
void GetEmcPhiBumpList (int iClust)
 
 PndPidBremCorrector (const PndPidBremCorrector &L)
 
PndPidBremCorrectoroperator= (const PndPidBremCorrector &)
 
 ClassDef (PndPidBremCorrector, 1)
 

Private Attributes

TClonesArray * fBumpArray
 
TClonesArray * fClusterArray
 
TClonesArray * fPhiBumpArray
 
TClonesArray * fChargedCandidateArray
 
TClonesArray * fNeutralCandidateArray
 
TClonesArray * fBremCorrected4MomArray
 
double fRecMomOfEle
 
double fRecThetaOfEle
 
double fRecPhiOfEle
 
int fCharge
 
Double_t fSepPhotonE
 
Double_t fMergPhotonE
 
std::vector< PndEmcBump * > fEmcPhiBumpList
 
TString fTrackBranchNamePidHypo
 
Bool_t fPersistance
 

Detailed Description

Definition at line 23 of file PndPidBremCorrector.h.

Constructor & Destructor Documentation

PndPidBremCorrector::PndPidBremCorrector ( )

Definition at line 36 of file PndPidBremCorrector.cxx.

36  :
38 {
39 
40 }
TClonesArray * fNeutralCandidateArray
TClonesArray * fChargedCandidateArray
TClonesArray * fClusterArray
TClonesArray * fPhiBumpArray
TClonesArray * fBremCorrected4MomArray
std::vector< PndEmcBump * > fEmcPhiBumpList
TClonesArray * fBumpArray
PndPidBremCorrector::~PndPidBremCorrector ( )
virtual

Definition at line 42 of file PndPidBremCorrector.cxx.

43 {
44 
45 }
PndPidBremCorrector::PndPidBremCorrector ( const PndPidBremCorrector L)
private

Member Function Documentation

PndPidBremCorrected4Mom * PndPidBremCorrector::AddBremCorrected4Mom ( )
private

Definition at line 144 of file PndPidBremCorrector.cxx.

References fBremCorrected4MomArray.

Referenced by Exec().

144  {
145  TClonesArray& clref = *fBremCorrected4MomArray;
146  Int_t size = clref.GetEntriesFast();
147  return new(clref[size]) PndPidBremCorrected4Mom();
148 }
TClonesArray * fBremCorrected4MomArray
PndPidBremCorrector::ClassDef ( PndPidBremCorrector  ,
 
)
private
void PndPidBremCorrector::Exec ( Option_t *  opt)
virtual

Virtual method Exec

Definition at line 102 of file PndPidBremCorrector.cxx.

References AddBremCorrected4Mom(), fBremCorrected4MomArray, fCharge, fChargedCandidateArray, fMergPhotonE, fRecMomOfEle, fRecPhiOfEle, fRecThetaOfEle, fSepPhotonE, PndPidCandidate::GetCharge(), PndPidCandidate::GetEnergy(), GetMergPhotonE(), PndPidCandidate::GetMomentum(), GetSepPhotonE(), i, and mom.

103 {
104 
105  // Reset output array
106  if ( ! fBremCorrected4MomArray ) Fatal("Exec", "No BremCorrected4Mom Array");
107  fBremCorrected4MomArray->Delete();
108 
109  int nChargedCand = fChargedCandidateArray->GetEntriesFast();
110 
111  for (int iCand = 0; iCand<nChargedCand; ++iCand){
112 
113  PndPidCandidate* theChargedCand = (PndPidCandidate*) fChargedCandidateArray->At(iCand);
114  fRecMomOfEle = theChargedCand->GetMomentum().Mag();
115  fRecThetaOfEle = theChargedCand->GetMomentum().Theta()*TMath::RadToDeg();
116  fRecPhiOfEle = theChargedCand->GetMomentum().Phi()*TMath::RadToDeg();
117  fCharge = theChargedCand->GetCharge();
118 
119  TVector3 mom = theChargedCand->GetMomentum();
120  double ene = theChargedCand->GetEnergy();
121  TLorentzVector m4 = TLorentzVector(mom,ene);
122  //double mass = m4.M();
123  double mass = 0.000511; // Electron mass hypothesis (GeV)
124 
125  std::vector<int> sep_bumps, phi_bumps;
126  fSepPhotonE = GetSepPhotonE(theChargedCand, sep_bumps);
127  fMergPhotonE = GetMergPhotonE(theChargedCand, phi_bumps);
128  double energy_gamma = fSepPhotonE + fMergPhotonE;
129 
130  TVector3 momCorr = ((energy_gamma+fRecMomOfEle)/fRecMomOfEle) * mom;
131  double eneCorr = TMath::Hypot(mass, momCorr.Mag());
132 
134  bremCorr->SetMomentum(momCorr);
135  bremCorr->SetEnergy(eneCorr);
136  for (size_t i=0; i < sep_bumps.size(); ++i) bremCorr->AddToSepBumpList(sep_bumps[i]);
137  for (size_t i=0; i < phi_bumps.size(); ++i) bremCorr->AddToPhiBumpList(phi_bumps[i]);
138  bremCorr->SetPidCandIdx(iCand);
139 
140  }
141 
142 }
Int_t GetCharge() const
Int_t i
Definition: run_full.C:25
Double_t GetEnergy() const
Double_t mom
Definition: plot_dirc.C:14
TClonesArray * fChargedCandidateArray
TClonesArray * fBremCorrected4MomArray
PndPidBremCorrected4Mom * AddBremCorrected4Mom()
TVector3 GetMomentum() const
double GetMergPhotonE(PndPidCandidate *, std::vector< Int_t > &)
double GetSepPhotonE(PndPidCandidate *, std::vector< Int_t > &)
virtual void PndPidBremCorrector::FinishTask ( )
inlinevirtual

Definition at line 43 of file PndPidBremCorrector.h.

43 {};
void PndPidBremCorrector::GetEmcPhiBumpList ( int  iClust)
private

Definition at line 241 of file PndPidBremCorrector.cxx.

References fEmcPhiBumpList, fPhiBumpArray, and PndEmcBump::GetClusterIndex().

Referenced by GetMergPhotonE().

241  {
242  fEmcPhiBumpList.clear();
243  int nPhiBump = fPhiBumpArray->GetEntriesFast();
244  for (int ipb=0; ipb<nPhiBump; ++ipb) {
245  PndEmcBump *phibump = (PndEmcBump*) fPhiBumpArray->At(ipb);
246  if ( phibump->GetClusterIndex() == iClust ) {
247  fEmcPhiBumpList.push_back(phibump);
248  }
249  }
250 }
Int_t GetClusterIndex()
Definition: PndEmcBump.h:54
TClonesArray * fPhiBumpArray
std::vector< PndEmcBump * > fEmcPhiBumpList
represents a reconstructed (splitted) emc cluster
Definition: PndEmcBump.h:34
double PndPidBremCorrector::GetMergPhotonE ( PndPidCandidate ,
std::vector< Int_t > &   
)
private

Definition at line 202 of file PndPidBremCorrector.cxx.

References Double_t, energy, fBumpArray, fCharge, fEmcPhiBumpList, fRecMomOfEle, PndEmcBump::GetClusterIndex(), PndPidCandidate::GetEmcIndex(), GetEmcPhiBumpList(), and r.

Referenced by Exec().

202  {
203 
204  Double_t PhotonTotEnergyMerg = 0.0;
205 
206  // no EMcal cluster associated with track ...
207  if (ChargedCand->GetEmcIndex() < 0) return 0.0;
208 
209  PndEmcBump *EleBump = (PndEmcBump *) fBumpArray->At(ChargedCand->GetEmcIndex());
210  Int_t EleRefCluster = EleBump->GetClusterIndex();
211 
212  if (EleRefCluster < 0) return 0.0;
213  GetEmcPhiBumpList(EleRefCluster);
214 
215  //Double_t EnergyCut = 0.15/TMath::Sin(fRecThetaOfEle*TMath::DegToRad()); //[R.K. 01/2017] unused variable
216  //Double_t EleEnergy = 0; //[R.K. 01/2017] unused variable
217 
218  int iMax = 0;
219  Float_t eMax = -1e9;
220  for (size_t ib = 0; ib < fEmcPhiBumpList.size(); ++ib) {
221  if( fEmcPhiBumpList[ib]->energy() > eMax) {
222  iMax = ib;
223  eMax = fEmcPhiBumpList[ib]->energy();
224  }
225  }
226  Int_t iS = fCharge<0?0:iMax+1;
227  Int_t iE = fCharge<0?iMax-1:fEmcPhiBumpList.size()-1;
228  for(Int_t r = iS; r<=iE; r++) {
229  PhotonTotEnergyMerg += fEmcPhiBumpList[r]->energy();
230  phi_bumps.push_back(r);
231  }
232 
233  if(PhotonTotEnergyMerg > fRecMomOfEle/100.) {
234  return PhotonTotEnergyMerg;
235  } else {
236  return 0.0;
237  }
238 
239 }
double r
Definition: RiemannTest.C:14
Double_t
Int_t GetClusterIndex()
Definition: PndEmcBump.h:54
void GetEmcPhiBumpList(int iClust)
std::vector< PndEmcBump * > fEmcPhiBumpList
represents a reconstructed (splitted) emc cluster
Definition: PndEmcBump.h:34
TClonesArray * fBumpArray
Double_t energy
Definition: plot_dirc.C:15
double PndPidBremCorrector::GetSepPhotonE ( PndPidCandidate ,
std::vector< Int_t > &   
)
private

Definition at line 150 of file PndPidBremCorrector.cxx.

References CAMath::ASin(), Bool_t, Double_t, fBumpArray, fCharge, fRecMomOfEle, fRecPhiOfEle, fRecThetaOfEle, PndEmcBump::GetClusterIndex(), PndPidCandidate::GetEmcIndex(), PndEmcCluster::GetEnergyCorrected(), PndEmcCluster::position(), CAMath::Sin(), and CAMath::Tan().

Referenced by Exec().

150  {
151 
152  Float_t PhotonTotEnergySepWtd = 0;
153 
154  const int iTrkEmcIdx = ChargedCand->GetEmcIndex();
155  if (iTrkEmcIdx<0) return 0;
156 
157  const int nBump = fBumpArray->GetEntriesFast();
158  for(Int_t iBump = 0; iBump<nBump; ++iBump)
159  {
160  PndEmcBump *PhotonBump = (PndEmcBump *) fBumpArray->At(iBump);
161  const Float_t PhotonEnergySep = PhotonBump->GetEnergyCorrected();
162 
163  const Int_t iSepBump = PhotonBump->GetClusterIndex();
164  if ( iSepBump == iTrkEmcIdx ) continue;
165 
166  const Double_t PhotonThetaSep = PhotonBump->position().Theta()*TMath::RadToDeg();
167  const Double_t PhotonPhiSep = PhotonBump->position().Phi()*TMath::RadToDeg();
168 
169  const Bool_t fwd = fRecThetaOfEle <= 23.;
170  const Float_t Pt = fRecMomOfEle*TMath::Sin(fRecThetaOfEle/TMath::RadToDeg());
171  const Float_t DeltaPhiBarrel = TMath::ASin(0.12/Pt)*2.*TMath::RadToDeg();
172  const Float_t DeltaPhiForward = (0.6*2.0/Pt)*TMath::Tan(fRecThetaOfEle/57.3)*57.3;
173 
174  const Float_t RealDeltaPhi = fCharge<0?PhotonPhiSep-fRecPhiOfEle:fRecPhiOfEle-PhotonPhiSep;
175  const Float_t RealDeltaTheta = fCharge<0?PhotonThetaSep-fRecThetaOfEle:fRecThetaOfEle-PhotonThetaSep;
176 
177  const Float_t rad_calc = 100.*TMath::Sin(RealDeltaPhi*TMath::DegToRad()/2.)*2.0*Pt/0.3/2.0; // B=2T
178  const Float_t zed_calc = rad_calc/TMath::Tan(TMath::DegToRad()*fRecThetaOfEle);
179 
180  const Float_t wt = fwd ? 1.0/(1.+TMath::Exp((zed_calc-90.)/25.)) : 1.0/(1.+TMath::Exp((rad_calc-21.)/5.));
181  const Float_t ThetaCutUp = 2.;
182  const Float_t ThetaCutDown = -2.;
183  const Float_t PhiCutUp = fwd ? DeltaPhiForward : DeltaPhiBarrel;
184  const Float_t PhiCutDown = -1;
185 
186  const Bool_t PhiCut = RealDeltaPhi <= PhiCutUp && RealDeltaPhi >= PhiCutDown;
187  const Bool_t ThetaCut = RealDeltaTheta <= ThetaCutUp && RealDeltaTheta >= ThetaCutDown;
188 
189  if (PhiCut && ThetaCut) {
190  PhotonTotEnergySepWtd += wt*PhotonEnergySep;
191  sep_bumps.push_back(iSepBump);
192  }
193 
194  }//loop neutralcand
195 
196  if (PhotonTotEnergySepWtd < fRecMomOfEle/100.) PhotonTotEnergySepWtd = 0;
197 
198  return PhotonTotEnergySepWtd;
199 
200 }
static T ASin(const T &x)
static T Sin(const T &x)
Definition: PndCAMath.h:42
float Tan(float x)
Definition: PndCAMath.h:165
TVector3 position() const
Double_t
Int_t GetClusterIndex()
Definition: PndEmcBump.h:54
Double_t GetEnergyCorrected() const
represents a reconstructed (splitted) emc cluster
Definition: PndEmcBump.h:34
TClonesArray * fBumpArray
InitStatus PndPidBremCorrector::Init ( )
virtual

Virtual method Init

Definition at line 47 of file PndPidBremCorrector.cxx.

References fBremCorrected4MomArray, fBumpArray, fChargedCandidateArray, fClusterArray, fNeutralCandidateArray, fPersistance, fPhiBumpArray, and fTrackBranchNamePidHypo.

47  {
48 
49  // Get RootManager
50  FairRootManager* ioman = FairRootManager::Instance();
51  if ( ! ioman ){
52  cout << "-E- PndPidBremCorrector::Init: "
53  << "RootManager not instantiated!" << endl;
54  return kFATAL;
55  }
56 
57 
58  fClusterArray = dynamic_cast<TClonesArray *> (ioman->GetObject("EmcCluster"));
59  if ( ! fClusterArray ) {
60  cout << "-W- PndEmcMakeBump::Init: "
61  << "No PndEmcCluster array!" << endl;
62  return kERROR;
63  }
64 
65  fPhiBumpArray = dynamic_cast<TClonesArray *> (ioman->GetObject("EmcPhiBump"));
66  if ( ! fPhiBumpArray ) {
67  cout << "-W- PndEmcMakePhiBump::Init: "
68  << "No PhiBumpArray array!" << endl;
69  return kERROR;
70  }
71 
72  fBumpArray = dynamic_cast<TClonesArray *> (ioman->GetObject("EmcBump"));
73  if ( ! fBumpArray ) {
74  cout << "-W- PndEmcMakeBump::Init: "
75  << "No PndEmcBump array!" << endl;
76  return kERROR;
77  }
78 
79  fChargedCandidateArray = dynamic_cast<TClonesArray *> (ioman->GetObject("PidChargedCand"+fTrackBranchNamePidHypo));
80  if ( ! fChargedCandidateArray ) {
81  cout << "-W- PndEmcMakeBump::Init: "
82  << "No PidChargedCand array!" << endl;
83  return kERROR;
84  }
85 
86 
87  fNeutralCandidateArray = dynamic_cast<TClonesArray *> (ioman->GetObject("PidNeutralCand"+fTrackBranchNamePidHypo));
88  if ( ! fNeutralCandidateArray ) {
89  cout << "-W- PndEmcMakeBump::Init: "
90  << "No PidNeutralCand array!" << endl;
91  return kERROR;
92  }
93 
94 
95  fBremCorrected4MomArray = new TClonesArray("PndPidBremCorrected4Mom");
96  ioman->Register("BremCorrected4Mom"+fTrackBranchNamePidHypo,"Pid",fBremCorrected4MomArray,fPersistance);
97 
98  return kSUCCESS;
99 
100 }
TClonesArray * fNeutralCandidateArray
TClonesArray * fChargedCandidateArray
TClonesArray * fClusterArray
TClonesArray * fPhiBumpArray
TClonesArray * fBremCorrected4MomArray
TClonesArray * fBumpArray
PndPidBremCorrector& PndPidBremCorrector::operator= ( const PndPidBremCorrector )
inlineprivate

Definition at line 82 of file PndPidBremCorrector.h.

82 {return *this;};
void PndPidBremCorrector::SetOutputBranch ( TString  branch)
inline

Definition at line 44 of file PndPidBremCorrector.h.

References fTrackBranchNamePidHypo.

Referenced by PndMasterMultiPidTask::PndMasterMultiPidTask().

44 { fTrackBranchNamePidHypo = branch; };
void PndPidBremCorrector::SetStorageOfData ( Bool_t  p = kTRUE)
inline

Definition at line 40 of file PndPidBremCorrector.h.

References fPersistance, and p.

40 {fPersistance=p;};
Double_t p
Definition: anasim.C:58

Member Data Documentation

TClonesArray* PndPidBremCorrector::fBremCorrected4MomArray
private

Definition at line 65 of file PndPidBremCorrector.h.

Referenced by AddBremCorrected4Mom(), Exec(), and Init().

TClonesArray* PndPidBremCorrector::fBumpArray
private

Input array of PndEmcClusters

Definition at line 56 of file PndPidBremCorrector.h.

Referenced by GetMergPhotonE(), GetSepPhotonE(), and Init().

int PndPidBremCorrector::fCharge
private

Definition at line 70 of file PndPidBremCorrector.h.

Referenced by Exec(), GetMergPhotonE(), and GetSepPhotonE().

TClonesArray* PndPidBremCorrector::fChargedCandidateArray
private

Definition at line 62 of file PndPidBremCorrector.h.

Referenced by Exec(), and Init().

TClonesArray* PndPidBremCorrector::fClusterArray
private

Definition at line 57 of file PndPidBremCorrector.h.

Referenced by Init().

std::vector<PndEmcBump*> PndPidBremCorrector::fEmcPhiBumpList
private

Definition at line 75 of file PndPidBremCorrector.h.

Referenced by GetEmcPhiBumpList(), and GetMergPhotonE().

Double_t PndPidBremCorrector::fMergPhotonE
private

Definition at line 73 of file PndPidBremCorrector.h.

Referenced by Exec().

TClonesArray* PndPidBremCorrector::fNeutralCandidateArray
private

Definition at line 63 of file PndPidBremCorrector.h.

Referenced by Init().

Bool_t PndPidBremCorrector::fPersistance
private

Definition at line 78 of file PndPidBremCorrector.h.

Referenced by Init(), and SetStorageOfData().

TClonesArray* PndPidBremCorrector::fPhiBumpArray
private

Definition at line 60 of file PndPidBremCorrector.h.

Referenced by GetEmcPhiBumpList(), and Init().

double PndPidBremCorrector::fRecMomOfEle
private

Definition at line 67 of file PndPidBremCorrector.h.

Referenced by Exec(), GetMergPhotonE(), and GetSepPhotonE().

double PndPidBremCorrector::fRecPhiOfEle
private

Definition at line 69 of file PndPidBremCorrector.h.

Referenced by Exec(), and GetSepPhotonE().

double PndPidBremCorrector::fRecThetaOfEle
private

Definition at line 68 of file PndPidBremCorrector.h.

Referenced by Exec(), and GetSepPhotonE().

Double_t PndPidBremCorrector::fSepPhotonE
private

Definition at line 72 of file PndPidBremCorrector.h.

Referenced by Exec().

TString PndPidBremCorrector::fTrackBranchNamePidHypo
private

Definition at line 76 of file PndPidBremCorrector.h.

Referenced by Init(), and SetOutputBranch().


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