}//time for right shoulder
if(volume==2){
timeleft = startHit->fTime;
- // printf("timeleft %f\n",timeleft);
if(timeleft<besttimeleft) {
besttimeleft=timeleft;
} //timeleftbest
//folding with experimental time distribution
Float_t besttimerightGaus=gRandom->Gaus(besttimeright,0.05);
+ Float_t koef=69.7/350.;
+ besttimeleft=koef*besttimeleft;
Float_t besttimeleftGaus=gRandom->Gaus(besttimeleft,0.05);
timediff=besttimerightGaus-besttimeleftGaus;
meanTime=(besttimerightGaus+besttimeleftGaus)/2.;
- if ( TMath::Abs(timediff)<TMath::Abs(10.) && meanTime<TMath::Abs(7.1))
+ if ( TMath::Abs(timediff)<TMath::Abs(3.) && meanTime<TMath::Abs(5.))
{
//we assume centre of bunch is 5ns after TTS signal
//TOF values are relative of the end of bunch
Float_t t2=1000.*besttimerightGaus;
t1=t1/channelWidth+ppBunch; //time in ps to channelWidth
t2=t2/channelWidth+ppBunch; //time in ps to channelWidth
-
timeav=(t1+t2)/2.;
// Time to TDC signal
timeAv = (Int_t)(timeav); // time (ps) channel numbres
timeDiff = (Int_t)(timediff); // time ( ps) channel numbres
fdigits->Set(timeAv,timeDiff);
- fdigits->Print();
+ fdigits->Print();
}
else
{timeAv=999999; timeDiff=99999;}
**************************************************************************/
/*
$Log$
+Revision 1.6 2001/10/19 05:29:38 alla
+bug in meduim fixed
+
Revision 1.5 2001/07/27 13:03:12 hristov
Default Branch split level set to 99
Vertex reconstruction
*/
-#include <TObject.h>
+#include "TObject.h"
#include "AliSTARTvertex.h"
#include "AliSTARTdigit.h"
#include "AliSTARThit.h"
//#include "TTree.h"
#include "TDirectory.h"
+#include <stdlib.h>
+#include <iostream.h>
+#include <fstream.h>
ClassImp(AliSTARTvertex)
Float_t timePs;
char nameTD[8],nameTR[8];
- TBranch *bRec=0;
- TBranch *bd;
AliSTARTdigit *digits;
- AliSTARTvertex *vertex;
-
- Int_t buffersize=256;
+ AliSTARTvertex *fvertex;
- // TParticle *particle;
digits = new AliSTARTdigit();
- vertex = new AliSTARTvertex();
+ fvertex = new AliSTARTvertex();
// Event ------------------------- LOOP
- sprintf(nameTD,"TreeD%d",evNumber);
+ gAlice->GetEvent(evNumber);
+
+ sprintf(nameTD,"START_D_%d",evNumber);
+ TObject *td = (TObject*)gDirectory->Get(nameTD);
printf("%s\n",nameTD);
- TTree *td = (TTree*)gDirectory->Get(nameTD);
- bd = td->GetBranch("START");
- bd->SetAddress(&digits);
- bd->GetEvent(0);
- sprintf(nameTR,"TreeR%d",evNumber);
- TTree *tr = new TTree(nameTR,"START");
- bRec = tr->Branch("START","AliSTARTvertex",&vertex,buffersize);
+
+ if (!td) {
+ cerr<<"something wrong with output...."<<exit;
+ return;
+ }
+ td->Read(nameTD);
+ digits->Read(nameTD);
+ digits->Dump();
if(digits->GetTime()!=999999)
{
timediff=digits->GetTime(); //time in number of channels
Float_t c = 299792458/1.e9; //speed of light cm/ps
//Float_t c = 0.3; //speed of light mm/ps
Float_t Zposit=timePs*c;// for 0 vertex
- vertex->Set((Int_t) Zposit);
- tr->Fill();
- tr->Write();
+ cout<<" Zposit "<<Zposit<<endl;
+ fvertex->Set((Int_t) Zposit);
}
-
+ TTree *outTree = gAlice->TreeR();
+ if (!outTree) {
+ cerr<<"something wrong with output...."<<exit;
+ return;
+ }
+ TTree *outTreeR = gAlice->TreeR();
+ if (!outTreeR) {
+ cerr<<"something wrong with output...."<<exit;
+ return;
+ }
+ sprintf(nameTR,"START_R_%d",evNumber);
+ printf("%s\n",nameTR);
+ TDirectory *wd = gDirectory;
+ outTreeR->GetDirectory()->cd();
+ fvertex->Write(nameTR);
+ wd->cd();
}
+
+
# C++ sources
-SRCS = AliSTART.cxx AliSTARTv0.cxx AliSTARTv1.cxx AliSTARThit.cxx AliSTARTdigit.cxx AliSTARTvertex.cxx
+SRCS = AliSTART.cxx AliSTARTv0.cxx AliSTARTv1.cxx AliSTARThit.cxx AliSTARTdigit.cxx AliSTARTvertex.cxx AliSTARTDigitizer.cxx
# C++ Headers
// Connect the Root Galice file containing Geometry, Kine and Hits
TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
//TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
- if (!file) file = new TFile("galice.root","UPDATE");
+ if (!file) file = new TFile("production.root","UPDATE");
// Get AliRun object from file or create it if not on file
if (!gAlice) {
}
char nameTD[8],nameTR[8];
- TH1F *hTimediff = new TH1F("hTimediff","Time difference",100,0,256);
- TH1F *hTimePs = new TH1F("hTimePs","Time in Ps",100,-2000,2000);
+ TH1F *hTimediff = new TH1F("hTimediff","Time difference",100,0,200);
+ TH1F *hTimePs = new TH1F("hTimePs","Time in Ps",100,2000,3000);
digits = new AliSTARTdigit();
- TBranch *bd;
// Event ------------------------- LOOP
for (j=0; j<evNumber; j++){
- sprintf(nameTD,"TreeD%d",j);
+ gAlice->GetEvent(j);
+ sprintf(nameTD,"START_D_%d",j);
printf("%s\n",nameTD);
- TTree *TD = (TTree*)gDirectory->Get(nameTD);
- bd = TD->GetBranch("START");
- bd->SetAddress(&digits);
- bd->GetEvent(0);
- // printf(" Digits: %d \n ",digits->GetTime());
-
- printf("time %d\n",digits->GetTime());
+ TObject *td = (TObject*)gDirectory->Get(nameTD);
+ digits->Read(nameTD);
+ digits->Dump();
+ printf("time %d\n",digits->GetTime());
if(digits->GetTime()!=999999){
- Int_t timediff = digits->GetTime();
- Double_t timePs=(timediff-128)*10.; // time in Ps channel_width =10ps
- // cout<<"timediff "<<timediff<<" timePs "<<timePs<<endl;
+ Int_t timediff = digits->GetMeanTime();
+ // Double_t timePs=(timediff-128)*10.; // time in Ps channel_width =10ps
+ Double_t timePs=(timediff)*10.; // time in Ps channel_width =10ps
+ cout<<"timediff "<<timediff<<" timePs "<<timePs<<endl;
hTimediff->Fill(timediff);
hTimePs->Fill(timePs);
}
}
-
- Hfile = new TFile("figs.root","UPDATE","Histograms for STASRT digits");
- printf("Writting histograms to root file \n");
- Hfile->cd();
+
+ Hfile = new TFile("figs.root","UPDATE","Histograms for STASRT digits");
+ printf("Writting histograms to root file \n");
+ Hfile->cd();
//Create a canvas, set the view range, show histograms
- gStyle->SetOptStat(111111);
- TCanvas *c1 = new TCanvas("c1","Alice START Time ",400,10,600,600);
+ gStyle->SetOptStat(111111);
+ // TCanvas *c1 = new TCanvas("c1","Alice START Time ",400,10,600,600);
hTimePs->SetXTitle("arriving time, ps");
hTimePs->SetYTitle("number of events");
hTimePs->Write();
-
+ Hfile->Close();
} // end of macro
// Connect the Root Galice file containing Geometry, Kine and Hits
TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
- if (!file) file = new TFile("galice.root","UPDATE");
+ if (!file) file = new TFile("production.root","UPDATE");
// Get AliRun object from file or create it if not on file
if (!gAlice) {
char nameTD[8],nameTR[8];
TH1F *hVertex = new TH1F("hVertex","Z position of vertex",100,-350,350);
+ TH1F *hRealVertex = new TH1F("hRealVertex","Z position of vertex",100,-350,350);
digits = new AliSTARTdigit();
vertex = new AliSTARTvertex();
- TBranch *bd;
- TBranch *bRec;
-
// Event ------------------------- LOOP
- for (j=0; j<evNumber; j++){
- sprintf(nameTD,"TreeD%d",j);
- printf("%s\n",nameTD);
- TTree *TD = (TTree*)gDirectory->Get(nameTD);
- bd = TD->GetBranch("START");
- bd->SetAddress(&digits);
- bd->GetEvent(0);
- printf(" Digits: %d \n ",digits->GetTime());
-
+ for (Int_t j=0; j<evNumber; j++){
- sprintf(nameTR,"TreeR%d",j);
+ sprintf(nameTR,"START_R_%d",j);
printf("%s\n",nameTR);
- TTree *TR = (TTree*)gDirectory->Get(nameTR);
- bRec = TR->GetBranch("START");
- bRec->SetAddress(&vertex);
- bRec->GetEvent(0);
- if(digits->GetTime()!=999999){
- hVertex->Fill(vertex->GetVertex());
- // printf(" Z position %f\n",vertex->GetVertex());
- }
+ TObject *tr = (TObject*)gDirectory->Get(nameTR);
+ cout<<" tr "<<tr<<endl;
+ vertex->Read(nameTR);
+
+ hVertex->Fill(vertex->GetVertex());
+ printf(" Z position %f\n",vertex->GetVertex());
+ gAlice->GetEvent(j);
+ AliHeader *header = gAlice->GetHeader();
+ AliGenEventHeader* genHeader = header->GenEventHeader();
+ TArrayF *o = new TArrayF(3);
+ genHeader->PrimaryVertex(*o);
+ cout<<" o "<<o<<endl;
+ Float_t zRealVertex=o->At(2);
+ cout<<" zRealVertex "<<zRealVertex<<endl;
+ hRealVertex->Fill(zRealVertex);
+
}
- Hfile = new TFile("figs1.root","RECREATE","Histograms for START Vertex");
+ Hfile = new TFile("figs.root","UPDATE","Histograms for START Vertex");
printf("Writting histograms to root file \n");
Hfile->cd();
//Create a canvas, set the view range, show histograms
gStyle->SetOptStat(111111);
- TCanvas *c1 = new TCanvas("c1","Alice START Time (vertex)",400,10,600,600);
-
hVertex->SetXTitle("vertex position, mm");
hVertex->SetYTitle("number of events");
hVertex->Write();
+ hRealVertex->SetXTitle("vertex position, mm");
+ hRealVertex->SetYTitle("number of events");
+ hRealVertex->Write();
} // end of macro