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.41 2001/04/21 15:16:51 barbera
19 Updated with the new SSD reconstruction code
21 Revision 1.40 2001/03/17 15:07:06 mariana
22 Update SDD response parameters
24 Revision 1.39 2001/03/12 17:45:32 hristov
25 Changes needed on Sun with CC 5.0
27 Revision 1.38 2001/03/07 14:04:51 barbera
28 Some vector dimensions increased to cope with full events
30 Revision 1.37 2001/03/07 12:36:35 barbera
31 A change added in the tracking part to manage delta rays
33 Revision 1.36 2001/03/02 19:44:11 barbera
34 modified to taking into account new version tracking v1
36 Revision 1.35 2001/02/28 18:16:46 mariana
37 Make the code compatible with the new AliRun
39 Revision 1.34 2001/02/11 15:51:39 mariana
40 Set protection in MakeBranch
42 Revision 1.33 2001/02/10 22:26:39 mariana
43 Move the initialization of the containers for raw clusters in MakeTreeC()
45 Revision 1.32 2001/02/08 23:55:31 nilsen
46 Removed fMajor/MinorVersion variables in favor of variables in derived classes.
47 Set arrays char *det[3] = {"SPD","SDD","SSD"} as const.
49 Revision 1.31 2001/02/02 23:57:28 nilsen
50 Added include file that are no londer included in AliITSgeom.h
52 Revision 1.30 2001/01/30 09:23:13 hristov
53 Streamers removed (R.Brun)
55 Revision 1.29 2001/01/26 20:01:09 hristov
56 Major upgrade of AliRoot code
58 Revision 1.28 2000/12/18 14:02:00 barbera
59 new version of the ITS tracking to take into account the new TPC track parametrization
61 Revision 1.27 2000/12/08 13:49:27 barbera
62 Hidden declaration in a for loop removed to be compliant with HP-UX compiler
64 Revision 1.26 2000/11/27 13:12:13 barbera
65 New version containing the files for tracking
67 Revision 1.25 2000/11/12 22:38:05 barbera
68 Added header file for the SPD Bari model
70 Revision 1.24 2000/10/09 22:18:12 barbera
71 Bug fixes from MAriana to le AliITStest.C run correctly
73 Revision 1.23 2000/10/05 20:47:42 nilsen
74 fixed dependencies of include files. Tryed but failed to get a root automaticly
75 generates streamer function to work. Modified SetDefaults.
77 Revision 1.9.2.15 2000/10/04 16:56:40 nilsen
78 Needed to include stdlib.h
81 Revision 1.22 2000/10/04 19:45:52 barbera
82 Corrected by F. Carminati for v3.04
84 Revision 1.21 2000/10/02 21:28:08 fca
85 Removal of useless dependecies via forward declarations
87 Revision 1.20 2000/10/02 16:31:39 barbera
90 Revision 1.9.2.14 2000/10/02 15:43:51 barbera
91 General code clean-up (e.g., printf -> cout)
93 Revision 1.19 2000/09/22 12:13:25 nilsen
94 Patches and updates for fixes to this and other routines.
96 Revision 1.18 2000/07/12 05:32:20 fca
97 Correcting several syntax problem with static members
99 Revision 1.17 2000/07/10 16:07:18 fca
100 Release version of ITS code
102 Revision 1.9.2.3 2000/02/02 13:42:09 barbera
103 fixed AliITS.cxx for new AliRun structure. Added ITS hits list to list of hits which will have their track numbers updated
105 Revision 1.9.2.2 2000/01/23 03:03:13 nilsen
106 //fixed FillModule. Removed fi(fabs(xl)<dx....
108 Revision 1.9.2.1 2000/01/12 19:03:32 nilsen
109 This is the version of the files after the merging done in December 1999.
110 See the ReadMe110100.txt file for details
112 Revision 1.9 1999/11/14 14:33:25 fca
113 Correct problems with distructors and pointers, thanks to I.Hrivnacova
115 Revision 1.8 1999/09/29 09:24:19 fca
116 Introduction of the Copyright and cvs Log
120 ///////////////////////////////////////////////////////////////////////////////
122 // An overview of the basic philosophy of the ITS code development
123 // and analysis is show in the figure below.
126 <img src="picts/ITS/ITS_Analysis_schema.gif">
129 <font size=+2 color=red>
130 <p>Roberto Barbera is in charge of the ITS Offline code (1999).
131 <a href="mailto:roberto.barbera@ct.infn.it">Roberto Barbera</a>.
137 // AliITS. Inner Traking System base class.
138 // This class contains the base procedures for the Inner Tracking System
142 <img src="picts/ITS/AliITS_Class_Diagram.gif">
145 <font size=+2 color=red>
146 <p>This show the class diagram of the different elements that are part of
154 // Written by Rene Brun, Federico Carminati, and Roberto Barbera
157 // Modified and documented by Bjorn S. Nilsen
161 // Modified and documented by A. Bologna
164 // AliITS is the general base class for the ITS. Also see AliDetector for
165 // futher information.
167 ///////////////////////////////////////////////////////////////////////////////
168 #include <iostream.h>
176 #include <TClonesArray.h>
178 #include <TObjectTable.h>
182 #include <TParticle.h>
187 #include "AliITSMap.h"
188 #include "AliITSDetType.h"
189 #include "AliITSClusterFinder.h"
190 //#include "AliITSsimulation.h"
191 #include "AliITSsimulationSPD.h"
192 #include "AliITSsimulationSDD.h"
193 #include "AliITSsimulationSSD.h"
194 #include "AliITSresponse.h"
195 #include "AliITSsegmentationSPD.h"
196 #include "AliITSresponseSPD.h"
197 #include "AliITSresponseSPDbari.h"
198 #include "AliITSsegmentationSDD.h"
199 #include "AliITSresponseSDD.h"
200 #include "AliITSsegmentationSSD.h"
201 #include "AliITSresponseSSD.h"
202 #include "AliITShit.h"
203 #include "AliITSgeom.h"
204 #include "AliITSdigit.h"
205 #include "AliITSmodule.h"
206 #include "AliITSRecPoint.h"
207 #include "AliITSRawCluster.h"
210 #include "AliKalmanTrack.h"
213 #include "AliITStrack.h"
214 #include "AliITSiotrack.h"
215 #include "AliITStracking.h"
216 #include "AliITSRad.h"
217 #include "../TPC/AliTPC.h"
218 #include "../TPC/AliTPCParam.h"
223 //_____________________________________________________________________________
224 AliITS::AliITS() : AliDetector() {
226 // Default initialiser for ITS
227 // The default constructor of the AliITS class. In addition to
228 // creating the AliITS class it zeros the variables fIshunt (a member
229 // of AliDetector class), fEuclidOut, and fIdN, and zeros the pointers
230 // fITSpoints, fIdSens, and fIdName. The AliDetector default constructor
238 fNDetTypes = kNTYPES;
257 //_____________________________________________________________________________
258 AliITS::AliITS(const char *name, const char *title):AliDetector(name,title){
260 // Default initialiser for ITS
261 // The constructor of the AliITS class. In addition to creating the
262 // AliITS class, it allocates memory for the TClonesArrays fHits and
263 // fDigits, and for the TObjArray fITSpoints. It also zeros the variables
264 // fIshunt (a member of AliDetector class), fEuclidOut, and fIdN, and zeros
265 // the pointers fIdSens and fIdName. To help in displaying hits via the ROOT
266 // macro display.C AliITS also sets the marker color to red. The variables
267 // passes with this constructor, const char *name and *title, are used by
268 // the constructor of AliDetector class. See AliDetector class for a
269 // description of these parameters and its constructor functions.
273 fHits = new TClonesArray("AliITShit", 1560);
274 gAlice->AddHitList(fHits);
276 fNDetTypes = kNTYPES;
278 fNdtype = new Int_t[kNTYPES];
279 fDtype = new TObjArray(kNTYPES);
281 fNctype = new Int_t[kNTYPES];
282 fCtype = new TObjArray(kNTYPES);
298 fDetTypes = new TObjArray(kNTYPES);
301 for(i=0;i<kNTYPES;i++) {
302 (*fDetTypes)[i]=new AliITSDetType();
308 SetMarkerColor(kRed);
312 //___________________________________________________________________________
313 AliITS::AliITS(AliITS &source){
315 if(this==&source) return;
316 Error("AliITS::Copy constructor",
317 "You are not allowed to make a copy of the AliITS");
320 //____________________________________________________________________________
321 AliITS& AliITS::operator=(AliITS &source){
322 // assignment operator
323 if(this==&source) return *this;
324 Error("AliITS::operator=",
325 "You are not allowed to make a copy of the AliITS");
327 return *this; //fake return
329 //____________________________________________________________________________
330 void AliITS::ClearModules(){
331 //clear the modules TObjArray
333 if(fITSmodules) fITSmodules->Delete();
336 //_____________________________________________________________________________
339 // Default distructor for ITS
340 // The default destructor of the AliITS class. In addition to deleting
341 // the AliITS class it deletes the memory pointed to by the fHits, fDigits,
342 // fIdSens, fIdName, and fITSpoints.
349 // delete fIdName; // TObjArray of TObjStrings
350 if(fIdName!=0) delete[] fIdName; // Array of TStrings
351 if(fIdSens!=0) delete[] fIdSens;
353 this->ClearModules();
355 }// end if fITSmodules!=0
375 if (fTreeC) delete fTreeC;
377 if (fITSgeom) delete fITSgeom;
381 //___________________________________________
382 AliITSDetType* AliITS::DetType(Int_t id)
384 //return pointer to id detector type
385 return ((AliITSDetType*) (*fDetTypes)[id]);
388 //___________________________________________
389 void AliITS::SetClasses(Int_t id, const char *digit, const char *cluster)
391 //set the digit and cluster classes to be used for the id detector type
392 ((AliITSDetType*) (*fDetTypes)[id])->ClassNames(digit,cluster);
395 //___________________________________________
396 void AliITS::SetResponseModel(Int_t id, AliITSresponse *response)
398 //set the response model for the id detector type
400 ((AliITSDetType*) (*fDetTypes)[id])->ResponseModel(response);
404 //___________________________________________
405 void AliITS::SetSegmentationModel(Int_t id, AliITSsegmentation *seg)
407 //set the segmentation model for the id detector type
409 ((AliITSDetType*) (*fDetTypes)[id])->SegmentationModel(seg);
413 //___________________________________________
414 void AliITS::SetSimulationModel(Int_t id, AliITSsimulation *sim)
416 //set the simulation model for the id detector type
418 ((AliITSDetType*) (*fDetTypes)[id])->SimulationModel(sim);
421 //___________________________________________
422 void AliITS::SetReconstructionModel(Int_t id, AliITSClusterFinder *reconst)
424 //set the cluster finder model for the id detector type
426 ((AliITSDetType*) (*fDetTypes)[id])->ReconstructionModel(reconst);
430 //_____________________________________________________________________________
431 void AliITS::AddHit(Int_t track, Int_t *vol, Float_t *hits){
434 // The function to add information to the AliITShit class. See the
435 // AliITShit class for a full description. This function allocates the
436 // necessary new space for the hit information and passes the variable
437 // track, and the pointers *vol and *hits to the AliITShit constructor
440 TClonesArray &lhits = *fHits;
441 new(lhits[fNhits++]) AliITShit(fIshunt,track,vol,hits);
443 //_____________________________________________________________________________
444 void AliITS::AddRealDigit(Int_t id, Int_t *digits)
446 // add a real digit - as coming from data
448 TClonesArray &ldigits = *((TClonesArray*)(*fDtype)[id]);
449 new(ldigits[fNdtype[id]++]) AliITSdigit(digits);
452 //_____________________________________________________________________________
453 void AliITS::AddSimDigit(Int_t id, AliITSdigit *d)
456 // add a simulated digit
458 TClonesArray &ldigits = *((TClonesArray*)(*fDtype)[id]);
463 new(ldigits[fNdtype[id]++]) AliITSdigitSPD(*((AliITSdigitSPD*)d));
466 new(ldigits[fNdtype[id]++]) AliITSdigitSDD(*((AliITSdigitSDD*)d));
469 new(ldigits[fNdtype[id]++]) AliITSdigitSSD(*((AliITSdigitSSD*)d));
475 //_____________________________________________________________________________
476 void AliITS::AddSimDigit(Int_t id,Float_t phys,Int_t *digits,Int_t *tracks,Int_t *hits,Float_t *charges){
478 // add a simulated digit to the list
480 TClonesArray &ldigits = *((TClonesArray*)(*fDtype)[id]);
484 new(ldigits[fNdtype[id]++]) AliITSdigitSPD(digits,tracks,hits);
487 new(ldigits[fNdtype[id]++]) AliITSdigitSDD(phys,digits,tracks,hits,charges);
490 new(ldigits[fNdtype[id]++]) AliITSdigitSSD(digits,tracks,hits);
496 //_____________________________________________________________________________
497 void AliITS::AddCluster(Int_t id, AliITSRawCluster *c)
500 // add a cluster to the list
502 TClonesArray &lcl = *((TClonesArray*)(*fCtype)[id]);
507 new(lcl[fNctype[id]++]) AliITSRawClusterSPD(*((AliITSRawClusterSPD*)c));
510 new(lcl[fNctype[id]++]) AliITSRawClusterSDD(*((AliITSRawClusterSDD*)c));
513 new(lcl[fNctype[id]++]) AliITSRawClusterSSD(*((AliITSRawClusterSSD*)c));
520 //_____________________________________________________________________________
521 void AliITS::AddRecPoint(const AliITSRecPoint &r)
524 // Add a reconstructed space point to the list
526 TClonesArray &lrecp = *fRecPoints;
527 new(lrecp[fNRecPoints++]) AliITSRecPoint(r);
531 //____________________________________________
532 void AliITS::ResetDigits()
535 // Reset number of digits and the digits array for the ITS detector
541 for (i=0;i<kNTYPES;i++ ) {
542 if ((*fDtype)[i]) ((TClonesArray*)(*fDtype)[i])->Clear();
543 if (fNdtype) fNdtype[i]=0;
547 //____________________________________________
548 void AliITS::ResetDigits(Int_t i)
551 // Reset number of digits and the digits array for this branch
553 if ((*fDtype)[i]) ((TClonesArray*)(*fDtype)[i])->Clear();
554 if (fNdtype) fNdtype[i]=0;
558 //____________________________________________
559 void AliITS::ResetClusters()
562 // Reset number of clusters and the clusters array for ITS
566 for (i=0;i<kNTYPES;i++ ) {
567 if ((*fCtype)[i]) ((TClonesArray*)(*fCtype)[i])->Clear();
568 if (fNctype) fNctype[i]=0;
573 //____________________________________________
574 void AliITS::ResetClusters(Int_t i)
577 // Reset number of clusters and the clusters array for this branch
579 if ((*fCtype)[i]) ((TClonesArray*)(*fCtype)[i])->Clear();
580 if (fNctype) fNctype[i]=0;
585 //____________________________________________
586 void AliITS::ResetRecPoints()
589 // Reset number of rec points and the rec points array
591 if (fRecPoints) fRecPoints->Clear();
596 //_____________________________________________________________________________
597 Int_t AliITS::DistancetoPrimitive(Int_t , Int_t ){
599 // Distance from mouse to ITS on the screen. Dummy routine
600 // A dummy routine used by the ROOT macro display.C to allow for the
601 // use of the mouse (pointing device) in the macro. In general this should
602 // never be called. If it is it returns the number 9999 for any value of
608 //_____________________________________________________________________________
611 // Initialise ITS after it has been built
612 // This routine initializes the AliITS class. It is intended to be called
613 // from the Init function in AliITSv?. Besides displaying a banner
614 // indicating that it has been called it initializes the array fIdSens
615 // and sets the default segmentation, response, digit and raw cluster classes
616 // Therefore it should be called after a call to CreateGeometry.
623 for(i=0;i<fIdN;i++) fIdSens[i] = gMC->VolId(fIdName[i]);
627 //_____________________________________________________________________________
628 void AliITS::SetDefaults()
630 // sets the default segmentation, response, digit and raw cluster classes
632 printf("SetDefaults\n");
634 AliITSDetType *iDetType;
640 if (!iDetType->GetSegmentationModel()) {
641 AliITSsegmentationSPD *seg0=new AliITSsegmentationSPD(fITSgeom);
642 SetSegmentationModel(0,seg0);
644 if (!iDetType->GetResponseModel()) {
645 SetResponseModel(0,new AliITSresponseSPD());
647 // set digit and raw cluster classes to be used
649 const char *kData0=(iDetType->GetResponseModel())->DataType();
650 if (strstr(kData0,"real")) {
651 iDetType->ClassNames("AliITSdigit","AliITSRawClusterSPD");
652 } else iDetType->ClassNames("AliITSdigitSPD","AliITSRawClusterSPD");
656 if (!iDetType->GetResponseModel()) {
657 SetResponseModel(1,new AliITSresponseSDD());
659 AliITSresponse *resp1=iDetType->GetResponseModel();
660 if (!iDetType->GetSegmentationModel()) {
661 AliITSsegmentationSDD *seg1=new AliITSsegmentationSDD(fITSgeom,resp1);
662 SetSegmentationModel(1,seg1);
664 const char *kData1=(iDetType->GetResponseModel())->DataType();
665 const char *kopt=iDetType->GetResponseModel()->ZeroSuppOption();
666 if ((!strstr(kopt,"2D")) && (!strstr(kopt,"1D")) || strstr(kData1,"real") ) {
667 iDetType->ClassNames("AliITSdigit","AliITSRawClusterSDD");
668 } else iDetType->ClassNames("AliITSdigitSDD","AliITSRawClusterSDD");
672 if (!iDetType->GetSegmentationModel()) {
673 AliITSsegmentationSSD *seg2=new AliITSsegmentationSSD(fITSgeom);
674 SetSegmentationModel(2,seg2);
676 if (!iDetType->GetResponseModel()) {
677 SetResponseModel(2,new AliITSresponseSSD());
679 const char *kData2=(iDetType->GetResponseModel())->DataType();
680 if (strstr(kData2,"real")) {
681 iDetType->ClassNames("AliITSdigit","AliITSRawClusterSSD");
682 } else iDetType->ClassNames("AliITSdigitSSD","AliITSRawClusterSSD");
685 Warning("SetDefaults","Only the three basic detector types are initialised!");
692 //_____________________________________________________________________________
693 void AliITS::SetDefaultSimulation()
698 //_____________________________________________________________________________
699 void AliITS::SetDefaultClusterFinders()
704 //_____________________________________________________________________________
706 void AliITS::MakeTreeC(Option_t *option)
708 // create a separate tree to store the clusters
710 cout << "AliITS::MakeTreeC" << endl;
712 const char *optC = strstr(option,"C");
713 if (optC && !fTreeC) fTreeC = new TTree("TC","Clusters in ITS");
716 Int_t buffersize = 4000;
719 const char *det[3] = {"SPD","SDD","SSD"};
724 // one branch for Clusters per type of detector
726 for (i=0; i<kNTYPES ;i++) {
727 AliITSDetType *iDetType=DetType(i);
728 iDetType->GetClassNames(digclass,clclass);
730 (*fCtype)[i] = new TClonesArray(clclass,10000);
731 if (kNTYPES==3) sprintf(branchname,"%sClusters%s",GetName(),det[i]);
732 else sprintf(branchname,"%sClusters%d",GetName(),i+1);
733 if (fCtype && fTreeC) {
734 TreeC()->Branch(branchname,&((*fCtype)[i]), buffersize);
735 cout << "Making Branch " << branchname;
736 cout << " for Clusters of detector type " << i+1 << endl;
742 //_____________________________________________________________________________
743 void AliITS::GetTreeC(Int_t event)
746 cout << "AliITS::GetTreeC" << endl;
748 // get the clusters tree for this event and set the branch address
752 const char *det[3] = {"SPD","SDD","SSD"};
759 sprintf(treeName,"TreeC%d",event);
760 fTreeC = (TTree*)gDirectory->Get(treeName);
765 for (i=0; i<kNTYPES; i++) {
766 if (kNTYPES==3) sprintf(branchname,"%sClusters%s",GetName(),det[i]);
767 else sprintf(branchname,"%sClusters%d",GetName(),i+1);
769 branch = fTreeC->GetBranch(branchname);
770 if (branch) branch->SetAddress(&((*fCtype)[i]));
774 Error("AliITS::GetTreeC",
775 "cannot find Clusters Tree for event:%d\n",event);
779 //_____________________________________________________________________________
780 void AliITS::MakeBranch(Option_t* option, char *file)
783 // Creates Tree branches for the ITS.
786 Int_t buffersize = 4000;
788 sprintf(branchname,"%s",GetName());
790 AliDetector::MakeBranch(option,file);
792 const char *cD = strstr(option,"D");
793 const char *cR = strstr(option,"R");
797 // one branch for digits per type of detector
799 const char *det[3] = {"SPD","SDD","SSD"};
805 for (i=0; i<kNTYPES ;i++) {
806 AliITSDetType *iDetType=DetType(i);
807 iDetType->GetClassNames(digclass,clclass);
809 if(!((*fDtype)[i])) (*fDtype)[i] = new TClonesArray(digclass,10000);
813 for (i=0; i<kNTYPES ;i++) {
814 if (kNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]);
815 else sprintf(branchname,"%sDigits%d",GetName(),i+1);
816 if (fDtype && gAlice->TreeD()) {
817 gAlice->MakeBranchInTree(gAlice->TreeD(),
818 branchname, &((*fDtype)[i]), buffersize, file);
819 cout << "Making Branch " << branchname;
820 cout << " for digits of type "<< i+1 << endl;
827 // only one branch for rec points for all detector types
829 sprintf(branchname,"%sRecPoints",GetName());
831 if(!fRecPoints) fRecPoints=new TClonesArray("AliITSRecPoint",10000);
833 if (fRecPoints && gAlice->TreeR()) {
834 gAlice->MakeBranchInTree(gAlice->TreeR(),
835 branchname, &fRecPoints, buffersize, file) ;
836 cout << "Making Branch " << branchname;
837 cout << " for reconstructed space points" << endl;
842 //___________________________________________
843 void AliITS::SetTreeAddress()
846 // Set branch address for the Trees.
849 AliDetector::SetTreeAddress();
851 const char *det[3] = {"SPD","SDD","SSD"};
854 TTree *treeD = gAlice->TreeD();
855 TTree *treeR = gAlice->TreeR();
859 for (i=0; i<kNTYPES; i++) {
860 if (kNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]);
861 else sprintf(branchname,"%sDigits%d",GetName(),i+1);
863 branch = treeD->GetBranch(branchname);
864 if (branch) branch->SetAddress(&((*fDtype)[i]));
871 sprintf(branchname,"%sRecPoints",GetName());
872 branch = treeR->GetBranch(branchname);
873 if (branch) branch->SetAddress(&fRecPoints);
879 //____________________________________________________________________________
880 void AliITS::InitModules(Int_t size,Int_t &nmodules){
882 //initialize the modules array
885 fITSmodules->Delete();
889 Int_t nl,indexMAX,index;
891 if(size<=0){ // default to using data stored in AliITSgeom
893 Error("AliITS::InitModules",
894 "in AliITS::InitModule fITSgeom not defined\n");
896 } // end if fITSgeom==0
897 nl = fITSgeom->GetNlayers();
898 indexMAX = fITSgeom->GetModuleIndex(nl,fITSgeom->GetNladders(nl),
899 fITSgeom->GetNdetectors(nl))+1;
901 fITSmodules = new TObjArray(indexMAX);
902 for(index=0;index<indexMAX;index++){
903 fITSmodules->AddAt( new AliITSmodule(index),index);
906 fITSmodules = new TObjArray(size);
907 for(index=0;index<size;index++) {
908 fITSmodules->AddAt( new AliITSmodule(index),index);
915 //____________________________________________________________________________
916 void AliITS::FillModules(Int_t evnt,Int_t bgrev,Int_t nmodules,Option_t *option,Text_t *filename){
918 // fill the modules with the sorted by module hits; add hits from background
922 static TTree *trH1; //Tree with background hits
923 static TClonesArray *fHits2; //List of hits for one track only
925 static Bool_t first=kTRUE;
927 const char *addBgr = strstr(option,"Add");
932 cout<<"filename "<<filename<<endl;
933 file=new TFile(filename);
934 cout<<"I have opened "<<filename<<" file "<<endl;
935 fHits2 = new TClonesArray("AliITShit",1000 );
940 // Get Hits Tree header from file
941 if(fHits2) fHits2->Clear();
942 if(trH1) delete trH1;
946 sprintf(treeName,"TreeH%d",bgrev);
947 trH1 = (TTree*)gDirectory->Get(treeName);
948 //printf("TrH1 %p of treename %s for event %d \n",trH1,treeName,bgrev);
951 Error("AliITS::FillModules",
952 "cannot find Hits Tree for event:%d\n",bgrev);
954 // Set branch addresses
957 sprintf(branchname,"%s",GetName());
958 if (trH1 && fHits2) {
959 branch = trH1->GetBranch(branchname);
960 if (branch) branch->SetAddress(&fHits2);
964 //Int_t ntracks1 =(Int_t)TrH1->GetEntries();
965 //printf("background - ntracks1 - %d\n",ntracks1);
968 //Int_t npart = gAlice->GetEvent(evnt);
969 //if(npart<=0) return;
970 TClonesArray *itsHits = this->Hits();
971 Int_t lay,lad,det,index;
975 TTree *iTH = gAlice->TreeH();
976 Int_t ntracks =(Int_t) iTH->GetEntries();
979 for(t=0; t<ntracks; t++){
982 Int_t nhits = itsHits->GetEntriesFast();
983 //printf("nhits %d\n",nhits);
984 if (!nhits) continue;
985 for(h=0; h<nhits; h++){
986 itsHit = (AliITShit *)itsHits->UncheckedAt(h);
987 itsHit->GetDetectorID(lay,lad,det);
988 // temporarily index=det-1 !!!
989 if(fITSgeom) index = fITSgeom->GetModuleIndex(lay,lad,det);
992 mod = this->GetModule(index);
993 mod->AddHit(itsHit,t,h);
994 } // end loop over hits
995 } // end loop over tracks
997 // open the file with background
1001 ntracks =(Int_t)trH1->GetEntries();
1002 //printf("background - ntracks1 %d\n",ntracks);
1003 //printf("background - Start loop over tracks \n");
1006 for (track=0; track<ntracks; track++) {
1008 if (fHits2) fHits2->Clear();
1009 trH1->GetEvent(track);
1011 for(i=0;i<fHits2->GetEntriesFast();++i) {
1013 itsHit=(AliITShit*) (*fHits2)[i];
1014 itsHit->GetDetectorID(lay,lad,det);
1015 // temporarily index=det-1 !!!
1016 if(fITSgeom) index = fITSgeom->GetModuleIndex(lay,lad,det);
1019 mod = this->GetModule(index);
1020 mod->AddHit(itsHit,track,i);
1021 } // end loop over hits
1022 } // end loop over tracks
1024 TTree *fAli=gAlice->TreeK();
1027 if (fAli) fileAli =fAli->GetCurrentFile();
1032 //gObjectTable->Print();
1036 //____________________________________________________________________________
1038 void AliITS::SDigits2Digits()
1041 AliITSgeom *geom = GetITSgeom();
1044 AliITSDetType *iDetType;
1045 iDetType=DetType(0);
1046 AliITSsegmentationSPD *seg0=(AliITSsegmentationSPD*)iDetType->GetSegmentationModel();
1047 AliITSresponseSPD *res0 = (AliITSresponseSPD*)iDetType->GetResponseModel();
1048 AliITSsimulationSPD *sim0=new AliITSsimulationSPD(seg0,res0);
1049 SetSimulationModel(0,sim0);
1051 // printf("SPD dimensions %f %f \n",seg0->Dx(),seg0->Dz());
1052 // printf("SPD npixels %d %d \n",seg0->Npz(),seg0->Npx());
1053 // printf("SPD pitches %d %d \n",seg0->Dpz(0),seg0->Dpx(0));
1057 //Set response functions
1058 // SDD compression param: 2 fDecrease, 2fTmin, 2fTmax or disable, 2 fTolerance
1060 iDetType=DetType(1);
1061 AliITSresponseSDD *res1 = (AliITSresponseSDD*)iDetType->GetResponseModel();
1063 res1=new AliITSresponseSDD();
1064 SetResponseModel(1,res1);
1066 Float_t noise, baseline;
1067 res1->GetNoiseParam(noise,baseline);
1068 Float_t noise_after_el = res1->GetNoiseAfterElectronics();
1069 Float_t fCutAmp = baseline + 2.*noise_after_el;
1070 Int_t cp[8]={0,0,(int)fCutAmp,(int)fCutAmp,0,0,0,0}; //1D
1071 res1->SetCompressParam(cp);
1072 AliITSsegmentationSDD *seg1=(AliITSsegmentationSDD*)iDetType->GetSegmentationModel();
1074 seg1 = new AliITSsegmentationSDD(geom,res1);
1075 SetSegmentationModel(1,seg1);
1077 AliITSsimulationSDD *sim1=new AliITSsimulationSDD(seg1,res1);
1078 SetSimulationModel(1,sim1);
1081 iDetType=DetType(2);
1082 AliITSsegmentationSSD *seg2=(AliITSsegmentationSSD*)iDetType->GetSegmentationModel();
1083 AliITSresponseSSD *res2 = (AliITSresponseSSD*)iDetType->GetResponseModel();
1084 res2->SetSigmaSpread(3.,2.);
1085 AliITSsimulationSSD *sim2=new AliITSsimulationSSD(seg2,res2);
1086 SetSimulationModel(2,sim2);
1088 cerr<<"Digitizing ITS...\n";
1092 HitsToDigits(0,0,-1," ","All"," ");
1093 timer.Stop(); timer.Print();
1101 //____________________________________________________________________________
1102 void AliITS::HitsToDigits(Int_t evNumber,Int_t bgrev,Int_t size, Option_t *option, Option_t *opt,Text_t *filename)
1104 // keep galice.root for signal and name differently the file for
1105 // background when add! otherwise the track info for signal will be lost !
1107 // the condition below will disappear when the geom class will be
1108 // initialised for all versions - for the moment it is only for v5 !
1109 // 7 is the SDD beam test version
1110 Int_t ver = this->IsVersion();
1111 if(ver!=5 && ver!=7) return;
1113 const char *all = strstr(opt,"All");
1114 const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),strstr(opt,"SSD")};
1115 cout<<" 1 AliITS "<<endl;
1117 InitModules(size,nmodules);
1118 cout<<" 2 AliITS "<<endl;
1119 FillModules(evNumber,bgrev,nmodules,option,filename);
1120 cout<<" 3 AliITS "<<endl;
1123 AliITSsimulation* sim;
1124 //TObjArray *branches=gAlice->TreeD()->GetListOfBranches();
1125 AliITSgeom *geom = GetITSgeom();
1128 Int_t lay, lad, detect;
1130 for (id=0;id<kNTYPES;id++) {
1131 if (!all && !det[id]) continue;
1132 //branch = (TBranch*)branches->UncheckedAt(id);
1133 AliITSDetType *iDetType=DetType(id);
1134 sim = (AliITSsimulation*)iDetType->GetSimulationModel();
1137 Error("HitsToDigits","The simulation class was not instantiated!");
1139 // or SetDefaultSimulation();
1143 first = geom->GetStartDet(id);
1144 last = geom->GetLastDet(id);
1145 } else first=last=0;
1146 cout << "det type " << id << " first, last "<< first << last << endl;
1147 for(module=first;module<=last;module++) {
1148 AliITSmodule *mod = (AliITSmodule *)fITSmodules->At(module);
1150 geom->GetModuleId(module,lay, lad, detect);
1152 ((AliITSsegmentationSSD*)(((AliITSsimulationSSD*)sim)->GetSegmentation()))->SetLayer(6);
1154 ((AliITSsegmentationSSD*)(((AliITSsimulationSSD*)sim)->GetSegmentation()))->SetLayer(5);
1156 sim->DigitiseModule(mod,module,evNumber);
1157 // fills all branches - wasted disk space
1158 gAlice->TreeD()->Fill();
1160 // try and fill only the branch
1163 } // loop over modules
1164 } // loop over detector types
1168 Int_t nentries=(Int_t)gAlice->TreeD()->GetEntries();
1169 cout << "nentries in TreeD" << nentries << endl;
1172 sprintf(hname,"TreeD%d",evNumber);
1173 gAlice->TreeD()->Write(hname,TObject::kOverwrite);
1175 gAlice->TreeD()->Reset();
1180 //____________________________________________________________________________
1181 void AliITS::DigitsToRecPoints(Int_t evNumber,Int_t lastentry,Option_t *opt)
1183 // cluster finding and reconstruction of space points
1185 // the condition below will disappear when the geom class will be
1186 // initialised for all versions - for the moment it is only for v5 !
1187 // 7 is the SDD beam test version
1188 Int_t ver = this->IsVersion();
1191 const char *all = strstr(opt,"All");
1192 const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),strstr(opt,"SSD")};
1194 static Bool_t first=kTRUE;
1195 if (!TreeC() && first) {
1200 TTree *treeC=TreeC();
1204 AliITSClusterFinder* rec;
1206 //TObjArray *branches=gAlice->TreeR()->GetListOfBranches();
1207 AliITSgeom *geom = GetITSgeom();
1210 for (id=0;id<kNTYPES;id++) {
1211 if (!all && !det[id]) continue;
1212 //branch = (TBranch*)branches->UncheckedAt(id);
1213 AliITSDetType *iDetType=DetType(id);
1214 rec = (AliITSClusterFinder*)iDetType->GetReconstructionModel();
1216 Error("DigitsToRecPoints","The cluster finder class was not instantiated!");
1218 // or SetDefaultClusterFinders();
1220 TClonesArray *itsDigits = this->DigitsAddress(id);
1224 first = geom->GetStartDet(id);
1225 last = geom->GetLastDet(id);
1226 } else first=last=0;
1227 //printf("first last %d %d\n",first,last);
1228 for(module=first;module<=last;module++) {
1229 this->ResetDigits();
1230 if (all) gAlice->TreeD()->GetEvent(lastentry+module);
1231 else gAlice->TreeD()->GetEvent(lastentry+(module-first));
1232 Int_t ndigits = itsDigits->GetEntriesFast();
1233 if (ndigits) rec->FindRawClusters();
1234 gAlice->TreeR()->Fill();
1238 // try and fill only the branch
1240 //ResetRecPoints(id);
1241 } // loop over modules
1242 } // loop over detector types
1245 Int_t nentries=(Int_t)gAlice->TreeR()->GetEntries();
1246 Int_t ncentries=(Int_t)treeC->GetEntries();
1247 cout << " nentries ncentries " << nentries << ncentries << endl;
1250 sprintf(hname,"TreeR%d",evNumber);
1251 gAlice->TreeR()->Write(hname,TObject::kOverwrite);
1253 gAlice->TreeR()->Reset();
1255 sprintf(hname,"TreeC%d",evNumber);
1256 treeC->Write(hname,TObject::kOverwrite);
1261 //____________________________________________________________________________
1262 void AliITS::HitsToFastRecPoints(Int_t evNumber,Int_t bgrev,Int_t size,
1263 Option_t *option,Option_t *opt,Text_t *filename)
1265 // keep galice.root for signal and name differently the file for
1266 // background when add! otherwise the track info for signal will be lost !
1269 // the condition below will disappear when the geom class will be
1270 // initialised for all versions - for the moment it is only for v5 !
1271 Int_t ver = this->IsVersion();
1274 const char *all = strstr(opt,"All");
1275 const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),strstr(opt,"SSD")};
1278 InitModules(size,nmodules);
1279 FillModules(evNumber,bgrev,nmodules,option,filename);
1282 AliITSsimulation* sim;
1283 AliITSgeom *geom = GetITSgeom();
1285 TRandom *random=new TRandom[9];
1286 random[0].SetSeed(111);
1287 random[1].SetSeed(222);
1288 random[2].SetSeed(333);
1289 random[3].SetSeed(444);
1290 random[4].SetSeed(555);
1291 random[5].SetSeed(666);
1292 random[6].SetSeed(777);
1293 random[7].SetSeed(888);
1294 random[8].SetSeed(999);
1298 for (id=0;id<kNTYPES;id++) {
1299 if (!all && !det[id]) continue;
1300 AliITSDetType *iDetType=DetType(id);
1301 sim = (AliITSsimulation*)iDetType->GetSimulationModel();
1303 Error("HitsToFastPoints","The simulation class was not instantiated!");
1305 // or SetDefaultSimulation();
1307 Int_t first = geom->GetStartDet(id);
1308 Int_t last = geom->GetLastDet(id);
1309 for(module=first;module<=last;module++) {
1310 AliITSmodule *mod = (AliITSmodule *)fITSmodules->At(module);
1311 sim->CreateFastRecPoints(mod,module,random);
1312 gAlice->TreeR()->Fill();
1314 } // loop over modules
1315 } // loop over detector types
1320 //Int_t nentries=(Int_t)gAlice->TreeR()->GetEntries();
1323 sprintf(hname,"TreeR%d",evNumber);
1324 gAlice->TreeR()->Write(hname,TObject::kOverwrite);
1326 gAlice->TreeR()->Reset();
1332 //________________________________________________________________
1334 AliITStrack AliITS::Tracking(AliITStrack &track, AliITStrack *reference,TObjArray *fastpoints, Int_t
1335 **vettid, Bool_t flagvert, AliITSRad *rl ) {
1337 //Origin A. Badala' and G.S. Pappalardo: e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it
1340 TList *list= new TList();
1342 AliITStrack tr(track);
1346 Double_t Pt=(tr).GetPt();
1347 cout << "\n Pt = " << Pt <<"\n";
1349 AliITStracking obj(list, reference, this, fastpoints,TMath::Abs(Pt),vettid, flagvert, rl);
1354 TVector VecTotLabref(18);
1356 for(lay=5; lay>=0; lay--) {
1357 TVector VecLabref(3);
1358 VecLabref=(*reference).GetLabTrack(lay);
1359 Float_t ClustZ=(*reference).GetZclusterTrack( lay); //modified il 5-3-2001
1360 for(k=0; k<3; k++) { // {itot++; VecTotLabref(itot)=VecLabref(k);} // modified 5-3-2002
1362 Int_t lpp=(Int_t)VecLabref(k);
1364 TParticle *p=(TParticle*) gAlice->Particle(lpp);
1365 Int_t pcode=p->GetPdgCode();
1366 if(pcode==11) VecLabref(k)=p->GetFirstMother();
1369 itot++; VecTotLabref(itot)=VecLabref(k);
1370 if(VecLabref(k)==0. && ClustZ == 0.) VecTotLabref(itot) =-3.;
1375 (*reference).Search(VecTotLabref, labref, freq);
1377 if(freq < 5) labref=-labref;
1378 (*reference).SetLabel(labref);
1386 //________________________________________________________________
1390 void AliITS::DoTracking(Int_t evNumber, Int_t min_t, Int_t max_t, TFile *file, Bool_t flagvert) {
1392 // ex macro for tracking ITS
1394 printf("begin DoTracking - file %p\n",file);
1396 //const char *pname="75x40_100x60"; //commentato il 24-4-2001
1398 Int_t imax=200,jmax=450;
1399 AliITSRad *rl = new AliITSRad(imax,jmax);
1400 //cout<<" dopo costruttore AliITSRad\n"; getchar();
1404 Float_t px,py,pz,x,y,z,pxg,pyg,pzg,ptg;
1409 gAlice->GetEvent(0);
1412 //AliKalmanTrack::SetConvConst(100/0.299792458/0.2/gAlice->Field()->Factor());
1413 AliKalmanTrack *kkprov;
1414 kkprov->SetConvConst(100/0.299792458/0.2/gAlice->Field()->Factor());
1416 /////////////////////////////////////////////////////////////////////////////
1418 TFile *cf=TFile::Open("AliTPCclusters.root");
1419 AliTPCParam *digp= (AliTPCParam*)cf->Get("75x40_100x60");
1420 if (!digp) { cerr<<"TPC parameters have not been found !\n"; getchar();}
1422 GoodTrack gt[15000];
1424 ifstream in("itsgood_tracks");
1426 cerr<<"Reading itsgood tracks...\n";
1427 while (in>>gt[ngood].lab>>gt[ngood].code
1428 >>gt[ngood].px >>gt[ngood].py>>gt[ngood].pz
1429 >>gt[ngood].x >>gt[ngood].y >>gt[ngood].z
1430 >>gt[ngood].pxg >>gt[ngood].pyg >>gt[ngood].pzg
1431 >>gt[ngood].ptg >>gt[ngood].flag) {
1435 cerr<<"Too many good tracks !\n";
1439 if (!in.eof()) cerr<<"Read error (itsgood_tracks) !\n";
1443 //TFile *tf=TFile::Open("tpctracks.root");
1444 TFile *tf=TFile::Open("AliTPCtracks.root");
1445 if (!tf->IsOpen()) {cerr<<"Can't open AliTPCtracks.root !\n"; return ;}
1446 TObjArray tracks(200000);
1447 //TObjArray tracks(2000); //nuovo 24-4-2001
1449 TTree *tracktree=(TTree*)tf->Get("TreeT");
1450 TBranch *tbranch=tracktree->GetBranch("tracks");
1451 Int_t nentr=(Int_t)tracktree->GetEntries();
1453 AliTPCtrack *iotracktpc=0;
1454 for (kk=0; kk<nentr; kk++) {
1455 iotracktpc=new AliTPCtrack;
1456 tbranch->SetAddress(&iotracktpc);
1457 tracktree->GetEvent(kk);
1458 tracks.AddLast(iotracktpc);
1463 Int_t nt = tracks.GetEntriesFast();
1464 cerr<<"Number of found tracks "<<nt<<endl;
1469 Double_t ptg=0.,pxg=0.,pyg=0.,pzg=0.;
1471 ////////////////////////////// good tracks definition in TPC ////////////////////////////////
1473 ofstream out1 ("AliITSTrag.out");
1475 for (i=0; i<ngood; i++) out1 << gt[i].ptg << "\n";
1480 TTree *TR=gAlice->TreeR();
1481 Int_t nent=(Int_t)TR->GetEntries();
1482 TClonesArray *recPoints = RecPoints();
1484 Int_t totalpoints=0;
1485 Int_t *np = new Int_t[nent];
1486 Int_t **vettid = new Int_t* [nent];
1488 for (mod=0; mod<nent; mod++) {
1490 this->ResetRecPoints();
1491 //gAlice->TreeR()->GetEvent(mod+1); //first entry in TreeR is empty
1492 gAlice->TreeR()->GetEvent(mod); //first entry in TreeR is empty
1493 numbpoints = recPoints->GetEntries();
1494 totalpoints+=numbpoints;
1495 np[mod] = numbpoints;
1496 cout<<" mod = "<<mod<<" numbpoints = "<<numbpoints<<"\n"; //getchar();
1497 vettid[mod] = new Int_t[numbpoints];
1499 for (ii=0;ii<numbpoints; ii++) *(vettid[mod]+ii)=0;
1502 AliTPCtrack *track=0;
1504 if(min_t < 0) {min_t = 0; max_t = nt-1;}
1507 ///////////////////////////////// Definition of vertex end its error ////////////////////////////
1508 ////////////////////////// In the future it will be given by a method ///////////////////////////
1513 Float_t sigmavx=0.0050; // 50 microns
1514 Float_t sigmavy=0.0050; // 50 microns
1515 Float_t sigmavz=0.010; // 100 microns
1517 //Vx+=gRandom->Gaus(0,sigmavx); Vy+=gRandom->Gaus(0,sigmavy); Vz+=gRandom->Gaus(0,sigmavz);
1518 TVector vertex(3), ervertex(3)
1519 vertex(0)=Vx; vertex(1)=Vy; vertex(2)=Vz;
1520 ervertex(0)=sigmavx; ervertex(1)=sigmavy; ervertex(2)=sigmavz;
1521 /////////////////////////////////////////////////////////////////////////////////////////////////
1524 //TDirectory *savedir=gDirectory;
1526 TTree tracktree1("TreeT","Tree with ITS tracks");
1527 AliITSiotrack *iotrack=0;
1528 tracktree1.Branch("ITStracks","AliITSiotrack",&iotrack,32000,0);
1530 ofstream out ("AliITSTra.out");
1533 for (j=min_t; j<=max_t; j++) {
1534 track=(AliTPCtrack*)tracks.UncheckedAt(j);
1537 if (!track) continue;
1538 ////// elimination of not good tracks ////////////
1539 Int_t ilab=TMath::Abs(track->GetLabel());
1541 for (iii=0;iii<ngood;iii++) {
1542 //cout<<" ilab, gt[iii].lab = "<<ilab<<" "<<gt[iii].lab<<"\n"; getchar();
1543 if (ilab==gt[iii].lab) {
1552 //cout<<" j flaglab = " <<j<<" "<<flaglab<<"\n"; getchar();
1553 if (!flaglab) continue;
1554 //cout<<" j = " <<j<<"\n"; getchar();
1556 ////// old propagation to the end of TPC //////////////
1558 track->PropagateTo(xk);
1560 track->PropagateTo(xk,42.7,2.27); //C
1562 track->PropagateTo(xk,36.2,1.98e-3); //C02
1564 track->PropagateTo(xk,42.7,2.27); //C
1565 ///////////////////////////////////////////////////
1568 ////// new propagation to the end of TPC //////////////
1570 track->PropagateTo(xk, 28.94, 1.204e-3); //Ne
1572 track->PropagateTo(xk, 44.77, 1.71); //Tedlar
1574 track->PropagateTo(xk, 44.86, 1.45); //Kevlar
1576 track->PropagateTo(xk, 41.28, 0.029); //Nomex
1578 track->PropagateTo(xk,36.2,1.98e-3); //C02
1580 track->PropagateTo(xk, 24.01, 2.7); //Al
1582 track->PropagateTo(xk, 44.77, 1.71); //Tedlar
1584 track->PropagateTo(xk, 44.86, 1.45); //Kevlar
1586 track->PropagateTo(xk, 41.28, 0.029); //Nomex
1588 ///////////////////////////////////////////////////////////////
1590 ///////////////////////////////////////////////////////////////
1591 AliITStrack trackITS(*track);
1592 AliITStrack result(*track);
1593 AliITStrack primarytrack(*track);
1595 ///////////////////////////////////////////////////////////////////////////////////////////////
1597 Vgeant=result.GetVertex();
1599 // Definition of Dv and Zv for vertex constraint
1600 Double_t sigmaDv=0.0050; Double_t sigmaZv=0.010;
1601 //Double_t sigmaDv=0.0015; Double_t sigmaZv=0.0015;
1602 Double_t uniform= gRandom->Uniform();
1604 if(uniform<=0.5) signdv=-1.;
1608 Double_t Vr=TMath::Sqrt(Vgeant(0)*Vgeant(0)+ Vgeant(1)*Vgeant(1));
1609 Double_t Dv=gRandom->Gaus(signdv*Vr,(Float_t)sigmaDv);
1610 Double_t Zv=gRandom->Gaus(Vgeant(2),(Float_t)sigmaZv);
1612 //cout<<" Dv e Zv = "<<Dv<<" "<<Zv<<"\n";
1613 trackITS.SetDv(Dv); trackITS.SetZv(Zv);
1614 trackITS.SetsigmaDv(sigmaDv); trackITS.SetsigmaZv(sigmaZv);
1615 result.SetDv(Dv); result.SetZv(Zv);
1616 result.SetsigmaDv(sigmaDv); result.SetsigmaZv(sigmaZv);
1617 primarytrack.SetDv(Dv); primarytrack.SetZv(Zv);
1618 primarytrack.SetsigmaDv(sigmaDv); primarytrack.SetsigmaZv(sigmaZv);
1620 /////////////////////////////////////////////////////////////////////////////////////////////////
1622 primarytrack.PrimaryTrack(rl);
1623 TVector d2=primarytrack.Getd2();
1624 TVector tgl2=primarytrack.Gettgl2();
1625 TVector dtgl=primarytrack.Getdtgl();
1626 trackITS.Setd2(d2); trackITS.Settgl2(tgl2); trackITS.Setdtgl(dtgl);
1627 result.Setd2(d2); result.Settgl2(tgl2); result.Setdtgl(dtgl);
1629 trackITS.SetVertex(vertex); trackITS.SetErrorVertex(ervertex);
1630 result.SetVertex(vertex); result.SetErrorVertex(ervertex);
1632 Tracking(trackITS,&result,recPoints,vettid, flagvert,rl);
1634 // cout<<" progressive track number = "<<j<<"\r";
1636 cout<<" progressive track number = "<<j<<"\n";
1637 Long_t labITS=result.GetLabel();
1638 cout << " ITS track label = " << labITS << "\n";
1639 int lab=track->GetLabel();
1640 cout << " TPC track label = " << lab <<"\n";
1641 //result.GetClusters(); getchar(); //to print the cluster matrix
1643 //propagation to vertex
1647 result.Propagation(rbeam);
1650 cov=&result.GetCMatrix();
1651 Double_t pt=TMath::Abs(result.GetPt());
1652 Double_t Dr=result.GetD();
1653 Double_t Z=result.GetZ();
1654 Double_t tgl=result.GetTgl();
1655 Double_t C=result.GetC();
1657 Double_t Dz=Z-(tgl/Cy)*TMath::ASin(result.arga(rbeam));
1660 // cout<<" Dr e dz alla fine = "<<Dr<<" "<<Dz<<"\n"; getchar();
1661 Double_t phi=result.Getphi();
1662 Double_t phivertex = phi - TMath::ASin(result.argA(rbeam));
1663 Double_t duepi=2.*TMath::Pi();
1664 if(phivertex>duepi) phivertex-=duepi;
1665 if(phivertex<0.) phivertex+=duepi;
1666 Double_t Dtot=TMath::Sqrt(Dr*Dr+Dz*Dz);
1668 //////////////////////////////////////////////////////////////////////////////////////////
1669 Int_t NumofCluster, idmodule,idpoint;
1670 NumofCluster=result.GetNumClust();
1671 if(NumofCluster >=5) {
1674 AliITSiotrack outtrack;
1678 iotrack->SetStatePhi(phi);
1679 iotrack->SetStateZ(Z);
1680 iotrack->SetStateD(Dr);
1681 iotrack->SetStateTgl(tgl);
1682 iotrack->SetStateC(C);
1683 Double_t radius=result.Getrtrack();
1684 iotrack->SetRadius(radius);
1686 if(C>0.) charge=-1; else charge=1;
1687 iotrack->SetCharge(charge);
1691 iotrack->SetCovMatrix(cov);
1693 Double_t px=pt*TMath::Cos(phivertex);
1694 Double_t py=pt*TMath::Sin(phivertex);
1697 Double_t xtrack=Dr*TMath::Sin(phivertex);
1698 Double_t ytrack=Dr*TMath::Cos(phivertex);
1699 Double_t ztrack=Dz+Vgeant(2);
1705 iotrack->SetX(xtrack);
1706 iotrack->SetY(ytrack);
1707 iotrack->SetZ(ztrack);
1708 iotrack->SetLabel(labITS);
1711 for(il=0;il<6; il++){
1712 iotrack->SetIdPoint(il,result.GetIdPoint(il));
1713 iotrack->SetIdModule(il,result.GetIdModule(il));
1717 //cout<<" labITS = "<<labITS<<"\n";
1718 //cout<<" phi z Dr tgl C = "<<phi<<" "<<Z<<" "<<Dr<<" "<<tgl<<" "<<C<<"\n"; getchar();
1720 DataOut(kkk) = ptg; kkk++; DataOut(kkk)=labITS; kkk++; DataOut(kkk)=lab; kkk++;
1722 for (il=0;il<6;il++) {
1723 idpoint=result.GetIdPoint(il);
1724 idmodule=result.GetIdModule(il);
1725 *(vettid[idmodule]+idpoint)=1;
1726 iotrack->SetIdPoint(il,idpoint);
1727 iotrack->SetIdModule(il,idmodule);
1730 // cout<<" +++++++++++++ pt e ptg = "<<pt<<" "<<ptg<<" ++++++++++\n";
1731 Double_t difpt= (pt-ptg)/ptg*100.;
1732 DataOut(kkk)=difpt; kkk++;
1733 Double_t lambdag=TMath::ATan(pzg/ptg);
1734 Double_t lam=TMath::ATan(tgl);
1735 Double_t diflam = (lam - lambdag)*1000.;
1736 DataOut(kkk) = diflam; kkk++;
1737 Double_t phig=TMath::ATan(pyg/pxg);
1738 Double_t phi=phivertex;
1739 Double_t difphi = (phi - phig)*1000.;
1740 DataOut(kkk)=difphi; kkk++;
1741 DataOut(kkk)=Dtot*1.e4; kkk++;
1742 DataOut(kkk)=Dr*1.e4; kkk++;
1743 DataOut(kkk)=Dz*1.e4; kkk++;
1745 for (r=0; r<9; r++) { out<<DataOut(r)<<" ";}
1750 } // end if on NumofCluster
1751 //gObjectTable->Print(); // stampa memoria
1752 } // end for (int j=min_t; j<=max_t; j++)
1757 static Bool_t first=kTRUE;
1758 static TFile *tfile;
1761 tfile=new TFile("itstracks.root","RECREATE");
1762 //cout<<"I have opened itstracks.root file "<<endl;
1769 sprintf(hname,"TreeT%d",evNumber);
1771 tracktree1.Write(hname);
1775 TTree *fAli=gAlice->TreeK();
1778 if (fAli) fileAli =fAli->GetCurrentFile();
1781 ////////////////////////////////////////////////////////////////////////////////////////////////
1783 printf("delete vectors\n");
1784 if(np) delete [] np;
1785 if(vettid) delete [] vettid;