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 AliRunLoader::Instance();
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/OCDB");
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
82 // if (!fEquipIdMap.IsNull() && fRawReader)fRawReader->LoadEquipmentIdsMap(fEquipIdMap);
83 Reconstruct(rl,rawreader,opt);
86 cout<< "Starting from DIGITS \n";
93 //________________________________________________________________________
94 void Reconstruct(AliRunLoader* runLoader,Option_t *opt){
95 // reconstruct clusters starting from DIGITS
96 // MC truth if available is used to label clusters according to the particles
99 AliITSLoader* loader =
100 static_cast<AliITSLoader*>(runLoader->GetLoader("ITSLoader"));
102 Error("Reconstruct", "ITS loader not found");
105 AliITSDetTypeRec* rec = new AliITSDetTypeRec();
106 rec->SetITSgeom(loader->GetITSgeom());
109 runLoader->LoadKinematics();
110 TTree *trK=(TTree*)runLoader->TreeK();
112 cout<<"kine tree found - MC labels will be used in RP \n";
113 if(runLoader->LoadgAlice())gAlice = runLoader->GetAliRun();
116 cout<<"kine tree not found - MC labels will not b used\n";
119 Int_t nEvents = runLoader->GetNumberOfEvents();
120 // loop on the events
122 for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
123 runLoader->GetEvent(iEvent);
124 cout<<">>>>>>> Processing event number "<<iEvent+1<<endl;
125 loader->LoadRecPoints("update");
126 loader->CleanRecPoints();
127 loader->MakeRecPointsContainer();
128 loader->LoadDigits("read");
129 TTree *tR = loader->TreeR();
130 TTree *tD = loader->TreeD();
132 cout<<"Tree R pointer not found - Abort \n";
135 rec->SetTreeAddressD(tD);
136 rec->MakeBranch(tR,"R");
137 rec->SetTreeAddressR(tR);
138 rec->DigitsToRecPoints(tD,tR,0,opt,kTRUE);
139 loader->WriteRecPoints("OVERWRITE");
140 loader->UnloadRecPoints();
141 loader->UnloadDigits();
142 runLoader->UnloadKinematics();
147 void Reconstruct(AliRunLoader* runLoader, AliRawReader *rawreader,Option_t *opt){
148 // reconstruct clusters starting from raw data (root or DATE format)
149 // MC truth if available is used to label clusters according to the particles
152 AliITSLoader* loader = static_cast<AliITSLoader*>(runLoader->GetLoader("ITSLoader"));
154 Error("Reconstruct", "ITS loader not found");
157 AliITSDetTypeRec* rec = new AliITSDetTypeRec();
158 rec->SetITSgeom(loader->GetITSgeom());
160 // direct clusterfinding starting from raw data is implemented only
161 // in AliITSClusterFinderV2
162 rec->SetDefaultClusterFindersV2(kTRUE);
164 runLoader->LoadKinematics();
165 TTree *trK=(TTree*)runLoader->TreeK();
167 cout<<"kine tree found - MC labels will be used in RP \n";
168 if(runLoader->LoadgAlice())gAlice = runLoader->GetAliRun();
170 Int_t nEvents = runLoader->GetNumberOfEvents();
171 rawreader->RewindEvents();
172 for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
173 rawreader->NextEvent();
174 runLoader->GetEvent(iEvent);
175 cout<<">>>>>>> Processing event number: "<<iEvent<<endl;
176 loader->LoadRecPoints("update");
177 loader->CleanRecPoints();
178 loader->MakeRecPointsContainer();
179 TTree *tR = loader->TreeR();
181 cout<<"Tree R pointer not found - Abort \n";
184 rec->DigitsToRecPoints(rawreader,tR,opt);
185 rec->ResetRecPoints();
186 rec->ResetClusters();
187 loader->WriteRecPoints("OVERWRITE");
188 loader->UnloadRecPoints();
189 loader->UnloadDigits();
190 runLoader->UnloadKinematics();