]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSVertexerIons.cxx
warnings fixed
[u/mrichter/AliRoot.git] / ITS / AliITSVertexerIons.cxx
index 6be5900c09f4acf5c43d37d795b05f0a75283f82..65f3ddb0e967b4f84ca5c3fc7a465fa6dd7ee153 100644 (file)
@@ -1,10 +1,12 @@
+#include "AliRunLoader.h"
 #include "AliITSDetTypeRec.h"
 #include "AliITSVertexerIons.h"
-#include "AliITSVertexerPPZ.h"
+#include "AliITSVertexerZ.h"
 #include "AliESDVertex.h"
-#include "AliITSgeom.h"
+#include "AliITSgeomTGeo.h"
 #include "AliITSLoader.h"
 #include "AliITSRecPoint.h"
+#include "AliLog.h"
 #include <TTree.h>
 #include <TH1.h>
 #include <TF1.h>
 ClassImp(AliITSVertexerIons)
   
 //______________________________________________________________________
-  AliITSVertexerIons::AliITSVertexerIons():AliITSVertexer() {
+  AliITSVertexerIons::AliITSVertexerIons():AliITSVertexer(),
+fNpThreshold(0),
+fMaxDeltaPhi(0),
+fMaxDeltaZ(0){
   // Default Constructor
 
   //fITS = 0;
@@ -38,32 +43,6 @@ ClassImp(AliITSVertexerIons)
   SetMaxDeltaZ();
 }
 
-//______________________________________________________________________
-AliITSVertexerIons::AliITSVertexerIons(TString fn):AliITSVertexer(fn) {
-  // Standard constructor
-  
-  //fITS = 0;
-  SetNpThreshold();
-  SetMaxDeltaPhi();
-  SetMaxDeltaZ();
-}
-
-//______________________________________________________________________
-AliITSVertexerIons::AliITSVertexerIons(const AliITSVertexerIons &source):AliITSVertexer(source) {
-  // Copy constructor
-  // Copies are not allowed. The method is protected to avoid misuse.
-  Error("AliITSVertexerIons","Copy constructor not allowed\n");
-}
-
-//_________________________________________________________________________
-AliITSVertexerIons& AliITSVertexerIons::operator=(const AliITSVertexerIons &/*source*/) {
-  // Assignment operator
-  // Assignment is not allowed. The method is protected to avoid misuse.
-  Error("= operator","Assignment operator not allowed\n");
-  return *this;
-}
-
-
 //______________________________________________________________________
 AliITSVertexerIons::~AliITSVertexerIons() {
   // Default Destructor
@@ -71,22 +50,14 @@ AliITSVertexerIons::~AliITSVertexerIons() {
 }
 
 //______________________________________________________________________
-AliESDVertex* AliITSVertexerIons::FindVertexForCurrentEvent(Int_t evnumber){ 
+AliESDVertex* AliITSVertexerIons::FindVertexForCurrentEvent(TTree *itsClusterTree){ 
 // Defines the AliESDVertex for the current event
 
   fCurrentVertex = 0;
 
-  AliRunLoader *rl = AliRunLoader::GetRunLoader();
-  AliITSLoader* itsloader = (AliITSLoader*)rl->GetLoader("ITSLoader");
-  TDirectory * olddir = gDirectory;
-  rl->CdGAFile();
-  AliITSgeom* g2  = (AliITSgeom*)gDirectory->Get("AliITSgeom");
-  olddir->cd(); 
-
-  TTree *tr =  itsloader->TreeR();
   AliITSDetTypeRec detTypeRec;
 
-  detTypeRec.SetTreeAddressR(tr);
+  detTypeRec.SetTreeAddressR(itsClusterTree);
 
   TClonesArray  *recpoints = detTypeRec.RecPoints();
   AliITSRecPoint *pnt;
@@ -95,7 +66,7 @@ AliESDVertex* AliITSVertexerIons::FindVertexForCurrentEvent(Int_t evnumber){
   Int_t npoints=0;
   Int_t nopoints1=40000;
   Int_t nopoints2=40000;
-  Float_t l[3], p[3];
+  Float_t p[3];
 
   Double_t *z1, *z2, *y1, *y2, *x1, *x2, *phi1, *phi2, *r1, *r2;
   z1=new Double_t[nopoints1];
@@ -116,16 +87,19 @@ AliESDVertex* AliITSVertexerIons::FindVertexForCurrentEvent(Int_t evnumber){
   Double_t r=0;
 
   Int_t np1=0, np2=0;
-  for(Int_t i=g2->GetStartSPD();i<=g2->GetLastSPD();i++) {
+  for(Int_t i=AliITSgeomTGeo::GetModuleIndex(1,1,1);i<=AliITSgeomTGeo::GetModuleIndex(2,1,1)-1;i++) {
     detTypeRec.ResetRecPoints();
-    tr->GetEvent(i);
+    itsClusterTree->GetEvent(i);
     npoints = recpoints->GetEntries();
     for (Int_t ipoint=0;ipoint<npoints;ipoint++) {
       pnt = (AliITSRecPoint*)recpoints->UncheckedAt(ipoint);
-      l[0]=pnt->GetX();
+      /*
+      l[0]=pnt->GetDetLocalX();
       l[1]=0;
-      l[2]=pnt->GetZ();
+      l[2]=pnt->GetDetLocalZ();
       g2->LtoG(i, l, p);
+      */
+      pnt->GetGlobalXYZ(p);
       r=TMath::Sqrt(TMath::Power(p[0],2)+TMath::Power(p[1],2));
 
       if(i<80 && TMath::Abs(p[2])<14.35)  {
@@ -148,10 +122,10 @@ AliESDVertex* AliITSVertexerIons::FindVertexForCurrentEvent(Int_t evnumber){
   }
 
   if(np1<fNpThreshold) {
-    Warning("FindVertexForCurrentEvent","AliITSVertexerIons finder is not reliable for low multiplicity events. Switching to AliITSVertexerPPZ with default parameters...\n");
+    Warning("FindVertexForCurrentEvent","AliITSVertexerIons finder is not reliable for low multiplicity events. Switching to AliITSVertexerZ with default parameters...\n");
     Warning("FindVertexForCurrentEvent","N rec points = %d - Threshold is %d",np1,fNpThreshold);
-    AliITSVertexerPPZ *dovert = new AliITSVertexerPPZ("default");
-    fCurrentVertex =dovert->FindVertexForCurrentEvent(rl->GetEventNumber());
+    AliITSVertexerZ *dovert = new AliITSVertexerZ();
+    fCurrentVertex =dovert->FindVertexForCurrentEvent(itsClusterTree);
     delete dovert;
     return fCurrentVertex;
   }
@@ -160,7 +134,7 @@ AliESDVertex* AliITSVertexerIons::FindVertexForCurrentEvent(Int_t evnumber){
     Error("FindVertexForCurrentEvent","No points in the pixer layers");
     return fCurrentVertex;
   }  
-  if(fDebug>0)   cout << "N. points layer 1 and 2 : " << np1 << " " << np2 << endl;
+  AliDebug(1,Form("N. points layer 1 and 2 : %d %d",np1,np2));
 
   Double_t asparx = (mxpiu-mxmeno)/(mxpiu+mxmeno);
   Double_t aspary = (mypiu-mymeno)/(mypiu+mymeno);
@@ -168,7 +142,7 @@ AliESDVertex* AliITSVertexerIons::FindVertexForCurrentEvent(Int_t evnumber){
   Double_t x0 = 2.86*asparx;
   Double_t y0 = 2.86*aspary;
 
-  if(fDebug>0)   cout << "Rough xy vertex = " << x0 << " " << y0 << endl;  
+  AliDebug(1,Form("Rough xy vertex = %f %f",x0,y0));  
 
   for(Int_t i=0;i<np1;i++) {
     x1[i]-=x0;
@@ -222,7 +196,6 @@ AliESDVertex* AliITSVertexerIons::FindVertexForCurrentEvent(Int_t evnumber){
     Double_t resolution[3]={0,0,0};
     Double_t snr[3]={0,0,0};
     Char_t name[30];
-    if(fDebug>0)Info("FindVertexForCurrentEvent","Vertex found for event %d",evnumber);
     sprintf(name,"Vertex");
     fCurrentVertex = new AliESDVertex(position,resolution,snr,name);
     return fCurrentVertex;
@@ -242,7 +215,7 @@ AliESDVertex* AliITSVertexerIons::FindVertexForCurrentEvent(Int_t evnumber){
   fx->SetParameter(0,100);
   Double_t dist=0.3;
   Double_t xapprox=FindMaxAround(x0,hxv,dist);
-  if(fDebug>0) cout << "xapprox = " << xapprox << endl;
+  AliDebug(1,Form("xapprox = %f",xapprox));
   fx->SetParameter(1,xapprox);
   Double_t difcentroid=0.07;
   fx->SetParLimits(1,xapprox-difcentroid,xapprox+difcentroid);
@@ -253,7 +226,7 @@ AliESDVertex* AliITSVertexerIons::FindVertexForCurrentEvent(Int_t evnumber){
   TF1 *fy = new TF1 ("fy","([0]*exp(-0.5*((x-[1])/[2])*((x-[1])/[2])))+[3]+[4]*x+[5]*x*x",y0-dxy,y0+dxy);  
   fy->SetParameter(0,100);
   Double_t yapprox=FindMaxAround(y0,hyv,dist);
-  if(fDebug>0) cout << "yapprox = " << yapprox << endl;
+  AliDebug(1,Form("yapprox = %f",yapprox));
   fy->SetParameter(1,yapprox);
   fy->SetParLimits(1,yapprox-difcentroid,yapprox+difcentroid);
   fy->SetParameter(2,0.1);
@@ -279,7 +252,6 @@ AliESDVertex* AliITSVertexerIons::FindVertexForCurrentEvent(Int_t evnumber){
   Double_t snr[3]={0,0,0};
   
   Char_t name[30];
-  if(fDebug>0)Info("FindVertexForCurrentEvent","Vertex found for event %d",evnumber);
   sprintf(name,"Vertex");
   fCurrentVertex = new AliESDVertex(position,resolution,snr,name);
 
@@ -295,33 +267,10 @@ void AliITSVertexerIons::PhiFunc(Double_t &x,Double_t &y,Double_t &phi) {
   if(y<0 && x>0) phi=(TMath::ATan((Double_t)(y/x))*57.29578)+360;;
 }
 
-//______________________________________________________________________
-void AliITSVertexerIons::FindVertices(){
-  // computes the vertices of the events in the range FirstEvent - LastEvent
-  AliRunLoader *rl = AliRunLoader::GetRunLoader();
-  AliITSLoader* itsloader =  (AliITSLoader*) rl->GetLoader("ITSLoader");
-  itsloader->LoadRecPoints("read");
-  for(Int_t i=fFirstEvent;i<=fLastEvent;i++){
-    rl->GetEvent(i);
-    FindVertexForCurrentEvent(i);
-    if(fCurrentVertex){
-      WriteCurrentVertex();
-    }
-    else {
-      if(fDebug>0){
-       cout<<"Vertex not found for event "<<i<<endl;
-      }
-    }
-  }
-}
-
 //________________________________________________________
 void AliITSVertexerIons::PrintStatus() const {
   // Print current status
   cout <<"=======================================================\n";
-  cout <<" Debug flag: "<<fDebug<<endl;
-  cout<<"First event to be processed "<<fFirstEvent;
-  cout<<"\n Last event to be processed "<<fLastEvent<<endl;
   if(fCurrentVertex)fCurrentVertex->PrintStatus();
 }