version 3 and all the old provision for that deleted. New default is version 1
[u/mrichter/AliRoot.git] / ITS / AliITS.cxx
CommitLineData
4c039060 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
88cb7938 16/* $Id$ */
2ab0c725 17
4c039060 18
fe4da5cc 19///////////////////////////////////////////////////////////////////////////////
58005f18 20//
21// An overview of the basic philosophy of the ITS code development
22// and analysis is show in the figure below.
fe4da5cc 23//Begin_Html
24/*
a92b2b7d 25<img src="picts/ITS/ITS_Analysis_schema.gif">
fe4da5cc 26</pre>
27<br clear=left>
28<font size=+2 color=red>
58005f18 29<p>Roberto Barbera is in charge of the ITS Offline code (1999).
fe4da5cc 30<a href="mailto:roberto.barbera@ct.infn.it">Roberto Barbera</a>.
31</font>
32<pre>
33*/
34//End_Html
58005f18 35//
36// AliITS. Inner Traking System base class.
37// This class contains the base procedures for the Inner Tracking System
38//
39//Begin_Html
40/*
a92b2b7d 41<img src="picts/ITS/AliITS_Class_Diagram.gif">
58005f18 42</pre>
43<br clear=left>
44<font size=+2 color=red>
45<p>This show the class diagram of the different elements that are part of
46the AliITS class.
47</font>
48<pre>
49*/
50//End_Html
51//
52// Version: 0
53// Written by Rene Brun, Federico Carminati, and Roberto Barbera
54//
55// Version: 1
56// Modified and documented by Bjorn S. Nilsen
57// July 11 1999
58//
3bd79107 59// Version: 2
60// Modified and documented by A. Bologna
61// October 18 1999
62//
58005f18 63// AliITS is the general base class for the ITS. Also see AliDetector for
64// futher information.
65//
fe4da5cc 66///////////////////////////////////////////////////////////////////////////////
88cb7938 67
4ae5bbc4 68#include <Riostream.h>
143d1056 69#include <stdlib.h>
88cb7938 70
9c74c52b 71#include <TBranch.h>
caf37aec 72#include <TClonesArray.h>
9c74c52b 73#include <TFile.h>
88cb7938 74#include <TMath.h>
75#include <TObjectTable.h>
76#include <TROOT.h>
77#include <TRandom.h>
d5da1ecf 78#include <TString.h>
88cb7938 79#include <TTree.h>
80#include <TVector.h>
81#include <TVirtualMC.h>
3bd79107 82
88cb7938 83#include "AliConfig.h"
828e06c7 84#include "AliHeader.h"
3bd79107 85#include "AliITS.h"
88cb7938 86#include "AliITSClusterFinderSDD.h"
87#include "AliITSClusterFinderSPD.h"
88#include "AliITSClusterFinderSSD.h"
e8189707 89#include "AliITSDetType.h"
88cb7938 90#include "AliITSLoader.h"
41b19549 91#include "AliITSRawClusterSPD.h"
92#include "AliITSRawClusterSDD.h"
93#include "AliITSRawClusterSSD.h"
88cb7938 94#include "AliITSRecPoint.h"
95#include "AliITSdigit.h"
96#include "AliITSgeom.h"
97#include "AliITShit.h"
98#include "AliITSmodule.h"
99#include "AliITSpList.h"
3bd79107 100#include "AliITSresponseSDD.h"
88cb7938 101#include "AliITSresponseSPD.h"
3bd79107 102#include "AliITSresponseSSD.h"
828e06c7 103#include "AliITSsegmentationSDD.h"
88cb7938 104#include "AliITSsegmentationSPD.h"
828e06c7 105#include "AliITSsegmentationSSD.h"
828e06c7 106#include "AliITSsimulationSDD.h"
88cb7938 107#include "AliITSsimulationSPD.h"
828e06c7 108#include "AliITSsimulationSSD.h"
5d12ce38 109#include "AliMC.h"
85a5290f 110#include "AliITSDigitizer.h"
828e06c7 111
3bd79107 112ClassImp(AliITS)
3bd79107 113
2aea926d 114//______________________________________________________________________
115AliITS::AliITS() : AliDetector() {
4a5bebc2 116 // Default initializer for ITS
2aea926d 117 // The default constructor of the AliITS class. In addition to
118 // creating the AliITS class it zeros the variables fIshunt (a member
119 // of AliDetector class), fEuclidOut, and fIdN, and zeros the pointers
120 // fITSpoints, fIdSens, and fIdName. The AliDetector default constructor
121 // is also called.
4a5bebc2 122 // Inputs:
123 // none.
124 // Outputs:
125 // none.
126 // Return:
127 // Blank ITS class.
3bd79107 128
2aea926d 129 fIshunt = 0; // not zeroed in AliDetector.
3bd79107 130
2aea926d 131 // AliITS variables.
132 fEuclidOut = 0;
133 fITSgeom = 0;
134 fITSmodules = 0;
aa044888 135 fOpt = "All";
136// SetDetectors(); // default to fOpt="All". This variable not written out.
cb26748d 137
2aea926d 138 fIdN = 0;
139 fIdName = 0;
140 fIdSens = 0;
3bd79107 141
2aea926d 142 fNDetTypes = kNTYPES;
143 fDetTypes = 0;
3bd79107 144
2aea926d 145 fSDigits = 0;
146 fNSDigits = 0;
58005f18 147
2aea926d 148 fNdtype = 0;
149 fDtype = 0;
3bd79107 150
2aea926d 151 fCtype = 0;
152 fNctype = 0;
58005f18 153
2aea926d 154 fRecPoints = 0;
155 fNRecPoints = 0;
58005f18 156
2aea926d 157 SetMarkerColor(kRed);
fe4da5cc 158}
2aea926d 159//______________________________________________________________________
160AliITS::AliITS(const char *name, const char *title):AliDetector(name,title){
4a5bebc2 161 // The standard Constructor for the ITS class. In addition to
162 // creating the AliITS class, it allocates memory for the TClonesArrays
163 // fHits, fSDigits, fDigits, fITSpoints, and the TObjArray of fCtype
164 // (clusters). It also zeros the variables
2aea926d 165 // fIshunt (a member of AliDetector class), fEuclidOut, and fIdN, and zeros
166 // the pointers fIdSens and fIdName. To help in displaying hits via the
167 // ROOT macro display.C AliITS also sets the marker color to red. The
168 // variables passes with this constructor, const char *name and *title,
169 // are used by the constructor of AliDetector class. See AliDetector
170 // class for a description of these parameters and its constructor
171 // functions.
4a5bebc2 172 // Inputs:
173 // const char *name Detector name. Should always be "ITS"
174 // const char *title Detector title.
175 // Outputs:
176 // none.
177 // Return:
178 // An ITS class.
2aea926d 179
180 fIshunt = 0; // not zeroed in AliDetector
181 fHits = new TClonesArray("AliITShit", 1560);//not done in AliDetector
5d12ce38 182 gAlice->GetMCApp()->AddHitList(fHits); // Not done in AliDetector.
2aea926d 183
184 fEuclidOut = 0;
185 fITSgeom = 0;
186 fITSmodules = 0;
cd77595e 187 SetDetectors(); // default to fOpt="All". This variable not written out.
2aea926d 188
189 fIdN = 0;
190 fIdName = 0;
191 fIdSens = 0;
192
193 fNDetTypes = kNTYPES;
194 fDetTypes = new TObjArray(fNDetTypes);
195
2aea926d 196 fSDigits = new TClonesArray("AliITSpListItem",1000);
197 fNSDigits = 0;
198
199 fNdtype = new Int_t[fNDetTypes];
200 fDtype = new TObjArray(fNDetTypes);
201
202 fCtype = new TObjArray(fNDetTypes);
203 fNctype = new Int_t[fNDetTypes];
2aea926d 204
205 fRecPoints = new TClonesArray("AliITSRecPoint",1000);
206 fNRecPoints = 0;
3bd79107 207
2aea926d 208 Int_t i;
209 for(i=0;i<fNDetTypes;i++) {
88cb7938 210 fDetTypes->AddAt(new AliITSDetType(),i);
211 fNdtype[i] = 0;
212 fNctype[i] = 0;
2aea926d 213 } // end for i
fe4da5cc 214
2aea926d 215 SetMarkerColor(kRed);
88cb7938 216
3bd79107 217}
2aea926d 218//______________________________________________________________________
58005f18 219AliITS::~AliITS(){
4a5bebc2 220 // Default destructor for ITS.
2aea926d 221 // The default destructor of the AliITS class. In addition to deleting
222 // the AliITS class it deletes the memory pointed to by the fHits, fDigits,
4a5bebc2 223 // fSDigits, fCtype, fITSmodules, fITSgeom, fRecPoints, fIdSens, fIdName,
224 // fITSpoints, fDetType and it's contents.
225 // Inputs:
226 // none.
227 // Outputs:
228 // none.
229 // Return:
230 // none.
2aea926d 231
88cb7938 232 if (fHits) {
233 fHits->Delete();
234 delete fHits;
235 fHits=0;
236 }
237 if (fSDigits) {
238 fSDigits->Delete();
239 delete fSDigits;
240 fSDigits=0;
241 }
242 if (fDigits) {
243 fDigits->Delete();
244 delete fDigits;
245 fDigits=0;
246 }
247 if (fRecPoints) {
248 fRecPoints->Delete();
249 delete fRecPoints;
250 fRecPoints=0;
251 }
252 delete[] fIdName; // Array of TStrings
253 delete[] fIdSens;
254 if(fITSmodules) {
255 this->ClearModules();
256 delete fITSmodules;
279a35d7 257 fITSmodules = 0;
88cb7938 258 }// end if fITSmodules!=0
259
260 if(fDtype) {
261 fDtype->Delete();
262 delete fDtype;
263 } // end if fDtype
264 delete [] fNdtype;
265 if (fCtype) {
266 fCtype->Delete();
267 delete fCtype;
268 fCtype = 0;
269 } // end if fCtype
270 delete [] fNctype;
271
272 if (fDetTypes) {
273 fDetTypes->Delete();
274 delete fDetTypes;
275 fDetTypes = 0;
276 } // end if fDetTypes
277
278
279 if (fITSgeom) delete fITSgeom;
3bd79107 280}
2aea926d 281//______________________________________________________________________
ac74f489 282AliITS::AliITS(const AliITS &source) : AliDetector(source){
4a5bebc2 283 // Copy constructor. This is a function which is not allowed to be
284 // done to the ITS. It exits with an error.
285 // Inputs:
286 // AliITS &source An AliITS class.
287 // Outputs:
288 // none.
289 // Return:
290 // none.
3bd79107 291
2aea926d 292 if(this==&source) return;
4a5bebc2 293 Error("Copy constructor",
88cb7938 294 "You are not allowed to make a copy of the AliITS");
2aea926d 295 exit(1);
3bd79107 296}
2aea926d 297//______________________________________________________________________
298AliITS& AliITS::operator=(AliITS &source){
4a5bebc2 299 // Assignment operator. This is a function which is not allowed to be
300 // done to the ITS. It exits with an error.
301 // Inputs:
302 // AliITS &source An AliITS class.
303 // Outputs:
304 // none.
305 // Return:
306 // none.
3bd79107 307
2aea926d 308 if(this==&source) return *this;
4a5bebc2 309 Error("operator=","You are not allowed to make a copy of the AliITS");
2aea926d 310 exit(1);
311 return *this; //fake return
3bd79107 312}
2aea926d 313//______________________________________________________________________
93f82b23 314Int_t AliITS::DistancetoPrimitive(Int_t,Int_t) const{
2aea926d 315 // Distance from mouse to ITS on the screen. Dummy routine
316 // A dummy routine used by the ROOT macro display.C to allow for the
317 // use of the mouse (pointing device) in the macro. In general this should
318 // never be called. If it is it returns the number 9999 for any value of
319 // x and y.
4a5bebc2 320 // Inputs:
321 // Int_t Dummy screen coordinate.
322 // Int_t Dummy screen coordinate.
323 // Outputs:
324 // none.
325 // Return:
326 // Int_t Dummy = 9999 distance to ITS.
3bd79107 327
2aea926d 328 return 9999;
3bd79107 329}
2aea926d 330//______________________________________________________________________
331void AliITS::Init(){
4a5bebc2 332 // Initializer ITS after it has been built
2aea926d 333 // This routine initializes the AliITS class. It is intended to be
334 // called from the Init function in AliITSv?. Besides displaying a banner
335 // indicating that it has been called it initializes the array fIdSens
336 // and sets the default segmentation, response, digit and raw cluster
337 // classes therefore it should be called after a call to CreateGeometry.
4a5bebc2 338 // Inputs:
339 // none.
340 // Outputs:
341 // none.
342 // Return:
343 // none.
3bd79107 344 Int_t i;
3bd79107 345
2aea926d 346 SetDefaults();
347 // Array of TStrings
348 for(i=0;i<fIdN;i++) fIdSens[i] = gMC->VolId(fIdName[i]);
3bd79107 349}
2aea926d 350//______________________________________________________________________
351void AliITS::SetDefaults(){
4a5bebc2 352 // sets the default segmentation, response, digit and raw cluster classes.
353 // Inputs:
354 // none.
355 // Outputs:
356 // none.
357 // Return:
358 // none.
2aea926d 359
360 if(fDebug) printf("%s: SetDefaults\n",ClassName());
361
362 AliITSDetType *iDetType;
363
364 //SPD
365 iDetType=DetType(0);
366 if (!iDetType->GetSegmentationModel()) {
88cb7938 367 AliITSsegmentationSPD *seg0=new AliITSsegmentationSPD(fITSgeom);
368 SetSegmentationModel(0,seg0);
2aea926d 369 } // end if
370 if (!iDetType->GetResponseModel()) {
88cb7938 371 SetResponseModel(0,new AliITSresponseSPD());
2aea926d 372 } // end if
373 // set digit and raw cluster classes to be used
374
375 const char *kData0=(iDetType->GetResponseModel())->DataType();
376 if (strstr(kData0,"real")) {
88cb7938 377 iDetType->ClassNames("AliITSdigit","AliITSRawClusterSPD");
2aea926d 378 } else iDetType->ClassNames("AliITSdigitSPD","AliITSRawClusterSPD");
379
380 // SDD
381 iDetType=DetType(1);
382 if (!iDetType->GetResponseModel()) {
88cb7938 383 SetResponseModel(1,new AliITSresponseSDD("simulated"));
2aea926d 384 } // end if
385 AliITSresponse *resp1=iDetType->GetResponseModel();
386 if (!iDetType->GetSegmentationModel()) {
88cb7938 387 AliITSsegmentationSDD *seg1=new AliITSsegmentationSDD(fITSgeom,resp1);
388 SetSegmentationModel(1,seg1);
2aea926d 389 } // end if
390 const char *kData1=(iDetType->GetResponseModel())->DataType();
391 const char *kopt=iDetType->GetResponseModel()->ZeroSuppOption();
4a5bebc2 392 if((!strstr(kopt,"2D"))&&(!strstr(kopt,"1D")) || strstr(kData1,"real") ){
88cb7938 393 iDetType->ClassNames("AliITSdigit","AliITSRawClusterSDD");
2aea926d 394 } else iDetType->ClassNames("AliITSdigitSDD","AliITSRawClusterSDD");
395
396 // SSD
397 iDetType=DetType(2);
398 if (!iDetType->GetSegmentationModel()) {
88cb7938 399 AliITSsegmentationSSD *seg2=new AliITSsegmentationSSD(fITSgeom);
400 SetSegmentationModel(2,seg2);
2aea926d 401 } // end if
402 if (!iDetType->GetResponseModel()) {
88cb7938 403 SetResponseModel(2,new AliITSresponseSSD("simulated"));
2aea926d 404 } // end if
405 const char *kData2=(iDetType->GetResponseModel())->DataType();
406 if (strstr(kData2,"real")) {
88cb7938 407 iDetType->ClassNames("AliITSdigit","AliITSRawClusterSSD");
2aea926d 408 } else iDetType->ClassNames("AliITSdigitSSD","AliITSRawClusterSSD");
409
410 if (kNTYPES>3) {
88cb7938 411 Warning("SetDefaults",
412 "Only the three basic detector types are initialized!");
2aea926d 413 } // end if
3bd79107 414}
2aea926d 415//______________________________________________________________________
416void AliITS::SetDefaultSimulation(){
4a5bebc2 417 // sets the default simulation.
418 // Inputs:
419 // none.
420 // Outputs:
421 // none.
422 // Return:
423 // none.
2aea926d 424
425 AliITSDetType *iDetType;
54b8cf3b 426 AliITSsimulation *sim;
2aea926d 427 iDetType=DetType(0);
54b8cf3b 428 sim = iDetType->GetSimulationModel();
429 if (!sim) {
88cb7938 430 AliITSsegmentation *seg0=
431 (AliITSsegmentation*)iDetType->GetSegmentationModel();
432 AliITSresponse *res0 = (AliITSresponse*)iDetType->GetResponseModel();
433 AliITSsimulationSPD *sim0=new AliITSsimulationSPD(seg0,res0);
434 SetSimulationModel(0,sim0);
54b8cf3b 435 }else{ // simulation exists, make sure it is set up properly.
88cb7938 436 ((AliITSsimulationSPD*)sim)->Init(
437 (AliITSsegmentationSPD*) iDetType->GetSegmentationModel(),
438 (AliITSresponseSPD*) iDetType->GetResponseModel());
439// if(sim->GetResponseModel()==0) sim->SetResponseModel(
440// (AliITSresponse*)iDetType->GetResponseModel());
441// if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel(
442// (AliITSsegmentation*)iDetType->GetSegmentationModel());
2aea926d 443 } // end if
444 iDetType=DetType(1);
54b8cf3b 445 sim = iDetType->GetSimulationModel();
446 if (!sim) {
88cb7938 447 AliITSsegmentation *seg1=
448 (AliITSsegmentation*)iDetType->GetSegmentationModel();
449 AliITSresponse *res1 = (AliITSresponse*)iDetType->GetResponseModel();
450 AliITSsimulationSDD *sim1=new AliITSsimulationSDD(seg1,res1);
451 SetSimulationModel(1,sim1);
54b8cf3b 452 }else{ // simulation exists, make sure it is set up properly.
88cb7938 453 ((AliITSsimulationSDD*)sim)->Init(
454 (AliITSsegmentationSDD*) iDetType->GetSegmentationModel(),
455 (AliITSresponseSDD*) iDetType->GetResponseModel());
456// if(sim->GetResponseModel()==0) sim->SetResponseModel(
457// (AliITSresponse*)iDetType->GetResponseModel());
458// if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel(
459// (AliITSsegmentation*)iDetType->GetSegmentationModel());
2aea926d 460 } //end if
461 iDetType=DetType(2);
54b8cf3b 462 sim = iDetType->GetSimulationModel();
463 if (!sim) {
88cb7938 464 AliITSsegmentation *seg2=
465 (AliITSsegmentation*)iDetType->GetSegmentationModel();
466 AliITSresponse *res2 = (AliITSresponse*)iDetType->GetResponseModel();
467 AliITSsimulationSSD *sim2=new AliITSsimulationSSD(seg2,res2);
468 SetSimulationModel(2,sim2);
54b8cf3b 469 }else{ // simulation exists, make sure it is set up properly.
88cb7938 470 ((AliITSsimulationSSD*)sim)->Init(
471 (AliITSsegmentationSSD*) iDetType->GetSegmentationModel(),
472 (AliITSresponseSSD*) iDetType->GetResponseModel());
473// if(sim->GetResponseModel()==0) sim->SetResponseModel(
474// (AliITSresponse*)iDetType->GetResponseModel());
475// if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel(
476// (AliITSsegmentation*)iDetType->GetSegmentationModel());
2aea926d 477 } // end if
3bd79107 478}
2aea926d 479//______________________________________________________________________
480void AliITS::SetDefaultClusterFinders(){
4a5bebc2 481 // Sets the default cluster finders. Used in finding RecPoints.
482 // Inputs:
483 // none.
484 // Outputs:
485 // none.
486 // Return:
487 // none.
2aea926d 488
489 MakeTreeC();
490 AliITSDetType *iDetType;
491
492 // SPD
493 iDetType=DetType(0);
494 if (!iDetType->GetReconstructionModel()) {
88cb7938 495 AliITSsegmentation *seg0 =
496 (AliITSsegmentation*)iDetType->GetSegmentationModel();
497 TClonesArray *dig0=DigitsAddress(0);
498 TClonesArray *recp0=ClustersAddress(0);
499 AliITSClusterFinderSPD *rec0 = new AliITSClusterFinderSPD(seg0,dig0,
500 recp0);
501 SetReconstructionModel(0,rec0);
2aea926d 502 } // end if
503
504 // SDD
505 iDetType=DetType(1);
506 if (!iDetType->GetReconstructionModel()) {
88cb7938 507 AliITSsegmentation *seg1 =
508 (AliITSsegmentation*)iDetType->GetSegmentationModel();
509 AliITSresponse *res1 = (AliITSresponse*)iDetType->GetResponseModel();
510 TClonesArray *dig1=DigitsAddress(1);
511 TClonesArray *recp1=ClustersAddress(1);
512 AliITSClusterFinderSDD *rec1 =
513 new AliITSClusterFinderSDD(seg1,res1,dig1,recp1);
2aea926d 514 SetReconstructionModel(1,rec1);
515 } // end if
516
517 // SSD
518 iDetType=DetType(2);
519 if (!iDetType->GetReconstructionModel()) {
88cb7938 520 AliITSsegmentation *seg2=
521 (AliITSsegmentation*)iDetType->GetSegmentationModel();
522 TClonesArray *dig2=DigitsAddress(2);
523 AliITSClusterFinderSSD *rec2= new AliITSClusterFinderSSD(seg2,dig2);
524 SetReconstructionModel(2,rec2);
2aea926d 525 } // end if
3bd79107 526}
2aea926d 527//______________________________________________________________________
88cb7938 528void AliITS::MakeBranch(Option_t* option){
2aea926d 529 // Creates Tree branches for the ITS.
4a5bebc2 530 // Inputs:
531 // Option_t *option String of Tree types S,D, and/or R.
532 // const char *file String of the file name where these branches
533 // are to be stored. If blank then these branches
534 // are written to the same tree as the Hits were
535 // read from.
536 // Outputs:
537 // none.
538 // Return:
539 // none.
88cb7938 540 Bool_t cH = (strstr(option,"H")!=0);
ff0e455e 541 Bool_t cS = (strstr(option,"S")!=0);
542 Bool_t cD = (strstr(option,"D")!=0);
543 Bool_t cR = (strstr(option,"R")!=0);
544 Bool_t cRF = (strstr(option,"RF")!=0);
88cb7938 545
ff0e455e 546 if(cRF)cR = kFALSE;
88cb7938 547 if(cH && (fHits == 0x0)) fHits = new TClonesArray("AliITShit", 1560);
548
549 AliDetector::MakeBranch(option);
2aea926d 550
88cb7938 551 if(cS) MakeBranchS(0);
552 if(cD) MakeBranchD(0);
553 if(cR) MakeBranchR(0);
554 if(cRF) MakeBranchRF(0);
fe4da5cc 555}
2aea926d 556//______________________________________________________________________
557void AliITS::SetTreeAddress(){
558 // Set branch address for the Trees.
4a5bebc2 559 // Inputs:
560 // none.
561 // Outputs:
562 // none.
563 // Return:
564 // none.
88cb7938 565 TTree *treeS = fLoader->TreeS();
566 TTree *treeD = fLoader->TreeD();
567 TTree *treeR = fLoader->TreeR();
568 if (fLoader->TreeH() && (fHits == 0x0)) fHits = new TClonesArray("AliITShit", 1560);
569
2aea926d 570 AliDetector::SetTreeAddress();
571
572 SetTreeAddressS(treeS);
573 SetTreeAddressD(treeD);
574 SetTreeAddressR(treeR);
fe4da5cc 575}
2aea926d 576//______________________________________________________________________
577AliITSDetType* AliITS::DetType(Int_t id){
4a5bebc2 578 // Return pointer to id detector type.
579 // Inputs:
580 // Int_t id detector id number.
581 // Outputs:
582 // none.
583 // Return:
584 // returned, a pointer to a AliITSDetType.
fe4da5cc 585
2aea926d 586 return ((AliITSDetType*) fDetTypes->At(id));
3bd79107 587}
2aea926d 588//______________________________________________________________________
589void AliITS::SetResponseModel(Int_t id, AliITSresponse *response){
4a5bebc2 590 // Set the response model for the id detector type.
591 // Inputs:
592 // Int_t id detector id number.
593 // AliITSresponse* a pointer containing an instance of AliITSresponse
594 // to be stored/owned b y AliITSDetType.
595 // Outputs:
596 // none.
597 // Return:
598 // none.
e8189707 599
2aea926d 600 ((AliITSDetType*) fDetTypes->At(id))->ResponseModel(response);
e8189707 601}
2aea926d 602//______________________________________________________________________
603void AliITS::SetSegmentationModel(Int_t id, AliITSsegmentation *seg){
4a5bebc2 604 // Set the segmentation model for the id detector type.
605 // Inputs:
606 // Int_t id detector id number.
607 // AliITSsegmentation* a pointer containing an instance of
608 // AliITSsegmentation to be stored/owned b y
609 // AliITSDetType.
610 // Outputs:
611 // none.
612 // Return:
613 // none.
e8189707 614
2aea926d 615 ((AliITSDetType*) fDetTypes->At(id))->SegmentationModel(seg);
e8189707 616}
2aea926d 617//______________________________________________________________________
618void AliITS::SetSimulationModel(Int_t id, AliITSsimulation *sim){
4a5bebc2 619 // Set the simulation model for the id detector type.
620 // Inputs:
621 // Int_t id detector id number.
622 // AliITSresponse* a pointer containing an instance of AliITSresponse
623 // to be stored/owned b y AliITSDetType.
624 // Outputs:
625 // none.
626 // Return:
627 // none.
3bd79107 628
2aea926d 629 ((AliITSDetType*) fDetTypes->At(id))->SimulationModel(sim);
3bd79107 630
631}
2aea926d 632//______________________________________________________________________
633void AliITS::SetReconstructionModel(Int_t id, AliITSClusterFinder *reconst){
4a5bebc2 634 // Set the cluster finder model for the id detector type.
635 // Inputs:
636 // Int_t id detector id number.
637 // AliITSClusterFinder* a pointer containing an instance of
638 // AliITSClusterFinder to be stored/owned b y
639 // AliITSDetType.
640 // Outputs:
641 // none.
642 // Return:
643 // none.
3bd79107 644
2aea926d 645 ((AliITSDetType*) fDetTypes->At(id))->ReconstructionModel(reconst);
3bd79107 646}
2aea926d 647//______________________________________________________________________
648void AliITS::SetClasses(Int_t id, const char *digit, const char *cluster){
4a5bebc2 649 // Set the digit and cluster classes name to be used for the id detector
650 // type.
651 // Inputs:
652 // Int_t id detector id number.
653 // const char *digit Digit class name for detector id.
654 // const char *cluster Cluster class name for detector id.
655 // Outputs:
656 // none.
657 // Return:
658 // none.
3bd79107 659
2aea926d 660 ((AliITSDetType*) fDetTypes->At(id))->ClassNames(digit,cluster);
3bd79107 661}
2aea926d 662//______________________________________________________________________
663void AliITS::AddHit(Int_t track, Int_t *vol, Float_t *hits){
664 // Add an ITS hit
665 // The function to add information to the AliITShit class. See the
666 // AliITShit class for a full description. This function allocates the
667 // necessary new space for the hit information and passes the variable
668 // track, and the pointers *vol and *hits to the AliITShit constructor
669 // function.
4a5bebc2 670 // Inputs:
671 // Int_t track Track number which produced this hit.
672 // Int_t *vol Array of Integer Hit information. See AliITShit.h
673 // Float_t *hits Array of Floating Hit information. see AliITShit.h
674 // Outputs:
675 // none.
676 // Return:
677 // none.
2aea926d 678
679 TClonesArray &lhits = *fHits;
680 new(lhits[fNhits++]) AliITShit(fIshunt,track,vol,hits);
3bd79107 681}
2aea926d 682//______________________________________________________________________
3bd79107 683void AliITS::InitModules(Int_t size,Int_t &nmodules){
4a5bebc2 684 // Initialize the modules array.
685 // Inputs:
686 // Int_t size Size of array of the number of modules to be
687 // created. If size <=0 then the number of modules
688 // is gotten from AliITSgeom class kept in fITSgeom.
689 // Outputs:
690 // Int_t &nmodules The number of modules existing.
691 // Return:
692 // none.
3bd79107 693
2aea926d 694 if(fITSmodules){
88cb7938 695 fITSmodules->Delete();
696 delete fITSmodules;
2aea926d 697 } // end fir fITSmoudles
e8189707 698
3bd79107 699 Int_t nl,indexMAX,index;
3bd79107 700
701 if(size<=0){ // default to using data stored in AliITSgeom
88cb7938 702 if(fITSgeom==0) {
703 Error("InitModules","fITSgeom not defined");
704 return;
705 } // end if fITSgeom==0
706 nl = fITSgeom->GetNlayers();
707 indexMAX = fITSgeom->GetModuleIndex(nl,fITSgeom->GetNladders(nl),
708 fITSgeom->GetNdetectors(nl))+1;
709 nmodules = indexMAX;
710 fITSmodules = new TObjArray(indexMAX);
711 for(index=0;index<indexMAX;index++){
712 fITSmodules->AddAt( new AliITSmodule(index),index);
713 } // end for index
3bd79107 714 }else{
88cb7938 715 fITSmodules = new TObjArray(size);
716 for(index=0;index<size;index++) {
717 fITSmodules->AddAt( new AliITSmodule(index),index);
718 } // end for index
9c74c52b 719
3bd79107 720 nmodules = size;
721 } // end i size<=0
722}
2aea926d 723//______________________________________________________________________
724void AliITS::FillModules(Int_t evnt,Int_t bgrev,Int_t nmodules,
88cb7938 725 Option_t *option,Text_t *filename){
2aea926d 726 // fill the modules with the sorted by module hits; add hits from
4a5bebc2 727 // background if option=Add.
728 // Inputs:
729 // Int_t evnt Event to be processed.
730 // Int_t bgrev Background Hit tree number.
731 // Int_t nmodules Not used.
732 // Option_t *option String indicating if merging hits or not. To
733 // merge hits set equal to "Add". Otherwise no
734 // background hits are considered.
735 // Test_t *filename File name containing the background hits..
736 // Outputs:
737 // none.
738 // Return:
739 // none.
3bd79107 740 static TTree *trH1; //Tree with background hits
3bd79107 741 static Bool_t first=kTRUE;
742 static TFile *file;
5cf7bbad 743 const char *addBgr = strstr(option,"Add");
3bd79107 744
ac74f489 745 evnt = nmodules; // Dummy use of variables to remove warnings
e8189707 746 if (addBgr ) {
88cb7938 747 if(first) {
748 file=new TFile(filename);
749 } // end if first
750 first=kFALSE;
751 file->cd();
752 file->ls();
753 // Get Hits Tree header from file
754 if(trH1) delete trH1;
755 trH1=0;
756
757 char treeName[20];
758 sprintf(treeName,"TreeH%d",bgrev);
759 trH1 = (TTree*)gDirectory->Get(treeName);
760 if (!trH1) {
761 Error("FillModules","cannot find Hits Tree for event:%d",bgrev);
762 } // end if !trH1
763 // Set branch addresses
2aea926d 764 } // end if addBgr
3bd79107 765
88cb7938 766 FillModules(fLoader->TreeH(),0); // fill from this file's tree.
3bd79107 767
e8189707 768 if (addBgr ) {
88cb7938 769 FillModules(trH1,10000000); // Default mask 10M.
770 TTree *fAli=fLoader->GetRunLoader()->TreeK();
771 TFile *fileAli=0;
772 if (fAli) fileAli =fAli->GetCurrentFile();
773 fileAli->cd();
3bd79107 774 } // end if add
3bd79107 775}
2aea926d 776//______________________________________________________________________
b4012daf 777void AliITS::FillModules(TTree *treeH, Int_t mask) {
778 // fill the modules with the sorted by module hits;
779 // can be called many times to do a merging
780 // Inputs:
781 // TTree *treeH The tree containing the hits to be copied into
782 // the modules.
783 // Int_t mask The track number mask to indecate which file
784 // this hits came from.
785 // Outputs:
786 // none.
787 // Return:
788 // none.
789
88cb7938 790 if (treeH == 0x0)
791 {
792 Error("FillModules","Tree is NULL");
793 }
b4012daf 794 Int_t lay,lad,det,index;
795 AliITShit *itsHit=0;
796 AliITSmodule *mod=0;
797 char branchname[20];
798 sprintf(branchname,"%s",GetName());
799 TBranch *branch = treeH->GetBranch(branchname);
800 if (!branch) {
88cb7938 801 Error("FillModules","%s branch in TreeH not found",branchname);
802 return;
b4012daf 803 } // end if !branch
804 branch->SetAddress(&fHits);
805 Int_t nTracks =(Int_t) treeH->GetEntries();
806 Int_t iPrimTrack,h;
807 for(iPrimTrack=0; iPrimTrack<nTracks; iPrimTrack++){
88cb7938 808 ResetHits();
809 Int_t nBytes = treeH->GetEvent(iPrimTrack);
810 if (nBytes <= 0) continue;
811 Int_t nHits = fHits->GetEntriesFast();
812 for(h=0; h<nHits; h++){
813 itsHit = (AliITShit *)fHits->UncheckedAt(h);
814 itsHit->GetDetectorID(lay,lad,det);
815 if (fITSgeom) {
816 index = fITSgeom->GetModuleIndex(lay,lad,det);
817 } else {
818 index=det-1; // This should not be used.
819 } // end if [You must have fITSgeom for this to work!]
820 mod = GetModule(index);
821 itsHit->SetTrack(itsHit->GetTrack()+mask); // Set track mask.
822 mod->AddHit(itsHit,iPrimTrack,h);
823 } // end loop over hits
b4012daf 824 } // end loop over tracks
825}
826//______________________________________________________________________
2aea926d 827void AliITS::ClearModules(){
4a5bebc2 828 // Clear the modules TObjArray.
829 // Inputs:
830 // none.
831 // Outputs:
832 // none.
3bd79107 833
2aea926d 834 if(fITSmodules) fITSmodules->Delete();
835}
836//______________________________________________________________________
4a5bebc2 837void AliITS::MakeBranchS(const char *fl){
838 // Creates Tree Branch for the ITS summable digits.
839 // Inputs:
840 // cont char *fl File name where SDigits branch is to be written
841 // to. If blank it write the SDigits to the same
842 // file in which the Hits were found.
843 // Outputs:
844 // none.
845 // Return:
846 // none.
2aea926d 847 Int_t buffersize = 4000;
848 char branchname[30];
2ab0c725 849
2aea926d 850 // only one branch for SDigits.
851 sprintf(branchname,"%s",GetName());
88cb7938 852
853
7941072e 854 if(fLoader->TreeS()){
88cb7938 855 if (fSDigits == 0x0) fSDigits = new TClonesArray("AliITSpListItem",1000);
856 MakeBranchInTree(fLoader->TreeS(),branchname,&fSDigits,buffersize,fl);
2aea926d 857 } // end if
858}
859//______________________________________________________________________
860void AliITS::SetTreeAddressS(TTree *treeS){
861 // Set branch address for the ITS summable digits Trees.
4a5bebc2 862 // Inputs:
863 // TTree *treeS Tree containing the SDigits.
864 // Outputs:
865 // none.
866 // Return:
867 // none.
2aea926d 868 char branchname[30];
828e06c7 869
2aea926d 870 if(!treeS) return;
88cb7938 871 if (fSDigits == 0x0) fSDigits = new TClonesArray("AliITSpListItem",1000);
2aea926d 872 TBranch *branch;
873 sprintf(branchname,"%s",GetName());
874 branch = treeS->GetBranch(branchname);
875 if (branch) branch->SetAddress(&fSDigits);
876}
877//______________________________________________________________________
9ad8b5dd 878void AliITS::MakeBranchInTreeD(TTree *treeD,const char *file){
2aea926d 879 // Creates Tree branches for the ITS.
4a5bebc2 880 // Inputs:
e0fc0305 881 // TTree *treeD Pointer to the Digits Tree.
4a5bebc2 882 // cont char *file File name where Digits branch is to be written
883 // to. If blank it write the SDigits to the same
884 // file in which the Hits were found.
885 // Outputs:
886 // none.
887 // Return:
888 // none.
2aea926d 889 Int_t buffersize = 4000;
890 char branchname[30];
2ab0c725 891
2aea926d 892 sprintf(branchname,"%s",GetName());
893 // one branch for digits per type of detector
894 const char *det[3] = {"SPD","SDD","SSD"};
895 char digclass[40];
896 char clclass[40];
897 Int_t i;
898 for (i=0; i<kNTYPES ;i++) {
88cb7938 899 DetType(i)->GetClassNames(digclass,clclass);
900 // digits
901 if (fDtype == 0x0) fDtype = new TObjArray(fNDetTypes);
902 if(!(fDtype->At(i))) fDtype->AddAt(new TClonesArray(digclass,1000),i);
903 else ResetDigits(i);
2aea926d 904 } // end for i
905 for (i=0; i<kNTYPES ;i++) {
88cb7938 906 if (kNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]);
907 else sprintf(branchname,"%sDigits%d",GetName(),i+1);
908 if (fDtype && treeD) {
909 MakeBranchInTree(treeD, branchname, &((*fDtype)[i]),buffersize,file);
910 } // end if
2aea926d 911 } // end for i
2ab0c725 912}
2aea926d 913//______________________________________________________________________
914void AliITS::SetTreeAddressD(TTree *treeD){
915 // Set branch address for the Trees.
4a5bebc2 916 // Inputs:
917 // TTree *treeD Tree containing the Digits.
918 // Outputs:
919 // none.
920 // Return:
921 // none.
2aea926d 922 char branchname[30];
923 const char *det[3] = {"SPD","SDD","SSD"};
924 TBranch *branch;
925 char digclass[40];
926 char clclass[40];
927 Int_t i;
2ab0c725 928
2aea926d 929 if(!treeD) return;
930 for (i=0; i<kNTYPES; i++) {
88cb7938 931 DetType(i)->GetClassNames(digclass,clclass);
932 // digits
933 if (fDtype == 0x0) fDtype = new TObjArray(fNDetTypes);
934 if(!(fDtype->At(i))) fDtype->AddAt(new TClonesArray(digclass,1000),i);
935 else ResetDigits(i);
936 if (kNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]);
937 else sprintf(branchname,"%sDigits%d",GetName(),i+1);
938 if (fDtype) {
939 branch = treeD->GetBranch(branchname);
940 if (branch) branch->SetAddress(&((*fDtype)[i]));
941 } // end if fDtype
2aea926d 942 } // end for i
943}
944//______________________________________________________________________
945void AliITS::Hits2SDigits(){
946 // Standard Hits to summable Digits function.
4a5bebc2 947 // Inputs:
948 // none.
949 // Outputs:
950 // none.
2aea926d 951
e0fc0305 952// return; // Using Hits in place of the larger sDigits.
85a5290f 953 fLoader->LoadHits("read");
954 fLoader->LoadSDigits("recreate");
88cb7938 955 AliRunLoader* rl = fLoader->GetRunLoader();
85a5290f 956
957 for (Int_t iEvent = 0; iEvent < rl->GetNumberOfEvents(); iEvent++) {
2aea926d 958 // Do the Hits to Digits operation. Use Standard input values.
959 // Event number from file, no background hit merging , use size from
960 // AliITSgeom class, option="All", input from this file only.
85a5290f 961 rl->GetEvent(iEvent);
962 if (!fLoader->TreeS()) fLoader->MakeTree("S");
963 MakeBranch("S");
964 SetTreeAddress();
965 HitsToSDigits(iEvent,0,-1," ",fOpt," ");
966 }
88cb7938 967
85a5290f 968 fLoader->UnloadHits();
969 fLoader->UnloadSDigits();
2aea926d 970}
971//______________________________________________________________________
972void AliITS::Hits2PreDigits(){
973 // Standard Hits to summable Digits function.
4a5bebc2 974 // Inputs:
975 // none.
976 // Outputs:
977 // none.
2aea926d 978
88cb7938 979 AliHeader *header=fLoader->GetRunLoader()->GetHeader(); // Get event number from this file.
2aea926d 980 // Do the Hits to Digits operation. Use Standard input values.
981 // Event number from file, no background hit merging , use size from
982 // AliITSgeom class, option="All", input from this file only.
7d8046e8 983 HitsToPreDigits(header->GetEvent(),0,-1," ",fOpt," ");
2aea926d 984}
985//______________________________________________________________________
c92eb8ad 986AliDigitizer* AliITS::CreateDigitizer(AliRunDigitizer* manager) const
85a5290f 987{
988 return new AliITSDigitizer(manager);
989}
990//______________________________________________________________________
e0fc0305 991void AliITS::SDigitsToDigits(Option_t *opt){
2aea926d 992 // Standard Summable digits to Digits function.
4a5bebc2 993 // Inputs:
994 // none.
995 // Outputs:
996 // none.
e0fc0305 997 char name[20] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
998
999 if(!GetITSgeom()) return; // need transformations to do digitization.
1000 AliITSgeom *geom = GetITSgeom();
1001
1002 const char *all = strstr(opt,"All");
1003 const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
88cb7938 1004 strstr(opt,"SSD")};
e0fc0305 1005 if( !det[0] && !det[1] && !det[2] ) all = "All";
1006 else all = 0;
1007 static Bool_t setDef=kTRUE;
1008 if (setDef) SetDefaultSimulation();
1009 setDef=kFALSE;
1010
1011 AliITSsimulation *sim = 0;
1012 AliITSDetType *iDetType = 0;
88cb7938 1013 TTree *trees = fLoader->TreeS();
e0fc0305 1014 if( !(trees && this->GetSDigits()) ){
88cb7938 1015 Error("SDigits2Digits","Error: No trees or SDigits. Returning.");
1016 return;
e0fc0305 1017 } // end if
1018 sprintf( name, "%s", this->GetName() );
1019 TBranch *brchSDigits = trees->GetBranch( name );
1020
1021 Int_t id,module;
1022 for(module=0;module<geom->GetIndexMax();module++){
88cb7938 1023 id = geom->GetModuleType(module);
e0fc0305 1024 if (!all && !det[id]) continue;
88cb7938 1025 iDetType = DetType(id);
1026 sim = (AliITSsimulation*)iDetType->GetSimulationModel();
1027 if (!sim) {
1028 Error("SDigit2Digits",
1029 "The simulation class was not instanciated!");
1030 exit(1);
1031 } // end if !sim
1032 sim->InitSimulationModule(module,gAlice->GetEvNumber());
e0fc0305 1033//
88cb7938 1034 // add summable digits to module
1035 this->GetSDigits()->Clear();
1036 brchSDigits->GetEvent(module);
1037 sim->AddSDigitsToModule(GetSDigits(),0);
e0fc0305 1038//
1039 // Digitise current module sum(SDigits)->Digits
1040 sim->FinishSDigitiseModule();
3bd79107 1041
e0fc0305 1042 // fills all branches - wasted disk space
88cb7938 1043 fLoader->TreeD()->Fill();
e0fc0305 1044 this->ResetDigits();
1045 } // end for module
1046
88cb7938 1047 fLoader->TreeD()->GetEntries();
ed9afcd2 1048
88cb7938 1049 fLoader->TreeD()->AutoSave();
e0fc0305 1050 // reset tree
88cb7938 1051 fLoader->TreeD()->Reset();
e0fc0305 1052
2aea926d 1053}
1054//______________________________________________________________________
1055void AliITS::Hits2Digits(){
1056 // Standard Hits to Digits function.
4a5bebc2 1057 // Inputs:
1058 // none.
1059 // Outputs:
1060 // none.
2aea926d 1061
85a5290f 1062 fLoader->LoadHits("read");
1063 fLoader->LoadDigits("recreate");
1064 AliRunLoader* rl = fLoader->GetRunLoader();
1065
1066 for (Int_t iEvent = 0; iEvent < rl->GetNumberOfEvents(); iEvent++) {
2aea926d 1067 // Do the Hits to Digits operation. Use Standard input values.
1068 // Event number from file, no background hit merging , use size from
1069 // AliITSgeom class, option="All", input from this file only.
85a5290f 1070 rl->GetEvent(iEvent);
1071 if (!fLoader->TreeD()) fLoader->MakeTree("D");
1072 MakeBranch("D");
1073 SetTreeAddress();
1074 HitsToDigits(iEvent,0,-1," ",fOpt," ");
1075 }
1076
1077 fLoader->UnloadHits();
1078 fLoader->UnloadDigits();
2aea926d 1079}
1080//______________________________________________________________________
1081void AliITS::HitsToSDigits(Int_t evNumber,Int_t bgrev,Int_t size,
88cb7938 1082 Option_t *option, Option_t *opt,Text_t *filename){
3bd79107 1083 // keep galice.root for signal and name differently the file for
1084 // background when add! otherwise the track info for signal will be lost !
2aea926d 1085 // the condition below will disappear when the geom class will be
4a5bebc2 1086 // initialized for all versions - for the moment it is only for v5 !
1087 // 7 is the SDD beam test version. Dummy routine. Hits are ITS's Summable
1088 // Digits.
1089 // Inputs:
1090 // Int_t evnt Event to be processed.
1091 // Int_t bgrev Background Hit tree number.
1092 // Int_t nmodules Not used.
1093 // Option_t *option String indicating if merging hits or not. To
1094 // merge hits set equal to "Add". Otherwise no
1095 // background hits are considered.
1096 // Test_t *filename File name containing the background hits..
1097 // Outputs:
1098 // none.
1099 // Return:
1100 // none.
e0fc0305 1101// return; // using Hits instead of the larger sdigits.
1102
1103 HitsToPreDigits(evNumber,bgrev,size,option,opt,filename);
2aea926d 1104}
1105//______________________________________________________________________
1106void AliITS::HitsToPreDigits(Int_t evNumber,Int_t bgrev,Int_t size,
88cb7938 1107 Option_t *option, Option_t *opt,Text_t *filename){
4a5bebc2 1108 // Keep galice.root for signal and name differently the file for
2aea926d 1109 // background when add! otherwise the track info for signal will be lost !
1110 // the condition below will disappear when the geom class will be
4a5bebc2 1111 // initialized for all versions - for the moment it is only for v5 !
1112 // 7 is the SDD beam test version.
1113 // Inputs:
1114 // Int_t evnt Event to be processed.
1115 // Int_t bgrev Background Hit tree number.
1116 // Int_t nmodules Not used.
1117 // Option_t *option String indicating if merging hits or not. To
1118 // merge hits set equal to "Add". Otherwise no
1119 // background hits are considered.
1120 // Test_t *filename File name containing the background hits..
1121 // Outputs:
1122 // none.
1123 // Return:
1124 // none.
2aea926d 1125
1126 if(!GetITSgeom()) return; // need transformations to do digitization.
1127 AliITSgeom *geom = GetITSgeom();
1128
1129 const char *all = strstr(opt,"All");
1130 const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
88cb7938 1131 strstr(opt,"SSD")};
2aea926d 1132 static Bool_t setDef=kTRUE;
1133 if (setDef) SetDefaultSimulation();
1134 setDef=kFALSE;
1135
1136 Int_t nmodules;
1137 InitModules(size,nmodules);
1138 FillModules(evNumber,bgrev,nmodules,option,filename);
1139
1140 AliITSsimulation *sim = 0;
1141 AliITSDetType *iDetType = 0;
1142 AliITSmodule *mod = 0;
1143 Int_t id,module;
1144 for(module=0;module<geom->GetIndexMax();module++){
88cb7938 1145 id = geom->GetModuleType(module);
2aea926d 1146 if (!all && !det[id]) continue;
88cb7938 1147 iDetType = DetType(id);
1148 sim = (AliITSsimulation*)iDetType->GetSimulationModel();
1149 if (!sim) {
1150 Error("HitsToSDigits",
1151 "The simulation class was not instanciated!");
1152 exit(1);
1153 } // end if !sim
1154 mod = (AliITSmodule *)fITSmodules->At(module);
1155 sim->SDigitiseModule(mod,module,evNumber);
1156 // fills all branches - wasted disk space
1157 fLoader->TreeS()->Fill();
1158 ResetSDigits();
2aea926d 1159 } // end for module
1160
1161 ClearModules();
1162
88cb7938 1163 fLoader->TreeS()->GetEntries();
1164 fLoader->TreeS()->AutoSave();
1165 fLoader->WriteSDigits("OVERWRITE");
2aea926d 1166 // reset tree
88cb7938 1167 fLoader->TreeS()->Reset();
2aea926d 1168}
1169//______________________________________________________________________
1170void AliITS::HitsToDigits(Int_t evNumber,Int_t bgrev,Int_t size,
88cb7938 1171 Option_t *option, Option_t *opt,Text_t *filename){
4a5bebc2 1172 // Keep galice.root for signal and name differently the file for
2aea926d 1173 // background when add! otherwise the track info for signal will be lost !
1174 // the condition below will disappear when the geom class will be
4a5bebc2 1175 // initialized for all versions - for the moment it is only for v5 !
1176 // 7 is the SDD beam test version.
1177 // Inputs:
1178 // Int_t evnt Event to be processed.
1179 // Int_t bgrev Background Hit tree number.
1180 // Int_t nmodules Not used.
1181 // Option_t *option String indicating if merging hits or not. To
1182 // merge hits set equal to "Add". Otherwise no
1183 // background hits are considered.
1184 // Test_t *filename File name containing the background hits..
1185 // Outputs:
1186 // none.
1187 // Return:
1188 // none.
1189
2aea926d 1190 if(!GetITSgeom()) return; // need transformations to do digitization.
1191 AliITSgeom *geom = GetITSgeom();
1192
1193 const char *all = strstr(opt,"All");
1194 const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
88cb7938 1195 strstr(opt,"SSD")};
2aea926d 1196 static Bool_t setDef=kTRUE;
1197 if (setDef) SetDefaultSimulation();
1198 setDef=kFALSE;
1199
1200 Int_t nmodules;
1201 InitModules(size,nmodules);
1202 FillModules(evNumber,bgrev,nmodules,option,filename);
1203
1204 AliITSsimulation *sim = 0;
1205 AliITSDetType *iDetType = 0;
1206 AliITSmodule *mod = 0;
1207 Int_t id,module;
1208 for(module=0;module<geom->GetIndexMax();module++){
88cb7938 1209 id = geom->GetModuleType(module);
2aea926d 1210 if (!all && !det[id]) continue;
88cb7938 1211 iDetType = DetType(id);
1212 sim = (AliITSsimulation*)iDetType->GetSimulationModel();
1213 if (!sim) {
1214 Error("HitsToDigits",
1215 "The simulation class was not instanciated!");
1216 exit(1);
1217 } // end if !sim
1218 mod = (AliITSmodule *)fITSmodules->At(module);
1219 sim->DigitiseModule(mod,module,evNumber);
1220 // fills all branches - wasted disk space
1221 fLoader->TreeD()->Fill();
1222 ResetDigits();
2aea926d 1223 } // end for module
4a5bebc2 1224
2aea926d 1225 ClearModules();
3bd79107 1226
88cb7938 1227 fLoader->TreeD()->GetEntries();
1228 fLoader->TreeD()->AutoSave();
2aea926d 1229 // reset tree
88cb7938 1230 fLoader->TreeD()->Reset();
2aea926d 1231}
1232//______________________________________________________________________
1233void AliITS::ResetSDigits(){
4a5bebc2 1234 // Reset the Summable Digits array.
1235 // Inputs:
1236 // none.
1237 // Outputs:
1238 // none.
3bd79107 1239
2aea926d 1240 if (fSDigits) fSDigits->Clear();
1241 fNSDigits = 0;
3bd79107 1242}
2aea926d 1243//______________________________________________________________________
1244void AliITS::ResetDigits(){
4a5bebc2 1245 // Reset number of digits and the digits array for the ITS detector.
1246 // Inputs:
1247 // none.
1248 // Outputs:
1249 // none.
3bd79107 1250
2aea926d 1251 if (!fDtype) return;
3bd79107 1252
2aea926d 1253 Int_t i;
1254 for (i=0;i<kNTYPES;i++ ) {
88cb7938 1255 if (fDtype->At(i)) ((TClonesArray*)fDtype->At(i))->Clear();
1256 if (fNdtype) fNdtype[i]=0;
2aea926d 1257 } // end for i
1258}
1259//______________________________________________________________________
1260void AliITS::ResetDigits(Int_t i){
4a5bebc2 1261 // Reset number of digits and the digits array for this branch.
1262 // Inputs:
1263 // none.
1264 // Outputs:
1265 // none.
828e06c7 1266
2aea926d 1267 if (fDtype->At(i)) ((TClonesArray*)fDtype->At(i))->Clear();
1268 if (fNdtype) fNdtype[i]=0;
1269}
1270//______________________________________________________________________
1271void AliITS::AddSumDigit(AliITSpListItem &sdig){
4a5bebc2 1272 // Adds the a module full of summable digits to the summable digits tree.
1273 // Inputs:
1274 // AliITSpListItem &sdig SDigit to be added to SDigits tree.
1275 // Outputs:
1276 // none.
1277 // Return:
1278 // none.
828e06c7 1279
2aea926d 1280 TClonesArray &lsdig = *fSDigits;
1281 new(lsdig[fNSDigits++]) AliITSpListItem(sdig);
828e06c7 1282}
2aea926d 1283//______________________________________________________________________
1284void AliITS::AddRealDigit(Int_t id, Int_t *digits){
4a5bebc2 1285 // Add a real digit - as coming from data.
1286 // Inputs:
1287 // Int_t id Detector type number.
1288 // Int_t *digits Integer array containing the digits info. See
1289 // AliITSdigit.h
1290 // Outputs:
1291 // none.
1292 // Return:
1293 // none.
9c74c52b 1294
2aea926d 1295 TClonesArray &ldigits = *((TClonesArray*)fDtype->At(id));
1296 new(ldigits[fNdtype[id]++]) AliITSdigit(digits);
1297}
1298//______________________________________________________________________
1299void AliITS::AddSimDigit(Int_t id, AliITSdigit *d){
4a5bebc2 1300 // Add a simulated digit.
1301 // Inputs:
1302 // Int_t id Detector type number.
1303 // AliITSdigit *d Digit to be added to the Digits Tree. See
1304 // AliITSdigit.h
1305 // Outputs:
1306 // none.
1307 // Return:
1308 // none.
2aea926d 1309
1310 TClonesArray &ldigits = *((TClonesArray*)fDtype->At(id));
1311
1312 switch(id){
1313 case 0:
88cb7938 1314 new(ldigits[fNdtype[id]++]) AliITSdigitSPD(*((AliITSdigitSPD*)d));
1315 break;
2aea926d 1316 case 1:
88cb7938 1317 new(ldigits[fNdtype[id]++]) AliITSdigitSDD(*((AliITSdigitSDD*)d));
1318 break;
2aea926d 1319 case 2:
88cb7938 1320 new(ldigits[fNdtype[id]++]) AliITSdigitSSD(*((AliITSdigitSSD*)d));
1321 break;
2aea926d 1322 } // end switch id
1323}
1324//______________________________________________________________________
1325void AliITS::AddSimDigit(Int_t id,Float_t phys,Int_t *digits,Int_t *tracks,
88cb7938 1326 Int_t *hits,Float_t *charges){
4a5bebc2 1327 // Add a simulated digit to the list.
1328 // Inputs:
1329 // Int_t id Detector type number.
1330 // Float_t phys Physics indicator. See AliITSdigits.h
1331 // Int_t *digits Integer array containing the digits info. See
1332 // AliITSdigit.h
e2450c78 1333 // Int_t *tracks Integer array [AliITSdigitS?D::GetNTracks()]
1334 // containing the track numbers that contributed to
1335 // this digit.
1336 // Int_t *hits Integer array [AliITSdigitS?D::GetNTracks()]
1337 // containing the hit numbers, from AliITSmodule, that
4a5bebc2 1338 // contributed to this digit.
1339 // Float_t *charge Floating point array of the signals contributed
1340 // to this digit by each track.
1341 // Outputs:
1342 // none.
1343 // Return:
1344 // none.
2aea926d 1345
1346 TClonesArray &ldigits = *((TClonesArray*)fDtype->At(id));
1347 switch(id){
1348 case 0:
88cb7938 1349 new(ldigits[fNdtype[id]++]) AliITSdigitSPD(digits,tracks,hits);
1350 break;
2aea926d 1351 case 1:
88cb7938 1352 new(ldigits[fNdtype[id]++]) AliITSdigitSDD(phys,digits,tracks,
1353 hits,charges);
1354 break;
2aea926d 1355 case 2:
88cb7938 1356 new(ldigits[fNdtype[id]++]) AliITSdigitSSD(digits,tracks,hits);
1357 break;
2aea926d 1358 } // end switch id
1359}
1360//______________________________________________________________________
1361void AliITS::MakeTreeC(Option_t *option){
88cb7938 1362 // Create a separate tree to store the clusters.
1363 // Inputs:
1364 // Option_t *option string which must contain "C" otherwise
1365 // no Cluster Tree is created.
1366 // Outputs:
1367 // none.
1368 // Return:
1369 // none.
1370
1371 AliITSLoader *pITSLoader = (AliITSLoader*)fLoader;
1372
1373 if (pITSLoader == 0x0) {
ac74f489 1374 Error("MakeTreeC","fLoader == 0x0 option=%s",option);
88cb7938 1375 return;
1376 }
1377 if (pITSLoader->TreeC() == 0x0) pITSLoader->MakeTree("C");
1378 MakeBranchC();
1379}
828e06c7 1380
88cb7938 1381void AliITS::MakeBranchC()
1382{
1383//Makes barnches in treeC
1384 AliITSLoader *pITSLoader = (AliITSLoader*)fLoader;
1385 if (pITSLoader == 0x0)
1386 {
1387 Error("MakeTreeC","fLoader == 0x0");
1388 return;
1389 }
93f82b23 1390 TTree * lTC = pITSLoader->TreeC();
1391 if (lTC == 0x0)
88cb7938 1392 {
1393 Error("MakeTreeC","Can not get TreeC from Loader");
1394 return;
1395 }
1396
1397 Int_t buffersize = 4000;
1398 char branchname[30];
1399 const char *det[3] = {"SPD","SDD","SSD"};
1400 char digclass[40];
1401 char clclass[40];
caf37aec 1402
2aea926d 1403 // one branch for Clusters per type of detector
88cb7938 1404 Int_t i;
1405 for (i=0; i<kNTYPES ;i++)
1406 {
2aea926d 1407 AliITSDetType *iDetType=DetType(i);
1408 iDetType->GetClassNames(digclass,clclass);
88cb7938 1409 // clusters
1410 if (fCtype == 0x0) fCtype = new TObjArray(fNDetTypes);
1411 if(!ClustersAddress(i))
1412 {
def15085 1413 fCtype->AddAt(new TClonesArray(clclass,1000),i);
88cb7938 1414 }
2aea926d 1415 if (kNTYPES==3) sprintf(branchname,"%sClusters%s",GetName(),det[i]);
88cb7938 1416 else sprintf(branchname,"%sClusters%d",GetName(),i+1);
93f82b23 1417 if (fCtype && lTC)
88cb7938 1418 {
93f82b23 1419 if (lTC->GetBranch(branchname))
88cb7938 1420 {
1421 Warning("MakeBranchC","Branch %s alread exists in TreeC",branchname);
1422 }
1423 else
1424 {
1425 Info("MakeBranchC","Creating branch %s in TreeC",branchname);
93f82b23 1426 lTC->Branch(branchname,&((*fCtype)[i]), buffersize);
88cb7938 1427 }
93f82b23 1428 } // end if fCtype && lTC
88cb7938 1429 } // end for i
2aea926d 1430}
88cb7938 1431
2aea926d 1432//______________________________________________________________________
1433void AliITS::GetTreeC(Int_t event){
88cb7938 1434 // Get the clusters tree for this event and set the branch address.
1435 // Inputs:
1436 // Int_t event Event number for the cluster tree.
1437 // Outputs:
1438 // none.
1439 // Return:
1440 // none.
1441 char branchname[30];
1442 const char *det[3] = {"SPD","SDD","SSD"};
9c74c52b 1443
88cb7938 1444 AliITSLoader *pITSLoader = (AliITSLoader*)fLoader;
93f82b23 1445 TTree * lTC = pITSLoader->TreeC();
3bd79107 1446
88cb7938 1447 ResetClusters();
93f82b23 1448 if (lTC) {
88cb7938 1449 pITSLoader->CleanRawClusters();
1450 } // end if TreeC()
2aea926d 1451
88cb7938 1452
1453 TBranch *branch;
1454
93f82b23 1455 if (lTC) {
88cb7938 1456 Int_t i;
1457 char digclass[40];
1458 char clclass[40];
1459 for (i=0; i<kNTYPES; i++) {
1460 AliITSDetType *iDetType=DetType(i);
1461 iDetType->GetClassNames(digclass,clclass);
1462 // clusters
1463 if (fCtype == 0x0) fCtype = new TObjArray(fNDetTypes);
1464 if(!fCtype->At(i)) fCtype->AddAt(new TClonesArray(clclass,1000),i);
1465 if(kNTYPES==3) sprintf(branchname,"%sClusters%s",GetName(),det[i]);
1466 else sprintf(branchname,"%sClusters%d",GetName(),i+1);
1467 if (fCtype) {
93f82b23 1468 branch = lTC->GetBranch(branchname);
88cb7938 1469 if (branch) branch->SetAddress(&((*fCtype)[i]));
1470 } // end if fCtype
1471 } // end for i
1472 } else {
1473 Error("GetTreeC","cannot find Clusters Tree for event:%d",event);
93f82b23 1474 } // end if lTC
2aea926d 1475}
1476//______________________________________________________________________
1477void AliITS::AddCluster(Int_t id, AliITSRawCluster *c){
4a5bebc2 1478 // Add a cluster to the list.
1479 // Inputs:
1480 // Int_t id Detector type number.
1481 // AliITSRawCluster *c Cluster class to be added to the tree of
1482 // clusters.
1483 // Outputs:
1484 // none.
1485 // Return:
1486 // none.
2aea926d 1487
1488 TClonesArray &lc = *((TClonesArray*)fCtype->At(id));
1489
1490 switch(id){
1491 case 0:
88cb7938 1492 new(lc[fNctype[id]++]) AliITSRawClusterSPD(*((AliITSRawClusterSPD*)c));
1493 break;
2aea926d 1494 case 1:
88cb7938 1495 new(lc[fNctype[id]++]) AliITSRawClusterSDD(*((AliITSRawClusterSDD*)c));
1496 break;
2aea926d 1497 case 2:
88cb7938 1498 new(lc[fNctype[id]++]) AliITSRawClusterSSD(*((AliITSRawClusterSSD*)c));
1499 break;
2aea926d 1500 } // end switch id
1501}
1502//______________________________________________________________________
1503void AliITS::ResetClusters(){
4a5bebc2 1504 // Reset number of clusters and the clusters array for ITS.
1505 // Inputs:
1506 // none.
1507 // Outputs:
1508 // none.
2aea926d 1509
1510 Int_t i;
4a5bebc2 1511 for (i=0;i<kNTYPES;i++ ) ResetClusters(i);
2aea926d 1512}
1513//______________________________________________________________________
1514void AliITS::ResetClusters(Int_t i){
4a5bebc2 1515 // Reset number of clusters and the clusters array for this branch.
1516 // Inputs:
1517 // Int_t i Detector type number.
1518 // Outputs:
1519 // none.
1520 // Return:
1521 // none.
3bd79107 1522
2aea926d 1523 if (fCtype->At(i)) ((TClonesArray*)fCtype->At(i))->Clear();
1524 if (fNctype) fNctype[i]=0;
1525}
1526//______________________________________________________________________
ff0e455e 1527void AliITS::MakeBranchR(const char *file, Option_t *opt){
2aea926d 1528 // Creates Tree branches for the ITS Reconstructed points.
4a5bebc2 1529 // Inputs:
1530 // cont char *file File name where RecPoints branch is to be written
1531 // to. If blank it write the SDigits to the same
1532 // file in which the Hits were found.
1533 // Outputs:
1534 // none.
1535 // Return:
1536 // none.
1537 Int_t buffsz = 4000;
2aea926d 1538 char branchname[30];
3bd79107 1539
2aea926d 1540 // only one branch for rec points for all detector types
ff0e455e 1541 Bool_t oFast= (strstr(opt,"Fast")!=0);
1542 if(oFast){
1543 sprintf(branchname,"%sRecPointsF",GetName());
1544 } else {
1545 sprintf(branchname,"%sRecPoints",GetName());
1546 }
88cb7938 1547
1548
8a92b3ef 1549 if(!fRecPoints)fRecPoints = new TClonesArray("AliITSRecPoint",1000);
1550 if (fLoader->TreeR()) {
88cb7938 1551 if (fRecPoints == 0x0) fRecPoints = new TClonesArray("AliITSRecPoint",1000);
1552 MakeBranchInTree(fLoader->TreeR(),branchname,&fRecPoints,buffsz,file);
2aea926d 1553 } // end if
1554}
1555//______________________________________________________________________
1556void AliITS::SetTreeAddressR(TTree *treeR){
1557 // Set branch address for the Reconstructed points Trees.
4a5bebc2 1558 // Inputs:
1559 // TTree *treeR Tree containing the RecPoints.
1560 // Outputs:
1561 // none.
1562 // Return:
1563 // none.
2aea926d 1564 char branchname[30];
3bd79107 1565
2aea926d 1566 if(!treeR) return;
88cb7938 1567 if (fRecPoints == 0x0) fRecPoints = new TClonesArray("AliITSRecPoint",1000);
2aea926d 1568 TBranch *branch;
2aea926d 1569 sprintf(branchname,"%sRecPoints",GetName());
1570 branch = treeR->GetBranch(branchname);
ff0e455e 1571 if (branch) {
1572 branch->SetAddress(&fRecPoints);
1573 }
1574 else {
1575 sprintf(branchname,"%sRecPointsF",GetName());
1576 branch = treeR->GetBranch(branchname);
1577 if (branch) {
1578 branch->SetAddress(&fRecPoints);
1579 }
1580 }
2aea926d 1581}
1582//______________________________________________________________________
1583void AliITS::AddRecPoint(const AliITSRecPoint &r){
1584 // Add a reconstructed space point to the list
4a5bebc2 1585 // Inputs:
1586 // const AliITSRecPoint &r RecPoint class to be added to the tree
1587 // of reconstructed points TreeR.
1588 // Outputs:
1589 // none.
1590 // Return:
1591 // none.
3bd79107 1592
2aea926d 1593 TClonesArray &lrecp = *fRecPoints;
1594 new(lrecp[fNRecPoints++]) AliITSRecPoint(r);
3bd79107 1595}
2aea926d 1596//______________________________________________________________________
e8189707 1597void AliITS::HitsToFastRecPoints(Int_t evNumber,Int_t bgrev,Int_t size,
88cb7938 1598 Option_t *opt0,Option_t *opt1,Text_t *flnm){
3bd79107 1599 // keep galice.root for signal and name differently the file for
1600 // background when add! otherwise the track info for signal will be lost !
2aea926d 1601 // the condition below will disappear when the geom class will be
4a5bebc2 1602 // initialized for all versions - for the moment it is only for v5 !
1603 // Inputs:
1604 // Int_t evnt Event to be processed.
1605 // Int_t bgrev Background Hit tree number.
1606 // Int_t size Size used by InitModules. See InitModules.
1607 // Option_t *opt0 Option passed to FillModules. See FillModules.
1608 // Option_t *opt1 String indicating if merging hits or not. To
1609 // merge hits set equal to "Add". Otherwise no
1610 // background hits are considered.
1611 // Test_t *flnm File name containing the background hits..
1612 // Outputs:
1613 // none.
1614 // Return:
1615 // none.
1616
2aea926d 1617 if(!GetITSgeom()) return;
8a92b3ef 1618 AliITSLoader *pITSloader = (AliITSLoader*)fLoader;
2aea926d 1619 AliITSgeom *geom = GetITSgeom();
1620
1621 const char *all = strstr(opt1,"All");
1622 const char *det[3] ={strstr(opt1,"SPD"),strstr(opt1,"SDD"),
88cb7938 1623 strstr(opt1,"SSD")};
2aea926d 1624 Int_t nmodules;
1625 InitModules(size,nmodules);
1626 FillModules(evNumber,bgrev,nmodules,opt0,flnm);
1627
1628 AliITSsimulation *sim = 0;
1629 AliITSDetType *iDetType = 0;
1630 AliITSmodule *mod = 0;
1631 Int_t id,module;
e3b819ce 1632
1633 //m.b. : this change is nothing but a nice way to make sure
1634 //the CPU goes up !
88cb7938 1635
1636 cout<<"HitsToFastRecPoints: N mod = "<<geom->GetIndexMax()<<endl;
1637
1638 for(module=0;module<geom->GetIndexMax();module++)
1639 {
1640 id = geom->GetModuleType(module);
2aea926d 1641 if (!all && !det[id]) continue;
88cb7938 1642 iDetType = DetType(id);
1643 sim = (AliITSsimulation*)iDetType->GetSimulationModel();
1644 if (!sim)
1645 {
1646 Error("HitsToFastPoints","The simulation class was not instanciated!");
1647 exit(1);
1648 } // end if !sim
1649 mod = (AliITSmodule *)fITSmodules->At(module);
1650 sim->CreateFastRecPoints(mod,module,gRandom);
1651 cout<<module<<"\r";fflush(0);
8a92b3ef 1652 //gAlice->TreeR()->Fill();
93f82b23 1653 TTree *lTR = pITSloader->TreeR();
1654 TBranch *br=lTR->GetBranch("ITSRecPointsF");
88cb7938 1655 br->Fill();
1656 ResetRecPoints();
2aea926d 1657 } // end for module
4a5bebc2 1658
2aea926d 1659 ClearModules();
88cb7938 1660
1661 fLoader->WriteRecPoints("OVERWRITE");
2aea926d 1662}
1663//______________________________________________________________________
1664void AliITS::Digits2Reco(){
4a5bebc2 1665 // Find clusters and reconstruct space points.
1666 // Inputs:
1667 // none.
1668 // Outputs:
1669 // none.
2aea926d 1670
88cb7938 1671 AliHeader *header=fLoader->GetRunLoader()->GetHeader();
2aea926d 1672 // to Digits to RecPoints for event in file, all digits in file, and
1673 // all ITS detectors.
7d8046e8 1674 DigitsToRecPoints(header->GetEvent(),0,fOpt);
2aea926d 1675}
1676//______________________________________________________________________
1677void AliITS::DigitsToRecPoints(Int_t evNumber,Int_t lastentry,Option_t *opt){
88cb7938 1678 // cluster finding and reconstruction of space points
1679 // the condition below will disappear when the geom class will be
1680 // initialized for all versions - for the moment it is only for v5 !
1681 // 7 is the SDD beam test version
1682 // Inputs:
1683 // Int_t evNumber Event number to be processed.
1684 // Int_t lastentry Offset for module when not all of the modules
1685 // are processed.
1686 // Option_t *opt String indicating which ITS sub-detectors should
1687 // be processed. If ="All" then all of the ITS
1688 // sub detectors are processed.
1689 // Outputs:
1690 // none.
1691 // Return:
1692 // none.
1693
1694 if(!GetITSgeom()) return;
1695 AliITSgeom *geom = GetITSgeom();
2aea926d 1696
88cb7938 1697 const char *all = strstr(opt,"All");
1698 const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
1699 strstr(opt,"SSD")};
1700 static Bool_t setRec=kTRUE;
1701 if (setRec) SetDefaultClusterFinders();
1702 setRec=kFALSE;
1703
1704 AliITSLoader *pITSloader = (AliITSLoader*)fLoader;
1705 TTree *treeC=pITSloader->TreeC();
1706 AliITSClusterFinder *rec = 0;
1707 AliITSDetType *iDetType = 0;
1708 Int_t id,module,first=0;
1709 for(module=0;module<geom->GetIndexMax();module++){
ac74f489 1710 id = geom->GetModuleType(module);
1711 if (!all && !det[id]) continue;
1712 if(det[id]) first = geom->GetStartDet(id);
1713 iDetType = DetType(id);
1714 rec = (AliITSClusterFinder*)iDetType->GetReconstructionModel();
1715 TClonesArray *itsDigits = this->DigitsAddress(id);
1716 if (!rec) {
1717 Error("DigitsToRecPoints",
1718 "The reconstruction class was not instanciated! event=%d",
1719 evNumber);
1720 exit(1);
1721 } // end if !rec
1722 this->ResetDigits();
93f82b23 1723 TTree *lTD = pITSloader->TreeD();
ac74f489 1724 if (all) {
93f82b23 1725 lTD->GetEvent(lastentry+module);
ac74f489 1726 }else {
93f82b23 1727 lTD->GetEvent(lastentry+(module-first));
ac74f489 1728 }
1729 Int_t ndigits = itsDigits->GetEntriesFast();
1730 if (ndigits) rec->FindRawClusters(module);
1731 pITSloader->TreeR()->Fill();
1732 ResetRecPoints();
1733 treeC->Fill();
1734 ResetClusters();
88cb7938 1735 } // end for module
828e06c7 1736
2aea926d 1737
88cb7938 1738 pITSloader->WriteRecPoints("OVERWRITE");
1739 pITSloader->WriteRawClusters("OVERWRITE");
fe4da5cc 1740}
2aea926d 1741//______________________________________________________________________
1742void AliITS::ResetRecPoints(){
4a5bebc2 1743 // Reset number of rec points and the rec points array.
1744 // Inputs:
1745 // none.
1746 // Outputs:
1747 // none.
63147407 1748
2aea926d 1749 if (fRecPoints) fRecPoints->Clear();
1750 fNRecPoints = 0;
1751}
88cb7938 1752//______________________________________________________________________
1753AliLoader* AliITS::MakeLoader(const char* topfoldername)
1754{
1755 //builds ITSgetter (AliLoader type)
1756 //if detector wants to use castomized getter, it must overload this method
1757
f2a509af 1758 Info("MakeLoader","Creating AliITSLoader. Top folder is %s.",topfoldername);
88cb7938 1759 fLoader = new AliITSLoader(GetName(),topfoldername);
1760 return fLoader;
88cb7938 1761}
1762
1763