1 TFile* AccessFile(TString inFile="galice.root", TString acctype="R");
3 void AliITSHits2FastRecPoints (Int_t evNumber1=0,Int_t evNumber2=0, TString inFile = "galice.root", TString outFile="galice.root", Int_t nsignal=25, Int_t size=-1)
5 /////////////////////////////////////////////////////////////////////////
7 // This macro creates fast recpoints, optionally on a separate file
9 /////////////////////////////////////////////////////////////////////////
11 // Dynamically link some shared libs
13 if (gClassTable->GetID("AliRun") < 0) {
14 gROOT->LoadMacro("loadlibs.C");
21 // Connect the Root Galice file containing Geometry, Kine and Hits
23 if(outFile.Data() == inFile.Data()){
24 file = AccessFile(inFile,"U");
27 file = AccessFile(inFile);
30 TFile *file2 = 0; // possible output file for TreeR
31 if(!(outFile.Data() == inFile.Data())){
32 // open output file and create TreeR on it
33 file2 = gAlice->InitTreeFile("R",outFile);
36 AliITS *ITS = (AliITS*) gAlice->GetModule("ITS");
39 // Set the simulation model
41 for (Int_t i=0;i<3;i++) {
42 ITS->SetSimulationModel(i,new AliITSsimulationFastPoints());
53 cout << "Creating fast reconstructed points from hits for the ITS..." << endl;
55 for (int ev=evNumber1; ev<= evNumber2; ev++) {
56 cout << "...working on event "<< ev << " ..." << endl;
57 Int_t nparticles = gAlice->GetEvent(ev);
58 cout << "event " <<ev<<endl;
59 cout << "nparticles " <<nparticles<<endl;
61 if(!gAlice->TreeR() && file2 == 0) gAlice-> MakeTree("R");
62 if(!gAlice->TreeR() && file2 != 0) gAlice->MakeTree("R",file2);
63 ITS->MakeBranch("RF");
64 if (ev < evNumber1) continue;
65 if (nparticles <= 0) return;
67 Int_t bgr_ev=Int_t(ev/nsignal);
68 //printf("bgr_ev %d\n",bgr_ev);
70 ITS->HitsToFastRecPoints(ev,bgr_ev,size," ","All"," ");
71 timer.Stop(); timer.Print();
74 delete gAlice; gAlice=0;
79 //-------------------------------------------------------------------
80 TFile * AccessFile(TString FileName, TString acctype){
82 // Function used to open the input file and fetch the AliRun object
85 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(FileName);
86 if (file) {file->Close(); delete file; file = 0;}
87 if(acctype.Contains("U")){
88 file = new TFile(FileName,"update");
90 if(acctype.Contains("N") && !file){
91 file = new TFile(FileName,"recreate");
93 if(!file) file = new TFile(FileName); // default readonly
94 if (!file->IsOpen()) {
95 cerr<<"Can't open "<<FileName<<" !" << endl;
99 // Get AliRun object from file or return if not on file
100 if (gAlice) {delete gAlice; gAlice = 0;}
101 gAlice = (AliRun*)file->Get("gAlice");
103 cerr << "AliRun object not found on file"<< endl;