#include "AliPDG.h"
#include "AliLoader.h"
#include "AliRunLoader.h"
+#include "AliSTARTLoader.h"
#include <stdlib.h>
#include <Riostream.h>
outRL = AliRunLoader::GetRunLoader(fManager->GetOutputFolderName());
outgime = outRL->GetLoader("STARTLoader");
+ cout<<" outgime "<<outgime<<endl;
#ifdef DEBUG
cout<<"AliSTARTDigitizer::>SDigits2Digits start...\n";
fRightADC = new TArrayI(12);
fLeftADC = new TArrayI(12);
-
- fHits = new TClonesArray ("AliSTARThit", 1000);
+ inRL = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(0));
+ inRL->LoadgAlice();
+
+ // fHits = new TClonesArray ("AliSTARThit", 1000);
fPhotons = new TClonesArray ("AliSTARThitPhoton", 10000); //!!!
AliSTART *START = (AliSTART*) gAlice->GetDetector("START");
-
AliSTARThit *startHit;
AliSTARThitPhoton *startHitPhoton; //!!!
TBranch *brHits=0;
Int_t nFiles=fManager->GetNinputs();
for (Int_t inputFile=0; inputFile<nFiles; inputFile++) {
-
-
besttimeright=9999.;
besttimeleft=9999.;
Int_t timeDiff=0;
timeright[i0]=0; timeleft[i0]=0;
CountEr[i0]=0; CountEl[i0]=0;
}
- TClonesArray *STARThits = START->Hits ();
inRL = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(inputFile));
+ // AliSTARTLoader *pSTARTloader = (AliSTARTLoader*)fLoader;
+ // pSTARTLoader->LoadHits("READ");
ingime = inRL->GetLoader("STARTLoader");
+ cout<<" ingime "<<ingime<<endl;
+ // AliSTARTLoader *pSTARTLoader ;
ingime->LoadHits("READ");//probably it is necessary to load them before
+ ingime->LoadDigits("UPDATE");//probably it is necessary to load them before
TClonesArray *STARThitsPhotons = START->Photons ();
+ TClonesArray *fHits = START->Hits ();
+ // cout<<" Load "<<AliSTARTLoader::LoadDigits()<<endl;
-
- TTree *th = ingime->TreeH();
+ TTree *th = ingime->TreeH();
brHits = th->GetBranch("START");
brHitPhoton = th->GetBranch("STARThitPhoton");
if (brHits) {
+ cout<<" brHits "<<endl;
START->SetHitsAddressBranch(brHits,brHitPhoton);
}else{
cerr<<"EXEC Branch START hit not found"<<endl;
if (ntracks<=0) return;
// Start loop on tracks in the photon hits containers
// for amplitude
+ /*
if(brHitPhoton) {
+ cout<<"brHitPhoton "<<endl;
for (Int_t track=0; track<ntracks;track++) {
brHitPhoton -> GetEntry(track);;
nhits = STARThitsPhotons->GetEntriesFast();
} //hit photons
} //track photons
} // was photons
-
+ */
// Start loop on tracks in the hits containers
+ cout<<" fHits "<<fHits<<endl;;
for (Int_t track=0; track<ntracks;track++) {
brHits->GetEntry(track);
- nhits = STARThits->GetEntriesFast();
+ nhits = fHits->GetEntriesFast();
+ // cout<<" brHits hits "<<nhits<<endl;
for (hit=0;hit<nhits;hit++) {
- startHit = (AliSTARThit*) STARThits->UncheckedAt(hit);
+ startHit = (AliSTARThit*) fHits->UncheckedAt(hit);
pmt=startHit->fPmt;
volume = startHit->fVolume;
if(volume==1){
{timeAv=999999; timeDiff=99999;}
// trick to find out output dir:
- outgime->WriteDigits("OVERWRITE");
+
+
+/*
+ // trick to find out output dir:
+ TTree *outTree = fManager->GetTreeD();
+ if (!outTree) {
+ cerr<<"something wrong with output...."<<endl;
+ exit(111);
+ }
+
+ Char_t nameDigits[20];
+ TDirectory *wd = gDirectory;
+ outTree->GetDirectory()->cd();
+ fdigits->Write(nameDigits);
+ cout<<nameDigits<<endl;
+ wd->cd();
+*/
+ cout<<" outgime v konce "<<outgime<<endl;
+ outgime->Dump();
+ outgime->Print();
+ Char_t nameDigits[20];
+ sprintf(nameDigits,"START_D_%d",fManager->GetOutputEventNr());
+ fdigits->Write(nameDigits);
+
+ // outgime->WriteDigits("OVERWRITE");
}
}
return kTRUE;
}
+//----------------------------------------------------------------------------
* See cxx source for full Copyright notice */
#include "AliDigitizer.h"
+#include "AliLoader.h"
+#include "AliRunLoader.h"
class AliRunDigitizer;
class AliSTART;
// Do the main work
void Exec(Option_t* option=0) ;
Bool_t RegisterPhotoE(AliSTARThitPhoton *hit); //!!!
-
+
enum {kBgTag = -1};
private:
Zposit = &fZposition ;
}
-void AliSTARTvertex::Reconstruct(Int_t evNumber=1)
+void AliSTARTvertex::Reconstruct()
{
/***************************************************
Resonstruct digits to vertex position
Int_t timediff;
Float_t timePs;
char nameTD[8],nameTR[8];
-
+ char filename[100];
+ sprintf(filename,"galice.root");
+ AliRunLoader* rl = AliRunLoader::Open("galice.root",AliConfig::fgkDefaultEventFolderName,"read");
+ if (rl == 0x0)
+ {
+ cerr<<"Can not open session for file galice.root\n";
+ return;
+ }
+
+ rl->LoadgAlice();
+ gAlice = rl->GetAliRun();
+
+ AliSTART* START = (AliSTART *)gAlice->GetDetector("START");
+
+ rl->LoadHeader();
+ rl->LoadKinematics("READ");
+ Int_t retval;
+ AliLoader* lstart = rl->GetLoader("STARTLoader");
+ lstart->LoadDigits("READ");
+
AliSTARTdigit *digits;
AliSTARTvertex *fvertex;
// Event ------------------------- LOOP
// gAlice->GetEvent(evNumber);
-
- sprintf(nameTD,"START_D_%d",evNumber);
- TObject *td = (TObject*)gDirectory->Get(nameTD);
- printf("%s\n",nameTD);
+ Int_t iNevents=rl->GetNumberOfEvents();
+ cout<<" nevents "<<iNevents<<endl;
- if (!td) {
- cerr<<"something wrong with output...."<<endl;
- exit(111);
- }
- td->Read(nameTD);
- digits->Read(nameTD);
- if(digits->GetTimeDiff()<TMath::Abs(1000))
- {
- timediff=digits->GetTimeDiff(); //time in number of channels
- timePs=(512-timediff)*2.5; // time in Ps channel_width =10ps
- cout<<"timediff "<< timediff<<" timePs "<<timePs<<endl;
- // 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
- cout<<" Zposit "<<Zposit<<endl;
- fvertex->Set((Int_t) Zposit);
+ for (Int_t evNumber=0; evNumber<iNevents; evNumber++){
+ rl->GetEvent(evNumber);
+ lstart->LoadDigits("READ");
+ gDirectory->ls();
+
+ sprintf(nameTD,"START_D_%d",evNumber);
+ TObject *td = (TObject*)gDirectory->Get(nameTD);
+ printf("%s\n",nameTD);
+ // td->Dump();
+ if (!td) {
+ cerr<<"something wrong with input...."<<endl;
+ exit(111);
+ }
+ td->Read(nameTD);
+ digits->Read(nameTD);
+ if(digits->GetTimeDiff()<TMath::Abs(1000))
+ {
+ timediff=digits->GetTimeDiff(); //time in number of channels
+ timePs=(512-timediff)*2.5; // time in Ps channel_width =10ps
+ cout<<"timediff "<< timediff<<" timePs "<<timePs<<endl;
+ // 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
+ cout<<" Zposit "<<Zposit<<endl;
+ fvertex->Set((Int_t) Zposit);
}
- sprintf(nameTR,"START_R_%d",evNumber);
- printf("%s\n",nameTR);
- fvertex->Write(nameTR);
+ lstart->LoadRecPoints("UPDATE");
+ sprintf(nameTR,"START_R_%d",evNumber);
+ printf("%s\n",nameTR);
+ fvertex->Write(nameTR);
+
+
+ }
}
public:
AliSTARTvertex() {}
AliSTARTvertex(Int_t *);
- void Reconstruct(Int_t);
+ void Reconstruct();
Int_t GetVertex();
virtual ~AliSTARTvertex() {}
void Set(Int_t);
#pragma link C++ class AliSTARTdigit+;
#pragma link C++ class AliSTARTvertex+;
#pragma link C++ class AliSTARTDigitizer+;
+#pragma link C++ class AliSTARTLoader+;
#endif
gROOT->LoadMacro("loadlibs.C");
loadlibs();
}
-
- // Connect the Root Galice file containing Geometry, Kine and Hits
- TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
- if (!file) file = new TFile("~/w0/START/galice.root","UPDATE");
-
- // Get AliRun object from file or create it if not on file
- if (!gAlice) {
- gAlice = (AliRun*)file->Get("gAlice");
- if (gAlice) printf("AliRun object found on file\n");
- if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
- }
-
+ char filename[100];
+ sprintf(filename,"galice.root");
+ AliRunLoader* rl = AliRunLoader::Open("galice.root",AliConfig::fgkDefaultEventFolderName,"read");
+ if (rl == 0x0)
+ {
+ cerr<<"Can not open session for file galice.root\n";
+ return;
+ }
+
+ rl->LoadgAlice();
+ gAlice = rl->GetAliRun();
+
+ AliSTART* START = (AliSTART *)gAlice->GetDetector("START");
+ /*
+ rl->LoadHeader();
+
+ rl->LoadKinematics("READ");
+ Int_t retval;
+ AliLoader* lstart = rl->GetLoader("STARTLoader");
+ lstart->LoadDigits("READ");
+ // lstart->Dump();
+ // lstart->LoadRecPoints("UPDATE");
+ */
vertex= new AliSTARTvertex();
TBranch *bRec=0;
-
+ vertex->Dump();
// Event ------------------------- LOOP
- for (Int_t j=0; j<evNumber; j++){
- vertex->Reconstruct(j);
- }
- file->Write();
- file->Close();
+ // Int_t iNevents=rl->GetNumberOfEvents();
+ // cout<<" nevents "<<iNevents<<endl;
+
+ // for (Int_t j=0; j<iNevents; j++){
+ // lstart->LoadDigits("READ");
+ vertex->Reconstruct();
+ // }
} // end of macro
-SRCS= AliSTART.cxx AliSTARTv0.cxx AliSTARTv1.cxx AliSTARTv2.cxx AliSTARThit.cxx AliSTARTdigit.cxx AliSTARTvertex.cxx AliSTARTDigitizer.cxx AliSTARThitPhoton.cxx
+SRCS= AliSTART.cxx AliSTARTv0.cxx AliSTARTv1.cxx AliSTARTv2.cxx AliSTARThit.cxx AliSTARTdigit.cxx AliSTARTvertex.cxx AliSTARTDigitizer.cxx AliSTARThitPhoton.cxx AliSTARTLoader.cxx
HDRS= $(SRCS:.cxx=.h)
-void readDigits(Int_t evNumber=1)
+void readDigits()
{
// Dynamically link some shared libs
gROOT->LoadMacro("loadlibs.C");
loadlibs();
}
+ char filename[100];
+ sprintf(filename,"galice.root");
+ AliRunLoader* rl = AliRunLoader::Open("galice.root",AliConfig::fgkDefaultEventFolderName,"read");
+ if (rl == 0x0)
+ {
+ cerr<<"Can not open session for file galice.root\n";
+ return;
+ }
+
+ rl->LoadgAlice();
+ gAlice = rl->GetAliRun();
- // 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("production.root","UPDATE");
+ AliSTART* START = (AliSTART *)gAlice->GetDetector("START");
- // Get AliRun object from file or create it if not on file
- if (!gAlice) {
- gAlice = (AliRun*)file->Get("gAlice");
- if (gAlice) printf("AliRun object found on file\n");
- if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
- }
- char nameTD[8],nameTR[8];
+ rl->LoadHeader();
+ rl->LoadKinematics("READ");
+ Int_t retval;
+ AliLoader* lstart = rl->GetLoader("STARTLoader");
+
+ Int_t iNevents=rl->GetNumberOfEvents();
+ cout<<" nevents "<<iNevents<<endl;
+
+ char nameTD[8],nameTR[8];
TH1F *hTimediff = new TH1F("hTimediff","Time difference",100,0,200);
TH1F *hTimePs = new TH1F("hTimePs","Time in Ps",100,-200,200);
TH1F *hBestTimeleft = new TH1F("hBestTimeleft","First time left",
100,11000.,13000.);
+ // digits = new AliSTARTdigit();
+ AliSTARTdigit *digits ; // digits
digits = new AliSTARTdigit();
+
timeRight = new TArrayI(12);
timeLeft = new TArrayI(12);
ADCRight = new TArrayI(12);
ADCLeft = new TArrayI(12);
// Event ------------------------- LOOP
- for (Int_t j=0; j<evNumber; j++){
+ for (Int_t j=0; j<iNevents; j++){
// gAlice->GetEvent(j);
+ rl->GetEvent(j);
+ // lstart->Dump();
+ lstart->LoadHits("READ");
+ lstart->LoadDigits("READ");
sprintf(nameTD,"START_D_%d",j);
printf("%s\n",nameTD);
- TObject *td = (TObject*)gDirectory->Get(nameTD);
- digits->Read(nameTD);
- // digits->Dump();
+ TObject *td = (TObject*)gDirectory->Get(nameTD);
+ // td->Dump();
+ // cout<<" td "<<td<<endl;
+ td->Read(nameTD);
+ digits->Read(nameTD);
+ // digits->Read(nameTD);
// digits->Print();
- printf("time %d\n",digits->GetTimeDiff());
-
+ printf("time %d\n",digits->GetTimeDiff());
+
if(digits->GetTimeDiff()!=999999){
Int_t timediff = digits->GetTimeDiff();
// Double_t timePs=(timediff-128)*10.; // time in Ps channel_width =10ps