2 // Macro to convert ITS local-coordinate points
6 Int_t AliITSL2GConvertPoints
7 (const char* in_name = "ITS.RecPoints.root",
8 const char* out_name = "ITS.Neural.PointsV1.root", Int_t nev = 0)
13 TFile *in = new TFile(in_name);
14 TFile *out = new TFile(out_name, "recreate");
18 delete gAlice->GetRunLoader();
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;
51 TTree *TR = (TTree*)in->Get(Form("Event%d/TreeR", nev));
53 cout << "TreeR not found" << endl;
56 nModules = (Int_t)TR->GetEntries();
58 cout << "Empty TreeR!!!" << endl;
64 // Converts and stores the ITS points into global coordinate format
66 AliITSRecPoint *local = 0;
67 AliITSNeuralPoint *global = 0;
68 TTree *TP = new TTree("TreeP", "Event points in global coords");
69 TP->Branch("pos", &pos, "pos/I");
70 TP->Branch("Points", "AliITSNeuralPoint", &global);
72 TObjArray *localArray = 0;
73 TR->SetBranchAddress("ITSRecPoints", &localArray);
74 Int_t module, layer, i, j, count, index;
75 Double_t locPos[3], globPos[3], locErr[3][3], globErr[3][3];
77 for(module = 0; module < nModules; module++) {
79 if (module > geom->GetLastSSD()) {
80 cout << "Strange behavior: an entry greater than the last SSD index!" << endl;
83 AliITSgeomMatrix *gm = geom->GetGeomMatrix(module);
84 geom->GetModuleId(module, layer, i, j);
85 count = (Int_t)localArray->GetEntriesFast();
87 if (layer < 0 || layer > 5) {
88 cout << "STRANGE layer value: " << layer << endl;
91 for (index = 0; index < count; index++) {
92 local = (AliITSRecPoint*)localArray->At(index);
93 global = new AliITSNeuralPoint(local, gm);
94 global->SetLayer(layer);
95 global->SetModule(module);
96 global->SetIndex(index);
98 global->ConfMap(0.0, 0.0);
106 cout << TP->GetEntries() << " points collected" << endl;
109 out->mkdir(Form("Event%d", nev));
110 out->cd(Form("Event%d", nev));
111 TP->Write(Form("TreeP", nev));