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