#include "AliRun.h"
#include "AliITS.h"
#include "AliITSgeom.h"
+#include "AliITSLoader.h"
#include "AliITSRecPoint.h"
/////////////////////////////////////////////////////////////////////////
// //
SetWindow(0);
}
-AliITSVertexerPPZ::AliITSVertexerPPZ(TFile *infile, TFile *outfile, Float_t x0, Float_t y0):AliITSVertexer(infile,outfile) {
+AliITSVertexerPPZ::AliITSVertexerPPZ(TString fn, Float_t x0, Float_t y0):AliITSVertexer(fn) {
// Standard constructor
- if(!fInFile)Fatal("AliITSVertexerPPZ","No inputfile has been defined!");
SetDiffPhiMax();
fX0 = x0;
fY0 = y0;
if(NbinNotZero==1){
fZFound = curz;
fZsig=0;
- fCurrentVertex = new AliITSVertex(fZFound,fZsig,NbinNotZero);
+ fCurrentVertex = new AliESDVertex(fZFound,fZsig,NbinNotZero);
return;
}
Float_t errsq = totst2/(N-1)-totst*totst/N/(N-1);
if(N<1){fZFound=-110; fZsig=-110; return;}
if(N==1){
fZsig = 0;
- fCurrentVertex = new AliITSVertex(fZFound,fZsig,N);
+ fCurrentVertex = new AliESDVertex(fZFound,fZsig,N);
return;
}
errsq = (fZsig/(N-1)-fZFound*fZFound/N/(N-1))/N;
fZFound*=fZsig;
fZsig = TMath::Sqrt(fZsig);
*/
- fCurrentVertex = new AliITSVertex(fZFound,fZsig,N);
+ fCurrentVertex = new AliESDVertex(fZFound,fZsig,N);
}
//______________________________________________________________________
-AliITSVertex* AliITSVertexerPPZ::FindVertexForCurrentEvent(Int_t evnumber){
- // Defines the AliITSVertex for the current event
+AliESDVertex* AliITSVertexerPPZ::FindVertexForCurrentEvent(Int_t evnumber){
+ // Defines the AliESDVertex for the current event
fCurrentVertex = 0;
fZFound = -999;
fZsig = -999;
- if(!gAlice)gAlice = (AliRun*)fInFile->Get("gAlice");
- if(!gAlice){
- Error("FindVertexForCurrentEvent","The AliRun object is not available - nothing done");
- return fCurrentVertex;
- }
+ AliRunLoader *rl =AliRunLoader::GetRunLoader();
+ AliITSLoader* ITSloader = (AliITSLoader*) rl->GetLoader("ITSLoader");
if(!fITS) {
fITS = (AliITS*)gAlice->GetModule("ITS");
if(!fITS) {
return fCurrentVertex;
}
}
+ fITS->SetTreeAddress();
AliITSgeom *geom = fITS->GetITSgeom();
if(!geom) {
Error("FindVertexForCurrentEvent","ITS geometry is not defined");
return fCurrentVertex;
}
- TTree *TR=0;
- TClonesArray *ITSrec = 0;
+ TTree *tR=0;
+ TClonesArray *itsRec = 0;
Float_t lc[3]; for(Int_t ii=0; ii<3; ii++) lc[ii]=0.;
Float_t gc[3]; for(Int_t ii=0; ii<3; ii++) gc[ii]=0.;
Float_t lc2[3]; for(Int_t ii=0; ii<3; ii++) lc2[ii]=0.;
Float_t gc2[3]; for(Int_t ii=0; ii<3; ii++) gc2[ii]=0.;
- TR = gAlice->TreeR();
- if(!TR){
+ tR = ITSloader->TreeR();
+ if(!tR){
Error("FindVertexForCurrentEvent","TreeR not found");
return fCurrentVertex;
}
- ITSrec = fITS->RecPoints(); // uses slow points or fast points if slow are
+ itsRec = fITS->RecPoints(); // uses slow points or fast points if slow are
// missing
- TBranch *branch = TR->GetBranch("ITSRecPoints");
- if(!branch){
- branch = TR->GetBranch("ITSRecPointsF");
- // Warning("FindVertexForCurrentEvent","Using Fast points");
+ TClonesArray dummy("AliITSclusterV2",10000), *clusters=&dummy;
+ TBranch *branch;
+ if(fUseV2Clusters){
+ branch = tR->GetBranch("Clusters");
+ branch->SetAddress(&clusters);
+ }
+ else {
+ branch = tR->GetBranch("ITSRecPoints");
+ if(!branch){
+ branch = tR->GetBranch("ITSRecPointsF");
+ }
}
if(!branch){
Error("FindVertexForCurrentEvent","branch for ITS rec points not found");
Int_t firipixe=0;
for(Int_t module= fFirstL1; module<=fLastL1;module++){
branch->GetEvent(module);
- Int_t nrecp1 = ITSrec->GetEntries();
+ if(fUseV2Clusters){
+ Clusters2RecPoints(clusters,module,itsRec);
+ }
+ Int_t nrecp1 = itsRec->GetEntries();
for(Int_t i=0; i<nrecp1;i++){
- AliITSRecPoint *current = (AliITSRecPoint*)ITSrec->At(i);
+ AliITSRecPoint *current = (AliITSRecPoint*)itsRec->At(i);
lc[0]=current->GetX();
lc[2]=current->GetZ();
geom->LtoG(module,lc,gc);
for(Int_t module= fFirstL1; module<=fLastL1;module++){
if(fDebug>0)cout<<"processing module "<<module<<" \r";
branch->GetEvent(module);
- Int_t nrecp1 = ITSrec->GetEntries();
+ if(fUseV2Clusters){
+ Clusters2RecPoints(clusters,module,itsRec);
+ }
+ Int_t nrecp1 = itsRec->GetEntries();
TObjArray *poiL1 = new TObjArray(nrecp1);
- for(Int_t i=0; i<nrecp1;i++)poiL1->AddAt(ITSrec->At(i),i);
+ for(Int_t i=0; i<nrecp1;i++)poiL1->AddAt(itsRec->At(i),i);
fITS->ResetRecPoints();
for(Int_t i=0; i<nrecp1;i++){
AliITSRecPoint *current = (AliITSRecPoint*)poiL1->At(i);
if(fDebug>1)cout<<"module "<<module<<" "<<gc[0]<<" "<<gc[1]<<" "<<gc[2]<<" "<<phi1<<" \n";
for(Int_t modul2=fFirstL2; modul2<=fLastL2; modul2++){
branch->GetEvent(modul2);
- Int_t nrecp2 = ITSrec->GetEntries();
+ if(fUseV2Clusters){
+ Clusters2RecPoints(clusters,modul2,itsRec);
+ }
+ Int_t nrecp2 = itsRec->GetEntries();
for(Int_t j=0; j<nrecp2;j++){
- AliITSRecPoint *recp = (AliITSRecPoint*)ITSrec->At(j);
+ AliITSRecPoint *recp = (AliITSRecPoint*)itsRec->At(j);
lc2[0]=recp->GetX();
lc2[2]=recp->GetZ();
geom->LtoG(modul2,lc2,gc2);
if(fCurrentVertex){
char name[30];
sprintf(name,"Vertex_%d",evnumber);
- fCurrentVertex->SetName(name);
+ // fCurrentVertex->SetName(name);
fCurrentVertex->SetTitle("vertexer: PPZ");
}
return fCurrentVertex;
//______________________________________________________________________
void AliITSVertexerPPZ::FindVertices(){
// computes the vertices of the events in the range FirstEvent - LastEvent
- if(!fOutFile){
- Error("FindVertices","The output file is not available - nothing done");
- return;
- }
- if(!gAlice)gAlice = (AliRun*)fInFile->Get("gAlice");
- if(!gAlice){
- Error("FindVertices","The AliRun object is not available - nothing done");
- return;
- }
- TDirectory *curdir = gDirectory;
- fInFile->cd();
+ AliRunLoader *rl = AliRunLoader::GetRunLoader();
+ AliITSLoader* ITSloader = (AliITSLoader*) rl->GetLoader("ITSLoader");
+ ITSloader->ReloadRecPoints();
for(Int_t i=fFirstEvent;i<=fLastEvent;i++){
- gAlice->GetEvent(i);
+ cout<<"Processing event "<<i<<endl;
+ rl->GetEvent(i);
FindVertexForCurrentEvent(i);
if(fCurrentVertex){
WriteCurrentVertex();
}
}
}
- curdir->cd();
}
//________________________________________________________
cout <<" Window for Z search: "<<fWindow<<endl;
cout <<" Current Z "<<fZFound<<"; Z sig "<<fZsig<<endl;
cout <<" Debug flag: "<<fDebug<<endl;
- if(fInFile)cout <<" The input file is open\n";
- if(!fInFile)cout <<"The input file is not open\n";
- if(fOutFile)cout <<"The output file is open\n";
- if(!fOutFile)cout <<"The output file is not open\n";
cout<<"First event to be processed "<<fFirstEvent;
cout<<"\n Last event to be processed "<<fLastEvent<<endl;
}