]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/testTrackSegment.C
MixWith method has been corrected: only one event per file is in the folder
[u/mrichter/AliRoot.git] / PHOS / testTrackSegment.C
1 void testTrackSegment (Int_t evt = 0)  
2 {
3
4 //========= Dynamically link some shared libs
5   if (gClassTable->GetID("AliRun") < 0) 
6   {
7     gROOT->LoadMacro("loadlibs.C");
8     loadlibs();
9   }
10
11 //========== Opening galice.root file  
12   TFile * file   = new TFile("galice.root"); 
13
14 //========== Get AliRun object from file 
15   gAlice = (AliRun*) file->Get("gAlice");
16
17 //=========== Gets the PHOS object and associated geometry from the file 
18   AliPHOSv0 * PHOS  = (AliPHOSv0 *)gAlice->GetDetector("PHOS");
19   AliPHOSGeometry * Geom = AliPHOSGeometry::GetInstance(PHOS->GetGeometry()->GetName(),PHOS->GetGeometry()->GetTitle());
20   
21 //========== Creates the Clusterizer
22   AliPHOSClusterizerv1 clusterizer; 
23   clusterizer.SetEmcEnergyThreshold(0.01) ; 
24   clusterizer.SetEmcClusteringThreshold(0.1) ; 
25   clusterizer.SetPpsdEnergyThreshold(0.0000001) ; 
26   clusterizer.SetPpsdClusteringThreshold(0.0000002) ; 
27   clusterizer.SetLocalMaxCut(0.03) ;
28   clusterizer.SetCalibrationParameters(0.,0.0000001) ;
29
30
31 //========== Creates the track segment maker
32   AliPHOSTrackSegmentMakerv1 tracksegmentmaker ;
33
34 //========== Creates the Reconstructioner  
35   AliPHOSReconstructioner Reconstructioner(clusterizer,tracksegmentmaker);     
36
37   //=========== Connects the various Tree's for evt
38   gAlice->GetEvent(evt);
39   //=========== Gets the Digit TTree
40   gAlice->TreeD()->GetEvent(0) ;     
41   //=========== Gets the number of entries in the Digits array
42   Int_t nId = PHOS->Digits()->GetEntries();    
43   //  printf("AnaPHOSv0.C> Number of entries in the Digit array is %d \n",nId);
44   
45   //=========== Do the reconstruction
46
47   AliPHOSDigit * digit ;
48   TIter next(PHOS->Digits()) ;
49   Float_t Etot=0 ;
50   while((digit = (AliPHOSDigit *)next())) Etot+=clusterizer.Calibrate(digit->GetAmp()) ;
51   cout <<"Found   " << nId << "  digits with total energy " << Etot << endl ;
52
53
54
55     PHOS->Reconstruction(Reconstructioner);  
56
57   //================Make checks===========================
58   AliPHOSDigit * digit ;
59   TIter next(PHOS->Digits()) ;
60   Float_t Etot=0 ;
61   while((digit = (AliPHOSDigit *)next())) Etot+=clusterizer.Calibrate(digit->GetAmp() );
62   cout <<"Found   " << nId << "  digits with total energy " << Etot << endl ;
63
64   TClonesArray * EmcRP = PHOS->EmcClusters() ;
65   Etot = 0.;
66   TIter nextemc(EmcRP) ;
67   AliPHOSEmcRecPoint * emc ;
68   while((emc = (AliPHOSEmcRecPoint *)nextemc())) {
69     Etot+=emc->GetTotalEnergy() ;
70     TVector3 pos ;
71     emc->GetLocalPosition(pos ) ;
72   TMatrix Dummy ;  
73     emc->GetGlobalPosition(pos,Dummy) ;
74   }
75
76   cout << "Found " << EmcRP->GetEntries() << " EMC Clusters with total energy  "<<Etot << endl ; 
77   TClonesArray * PpsdRP = PHOS->PpsdClusters() ;
78   cout << "Found " << PpsdRP->GetEntries() << " Ppsd Clusters " << endl ; 
79
80   TObjArray * trsegl = PHOS->TrackSegments() ;
81   AliPHOSTrackSegment trseg ;
82
83   Int_t NTrackSegments = trsegl->GetEntries() ;
84   Int_t index ;
85   Etot = 0 ;
86   for(index = 0; index < NTrackSegments ; index++){
87     trseg = (AliPHOSTrackSegment * )trsegl->At(index) ;
88     Etot+= trseg->GetEnergy() ;
89     trseg->Print() ;
90   } 
91   cout << "Found " << trsegl->GetEntries() << " Track segments with total energy "<< Etot << endl ;
92   
93 }
94
95