#include "TS800TimeOfFlight.h"
#include "TS800.h"
#include <iostream>
#include <math.h>
#include <TNamed.h>
#include <TList.h>
ClassImp(TS800TimeOfFlight);
TS800TimeOfFlight::TS800TimeOfFlight(const TS800TimeOfFlight & tof) : TObject(tof)
{
((TS800TimeOfFlight&)tof).Copy(*this);
}
Int_t TS800TimeOfFlight::Calculate(Long64_t entry)
{
Clear();
fCon->b_rf->GetEntry(entry);
fCon->b_obj->GetEntry(entry);
fCon->b_xfp->GetEntry(entry);
if(xfp==0) xfp = 0;
Double_t trigRndm = fCon->parent->trigger.fRs800;
if(parent->fAddRndm){
rfc = (Double_t)-1*((fCon->rf +fRandom.Rndm()) - fCon->parent->trigger.s800+trigRndm)*timeSlope;
objc = (Double_t)-1*((fCon->obj+fRandom.Rndm()) - fCon->parent->trigger.s800+trigRndm)*timeSlope;
xfpc = (Double_t)-1*((fCon->xfp+fRandom.Rndm()) - fCon->parent->trigger.s800+trigRndm)*timeSlope;
xfpobj = fCon->obj - fCon->xfp;
}else{
rfc = (Double_t)-1*(fCon->rf - fCon->parent->trigger.s800)*timeSlope;
objc = (Double_t)-1*(fCon->obj - fCon->parent->trigger.s800)*timeSlope;
xfpc = (Double_t)-1*(fCon->xfp - fCon->parent->trigger.s800)*timeSlope;
xfpobj = fCon->obj - fCon->xfp;
}
obje1= objc
+ (obje1tupCorrection - parent->e1.time*timeSlope)
+ (obje1Correction * parent->fpTrack.afp)
+ (objX1Correction[1] * parent->crdc1.x )
+ (objX1Correction[2] * (parent->crdc1.x*parent->crdc1.x))
+ (objX1Correction[3] * (parent->crdc1.x*parent->crdc1.x*parent->crdc1.x))
+ (objX2Correction[1] * parent->crdc2.x )
+ (objX2Correction[2] * (parent->crdc2.x*parent->crdc2.x))
+ (objX2Correction[3] * (parent->crdc2.x*parent->crdc2.x*parent->crdc2.x))
+ (objY1Correction * parent->crdc1.y)
+ (objY2Correction * parent->crdc2.y);
xfpe1 = xfpc - parent->e1.time*timeSlope
+ xfpe1Correction * parent->fpTrack.afp
+ xfpX1Correction[1] * parent->crdc1.x
+ xfpX1Correction[2] * (parent->crdc1.x*parent->crdc1.x)
+ xfpX1Correction[3] * (parent->crdc1.x*parent->crdc1.x*parent->crdc1.x)
+ xfpX2Correction[1] * parent->crdc2.x
+ xfpX2Correction[2] * (parent->crdc2.x*parent->crdc2.x)
+ xfpX2Correction[3] * (parent->crdc2.x*parent->crdc2.x*parent->crdc2.x)
+ xfpY1Correction * parent->crdc1.y
+ xfpY2Correction * parent->crdc2.y;
obje2 = objc - parent->e2.time + obje2Correction * parent->crdc1.calc.x_gravity;
xfpe2 = xfpc - parent->e2.time + xfpe2Correction * parent->crdc1.calc.x_gravity;
xfpobje1 = obje1 - xfpe1;
CalculateVelCorr();
return 1;
}
void TS800TimeOfFlight::CalculateVelCorr()
{
objFp = objc - parent->e1.time*timeSlope + objFpShift;
xfpFp = xfpc - parent->e1.time*timeSlope + xfpFpShift;
xfpTar = (XFP_OBJ_DIST+OBJ_TAR_DIST)/XFP_OBJ_DIST * ((xfpc - parent->e1.time*timeSlope) -
(objc - parent->e1.time*timeSlope) +
xfpObjShift);
tarFp = xfpFp - xfpTar
+ (tarFpCorrection * parent->fpTrack.afp)
+ (tarFpX1Correction[1] * parent->crdc1.x )
+ (tarFpX1Correction[2] * (parent->crdc1.x*parent->crdc1.x))
+ (tarFpX1Correction[3] * (parent->crdc1.x*parent->crdc1.x*parent->crdc1.x))
+ (tarFpX2Correction[1] * parent->crdc2.x )
+ (tarFpX2Correction[2] * (parent->crdc2.x*parent->crdc2.x))
+ (tarFpX2Correction[3] * (parent->crdc2.x*parent->crdc2.x*parent->crdc2.x))
+ (tarFpY1Correction * parent->crdc1.y)
+ (tarFpY2Correction * parent->crdc2.y);
xfpTar += fPIDShift[0];
tarFp += fPIDShift[1];
}
Int_t TS800TimeOfFlight::Calibrate(Long64_t entry)
{
printf("* This method is currently empty.\n");
return -1;
}
void TS800TimeOfFlight::Clear(Option_t*)
{
rf = 0;
obj = 0;
xfp = 0;
tar = 0;
rfc = 0;
objc = 0;
xfpc = 0;
xfpobj = 0;
obje1 = sqrt(-1.0);
obje2 = sqrt(-1.0);
xfpe1 = sqrt(-1.0);
xfpe2 = sqrt(-1.0);
xfpobje1 = sqrt(-1.0);
objFp = sqrt(-1.0);
xfpFp = sqrt(-1.0);
xfpTar = sqrt(-1.0);
tarFp = sqrt(-1.0);
}
void TS800TimeOfFlight::Copy(TObject &tof) const
{
TObject::Copy((TObject&)tof);
((TS800TimeOfFlight&)tof).fRandom.SetSeed(0);
((TS800TimeOfFlight&)tof).timeSlope = timeSlope;
((TS800TimeOfFlight&)tof).objFpShift = objFpShift;
((TS800TimeOfFlight&)tof).xfpFpShift = xfpFpShift;
((TS800TimeOfFlight&)tof).xfpObjShift = xfpObjShift;
((TS800TimeOfFlight&)tof).rfCorrection = rfCorrection;
for(Int_t i=0; i<4; i++) ((TS800TimeOfFlight&)tof).objX1Correction[i] = objX1Correction[i];
for(Int_t i=0; i<4; i++) ((TS800TimeOfFlight&)tof).objX2Correction[i] = objX2Correction[i];
for(Int_t i=0; i<4; i++) ((TS800TimeOfFlight&)tof).xfpX1Correction[i] = xfpX1Correction[i];
for(Int_t i=0; i<4; i++) ((TS800TimeOfFlight&)tof).xfpX2Correction[i] = xfpX2Correction[i];
for(Int_t i=0; i<4; i++) ((TS800TimeOfFlight&)tof).tarFpX1Correction[i] = tarFpX1Correction[i];
for(Int_t i=0; i<4; i++) ((TS800TimeOfFlight&)tof).tarFpX2Correction[i] = tarFpX2Correction[i];
((TS800TimeOfFlight&)tof).objY1Correction = objY1Correction;
((TS800TimeOfFlight&)tof).objY2Correction = objY2Correction;
((TS800TimeOfFlight&)tof).xfpY2Correction = xfpY2Correction;
((TS800TimeOfFlight&)tof).xfpY1Correction = xfpY2Correction;
((TS800TimeOfFlight&)tof).tarFpY1Correction = tarFpY1Correction;
((TS800TimeOfFlight&)tof).tarFpY2Correction = tarFpY2Correction;
((TS800TimeOfFlight&)tof).obje1Correction = obje1Correction;
((TS800TimeOfFlight&)tof).xfpe1Correction = xfpe1Correction;
((TS800TimeOfFlight&)tof).tarFpCorrection = tarFpCorrection;
((TS800TimeOfFlight&)tof).obje2Correction = obje2Correction;
((TS800TimeOfFlight&)tof).xfpe2Correction = xfpe2Correction;
((TS800TimeOfFlight&)tof).fPIDShift[0] = fPIDShift[0];
((TS800TimeOfFlight&)tof).fPIDShift[1] = fPIDShift[1];
}
void TS800TimeOfFlight::InitClass(TString iname, TS800* theParent)
{
parent = theParent;
name = iname;
timeSlope = 1.000;
rfCorrection = 0;
memset(objX1Correction,'\0',sizeof(objX1Correction));
memset(objX2Correction,'\0',sizeof(objX2Correction));
memset(xfpX1Correction,'\0',sizeof(xfpX1Correction));
memset(xfpX2Correction,'\0',sizeof(xfpX2Correction));
memset(tarFpX1Correction,'\0',sizeof(tarFpX1Correction));
memset(tarFpX2Correction,'\0',sizeof(tarFpX2Correction));
objY1Correction = 0;
xfpY1Correction = 0;
tarFpY1Correction = 0;
objY2Correction = 0;
xfpY2Correction = 0;
tarFpY2Correction = 0;
obje1tupCorrection = 0;
obje1Correction = 0;
xfpe1Correction = 0;
tarFpCorrection = 0;
obje2Correction = 0;
xfpe2Correction = 0;
objFpShift = 0.0;
xfpFpShift = 0.0;
xfpObjShift = 0.0;
fPIDShift[0] = 0.0;
fPIDShift[1] = 0.0;
}
void TS800TimeOfFlight::InitTree(TTree *tree)
{
fChain = tree;
fCurrent = -1;
b_rf = fChain->GetBranch(name+".rf");
b_obj = fChain->GetBranch(name+".obj");
b_xfp = fChain->GetBranch(name+".xfp");
b_tar = fChain->GetBranch(name+".tar");
b_rfc = fChain->GetBranch(name+".rfc");
b_objc = fChain->GetBranch(name+".objc");
b_xfpc = fChain->GetBranch(name+".xfpc");
b_xfpobj = fChain->GetBranch(name+".xfpobj");
b_obje1 = fChain->GetBranch(name+".obje1");
b_obje2 = fChain->GetBranch(name+".obje2");
b_xfpe1 = fChain->GetBranch(name+".xfpe1");
b_xfpe2 = fChain->GetBranch(name+".xfpe2");
b_xfpobje1 = fChain->GetBranch(name+".xfpobje1");
b_objFp = fChain->GetBranch(name+".objFp");
b_xfpFp = fChain->GetBranch(name+".xfpFP");
b_xfpTar = fChain->GetBranch(name+".xfpTar");
b_tarFp = fChain->GetBranch(name+".tarFp");
}
void TS800TimeOfFlight::GetEntry(int i)
{
b_rf->GetEntry(i);
b_obj->GetEntry(i);
b_xfp->GetEntry(i);
b_tar->GetEntry(i);
b_rfc->GetEntry(i);
b_objc->GetEntry(i);
b_xfpc->GetEntry(i);
b_xfpobj->GetEntry(i);
b_obje1->GetEntry(i);
b_obje2->GetEntry(i);
b_xfpe1->GetEntry(i);
b_xfpe2->GetEntry(i);
b_xfpobje1->GetEntry(i);
b_objFp->GetEntry(i);
b_xfpFp->GetEntry(i);
b_xfpTar->GetEntry(i);
b_tarFp->GetEntry(i);
}
void TS800TimeOfFlight::SetName(const Char_t *iname)
{
name = iname;
}
UShort_t* TS800TimeOfFlight::Unpack(UShort_t *p)
{
UShort_t words = (*(p-2))-2, ch;
UShort_t dummy;
while (words > 0) {
ch = ((*p)&0xf000)>>12;
if (ch == 12) rf = (UShort_t)((*p++)&0xfff);
if (ch == 13) obj = (UShort_t)((*p++)&0xfff);
if (ch == 14) xfp = (UShort_t)((*p++)&0xfff);
if (ch == 15) tar = (UShort_t)((*p++)&0xfff);
if (ch == 6) dummy = (UShort_t)((*p++)&0xfff);
if (ch == 7) dummy = (UShort_t)((*p++)&0xfff);
if (ch == 1) dummy = (UShort_t)((*p++)&0xfff);
if (ch == 2) dummy = (UShort_t)((*p++)&0xfff);
if (ch == 3) dummy = (UShort_t)((*p++)&0xfff);
if (ch == 4) dummy = (UShort_t)((*p++)&0xfff);
if (ch == 5) dummy = (UShort_t)((*p++)&0xfff);
words--;
}
return p;
}
Last change: Sun Dec 21 12:38:57 2008
Last generated: 2008-12-21 12:38
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.