1 #if !defined(__CINT__) || defined(__MAKECINT__)
6 #include "AliRawReader.h"
7 #include "AliRawReaderDate.h"
8 #include "AliRawReaderRoot.h"
10 #include "AliRunLoader.h"
11 #include "AliITSInitGeometry.h"
12 #include "AliITSgeom.h"
13 #include "AliITSLoader.h"
14 #include "AliCDBManager.h"
15 #include "AliITSDetTypeRec.h"
16 #include "AliGeomManager.h"
23 /***************************************************************
24 * This macro performs the ITS local reconstruction *
25 * It is intended for special purposes and tests. *
26 * The reccomended way to reconstruct ITs is via the *
27 * class STEER/AliReconstruction *
28 * Present version: M.Masera - Previous version: J. Belikov *
29 ***************************************************************/
31 void Reconstruct(AliRunLoader* runLoader,Option_t *opt);
32 void Reconstruct(AliRunLoader* runLoader, AliRawReader *rawreader,Option_t *opt);
34 Int_t AliITSFindClustersV2(char *inputRawData = NULL,TString filename="galice.root",Option_t *opt="All"){
35 // if kine tree is available MC labels are used for rec points
36 // set opt equal to "SPD" or to "SDD" or to "SSD" do build
37 // rec points for individual subdetectors
39 delete gAlice->GetRunLoader();
45 AliGeomManager::LoadGeometry("geometry.root");
47 //Get Run loader and ITS loader - set geometry
48 AliRunLoader* rl = AliRunLoader::Open(filename.Data());
50 AliITSInitGeometry initgeom;
51 AliITSgeom *geom = initgeom.CreateAliITSgeom();
52 printf("Geometry name: %s \n",(initgeom.GetGeometryName()).Data());
53 AliITSLoader* loader = static_cast<AliITSLoader*>(rl->GetLoader("ITSLoader"));
55 Error("Init", "ITS loader not found");
58 loader->SetITSgeom(geom);
61 AliCDBManager* man = AliCDBManager::Instance();
62 if (!man->IsDefaultStorageSet()) {
63 printf("Setting a local default storage and run number 0\n");
64 man->SetDefaultStorage("local://$ALICE_ROOT");
68 printf("Using deafult storage \n");
71 AliRawReader *rawreader = NULL;
72 TString fileRaw(inputRawData);
73 if(!fileRaw.IsNull()){
74 if (fileRaw.EndsWith(".root")) {
75 cout<<"Raw data format - ROOT file \n";
76 rawreader = new AliRawReaderRoot(fileRaw); // root format
79 cout<<"Raw data format - DATE file \n";
80 rawreader = new AliRawReaderDate(fileRaw); // DATE format
81 rawreader->SelectEvents(7);
83 // if (!fEquipIdMap.IsNull() && fRawReader)fRawReader->LoadEquipmentIdsMap(fEquipIdMap);
84 Reconstruct(rl,rawreader,opt);
87 cout<< "Starting from DIGITS \n";
94 //________________________________________________________________________
95 void Reconstruct(AliRunLoader* runLoader,Option_t *opt){
96 // reconstruct clusters starting from DIGITS
97 // MC truth if available is used to label clusters according to the particles
100 AliITSLoader* loader =
101 static_cast<AliITSLoader*>(runLoader->GetLoader("ITSLoader"));
103 Error("Reconstruct", "ITS loader not found");
106 AliITSDetTypeRec* rec = new AliITSDetTypeRec();
107 rec->SetITSgeom(loader->GetITSgeom());
110 runLoader->LoadKinematics();
111 TTree *trK=(TTree*)runLoader->TreeK();
113 cout<<"kine tree found - MC labels will be used in RP \n";
114 if(runLoader->LoadgAlice())gAlice = runLoader->GetAliRun();
117 cout<<"kine tree not found - MC labels will not b used\n";
120 Int_t nEvents = runLoader->GetNumberOfEvents();
121 // loop on the events
123 for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
124 runLoader->GetEvent(iEvent);
125 cout<<">>>>>>> Processing event number "<<iEvent+1<<endl;
126 loader->LoadRecPoints("update");
127 loader->CleanRecPoints();
128 loader->MakeRecPointsContainer();
129 loader->LoadDigits("read");
130 TTree *tR = loader->TreeR();
131 TTree *tD = loader->TreeD();
133 cout<<"Tree R pointer not found - Abort \n";
136 rec->SetTreeAddressD(tD);
137 rec->MakeBranch(tR,"R");
138 rec->SetTreeAddressR(tR);
139 rec->DigitsToRecPoints(tD,tR,0,opt,kTRUE);
140 loader->WriteRecPoints("OVERWRITE");
141 loader->UnloadRecPoints();
142 loader->UnloadDigits();
143 runLoader->UnloadKinematics();
148 void Reconstruct(AliRunLoader* runLoader, AliRawReader *rawreader,Option_t *opt){
149 // reconstruct clusters starting from raw data (root or DATE format)
150 // MC truth if available is used to label clusters according to the particles
153 AliITSLoader* loader = static_cast<AliITSLoader*>(runLoader->GetLoader("ITSLoader"));
155 Error("Reconstruct", "ITS loader not found");
158 AliITSDetTypeRec* rec = new AliITSDetTypeRec();
159 rec->SetITSgeom(loader->GetITSgeom());
161 // direct clusterfinding starting from raw data is implemented only
162 // in AliITSClusterFinderV2
163 rec->SetDefaultClusterFindersV2(kTRUE);
165 runLoader->LoadKinematics();
166 TTree *trK=(TTree*)runLoader->TreeK();
168 cout<<"kine tree found - MC labels will be used in RP \n";
169 if(runLoader->LoadgAlice())gAlice = runLoader->GetAliRun();
171 Int_t nEvents = runLoader->GetNumberOfEvents();
172 rawreader->RewindEvents();
173 for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
174 rawreader->NextEvent();
175 runLoader->GetEvent(iEvent);
176 cout<<">>>>>>> Processing event number: "<<iEvent<<endl;
177 loader->LoadRecPoints("update");
178 loader->CleanRecPoints();
179 loader->MakeRecPointsContainer();
180 TTree *tR = loader->TreeR();
182 cout<<"Tree R pointer not found - Abort \n";
185 rec->DigitsToRecPoints(rawreader,tR,opt);
186 rec->ResetRecPoints();
187 rec->ResetClusters();
188 loader->WriteRecPoints("OVERWRITE");
189 loader->UnloadRecPoints();
190 loader->UnloadDigits();
191 runLoader->UnloadKinematics();