Fixed Warnings in Reconstructioner and Prob
[u/mrichter/AliRoot.git] / TOF / AliTOFReconstructioner.cxx
index 3a00c8669c28090ebed60526129408060c1faba3..466eef1a431cca8baa78895ba0fa5714adac967c 100644 (file)
@@ -64,7 +64,8 @@
 #include "TFile.h"
 #include "TParticle.h"
 #include <TClonesArray.h>
 #include "TFile.h"
 #include "TParticle.h"
 #include <TClonesArray.h>
-#include "../TGeant3/TGeant3.h"
+#include "TGeant3.h"
+#include "TVirtualMC.h"
 #include <TF1.h>
 #include <TF2.h>
 #include "TROOT.h"
 #include <TF1.h>
 #include <TF2.h>
 #include "TROOT.h"
@@ -81,7 +82,6 @@ ClassImp(AliTOFReconstructioner)
 {
   // default ctor
   fNevents = 0 ; 
 {
   // default ctor
   fNevents = 0 ; 
-  fg3      = 0;
   foutputfile  = 0; 
   foutputntuple= 0;
   fZnoise  = 0;
   foutputfile  = 0; 
   foutputntuple= 0;
   fZnoise  = 0;
@@ -95,7 +95,6 @@ ClassImp(AliTOFReconstructioner)
   // ctor
   //
   fNevents = 0 ;     // Number of events to reconstruct, 0 means all evens in current file
   // ctor
   //
   fNevents = 0 ;     // Number of events to reconstruct, 0 means all evens in current file
-  fg3      = 0;
   foutputfile  = 0; 
   foutputntuple= 0;
   fZnoise  = 0;
   foutputfile  = 0; 
   foutputntuple= 0;
   fZnoise  = 0;
@@ -117,9 +116,6 @@ ClassImp(AliTOFReconstructioner)
   gAlice->Init();
   gAlice->Print(); 
 
   gAlice->Init();
   gAlice->Print(); 
 
-  // set the fg3 pointer to geometry used by IsInsideThePad method
-  fg3 = (TGeant3*) gMC;         
-
   CreateNTuple();  
 
   // add Task to //root/Tasks folder
   CreateNTuple();  
 
   // add Task to //root/Tasks folder
@@ -216,11 +212,7 @@ void AliTOFReconstructioner::Init(Option_t* opt)
   //
   // dtor
   //
   //
   // dtor
   //
-  if (fg3)
-    {
-      delete fg3;
-      fg3 = 0;
-    }
+
   if (foutputfile)
     {
       delete foutputfile;
   if (foutputfile)
     {
       delete foutputfile;
@@ -586,7 +578,7 @@ void AliTOFReconstructioner::PrintParameters()const
 }
 
 //__________________________________________________________________
 }
 
 //__________________________________________________________________
-void AliTOFReconstructioner::IsInsideThePad(TGeant3 *g3, Float_t x, Float_t y, Float_t z, Int_t *nGeom, Float_t& zPad, Float_t& xPad) 
+void AliTOFReconstructioner::IsInsideThePad(TVirtualMC *vmc, Float_t x, Float_t y, Float_t z, Int_t *nGeom, Float_t& zPad, Float_t& xPad) 
 {
   //   input: x,y,z - coordinates of a hit
   //   output: array  nGeom[]
 {
   //   input: x,y,z - coordinates of a hit
   //   output: array  nGeom[]
@@ -627,6 +619,8 @@ void AliTOFReconstructioner::IsInsideThePad(TGeant3 *g3, Float_t x, Float_t y, F
   xTOF[1]=y;
   xTOF[2]=z;
   
   xTOF[1]=y;
   xTOF[2]=z;
   
+  TGeant3 * g3 = (TGeant3*) vmc;
+
   g3->Gmedia(xTOF, numed);
   gcvolu=g3->Gcvolu();
   nLevel=gcvolu->nlevel;
   g3->Gmedia(xTOF, numed);
   gcvolu=g3->Gcvolu();
   nLevel=gcvolu->nlevel;
@@ -1507,18 +1501,24 @@ Bool_t AliTOFReconstructioner::operator==( AliTOFReconstructioner const & tofrec
   // split the member variables in analogous categories
   
   // time resolution and edge effect parameters
   // split the member variables in analogous categories
   
   // time resolution and edge effect parameters
-  Bool_t dummy0=(fTimeResolution==tofrec.fTimeResolution)&&(fpadefficiency==tofrec.fpadefficiency)&&(fEdgeEffect==tofrec.fEdgeEffect)&&(fEdgeTails==tofrec.fEdgeTails)&&(fHparameter==tofrec.fHparameter)&&(fH2parameter==tofrec.fH2parameter)&&(fKparameter==tofrec.fKparameter)&&(fK2parameter==tofrec.fK2parameter);
+  Bool_t dummy0=(fTimeResolution==tofrec.fTimeResolution)&&(fpadefficiency==tofrec.fpadefficiency)&&(fEdgeEffect==tofrec.fEdgeEffect)&&(fEdgeTails==tofrec.fEdgeTails)&&(fHparameter==tofrec.fHparameter)&&(fH2parameter==tofrec.fH2parameter)&&(fKparameter==t
+ofrec.fKparameter)&&(fK2parameter==tofrec.fK2parameter);
   
   // pad efficiency parameters
   
   // pad efficiency parameters
-  Bool_t dummy1=(fEffCenter==tofrec.fEffCenter)&&(fEffBoundary==tofrec.fEffBoundary)&&(fEff2Boundary==tofrec.fEff2Boundary)&&(fEff3Boundary==tofrec.fEff3Boundary)&&(fResCenter==tofrec.fResCenter)&&(fResBoundary==tofrec.fResBoundary)&&(fResSlope==tofrec.fResSlope);
+  Bool_t dummy1=(fEffCenter==tofrec.fEffCenter)&&(fEffBoundary==tofrec.fEffBoundary)&&(fEff2Boundary==tofrec.fEff2Boundary)&&(fEff3Boundary==tofrec.fEff3Boundary)&&(fResCenter==tofrec.fResCenter)&&(fResBoundary==tofrec.fResBoundary)&&(fResSlope==tofrec.fR
+esSlope);
 
   // time walk parameters
 
   // time walk parameters
-  Bool_t dummy2=(fTimeWalkCenter==tofrec.fTimeWalkCenter)&&(fTimeWalkBoundary==tofrec.fTimeWalkBoundary)&&(fTimeWalkSlope==tofrec.fTimeWalkSlope)&&(fTimeDelayFlag==tofrec.fTimeDelayFlag)&&(fPulseHeightSlope==tofrec.fPulseHeightSlope)&&(fTimeDelaySlope==tofrec.fTimeDelaySlope);
+  Bool_t dummy2=(fTimeWalkCenter==tofrec.fTimeWalkCenter)&&(fTimeWalkBoundary==tofrec.fTimeWalkBoundary)&&(fTimeWalkSlope==tofrec.fTimeWalkSlope)&&(fTimeDelayFlag==tofrec.fTimeDelayFlag)&&(fPulseHeightSlope==tofrec.fPulseHeightSlope)&&(fTimeDelaySlope==to
+frec.fTimeDelaySlope);
 
   // ADC-TDC correlation parameters
 
   // ADC-TDC correlation parameters
-  Bool_t dummy3=(fMinimumCharge==tofrec.fMinimumCharge)&&(fChargeSmearing==tofrec.fChargeSmearing )&&(fLogChargeSmearing==tofrec.fLogChargeSmearing )&&(fTimeSmearing==tofrec.fTimeSmearing )&&(fAverageTimeFlag==tofrec.fAverageTimeFlag)&&(fChargeFactorForMatching==tofrec.fChargeFactorForMatching)&&(fMatchingStyle==tofrec.fMatchingStyle);
+  Bool_t dummy3=(fMinimumCharge==tofrec.fMinimumCharge)&&(fChargeSmearing==tofrec.fChargeSmearing )&&(fLogChargeSmearing==tofrec.fLogChargeSmearing )&&(fTimeSmearing==tofrec.fTimeSmearing )&&(fAverageTimeFlag==tofrec.fAverageTimeFlag)&&(fChargeFactorForMa
+tching==tofrec.fChargeFactorForMatching)&&(fMatchingStyle==tofrec.fMatchingStyle);
   
   
-  Bool_t dummy4=(fTrackingEfficiency==tofrec.fTrackingEfficiency)&&(fSigmavsp==tofrec.fSigmavsp)&&(fSigmaZ==tofrec.fSigmaZ)&&(fSigmarphi==tofrec.fSigmarphi)&&(fSigmap==tofrec.fSigmap)&&(fSigmaPhi==tofrec.fSigmaPhi)&&(fSigmaTheta==tofrec.fSigmaTheta)&&(fNoise==tofrec.fNoise)&&(fNoiseSlope==tofrec.fNoiseSlope)&&(fField==tofrec.fField)&&(fRadLenTPC==tofrec.fRadLenTPC)&&(fCorrectionTRD==tofrec.fCorrectionTRD)&&(fLastTPCRow==tofrec.fLastTPCRow)&&(fRadiusvtxBound==tofrec.fRadiusvtxBound)&&(fMaxTestTracks==tofrec.fMaxTestTracks)&&(fStep==tofrec.fStep)&&(fMaxPixels==tofrec.fMaxPixels)&&(fMaxAllTracks==tofrec.fMaxAllTracks)&&(fMaxTracks==tofrec.fMaxTracks)&&(fMaxTOFHits==tofrec.fMaxTOFHits)&&(fPBound==tofrec.fPBound);
+  Bool_t dummy4=(fTrackingEfficiency==tofrec.fTrackingEfficiency)&&(fSigmavsp==tofrec.fSigmavsp)&&(fSigmaZ==tofrec.fSigmaZ)&&(fSigmarphi==tofrec.fSigmarphi)&&(fSigmap==tofrec.fSigmap)&&(fSigmaPhi==tofrec.fSigmaPhi)&&(fSigmaTheta==tofrec.fSigmaTheta)&&(fNo
+ise==tofrec.fNoise)&&(fNoiseSlope==tofrec.fNoiseSlope)&&(fField==tofrec.fField)&&(fRadLenTPC==tofrec.fRadLenTPC)&&(fCorrectionTRD==tofrec.fCorrectionTRD)&&(fLastTPCRow==tofrec.fLastTPCRow)&&(fRadiusvtxBound==tofrec.fRadiusvtxBound)&&(fMaxTestTracks==tofre
+c.fMaxTestTracks)&&(fStep==tofrec.fStep)&&(fMaxPixels==tofrec.fMaxPixels)&&(fMaxAllTracks==tofrec.fMaxAllTracks)&&(fMaxTracks==tofrec.fMaxTracks)&&(fMaxTOFHits==tofrec.fMaxTOFHits)&&(fPBound==tofrec.fPBound);
 
   if( dummy0 && dummy1 && dummy2 && dummy3 && dummy4)
     return kTRUE ;
 
   if( dummy0 && dummy1 && dummy2 && dummy3 && dummy4)
     return kTRUE ;
@@ -1558,7 +1558,8 @@ void AliTOFReconstructioner::InitArray(Int_t array[], Int_t nlocations)
 
 
 //____________________________________________________________________________
 
 
 //____________________________________________________________________________
-void AliTOFReconstructioner::ReadTOFHits(Int_t ntracks, TTree* treehits, TClonesArray* tofhits, Int_t ***MapPixels, Int_t* kTOFhitFirst, AliTOFPad* pixelArray , Int_t* iTOFpixel, Float_t* toftime, AliTOFRecHit* hitArray, Int_t& isHitOnFiredPad, Int_t& ipixel)
+void AliTOFReconstructioner::ReadTOFHits(Int_t ntracks, TTree* treehits, TClonesArray* tofhits, Int_t ***MapPixels, Int_t* kTOFhitFirst, AliTOFPad* pixelArray , Int_t* iTOFpixel, Float_t* toftime, AliTOFRecHit* hitArray, Int_t& isHitOnFiredPad, Int_t& ipi
+xel)
 {
   //
   // Read TOF hits for the current event and fill arrays
 {
   //
   // Read TOF hits for the current event and fill arrays
@@ -1721,7 +1722,7 @@ void AliTOFReconstructioner::ReadTOFHits(Int_t ntracks, TTree* treehits, TClones
          }
        } //end if(ipart!=ipartLast)
 
          }
        } //end if(ipart!=ipartLast)
 
-       IsInsideThePad(fg3,x,y,z,npixel,zPad,xPad);
+       IsInsideThePad(gMC,x,y,z,npixel,zPad,xPad);
 
        Int_t sec  = tofHit->GetSector();
        Int_t pla  = tofHit->GetPlate();
 
        Int_t sec  = tofHit->GetSector();
        Int_t pla  = tofHit->GetPlate();
@@ -1739,7 +1740,7 @@ void AliTOFReconstructioner::ReadTOFHits(Int_t ntracks, TTree* treehits, TClones
        
        
        if (npixel[4]==0){
        
        
        if (npixel[4]==0){
-         IsInsideThePad(fg3,x,y,z,npixel,zPad,xPad);
+         IsInsideThePad(gMC,x,y,z,npixel,zPad,xPad);
          if (npixel[4]==0){          
            nHitOutofTofVolumes++;
          }
          if (npixel[4]==0){          
            nHitOutofTofVolumes++;
          }
@@ -2586,7 +2587,7 @@ void AliTOFReconstructioner::Matching(AliTOFTrack* trackArray, AliTOFRecHit* hit
        gz=zHelixCenter+s*sinlam;
        rho=TMath::Sqrt(gx*gx+gy*gy);
        
        gz=zHelixCenter+s*sinlam;
        rho=TMath::Sqrt(gx*gx+gy*gy);
        
-       IsInsideThePad(fg3,gx,gy,gz,npixel,zPad,xPad);
+       IsInsideThePad(gMC,gx,gy,gz,npixel,zPad,xPad);
        
        iplate += npixel[1];
        iPadAlongX += npixel[4];
        
        iplate += npixel[1];
        iPadAlongX += npixel[4];
@@ -2718,7 +2719,7 @@ void AliTOFReconstructioner::Matching(AliTOFTrack* trackArray, AliTOFRecHit* hit
          testZ[itest-1]=wZ;
          testWeight[itest-1]=weight;
        } else {
          testZ[itest-1]=wZ;
          testWeight[itest-1]=weight;
        } else {
-         Int_t k;
+         Int_t k=0;
          for(Int_t i=0;i<itest;i++) {
            k=0;
            if(testPixel[i]==wPixel) {
          for(Int_t i=0;i<itest;i++) {
            k=0;
            if(testPixel[i]==wPixel) {
@@ -2950,11 +2951,14 @@ void AliTOFReconstructioner::Matching(AliTOFTrack* trackArray, AliTOFRecHit* hit
       if(iTOFpixel[ipart] && match!=3) {
        particle = (TParticle*)gAlice->Particle(ipart);  //for V3.05
 
       if(iTOFpixel[ipart] && match!=3) {
        particle = (TParticle*)gAlice->Particle(ipart);  //for V3.05
 
-       printf("          ipixel=%i (Sector=%i, Plate=%i, Strip=%i, Pixel=%i), fired by %i track\n",iTOFpixel[ipart],pixelArray[iTOFpixel[ipart]-1].GetSector(),pixelArray[iTOFpixel[ipart]-1].GetPlate(),pixelArray[iTOFpixel[ipart]-1].GetStrip(),pixelArray[iTOFpixel[ipart]-1].GetPixel(),pixelArray[iTOFpixel[ipart]-1].GetTrack());   
-       printf("     indexOfTestTrack=%i itest=%i weightTestTracksOutTof[4]=%f weightTestTracksOutTof[2]=%f weightTestTracksOutTof[1]=%f weightTestTracksOutTof[0]=%f\n",indexOfTestTrack,itest,weightTestTracksOutTof[3],weightTestTracksOutTof[2],weightTestTracksOutTof[1],weightTestTracksOutTof[0]);
+       printf("          ipixel=%i (Sector=%i, Plate=%i, Strip=%i, Pixel=%i), fired by %i track\n",iTOFpixel[ipart],pixelArray[iTOFpixel[ipart]-1].GetSector(),pixelArray[iTOFpixel[ipart]-1].GetPlate(),pixelArray[iTOFpixel[ipart]-1].GetStrip(),pixelArray[iTOFpix
+el[ipart]-1].GetPixel(),pixelArray[iTOFpixel[ipart]-1].GetTrack());   
+       printf("     indexOfTestTrack=%i itest=%i weightTestTracksOutTof[4]=%f weightTestTracksOutTof[2]=%f weightTestTracksOutTof[1]=%f weightTestTracksOutTof[0]=%f\n",indexOfTestTrack,itest,weightTestTracksOutTof[3],weightTestTracksOutTof[2],weightTestTracksOu
+tTof[1],weightTestTracksOutTof[0]);
        if(itest) {
 
        if(itest) {
 
-         printf("     take ipixel=%i (Sector=%i, Plate=%i, Strip=%i, Pixel=%i), (fired by %i track), match=%i\n",wPixel,pixelArray[wPixel-1].GetSector(),pixelArray[wPixel-1].GetPlate(),pixelArray[wPixel-1].GetStrip(),pixelArray[wPixel-1].GetPixel(),pixelArray[wPixel-1].GetTrack(),match);   
+         printf("     take ipixel=%i (Sector=%i, Plate=%i, Strip=%i, Pixel=%i), (fired by %i track), match=%i\n",wPixel,pixelArray[wPixel-1].GetSector(),pixelArray[wPixel-1].GetPlate(),pixelArray[wPixel-1].GetStrip(),pixelArray[wPixel-1].GetPixel(),pixelArray[w
+Pixel-1].GetTrack(),match);   
        }
       }
     }
        }
       }
     }