]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSVertexerIons.cxx
Coding conventions
[u/mrichter/AliRoot.git] / ITS / AliITSVertexerIons.cxx
index c15202ee93bfcc1253eab30ce3dcae8ab17ac7aa..eef9f19ac0a93bf7ceba306f2680256529835a11 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;
@@ -39,7 +44,10 @@ ClassImp(AliITSVertexerIons)
 }
 
 //______________________________________________________________________
-AliITSVertexerIons::AliITSVertexerIons(TString fn):AliITSVertexer(fn) {
+AliITSVertexerIons::AliITSVertexerIons(TString fn):AliITSVertexer(fn),
+fNpThreshold(0),
+fMaxDeltaPhi(0),
+fMaxDeltaZ(0) {
   // Standard constructor
   
   //fITS = 0;
@@ -47,21 +55,21 @@ AliITSVertexerIons::AliITSVertexerIons(TString fn):AliITSVertexer(fn) {
   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*/) {
+//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;
-}
+  //Error("= operator","Assignment operator not allowed\n");
+  //return *this;
+//}
 
 
 //______________________________________________________________________
@@ -78,10 +86,12 @@ AliESDVertex* AliITSVertexerIons::FindVertexForCurrentEvent(Int_t evnumber){
 
   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;
@@ -95,7 +105,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 +126,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);
     npoints = recpoints->GetEntries();
     for (Int_t ipoint=0;ipoint<npoints;ipoint++) {
       pnt = (AliITSRecPoint*)recpoints->UncheckedAt(ipoint);
+      /*
       l[0]=pnt->GetDetLocalX();
       l[1]=0;
       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,9 +161,9 @@ 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");
+    AliITSVertexerZ *dovert = new AliITSVertexerZ("default");
     fCurrentVertex =dovert->FindVertexForCurrentEvent(rl->GetEventNumber());
     delete dovert;
     return fCurrentVertex;
@@ -160,7 +173,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 +181,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 +235,7 @@ 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);
+    AliDebug(1,Form("Vertex found for event %d",evnumber));
     sprintf(name,"Vertex");
     fCurrentVertex = new AliESDVertex(position,resolution,snr,name);
     return fCurrentVertex;
@@ -242,7 +255,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 +266,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 +292,7 @@ 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);
+  AliDebug(1,Form("Vertex found for event %d",evnumber));
   sprintf(name,"Vertex");
   fCurrentVertex = new AliESDVertex(position,resolution,snr,name);
 
@@ -308,9 +321,7 @@ void AliITSVertexerIons::FindVertices(){
       WriteCurrentVertex();
     }
     else {
-      if(fDebug>0){
-       cout<<"Vertex not found for event "<<i<<endl;
-      }
+      AliDebug(1,Form("Vertex not found for event %d",i));
     }
   }
 }
@@ -319,7 +330,6 @@ void AliITSVertexerIons::FindVertices(){
 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();