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.68 2002/05/02 18:51:53 nilsen
20 Method MakeBranchR has now a second argument, with a default value:
21 Option_t *opt=" ". Opt="Fast" is to create a separate branch
22 for fast points in TreeR
23 New method MakeBranchRF: it a separate branch in TreeR for Fast Points
26 1) TTree->Write() replaced with TTree->AutoSave for TreeS, TreeD and
28 2) Changes in MakeBranchR to allow the creation of a special branch
31 Revision 1.67 2002/03/15 17:22:51 nilsen
32 Intoduced SDigits2Digits and SDigitsToDigits functions.
34 Revision 1.66 2001/11/28 01:35:45 nilsen
35 Using standard constructors instead of default constructors for Clusterfinder,
36 Response, and FastSimulator.
38 Revision 1.65 2001/11/27 16:27:28 nilsen
39 Adding AliITSDigitizer class to do merging and digitization . Based on the
40 TTask method. AliITSDigitizer class added to the Makefile and ITSLinkDef.h
41 file. The following files required minor changes. AliITS, added functions
42 SetHitsAddressBranch, MakeBranchInTreeD and modified MakeBranchD.
43 AliITSsimulationSDD.cxx needed a Tree indepenent way of returning back to
44 the original Root Directory in function Compress1D. Now it uses gDirectory.
46 Revision 1.64 2001/11/19 16:17:02 nilsen
47 Applyed fixes to bugs found by Rene Brun. With many thanks. Some additonal
48 bugs found by Rene require more work to fix. Will be fixed soon.
50 Revision 1.63 2001/10/24 21:16:34 nilsen
51 Removed some dead code and improved comments/documntation.
53 Revision 1.62 2001/10/21 19:23:21 nilsen
54 Added function to allow to limit which detectors to digitize and reconstruct.
55 The default is All. This change makes no changes to any root file.
57 Revision 1.61 2001/10/11 15:26:07 mariana
58 Correct HitsToFastRecPoints
60 Revision 1.60 2001/10/04 22:38:10 nilsen
61 Changes made to support PreDigits (SDigits) plus other helpful changes.
63 Revision 1.59 2001/08/30 09:56:18 hristov
64 The operator[] is replaced by At() or AddAt() in case of TObjArray.
66 Revision 1.58 2001/07/26 15:05:29 hristov
67 Use global gRandom generator (M.Ivanov)
69 Revision 1.57 2001/07/24 14:26:11 mariana
70 Introduce the function Digits2Reco() and write the defaults for simulation and reconstruction
72 Revision 1.56 2001/07/05 12:49:49 mariana
73 Temporary patches required by root.v3.01.05
75 Revision 1.55 2001/06/14 14:59:00 barbera
76 Tracking V1 decoupled from AliITS
78 Revision 1.54 2001/05/31 20:37:56 barbera
79 Bari/Salerno model set as defaault SPD simulation
81 Revision 1.53 2001/05/31 18:52:24 barbera
82 Bari model becomes the default
84 Revision 1.53 2001/05/30 07:52:24 hristov
85 TPC and CONTAINERS included in the search path
87 Revision 1.52 2001/05/30 06:04:58 hristov
88 Changes made to be consitant with changes in TPC tracking classes (B.Nilsen)
90 Revision 1.51 2001/05/16 14:57:15 alibrary
91 New files for folders and Stack
93 Revision 1.50 2001/05/11 09:15:21 barbera
94 Corrected to make fast point creation working with PPR geometry
96 Revision 1.49 2001/05/11 07:37:49 hristov
97 Legacy lines commented
99 Revision 1.48 2001/05/10 18:14:25 barbera
102 Revision 1.47 2001/05/10 17:55:59 barbera
103 Modified to create rec points also for PPR geometries
105 Revision 1.46 2001/05/10 00:05:28 nilsen
106 Allowed for HitsToDigits function to work with versions 5, 7, 8, and 9. This
107 should probably be cleaned up to only check to make sure that fITSgeom has
108 been properly defined.
110 Revision 1.45 2001/05/01 22:35:48 nilsen
111 Remove/commented a number of cout<< statements. and made change needed by
114 Revision 1.44 2001/04/26 22:44:01 nilsen
115 Removed dependence on layer 5/6 in AliITS::HitsToDigits. This will be
116 done properly in AliITSv???.cxx via SetDefaults.
118 Revision 1.43 2001/04/26 13:22:52 barbera
119 TMatrix and TVector elimininated to speed up the code
121 Revision 1.42 2001/04/25 21:55:12 barbera
122 Updated version to be compatible with actual verion of STEER and TPC
124 Revision 1.41 2001/04/21 15:16:51 barbera
125 Updated with the new SSD reconstruction code
127 Revision 1.40 2001/03/17 15:07:06 mariana
128 Update SDD response parameters
130 Revision 1.39 2001/03/12 17:45:32 hristov
131 Changes needed on Sun with CC 5.0
133 Revision 1.38 2001/03/07 14:04:51 barbera
134 Some vector dimensions increased to cope with full events
136 Revision 1.37 2001/03/07 12:36:35 barbera
137 A change added in the tracking part to manage delta rays
139 Revision 1.36 2001/03/02 19:44:11 barbera
140 modified to taking into account new version tracking v1
142 Revision 1.35 2001/02/28 18:16:46 mariana
143 Make the code compatible with the new AliRun
145 Revision 1.34 2001/02/11 15:51:39 mariana
146 Set protection in MakeBranch
148 Revision 1.33 2001/02/10 22:26:39 mariana
149 Move the initialization of the containers for raw clusters in MakeTreeC()
151 Revision 1.32 2001/02/08 23:55:31 nilsen
152 Removed fMajor/MinorVersion variables in favor of variables in derived classes.
153 Set arrays char *det[3] = {"SPD","SDD","SSD"} as const.
155 Revision 1.31 2001/02/02 23:57:28 nilsen
156 Added include file that are no londer included in AliITSgeom.h
158 Revision 1.30 2001/01/30 09:23:13 hristov
159 Streamers removed (R.Brun)
161 Revision 1.29 2001/01/26 20:01:09 hristov
162 Major upgrade of AliRoot code
164 Revision 1.28 2000/12/18 14:02:00 barbera
165 new version of the ITS tracking to take into account the new TPC track parametrization
167 Revision 1.27 2000/12/08 13:49:27 barbera
168 Hidden declaration in a for loop removed to be compliant with HP-UX compiler
170 Revision 1.26 2000/11/27 13:12:13 barbera
171 New version containing the files for tracking
173 Revision 1.25 2000/11/12 22:38:05 barbera
174 Added header file for the SPD Bari model
176 Revision 1.24 2000/10/09 22:18:12 barbera
177 Bug fixes from MAriana to le AliITStest.C run correctly
179 Revision 1.23 2000/10/05 20:47:42 nilsen
180 fixed dependencies of include files. Tryed but failed to get a root automaticly
181 generates streamer function to work. Modified SetDefaults.
183 Revision 1.9.2.15 2000/10/04 16:56:40 nilsen
184 Needed to include stdlib.h
187 Revision 1.22 2000/10/04 19:45:52 barbera
188 Corrected by F. Carminati for v3.04
190 Revision 1.21 2000/10/02 21:28:08 fca
191 Removal of useless dependecies via forward declarations
193 Revision 1.20 2000/10/02 16:31:39 barbera
194 General code clean-up
196 Revision 1.9.2.14 2000/10/02 15:43:51 barbera
197 General code clean-up (e.g., printf -> cout)
199 Revision 1.19 2000/09/22 12:13:25 nilsen
200 Patches and updates for fixes to this and other routines.
202 Revision 1.18 2000/07/12 05:32:20 fca
203 Correcting several syntax problem with static members
205 Revision 1.17 2000/07/10 16:07:18 fca
206 Release version of ITS code
208 Revision 1.9.2.3 2000/02/02 13:42:09 barbera
209 fixed AliITS.cxx for new AliRun structure. Added ITS hits list to list of hits which will have their track numbers updated
211 Revision 1.9.2.2 2000/01/23 03:03:13 nilsen
212 //fixed FillModule. Removed fi(fabs(xl)<dx....
214 Revision 1.9.2.1 2000/01/12 19:03:32 nilsen
215 This is the version of the files after the merging done in December 1999.
216 See the ReadMe110100.txt file for details
218 Revision 1.9 1999/11/14 14:33:25 fca
219 Correct problems with distructors and pointers, thanks to I.Hrivnacova
221 Revision 1.8 1999/09/29 09:24:19 fca
222 Introduction of the Copyright and cvs Log
226 ///////////////////////////////////////////////////////////////////////////////
228 // An overview of the basic philosophy of the ITS code development
229 // and analysis is show in the figure below.
232 <img src="picts/ITS/ITS_Analysis_schema.gif">
235 <font size=+2 color=red>
236 <p>Roberto Barbera is in charge of the ITS Offline code (1999).
237 <a href="mailto:roberto.barbera@ct.infn.it">Roberto Barbera</a>.
243 // AliITS. Inner Traking System base class.
244 // This class contains the base procedures for the Inner Tracking System
248 <img src="picts/ITS/AliITS_Class_Diagram.gif">
251 <font size=+2 color=red>
252 <p>This show the class diagram of the different elements that are part of
260 // Written by Rene Brun, Federico Carminati, and Roberto Barbera
263 // Modified and documented by Bjorn S. Nilsen
267 // Modified and documented by A. Bologna
270 // AliITS is the general base class for the ITS. Also see AliDetector for
271 // futher information.
273 ///////////////////////////////////////////////////////////////////////////////
274 #include <iostream.h>
282 #include <TClonesArray.h>
284 #include <TObjectTable.h>
290 #include "AliHeader.h"
293 #include "AliITSDetType.h"
294 #include "AliITSresponseSPD.h"
295 #include "AliITSresponseSDD.h"
296 #include "AliITSresponseSSD.h"
297 #include "AliITSsegmentationSPD.h"
298 #include "AliITSsegmentationSDD.h"
299 #include "AliITSsegmentationSSD.h"
300 #include "AliITSsimulationSPD.h"
301 #include "AliITSsimulationSDD.h"
302 #include "AliITSsimulationSSD.h"
303 #include "AliITSClusterFinderSPD.h"
304 #include "AliITSClusterFinderSDD.h"
305 #include "AliITSClusterFinderSSD.h"
306 #include "AliITShit.h"
307 #include "AliITSgeom.h"
308 #include "AliITSpList.h"
309 #include "AliITSdigit.h"
310 #include "AliITSmodule.h"
311 #include "AliITSRecPoint.h"
312 #include "AliITSRawCluster.h"
316 //______________________________________________________________________
317 AliITS::AliITS() : AliDetector() {
318 // Default initializer for ITS
319 // The default constructor of the AliITS class. In addition to
320 // creating the AliITS class it zeros the variables fIshunt (a member
321 // of AliDetector class), fEuclidOut, and fIdN, and zeros the pointers
322 // fITSpoints, fIdSens, and fIdName. The AliDetector default constructor
331 fIshunt = 0; // not zeroed in AliDetector.
338 // SetDetectors(); // default to fOpt="All". This variable not written out.
344 fNDetTypes = kNTYPES;
360 SetMarkerColor(kRed);
362 //______________________________________________________________________
363 AliITS::AliITS(const char *name, const char *title):AliDetector(name,title){
364 // The standard Constructor for the ITS class. In addition to
365 // creating the AliITS class, it allocates memory for the TClonesArrays
366 // fHits, fSDigits, fDigits, fITSpoints, and the TObjArray of fCtype
367 // (clusters). It also zeros the variables
368 // fIshunt (a member of AliDetector class), fEuclidOut, and fIdN, and zeros
369 // the pointers fIdSens and fIdName. To help in displaying hits via the
370 // ROOT macro display.C AliITS also sets the marker color to red. The
371 // variables passes with this constructor, const char *name and *title,
372 // are used by the constructor of AliDetector class. See AliDetector
373 // class for a description of these parameters and its constructor
376 // const char *name Detector name. Should always be "ITS"
377 // const char *title Detector title.
383 fIshunt = 0; // not zeroed in AliDetector
384 fHits = new TClonesArray("AliITShit", 1560);//not done in AliDetector
385 gAlice->AddHitList(fHits); // Not done in AliDetector.
390 SetDetectors(); // default to fOpt="All". This variable not written out.
396 fNDetTypes = kNTYPES;
397 fDetTypes = new TObjArray(fNDetTypes);
399 fSDigits = new TClonesArray("AliITSpListItem",1000);
402 fNdtype = new Int_t[fNDetTypes];
403 fDtype = new TObjArray(fNDetTypes);
405 fCtype = new TObjArray(fNDetTypes);
406 fNctype = new Int_t[fNDetTypes];
409 fRecPoints = new TClonesArray("AliITSRecPoint",1000);
413 for(i=0;i<fNDetTypes;i++) {
414 fDetTypes->AddAt(new AliITSDetType(),i);
419 SetMarkerColor(kRed);
421 //______________________________________________________________________
423 // Default destructor for ITS.
424 // The default destructor of the AliITS class. In addition to deleting
425 // the AliITS class it deletes the memory pointed to by the fHits, fDigits,
426 // fSDigits, fCtype, fITSmodules, fITSgeom, fRecPoints, fIdSens, fIdName,
427 // fITSpoints, fDetType and it's contents.
439 if(fIdName!=0) delete[] fIdName; // Array of TStrings
440 if(fIdSens!=0) delete[] fIdSens;
442 this->ClearModules();
444 }// end if fITSmodules!=0
460 } // end if fDetTypes
462 if (fTreeC) delete fTreeC;
464 if (fITSgeom) delete fITSgeom;
466 //______________________________________________________________________
467 AliITS::AliITS(AliITS &source){
468 // Copy constructor. 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;
478 Error("Copy constructor",
479 "You are not allowed to make a copy of the AliITS");
482 //______________________________________________________________________
483 AliITS& AliITS::operator=(AliITS &source){
484 // Assignment operator. This is a function which is not allowed to be
485 // done to the ITS. It exits with an error.
487 // AliITS &source An AliITS class.
493 if(this==&source) return *this;
494 Error("operator=","You are not allowed to make a copy of the AliITS");
496 return *this; //fake return
498 //______________________________________________________________________
499 Int_t AliITS::DistancetoPrimitive(Int_t,Int_t){
500 // Distance from mouse to ITS on the screen. Dummy routine
501 // A dummy routine used by the ROOT macro display.C to allow for the
502 // use of the mouse (pointing device) in the macro. In general this should
503 // never be called. If it is it returns the number 9999 for any value of
506 // Int_t Dummy screen coordinate.
507 // Int_t Dummy screen coordinate.
511 // Int_t Dummy = 9999 distance to ITS.
515 //______________________________________________________________________
517 // Initializer ITS after it has been built
518 // This routine initializes the AliITS class. It is intended to be
519 // called from the Init function in AliITSv?. Besides displaying a banner
520 // indicating that it has been called it initializes the array fIdSens
521 // and sets the default segmentation, response, digit and raw cluster
522 // classes therefore it should be called after a call to CreateGeometry.
533 for(i=0;i<fIdN;i++) fIdSens[i] = gMC->VolId(fIdName[i]);
535 //______________________________________________________________________
536 void AliITS::SetDefaults(){
537 // sets the default segmentation, response, digit and raw cluster classes.
545 if(fDebug) printf("%s: SetDefaults\n",ClassName());
547 AliITSDetType *iDetType;
551 if (!iDetType->GetSegmentationModel()) {
552 AliITSsegmentationSPD *seg0=new AliITSsegmentationSPD(fITSgeom);
553 SetSegmentationModel(0,seg0);
555 if (!iDetType->GetResponseModel()) {
556 SetResponseModel(0,new AliITSresponseSPD());
558 // set digit and raw cluster classes to be used
560 const char *kData0=(iDetType->GetResponseModel())->DataType();
561 if (strstr(kData0,"real")) {
562 iDetType->ClassNames("AliITSdigit","AliITSRawClusterSPD");
563 } else iDetType->ClassNames("AliITSdigitSPD","AliITSRawClusterSPD");
567 if (!iDetType->GetResponseModel()) {
568 SetResponseModel(1,new AliITSresponseSDD("simulated"));
570 AliITSresponse *resp1=iDetType->GetResponseModel();
571 if (!iDetType->GetSegmentationModel()) {
572 AliITSsegmentationSDD *seg1=new AliITSsegmentationSDD(fITSgeom,resp1);
573 SetSegmentationModel(1,seg1);
575 const char *kData1=(iDetType->GetResponseModel())->DataType();
576 const char *kopt=iDetType->GetResponseModel()->ZeroSuppOption();
577 if((!strstr(kopt,"2D"))&&(!strstr(kopt,"1D")) || strstr(kData1,"real") ){
578 iDetType->ClassNames("AliITSdigit","AliITSRawClusterSDD");
579 } else iDetType->ClassNames("AliITSdigitSDD","AliITSRawClusterSDD");
583 if (!iDetType->GetSegmentationModel()) {
584 AliITSsegmentationSSD *seg2=new AliITSsegmentationSSD(fITSgeom);
585 SetSegmentationModel(2,seg2);
587 if (!iDetType->GetResponseModel()) {
588 SetResponseModel(2,new AliITSresponseSSD("simulated"));
590 const char *kData2=(iDetType->GetResponseModel())->DataType();
591 if (strstr(kData2,"real")) {
592 iDetType->ClassNames("AliITSdigit","AliITSRawClusterSSD");
593 } else iDetType->ClassNames("AliITSdigitSSD","AliITSRawClusterSSD");
596 Warning("SetDefaults",
597 "Only the three basic detector types are initialized!");
600 //______________________________________________________________________
601 void AliITS::SetDefaultSimulation(){
602 // sets the default simulation.
610 AliITSDetType *iDetType;
611 AliITSsimulation *sim;
613 sim = iDetType->GetSimulationModel();
615 AliITSsegmentation *seg0=
616 (AliITSsegmentation*)iDetType->GetSegmentationModel();
617 AliITSresponse *res0 = (AliITSresponse*)iDetType->GetResponseModel();
618 AliITSsimulationSPD *sim0=new AliITSsimulationSPD(seg0,res0);
619 SetSimulationModel(0,sim0);
620 }else{ // simulation exists, make sure it is set up properly.
621 ((AliITSsimulationSPD*)sim)->Init(
622 (AliITSsegmentationSPD*) iDetType->GetSegmentationModel(),
623 (AliITSresponseSPD*) iDetType->GetResponseModel());
624 // if(sim->GetResponseModel()==0) sim->SetResponseModel(
625 // (AliITSresponse*)iDetType->GetResponseModel());
626 // if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel(
627 // (AliITSsegmentation*)iDetType->GetSegmentationModel());
630 sim = iDetType->GetSimulationModel();
632 AliITSsegmentation *seg1=
633 (AliITSsegmentation*)iDetType->GetSegmentationModel();
634 AliITSresponse *res1 = (AliITSresponse*)iDetType->GetResponseModel();
635 AliITSsimulationSDD *sim1=new AliITSsimulationSDD(seg1,res1);
636 SetSimulationModel(1,sim1);
637 }else{ // simulation exists, make sure it is set up properly.
638 ((AliITSsimulationSDD*)sim)->Init(
639 (AliITSsegmentationSDD*) iDetType->GetSegmentationModel(),
640 (AliITSresponseSDD*) iDetType->GetResponseModel());
641 // if(sim->GetResponseModel()==0) sim->SetResponseModel(
642 // (AliITSresponse*)iDetType->GetResponseModel());
643 // if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel(
644 // (AliITSsegmentation*)iDetType->GetSegmentationModel());
647 sim = iDetType->GetSimulationModel();
649 AliITSsegmentation *seg2=
650 (AliITSsegmentation*)iDetType->GetSegmentationModel();
651 AliITSresponse *res2 = (AliITSresponse*)iDetType->GetResponseModel();
652 AliITSsimulationSSD *sim2=new AliITSsimulationSSD(seg2,res2);
653 SetSimulationModel(2,sim2);
654 }else{ // simulation exists, make sure it is set up properly.
655 ((AliITSsimulationSSD*)sim)->Init(
656 (AliITSsegmentationSSD*) iDetType->GetSegmentationModel(),
657 (AliITSresponseSSD*) iDetType->GetResponseModel());
658 // if(sim->GetResponseModel()==0) sim->SetResponseModel(
659 // (AliITSresponse*)iDetType->GetResponseModel());
660 // if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel(
661 // (AliITSsegmentation*)iDetType->GetSegmentationModel());
664 //______________________________________________________________________
665 void AliITS::SetDefaultClusterFinders(){
666 // Sets the default cluster finders. Used in finding RecPoints.
675 AliITSDetType *iDetType;
679 if (!iDetType->GetReconstructionModel()) {
680 AliITSsegmentation *seg0 =
681 (AliITSsegmentation*)iDetType->GetSegmentationModel();
682 TClonesArray *dig0=DigitsAddress(0);
683 TClonesArray *recp0=ClustersAddress(0);
684 AliITSClusterFinderSPD *rec0 = new AliITSClusterFinderSPD(seg0,dig0,
686 SetReconstructionModel(0,rec0);
691 if (!iDetType->GetReconstructionModel()) {
692 AliITSsegmentation *seg1 =
693 (AliITSsegmentation*)iDetType->GetSegmentationModel();
694 AliITSresponse *res1 = (AliITSresponse*)iDetType->GetResponseModel();
695 TClonesArray *dig1=DigitsAddress(1);
696 TClonesArray *recp1=ClustersAddress(1);
697 AliITSClusterFinderSDD *rec1 =
698 new AliITSClusterFinderSDD(seg1,res1,dig1,recp1);
699 SetReconstructionModel(1,rec1);
704 if (!iDetType->GetReconstructionModel()) {
705 AliITSsegmentation *seg2=
706 (AliITSsegmentation*)iDetType->GetSegmentationModel();
707 TClonesArray *dig2=DigitsAddress(2);
708 AliITSClusterFinderSSD *rec2= new AliITSClusterFinderSSD(seg2,dig2);
709 SetReconstructionModel(2,rec2);
712 //______________________________________________________________________
713 void AliITS::MakeBranch(Option_t* option, const char *file){
714 // Creates Tree branches for the ITS.
716 // Option_t *option String of Tree types S,D, and/or R.
717 // const char *file String of the file name where these branches
718 // are to be stored. If blank then these branches
719 // are written to the same tree as the Hits were
725 Bool_t cS = (strstr(option,"S")!=0);
726 Bool_t cD = (strstr(option,"D")!=0);
727 Bool_t cR = (strstr(option,"R")!=0);
728 Bool_t cRF = (strstr(option,"RF")!=0);
731 AliDetector::MakeBranch(option,file);
733 if(cS) MakeBranchS(file);
734 if(cD) MakeBranchD(file);
735 if(cR) MakeBranchR(file);
736 if(cRF) MakeBranchRF(file);
738 //______________________________________________________________________
739 void AliITS::SetTreeAddress(){
740 // Set branch address for the Trees.
747 TTree *treeS = gAlice->TreeS();
748 TTree *treeD = gAlice->TreeD();
749 TTree *treeR = gAlice->TreeR();
751 AliDetector::SetTreeAddress();
753 SetTreeAddressS(treeS);
754 SetTreeAddressD(treeD);
755 SetTreeAddressR(treeR);
757 //______________________________________________________________________
758 AliITSDetType* AliITS::DetType(Int_t id){
759 // Return pointer to id detector type.
761 // Int_t id detector id number.
765 // returned, a pointer to a AliITSDetType.
767 return ((AliITSDetType*) fDetTypes->At(id));
769 //______________________________________________________________________
770 void AliITS::SetResponseModel(Int_t id, AliITSresponse *response){
771 // Set the response model for the id detector type.
773 // Int_t id detector id number.
774 // AliITSresponse* a pointer containing an instance of AliITSresponse
775 // to be stored/owned b y AliITSDetType.
781 ((AliITSDetType*) fDetTypes->At(id))->ResponseModel(response);
783 //______________________________________________________________________
784 void AliITS::SetSegmentationModel(Int_t id, AliITSsegmentation *seg){
785 // Set the segmentation model for the id detector type.
787 // Int_t id detector id number.
788 // AliITSsegmentation* a pointer containing an instance of
789 // AliITSsegmentation to be stored/owned b y
796 ((AliITSDetType*) fDetTypes->At(id))->SegmentationModel(seg);
798 //______________________________________________________________________
799 void AliITS::SetSimulationModel(Int_t id, AliITSsimulation *sim){
800 // Set the simulation model for the id detector type.
802 // Int_t id detector id number.
803 // AliITSresponse* a pointer containing an instance of AliITSresponse
804 // to be stored/owned b y AliITSDetType.
810 ((AliITSDetType*) fDetTypes->At(id))->SimulationModel(sim);
813 //______________________________________________________________________
814 void AliITS::SetReconstructionModel(Int_t id, AliITSClusterFinder *reconst){
815 // Set the cluster finder model for the id detector type.
817 // Int_t id detector id number.
818 // AliITSClusterFinder* a pointer containing an instance of
819 // AliITSClusterFinder to be stored/owned b y
826 ((AliITSDetType*) fDetTypes->At(id))->ReconstructionModel(reconst);
828 //______________________________________________________________________
829 void AliITS::SetClasses(Int_t id, const char *digit, const char *cluster){
830 // Set the digit and cluster classes name to be used for the id detector
833 // Int_t id detector id number.
834 // const char *digit Digit class name for detector id.
835 // const char *cluster Cluster class name for detector id.
841 ((AliITSDetType*) fDetTypes->At(id))->ClassNames(digit,cluster);
843 //______________________________________________________________________
844 void AliITS::AddHit(Int_t track, Int_t *vol, Float_t *hits){
846 // The function to add information to the AliITShit class. See the
847 // AliITShit class for a full description. This function allocates the
848 // necessary new space for the hit information and passes the variable
849 // track, and the pointers *vol and *hits to the AliITShit constructor
852 // Int_t track Track number which produced this hit.
853 // Int_t *vol Array of Integer Hit information. See AliITShit.h
854 // Float_t *hits Array of Floating Hit information. see AliITShit.h
860 TClonesArray &lhits = *fHits;
861 new(lhits[fNhits++]) AliITShit(fIshunt,track,vol,hits);
863 //______________________________________________________________________
864 void AliITS::InitModules(Int_t size,Int_t &nmodules){
865 // Initialize the modules array.
867 // Int_t size Size of array of the number of modules to be
868 // created. If size <=0 then the number of modules
869 // is gotten from AliITSgeom class kept in fITSgeom.
871 // Int_t &nmodules The number of modules existing.
876 fITSmodules->Delete();
878 } // end fir fITSmoudles
880 Int_t nl,indexMAX,index;
882 if(size<=0){ // default to using data stored in AliITSgeom
884 Error("InitModules","fITSgeom not defined");
886 } // end if fITSgeom==0
887 nl = fITSgeom->GetNlayers();
888 indexMAX = fITSgeom->GetModuleIndex(nl,fITSgeom->GetNladders(nl),
889 fITSgeom->GetNdetectors(nl))+1;
891 fITSmodules = new TObjArray(indexMAX);
892 for(index=0;index<indexMAX;index++){
893 fITSmodules->AddAt( new AliITSmodule(index),index);
896 fITSmodules = new TObjArray(size);
897 for(index=0;index<size;index++) {
898 fITSmodules->AddAt( new AliITSmodule(index),index);
904 //______________________________________________________________________
905 void AliITS::FillModules(Int_t evnt,Int_t bgrev,Int_t nmodules,
906 Option_t *option,Text_t *filename){
907 // fill the modules with the sorted by module hits; add hits from
908 // background if option=Add.
910 // Int_t evnt Event to be processed.
911 // Int_t bgrev Background Hit tree number.
912 // Int_t nmodules Not used.
913 // Option_t *option String indicating if merging hits or not. To
914 // merge hits set equal to "Add". Otherwise no
915 // background hits are considered.
916 // Test_t *filename File name containing the background hits..
921 static TTree *trH1; //Tree with background hits
922 static TClonesArray *fHits2; //List of hits for one track only
923 static Bool_t first=kTRUE;
925 const char *addBgr = strstr(option,"Add");
929 file=new TFile(filename);
930 fHits2 = new TClonesArray("AliITShit",1000 );
935 // Get Hits Tree header from file
936 if(fHits2) fHits2->Clear();
937 if(trH1) delete trH1;
941 sprintf(treeName,"TreeH%d",bgrev);
942 trH1 = (TTree*)gDirectory->Get(treeName);
944 Error("FillModules","cannot find Hits Tree for event:%d",bgrev);
946 // Set branch addresses
949 sprintf(branchname,"%s",GetName());
950 if (trH1 && fHits2) {
951 branch = trH1->GetBranch(branchname);
952 if (branch) branch->SetAddress(&fHits2);
953 } // end if trH1 && fHits
956 TClonesArray *itsHits = this->Hits();
957 Int_t lay,lad,det,index;
960 TTree *iTH = gAlice->TreeH();
961 Int_t ntracks =(Int_t) iTH->GetEntries();
963 for(t=0; t<ntracks; t++){
966 Int_t nhits = itsHits->GetEntriesFast();
967 if (!nhits) continue;
968 for(h=0; h<nhits; h++){
969 itsHit = (AliITShit *)itsHits->UncheckedAt(h);
970 itsHit->GetDetectorID(lay,lad,det);
971 // temporarily index=det-1 !!!
972 if(fITSgeom) index = fITSgeom->GetModuleIndex(lay,lad,det);
975 mod = this->GetModule(index);
976 mod->AddHit(itsHit,t,h);
977 } // end loop over hits
978 } // end loop over tracks
980 // open the file with background
984 ntracks =(Int_t)trH1->GetEntries();
986 for (track=0; track<ntracks; track++) {
987 if (fHits2) fHits2->Clear();
988 trH1->GetEvent(track);
990 for(i=0;i<fHits2->GetEntriesFast();++i) {
991 itsHit=(AliITShit*) (*fHits2)[i];
992 itsHit->GetDetectorID(lay,lad,det);
993 // temporarily index=det-1 !!!
994 if(fITSgeom) index = fITSgeom->GetModuleIndex(lay,lad,det);
997 mod = this->GetModule(index);
998 mod->AddHit(itsHit,track,i);
999 } // end loop over hits
1000 } // end loop over tracks
1001 TTree *fAli=gAlice->TreeK();
1003 if (fAli) fileAli =fAli->GetCurrentFile();
1007 //______________________________________________________________________
1008 void AliITS::ClearModules(){
1009 // Clear the modules TObjArray.
1015 if(fITSmodules) fITSmodules->Delete();
1017 //______________________________________________________________________
1018 void AliITS::MakeBranchS(const char *fl){
1019 // Creates Tree Branch for the ITS summable digits.
1021 // cont char *fl File name where SDigits branch is to be written
1022 // to. If blank it write the SDigits to the same
1023 // file in which the Hits were found.
1028 Int_t buffersize = 4000;
1029 char branchname[30];
1031 // only one branch for SDigits.
1032 sprintf(branchname,"%s",GetName());
1033 if(fSDigits && gAlice->TreeS()){
1034 MakeBranchInTree(gAlice->TreeS(),branchname,&fSDigits,buffersize,fl);
1037 //______________________________________________________________________
1038 void AliITS::SetTreeAddressS(TTree *treeS){
1039 // Set branch address for the ITS summable digits Trees.
1041 // TTree *treeS Tree containing the SDigits.
1046 char branchname[30];
1050 sprintf(branchname,"%s",GetName());
1051 branch = treeS->GetBranch(branchname);
1052 if (branch) branch->SetAddress(&fSDigits);
1054 //______________________________________________________________________
1055 void AliITS::MakeBranchInTreeD(TTree *treeD,const char *file){
1056 // Creates Tree branches for the ITS.
1058 // TTree *treeD Pointer to the Digits Tree.
1059 // cont char *file File name where Digits branch is to be written
1060 // to. If blank it write the SDigits to the same
1061 // file in which the Hits were found.
1066 Int_t buffersize = 4000;
1067 char branchname[30];
1069 sprintf(branchname,"%s",GetName());
1070 // one branch for digits per type of detector
1071 const char *det[3] = {"SPD","SDD","SSD"};
1075 for (i=0; i<kNTYPES ;i++) {
1076 DetType(i)->GetClassNames(digclass,clclass);
1078 if(!(fDtype->At(i))) fDtype->AddAt(new TClonesArray(digclass,1000),i);
1079 else ResetDigits(i);
1081 for (i=0; i<kNTYPES ;i++) {
1082 if (kNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]);
1083 else sprintf(branchname,"%sDigits%d",GetName(),i+1);
1084 if (fDtype && treeD) {
1085 MakeBranchInTree(treeD,
1086 branchname, &((*fDtype)[i]),buffersize,file);
1090 //______________________________________________________________________
1091 void AliITS::SetTreeAddressD(TTree *treeD){
1092 // Set branch address for the Trees.
1094 // TTree *treeD Tree containing the Digits.
1099 char branchname[30];
1100 const char *det[3] = {"SPD","SDD","SSD"};
1107 for (i=0; i<kNTYPES; i++) {
1108 DetType(i)->GetClassNames(digclass,clclass);
1110 if(!(fDtype->At(i))) fDtype->AddAt(new TClonesArray(digclass,1000),i);
1111 else ResetDigits(i);
1112 if (kNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]);
1113 else sprintf(branchname,"%sDigits%d",GetName(),i+1);
1115 branch = treeD->GetBranch(branchname);
1116 if (branch) branch->SetAddress(&((*fDtype)[i]));
1120 //______________________________________________________________________
1121 void AliITS::Hits2SDigits(){
1122 // Standard Hits to summable Digits function.
1128 // return; // Using Hits in place of the larger sDigits.
1129 AliHeader *header=gAlice->GetHeader(); // Get event number from this file.
1130 // Do the Hits to Digits operation. Use Standard input values.
1131 // Event number from file, no background hit merging , use size from
1132 // AliITSgeom class, option="All", input from this file only.
1133 HitsToSDigits(header->GetEvent(),0,-1," ",fOpt," ");
1135 //______________________________________________________________________
1136 void AliITS::Hits2PreDigits(){
1137 // Standard Hits to summable Digits function.
1143 AliHeader *header=gAlice->GetHeader(); // Get event number from this file.
1144 // Do the Hits to Digits operation. Use Standard input values.
1145 // Event number from file, no background hit merging , use size from
1146 // AliITSgeom class, option="All", input from this file only.
1147 HitsToPreDigits(header->GetEvent(),0,-1," ",fOpt," ");
1149 //______________________________________________________________________
1150 void AliITS::SDigitsToDigits(Option_t *opt){
1151 // Standard Summable digits to Digits function.
1156 char name[20] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
1158 if(!GetITSgeom()) return; // need transformations to do digitization.
1159 AliITSgeom *geom = GetITSgeom();
1161 const char *all = strstr(opt,"All");
1162 const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
1164 if( !det[0] && !det[1] && !det[2] ) all = "All";
1166 static Bool_t setDef=kTRUE;
1167 if (setDef) SetDefaultSimulation();
1170 AliITSsimulation *sim = 0;
1171 AliITSDetType *iDetType = 0;
1172 TTree *trees = gAlice->TreeS();
1173 if( !(trees && this->GetSDigits()) ){
1174 Error("SDigits2Digits","Error: No trees or SDigits. Returning.");
1177 sprintf( name, "%s", this->GetName() );
1178 TBranch *brchSDigits = trees->GetBranch( name );
1181 for(module=0;module<geom->GetIndexMax();module++){
1182 id = geom->GetModuleType(module);
1183 if (!all && !det[id]) continue;
1184 iDetType = DetType(id);
1185 sim = (AliITSsimulation*)iDetType->GetSimulationModel();
1187 Error("SDigit2Digits",
1188 "The simulation class was not instanciated!");
1191 sim->InitSimulationModule(module,gAlice->GetEvNumber());
1193 // add summable digits to module
1194 this->GetSDigits()->Clear();
1195 brchSDigits->GetEvent(module);
1196 sim->AddSDigitsToModule(GetSDigits(),0);
1198 // Digitise current module sum(SDigits)->Digits
1199 sim->FinishSDigitiseModule();
1201 // fills all branches - wasted disk space
1202 gAlice->TreeD()->Fill();
1203 this->ResetDigits();
1206 gAlice->TreeD()->GetEntries();
1209 sprintf(hname,"TreeD%d",gAlice->GetEvNumber());
1210 gAlice->TreeD()->Write(hname,TObject::kOverwrite);
1212 gAlice->TreeD()->AutoSave();
1214 gAlice->TreeD()->Reset();
1217 //______________________________________________________________________
1218 void AliITS::Hits2Digits(){
1219 // Standard Hits to Digits function.
1225 AliHeader *header=gAlice->GetHeader(); // Get event number from this file.
1226 // Do the Hits to Digits operation. Use Standard input values.
1227 // Event number from file, no background hit merging , use size from
1228 // AliITSgeom class, option="All", input from this file only.
1229 HitsToDigits(header->GetEvent(),0,-1," ",fOpt," ");
1231 //______________________________________________________________________
1232 void AliITS::HitsToSDigits(Int_t evNumber,Int_t bgrev,Int_t size,
1233 Option_t *option, Option_t *opt,Text_t *filename){
1234 // keep galice.root for signal and name differently the file for
1235 // background when add! otherwise the track info for signal will be lost !
1236 // the condition below will disappear when the geom class will be
1237 // initialized for all versions - for the moment it is only for v5 !
1238 // 7 is the SDD beam test version. Dummy routine. Hits are ITS's Summable
1241 // Int_t evnt Event to be processed.
1242 // Int_t bgrev Background Hit tree number.
1243 // Int_t nmodules Not used.
1244 // Option_t *option String indicating if merging hits or not. To
1245 // merge hits set equal to "Add". Otherwise no
1246 // background hits are considered.
1247 // Test_t *filename File name containing the background hits..
1252 // return; // using Hits instead of the larger sdigits.
1254 HitsToPreDigits(evNumber,bgrev,size,option,opt,filename);
1256 //______________________________________________________________________
1257 void AliITS::HitsToPreDigits(Int_t evNumber,Int_t bgrev,Int_t size,
1258 Option_t *option, Option_t *opt,Text_t *filename){
1259 // Keep galice.root for signal and name differently the file for
1260 // background when add! otherwise the track info for signal will be lost !
1261 // the condition below will disappear when the geom class will be
1262 // initialized for all versions - for the moment it is only for v5 !
1263 // 7 is the SDD beam test version.
1265 // Int_t evnt Event to be processed.
1266 // Int_t bgrev Background Hit tree number.
1267 // Int_t nmodules Not used.
1268 // Option_t *option String indicating if merging hits or not. To
1269 // merge hits set equal to "Add". Otherwise no
1270 // background hits are considered.
1271 // Test_t *filename File name containing the background hits..
1277 if(!GetITSgeom()) return; // need transformations to do digitization.
1278 AliITSgeom *geom = GetITSgeom();
1280 const char *all = strstr(opt,"All");
1281 const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
1283 static Bool_t setDef=kTRUE;
1284 if (setDef) SetDefaultSimulation();
1288 InitModules(size,nmodules);
1289 FillModules(evNumber,bgrev,nmodules,option,filename);
1291 AliITSsimulation *sim = 0;
1292 AliITSDetType *iDetType = 0;
1293 AliITSmodule *mod = 0;
1295 for(module=0;module<geom->GetIndexMax();module++){
1296 id = geom->GetModuleType(module);
1297 if (!all && !det[id]) continue;
1298 iDetType = DetType(id);
1299 sim = (AliITSsimulation*)iDetType->GetSimulationModel();
1301 Error("HitsToSDigits",
1302 "The simulation class was not instanciated!");
1305 mod = (AliITSmodule *)fITSmodules->At(module);
1306 sim->SDigitiseModule(mod,module,evNumber);
1307 // fills all branches - wasted disk space
1308 gAlice->TreeS()->Fill();
1314 gAlice->TreeS()->GetEntries();
1317 sprintf(hname,"TreeS%d",evNumber);
1318 gAlice->TreeS()->Write(hname,TObject::kOverwrite);
1320 gAlice->TreeS()->AutoSave();
1322 gAlice->TreeS()->Reset();
1324 //______________________________________________________________________
1325 void AliITS::HitsToDigits(Int_t evNumber,Int_t bgrev,Int_t size,
1326 Option_t *option, Option_t *opt,Text_t *filename){
1327 // Keep galice.root for signal and name differently the file for
1328 // background when add! otherwise the track info for signal will be lost !
1329 // the condition below will disappear when the geom class will be
1330 // initialized for all versions - for the moment it is only for v5 !
1331 // 7 is the SDD beam test version.
1333 // Int_t evnt Event to be processed.
1334 // Int_t bgrev Background Hit tree number.
1335 // Int_t nmodules Not used.
1336 // Option_t *option String indicating if merging hits or not. To
1337 // merge hits set equal to "Add". Otherwise no
1338 // background hits are considered.
1339 // Test_t *filename File name containing the background hits..
1345 if(!GetITSgeom()) return; // need transformations to do digitization.
1346 AliITSgeom *geom = GetITSgeom();
1348 const char *all = strstr(opt,"All");
1349 const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
1351 static Bool_t setDef=kTRUE;
1352 if (setDef) SetDefaultSimulation();
1356 InitModules(size,nmodules);
1357 FillModules(evNumber,bgrev,nmodules,option,filename);
1359 AliITSsimulation *sim = 0;
1360 AliITSDetType *iDetType = 0;
1361 AliITSmodule *mod = 0;
1363 for(module=0;module<geom->GetIndexMax();module++){
1364 id = geom->GetModuleType(module);
1365 if (!all && !det[id]) continue;
1366 iDetType = DetType(id);
1367 sim = (AliITSsimulation*)iDetType->GetSimulationModel();
1369 Error("HitsToDigits",
1370 "The simulation class was not instanciated!");
1373 mod = (AliITSmodule *)fITSmodules->At(module);
1374 sim->DigitiseModule(mod,module,evNumber);
1375 // fills all branches - wasted disk space
1376 gAlice->TreeD()->Fill();
1382 gAlice->TreeD()->GetEntries();
1385 sprintf(hname,"TreeD%d",evNumber);
1386 gAlice->TreeD()->Write(hname,TObject::kOverwrite);
1388 gAlice->TreeD()->AutoSave();
1390 gAlice->TreeD()->Reset();
1392 //______________________________________________________________________
1393 void AliITS::ResetSDigits(){
1394 // Reset the Summable Digits array.
1400 if (fSDigits) fSDigits->Clear();
1403 //______________________________________________________________________
1404 void AliITS::ResetDigits(){
1405 // Reset number of digits and the digits array for the ITS detector.
1411 if (!fDtype) return;
1414 for (i=0;i<kNTYPES;i++ ) {
1415 if (fDtype->At(i)) ((TClonesArray*)fDtype->At(i))->Clear();
1416 if (fNdtype) fNdtype[i]=0;
1419 //______________________________________________________________________
1420 void AliITS::ResetDigits(Int_t i){
1421 // Reset number of digits and the digits array for this branch.
1427 if (fDtype->At(i)) ((TClonesArray*)fDtype->At(i))->Clear();
1428 if (fNdtype) fNdtype[i]=0;
1430 //______________________________________________________________________
1431 void AliITS::AddSumDigit(AliITSpListItem &sdig){
1432 // Adds the a module full of summable digits to the summable digits tree.
1434 // AliITSpListItem &sdig SDigit to be added to SDigits tree.
1440 TClonesArray &lsdig = *fSDigits;
1441 new(lsdig[fNSDigits++]) AliITSpListItem(sdig);
1443 //______________________________________________________________________
1444 void AliITS::AddRealDigit(Int_t id, Int_t *digits){
1445 // Add a real digit - as coming from data.
1447 // Int_t id Detector type number.
1448 // Int_t *digits Integer array containing the digits info. See
1455 TClonesArray &ldigits = *((TClonesArray*)fDtype->At(id));
1456 new(ldigits[fNdtype[id]++]) AliITSdigit(digits);
1458 //______________________________________________________________________
1459 void AliITS::AddSimDigit(Int_t id, AliITSdigit *d){
1460 // Add a simulated digit.
1462 // Int_t id Detector type number.
1463 // AliITSdigit *d Digit to be added to the Digits Tree. See
1470 TClonesArray &ldigits = *((TClonesArray*)fDtype->At(id));
1474 new(ldigits[fNdtype[id]++]) AliITSdigitSPD(*((AliITSdigitSPD*)d));
1477 new(ldigits[fNdtype[id]++]) AliITSdigitSDD(*((AliITSdigitSDD*)d));
1480 new(ldigits[fNdtype[id]++]) AliITSdigitSSD(*((AliITSdigitSSD*)d));
1484 //______________________________________________________________________
1485 void AliITS::AddSimDigit(Int_t id,Float_t phys,Int_t *digits,Int_t *tracks,
1486 Int_t *hits,Float_t *charges){
1487 // Add a simulated digit to the list.
1489 // Int_t id Detector type number.
1490 // Float_t phys Physics indicator. See AliITSdigits.h
1491 // Int_t *digits Integer array containing the digits info. See
1493 // Int_t *tracks Integer array [3] containing the track numbers that
1494 // contributed to this digit.
1495 // Int_t *hits Integer array [3] containing the hit numbers that
1496 // contributed to this digit.
1497 // Float_t *charge Floating point array of the signals contributed
1498 // to this digit by each track.
1504 TClonesArray &ldigits = *((TClonesArray*)fDtype->At(id));
1507 new(ldigits[fNdtype[id]++]) AliITSdigitSPD(digits,tracks,hits);
1510 new(ldigits[fNdtype[id]++]) AliITSdigitSDD(phys,digits,tracks,
1514 new(ldigits[fNdtype[id]++]) AliITSdigitSSD(digits,tracks,hits);
1518 //______________________________________________________________________
1519 void AliITS::MakeTreeC(Option_t *option){
1520 // Create a separate tree to store the clusters.
1522 // Option_t *option string which must contain "C" otherwise
1523 // no Cluster Tree is created.
1529 const char *optC = strstr(option,"C");
1530 if (optC && !fTreeC) fTreeC = new TTree("TC","Clusters in ITS");
1533 Int_t buffersize = 4000;
1534 char branchname[30];
1535 const char *det[3] = {"SPD","SDD","SSD"};
1539 // one branch for Clusters per type of detector
1541 for (i=0; i<kNTYPES ;i++) {
1542 AliITSDetType *iDetType=DetType(i);
1543 iDetType->GetClassNames(digclass,clclass);
1545 fCtype->AddAt(new TClonesArray(clclass,1000),i);
1546 if (kNTYPES==3) sprintf(branchname,"%sClusters%s",GetName(),det[i]);
1547 else sprintf(branchname,"%sClusters%d",GetName(),i+1);
1548 if (fCtype && fTreeC) {
1549 TreeC()->Branch(branchname,&((*fCtype)[i]), buffersize);
1550 } // end if fCtype && fTreeC
1553 //______________________________________________________________________
1554 void AliITS::GetTreeC(Int_t event){
1555 // Get the clusters tree for this event and set the branch address.
1557 // Int_t event Event number for the cluster tree.
1563 char branchname[30];
1564 const char *det[3] = {"SPD","SDD","SSD"};
1571 sprintf(treeName,"TreeC%d",event);
1572 fTreeC = (TTree*)gDirectory->Get(treeName);
1580 for (i=0; i<kNTYPES; i++) {
1581 AliITSDetType *iDetType=DetType(i);
1582 iDetType->GetClassNames(digclass,clclass);
1584 if(!fCtype->At(i)) fCtype->AddAt(new TClonesArray(clclass,1000),i);
1585 if(kNTYPES==3) sprintf(branchname,"%sClusters%s",GetName(),det[i]);
1586 else sprintf(branchname,"%sClusters%d",GetName(),i+1);
1588 branch = fTreeC->GetBranch(branchname);
1589 if (branch) branch->SetAddress(&((*fCtype)[i]));
1593 Error("GetTreeC","cannot find Clusters Tree for event:%d",event);
1596 //______________________________________________________________________
1597 void AliITS::AddCluster(Int_t id, AliITSRawCluster *c){
1598 // Add a cluster to the list.
1600 // Int_t id Detector type number.
1601 // AliITSRawCluster *c Cluster class to be added to the tree of
1608 TClonesArray &lc = *((TClonesArray*)fCtype->At(id));
1612 new(lc[fNctype[id]++]) AliITSRawClusterSPD(*((AliITSRawClusterSPD*)c));
1615 new(lc[fNctype[id]++]) AliITSRawClusterSDD(*((AliITSRawClusterSDD*)c));
1618 new(lc[fNctype[id]++]) AliITSRawClusterSSD(*((AliITSRawClusterSSD*)c));
1622 //______________________________________________________________________
1623 void AliITS::ResetClusters(){
1624 // Reset number of clusters and the clusters array for ITS.
1631 for (i=0;i<kNTYPES;i++ ) ResetClusters(i);
1633 //______________________________________________________________________
1634 void AliITS::ResetClusters(Int_t i){
1635 // Reset number of clusters and the clusters array for this branch.
1637 // Int_t i Detector type number.
1643 if (fCtype->At(i)) ((TClonesArray*)fCtype->At(i))->Clear();
1644 if (fNctype) fNctype[i]=0;
1646 //______________________________________________________________________
1647 void AliITS::MakeBranchR(const char *file, Option_t *opt){
1648 // Creates Tree branches for the ITS Reconstructed points.
1650 // cont char *file File name where RecPoints branch is to be written
1651 // to. If blank it write the SDigits to the same
1652 // file in which the Hits were found.
1657 Int_t buffsz = 4000;
1658 char branchname[30];
1660 // only one branch for rec points for all detector types
1661 Bool_t oFast= (strstr(opt,"Fast")!=0);
1663 sprintf(branchname,"%sRecPointsF",GetName());
1665 sprintf(branchname,"%sRecPoints",GetName());
1667 if (fRecPoints && gAlice->TreeR()) {
1668 MakeBranchInTree(gAlice->TreeR(),branchname,&fRecPoints,buffsz,file);
1671 //______________________________________________________________________
1672 void AliITS::SetTreeAddressR(TTree *treeR){
1673 // Set branch address for the Reconstructed points Trees.
1675 // TTree *treeR Tree containing the RecPoints.
1680 char branchname[30];
1684 sprintf(branchname,"%sRecPoints",GetName());
1685 branch = treeR->GetBranch(branchname);
1687 branch->SetAddress(&fRecPoints);
1690 sprintf(branchname,"%sRecPointsF",GetName());
1691 branch = treeR->GetBranch(branchname);
1693 branch->SetAddress(&fRecPoints);
1697 //______________________________________________________________________
1698 void AliITS::AddRecPoint(const AliITSRecPoint &r){
1699 // Add a reconstructed space point to the list
1701 // const AliITSRecPoint &r RecPoint class to be added to the tree
1702 // of reconstructed points TreeR.
1708 TClonesArray &lrecp = *fRecPoints;
1709 new(lrecp[fNRecPoints++]) AliITSRecPoint(r);
1711 //______________________________________________________________________
1712 void AliITS::HitsToFastRecPoints(Int_t evNumber,Int_t bgrev,Int_t size,
1713 Option_t *opt0,Option_t *opt1,Text_t *flnm){
1714 // keep galice.root for signal and name differently the file for
1715 // background when add! otherwise the track info for signal will be lost !
1716 // the condition below will disappear when the geom class will be
1717 // initialized for all versions - for the moment it is only for v5 !
1719 // Int_t evnt Event to be processed.
1720 // Int_t bgrev Background Hit tree number.
1721 // Int_t size Size used by InitModules. See InitModules.
1722 // Option_t *opt0 Option passed to FillModules. See FillModules.
1723 // Option_t *opt1 String indicating if merging hits or not. To
1724 // merge hits set equal to "Add". Otherwise no
1725 // background hits are considered.
1726 // Test_t *flnm File name containing the background hits..
1732 if(!GetITSgeom()) return;
1733 AliITSgeom *geom = GetITSgeom();
1735 const char *all = strstr(opt1,"All");
1736 const char *det[3] ={strstr(opt1,"SPD"),strstr(opt1,"SDD"),
1737 strstr(opt1,"SSD")};
1739 InitModules(size,nmodules);
1740 FillModules(evNumber,bgrev,nmodules,opt0,flnm);
1742 AliITSsimulation *sim = 0;
1743 AliITSDetType *iDetType = 0;
1744 AliITSmodule *mod = 0;
1747 //m.b. : this change is nothing but a nice way to make sure
1749 for(module=0;module<geom->GetIndexMax();module++){
1750 id = geom->GetModuleType(module);
1751 if (!all && !det[id]) continue;
1752 iDetType = DetType(id);
1753 sim = (AliITSsimulation*)iDetType->GetSimulationModel();
1755 Error("HitsToFastPoints",
1756 "The simulation class was not instanciated!");
1759 mod = (AliITSmodule *)fITSmodules->At(module);
1760 sim->CreateFastRecPoints(mod,module,gRandom);
1761 // gAlice->TreeR()->Fill();
1762 TBranch *br=gAlice->TreeR()->GetBranch("ITSRecPointsF");
1770 sprintf(hname,"TreeR%d",evNumber);
1771 gAlice->TreeR()->Write(hname,TObject::kOverwrite);
1773 gAlice->TreeR()->AutoSave();
1775 gAlice->TreeR()->Reset();
1777 //______________________________________________________________________
1778 void AliITS::Digits2Reco(){
1779 // Find clusters and reconstruct space points.
1785 AliHeader *header=gAlice->GetHeader();
1786 // to Digits to RecPoints for event in file, all digits in file, and
1787 // all ITS detectors.
1788 DigitsToRecPoints(header->GetEvent(),0,fOpt);
1790 //______________________________________________________________________
1791 void AliITS::DigitsToRecPoints(Int_t evNumber,Int_t lastentry,Option_t *opt){
1792 // cluster finding and reconstruction of space points
1793 // the condition below will disappear when the geom class will be
1794 // initialized for all versions - for the moment it is only for v5 !
1795 // 7 is the SDD beam test version
1797 // Int_t evNumber Event number to be processed.
1798 // Int_t lastentry Offset for module when not all of the modules
1800 // Option_t *opt String indicating which ITS sub-detectors should
1801 // be processed. If ="All" then all of the ITS
1802 // sub detectors are processed.
1808 if(!GetITSgeom()) return;
1809 AliITSgeom *geom = GetITSgeom();
1811 const char *all = strstr(opt,"All");
1812 const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
1814 static Bool_t setRec=kTRUE;
1815 if (setRec) SetDefaultClusterFinders();
1818 TTree *treeC=TreeC();
1819 AliITSClusterFinder *rec = 0;
1820 AliITSDetType *iDetType = 0;
1821 Int_t id,module,first=0;
1822 for(module=0;module<geom->GetIndexMax();module++){
1823 id = geom->GetModuleType(module);
1824 if (!all && !det[id]) continue;
1825 if(det[id]) first = geom->GetStartDet(id);
1826 iDetType = DetType(id);
1827 rec = (AliITSClusterFinder*)iDetType->GetReconstructionModel();
1828 TClonesArray *itsDigits = this->DigitsAddress(id);
1830 Error("DigitsToRecPoints",
1831 "The reconstruction class was not instanciated!");
1834 this->ResetDigits();
1835 if (all) gAlice->TreeD()->GetEvent(lastentry+module);
1836 else gAlice->TreeD()->GetEvent(lastentry+(module-first));
1837 Int_t ndigits = itsDigits->GetEntriesFast();
1838 if (ndigits) rec->FindRawClusters(module);
1839 gAlice->TreeR()->Fill();
1845 gAlice->TreeR()->GetEntries();
1846 treeC->GetEntries();
1849 sprintf(hname,"TreeR%d",evNumber);
1850 gAlice->TreeR()->Write(hname,TObject::kOverwrite);
1852 gAlice->TreeR()->AutoSave();
1854 gAlice->TreeR()->Reset();
1856 sprintf(hname,"TreeC%d",evNumber);
1857 treeC->Write(hname,TObject::kOverwrite);
1860 //______________________________________________________________________
1861 void AliITS::ResetRecPoints(){
1862 // Reset number of rec points and the rec points array.
1868 if (fRecPoints) fRecPoints->Clear();