]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPC.cxx
- AddTrackReference moved to AliModule
[u/mrichter/AliRoot.git] / TPC / AliTPC.cxx
index 58e3531e2eb32a9e20b4746a95add0006c8bcd9c..24a1d5a490acf4a11d9849a15225556e7fa29ae1 100644 (file)
 
 /*
 $Log$
+Revision 1.67  2003/03/03 16:36:16  kowal2
+Added LoadTPCParam method
+
+Revision 1.66  2003/02/11 16:54:07  hristov
+Updated AliTrackReference class (S.Radomski)
+
+Revision 1.65  2002/11/21 22:43:32  alibrary
+Removing AliMC and AliMCProcess
+
+Revision 1.64  2002/10/23 07:17:33  alibrary
+Introducing Riostream.h
+
+Revision 1.63  2002/10/14 14:57:42  hristov
+Merging the VirtualMC branch to the main development branch (HEAD)
+
+Revision 1.54.4.3  2002/10/11 08:34:48  hristov
+Updating VirtualMC to v3-09-02
+
+Revision 1.62  2002/09/23 09:22:56  hristov
+The address of the TrackReferences is set (M.Ivanov)
+
+Revision 1.61  2002/09/10 07:06:42  kowal2
+Corrected for the memory leak. Thanks to J. Chudoba and M. Ivanov
+
+Revision 1.60  2002/06/12 14:56:56  kowal2
+Added track length to the reference hits
+
 Revision 1.59  2002/06/05 15:37:31  kowal2
 Added cross-talk from the wires beyond the first and the last rows
 
@@ -209,10 +236,9 @@ Introduction of the Copyright and cvs Log
 #include <TROOT.h>
 #include <TSystem.h>     
 #include "AliRun.h"
-#include <iostream.h>
+#include <Riostream.h>
 #include <stdlib.h>
-#include <fstream.h>
-#include "AliMC.h"
+#include <Riostream.h>
 #include "AliMagF.h"
 #include "AliTrackReference.h"
 
@@ -264,7 +290,9 @@ AliTPCFastMatrix::AliTPCFastMatrix(Int_t row_lwb, Int_t row_upb, Int_t col_lwb,
 class AliTPCFastVector : public TVector {
 public :
   AliTPCFastVector(Int_t size);
+  virtual ~AliTPCFastVector(){;}
   inline Float_t & UncheckedAt(Int_t index) const  {return  fElements[index];} //fast acces  
+  
 };
 
 AliTPCFastVector::AliTPCFastVector(Int_t size):TVector(size){
@@ -378,22 +406,6 @@ void AliTPC::AddHit(Int_t track, Int_t *vol, Float_t *hits)
   if (fHitType>1)
    AddHit2(track,vol,hits);
 }
-
-void  AliTPC::AddTrackReference(Int_t lab, TLorentzVector p, TLorentzVector x, Float_t length){
-  //
-  // add a trackrefernce to the list
-  if (!fTrackReferences) {
-    cerr<<"Container trackrefernce not active\n";
-    return;
-  }
-  Int_t nref = fTrackReferences->GetEntriesFast();
-  TClonesArray &lref = *fTrackReferences;
-  AliTrackReference * ref =  new(lref[nref]) AliTrackReference;
-  ref->SetMomentum(p[0],p[1],p[2]);
-  ref->SetPosition(x[0],x[1],x[2]);
-  ref->SetTrack(lab);
-  ref->SetLength(length);
-}
  
 //_____________________________________________________________________________
 void AliTPC::BuildGeometry()
@@ -1895,7 +1907,7 @@ void AliTPC::Hits2DigitsSector(Int_t isec)
    
        } // end of the sector digitization
 
-      for(i=0;i<nrows;i++){
+      for(i=0;i<nrows+2;i++){
         row[i]->Delete();  
         delete row[i];   
       }
@@ -2739,6 +2751,13 @@ void AliTPC::SetTreeAddress2()
     branch = treeH->GetBranch(branchname);
     if (branch) branch->SetAddress(&fTrackHitsOld);
   }
+  //set address to TREETR
+  TTree *treeTR = gAlice->TreeTR();
+  if (treeTR && fTrackReferences) {
+    branch = treeTR->GetBranch(GetName());
+    if (branch) branch->SetAddress(&fTrackReferences);
+  }
+
 
 }
 
@@ -3258,3 +3277,48 @@ void AliTPC::Digits2Reco(Int_t firstevent,Int_t lastevent)
 
 
 }
+
+////////////////////////////////////////////////////////////////////////
+AliTPCParam* AliTPC::LoadTPCParam(TFile *file) {
+//
+// load TPC paarmeters from a given file or create new if the object
+// is not found there
+//
+  char paramName[50];
+  sprintf(paramName,"75x40_100x60_150x60");
+  AliTPCParam *paramTPC=(AliTPCParam*)file->Get(paramName);
+  if (paramTPC) {
+    cout<<"TPC parameters "<<paramName<<" found."<<endl;
+  } else {
+    cerr<<"TPC parameters not found. Create new (they may be incorrect)."
+       <<endl;    
+    paramTPC = new AliTPCParamSR;
+  }
+  return paramTPC;
+
+// the older version of parameters can be accessed with this code.
+// In some cases, we have old parameters saved in the file but 
+// digits were created with new parameters, it can be distinguish 
+// by the name of TPC TreeD. The code here is just for the case 
+// we would need to compare with old data, uncomment it if needed.
+//
+//  char paramName[50];
+//  sprintf(paramName,"75x40_100x60");
+//  AliTPCParam *paramTPC=(AliTPCParam*)in->Get(paramName);
+//  if (paramTPC) {
+//    cout<<"TPC parameters "<<paramName<<" found."<<endl;
+//  } else {
+//    sprintf(paramName,"75x40_100x60_150x60");
+//    paramTPC=(AliTPCParam*)in->Get(paramName);
+//    if (paramTPC) {
+//     cout<<"TPC parameters "<<paramName<<" found."<<endl;
+//    } else {
+//     cerr<<"TPC parameters not found. Create new (they may be incorrect)."
+//         <<endl;    
+//     paramTPC = new AliTPCParamSR;
+//    }
+//  }
+//  return paramTPC;
+
+}
+