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