1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 Revision 1.66 2001/11/28 01:35:45 nilsen
19 Using standard constructors instead of default constructors for Clusterfinder,
20 Response, and FastSimulator.
22 Revision 1.65 2001/11/27 16:27:28 nilsen
23 Adding AliITSDigitizer class to do merging and digitization . Based on the
24 TTask method. AliITSDigitizer class added to the Makefile and ITSLinkDef.h
25 file. The following files required minor changes. AliITS, added functions
26 SetHitsAddressBranch, MakeBranchInTreeD and modified MakeBranchD.
27 AliITSsimulationSDD.cxx needed a Tree indepenent way of returning back to
28 the original Root Directory in function Compress1D. Now it uses gDirectory.
30 Revision 1.64 2001/11/19 16:17:02 nilsen
31 Applyed fixes to bugs found by Rene Brun. With many thanks. Some additonal
32 bugs found by Rene require more work to fix. Will be fixed soon.
34 Revision 1.63 2001/10/24 21:16:34 nilsen
35 Removed some dead code and improved comments/documntation.
37 Revision 1.62 2001/10/21 19:23:21 nilsen
38 Added function to allow to limit which detectors to digitize and reconstruct.
39 The default is All. This change makes no changes to any root file.
41 Revision 1.61 2001/10/11 15:26:07 mariana
42 Correct HitsToFastRecPoints
44 Revision 1.60 2001/10/04 22:38:10 nilsen
45 Changes made to support PreDigits (SDigits) plus other helpful changes.
47 Revision 1.59 2001/08/30 09:56:18 hristov
48 The operator[] is replaced by At() or AddAt() in case of TObjArray.
50 Revision 1.58 2001/07/26 15:05:29 hristov
51 Use global gRandom generator (M.Ivanov)
53 Revision 1.57 2001/07/24 14:26:11 mariana
54 Introduce the function Digits2Reco() and write the defaults for simulation and reconstruction
56 Revision 1.56 2001/07/05 12:49:49 mariana
57 Temporary patches required by root.v3.01.05
59 Revision 1.55 2001/06/14 14:59:00 barbera
60 Tracking V1 decoupled from AliITS
62 Revision 1.54 2001/05/31 20:37:56 barbera
63 Bari/Salerno model set as defaault SPD simulation
65 Revision 1.53 2001/05/31 18:52:24 barbera
66 Bari model becomes the default
68 Revision 1.53 2001/05/30 07:52:24 hristov
69 TPC and CONTAINERS included in the search path
71 Revision 1.52 2001/05/30 06:04:58 hristov
72 Changes made to be consitant with changes in TPC tracking classes (B.Nilsen)
74 Revision 1.51 2001/05/16 14:57:15 alibrary
75 New files for folders and Stack
77 Revision 1.50 2001/05/11 09:15:21 barbera
78 Corrected to make fast point creation working with PPR geometry
80 Revision 1.49 2001/05/11 07:37:49 hristov
81 Legacy lines commented
83 Revision 1.48 2001/05/10 18:14:25 barbera
86 Revision 1.47 2001/05/10 17:55:59 barbera
87 Modified to create rec points also for PPR geometries
89 Revision 1.46 2001/05/10 00:05:28 nilsen
90 Allowed for HitsToDigits function to work with versions 5, 7, 8, and 9. This
91 should probably be cleaned up to only check to make sure that fITSgeom has
92 been properly defined.
94 Revision 1.45 2001/05/01 22:35:48 nilsen
95 Remove/commented a number of cout<< statements. and made change needed by
98 Revision 1.44 2001/04/26 22:44:01 nilsen
99 Removed dependence on layer 5/6 in AliITS::HitsToDigits. This will be
100 done properly in AliITSv???.cxx via SetDefaults.
102 Revision 1.43 2001/04/26 13:22:52 barbera
103 TMatrix and TVector elimininated to speed up the code
105 Revision 1.42 2001/04/25 21:55:12 barbera
106 Updated version to be compatible with actual verion of STEER and TPC
108 Revision 1.41 2001/04/21 15:16:51 barbera
109 Updated with the new SSD reconstruction code
111 Revision 1.40 2001/03/17 15:07:06 mariana
112 Update SDD response parameters
114 Revision 1.39 2001/03/12 17:45:32 hristov
115 Changes needed on Sun with CC 5.0
117 Revision 1.38 2001/03/07 14:04:51 barbera
118 Some vector dimensions increased to cope with full events
120 Revision 1.37 2001/03/07 12:36:35 barbera
121 A change added in the tracking part to manage delta rays
123 Revision 1.36 2001/03/02 19:44:11 barbera
124 modified to taking into account new version tracking v1
126 Revision 1.35 2001/02/28 18:16:46 mariana
127 Make the code compatible with the new AliRun
129 Revision 1.34 2001/02/11 15:51:39 mariana
130 Set protection in MakeBranch
132 Revision 1.33 2001/02/10 22:26:39 mariana
133 Move the initialization of the containers for raw clusters in MakeTreeC()
135 Revision 1.32 2001/02/08 23:55:31 nilsen
136 Removed fMajor/MinorVersion variables in favor of variables in derived classes.
137 Set arrays char *det[3] = {"SPD","SDD","SSD"} as const.
139 Revision 1.31 2001/02/02 23:57:28 nilsen
140 Added include file that are no londer included in AliITSgeom.h
142 Revision 1.30 2001/01/30 09:23:13 hristov
143 Streamers removed (R.Brun)
145 Revision 1.29 2001/01/26 20:01:09 hristov
146 Major upgrade of AliRoot code
148 Revision 1.28 2000/12/18 14:02:00 barbera
149 new version of the ITS tracking to take into account the new TPC track parametrization
151 Revision 1.27 2000/12/08 13:49:27 barbera
152 Hidden declaration in a for loop removed to be compliant with HP-UX compiler
154 Revision 1.26 2000/11/27 13:12:13 barbera
155 New version containing the files for tracking
157 Revision 1.25 2000/11/12 22:38:05 barbera
158 Added header file for the SPD Bari model
160 Revision 1.24 2000/10/09 22:18:12 barbera
161 Bug fixes from MAriana to le AliITStest.C run correctly
163 Revision 1.23 2000/10/05 20:47:42 nilsen
164 fixed dependencies of include files. Tryed but failed to get a root automaticly
165 generates streamer function to work. Modified SetDefaults.
167 Revision 1.9.2.15 2000/10/04 16:56:40 nilsen
168 Needed to include stdlib.h
171 Revision 1.22 2000/10/04 19:45:52 barbera
172 Corrected by F. Carminati for v3.04
174 Revision 1.21 2000/10/02 21:28:08 fca
175 Removal of useless dependecies via forward declarations
177 Revision 1.20 2000/10/02 16:31:39 barbera
178 General code clean-up
180 Revision 1.9.2.14 2000/10/02 15:43:51 barbera
181 General code clean-up (e.g., printf -> cout)
183 Revision 1.19 2000/09/22 12:13:25 nilsen
184 Patches and updates for fixes to this and other routines.
186 Revision 1.18 2000/07/12 05:32:20 fca
187 Correcting several syntax problem with static members
189 Revision 1.17 2000/07/10 16:07:18 fca
190 Release version of ITS code
192 Revision 1.9.2.3 2000/02/02 13:42:09 barbera
193 fixed AliITS.cxx for new AliRun structure. Added ITS hits list to list of hits which will have their track numbers updated
195 Revision 1.9.2.2 2000/01/23 03:03:13 nilsen
196 //fixed FillModule. Removed fi(fabs(xl)<dx....
198 Revision 1.9.2.1 2000/01/12 19:03:32 nilsen
199 This is the version of the files after the merging done in December 1999.
200 See the ReadMe110100.txt file for details
202 Revision 1.9 1999/11/14 14:33:25 fca
203 Correct problems with distructors and pointers, thanks to I.Hrivnacova
205 Revision 1.8 1999/09/29 09:24:19 fca
206 Introduction of the Copyright and cvs Log
210 ///////////////////////////////////////////////////////////////////////////////
212 // An overview of the basic philosophy of the ITS code development
213 // and analysis is show in the figure below.
216 <img src="picts/ITS/ITS_Analysis_schema.gif">
219 <font size=+2 color=red>
220 <p>Roberto Barbera is in charge of the ITS Offline code (1999).
221 <a href="mailto:roberto.barbera@ct.infn.it">Roberto Barbera</a>.
227 // AliITS. Inner Traking System base class.
228 // This class contains the base procedures for the Inner Tracking System
232 <img src="picts/ITS/AliITS_Class_Diagram.gif">
235 <font size=+2 color=red>
236 <p>This show the class diagram of the different elements that are part of
244 // Written by Rene Brun, Federico Carminati, and Roberto Barbera
247 // Modified and documented by Bjorn S. Nilsen
251 // Modified and documented by A. Bologna
254 // AliITS is the general base class for the ITS. Also see AliDetector for
255 // futher information.
257 ///////////////////////////////////////////////////////////////////////////////
258 #include <iostream.h>
266 #include <TClonesArray.h>
268 #include <TObjectTable.h>
274 #include "AliHeader.h"
277 #include "AliITSDetType.h"
278 #include "AliITSresponseSPD.h"
279 #include "AliITSresponseSDD.h"
280 #include "AliITSresponseSSD.h"
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"
290 #include "AliITShit.h"
291 #include "AliITSgeom.h"
292 #include "AliITSpList.h"
293 #include "AliITSdigit.h"
294 #include "AliITSmodule.h"
295 #include "AliITSRecPoint.h"
296 #include "AliITSRawCluster.h"
300 //______________________________________________________________________
301 AliITS::AliITS() : AliDetector() {
302 // Default initializer for ITS
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
315 fIshunt = 0; // not zeroed in AliDetector.
322 // SetDetectors(); // default to fOpt="All". This variable not written out.
328 fNDetTypes = kNTYPES;
344 SetMarkerColor(kRed);
346 //______________________________________________________________________
347 AliITS::AliITS(const char *name, const char *title):AliDetector(name,title){
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
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
360 // const char *name Detector name. Should always be "ITS"
361 // const char *title Detector title.
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.
374 SetDetectors(); // default to fOpt="All". This variable not written out.
380 fNDetTypes = kNTYPES;
381 fDetTypes = new TObjArray(fNDetTypes);
383 fSDigits = new TClonesArray("AliITSpListItem",1000);
386 fNdtype = new Int_t[fNDetTypes];
387 fDtype = new TObjArray(fNDetTypes);
389 fCtype = new TObjArray(fNDetTypes);
390 fNctype = new Int_t[fNDetTypes];
393 fRecPoints = new TClonesArray("AliITSRecPoint",1000);
397 for(i=0;i<fNDetTypes;i++) {
398 fDetTypes->AddAt(new AliITSDetType(),i);
403 SetMarkerColor(kRed);
405 //______________________________________________________________________
407 // Default destructor for ITS.
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,
410 // fSDigits, fCtype, fITSmodules, fITSgeom, fRecPoints, fIdSens, fIdName,
411 // fITSpoints, fDetType and it's contents.
423 if(fIdName!=0) delete[] fIdName; // Array of TStrings
424 if(fIdSens!=0) delete[] fIdSens;
426 this->ClearModules();
428 }// end if fITSmodules!=0
444 } // end if fDetTypes
446 if (fTreeC) delete fTreeC;
448 if (fITSgeom) delete fITSgeom;
450 //______________________________________________________________________
451 AliITS::AliITS(AliITS &source){
452 // Copy constructor. This is a function which is not allowed to be
453 // done to the ITS. It exits with an error.
455 // AliITS &source An AliITS class.
461 if(this==&source) return;
462 Error("Copy constructor",
463 "You are not allowed to make a copy of the AliITS");
466 //______________________________________________________________________
467 AliITS& AliITS::operator=(AliITS &source){
468 // Assignment operator. This is a function which is not allowed to be
469 // done to the ITS. It exits with an error.
471 // AliITS &source An AliITS class.
477 if(this==&source) return *this;
478 Error("operator=","You are not allowed to make a copy of the AliITS");
480 return *this; //fake return
482 //______________________________________________________________________
483 Int_t AliITS::DistancetoPrimitive(Int_t,Int_t){
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
490 // Int_t Dummy screen coordinate.
491 // Int_t Dummy screen coordinate.
495 // Int_t Dummy = 9999 distance to ITS.
499 //______________________________________________________________________
501 // Initializer ITS after it has been built
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.
517 for(i=0;i<fIdN;i++) fIdSens[i] = gMC->VolId(fIdName[i]);
519 //______________________________________________________________________
520 void AliITS::SetDefaults(){
521 // sets the default segmentation, response, digit and raw cluster classes.
529 if(fDebug) printf("%s: SetDefaults\n",ClassName());
531 AliITSDetType *iDetType;
535 if (!iDetType->GetSegmentationModel()) {
536 AliITSsegmentationSPD *seg0=new AliITSsegmentationSPD(fITSgeom);
537 SetSegmentationModel(0,seg0);
539 if (!iDetType->GetResponseModel()) {
540 SetResponseModel(0,new AliITSresponseSPD());
542 // set digit and raw cluster classes to be used
544 const char *kData0=(iDetType->GetResponseModel())->DataType();
545 if (strstr(kData0,"real")) {
546 iDetType->ClassNames("AliITSdigit","AliITSRawClusterSPD");
547 } else iDetType->ClassNames("AliITSdigitSPD","AliITSRawClusterSPD");
551 if (!iDetType->GetResponseModel()) {
552 SetResponseModel(1,new AliITSresponseSDD("simulated"));
554 AliITSresponse *resp1=iDetType->GetResponseModel();
555 if (!iDetType->GetSegmentationModel()) {
556 AliITSsegmentationSDD *seg1=new AliITSsegmentationSDD(fITSgeom,resp1);
557 SetSegmentationModel(1,seg1);
559 const char *kData1=(iDetType->GetResponseModel())->DataType();
560 const char *kopt=iDetType->GetResponseModel()->ZeroSuppOption();
561 if((!strstr(kopt,"2D"))&&(!strstr(kopt,"1D")) || strstr(kData1,"real") ){
562 iDetType->ClassNames("AliITSdigit","AliITSRawClusterSDD");
563 } else iDetType->ClassNames("AliITSdigitSDD","AliITSRawClusterSDD");
567 if (!iDetType->GetSegmentationModel()) {
568 AliITSsegmentationSSD *seg2=new AliITSsegmentationSSD(fITSgeom);
569 SetSegmentationModel(2,seg2);
571 if (!iDetType->GetResponseModel()) {
572 SetResponseModel(2,new AliITSresponseSSD("simulated"));
574 const char *kData2=(iDetType->GetResponseModel())->DataType();
575 if (strstr(kData2,"real")) {
576 iDetType->ClassNames("AliITSdigit","AliITSRawClusterSSD");
577 } else iDetType->ClassNames("AliITSdigitSSD","AliITSRawClusterSSD");
580 Warning("SetDefaults",
581 "Only the three basic detector types are initialized!");
584 //______________________________________________________________________
585 void AliITS::SetDefaultSimulation(){
586 // sets the default simulation.
594 AliITSDetType *iDetType;
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);
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);
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);
620 //______________________________________________________________________
621 void AliITS::SetDefaultClusterFinders(){
622 // Sets the default cluster finders. Used in finding RecPoints.
631 AliITSDetType *iDetType;
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,
642 SetReconstructionModel(0,rec0);
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);
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);
668 //______________________________________________________________________
669 void AliITS::MakeBranch(Option_t* option, const char *file){
670 // Creates Tree branches for the ITS.
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
681 const char *cS = strstr(option,"S");
682 const char *cD = strstr(option,"D");
683 const char *cR = strstr(option,"R");
685 AliDetector::MakeBranch(option,file);
687 if(cS) MakeBranchS(file);
688 if(cD) MakeBranchD(file);
689 if(cR) MakeBranchR(file);
691 //______________________________________________________________________
692 void AliITS::SetTreeAddress(){
693 // Set branch address for the Trees.
700 TTree *treeS = gAlice->TreeS();
701 TTree *treeD = gAlice->TreeD();
702 TTree *treeR = gAlice->TreeR();
704 AliDetector::SetTreeAddress();
706 SetTreeAddressS(treeS);
707 SetTreeAddressD(treeD);
708 SetTreeAddressR(treeR);
710 //______________________________________________________________________
711 AliITSDetType* AliITS::DetType(Int_t id){
712 // Return pointer to id detector type.
714 // Int_t id detector id number.
718 // returned, a pointer to a AliITSDetType.
720 return ((AliITSDetType*) fDetTypes->At(id));
722 //______________________________________________________________________
723 void AliITS::SetResponseModel(Int_t id, AliITSresponse *response){
724 // Set the response model for the id detector type.
726 // Int_t id detector id number.
727 // AliITSresponse* a pointer containing an instance of AliITSresponse
728 // to be stored/owned b y AliITSDetType.
734 ((AliITSDetType*) fDetTypes->At(id))->ResponseModel(response);
736 //______________________________________________________________________
737 void AliITS::SetSegmentationModel(Int_t id, AliITSsegmentation *seg){
738 // Set the segmentation model for the id detector type.
740 // Int_t id detector id number.
741 // AliITSsegmentation* a pointer containing an instance of
742 // AliITSsegmentation to be stored/owned b y
749 ((AliITSDetType*) fDetTypes->At(id))->SegmentationModel(seg);
751 //______________________________________________________________________
752 void AliITS::SetSimulationModel(Int_t id, AliITSsimulation *sim){
753 // Set the simulation model for the id detector type.
755 // Int_t id detector id number.
756 // AliITSresponse* a pointer containing an instance of AliITSresponse
757 // to be stored/owned b y AliITSDetType.
763 ((AliITSDetType*) fDetTypes->At(id))->SimulationModel(sim);
766 //______________________________________________________________________
767 void AliITS::SetReconstructionModel(Int_t id, AliITSClusterFinder *reconst){
768 // Set the cluster finder model for the id detector type.
770 // Int_t id detector id number.
771 // AliITSClusterFinder* a pointer containing an instance of
772 // AliITSClusterFinder to be stored/owned b y
779 ((AliITSDetType*) fDetTypes->At(id))->ReconstructionModel(reconst);
781 //______________________________________________________________________
782 void AliITS::SetClasses(Int_t id, const char *digit, const char *cluster){
783 // Set the digit and cluster classes name to be used for the id detector
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.
794 ((AliITSDetType*) fDetTypes->At(id))->ClassNames(digit,cluster);
796 //______________________________________________________________________
797 void AliITS::AddHit(Int_t track, Int_t *vol, Float_t *hits){
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
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
813 TClonesArray &lhits = *fHits;
814 new(lhits[fNhits++]) AliITShit(fIshunt,track,vol,hits);
816 //______________________________________________________________________
817 void AliITS::InitModules(Int_t size,Int_t &nmodules){
818 // Initialize the modules array.
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.
824 // Int_t &nmodules The number of modules existing.
829 fITSmodules->Delete();
831 } // end fir fITSmoudles
833 Int_t nl,indexMAX,index;
835 if(size<=0){ // default to using data stored in AliITSgeom
837 Error("InitModules","fITSgeom not defined");
839 } // end if fITSgeom==0
840 nl = fITSgeom->GetNlayers();
841 indexMAX = fITSgeom->GetModuleIndex(nl,fITSgeom->GetNladders(nl),
842 fITSgeom->GetNdetectors(nl))+1;
844 fITSmodules = new TObjArray(indexMAX);
845 for(index=0;index<indexMAX;index++){
846 fITSmodules->AddAt( new AliITSmodule(index),index);
849 fITSmodules = new TObjArray(size);
850 for(index=0;index<size;index++) {
851 fITSmodules->AddAt( new AliITSmodule(index),index);
857 //______________________________________________________________________
858 void 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
861 // background if option=Add.
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..
874 static TTree *trH1; //Tree with background hits
875 static TClonesArray *fHits2; //List of hits for one track only
876 static Bool_t first=kTRUE;
878 const char *addBgr = strstr(option,"Add");
882 file=new TFile(filename);
883 fHits2 = new TClonesArray("AliITShit",1000 );
888 // Get Hits Tree header from file
889 if(fHits2) fHits2->Clear();
890 if(trH1) delete trH1;
894 sprintf(treeName,"TreeH%d",bgrev);
895 trH1 = (TTree*)gDirectory->Get(treeName);
897 Error("FillModules","cannot find Hits Tree for event:%d",bgrev);
899 // Set branch addresses
902 sprintf(branchname,"%s",GetName());
903 if (trH1 && fHits2) {
904 branch = trH1->GetBranch(branchname);
905 if (branch) branch->SetAddress(&fHits2);
906 } // end if trH1 && fHits
909 TClonesArray *itsHits = this->Hits();
910 Int_t lay,lad,det,index;
913 TTree *iTH = gAlice->TreeH();
914 Int_t ntracks =(Int_t) iTH->GetEntries();
916 for(t=0; t<ntracks; t++){
919 Int_t nhits = itsHits->GetEntriesFast();
920 if (!nhits) continue;
921 for(h=0; h<nhits; h++){
922 itsHit = (AliITShit *)itsHits->UncheckedAt(h);
923 itsHit->GetDetectorID(lay,lad,det);
924 // temporarily index=det-1 !!!
925 if(fITSgeom) index = fITSgeom->GetModuleIndex(lay,lad,det);
928 mod = this->GetModule(index);
929 mod->AddHit(itsHit,t,h);
930 } // end loop over hits
931 } // end loop over tracks
933 // open the file with background
937 ntracks =(Int_t)trH1->GetEntries();
939 for (track=0; track<ntracks; track++) {
940 if (fHits2) fHits2->Clear();
941 trH1->GetEvent(track);
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);
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();
956 if (fAli) fileAli =fAli->GetCurrentFile();
960 //______________________________________________________________________
961 void AliITS::ClearModules(){
962 // Clear the modules TObjArray.
968 if(fITSmodules) fITSmodules->Delete();
970 //______________________________________________________________________
971 void AliITS::MakeBranchS(const char *fl){
972 // Creates Tree Branch for the ITS summable digits.
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.
981 Int_t buffersize = 4000;
984 // only one branch for SDigits.
985 sprintf(branchname,"%s",GetName());
986 if(fSDigits && gAlice->TreeS()){
987 MakeBranchInTree(gAlice->TreeS(),branchname,&fSDigits,buffersize,fl);
990 //______________________________________________________________________
991 void AliITS::SetTreeAddressS(TTree *treeS){
992 // Set branch address for the ITS summable digits Trees.
994 // TTree *treeS Tree containing the SDigits.
1003 sprintf(branchname,"%s",GetName());
1004 branch = treeS->GetBranch(branchname);
1005 if (branch) branch->SetAddress(&fSDigits);
1007 //______________________________________________________________________
1008 void AliITS::MakeBranchInTreeD(TTree *treeD,const char *file){
1009 // Creates Tree branches for the ITS.
1011 // TTree *treeD Pointer to the Digits Tree.
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.
1019 Int_t buffersize = 4000;
1020 char branchname[30];
1022 sprintf(branchname,"%s",GetName());
1023 // one branch for digits per type of detector
1024 const char *det[3] = {"SPD","SDD","SSD"};
1028 for (i=0; i<kNTYPES ;i++) {
1029 DetType(i)->GetClassNames(digclass,clclass);
1031 if(!(fDtype->At(i))) fDtype->AddAt(new TClonesArray(digclass,1000),i);
1032 else ResetDigits(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);
1037 if (fDtype && treeD) {
1038 MakeBranchInTree(treeD,
1039 branchname, &((*fDtype)[i]),buffersize,file);
1043 //______________________________________________________________________
1044 void AliITS::SetTreeAddressD(TTree *treeD){
1045 // Set branch address for the Trees.
1047 // TTree *treeD Tree containing the Digits.
1052 char branchname[30];
1053 const char *det[3] = {"SPD","SDD","SSD"};
1060 for (i=0; i<kNTYPES; i++) {
1061 DetType(i)->GetClassNames(digclass,clclass);
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);
1068 branch = treeD->GetBranch(branchname);
1069 if (branch) branch->SetAddress(&((*fDtype)[i]));
1073 //______________________________________________________________________
1074 void AliITS::Hits2SDigits(){
1075 // Standard Hits to summable Digits function.
1081 // return; // Using Hits in place of the larger sDigits.
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.
1086 HitsToSDigits(header->GetEvent(),0,-1," ",fOpt," ");
1088 //______________________________________________________________________
1089 void AliITS::Hits2PreDigits(){
1090 // Standard Hits to summable Digits function.
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.
1100 HitsToPreDigits(header->GetEvent(),0,-1," ",fOpt," ");
1102 //______________________________________________________________________
1103 void AliITS::SDigitsToDigits(Option_t *opt){
1104 // Standard Summable digits to Digits function.
1109 char name[20] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
1111 if(!GetITSgeom()) return; // need transformations to do digitization.
1112 AliITSgeom *geom = GetITSgeom();
1114 const char *all = strstr(opt,"All");
1115 const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
1117 if( !det[0] && !det[1] && !det[2] ) all = "All";
1119 static Bool_t setDef=kTRUE;
1120 if (setDef) SetDefaultSimulation();
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.");
1130 sprintf( name, "%s", this->GetName() );
1131 TBranch *brchSDigits = trees->GetBranch( name );
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();
1140 Error("SDigit2Digits",
1141 "The simulation class was not instanciated!");
1144 sim->InitSimulationModule(module,gAlice->GetEvNumber());
1146 // add summable digits to module
1147 this->GetSDigits()->Clear();
1148 brchSDigits->GetEvent(module);
1149 sim->AddSDigitsToModule(GetSDigits(),0);
1151 // Digitise current module sum(SDigits)->Digits
1152 sim->FinishSDigitiseModule();
1154 // fills all branches - wasted disk space
1155 gAlice->TreeD()->Fill();
1156 this->ResetDigits();
1159 gAlice->TreeD()->GetEntries();
1162 sprintf(hname,"TreeD%d",gAlice->GetEvNumber());
1163 gAlice->TreeD()->Write(hname,TObject::kOverwrite);
1165 gAlice->TreeD()->Reset();
1168 //______________________________________________________________________
1169 void AliITS::Hits2Digits(){
1170 // Standard Hits to Digits function.
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.
1180 HitsToDigits(header->GetEvent(),0,-1," ",fOpt," ");
1182 //______________________________________________________________________
1183 void AliITS::HitsToSDigits(Int_t evNumber,Int_t bgrev,Int_t size,
1184 Option_t *option, Option_t *opt,Text_t *filename){
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 !
1187 // the condition below will disappear when the geom class will be
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
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..
1203 // return; // using Hits instead of the larger sdigits.
1205 HitsToPreDigits(evNumber,bgrev,size,option,opt,filename);
1207 //______________________________________________________________________
1208 void AliITS::HitsToPreDigits(Int_t evNumber,Int_t bgrev,Int_t size,
1209 Option_t *option, Option_t *opt,Text_t *filename){
1210 // Keep galice.root for signal and name differently the file for
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
1213 // initialized for all versions - for the moment it is only for v5 !
1214 // 7 is the SDD beam test version.
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..
1228 if(!GetITSgeom()) return; // need transformations to do digitization.
1229 AliITSgeom *geom = GetITSgeom();
1231 const char *all = strstr(opt,"All");
1232 const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
1234 static Bool_t setDef=kTRUE;
1235 if (setDef) SetDefaultSimulation();
1239 InitModules(size,nmodules);
1240 FillModules(evNumber,bgrev,nmodules,option,filename);
1242 AliITSsimulation *sim = 0;
1243 AliITSDetType *iDetType = 0;
1244 AliITSmodule *mod = 0;
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();
1252 Error("HitsToSDigits",
1253 "The simulation class was not instanciated!");
1256 mod = (AliITSmodule *)fITSmodules->At(module);
1257 sim->SDigitiseModule(mod,module,evNumber);
1258 // fills all branches - wasted disk space
1259 gAlice->TreeS()->Fill();
1265 gAlice->TreeS()->GetEntries();
1268 sprintf(hname,"TreeS%d",evNumber);
1269 gAlice->TreeS()->Write(hname,TObject::kOverwrite);
1271 gAlice->TreeS()->Reset();
1273 //______________________________________________________________________
1274 void AliITS::HitsToDigits(Int_t evNumber,Int_t bgrev,Int_t size,
1275 Option_t *option, Option_t *opt,Text_t *filename){
1276 // Keep galice.root for signal and name differently the file for
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
1279 // initialized for all versions - for the moment it is only for v5 !
1280 // 7 is the SDD beam test version.
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..
1294 if(!GetITSgeom()) return; // need transformations to do digitization.
1295 AliITSgeom *geom = GetITSgeom();
1297 const char *all = strstr(opt,"All");
1298 const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
1300 static Bool_t setDef=kTRUE;
1301 if (setDef) SetDefaultSimulation();
1305 InitModules(size,nmodules);
1306 FillModules(evNumber,bgrev,nmodules,option,filename);
1308 AliITSsimulation *sim = 0;
1309 AliITSDetType *iDetType = 0;
1310 AliITSmodule *mod = 0;
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();
1318 Error("HitsToDigits",
1319 "The simulation class was not instanciated!");
1322 mod = (AliITSmodule *)fITSmodules->At(module);
1323 sim->DigitiseModule(mod,module,evNumber);
1324 // fills all branches - wasted disk space
1325 gAlice->TreeD()->Fill();
1331 gAlice->TreeD()->GetEntries();
1334 sprintf(hname,"TreeD%d",evNumber);
1335 gAlice->TreeD()->Write(hname,TObject::kOverwrite);
1337 gAlice->TreeD()->Reset();
1339 //______________________________________________________________________
1340 void AliITS::ResetSDigits(){
1341 // Reset the Summable Digits array.
1347 if (fSDigits) fSDigits->Clear();
1350 //______________________________________________________________________
1351 void AliITS::ResetDigits(){
1352 // Reset number of digits and the digits array for the ITS detector.
1358 if (!fDtype) return;
1361 for (i=0;i<kNTYPES;i++ ) {
1362 if (fDtype->At(i)) ((TClonesArray*)fDtype->At(i))->Clear();
1363 if (fNdtype) fNdtype[i]=0;
1366 //______________________________________________________________________
1367 void AliITS::ResetDigits(Int_t i){
1368 // Reset number of digits and the digits array for this branch.
1374 if (fDtype->At(i)) ((TClonesArray*)fDtype->At(i))->Clear();
1375 if (fNdtype) fNdtype[i]=0;
1377 //______________________________________________________________________
1378 void AliITS::AddSumDigit(AliITSpListItem &sdig){
1379 // Adds the a module full of summable digits to the summable digits tree.
1381 // AliITSpListItem &sdig SDigit to be added to SDigits tree.
1387 TClonesArray &lsdig = *fSDigits;
1388 new(lsdig[fNSDigits++]) AliITSpListItem(sdig);
1390 //______________________________________________________________________
1391 void AliITS::AddRealDigit(Int_t id, Int_t *digits){
1392 // Add a real digit - as coming from data.
1394 // Int_t id Detector type number.
1395 // Int_t *digits Integer array containing the digits info. See
1402 TClonesArray &ldigits = *((TClonesArray*)fDtype->At(id));
1403 new(ldigits[fNdtype[id]++]) AliITSdigit(digits);
1405 //______________________________________________________________________
1406 void AliITS::AddSimDigit(Int_t id, AliITSdigit *d){
1407 // Add a simulated digit.
1409 // Int_t id Detector type number.
1410 // AliITSdigit *d Digit to be added to the Digits Tree. See
1417 TClonesArray &ldigits = *((TClonesArray*)fDtype->At(id));
1421 new(ldigits[fNdtype[id]++]) AliITSdigitSPD(*((AliITSdigitSPD*)d));
1424 new(ldigits[fNdtype[id]++]) AliITSdigitSDD(*((AliITSdigitSDD*)d));
1427 new(ldigits[fNdtype[id]++]) AliITSdigitSSD(*((AliITSdigitSSD*)d));
1431 //______________________________________________________________________
1432 void AliITS::AddSimDigit(Int_t id,Float_t phys,Int_t *digits,Int_t *tracks,
1433 Int_t *hits,Float_t *charges){
1434 // Add a simulated digit to the list.
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
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.
1451 TClonesArray &ldigits = *((TClonesArray*)fDtype->At(id));
1454 new(ldigits[fNdtype[id]++]) AliITSdigitSPD(digits,tracks,hits);
1457 new(ldigits[fNdtype[id]++]) AliITSdigitSDD(phys,digits,tracks,
1461 new(ldigits[fNdtype[id]++]) AliITSdigitSSD(digits,tracks,hits);
1465 //______________________________________________________________________
1466 void AliITS::MakeTreeC(Option_t *option){
1467 // Create a separate tree to store the clusters.
1469 // Option_t *option string which must contain "C" otherwise
1470 // no Cluster Tree is created.
1476 const char *optC = strstr(option,"C");
1477 if (optC && !fTreeC) fTreeC = new TTree("TC","Clusters in ITS");
1480 Int_t buffersize = 4000;
1481 char branchname[30];
1482 const char *det[3] = {"SPD","SDD","SSD"};
1486 // one branch for Clusters per type of detector
1488 for (i=0; i<kNTYPES ;i++) {
1489 AliITSDetType *iDetType=DetType(i);
1490 iDetType->GetClassNames(digclass,clclass);
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
1500 //______________________________________________________________________
1501 void AliITS::GetTreeC(Int_t event){
1502 // Get the clusters tree for this event and set the branch address.
1504 // Int_t event Event number for the cluster tree.
1510 char branchname[30];
1511 const char *det[3] = {"SPD","SDD","SSD"};
1518 sprintf(treeName,"TreeC%d",event);
1519 fTreeC = (TTree*)gDirectory->Get(treeName);
1527 for (i=0; i<kNTYPES; i++) {
1528 AliITSDetType *iDetType=DetType(i);
1529 iDetType->GetClassNames(digclass,clclass);
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);
1535 branch = fTreeC->GetBranch(branchname);
1536 if (branch) branch->SetAddress(&((*fCtype)[i]));
1540 Error("GetTreeC","cannot find Clusters Tree for event:%d",event);
1543 //______________________________________________________________________
1544 void AliITS::AddCluster(Int_t id, AliITSRawCluster *c){
1545 // Add a cluster to the list.
1547 // Int_t id Detector type number.
1548 // AliITSRawCluster *c Cluster class to be added to the tree of
1555 TClonesArray &lc = *((TClonesArray*)fCtype->At(id));
1559 new(lc[fNctype[id]++]) AliITSRawClusterSPD(*((AliITSRawClusterSPD*)c));
1562 new(lc[fNctype[id]++]) AliITSRawClusterSDD(*((AliITSRawClusterSDD*)c));
1565 new(lc[fNctype[id]++]) AliITSRawClusterSSD(*((AliITSRawClusterSSD*)c));
1569 //______________________________________________________________________
1570 void AliITS::ResetClusters(){
1571 // Reset number of clusters and the clusters array for ITS.
1578 for (i=0;i<kNTYPES;i++ ) ResetClusters(i);
1580 //______________________________________________________________________
1581 void AliITS::ResetClusters(Int_t i){
1582 // Reset number of clusters and the clusters array for this branch.
1584 // Int_t i Detector type number.
1590 if (fCtype->At(i)) ((TClonesArray*)fCtype->At(i))->Clear();
1591 if (fNctype) fNctype[i]=0;
1593 //______________________________________________________________________
1594 void AliITS::MakeBranchR(const char *file){
1595 // Creates Tree branches for the ITS Reconstructed points.
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.
1604 Int_t buffsz = 4000;
1605 char branchname[30];
1607 // only one branch for rec points for all detector types
1608 sprintf(branchname,"%sRecPoints",GetName());
1609 if (fRecPoints && gAlice->TreeR()) {
1610 MakeBranchInTree(gAlice->TreeR(),branchname,&fRecPoints,buffsz,file);
1613 //______________________________________________________________________
1614 void AliITS::SetTreeAddressR(TTree *treeR){
1615 // Set branch address for the Reconstructed points Trees.
1617 // TTree *treeR Tree containing the RecPoints.
1622 char branchname[30];
1626 sprintf(branchname,"%sRecPoints",GetName());
1627 branch = treeR->GetBranch(branchname);
1628 if (branch) branch->SetAddress(&fRecPoints);
1630 //______________________________________________________________________
1631 void AliITS::AddRecPoint(const AliITSRecPoint &r){
1632 // Add a reconstructed space point to the list
1634 // const AliITSRecPoint &r RecPoint class to be added to the tree
1635 // of reconstructed points TreeR.
1641 TClonesArray &lrecp = *fRecPoints;
1642 new(lrecp[fNRecPoints++]) AliITSRecPoint(r);
1644 //______________________________________________________________________
1645 void AliITS::HitsToFastRecPoints(Int_t evNumber,Int_t bgrev,Int_t size,
1646 Option_t *opt0,Option_t *opt1,Text_t *flnm){
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 !
1649 // the condition below will disappear when the geom class will be
1650 // initialized for all versions - for the moment it is only for v5 !
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..
1665 if(!GetITSgeom()) return;
1666 AliITSgeom *geom = GetITSgeom();
1668 const char *all = strstr(opt1,"All");
1669 const char *det[3] ={strstr(opt1,"SPD"),strstr(opt1,"SDD"),
1670 strstr(opt1,"SSD")};
1672 InitModules(size,nmodules);
1673 FillModules(evNumber,bgrev,nmodules,opt0,flnm);
1675 AliITSsimulation *sim = 0;
1676 AliITSDetType *iDetType = 0;
1677 AliITSmodule *mod = 0;
1680 //m.b. : this change is nothing but a nice way to make sure
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();
1688 Error("HitsToFastPoints",
1689 "The simulation class was not instanciated!");
1692 mod = (AliITSmodule *)fITSmodules->At(module);
1693 sim->CreateFastRecPoints(mod,module,gRandom);
1694 gAlice->TreeR()->Fill();
1701 sprintf(hname,"TreeR%d",evNumber);
1702 gAlice->TreeR()->Write(hname,TObject::kOverwrite);
1704 gAlice->TreeR()->Reset();
1706 //______________________________________________________________________
1707 void AliITS::Digits2Reco(){
1708 // Find clusters and reconstruct space points.
1714 AliHeader *header=gAlice->GetHeader();
1715 // to Digits to RecPoints for event in file, all digits in file, and
1716 // all ITS detectors.
1717 DigitsToRecPoints(header->GetEvent(),0,fOpt);
1719 //______________________________________________________________________
1720 void 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
1723 // initialized for all versions - for the moment it is only for v5 !
1724 // 7 is the SDD beam test version
1726 // Int_t evNumber Event number to be processed.
1727 // Int_t lastentry Offset for module when not all of the modules
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.
1737 if(!GetITSgeom()) return;
1738 AliITSgeom *geom = GetITSgeom();
1740 const char *all = strstr(opt,"All");
1741 const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
1743 static Bool_t setRec=kTRUE;
1744 if (setRec) SetDefaultClusterFinders();
1747 TTree *treeC=TreeC();
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);
1760 Error("DigitsToRecPoints",
1761 "The reconstruction class was not instanciated!");
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();
1775 gAlice->TreeR()->GetEntries();
1776 treeC->GetEntries();
1779 sprintf(hname,"TreeR%d",evNumber);
1780 gAlice->TreeR()->Write(hname,TObject::kOverwrite);
1782 gAlice->TreeR()->Reset();
1784 sprintf(hname,"TreeC%d",evNumber);
1785 treeC->Write(hname,TObject::kOverwrite);
1788 //______________________________________________________________________
1789 void AliITS::ResetRecPoints(){
1790 // Reset number of rec points and the rec points array.
1796 if (fRecPoints) fRecPoints->Clear();