////////////////// const Int_t NMAX = 40; struct tpol0_t { Int_t nhits; Int_t eventnum; Int_t slot[NMAX]; Int_t sector[NMAX]; UShort_t waveform[NMAX][100]; Float_t t_iLeft_PSC[NMAX],t_iRight_PSC[NMAX]; Int_t nhits_PS,nhits_PSC; Float_t e_iLeft_PS[NMAX],e_iRight_PS[NMAX]; Int_t iLeft_PS[NMAX],iRight_PS[NMAX]; Int_t iLeft_PSC[NMAX],iRight_PSC[NMAX]; }; void getBranchesT0(TTree *inTree, tpol0_t *tpol0){ inTree->SetBranchAddress("nhits",&tpol0->nhits); inTree->SetBranchAddress("eventnum",&tpol0->eventnum); inTree->SetBranchAddress("slot",tpol0->slot); inTree->SetBranchAddress("sector",tpol0->sector); inTree->SetBranchAddress("waveform",tpol0->waveform); inTree->SetBranchAddress("nhits_PS",&tpol0->nhits_PS); inTree->SetBranchAddress("nhits_PSC",&tpol0->nhits_PSC); inTree->SetBranchAddress("iLeft_PSC",tpol0->iLeft_PSC); inTree->SetBranchAddress("iRight_PSC",tpol0->iRight_PSC); inTree->SetBranchAddress("e_iLeft_PS",tpol0->e_iLeft_PS); inTree->SetBranchAddress("e_iRight_PS",tpol0->e_iRight_PS); inTree->SetBranchAddress("t_iLeft_PSC",tpol0->t_iLeft_PSC); inTree->SetBranchAddress("t_iRight_PSC",tpol0->t_iRight_PSC); inTree->SetBranchAddress("iLeft_PS",tpol0->iLeft_PS); inTree->SetBranchAddress("iRight_PS",tpol0->iRight_PS); }; ////////////////// struct tpol1_t { Int_t nSectorHits; Int_t sector[NMAX]; Double_t phi[NMAX]; Double_t energy[NMAX]; Double_t energyErr[NMAX]; Double_t riseTime[NMAX]; Double_t riseTimeErr[NMAX]; Double_t energyOffset[NMAX]; Double_t energyOffsetErr[NMAX]; Double_t startTime[NMAX]; Double_t startTimeErr[NMAX]; Double_t confidenceLevel[NMAX]; Double_t chi2Reduced[NMAX]; //UShort_t waveform[NMAX][100]; Int_t nhits_PS,nhits_PSC; Double_t t_iLeft_PSC[NMAX],t_iRight_PSC[NMAX]; Int_t iLeft_PSC[NMAX],iRight_PSC[NMAX]; Double_t e_iLeft_PS[NMAX],e_iRight_PS[NMAX]; Int_t iLeft_PS[NMAX],iRight_PS[NMAX]; }; void setBranchesT1(TTree *outTree, tpol1_t *tpol1){ outTree->Branch("nSectorHits",&tpol1->nSectorHits,"nSectorHits/I"); outTree->Branch("sector",&tpol1->sector,"sector[nSectorHits]/I"); outTree->Branch("phi",tpol1->phi,"phi[nSectorHits]/D"); outTree->Branch("energy",tpol1->energy,"energy[nSectorHits]/D"); outTree->Branch("energyErr",tpol1->energyErr,"energyErr[nSectorHits]/D"); outTree->Branch("riseTime",tpol1->riseTime,"riseTime[nSectorHits]/D"); outTree->Branch("riseTimeErr",tpol1->riseTimeErr,"riseTimeErr[nSectorHits]/D"); outTree->Branch("energyOffset",tpol1->energyOffset,"energyOffset[nSectorHits]/D"); outTree->Branch("energyOffsetErr",tpol1->energyOffsetErr,"energyOffsetErr[nSectorHits]/D"); outTree->Branch("startTime",tpol1->startTime,"startTime[nSectorHits]/D"); outTree->Branch("startTimeErr",tpol1->startTimeErr,"startTimeErr[nSectorHits]/D"); outTree->Branch("confidenceLevel",tpol1->confidenceLevel,"confidenceLevel[nSectorHits]/D"); outTree->Branch("chi2Reduced",tpol1->chi2Reduced,"chi2Reduced[nSectorHits]/D"); outTree->Branch("nhits_PS",&tpol1->nhits_PS,"nhits_PS/I"); outTree->Branch("nhits_PSC",&tpol1->nhits_PSC,"nhits_PSC/I"); outTree->Branch("iLeft_PSC",tpol1->iLeft_PSC,"iLeft_PSC[nhits_PSC]/I"); outTree->Branch("iRight_PSC",tpol1->iRight_PSC,"iRight_PSC[nhits_PSC]/I"); outTree->Branch("e_iLeft_PS",tpol1->e_iLeft_PS,"e_iLeft_PS[nhits_PS]/D"); outTree->Branch("e_iRight_PS",tpol1->e_iRight_PS,"e_iRight_PS[nhits_PS]/D"); outTree->Branch("t_iLeft_PSC",tpol1->t_iLeft_PSC,"t_iLeft_PSC[nhits_PSC]/D"); outTree->Branch("t_iRight_PSC",tpol1->t_iRight_PSC,"t_iRight_PSC[nhits_PSC]/D"); outTree->Branch("iLeft_PS",tpol1->iLeft_PS,"iLeft_PS[nhits_PS]/I"); outTree->Branch("iRight_PS",tpol1->iRight_PS,"iRight_PS[nhits_PS]/I"); } void getBranchesT1(TTree *inTree, tpol1_t *tpol1){ inTree->SetBranchAddress("nSectorHits",&tpol1->nSectorHits); inTree->SetBranchAddress("sector",tpol1->sector); inTree->SetBranchAddress("phi",tpol1->phi); inTree->SetBranchAddress("energy",tpol1->energy); inTree->SetBranchAddress("energyErr",tpol1->energyErr); inTree->SetBranchAddress("riseTime",tpol1->riseTime); inTree->SetBranchAddress("riseTimeErr",tpol1->riseTimeErr); inTree->SetBranchAddress("energyOffset",tpol1->energyOffset); inTree->SetBranchAddress("energyOffsetErr",tpol1->energyOffsetErr); inTree->SetBranchAddress("startTime",tpol1->startTime); inTree->SetBranchAddress("startTimeErr",tpol1->startTimeErr); inTree->SetBranchAddress("confidenceLevel",tpol1->confidenceLevel); inTree->SetBranchAddress("chi2Reduced",tpol1->chi2Reduced); inTree->SetBranchAddress("nhits_PS",&tpol1->nhits_PS); inTree->SetBranchAddress("nhits_PSC",&tpol1->nhits_PSC); inTree->SetBranchAddress("iLeft_PSC",tpol1->iLeft_PSC); inTree->SetBranchAddress("iRight_PSC",tpol1->iRight_PSC); inTree->SetBranchAddress("e_iLeft_PS",tpol1->e_iLeft_PS); inTree->SetBranchAddress("e_iRight_PS",tpol1->e_iRight_PS); inTree->SetBranchAddress("t_iLeft_PSC",tpol1->t_iLeft_PSC); inTree->SetBranchAddress("t_iRight_PSC",tpol1->t_iRight_PSC); inTree->SetBranchAddress("iLeft_PS",tpol1->iLeft_PS); inTree->SetBranchAddress("iRight_PS",tpol1->iRight_PS); }; ////////////////// class MySigFun { public: double Evaluate(double *tPtr, double *parPtr) { Double_t qVal,timeVal; timeVal = *tPtr; Double_t Qmax = parPtr[0]; Double_t GammaRise = parPtr[1]; Double_t GammaFall = parPtr[2]; Double_t cVal = parPtr[3]; Double_t startTime = parPtr[4]; qVal = 0.0; if (timeVal > startTime){ qVal += exp(-GammaRise*(timeVal-startTime)) - exp(-GammaFall*(timeVal-startTime)); qVal *= GammaRise*Qmax/(GammaFall - GammaRise); } qVal += cVal; return qVal; } }; ////////////////// double tpolEnergyCal(int sector){ double calVec[32]; //mV per MeV double mV_per_fADCcount; double MeV_per_mV; double keV_per_mV; double keV_per_fADCcount; calVec[0] = 93.3058; calVec[1] = 96.4358; calVec[2] = 105.836; calVec[3] = 95.538; calVec[4] = 104.741; calVec[5] = 95.9708; calVec[6] = 105.596; calVec[7] = 97.2229; calVec[8] = 102.087; calVec[9] = 104.769; calVec[10] = 105.099; calVec[11] = 96.4139; calVec[12] = 94.924; calVec[13] = 95.2789; calVec[14] = 94.5175; calVec[15] = 100.268; calVec[16] = 95.7167; calVec[17] = 101.83; calVec[18] = 104.672; calVec[19] = 105.956; calVec[20] = 94.7983; calVec[21] = 94.5537; calVec[22] = 93.8155; calVec[23] = 94.3056; calVec[24] = 94.5507; calVec[25] = 92.4723; calVec[26] = 106.364; calVec[27] = 95.8789; calVec[28] = 95.8562; calVec[29] = 93.959; calVec[30] = 96.0192; calVec[31] = 102.086; mV_per_fADCcount = 1000.0/pow(2.0,12); MeV_per_mV = 1.0/calVec[sector-1]; keV_per_mV = 1000.0*MeV_per_mV; keV_per_fADCcount = keV_per_mV*mV_per_fADCcount; return keV_per_fADCcount; }; ////////////////// double sectorToPhi(int sector){ int phiBin = -1; if (sector <= 8) phiBin = 9 - sector; if (sector >= 9) phiBin = 41 - sector; double deltaPhi = 360.0/32.0; double phiVal = (phiBin*deltaPhi - deltaPhi/2.0); return phiVal; }