2 // Macro to convert ITS local-coordinate points
6 Int_t AliITSL2GConvertPointsV2
7 (const char* in_name = "ITS.RecPoints.root",
8 const char* out_name = "ITS.Neural.PointsV2.root", Int_t nev = 0)
13 TFile *in = new TFile(in_name);
14 TFile *out = new TFile(out_name, "recreate");
18 delete AliRunLoader::Instance();
22 AliRunLoader* rl = AliRunLoader::Open("galice.root");
24 cerr << "AliITSL2GConvertPoints.C : Can not open session." << endl;
27 Int_t retval = rl->LoadgAlice();
29 cerr << "AliITSL2GConvertPoints.C : LoadgAlice returned error" << endl;
32 gAlice=rl->GetAliRun();
33 AliITSLoader* gime = (AliITSLoader*)rl->GetLoader("ITSLoader");
35 cerr << "AliITSL2GConvertPoints.C : can not get ITS loader" << endl;
38 AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS");
40 cerr << "AliITSL2GConvertPoints.C : AliITS object not found on file" << endl;
43 AliITSgeom *geom = (AliITSgeom*)ITS->GetITSgeom();
45 cerr << "AliITSL2GConvertPoints.C : AliITSgeom not found." << endl;
48 gime->LoadRecPoints("read");
50 TTree *TR = gime->TreeR();
52 cerr << "AliITSL2GConvertPoints.C : Can't get the clusters tree." << endl;
58 TTree *TR = (TTree*)in->Get(Form("Event%d/TreeR", nev));
59 nModules = (Int_t)TR->GetEntries();
61 cout << "Empty TreeR!!!" << endl;
67 // Converts and stores the ITS points into global coordinate format
69 AliITSRecPoint *local = 0;
70 AliITSNeuralPoint *global = 0;
71 TTree *TP = new TTree("TreeP", "Event points in global coords");
72 TP->Branch("pos", &pos, "pos/I");
73 TP->Branch("Points", "AliITSNeuralPoint", &global);
75 TObjArray *localArray = 0;
76 TR->SetBranchAddress("Clusters", &localArray);
77 Int_t module, layer, i, j, count, index;
78 Double_t locPos[3], globPos[3], locErr[3][3], globErr[3][3];
80 cout << geom->GetModuleIndex(1,1,1) << endl;
81 cout << geom->GetModuleIndex(2,1,1) << endl;
82 cout << geom->GetModuleIndex(3,1,1) << endl;
83 cout << geom->GetModuleIndex(4,1,1) << endl;
84 cout << geom->GetModuleIndex(5,1,1) << endl;
85 cout << geom->GetModuleIndex(6,1,1) << endl;
87 for(module = 0; module < nModules; module++) {
89 count = (Int_t)localArray->GetEntriesFast();
90 for (index = 0; index < count; index++) {
91 local = (AliITSRecPoint*)localArray->At(index);
92 cout << module << " - " << local->GetDetectorIndex() << endl;
93 global = new AliITSNeuralPoint(local, geom, module, index);
95 global->ConfMap(0.0, 0.0);
103 cout << TP->GetEntries() << " points collected" << endl;
106 out->mkdir(Form("Event%d", nev));
107 out->cd(Form("Event%d", nev));
108 TP->Write(Form("TreeP", nev));