]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSTrackSegmentMaker.cxx
More exact rounding function, but also much slower.
[u/mrichter/AliRoot.git] / PHOS / AliPHOSTrackSegmentMaker.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15 /* $Id$ */
16 //_________________________________________________________________________
17 // Algorithm Base class to construct PHOS track segments
18 // Associates EMC and PPSD clusters
19 // Unfolds the EMC cluster   
20 //*-- 
21 //*-- Author: Dmitri Peressounko (RRC Ki & SUBATECH)
22
23
24 // --- ROOT system ---
25 #include "TGeometry.h"
26 #include "TFile.h"
27 #include "TTree.h"
28
29 // --- Standard library ---
30 #include <iostream.h>
31 #include <stdlib.h>   
32
33 // --- AliRoot header files ---
34 #include "AliRun.h" 
35 #include "AliPHOSTrackSegmentMaker.h"
36 #include "AliHeader.h" 
37
38 ClassImp( AliPHOSTrackSegmentMaker) 
39
40
41 //____________________________________________________________________________
42   AliPHOSTrackSegmentMaker:: AliPHOSTrackSegmentMaker() : TTask("","")
43 {
44   // ctor
45   fSplitFile= 0 ; 
46
47 }
48
49 //____________________________________________________________________________
50 AliPHOSTrackSegmentMaker::AliPHOSTrackSegmentMaker(const char * headerFile, const char * name): TTask(name, headerFile)
51 {
52   // ctor
53   fSplitFile= 0 ; 
54 }
55
56 //____________________________________________________________________________
57 AliPHOSTrackSegmentMaker::~AliPHOSTrackSegmentMaker()
58 {
59    
60       fSplitFile = 0 ;
61 }
62
63 //____________________________________________________________________________
64 void AliPHOSTrackSegmentMaker::SetSplitFile(const TString splitFileName) const
65 {
66   // Diverts the TrackSegments in a file separate from the Digits file
67   
68
69   TDirectory * cwd = gDirectory ;
70   TFile * splitFile = gAlice->InitTreeFile("R",splitFileName.Data());
71   splitFile->cd() ; 
72   gAlice->Write(0, TObject::kOverwrite);
73
74   TTree *treeE  = gAlice->TreeE();
75   if (!treeE) {
76     cerr << "ERROR: AliPHOSTrackSegmentMaker::SetSplitFile -> No TreeE found "<<endl;
77     abort() ;
78   }      
79   
80   // copy TreeE
81   AliHeader *header = new AliHeader();
82   treeE->SetBranchAddress("Header", &header);
83   treeE->SetBranchStatus("*",1);
84   TTree *treeENew =  treeE->CloneTree();
85   treeENew->Write(0, TObject::kOverwrite);
86   
87   // copy AliceGeom
88   TGeometry *AliceGeom = static_cast<TGeometry*>(cwd->Get("AliceGeom"));
89   if (!AliceGeom) {
90     cerr << "ERROR: AliPHOSTrackSegmentMaker::SetSplitFile -> AliceGeom was not found in the input file "<<endl;
91     abort() ;
92   }
93   AliceGeom->Write(0, TObject::kOverwrite);
94   
95   gAlice->MakeTree("R",splitFile);
96   cwd->cd() ; 
97   cout << "INFO: AliPHOSTrackSegmentMaker::SetSPlitMode -> TrackSegments will be stored in " << splitFileName.Data() << endl ;   
98 }