// --------------------------------------------------------------------- // ----- TRootKRATEvent source file ----- // ----- Created 10/11/13 by J. Lukasik ----- // ----- P. Pawlowski, S. Kupny ----- // --------------------------------------------------------------------- #ifndef __CINT__ #include #include "TBox.h" #include "TCanvas.h" #include "TH1F.h" #include "TH1D.h" #include "TH2F.h" #include "TNtuple.h" #include "TProfile.h" #include "TRandom.h" #include "TSystem.h" #include "TTree.h" #include "TVector3.h" #endif #include "TBox.h" #include "TCanvas.h" #include "TH1F.h" #include "TPaveLabel.h" #include "TROOT.h" #include "TMath.h" #include "TRandom3.h" #include "TGraph2D.h" #include "TH3D.h" #include "TSystemDirectory.h" #include "TSystemFile.h" #include "TList.h" #include "TRootKRATEvent.h" //////////////////////////////////////////////////////////////////////// ClassImp(TRootKRATEvent) ClassImp(TRootKRATParticle) //______________________________________________________________________ TRootKRATEvent::TRootKRATEvent() : fNhit(0), Run(0), Evt(-1), CMRapidity(-1), TgtThck(-1), BeamEnergy(-1), BeamA(-1), BeamZ(-1), BeamRapidity(-1) { fHit = new TClonesArray("TRootKRATParticle",35); } //______________________________________________________________________ TRootKRATEvent::~TRootKRATEvent() { Clear(); delete fHit; } //______________________________________________________________________ void TRootKRATEvent::Clear(Option_t* option) { fNhit = 0; Run = 0; Evt = -1; // event No. CMRapidity = -1; TgtThck = -1; // target thickness sprintf(TgtMat,"INITIAL"); // target material sprintf(Beam,"INITIAL"); BeamEnergy = -1; BeamA = -1; BeamZ = -1; BeamRapidity = -1; //if(fHit) fHit->Delete(); // v1.: - this version is slower (compared to v2) if(fHit) fHit->Clear(option); // v2.: - this version is faster and allowed here (no dynamic allocated memory) } //______________________________________________________________________ TRootKRATParticle* TRootKRATEvent::GetPtrToAnotherOneHit() { return (TRootKRATParticle*) fHit->ConstructedAt(fNhit++); } //______________________________________________________________________ TRootKRATEvent& TRootKRATEvent::operator=(const TRootKRATEvent& ke) { if (this == &ke) return *this; fNhit = ke.fNhit; Run = ke.Run; Evt = ke.Evt; CMRapidity = ke.CMRapidity; TgtThck = ke.TgtThck; BeamEnergy = ke.BeamEnergy; BeamA = ke.BeamA; BeamZ = ke.BeamZ; BeamRapidity = ke.BeamRapidity; for(int i = 0;i<20;++i){ TgtMat[i] = ke.TgtMat[i]; Beam[i] = ke.Beam[i]; } *fHit = TClonesArray(*ke.fHit); return *this; } //______________________________________________________________________ TRootKRATParticle::TRootKRATParticle() { Clear(); } //______________________________________________________________________ TRootKRATParticle::~TRootKRATParticle() { Clear(); } //______________________________________________________________________ void TRootKRATParticle::Clear(Option_t * opt) { //printf("[TRootKRATParticle::Clear] called \n"); Code = -1; Xident = -1; Yident = -1; Spect = -1; PID = -1; Z = -1; A = -1; RealA = -1; RealZ = -1; Module = -1; Energy = -1; EnergyOld = -1; de_csi2 = -1; de_myl1 = -1; de_csi1 = -1; de_myl0 = -1; de_sil1 = -1; de_ddl1 = -1; de_sil0 = -1; de_ddl0 = -1; de_win = -1; de_air = -1; de_tgt = -1; WeightCol = -1; WeightInt = -1; WeightGeant = -1; RangeCsI = 0.f; /// 0 and not -1 because such value was in clearing in Calibrate function. Keeped for allow compare with previous results. TODO: After that can be changed. DeltaECsI = 0.f; /// 0 and not -1 because such value was in clearing in Calibrate function. Keeped for allow compare with previous results. TODO: After that can be changed. EnergyDE01 = -1; EnergyDE0 = -1; Theta = -1; Phi = -1; ThetaRndm = -1; PhiRndm = -1; Pextra = false; Gamma = false; Gamma2[0]=Gamma2[1]=false; Star = false; Star2[0]=Star2[1]=false; Stopped[0]=Stopped[1]=Stopped[2]=Stopped[3]=false; PunchThrough = false; InTime = false; InTime3[0]=InTime3[1]=InTime3[2]=false; DiffTimeSigma[0]=DiffTimeSigma[1]=DiffTimeSigma[2]=-1000; RapidityLab =-10; RapidityCM =-10; Pt =-10; Px =-10; Py =-10; Pz =-10; Xt =-10; Winv =-10; Gam =-10; ch_csi2 = -1; ch_csi1 = -1; ch_sil1 = -1; ch_sil0 = -1; ch_slo2 = -1; ch_fas2 = -1; ch_sof2 = -1; ch_mod0 = -1; ch_sum1 = -1; ch_dif1 = -1; ch_sum2 = -1; ch_dif2 = -1; ch_log01 = -1; ch_slo1 = -1; ch_fas1 = -1; ch_sof1 = -1; ch_log1 = -1; ch_log2 = -1; ch_tm0 = -1; ch_tm1 = -1; ch_tm2 = -1; pthr_flag = 0; } //______________________________________________________________________ void TRootKRATParticle::Copy(const TRootKRATParticle& ds) { *this = ds; } //______________________________________________________________________ TRootKRATParticle& TRootKRATParticle::operator=(const TRootKRATParticle& ds) { if (this == &ds) return *this; Module = ds.Module; Code = ds.Code; Xident = ds.Xident; Yident = ds.Yident; Spect = ds.Spect; PID = ds.PID; Z = ds.Z; A = ds.A; RealA = ds.RealA; RealZ = ds.RealZ; Energy = ds.Energy; EnergyOld = ds.EnergyOld; de_csi2 = ds.de_csi2; de_myl1 = ds.de_myl1; de_csi1 = ds.de_csi1; de_csi1_cal = ds.de_csi1_cal; de_myl0 = ds.de_myl0; de_sil1 = ds.de_sil1; de_sil1_cal = ds.de_sil1_cal; de_ddl1 = ds.de_ddl1; de_sil0 = ds.de_sil0; de_sil0_cal = ds.de_sil0_cal; de_ddl0 = ds.de_ddl0; de_win = ds.de_win; de_air = ds.de_air; de_tgt = ds.de_tgt; WeightCol = ds.WeightCol; WeightInt = ds.WeightInt; WeightGeant = ds.WeightGeant; RangeCsI = ds.RangeCsI; DeltaECsI = ds.DeltaECsI; EnergyDE01 = ds.EnergyDE01; EnergyDE0 = ds.EnergyDE0; EneResDE01 = ds.EneResDE01; EneResDE0 = ds.EneResDE0; Theta = ds.Theta; Phi = ds.Phi; ThetaRndm = ds.ThetaRndm; PhiRndm = ds.PhiRndm; Pextra = ds.Pextra; Gamma = ds.Gamma; Star = ds.Star; for(int i = 0;i<2;++i){ Gamma2[i] = ds.Gamma2[i]; Star2[i] = ds.Star2[i]; } for(int i = 0;i<4;++i){ Stopped[i] = ds.Stopped[i]; } PunchThrough = ds.PunchThrough ; InTime = ds.InTime ; for(int i = 0;i<3;++i){ InTime3[i] = ds. InTime3[i]; DiffTimeSigma[i] = ds.DiffTimeSigma[i]; } RapidityLab = ds.RapidityLab; RapidityCM = ds.RapidityCM; Pt = ds.Pt; Px = ds.Px; Py = ds.Py; Pz = ds.Pz; Xt = ds.Xt; Winv = ds.Winv; Gam = ds.Gam; ch_csi2 = ds.ch_csi2; ch_csi1 = ds.ch_csi1; ch_sil1 = ds.ch_sil1; ch_sil0 = ds.ch_sil0; ch_slo2 = ds.ch_slo2; ch_fas2 = ds.ch_fas2; ch_sof2 = ds.ch_sof2; ch_mod0 = ds.ch_mod0; ch_sum1 = ds.ch_sum1; ch_dif1 = ds.ch_dif1; ch_sum2 = ds.ch_sum2; ch_dif2 = ds.ch_dif2; ch_log01 = ds.ch_log01; ch_slo1 = ds.ch_slo1; ch_fas1 = ds.ch_fas1; ch_sof1 = ds.ch_sof1; ch_log1 = ds.ch_log1; ch_log2 = ds.ch_log2; ch_tm0 = ds.ch_tm0; ch_tm1 = ds.ch_tm1; ch_tm2 = ds.ch_tm2; pthr_flag = ds.pthr_flag; return *this; } //______________________________________________________________________ std::ostream& operator<<(std::ostream& output, const TRootKRATEvent& kc) { output << "[TRootKRATEvent: "; output << " Run = \t" << kc.Run; /// MOCK output << ", Evt = \t" << kc.Evt; output << " NoHits=\t" << kc.fNhit; /// TODO: to be filled: For each in fHit: output << fHit[i] << endl; output << "]"; return output; } //______________________________________________________________________ void TRootKRATParticle::ls(Option_t*)const{ printf("Module = %d\n", Module); printf("Code = %d\n", Code); printf("PID = %d\n", PID); printf("Z = %d\n", Z); printf("A = %d\n", A); printf("RealA = %f\n", RealA); printf("RealZ = %f\n", RealZ); printf("Energy = %f\n", Energy); } /** This version of printing was used for checking identity the results * with results obtained from Jersy script //______________________________________________________________________ std::ostream& operator<<(std::ostream& output, const TRootKRATParticle& ae) { output << "[TRootKRATParticle:"; output << std::scientific; output << ", Module = \t" << ae.Module; output << ", Code = \t" << ae.Code; //output << ", Spect =\t" << ae.Spect; output << ", PID = \t" << ae.PID; output << ", Z = \t" << ae.Z; output << ", A = \t" << ae.A; output << ", RealZ = \t" << ae.RealZ; output << ", RealA = \t" << ae.RealA; output << ", Xident = \t" << ae.Xident; output << ", Yident = \t" << ae.Yident; output << ", Energy = \t" << ae.Energy; output << ", Theta = \t" << ae.Theta; output << ", Phi = \t" << ae.Phi; output << ", de_csi1 = \t" << ae.de_csi1; output << ", de_csi2 = \t" << ae.de_csi2; //output << ", de_csi1_cal = \t" << ae.de_csi1_cal; output << ", RangeCsI = \t" << ae.RangeCsI; //output << ", Pt = \t" << ae.Pt; //output << ", Px = \t" << ae.Px; //output << ", Py = \t" << ae.Py; //output << ", Pz = \t" << ae.Pz; output << ", ch_sof2 = \t" << ae.ch_sof2; output << "]"; return output; } */ //______________________________________________________________________ std::ostream& operator<<(std::ostream& output, const TRootKRATParticle& ae) { output << "[TRootKRATParticle:"; output << std::scientific; output << "Module = " << ae.Module; output << ", Code = " << ae.Code; output << ", PID = " << ae.PID; output << ", Z = " << ae.Z; output << ", A = " << ae.A; output << ", Energy = " << ae.Energy; output << ", RealZ = " << ae.RealZ; output << ", RealA = " << ae.RealA; output << "]"; return output; }