1 #if !defined(__CINT__) || defined(__MAKECINT__)
5 #include "STEER/AliRun.h"
6 #include "STEER/AliRunDigitizer.h"
7 #include "ITS/AliITSDigitizer.h"
8 #include "ITS/AliITS.h"
9 #include "ITS/AliITSDetType.h"
10 #include "ITS/AliITSresponseSDD.h"
11 #include "TStopwatch.h"
17 //______________________________________________________________________
19 // Checks gAlice to see that ITS and the ITS geometry are properly
20 // defined. If not return kFALSE and deletes gAlice and set it to zero.
25 // gAlice defined check to see if ITS is properly defined.
26 AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS");
27 if(!ITS){ // ITS not defined, delete and reload gAlice
33 if(!(ITS->GetITSgeom())){
37 } // end if !(ITS->GetITSgeom())
38 // ITS and ITS geometry properly defined defined.
41 //______________________________________________________________________
42 TFile * AccessFile(TString FileName, TString acctype){
43 // Function used to open the input file and fetch the AliRun object
46 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(FileName);
52 if(acctype.Contains("U")){
53 file = new TFile(FileName,"UPDATE");
54 } // end if open for update
55 if(acctype.Contains("N") && !file){
56 file = new TFile(FileName,"RECREATE");
57 } // end if open a new file
58 if(!file) file = new TFile(FileName,"READ"); // default readonly
59 if (!file->IsOpen()) {
60 cerr << "Can't open " << FileName << " !" << endl;
62 } // end if error opeing file
64 // Get AliRun object from file or return if not on file
65 if (gAlice) {delete gAlice; gAlice = 0;}
66 gAlice = (AliRun*)file->Get("gAlice");
68 cerr << "AliRun object not found on file "<< FileName << "!" << endl;
69 file->Close(); // close file and return error.
74 //______________________________________________________________________
75 void writeAR(TFile * fin, TFile *fou) {
76 TDirectory *current = gDirectory;
78 gAlice->TreeE()->SetBranchStatus("*",1);
79 gAlice->TreeE()->Write(0,TObject::kOverwrite);
80 gAlice->Write(0,TObject::kOverwrite);
83 cout << "AliRun object from file "<<fin->GetName()
84 << " written to file " << fou->GetName() <<"." << endl;
87 //______________________________________________________________________
88 Int_t ChangeITSDefaults(TFile *hitfile,AliITS *ITS,TString opt){
90 TDatime *ct0 = new TDatime(2002,04,26,00,00,00);
92 if(hitfile) ct = hitfile->GetCreationDate();
94 if(ct0->GetDate()>ct.GetDate()){
95 // For old files, must change SDD noise.
96 AliITSresponseSDD *resp1 = (AliITSresponseSDD*)ITS->DetType(1)->
98 resp1 = new AliITSresponseSDD();
99 ITS->SetResponseModel(1,resp1);
100 cout << "Changed response class for SDD:" << endl;
104 if(opt.Contains("Dubna")){
105 AliITSresponseSPDdubna *resp0 = new AliITSresponseSPDdubna();
106 if(ITS->DetType(0)->GetResponseModel() !=0){
107 delete ((AliITSresponse*)ITS->DetType(0)->GetResponseModel());
108 ITS->DetType(0)->ResponseModel(0);
110 ITS->DetType(0)->ResponseModel(resp0);
111 AliITSsegmentationSPD *seg0 = (AliITSsegmentationSPD*)ITS->
112 DetType(0)->GetSegmentationModel();
113 AliITSsimulationSPDdubna *sim0 = new AliITSsimulationSPDdubna(seg0,
115 if(ITS->DetType(0)->GetSimulationModel() !=0){
116 delete ((AliITSsimulation*)ITS->DetType(0)->GetSimulationModel());
117 ITS->DetType(0)->SimulationModel(0);
119 ITS->DetType(0)->SimulationModel(sim0);