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.51 2001/05/16 14:57:15 alibrary
19 New files for folders and Stack
21 Revision 1.50 2001/05/11 09:15:21 barbera
22 Corrected to make fast point creation working with PPR geometry
24 Revision 1.49 2001/05/11 07:37:49 hristov
25 Legacy lines commented
27 Revision 1.48 2001/05/10 18:14:25 barbera
30 Revision 1.47 2001/05/10 17:55:59 barbera
31 Modified to create rec points also for PPR geometries
33 Revision 1.46 2001/05/10 00:05:28 nilsen
34 Allowed for HitsToDigits function to work with versions 5, 7, 8, and 9. This
35 should probably be cleaned up to only check to make sure that fITSgeom has
36 been properly defined.
38 Revision 1.45 2001/05/01 22:35:48 nilsen
39 Remove/commented a number of cout<< statements. and made change needed by
42 Revision 1.44 2001/04/26 22:44:01 nilsen
43 Removed dependence on layer 5/6 in AliITS::HitsToDigits. This will be
44 done properly in AliITSv???.cxx via SetDefaults.
46 Revision 1.43 2001/04/26 13:22:52 barbera
47 TMatrix and TVector elimininated to speed up the code
49 Revision 1.42 2001/04/25 21:55:12 barbera
50 Updated version to be compatible with actual verion of STEER and TPC
52 Revision 1.41 2001/04/21 15:16:51 barbera
53 Updated with the new SSD reconstruction code
55 Revision 1.40 2001/03/17 15:07:06 mariana
56 Update SDD response parameters
58 Revision 1.39 2001/03/12 17:45:32 hristov
59 Changes needed on Sun with CC 5.0
61 Revision 1.38 2001/03/07 14:04:51 barbera
62 Some vector dimensions increased to cope with full events
64 Revision 1.37 2001/03/07 12:36:35 barbera
65 A change added in the tracking part to manage delta rays
67 Revision 1.36 2001/03/02 19:44:11 barbera
68 modified to taking into account new version tracking v1
70 Revision 1.35 2001/02/28 18:16:46 mariana
71 Make the code compatible with the new AliRun
73 Revision 1.34 2001/02/11 15:51:39 mariana
74 Set protection in MakeBranch
76 Revision 1.33 2001/02/10 22:26:39 mariana
77 Move the initialization of the containers for raw clusters in MakeTreeC()
79 Revision 1.32 2001/02/08 23:55:31 nilsen
80 Removed fMajor/MinorVersion variables in favor of variables in derived classes.
81 Set arrays char *det[3] = {"SPD","SDD","SSD"} as const.
83 Revision 1.31 2001/02/02 23:57:28 nilsen
84 Added include file that are no londer included in AliITSgeom.h
86 Revision 1.30 2001/01/30 09:23:13 hristov
87 Streamers removed (R.Brun)
89 Revision 1.29 2001/01/26 20:01:09 hristov
90 Major upgrade of AliRoot code
92 Revision 1.28 2000/12/18 14:02:00 barbera
93 new version of the ITS tracking to take into account the new TPC track parametrization
95 Revision 1.27 2000/12/08 13:49:27 barbera
96 Hidden declaration in a for loop removed to be compliant with HP-UX compiler
98 Revision 1.26 2000/11/27 13:12:13 barbera
99 New version containing the files for tracking
101 Revision 1.25 2000/11/12 22:38:05 barbera
102 Added header file for the SPD Bari model
104 Revision 1.24 2000/10/09 22:18:12 barbera
105 Bug fixes from MAriana to le AliITStest.C run correctly
107 Revision 1.23 2000/10/05 20:47:42 nilsen
108 fixed dependencies of include files. Tryed but failed to get a root automaticly
109 generates streamer function to work. Modified SetDefaults.
111 Revision 1.9.2.15 2000/10/04 16:56:40 nilsen
112 Needed to include stdlib.h
115 Revision 1.22 2000/10/04 19:45:52 barbera
116 Corrected by F. Carminati for v3.04
118 Revision 1.21 2000/10/02 21:28:08 fca
119 Removal of useless dependecies via forward declarations
121 Revision 1.20 2000/10/02 16:31:39 barbera
122 General code clean-up
124 Revision 1.9.2.14 2000/10/02 15:43:51 barbera
125 General code clean-up (e.g., printf -> cout)
127 Revision 1.19 2000/09/22 12:13:25 nilsen
128 Patches and updates for fixes to this and other routines.
130 Revision 1.18 2000/07/12 05:32:20 fca
131 Correcting several syntax problem with static members
133 Revision 1.17 2000/07/10 16:07:18 fca
134 Release version of ITS code
136 Revision 1.9.2.3 2000/02/02 13:42:09 barbera
137 fixed AliITS.cxx for new AliRun structure. Added ITS hits list to list of hits which will have their track numbers updated
139 Revision 1.9.2.2 2000/01/23 03:03:13 nilsen
140 //fixed FillModule. Removed fi(fabs(xl)<dx....
142 Revision 1.9.2.1 2000/01/12 19:03:32 nilsen
143 This is the version of the files after the merging done in December 1999.
144 See the ReadMe110100.txt file for details
146 Revision 1.9 1999/11/14 14:33:25 fca
147 Correct problems with distructors and pointers, thanks to I.Hrivnacova
149 Revision 1.8 1999/09/29 09:24:19 fca
150 Introduction of the Copyright and cvs Log
154 ///////////////////////////////////////////////////////////////////////////////
156 // An overview of the basic philosophy of the ITS code development
157 // and analysis is show in the figure below.
160 <img src="picts/ITS/ITS_Analysis_schema.gif">
163 <font size=+2 color=red>
164 <p>Roberto Barbera is in charge of the ITS Offline code (1999).
165 <a href="mailto:roberto.barbera@ct.infn.it">Roberto Barbera</a>.
171 // AliITS. Inner Traking System base class.
172 // This class contains the base procedures for the Inner Tracking System
176 <img src="picts/ITS/AliITS_Class_Diagram.gif">
179 <font size=+2 color=red>
180 <p>This show the class diagram of the different elements that are part of
188 // Written by Rene Brun, Federico Carminati, and Roberto Barbera
191 // Modified and documented by Bjorn S. Nilsen
195 // Modified and documented by A. Bologna
198 // AliITS is the general base class for the ITS. Also see AliDetector for
199 // futher information.
201 ///////////////////////////////////////////////////////////////////////////////
202 #include <iostream.h>
210 #include <TClonesArray.h>
212 #include <TObjectTable.h>
216 #include <TParticle.h>
221 #include "AliITSMap.h"
222 #include "AliITSDetType.h"
223 #include "AliITSClusterFinder.h"
224 //#include "AliITSsimulation.h"
225 #include "AliITSsimulationSPD.h"
226 #include "AliITSsimulationSDD.h"
227 #include "AliITSsimulationSSD.h"
228 #include "AliITSresponse.h"
229 #include "AliITSsegmentationSPD.h"
230 #include "AliITSresponseSPD.h"
231 #include "AliITSresponseSPDbari.h"
232 #include "AliITSsegmentationSDD.h"
233 #include "AliITSresponseSDD.h"
234 #include "AliITSsegmentationSSD.h"
235 #include "AliITSresponseSSD.h"
236 #include "AliITShit.h"
237 #include "AliITSgeom.h"
238 #include "AliITSdigit.h"
239 #include "AliITSmodule.h"
240 #include "AliITSRecPoint.h"
241 #include "AliITSRawCluster.h"
244 #include "AliKalmanTrack.h"
247 #include "AliITStrack.h"
248 #include "AliITSiotrack.h"
249 #include "AliITStracking.h"
250 #include "AliITSRad.h"
251 #include "../TPC/AliTPC.h"
252 #include "../TPC/AliTPCParam.h"
253 #include "../TPC/AliTPCtracker.h"
257 //_____________________________________________________________________________
258 AliITS::AliITS() : AliDetector() {
260 // Default initialiser for ITS
261 // The default constructor of the AliITS class. In addition to
262 // creating the AliITS class it zeros the variables fIshunt (a member
263 // of AliDetector class), fEuclidOut, and fIdN, and zeros the pointers
264 // fITSpoints, fIdSens, and fIdName. The AliDetector default constructor
272 fNDetTypes = kNTYPES;
291 //_____________________________________________________________________________
292 AliITS::AliITS(const char *name, const char *title):AliDetector(name,title){
294 // Default initialiser for ITS
295 // The constructor of the AliITS class. In addition to creating the
296 // AliITS class, it allocates memory for the TClonesArrays fHits and
297 // fDigits, and for the TObjArray fITSpoints. It also zeros the variables
298 // fIshunt (a member of AliDetector class), fEuclidOut, and fIdN, and zeros
299 // the pointers fIdSens and fIdName. To help in displaying hits via the ROOT
300 // macro display.C AliITS also sets the marker color to red. The variables
301 // passes with this constructor, const char *name and *title, are used by
302 // the constructor of AliDetector class. See AliDetector class for a
303 // description of these parameters and its constructor functions.
307 fHits = new TClonesArray("AliITShit", 1560);
308 gAlice->AddHitList(fHits);
310 fNDetTypes = kNTYPES;
312 fNdtype = new Int_t[kNTYPES];
313 fDtype = new TObjArray(kNTYPES);
315 fNctype = new Int_t[kNTYPES];
316 fCtype = new TObjArray(kNTYPES);
332 fDetTypes = new TObjArray(kNTYPES);
335 for(i=0;i<kNTYPES;i++) {
336 fDetTypes->AddAt(new AliITSDetType(),i);
342 SetMarkerColor(kRed);
346 //___________________________________________________________________________
347 AliITS::AliITS(AliITS &source){
349 if(this==&source) return;
350 Error("AliITS::Copy constructor",
351 "You are not allowed to make a copy of the AliITS");
354 //____________________________________________________________________________
355 AliITS& AliITS::operator=(AliITS &source){
356 // assignment operator
357 if(this==&source) return *this;
358 Error("AliITS::operator=",
359 "You are not allowed to make a copy of the AliITS");
361 return *this; //fake return
363 //____________________________________________________________________________
364 void AliITS::ClearModules(){
365 //clear the modules TObjArray
367 if(fITSmodules) fITSmodules->Delete();
370 //_____________________________________________________________________________
373 // Default distructor for ITS
374 // The default destructor of the AliITS class. In addition to deleting
375 // the AliITS class it deletes the memory pointed to by the fHits, fDigits,
376 // fIdSens, fIdName, and fITSpoints.
383 // delete fIdName; // TObjArray of TObjStrings
384 if(fIdName!=0) delete[] fIdName; // Array of TStrings
385 if(fIdSens!=0) delete[] fIdSens;
387 this->ClearModules();
389 }// end if fITSmodules!=0
409 if (fTreeC) delete fTreeC;
411 if (fITSgeom) delete fITSgeom;
415 //___________________________________________
416 AliITSDetType* AliITS::DetType(Int_t id)
418 //return pointer to id detector type
419 return ((AliITSDetType*) (*fDetTypes)[id]);
422 //___________________________________________
423 void AliITS::SetClasses(Int_t id, const char *digit, const char *cluster)
425 //set the digit and cluster classes to be used for the id detector type
426 ((AliITSDetType*) (*fDetTypes)[id])->ClassNames(digit,cluster);
429 //___________________________________________
430 void AliITS::SetResponseModel(Int_t id, AliITSresponse *response)
432 //set the response model for the id detector type
434 ((AliITSDetType*) (*fDetTypes)[id])->ResponseModel(response);
438 //___________________________________________
439 void AliITS::SetSegmentationModel(Int_t id, AliITSsegmentation *seg)
441 //set the segmentation model for the id detector type
443 ((AliITSDetType*) (*fDetTypes)[id])->SegmentationModel(seg);
447 //___________________________________________
448 void AliITS::SetSimulationModel(Int_t id, AliITSsimulation *sim)
450 //set the simulation model for the id detector type
452 ((AliITSDetType*) (*fDetTypes)[id])->SimulationModel(sim);
455 //___________________________________________
456 void AliITS::SetReconstructionModel(Int_t id, AliITSClusterFinder *reconst)
458 //set the cluster finder model for the id detector type
460 ((AliITSDetType*) (*fDetTypes)[id])->ReconstructionModel(reconst);
464 //_____________________________________________________________________________
465 void AliITS::AddHit(Int_t track, Int_t *vol, Float_t *hits){
468 // The function to add information to the AliITShit class. See the
469 // AliITShit class for a full description. This function allocates the
470 // necessary new space for the hit information and passes the variable
471 // track, and the pointers *vol and *hits to the AliITShit constructor
474 TClonesArray &lhits = *fHits;
475 new(lhits[fNhits++]) AliITShit(fIshunt,track,vol,hits);
477 //_____________________________________________________________________________
478 void AliITS::AddRealDigit(Int_t id, Int_t *digits)
480 // add a real digit - as coming from data
482 TClonesArray &ldigits = *((TClonesArray*)(*fDtype)[id]);
483 new(ldigits[fNdtype[id]++]) AliITSdigit(digits);
486 //_____________________________________________________________________________
487 void AliITS::AddSimDigit(Int_t id, AliITSdigit *d)
490 // add a simulated digit
492 TClonesArray &ldigits = *((TClonesArray*)(*fDtype)[id]);
497 new(ldigits[fNdtype[id]++]) AliITSdigitSPD(*((AliITSdigitSPD*)d));
500 new(ldigits[fNdtype[id]++]) AliITSdigitSDD(*((AliITSdigitSDD*)d));
503 new(ldigits[fNdtype[id]++]) AliITSdigitSSD(*((AliITSdigitSSD*)d));
509 //_____________________________________________________________________________
510 void AliITS::AddSimDigit(Int_t id,Float_t phys,Int_t *digits,Int_t *tracks,Int_t *hits,Float_t *charges){
512 // add a simulated digit to the list
514 TClonesArray &ldigits = *((TClonesArray*)(*fDtype)[id]);
518 new(ldigits[fNdtype[id]++]) AliITSdigitSPD(digits,tracks,hits);
521 new(ldigits[fNdtype[id]++]) AliITSdigitSDD(phys,digits,tracks,hits,charges);
524 new(ldigits[fNdtype[id]++]) AliITSdigitSSD(digits,tracks,hits);
530 //_____________________________________________________________________________
531 void AliITS::AddCluster(Int_t id, AliITSRawCluster *c)
534 // add a cluster to the list
536 TClonesArray &lcl = *((TClonesArray*)(*fCtype)[id]);
541 new(lcl[fNctype[id]++]) AliITSRawClusterSPD(*((AliITSRawClusterSPD*)c));
544 new(lcl[fNctype[id]++]) AliITSRawClusterSDD(*((AliITSRawClusterSDD*)c));
547 new(lcl[fNctype[id]++]) AliITSRawClusterSSD(*((AliITSRawClusterSSD*)c));
554 //_____________________________________________________________________________
555 void AliITS::AddRecPoint(const AliITSRecPoint &r)
558 // Add a reconstructed space point to the list
560 TClonesArray &lrecp = *fRecPoints;
561 new(lrecp[fNRecPoints++]) AliITSRecPoint(r);
565 //____________________________________________
566 void AliITS::ResetDigits()
569 // Reset number of digits and the digits array for the ITS detector
575 for (i=0;i<kNTYPES;i++ ) {
576 if ((*fDtype)[i]) ((TClonesArray*)(*fDtype)[i])->Clear();
577 if (fNdtype) fNdtype[i]=0;
581 //____________________________________________
582 void AliITS::ResetDigits(Int_t i)
585 // Reset number of digits and the digits array for this branch
587 if ((*fDtype)[i]) ((TClonesArray*)(*fDtype)[i])->Clear();
588 if (fNdtype) fNdtype[i]=0;
592 //____________________________________________
593 void AliITS::ResetClusters()
596 // Reset number of clusters and the clusters array for ITS
600 for (i=0;i<kNTYPES;i++ ) {
601 if ((*fCtype)[i]) ((TClonesArray*)(*fCtype)[i])->Clear();
602 if (fNctype) fNctype[i]=0;
607 //____________________________________________
608 void AliITS::ResetClusters(Int_t i)
611 // Reset number of clusters and the clusters array for this branch
613 if ((*fCtype)[i]) ((TClonesArray*)(*fCtype)[i])->Clear();
614 if (fNctype) fNctype[i]=0;
619 //____________________________________________
620 void AliITS::ResetRecPoints()
623 // Reset number of rec points and the rec points array
625 if (fRecPoints) fRecPoints->Clear();
630 //_____________________________________________________________________________
631 Int_t AliITS::DistancetoPrimitive(Int_t , Int_t ){
633 // Distance from mouse to ITS on the screen. Dummy routine
634 // A dummy routine used by the ROOT macro display.C to allow for the
635 // use of the mouse (pointing device) in the macro. In general this should
636 // never be called. If it is it returns the number 9999 for any value of
642 //_____________________________________________________________________________
645 // Initialise ITS after it has been built
646 // This routine initializes the AliITS class. It is intended to be called
647 // from the Init function in AliITSv?. Besides displaying a banner
648 // indicating that it has been called it initializes the array fIdSens
649 // and sets the default segmentation, response, digit and raw cluster classes
650 // Therefore it should be called after a call to CreateGeometry.
657 for(i=0;i<fIdN;i++) fIdSens[i] = gMC->VolId(fIdName[i]);
661 //_____________________________________________________________________________
662 void AliITS::SetDefaults()
664 // sets the default segmentation, response, digit and raw cluster classes
666 if(fDebug) printf("%s: SetDefaults\n",ClassName());
668 AliITSDetType *iDetType;
674 if (!iDetType->GetSegmentationModel()) {
675 AliITSsegmentationSPD *seg0=new AliITSsegmentationSPD(fITSgeom);
676 SetSegmentationModel(0,seg0);
678 if (!iDetType->GetResponseModel()) {
679 SetResponseModel(0,new AliITSresponseSPD());
681 // set digit and raw cluster classes to be used
683 const char *kData0=(iDetType->GetResponseModel())->DataType();
684 if (strstr(kData0,"real")) {
685 iDetType->ClassNames("AliITSdigit","AliITSRawClusterSPD");
686 } else iDetType->ClassNames("AliITSdigitSPD","AliITSRawClusterSPD");
690 if (!iDetType->GetResponseModel()) {
691 SetResponseModel(1,new AliITSresponseSDD());
693 AliITSresponse *resp1=iDetType->GetResponseModel();
694 if (!iDetType->GetSegmentationModel()) {
695 AliITSsegmentationSDD *seg1=new AliITSsegmentationSDD(fITSgeom,resp1);
696 SetSegmentationModel(1,seg1);
698 const char *kData1=(iDetType->GetResponseModel())->DataType();
699 const char *kopt=iDetType->GetResponseModel()->ZeroSuppOption();
700 if ((!strstr(kopt,"2D")) && (!strstr(kopt,"1D")) || strstr(kData1,"real") ) {
701 iDetType->ClassNames("AliITSdigit","AliITSRawClusterSDD");
702 } else iDetType->ClassNames("AliITSdigitSDD","AliITSRawClusterSDD");
706 if (!iDetType->GetSegmentationModel()) {
707 AliITSsegmentationSSD *seg2=new AliITSsegmentationSSD(fITSgeom);
708 SetSegmentationModel(2,seg2);
710 if (!iDetType->GetResponseModel()) {
711 SetResponseModel(2,new AliITSresponseSSD());
713 const char *kData2=(iDetType->GetResponseModel())->DataType();
714 if (strstr(kData2,"real")) {
715 iDetType->ClassNames("AliITSdigit","AliITSRawClusterSSD");
716 } else iDetType->ClassNames("AliITSdigitSSD","AliITSRawClusterSSD");
719 Warning("SetDefaults","Only the three basic detector types are initialised!");
723 //_____________________________________________________________________________
724 void AliITS::SetDefaultSimulation()
729 //_____________________________________________________________________________
730 void AliITS::SetDefaultClusterFinders()
735 //_____________________________________________________________________________
737 void AliITS::MakeTreeC(Option_t *option)
739 // create a separate tree to store the clusters
741 // cout << "AliITS::MakeTreeC" << endl;
743 const char *optC = strstr(option,"C");
744 if (optC && !fTreeC) fTreeC = new TTree("TC","Clusters in ITS");
747 Int_t buffersize = 4000;
750 const char *det[3] = {"SPD","SDD","SSD"};
755 // one branch for Clusters per type of detector
757 for (i=0; i<kNTYPES ;i++) {
758 AliITSDetType *iDetType=DetType(i);
759 iDetType->GetClassNames(digclass,clclass);
761 (*fCtype)[i] = new TClonesArray(clclass,10000);
762 if (kNTYPES==3) sprintf(branchname,"%sClusters%s",GetName(),det[i]);
763 else sprintf(branchname,"%sClusters%d",GetName(),i+1);
764 if (fCtype && fTreeC) {
765 TreeC()->Branch(branchname,&((*fCtype)[i]), buffersize);
766 // cout << "Making Branch " << branchname;
767 // cout << " for Clusters of detector type " << i+1 << endl;
773 //_____________________________________________________________________________
774 void AliITS::GetTreeC(Int_t event)
777 // cout << "AliITS::GetTreeC" << endl;
779 // get the clusters tree for this event and set the branch address
783 const char *det[3] = {"SPD","SDD","SSD"};
790 sprintf(treeName,"TreeC%d",event);
791 fTreeC = (TTree*)gDirectory->Get(treeName);
796 for (i=0; i<kNTYPES; i++) {
797 if (kNTYPES==3) sprintf(branchname,"%sClusters%s",GetName(),det[i]);
798 else sprintf(branchname,"%sClusters%d",GetName(),i+1);
800 branch = fTreeC->GetBranch(branchname);
801 if (branch) branch->SetAddress(&((*fCtype)[i]));
805 Error("AliITS::GetTreeC",
806 "cannot find Clusters Tree for event:%d\n",event);
810 //_____________________________________________________________________________
811 void AliITS::MakeBranch(Option_t* option, const char *file)
814 // Creates Tree branches for the ITS.
817 Int_t buffersize = 4000;
819 sprintf(branchname,"%s",GetName());
821 AliDetector::MakeBranch(option,file);
823 const char *cD = strstr(option,"D");
824 const char *cR = strstr(option,"R");
828 // one branch for digits per type of detector
830 const char *det[3] = {"SPD","SDD","SSD"};
836 for (i=0; i<kNTYPES ;i++) {
837 AliITSDetType *iDetType=DetType(i);
838 iDetType->GetClassNames(digclass,clclass);
840 if(!((*fDtype)[i])) (*fDtype)[i] = new TClonesArray(digclass,10000);
844 for (i=0; i<kNTYPES ;i++) {
845 if (kNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]);
846 else sprintf(branchname,"%sDigits%d",GetName(),i+1);
847 if (fDtype && gAlice->TreeD()) {
848 MakeBranchInTree(gAlice->TreeD(),
849 branchname, &((*fDtype)[i]), buffersize, file);
850 // cout << "Making Branch " << branchname;
851 // cout << " for digits of type "<< i+1 << endl;
858 // only one branch for rec points for all detector types
860 sprintf(branchname,"%sRecPoints",GetName());
862 if(!fRecPoints) fRecPoints=new TClonesArray("AliITSRecPoint",10000);
864 if (fRecPoints && gAlice->TreeR()) {
865 MakeBranchInTree(gAlice->TreeR(),
866 branchname, &fRecPoints, buffersize, file) ;
867 // cout << "Making Branch " << branchname;
868 // cout << " for reconstructed space points" << endl;
873 //___________________________________________
874 void AliITS::SetTreeAddress()
877 // Set branch address for the Trees.
880 AliDetector::SetTreeAddress();
882 const char *det[3] = {"SPD","SDD","SSD"};
885 TTree *treeD = gAlice->TreeD();
886 TTree *treeR = gAlice->TreeR();
890 for (i=0; i<kNTYPES; i++) {
891 if (kNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]);
892 else sprintf(branchname,"%sDigits%d",GetName(),i+1);
894 branch = treeD->GetBranch(branchname);
895 if (branch) branch->SetAddress(&((*fDtype)[i]));
902 sprintf(branchname,"%sRecPoints",GetName());
903 branch = treeR->GetBranch(branchname);
904 if (branch) branch->SetAddress(&fRecPoints);
910 //____________________________________________________________________________
911 void AliITS::InitModules(Int_t size,Int_t &nmodules){
913 //initialize the modules array
916 fITSmodules->Delete();
920 Int_t nl,indexMAX,index;
922 if(size<=0){ // default to using data stored in AliITSgeom
924 Error("AliITS::InitModules",
925 "in AliITS::InitModule fITSgeom not defined\n");
927 } // end if fITSgeom==0
928 nl = fITSgeom->GetNlayers();
929 indexMAX = fITSgeom->GetModuleIndex(nl,fITSgeom->GetNladders(nl),
930 fITSgeom->GetNdetectors(nl))+1;
932 fITSmodules = new TObjArray(indexMAX);
933 for(index=0;index<indexMAX;index++){
934 fITSmodules->AddAt( new AliITSmodule(index),index);
937 fITSmodules = new TObjArray(size);
938 for(index=0;index<size;index++) {
939 fITSmodules->AddAt( new AliITSmodule(index),index);
946 //____________________________________________________________________________
947 void AliITS::FillModules(Int_t evnt,Int_t bgrev,Int_t nmodules,Option_t *option,Text_t *filename){
949 // fill the modules with the sorted by module hits; add hits from background
953 static TTree *trH1; //Tree with background hits
954 static TClonesArray *fHits2; //List of hits for one track only
956 static Bool_t first=kTRUE;
958 const char *addBgr = strstr(option,"Add");
963 // cout<<"filename "<<filename<<endl;
964 file=new TFile(filename);
965 // cout<<"I have opened "<<filename<<" file "<<endl;
966 fHits2 = new TClonesArray("AliITShit",1000 );
971 // Get Hits Tree header from file
972 if(fHits2) fHits2->Clear();
973 if(trH1) delete trH1;
977 sprintf(treeName,"TreeH%d",bgrev);
978 trH1 = (TTree*)gDirectory->Get(treeName);
979 //printf("TrH1 %p of treename %s for event %d \n",trH1,treeName,bgrev);
982 Error("AliITS::FillModules",
983 "cannot find Hits Tree for event:%d\n",bgrev);
985 // Set branch addresses
988 sprintf(branchname,"%s",GetName());
989 if (trH1 && fHits2) {
990 branch = trH1->GetBranch(branchname);
991 if (branch) branch->SetAddress(&fHits2);
995 //Int_t ntracks1 =(Int_t)TrH1->GetEntries();
996 //printf("background - ntracks1 - %d\n",ntracks1);
999 //Int_t npart = gAlice->GetEvent(evnt);
1000 //if(npart<=0) return;
1001 TClonesArray *itsHits = this->Hits();
1002 Int_t lay,lad,det,index;
1003 AliITShit *itsHit=0;
1004 AliITSmodule *mod=0;
1006 TTree *iTH = gAlice->TreeH();
1007 Int_t ntracks =(Int_t) iTH->GetEntries();
1010 for(t=0; t<ntracks; t++){
1011 gAlice->ResetHits();
1013 Int_t nhits = itsHits->GetEntriesFast();
1014 //printf("nhits %d\n",nhits);
1015 if (!nhits) continue;
1016 for(h=0; h<nhits; h++){
1017 itsHit = (AliITShit *)itsHits->UncheckedAt(h);
1018 itsHit->GetDetectorID(lay,lad,det);
1019 // temporarily index=det-1 !!!
1020 if(fITSgeom) index = fITSgeom->GetModuleIndex(lay,lad,det);
1023 mod = this->GetModule(index);
1024 mod->AddHit(itsHit,t,h);
1025 } // end loop over hits
1026 } // end loop over tracks
1028 // open the file with background
1032 ntracks =(Int_t)trH1->GetEntries();
1033 //printf("background - ntracks1 %d\n",ntracks);
1034 //printf("background - Start loop over tracks \n");
1037 for (track=0; track<ntracks; track++) {
1039 if (fHits2) fHits2->Clear();
1040 trH1->GetEvent(track);
1042 for(i=0;i<fHits2->GetEntriesFast();++i) {
1044 itsHit=(AliITShit*) (*fHits2)[i];
1045 itsHit->GetDetectorID(lay,lad,det);
1046 // temporarily index=det-1 !!!
1047 if(fITSgeom) index = fITSgeom->GetModuleIndex(lay,lad,det);
1050 mod = this->GetModule(index);
1051 mod->AddHit(itsHit,track,i);
1052 } // end loop over hits
1053 } // end loop over tracks
1055 TTree *fAli=gAlice->TreeK();
1058 if (fAli) fileAli =fAli->GetCurrentFile();
1063 //gObjectTable->Print();
1067 //____________________________________________________________________________
1069 void AliITS::SDigits2Digits()
1072 AliITSgeom *geom = GetITSgeom();
1075 AliITSDetType *iDetType;
1076 iDetType=DetType(0);
1077 AliITSsegmentationSPD *seg0=(AliITSsegmentationSPD*)iDetType->GetSegmentationModel();
1078 AliITSresponseSPD *res0 = (AliITSresponseSPD*)iDetType->GetResponseModel();
1079 AliITSsimulationSPD *sim0=new AliITSsimulationSPD(seg0,res0);
1080 SetSimulationModel(0,sim0);
1082 // printf("SPD dimensions %f %f \n",seg0->Dx(),seg0->Dz());
1083 // printf("SPD npixels %d %d \n",seg0->Npz(),seg0->Npx());
1084 // printf("SPD pitches %d %d \n",seg0->Dpz(0),seg0->Dpx(0));
1088 //Set response functions
1089 // SDD compression param: 2 fDecrease, 2fTmin, 2fTmax or disable, 2 fTolerance
1091 iDetType=DetType(1);
1092 AliITSresponseSDD *res1 = (AliITSresponseSDD*)iDetType->GetResponseModel();
1094 res1=new AliITSresponseSDD();
1095 SetResponseModel(1,res1);
1097 Float_t noise, baseline;
1098 res1->GetNoiseParam(noise,baseline);
1099 Float_t noise_after_el = res1->GetNoiseAfterElectronics();
1100 Float_t fCutAmp = baseline + 2.*noise_after_el;
1101 Int_t cp[8]={0,0,(int)fCutAmp,(int)fCutAmp,0,0,0,0}; //1D
1102 res1->SetCompressParam(cp);
1103 AliITSsegmentationSDD *seg1=(AliITSsegmentationSDD*)iDetType->GetSegmentationModel();
1105 seg1 = new AliITSsegmentationSDD(geom,res1);
1106 SetSegmentationModel(1,seg1);
1108 AliITSsimulationSDD *sim1=new AliITSsimulationSDD(seg1,res1);
1109 SetSimulationModel(1,sim1);
1112 iDetType=DetType(2);
1113 AliITSsegmentationSSD *seg2=(AliITSsegmentationSSD*)iDetType->GetSegmentationModel();
1114 AliITSresponseSSD *res2 = (AliITSresponseSSD*)iDetType->GetResponseModel();
1115 res2->SetSigmaSpread(3.,2.);
1116 AliITSsimulationSSD *sim2=new AliITSsimulationSSD(seg2,res2);
1117 SetSimulationModel(2,sim2);
1119 cerr<<"Digitizing ITS...\n";
1123 HitsToDigits(gAlice->GetEvNumber(),0,-1," ","All"," ");
1124 timer.Stop(); timer.Print();
1132 //____________________________________________________________________________
1133 void AliITS::HitsToDigits(Int_t evNumber,Int_t bgrev,Int_t size, Option_t *option, Option_t *opt,Text_t *filename)
1135 // keep galice.root for signal and name differently the file for
1136 // background when add! otherwise the track info for signal will be lost !
1138 // the condition below will disappear when the geom class will be
1139 // initialised for all versions - for the moment it is only for v5 !
1140 // 7 is the SDD beam test version
1141 Int_t ver = this->IsVersion();
1142 if(ver!=5 && ver!=7 && ver!=8 && ver!=9) return;
1144 const char *all = strstr(opt,"All");
1145 const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),strstr(opt,"SSD")};
1146 // cout<<" 1 AliITS "<<endl;
1148 InitModules(size,nmodules);
1149 // cout<<" 2 AliITS "<<endl;
1150 FillModules(evNumber,bgrev,nmodules,option,filename);
1151 // cout<<" 3 AliITS "<<endl;
1154 AliITSsimulation* sim;
1155 //TObjArray *branches=gAlice->TreeD()->GetListOfBranches();
1156 AliITSgeom *geom = GetITSgeom();
1159 // Int_t lay, lad, detect;
1161 for (id=0;id<kNTYPES;id++) {
1162 if (!all && !det[id]) continue;
1163 //branch = (TBranch*)branches->UncheckedAt(id);
1164 AliITSDetType *iDetType=DetType(id);
1165 sim = (AliITSsimulation*)iDetType->GetSimulationModel();
1168 Error("HitsToDigits","The simulation class was not instantiated!");
1170 // or SetDefaultSimulation();
1174 first = geom->GetStartDet(id);
1175 last = geom->GetLastDet(id);
1176 } else first=last=0;
1177 // cout << "det type " << id << " first, last "<< first << last << endl;
1178 for(module=first;module<=last;module++) {
1179 AliITSmodule *mod = (AliITSmodule *)fITSmodules->At(module);
1181 geom->GetModuleId(module,lay, lad, detect);
1183 ((AliITSsegmentationSSD*)(((AliITSsimulationSSD*)sim)->GetSegmentation()))->SetLayer(6);
1185 ((AliITSsegmentationSSD*)(((AliITSsimulationSSD*)sim)->GetSegmentation()))->SetLayer(5);
1187 sim->DigitiseModule(mod,module,evNumber);
1188 // fills all branches - wasted disk space
1189 gAlice->TreeD()->Fill();
1191 // try and fill only the branch
1194 } // loop over modules
1195 } // loop over detector types
1199 // Int_t nentries=(Int_t)
1200 gAlice->TreeD()->GetEntries();
1201 // cout << "nentries in TreeD" << nentries << endl;
1204 sprintf(hname,"TreeD%d",evNumber);
1205 gAlice->TreeD()->Write(hname,TObject::kOverwrite);
1207 gAlice->TreeD()->Reset();
1212 //____________________________________________________________________________
1213 void AliITS::DigitsToRecPoints(Int_t evNumber,Int_t lastentry,Option_t *opt)
1215 // cluster finding and reconstruction of space points
1217 // the condition below will disappear when the geom class will be
1218 // initialised for all versions - for the moment it is only for v5 !
1219 // 7 is the SDD beam test version
1220 Int_t ver = this->IsVersion();
1221 if(ver!=5 && ver!=8 && ver!=9) return;
1223 const char *all = strstr(opt,"All");
1224 const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),strstr(opt,"SSD")};
1226 static Bool_t first=kTRUE;
1227 if (!TreeC() && first) {
1232 TTree *treeC=TreeC();
1236 AliITSClusterFinder* rec;
1238 //TObjArray *branches=gAlice->TreeR()->GetListOfBranches();
1239 AliITSgeom *geom = GetITSgeom();
1242 for (id=0;id<kNTYPES;id++) {
1243 if (!all && !det[id]) continue;
1244 //branch = (TBranch*)branches->UncheckedAt(id);
1245 AliITSDetType *iDetType=DetType(id);
1246 rec = (AliITSClusterFinder*)iDetType->GetReconstructionModel();
1248 Error("DigitsToRecPoints","The cluster finder class was not instantiated!");
1250 // or SetDefaultClusterFinders();
1252 TClonesArray *itsDigits = this->DigitsAddress(id);
1256 first = geom->GetStartDet(id);
1257 last = geom->GetLastDet(id);
1258 } else first=last=0;
1259 printf("first module - last module %d %d\n",first,last);
1260 for(module=first;module<=last;module++) {
1261 this->ResetDigits();
1262 if (all) gAlice->TreeD()->GetEvent(lastentry+module);
1263 else gAlice->TreeD()->GetEvent(lastentry+(module-first));
1264 Int_t ndigits = itsDigits->GetEntriesFast();
1265 if (ndigits) rec->FindRawClusters(module);
1266 gAlice->TreeR()->Fill();
1270 // try and fill only the branch
1272 //ResetRecPoints(id);
1273 } // loop over modules
1274 } // loop over detector types
1277 // Int_t nentries=(Int_t)
1278 gAlice->TreeR()->GetEntries();
1279 // Int_t ncentries=(Int_t)
1280 treeC->GetEntries();
1281 // cout << " nentries ncentries " << nentries << ncentries << endl;
1284 sprintf(hname,"TreeR%d",evNumber);
1285 gAlice->TreeR()->Write(hname,TObject::kOverwrite);
1287 gAlice->TreeR()->Reset();
1289 sprintf(hname,"TreeC%d",evNumber);
1290 treeC->Write(hname,TObject::kOverwrite);
1293 //____________________________________________________________________________
1294 void AliITS::HitsToFastRecPoints(Int_t evNumber,Int_t bgrev,Int_t size,
1295 Option_t *option,Option_t *opt,Text_t *filename)
1297 // keep galice.root for signal and name differently the file for
1298 // background when add! otherwise the track info for signal will be lost !
1301 // the condition below will disappear when the geom class will be
1302 // initialised for all versions - for the moment it is only for v5 !
1303 Int_t ver = this->IsVersion();
1304 if(ver!=5 && ver!=8 && ver!=9) return;
1305 //if(ver!=5) return;
1307 const char *all = strstr(opt,"All");
1308 const char *det[3] ={strstr(opt,"SPD"),strstr(opt,"SDD"),strstr(opt,"SSD")};
1311 InitModules(size,nmodules);
1312 FillModules(evNumber,bgrev,nmodules,option,filename);
1315 AliITSsimulation* sim;
1316 AliITSgeom *geom = GetITSgeom();
1318 TRandom *random=new TRandom[9];
1319 random[0].SetSeed(111);
1320 random[1].SetSeed(222);
1321 random[2].SetSeed(333);
1322 random[3].SetSeed(444);
1323 random[4].SetSeed(555);
1324 random[5].SetSeed(666);
1325 random[6].SetSeed(777);
1326 random[7].SetSeed(888);
1327 random[8].SetSeed(999);
1331 for (id=0;id<kNTYPES;id++) {
1332 if (!all && !det[id]) continue;
1333 AliITSDetType *iDetType=DetType(id);
1334 sim = (AliITSsimulation*)iDetType->GetSimulationModel();
1336 Error("HitsToFastPoints",
1337 "The simulation class was not instantiated!");
1339 // or SetDefaultSimulation();
1344 first = geom->GetStartDet(id);
1345 last = geom->GetLastDet(id);
1346 } else first=last=0;
1347 printf("first module - last module %d %d\n",first,last);
1348 for(module=first;module<=last;module++) {
1349 AliITSmodule *mod = (AliITSmodule *)fITSmodules->At(module);
1350 sim->CreateFastRecPoints(mod,module,random);
1351 gAlice->TreeR()->Fill();
1353 } // loop over modules
1354 } // loop over detector types
1359 //Int_t nentries=(Int_t)gAlice->TreeR()->GetEntries();
1362 sprintf(hname,"TreeR%d",evNumber);
1363 gAlice->TreeR()->Write(hname,TObject::kOverwrite);
1365 gAlice->TreeR()->Reset();
1370 //________________________________________________________________
1371 AliITStrack AliITS::Tracking(AliITStrack &track, AliITStrack *reference,
1372 TObjArray *fastpoints, Int_t **vettid,
1373 Bool_t flagvert, AliITSRad *rl ) {
1374 // Origin A. Badala' and G.S. Pappalardo: e-mail Angela.Badala@ct.infn.it,
1375 // Giuseppe.S.Pappalardo@ct.infn.it
1377 TList *list= new TList();
1379 AliITStrack tr(track);
1383 Double_t Pt=(tr).GetPt();
1384 // cout << "\n Pt = " << Pt <<"\n"; //stampa
1386 AliITStracking obj(list, reference, this, fastpoints,
1387 TMath::Abs(Pt),vettid, flagvert, rl);
1392 TVector VecTotLabref(18);
1394 for(lay=5; lay>=0; lay--) {
1395 TVector VecLabref(3);
1396 VecLabref=(*reference).GetLabTrack(lay);
1397 Float_t ClustZ=(*reference).GetZclusterTrack( lay); //aggiunta il 5-3-2001
1399 //{itot++; VecTotLabref(itot)=VecLabref(k);} //cambiata il 5-3-2001
1400 Int_t lpp=(Int_t)VecLabref(k);
1402 TParticle *p=(TParticle*) gAlice->Particle(lpp);
1403 Int_t pcode=p->GetPdgCode();
1404 if(pcode==11) VecLabref(k)=p->GetFirstMother();
1406 itot++; VecTotLabref(itot)=VecLabref(k);
1407 if(VecLabref(k)==0. && ClustZ == 0.) VecTotLabref(itot) =-3.; }
1411 (*reference).Search(VecTotLabref, labref, freq);
1413 //if(freq < 4) labref=-labref;
1414 //if(freq < 6) labref=-labref; // cinque - sei
1415 if(freq < 5) labref=-labref; // cinque - sei
1416 (*reference).SetLabel(labref);
1421 //________________________________________________________________------
1422 void AliITS::DoTracking(Int_t evNumber, Int_t min_t, Int_t max_t,
1423 TFile *file, Bool_t flagvert) {
1424 // ex macro for tracking ITS
1426 printf("begin DoTracking - file %p\n",file);
1428 //const char *pname="75x40_100x60";
1430 Int_t imax=200,jmax=450;
1431 AliITSRad *rl = new AliITSRad(imax,jmax);
1432 //cout<<" dopo costruttore AliITSRad\n"; getchar();
1436 Float_t px,py,pz,x,y,z,pxg,pyg,pzg,ptg;
1440 gAlice->GetEvent(0);
1442 AliKalmanTrack *kkprov;
1443 kkprov->SetConvConst(100/0.299792458/0.2/gAlice->Field()->Factor());
1445 /* //modificato il 26-4-2001
1446 AliTPC *TPC=(AliTPC*)gAlice->GetDetector("TPC");
1447 AliTPCParam *digp = (AliTPCParam*)file->Get(pname);
1448 if (digp!=0) TPC->SetParam(digp);
1450 TFile *cf=TFile::Open("AliTPCclusters.root");
1451 AliTPCParam *digp= (AliTPCParam*)cf->Get("75x40_100x60");
1452 if (!digp) { cerr<<"TPC parameters have not been found !\n"; getchar();}
1454 AliTPCtracker *tracker = new AliTPCtracker(digp); //aggiunto il 23-5
1457 tracker->LoadInnerSectors();
1458 tracker->LoadOuterSectors();
1460 GoodTrack gt[15000];
1462 ifstream in("itsgood_tracks");
1464 cerr<<"Reading itsgood tracks...\n";
1465 while (in>>gt[ngood].lab>>gt[ngood].code
1466 >>gt[ngood].px >>gt[ngood].py>>gt[ngood].pz
1467 >>gt[ngood].x >>gt[ngood].y >>gt[ngood].z
1468 >>gt[ngood].pxg >>gt[ngood].pyg >>gt[ngood].pzg
1469 >>gt[ngood].ptg >>gt[ngood].flag) {
1473 cerr<<"Too many good tracks !\n";
1475 } // end if ngood==1500
1477 if (!in.eof()) cerr<<"Read error (itsgood_tracks) !\n";
1480 // TFile *tf=TFile::Open("tpctracks.root"); //commentato 26-4-2001
1481 TFile *tf=TFile::Open("AliTPCtracks.root");
1482 if (!tf->IsOpen()) {cerr<<"Can't open AliTPCtracks.root !\n"; return ;}
1483 TObjArray tracks(200000);
1484 //TTree *tracktree=(TTree*)tf->Get("TreeT");
1485 TTree *tracktree=(TTree*)tf->Get("TPCf"); //aggiunto il 23-5
1486 if (!tracktree) {cerr<<"Can't get a tree with TPC tracks !\n";}
1487 TBranch *tbranch=tracktree->GetBranch("tracks");
1488 Int_t nentr=(Int_t)tracktree->GetEntries();
1490 /* commentato il 26-4-2001
1491 for (kk=0; kk<nentr; kk++) {
1492 AliTPCtrack *iotrack=new AliTPCtrack;
1493 tbranch->SetAddress(&iotrack);
1494 tracktree->GetEvent(kk);
1495 tracks.AddLast(iotrack);
1498 AliTPCtrack *iotracktpc=0;
1499 for (kk=0; kk<nentr; kk++) {
1500 iotracktpc=new AliTPCtrack;
1501 tbranch->SetAddress(&iotracktpc);
1502 tracktree->GetEvent(kk);
1503 tracker->CookLabel(iotracktpc,0.1); //aggiunto 23-5
1504 tracks.AddLast(iotracktpc);
1509 Int_t nt = tracks.GetEntriesFast();
1510 cerr<<"Number of found tracks "<<nt<<endl;
1515 Double_t ptg=0.,pxg=0.,pyg=0.,pzg=0.;
1517 ////////////// good tracks definition in TPC ///////////////
1519 ofstream out1 ("AliITSTrag.out");
1521 for (i=0; i<ngood; i++) out1 << gt[i].ptg << "\n";
1526 TTree *TR=gAlice->TreeR();
1527 Int_t nent=(Int_t)TR->GetEntries();
1528 TClonesArray *recPoints = RecPoints();
1530 Int_t totalpoints=0;
1531 Int_t *np = new Int_t[nent];
1532 Int_t **vettid = new Int_t* [nent];
1534 for (mod=0; mod<nent; mod++) {
1536 this->ResetRecPoints();
1537 //gAlice->TreeR()->GetEvent(mod+1); //first entry in TreeR is empty
1538 gAlice->TreeR()->GetEvent(mod); //first entry in TreeR is empty
1539 numbpoints = recPoints->GetEntries();
1540 totalpoints+=numbpoints;
1541 np[mod] = numbpoints;
1542 //cout<<" mod = "<<mod<<" numbpoints = "<<numbpoints<<"\n";getchar();
1543 vettid[mod] = new Int_t[numbpoints];
1545 for (ii=0;ii<numbpoints; ii++) *(vettid[mod]+ii)=0;
1548 AliTPCtrack *track=0;
1550 if(min_t < 0) {min_t = 0; max_t = nt-1;}
1553 //////////////////// Definition of vertex end its error ////////////////////
1554 ////////////// In the future it will be given by a method //////////////////
1559 Float_t sigmavx=0.0050; // 50 microns
1560 Float_t sigmavy=0.0050; // 50 microns
1561 Float_t sigmavz=0.010; // 100 microns
1563 //Vx+=gRandom->Gaus(0,sigmavx); Vy+=gRandom->Gaus(0,sigmavy); Vz+=gRandom->Gaus(0,sigmavz);
1564 TVector vertex(3), ervertex(3)
1565 vertex(0)=Vx; vertex(1)=Vy; vertex(2)=Vz;
1566 ervertex(0)=sigmavx; ervertex(1)=sigmavy; ervertex(2)=sigmavz;
1567 //////////////////////////////////////////////////////////////////////////
1570 TTree tracktree1("TreeT","Tree with ITS tracks");
1571 AliITSiotrack *iotrack=0;
1572 tracktree1.Branch("ITStracks","AliITSiotrack",&iotrack,32000,0);
1574 ofstream out ("AliITSTra.out");
1575 //ofstream outprova ("AliITSprova.out"); //commentato il 26-4-2001
1578 for (j=min_t; j<=max_t; j++) {
1579 track=(AliTPCtrack*)tracks.UncheckedAt(j);
1581 if (!track) continue;
1582 ////// elimination of not good tracks ////////////
1583 Int_t ilab=TMath::Abs(track->GetLabel());
1585 for (iii=0;iii<ngood;iii++) {
1586 //cout<<" ilab, gt[iii].lab = "<<ilab<<" "<<gt[iii].lab<<"\n";getchar();
1587 if (ilab==gt[iii].lab) {
1596 //cout<<" j flaglab = " <<j<<" "<<flaglab<<"\n"; getchar();
1597 if (!flaglab) continue;
1598 //cout<<" j = " <<j<<"\n"; getchar();
1600 ////// old propagation to the end of TPC //////////////
1602 track->PropagateTo(xk);
1604 track->PropagateTo(xk,42.7,2.27); //C
1606 track->PropagateTo(xk,36.2,1.98e-3); //C02
1608 track->PropagateTo(xk,42.7,2.27); //C
1609 ///////////////////////////////////////////////////
1611 ////// new propagation to the end of TPC //////////////
1613 track->PropagateTo(xk, 28.94, 1.204e-3); //Ne
1615 track->PropagateTo(xk, 44.77, 1.71); //Tedlar
1617 track->PropagateTo(xk, 44.86, 1.45); //Kevlar
1619 track->PropagateTo(xk, 41.28, 0.029); //Nomex
1621 track->PropagateTo(xk,36.2,1.98e-3); //C02
1623 track->PropagateTo(xk, 24.01, 2.7); //Al
1625 track->PropagateTo(xk, 44.77, 1.71); //Tedlar
1627 track->PropagateTo(xk, 44.86, 1.45); //Kevlar
1629 track->PropagateTo(xk, 41.28, 0.029); //Nomex
1630 ///////////////////////////////////////////////////////////////
1632 ///////////////////////////////////////////////////////////////
1633 AliITStrack trackITS(*track);
1634 AliITStrack result(*track);
1635 AliITStrack primarytrack(*track);
1637 /////////////////////////////////////////////////////////////////
1639 Vgeant=result.GetVertex();
1641 // Definition of Dv and Zv for vertex constraint
1642 Double_t sigmaDv=0.0050; Double_t sigmaZv=0.010;
1643 //Double_t sigmaDv=0.0015; Double_t sigmaZv=0.0015;
1644 Double_t uniform= gRandom->Uniform();
1646 if(uniform<=0.5) signdv=-1.;
1650 Double_t Vr=TMath::Sqrt(Vgeant(0)*Vgeant(0)+ Vgeant(1)*Vgeant(1));
1651 Double_t Dv=gRandom->Gaus(signdv*Vr,(Float_t)sigmaDv);
1652 Double_t Zv=gRandom->Gaus(Vgeant(2),(Float_t)sigmaZv);
1654 //cout<<" Dv e Zv = "<<Dv<<" "<<Zv<<"\n";
1655 trackITS.SetDv(Dv); trackITS.SetZv(Zv);
1656 trackITS.SetsigmaDv(sigmaDv); trackITS.SetsigmaZv(sigmaZv);
1657 result.SetDv(Dv); result.SetZv(Zv);
1658 result.SetsigmaDv(sigmaDv); result.SetsigmaZv(sigmaZv);
1659 primarytrack.SetDv(Dv); primarytrack.SetZv(Zv);
1660 primarytrack.SetsigmaDv(sigmaDv); primarytrack.SetsigmaZv(sigmaZv);
1662 ////////////////////////////////////////////////////////////////
1664 primarytrack.PrimaryTrack(rl);
1665 TVector d2=primarytrack.Getd2();
1666 TVector tgl2=primarytrack.Gettgl2();
1667 TVector dtgl=primarytrack.Getdtgl();
1668 trackITS.Setd2(d2); trackITS.Settgl2(tgl2); trackITS.Setdtgl(dtgl);
1669 result.Setd2(d2); result.Settgl2(tgl2); result.Setdtgl(dtgl);
1671 trackITS.SetVertex(vertex); trackITS.SetErrorVertex(ervertex);
1672 result.SetVertex(vertex); result.SetErrorVertex(ervertex);
1676 Tracking(trackITS,&result,recPoints,vettid, flagvert,rl);
1677 // cout<<" progressive track number = "<<j<<"\r";
1679 Int_t NumofCluster=result.GetNumClust();
1680 // cout<<" progressive track number = "<<j<<"\n"; // stampa
1681 Long_t labITS=result.GetLabel();
1682 // cout << " ITS track label = " << labITS << "\n"; // stampa
1683 int lab=track->GetLabel();
1684 // cout << " TPC track label = " << lab <<"\n"; // stampa
1686 //propagation to vertex
1690 result.Propagation(rbeam);
1692 Double_t C00,C10,C11,C20,C21,C22,C30,C31,C32,C33,C40,C41,C42,C43,C44;
1693 result.GetCElements(C00,C10,C11,C20,C21,C22,C30,C31,C32,C33,C40,C41,C42,C43,C44);
1694 Double_t pt=TMath::Abs(result.GetPt());
1695 Double_t Dr=result.GetD();
1696 Double_t Z=result.GetZ();
1697 Double_t tgl=result.GetTgl();
1698 Double_t C=result.GetC();
1700 Double_t Dz=Z-(tgl/Cy)*TMath::ASin(result.arga(rbeam));
1703 // cout<<" Dr e dz alla fine = "<<Dr<<" "<<Dz<<"\n"; getchar();
1704 Double_t phi=result.Getphi();
1705 Double_t phivertex = phi - TMath::ASin(result.argA(rbeam));
1706 Double_t duepi=2.*TMath::Pi();
1707 if(phivertex>duepi) phivertex-=duepi;
1708 if(phivertex<0.) phivertex+=duepi;
1709 Double_t Dtot=TMath::Sqrt(Dr*Dr+Dz*Dz);
1711 /////////////////////////////////////////////////////////////////////
1713 Int_t idmodule,idpoint;
1714 if(NumofCluster >=5) { // cinque - sei
1715 //if(NumofCluster ==6) { // cinque - sei
1717 AliITSiotrack outtrack;
1721 iotrack->SetStatePhi(phi);
1722 iotrack->SetStateZ(Z);
1723 iotrack->SetStateD(Dr);
1724 iotrack->SetStateTgl(tgl);
1725 iotrack->SetStateC(C);
1726 Double_t radius=result.Getrtrack();
1727 iotrack->SetRadius(radius);
1729 if(C>0.) charge=-1; else charge=1;
1730 iotrack->SetCharge(charge);
1733 iotrack->SetCovMatrix(C00,C10,C11,C20,C21,C22,C30,C31,C32,C33,C40,C41,C42,C43,C44);
1735 Double_t px=pt*TMath::Cos(phivertex);
1736 Double_t py=pt*TMath::Sin(phivertex);
1739 Double_t xtrack=Dr*TMath::Sin(phivertex);
1740 Double_t ytrack=Dr*TMath::Cos(phivertex);
1741 Double_t ztrack=Dz+Vgeant(2);
1747 iotrack->SetX(xtrack);
1748 iotrack->SetY(ytrack);
1749 iotrack->SetZ(ztrack);
1750 iotrack->SetLabel(labITS);
1753 for(il=0;il<6; il++){
1754 iotrack->SetIdPoint(il,result.GetIdPoint(il));
1755 iotrack->SetIdModule(il,result.GetIdModule(il));
1759 //cout<<" labITS = "<<labITS<<"\n";
1760 //cout<<" phi z Dr tgl C = "<<phi<<" "<<Z<<" "<<Dr<<" "<<tgl<<" "<<C<<"\n"; getchar();
1762 DataOut(kkk) = ptg; kkk++; DataOut(kkk)=labITS; kkk++; DataOut(kkk)=lab; kkk++;
1764 for (il=0;il<6;il++) {
1765 idpoint=result.GetIdPoint(il);
1766 idmodule=result.GetIdModule(il);
1767 *(vettid[idmodule]+idpoint)=1;
1768 iotrack->SetIdPoint(il,idpoint);
1769 iotrack->SetIdModule(il,idmodule);
1772 // cout<<" +++++++++++++ pt e ptg = "<<pt<<" "<<ptg<<" ++++++++++\n";
1773 /* /// provvisorio il 23-5-2001
1774 Double_t pg=TMath::Sqrt(pxg*pxg+pyg*pyg+pzg*pzg);
1775 Double_t cosl=TMath::Sqrt(1./(1.+tgl*tgl));
1776 Double_t ptot=pt/cosl;
1777 cout<<"ptot e pg = "<<ptot<<" "<<pg<<"\n";
1778 Double_t difpt= (ptot-pg)/pg*100.;
1780 ///////////////////////////////
1781 Double_t difpt= (pt-ptg)/ptg*100.; //coomentato prov il 23-5-2001
1782 DataOut(kkk)=difpt; kkk++;
1783 Double_t lambdag=TMath::ATan(pzg/ptg);
1784 Double_t lam=TMath::ATan(tgl);
1785 Double_t diflam = (lam - lambdag)*1000.;
1786 DataOut(kkk) = diflam; kkk++;
1787 Double_t phig=TMath::ATan2(pyg,pxg);
1788 if(phig<0) phig=2.*TMath::Pi()+phig;
1789 Double_t phi=phivertex;
1791 Double_t difphi = (phi - phig)*1000.;
1792 DataOut(kkk)=difphi; kkk++;
1793 DataOut(kkk)=Dtot*1.e4; kkk++;
1794 DataOut(kkk)=Dr*1.e4; kkk++;
1795 DataOut(kkk)=Dz*1.e4; kkk++;
1797 for (r=0; r<9; r++) { out<<DataOut(r)<<" ";}
1801 } // end if on NumofCluster
1802 //gObjectTable->Print(); // stampa memoria
1803 } // end for (int j=min_t; j<=max_t; j++)
1808 static Bool_t first=kTRUE;
1809 static TFile *tfile;
1812 tfile=new TFile("itstracks.root","RECREATE");
1813 //cout<<"I have opened itstracks.root file "<<endl;
1820 sprintf(hname,"TreeT%d",evNumber);
1822 tracktree1.Write(hname);
1826 TTree *fAli=gAlice->TreeK();
1829 if (fAli) fileAli =fAli->GetCurrentFile();
1832 ///////////////////////////////////////////////////////////////////
1834 printf("delete vectors\n");
1835 if(np) delete [] np;
1836 if(vettid) delete [] vettid;