1 TFile* AccessFile(TString inFile="galice.root", TString acctype="R");
2 void writeAR(TFile * fin, TFile *fou);
3 void AliITSSD2D(TString inFile, TString outFile);
5 void AliITSSDigits2DigitsDubna(TString inFile= "galiceS.root",
6 TString outFile = "galiceD.root"){
7 // This macro takes SDigits and produces Digits. No merging is done
8 // and only one galice.root file is used.
9 // Dynamically link some shared libs
16 cout << "Creating digits from summable digits for the ITS..." << endl;
17 AliITSSD2D(inFile,outFile);
21 //______________________________________________________________________
22 void AliITSSD2D(TString inFile, TString outFile){
23 AliRunDigitizer * manager = new AliRunDigitizer(1,1);
25 sprintf(ftmp,"%s",inFile.Data());
26 TFile *file0 = AccessFile(ftmp);
27 AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS");
29 cerr<<"AliITSHits2DigitsDefault.C : AliITS object not found on file"
33 if(!(ITS->GetITSgeom())){
34 cerr << " AliITSgeom not found. Can't digitize with out it." << endl;
38 // For old files, must change SPD noise.
39 AliITSresponseSPDdubna *resp0 = new AliITSresponseSPDdubna();
40 if(ITS->DetType(0)->GetResponseModel() !=0){
41 delete ((AliITSresponse*)ITS->DetType(0)->GetResponseModel());
42 ITS->DetType(0)->ResponseModel(0);
44 ITS->DetType(0)->ResponseModel(resp0);
45 AliITSsegmentationSPD *seg0 = (AliITSsegmentationSPD*)ITS->DetType(0)->
46 GetSegmentationModel();
47 AliITSsimulationSPDdubna *sim0 = new AliITSsimulationSPDdubna(seg0,resp0);
48 if(ITS->DetType(0)->GetSimulationModel() !=0){
49 delete ((AliITSsimulation*)ITS->DetType(0)->GetSimulationModel());
50 ITS->DetType(0)->SimulationModel(0);
52 ITS->DetType(0)->SimulationModel(sim0);
53 manager->SetInputStream(0,ftmp);
54 if(outFile != "")manager->SetOutputFile(outFile);
55 AliITSDigitizer *dITS = new AliITSDigitizer(manager);
57 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(inFile);
60 file2 = new TFile(outFile,"UPDATE");
62 } // end if outFile!=""
72 //______________________________________________________________________
73 TFile * AccessFile(TString FileName, TString acctype){
75 // Function used to open the input file and fetch the AliRun object
78 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(FileName);
79 if (file) {file->Close(); delete file; file = 0;}
80 if(acctype.Contains("U")){
81 file = new TFile(FileName,"update");
83 if(acctype.Contains("N") && !file){
84 file = new TFile(FileName,"recreate");
86 if(!file) file = new TFile(FileName); // default readonly
87 if (!file->IsOpen()) {
88 cerr<<"Can't open "<<FileName<<" !" << endl;
92 // Get AliRun object from file or return if not on file
93 if (gAlice) {delete gAlice; gAlice = 0;}
94 gAlice = (AliRun*)file->Get("gAlice");
96 cerr << "AliRun object not found on file"<< endl;
101 //______________________________________________________________________
102 void writeAR(TFile * fin, TFile *fou) {
103 TDirectory *current = gDirectory;
106 AliHeader *alhe = new AliHeader();
107 Te = (TTree*)fin->Get("TE");
108 Te->SetBranchAddress("Header",&alhe);
109 Te->SetBranchStatus("*",1);
111 TeNew = Te->CloneTree();
112 TeNew->Write(0,TObject::kOverwrite);
113 gAlice->Write(0,TObject::kOverwrite);
116 cout<<"AliRun object written to file\n";