]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSVertexerFast.cxx
Added two missing includes to allow macro compilation (thanks to Laurent for remarkin...
[u/mrichter/AliRoot.git] / ITS / AliITSVertexerFast.cxx
index e9a234e376a26cb72be4451e2fe134ab05657e1e..7692cd17334d9c0845d5f0c60fe1f493673f8b9e 100644 (file)
@@ -35,18 +35,33 @@ ClassImp(AliITSVertexerFast)
 
 
 //______________________________________________________________________
-AliITSVertexerFast::AliITSVertexerFast():AliITSVertexer() {
+AliITSVertexerFast::AliITSVertexerFast():AliITSVertexer(),
+fSmear(0) 
+{
   // Default Constructor
   fSmear = 0;
+  AliRunLoader *rl =AliRunLoader::Instance();
+  TTree *trK=(TTree*)rl->TreeK();
+  if(!trK)AliFatal("This class should be used only with simulated events!!");
+  rl->LoadHeader(); 
 }
 
 //______________________________________________________________________
-AliITSVertexerFast::AliITSVertexerFast(Double_t *smear):AliITSVertexer() {
+AliITSVertexerFast::AliITSVertexerFast(Double_t *smear):AliITSVertexer(),
+fSmear(0)
+{
   // Standard constructor
   fSmear = new Double_t[3];
   for(Int_t i=0;i<3;i++)fSmear[i]=smear[i];
+  AliInfo(Form("Gaussian smaring of the generated vertex. Sigmas (x,y,z) = %12.5f , %12.5f , %12.5f cm",fSmear[0],fSmear[1],fSmear[2]));
+  AliRunLoader *rl =AliRunLoader::Instance();
+  TTree *trK=(TTree*)rl->TreeK();
+  if(!trK)AliFatal("This class should be used only with simulated events!!");
+  rl->LoadHeader(); 
+
 }
 
+
 //______________________________________________________________________
 AliITSVertexerFast::~AliITSVertexerFast(){
   // Destructor
@@ -55,47 +70,27 @@ AliITSVertexerFast::~AliITSVertexerFast(){
 }
 
 //______________________________________________________________________
-AliESDVertex* AliITSVertexerFast::FindVertexForCurrentEvent(Int_t evnumb){
+AliESDVertex* AliITSVertexerFast::FindVertexForCurrentEvent(TTree *itsClusterTree){
   // Defines the AliITSVertex for the current event
+  AliWarning(Form("This class should be used only with simulated events!! Input cluster tree (%p) will not be used!!",itsClusterTree));
+
   fCurrentVertex = 0;
-  AliRunLoader *rl =AliRunLoader::GetRunLoader();
-  rl->GetEvent(evnumb);
+  AliRunLoader *rl =AliRunLoader::Instance();
   TArrayF primaryVertex(3);  // true vertex
-  AliHeader* header = gAlice->GetHeader();
+  AliHeader* header = rl->GetHeader();
   AliGenEventHeader* genEventHeader = header->GenEventHeader();   
   genEventHeader->PrimaryVertex(primaryVertex); 
-
+  
   // Smearing
   Double_t vrttrue[3],vrtx[3];
   for(Int_t k=0; k<3;k++){
     vrttrue[k] = static_cast<Double_t>(primaryVertex[k]);
     vrtx[k] = gRandom->Gaus(vrttrue[k],fSmear[k]);
   }
-  char name[30];
-  sprintf(name,"Vertex_%d",evnumb);
-  fCurrentVertex = new AliESDVertex(vrtx,fSmear,name);
-  fCurrentVertex->SetTruePos(vrttrue);
+  fCurrentVertex = new AliESDVertex(vrtx,fSmear,"Smeared Generated Vertex");
+  fCurrentVertex->SetTitle("vertexer: smearMC");
   return fCurrentVertex;
-}
-
-//______________________________________________________________________
-void AliITSVertexerFast::FindVertices(){
-  // computes the vertices of the events in the range FirstEvent - LastEvent
-
-  AliRunLoader *rl = AliRunLoader::GetRunLoader();
-  AliITSLoader* iTSloader =  (AliITSLoader*) rl->GetLoader("ITSLoader");
-  iTSloader->ReloadRecPoints();
-  for(Int_t i=fFirstEvent;i<=fLastEvent;i++){
-    rl->GetEvent(i);
-    FindVertexForCurrentEvent(i);   
-    if(fCurrentVertex) WriteCurrentVertex();
-    else {
-      cout<<"Vertex not found for event "<<i<<endl;
-
-    }
-
-  }
-
+  
 }
 
 //________________________________________________________
@@ -103,26 +98,8 @@ void AliITSVertexerFast::PrintStatus() const {
   // Print current status
   cout <<"=======================================================\n";
 
-  cout<<"First event to be processed "<<fFirstEvent;
-  cout<<"\n Last event to be processed "<<fLastEvent<<endl;
   cout<<"RMS for gaussian smearing: ";
   for(Int_t k=0;k<3;k++)cout<<" "<<fSmear[k];
   cout<<endl;
 }
 
-//______________________________________________________________________
-AliITSVertexerFast::AliITSVertexerFast(const AliITSVertexerFast &vtxr) : 
-                    AliITSVertexer(vtxr) {
-  // Copy constructor
-  // Copies are not allowed. The method is protected to avoid misuse.
-  Error("AliITSVertexerFast","Copy constructor not allowed\n");
-}
-
-//______________________________________________________________________
-AliITSVertexerFast& AliITSVertexerFast::operator=(const 
-                    AliITSVertexerFast& /* vtxr */){
-  // Assignment operator
-  // Assignment is not allowed. The method is protected to avoid misuse.
-  Error("= operator","Assignment operator not allowed\n");
-  return *this;
-}