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.35 2001/02/28 18:16:46 mariana
19 Make the code compatible with the new AliRun
21 Revision 1.34 2001/02/11 15:51:39 mariana
22 Set protection in MakeBranch
24 Revision 1.33 2001/02/10 22:26:39 mariana
25 Move the initialization of the containers for raw clusters in MakeTreeC()
27 Revision 1.32 2001/02/08 23:55:31 nilsen
28 Removed fMajor/MinorVersion variables in favor of variables in derived classes.
29 Set arrays char *det[3] = {"SPD","SDD","SSD"} as const.
31 Revision 1.31 2001/02/02 23:57:28 nilsen
32 Added include file that are no londer included in AliITSgeom.h
34 Revision 1.30 2001/01/30 09:23:13 hristov
35 Streamers removed (R.Brun)
37 Revision 1.29 2001/01/26 20:01:09 hristov
38 Major upgrade of AliRoot code
40 Revision 1.28 2000/12/18 14:02:00 barbera
41 new version of the ITS tracking to take into account the new TPC track parametrization
43 Revision 1.27 2000/12/08 13:49:27 barbera
44 Hidden declaration in a for loop removed to be compliant with HP-UX compiler
46 Revision 1.26 2000/11/27 13:12:13 barbera
47 New version containing the files for tracking
49 Revision 1.25 2000/11/12 22:38:05 barbera
50 Added header file for the SPD Bari model
52 Revision 1.24 2000/10/09 22:18:12 barbera
53 Bug fixes from MAriana to le AliITStest.C run correctly
55 Revision 1.23 2000/10/05 20:47:42 nilsen
56 fixed dependencies of include files. Tryed but failed to get a root automaticly
57 generates streamer function to work. Modified SetDefaults.
59 Revision 1.9.2.15 2000/10/04 16:56:40 nilsen
60 Needed to include stdlib.h
63 Revision 1.22 2000/10/04 19:45:52 barbera
64 Corrected by F. Carminati for v3.04
66 Revision 1.21 2000/10/02 21:28:08 fca
67 Removal of useless dependecies via forward declarations
69 Revision 1.20 2000/10/02 16:31:39 barbera
72 Revision 1.9.2.14 2000/10/02 15:43:51 barbera
73 General code clean-up (e.g., printf -> cout)
75 Revision 1.19 2000/09/22 12:13:25 nilsen
76 Patches and updates for fixes to this and other routines.
78 Revision 1.18 2000/07/12 05:32:20 fca
79 Correcting several syntax problem with static members
81 Revision 1.17 2000/07/10 16:07:18 fca
82 Release version of ITS code
84 Revision 1.9.2.3 2000/02/02 13:42:09 barbera
85 fixed AliITS.cxx for new AliRun structure. Added ITS hits list to list of hits which will have their track numbers updated
87 Revision 1.9.2.2 2000/01/23 03:03:13 nilsen
88 //fixed FillModule. Removed fi(fabs(xl)<dx....
90 Revision 1.9.2.1 2000/01/12 19:03:32 nilsen
91 This is the version of the files after the merging done in December 1999.
92 See the ReadMe110100.txt file for details
94 Revision 1.9 1999/11/14 14:33:25 fca
95 Correct problems with distructors and pointers, thanks to I.Hrivnacova
97 Revision 1.8 1999/09/29 09:24:19 fca
98 Introduction of the Copyright and cvs Log
102 ///////////////////////////////////////////////////////////////////////////////
104 // An overview of the basic philosophy of the ITS code development
105 // and analysis is show in the figure below.
108 <img src="picts/ITS/ITS_Analysis_schema.gif">
111 <font size=+2 color=red>
112 <p>Roberto Barbera is in charge of the ITS Offline code (1999).
113 <a href="mailto:roberto.barbera@ct.infn.it">Roberto Barbera</a>.
119 // AliITS. Inner Traking System base class.
120 // This class contains the base procedures for the Inner Tracking System
124 <img src="picts/ITS/AliITS_Class_Diagram.gif">
127 <font size=+2 color=red>
128 <p>This show the class diagram of the different elements that are part of
136 // Written by Rene Brun, Federico Carminati, and Roberto Barbera
139 // Modified and documented by Bjorn S. Nilsen
143 // Modified and documented by A. Bologna
146 // AliITS is the general base class for the ITS. Also see AliDetector for
147 // futher information.
149 ///////////////////////////////////////////////////////////////////////////////
150 #include <iostream.h>
158 #include <TClonesArray.h>
160 #include <TObjectTable.h>
169 #include "AliITSMap.h"
170 #include "AliITSDetType.h"
171 #include "AliITSClusterFinder.h"
172 //#include "AliITSsimulation.h"
173 #include "AliITSsimulationSPD.h"
174 #include "AliITSsimulationSDD.h"
175 #include "AliITSsimulationSSD.h"
176 #include "AliITSresponse.h"
177 #include "AliITSsegmentationSPD.h"
178 #include "AliITSresponseSPD.h"
179 #include "AliITSresponseSPDbari.h"
180 #include "AliITSsegmentationSDD.h"
181 #include "AliITSresponseSDD.h"
182 #include "AliITSsegmentationSSD.h"
183 #include "AliITSresponseSSD.h"
184 #include "AliITShit.h"
185 #include "AliITSgeom.h"
186 #include "AliITSdigit.h"
187 #include "AliITSmodule.h"
188 #include "AliITSRecPoint.h"
189 #include "AliITSRawCluster.h"
193 #include "AliITStrack.h"
194 #include "AliITSiotrack.h"
195 #include "AliITStracking.h"
196 #include "AliITSRad.h"
197 #include "../TPC/AliTPC.h"
198 #include "../TPC/AliTPCParam.h"
203 //_____________________________________________________________________________
204 AliITS::AliITS() : AliDetector() {
206 // Default initialiser for ITS
207 // The default constructor of the AliITS class. In addition to
208 // creating the AliITS class it zeros the variables fIshunt (a member
209 // of AliDetector class), fEuclidOut, and fIdN, and zeros the pointers
210 // fITSpoints, fIdSens, and fIdName. The AliDetector default constructor
218 fNDetTypes = kNTYPES;
237 //_____________________________________________________________________________
238 AliITS::AliITS(const char *name, const char *title):AliDetector(name,title){
240 // Default initialiser for ITS
241 // The constructor of the AliITS class. In addition to creating the
242 // AliITS class, it allocates memory for the TClonesArrays fHits and
243 // fDigits, and for the TObjArray fITSpoints. It also zeros the variables
244 // fIshunt (a member of AliDetector class), fEuclidOut, and fIdN, and zeros
245 // the pointers fIdSens and fIdName. To help in displaying hits via the ROOT
246 // macro display.C AliITS also sets the marker color to red. The variables
247 // passes with this constructor, const char *name and *title, are used by
248 // the constructor of AliDetector class. See AliDetector class for a
249 // description of these parameters and its constructor functions.
253 fHits = new TClonesArray("AliITShit", 1560);
254 gAlice->AddHitList(fHits);
256 fNDetTypes = kNTYPES;
258 fNdtype = new Int_t[kNTYPES];
259 fDtype = new TObjArray(kNTYPES);
261 fNctype = new Int_t[kNTYPES];
262 fCtype = new TObjArray(kNTYPES);
278 fDetTypes = new TObjArray(kNTYPES);
281 for(i=0;i<kNTYPES;i++) {
282 (*fDetTypes)[i]=new AliITSDetType();
288 SetMarkerColor(kRed);
292 //___________________________________________________________________________
293 AliITS::AliITS(AliITS &source){
295 if(this==&source) return;
296 Error("AliITS::Copy constructor",
297 "You are not allowed to make a copy of the AliITS");
300 //____________________________________________________________________________
301 AliITS& AliITS::operator=(AliITS &source){
302 // assignment operator
303 if(this==&source) return *this;
304 Error("AliITS::operator=",
305 "You are not allowed to make a copy of the AliITS");
307 return *this; //fake return
309 //____________________________________________________________________________
310 void AliITS::ClearModules(){
311 //clear the modules TObjArray
313 if(fITSmodules) fITSmodules->Delete();
316 //_____________________________________________________________________________
319 // Default distructor for ITS
320 // The default destructor of the AliITS class. In addition to deleting
321 // the AliITS class it deletes the memory pointed to by the fHits, fDigits,
322 // fIdSens, fIdName, and fITSpoints.
329 // delete fIdName; // TObjArray of TObjStrings
330 if(fIdName!=0) delete[] fIdName; // Array of TStrings
331 if(fIdSens!=0) delete[] fIdSens;
333 this->ClearModules();
335 }// end if fITSmodules!=0
355 if (fTreeC) delete fTreeC;
357 if (fITSgeom) delete fITSgeom;
361 //___________________________________________
362 AliITSDetType* AliITS::DetType(Int_t id)
364 //return pointer to id detector type
365 return ((AliITSDetType*) (*fDetTypes)[id]);
368 //___________________________________________
369 void AliITS::SetClasses(Int_t id, const char *digit, const char *cluster)
371 //set the digit and cluster classes to be used for the id detector type
372 ((AliITSDetType*) (*fDetTypes)[id])->ClassNames(digit,cluster);
375 //___________________________________________
376 void AliITS::SetResponseModel(Int_t id, AliITSresponse *response)
378 //set the response model for the id detector type
380 ((AliITSDetType*) (*fDetTypes)[id])->ResponseModel(response);
384 //___________________________________________
385 void AliITS::SetSegmentationModel(Int_t id, AliITSsegmentation *seg)
387 //set the segmentation model for the id detector type
389 ((AliITSDetType*) (*fDetTypes)[id])->SegmentationModel(seg);
393 //___________________________________________
394 void AliITS::SetSimulationModel(Int_t id, AliITSsimulation *sim)
396 //set the simulation model for the id detector type
398 ((AliITSDetType*) (*fDetTypes)[id])->SimulationModel(sim);
401 //___________________________________________
402 void AliITS::SetReconstructionModel(Int_t id, AliITSClusterFinder *reconst)
404 //set the cluster finder model for the id detector type
406 ((AliITSDetType*) (*fDetTypes)[id])->ReconstructionModel(reconst);
410 //_____________________________________________________________________________
411 void AliITS::AddHit(Int_t track, Int_t *vol, Float_t *hits){
414 // The function to add information to the AliITShit class. See the
415 // AliITShit class for a full description. This function allocates the
416 // necessary new space for the hit information and passes the variable
417 // track, and the pointers *vol and *hits to the AliITShit constructor
420 TClonesArray &lhits = *fHits;
421 new(lhits[fNhits++]) AliITShit(fIshunt,track,vol,hits);
423 //_____________________________________________________________________________
424 void AliITS::AddRealDigit(Int_t id, Int_t *digits)
426 // add a real digit - as coming from data
428 TClonesArray &ldigits = *((TClonesArray*)(*fDtype)[id]);
429 new(ldigits[fNdtype[id]++]) AliITSdigit(digits);
432 //_____________________________________________________________________________
433 void AliITS::AddSimDigit(Int_t id, AliITSdigit *d)
436 // add a simulated digit
438 TClonesArray &ldigits = *((TClonesArray*)(*fDtype)[id]);
443 new(ldigits[fNdtype[id]++]) AliITSdigitSPD(*((AliITSdigitSPD*)d));
446 new(ldigits[fNdtype[id]++]) AliITSdigitSDD(*((AliITSdigitSDD*)d));
449 new(ldigits[fNdtype[id]++]) AliITSdigitSSD(*((AliITSdigitSSD*)d));
455 //_____________________________________________________________________________
456 void AliITS::AddSimDigit(Int_t id,Float_t phys,Int_t *digits,Int_t *tracks,Int_t *hits,Float_t *charges){
458 // add a simulated digit to the list
460 TClonesArray &ldigits = *((TClonesArray*)(*fDtype)[id]);
464 new(ldigits[fNdtype[id]++]) AliITSdigitSPD(digits,tracks,hits);
467 new(ldigits[fNdtype[id]++]) AliITSdigitSDD(phys,digits,tracks,hits,charges);
470 new(ldigits[fNdtype[id]++]) AliITSdigitSSD(digits,tracks,hits);
476 //_____________________________________________________________________________
477 void AliITS::AddCluster(Int_t id, AliITSRawCluster *c)
480 // add a cluster to the list
482 TClonesArray &lcl = *((TClonesArray*)(*fCtype)[id]);
487 new(lcl[fNctype[id]++]) AliITSRawClusterSPD(*((AliITSRawClusterSPD*)c));
490 new(lcl[fNctype[id]++]) AliITSRawClusterSDD(*((AliITSRawClusterSDD*)c));
493 new(lcl[fNctype[id]++]) AliITSRawClusterSSD(*((AliITSRawClusterSSD*)c));
500 //_____________________________________________________________________________
501 void AliITS::AddRecPoint(const AliITSRecPoint &r)
504 // Add a reconstructed space point to the list
506 TClonesArray &lrecp = *fRecPoints;
507 new(lrecp[fNRecPoints++]) AliITSRecPoint(r);
511 //____________________________________________
512 void AliITS::ResetDigits()
515 // Reset number of digits and the digits array for the ITS detector
521 for (i=0;i<kNTYPES;i++ ) {
522 if ((*fDtype)[i]) ((TClonesArray*)(*fDtype)[i])->Clear();
523 if (fNdtype) fNdtype[i]=0;
527 //____________________________________________
528 void AliITS::ResetDigits(Int_t i)
531 // Reset number of digits and the digits array for this branch
533 if ((*fDtype)[i]) ((TClonesArray*)(*fDtype)[i])->Clear();
534 if (fNdtype) fNdtype[i]=0;
538 //____________________________________________
539 void AliITS::ResetClusters()
542 // Reset number of clusters and the clusters array for ITS
546 for (i=0;i<kNTYPES;i++ ) {
547 if ((*fCtype)[i]) ((TClonesArray*)(*fCtype)[i])->Clear();
548 if (fNctype) fNctype[i]=0;
553 //____________________________________________
554 void AliITS::ResetClusters(Int_t i)
557 // Reset number of clusters and the clusters array for this branch
559 if ((*fCtype)[i]) ((TClonesArray*)(*fCtype)[i])->Clear();
560 if (fNctype) fNctype[i]=0;
565 //____________________________________________
566 void AliITS::ResetRecPoints()
569 // Reset number of rec points and the rec points array
571 if (fRecPoints) fRecPoints->Clear();
576 //_____________________________________________________________________________
577 Int_t AliITS::DistancetoPrimitive(Int_t , Int_t ){
579 // Distance from mouse to ITS on the screen. Dummy routine
580 // A dummy routine used by the ROOT macro display.C to allow for the
581 // use of the mouse (pointing device) in the macro. In general this should
582 // never be called. If it is it returns the number 9999 for any value of
588 //_____________________________________________________________________________
591 // Initialise ITS after it has been built
592 // This routine initializes the AliITS class. It is intended to be called
593 // from the Init function in AliITSv?. Besides displaying a banner
594 // indicating that it has been called it initializes the array fIdSens
595 // and sets the default segmentation, response, digit and raw cluster classes
596 // Therefore it should be called after a call to CreateGeometry.
603 for(i=0;i<fIdN;i++) fIdSens[i] = gMC->VolId(fIdName[i]);
607 //_____________________________________________________________________________
608 void AliITS::SetDefaults()
610 // sets the default segmentation, response, digit and raw cluster classes
612 printf("SetDefaults\n");
614 AliITSDetType *iDetType;
620 if (!iDetType->GetSegmentationModel()) {
621 AliITSsegmentationSPD *seg0=new AliITSsegmentationSPD(fITSgeom);
622 SetSegmentationModel(0,seg0);
624 if (!iDetType->GetResponseModel()) {
625 SetResponseModel(0,new AliITSresponseSPD());
627 // set digit and raw cluster classes to be used
629 const char *kData0=(iDetType->GetResponseModel())->DataType();
630 if (strstr(kData0,"real")) {
631 iDetType->ClassNames("AliITSdigit","AliITSRawClusterSPD");
632 } else iDetType->ClassNames("AliITSdigitSPD","AliITSRawClusterSPD");
636 if (!iDetType->GetResponseModel()) {
637 SetResponseModel(1,new AliITSresponseSDD());
639 AliITSresponse *resp1=iDetType->GetResponseModel();
640 if (!iDetType->GetSegmentationModel()) {
641 AliITSsegmentationSDD *seg1=new AliITSsegmentationSDD(fITSgeom,resp1);
642 SetSegmentationModel(1,seg1);
644 const char *kData1=(iDetType->GetResponseModel())->DataType();
645 const char *kopt=iDetType->GetResponseModel()->ZeroSuppOption();
646 if ((!strstr(kopt,"2D")) && (!strstr(kopt,"1D")) || strstr(kData1,"real") ) {
647 iDetType->ClassNames("AliITSdigit","AliITSRawClusterSDD");
648 } else iDetType->ClassNames("AliITSdigitSDD","AliITSRawClusterSDD");
652 if (!iDetType->GetSegmentationModel()) {
653 AliITSsegmentationSSD *seg2=new AliITSsegmentationSSD(fITSgeom);
654 SetSegmentationModel(2,seg2);
656 if (!iDetType->GetResponseModel()) {
657 SetResponseModel(2,new AliITSresponseSSD());
659 const char *kData2=(iDetType->GetResponseModel())->DataType();
660 if (strstr(kData2,"real")) {
661 iDetType->ClassNames("AliITSdigit","AliITSRawClusterSSD");
662 } else iDetType->ClassNames("AliITSdigitSSD","AliITSRawClusterSSD");
665 Warning("SetDefaults","Only the three basic detector types are initialised!");
672 //_____________________________________________________________________________
673 void AliITS::SetDefaultSimulation()
678 //_____________________________________________________________________________
679 void AliITS::SetDefaultClusterFinders()
684 //_____________________________________________________________________________
686 void AliITS::MakeTreeC(Option_t *option)
688 // create a separate tree to store the clusters
690 cout << "AliITS::MakeTreeC" << endl;
692 char *optC = strstr(option,"C");
693 if (optC && !fTreeC) fTreeC = new TTree("TC","Clusters in ITS");
696 Int_t buffersize = 4000;
699 const char *det[3] = {"SPD","SDD","SSD"};
704 // one branch for Clusters per type of detector
706 for (i=0; i<kNTYPES ;i++) {
707 AliITSDetType *iDetType=DetType(i);
708 iDetType->GetClassNames(digclass,clclass);
710 (*fCtype)[i] = new TClonesArray(clclass,10000);
711 if (kNTYPES==3) sprintf(branchname,"%sClusters%s",GetName(),det[i]);
712 else sprintf(branchname,"%sClusters%d",GetName(),i+1);
713 if (fCtype && fTreeC) {
714 TreeC()->Branch(branchname,&((*fCtype)[i]), buffersize);
715 cout << "Making Branch " << branchname;
716 cout << " for Clusters of detector type " << i+1 << endl;
722 //_____________________________________________________________________________
723 void AliITS::GetTreeC(Int_t event)
726 cout << "AliITS::GetTreeC" << endl;
728 // get the clusters tree for this event and set the branch address
732 const char *det[3] = {"SPD","SDD","SSD"};
739 sprintf(treeName,"TreeC%d",event);
740 fTreeC = (TTree*)gDirectory->Get(treeName);
745 for (i=0; i<kNTYPES; i++) {
746 if (kNTYPES==3) sprintf(branchname,"%sClusters%s",GetName(),det[i]);
747 else sprintf(branchname,"%sClusters%d",GetName(),i+1);
749 branch = fTreeC->GetBranch(branchname);
750 if (branch) branch->SetAddress(&((*fCtype)[i]));
754 Error("AliITS::GetTreeC",
755 "cannot find Clusters Tree for event:%d\n",event);
759 //_____________________________________________________________________________
760 void AliITS::MakeBranch(Option_t* option, char *file)
763 // Creates Tree branches for the ITS.
766 Int_t buffersize = 4000;
768 sprintf(branchname,"%s",GetName());
770 AliDetector::MakeBranch(option,file);
772 char *cD = strstr(option,"D");
773 char *cR = strstr(option,"R");
777 // one branch for digits per type of detector
779 const char *det[3] = {"SPD","SDD","SSD"};
785 for (i=0; i<kNTYPES ;i++) {
786 AliITSDetType *iDetType=DetType(i);
787 iDetType->GetClassNames(digclass,clclass);
789 if(!((*fDtype)[i])) (*fDtype)[i] = new TClonesArray(digclass,10000);
793 for (i=0; i<kNTYPES ;i++) {
794 if (kNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]);
795 else sprintf(branchname,"%sDigits%d",GetName(),i+1);
796 if (fDtype && gAlice->TreeD()) {
797 gAlice->MakeBranchInTree(gAlice->TreeD(),
798 branchname, &((*fDtype)[i]), buffersize, file);
799 cout << "Making Branch " << branchname;
800 cout << " for digits of type "<< i+1 << endl;
807 // only one branch for rec points for all detector types
809 sprintf(branchname,"%sRecPoints",GetName());
811 if(!fRecPoints) fRecPoints=new TClonesArray("AliITSRecPoint",10000);
813 if (fRecPoints && gAlice->TreeR()) {
814 gAlice->MakeBranchInTree(gAlice->TreeR(),
815 branchname, &fRecPoints, buffersize, file) ;
816 cout << "Making Branch " << branchname;
817 cout << " for reconstructed space points" << endl;
822 //___________________________________________
823 void AliITS::SetTreeAddress()
826 // Set branch address for the Trees.
829 AliDetector::SetTreeAddress();
831 const char *det[3] = {"SPD","SDD","SSD"};
834 TTree *treeD = gAlice->TreeD();
835 TTree *treeR = gAlice->TreeR();
839 for (i=0; i<kNTYPES; i++) {
840 if (kNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]);
841 else sprintf(branchname,"%sDigits%d",GetName(),i+1);
843 branch = treeD->GetBranch(branchname);
844 if (branch) branch->SetAddress(&((*fDtype)[i]));
851 sprintf(branchname,"%sRecPoints",GetName());
852 branch = treeR->GetBranch(branchname);
853 if (branch) branch->SetAddress(&fRecPoints);
859 //____________________________________________________________________________
860 void AliITS::InitModules(Int_t size,Int_t &nmodules){
862 //initialize the modules array
865 fITSmodules->Delete();
869 Int_t nl,indexMAX,index;
871 if(size<=0){ // default to using data stored in AliITSgeom
873 Error("AliITS::InitModules",
874 "in AliITS::InitModule fITSgeom not defined\n");
876 } // end if fITSgeom==0
877 nl = fITSgeom->GetNlayers();
878 indexMAX = fITSgeom->GetModuleIndex(nl,fITSgeom->GetNladders(nl),
879 fITSgeom->GetNdetectors(nl))+1;
881 fITSmodules = new TObjArray(indexMAX);
882 for(index=0;index<indexMAX;index++){
883 fITSmodules->AddAt( new AliITSmodule(index),index);
886 fITSmodules = new TObjArray(size);
887 for(index=0;index<size;index++) {
888 fITSmodules->AddAt( new AliITSmodule(index),index);
895 //____________________________________________________________________________
896 void AliITS::FillModules(Int_t evnt,Int_t bgrev,Int_t nmodules,Option_t *option,Text_t *filename){
898 // fill the modules with the sorted by module hits; add hits from background
902 static TTree *trH1; //Tree with background hits
903 static TClonesArray *fHits2; //List of hits for one track only
905 static Bool_t first=kTRUE;
907 char *addBgr = strstr(option,"Add");
912 cout<<"filename "<<filename<<endl;
913 file=new TFile(filename);
914 cout<<"I have opened "<<filename<<" file "<<endl;
915 fHits2 = new TClonesArray("AliITShit",1000 );
920 // Get Hits Tree header from file
921 if(fHits2) fHits2->Clear();
922 if(trH1) delete trH1;
926 sprintf(treeName,"TreeH%d",bgrev);
927 trH1 = (TTree*)gDirectory->Get(treeName);
928 //printf("TrH1 %p of treename %s for event %d \n",trH1,treeName,bgrev);
931 Error("AliITS::FillModules",
932 "cannot find Hits Tree for event:%d\n",bgrev);
934 // Set branch addresses
937 sprintf(branchname,"%s",GetName());
938 if (trH1 && fHits2) {
939 branch = trH1->GetBranch(branchname);
940 if (branch) branch->SetAddress(&fHits2);
944 //Int_t ntracks1 =(Int_t)TrH1->GetEntries();
945 //printf("background - ntracks1 - %d\n",ntracks1);
948 //Int_t npart = gAlice->GetEvent(evnt);
949 //if(npart<=0) return;
950 TClonesArray *itsHits = this->Hits();
951 Int_t lay,lad,det,index;
955 TTree *iTH = gAlice->TreeH();
956 Int_t ntracks =(Int_t) iTH->GetEntries();
959 for(t=0; t<ntracks; t++){
962 Int_t nhits = itsHits->GetEntriesFast();
963 //printf("nhits %d\n",nhits);
964 if (!nhits) continue;
965 for(h=0; h<nhits; h++){
966 itsHit = (AliITShit *)itsHits->UncheckedAt(h);
967 itsHit->GetDetectorID(lay,lad,det);
968 // temporarily index=det-1 !!!
969 if(fITSgeom) index = fITSgeom->GetModuleIndex(lay,lad,det);
972 mod = this->GetModule(index);
973 mod->AddHit(itsHit,t,h);
974 } // end loop over hits
975 } // end loop over tracks
977 // open the file with background
981 ntracks =(Int_t)trH1->GetEntries();
982 //printf("background - ntracks1 %d\n",ntracks);
983 //printf("background - Start loop over tracks \n");
986 for (track=0; track<ntracks; track++) {
988 if (fHits2) fHits2->Clear();
989 trH1->GetEvent(track);
991 for(i=0;i<fHits2->GetEntriesFast();++i) {
993 itsHit=(AliITShit*) (*fHits2)[i];
994 itsHit->GetDetectorID(lay,lad,det);
995 // temporarily index=det-1 !!!
996 if(fITSgeom) index = fITSgeom->GetModuleIndex(lay,lad,det);
999 mod = this->GetModule(index);
1000 mod->AddHit(itsHit,track,i);
1001 } // end loop over hits
1002 } // end loop over tracks
1004 TTree *fAli=gAlice->TreeK();
1007 if (fAli) fileAli =fAli->GetCurrentFile();
1012 //gObjectTable->Print();
1016 //____________________________________________________________________________
1018 void AliITS::SDigits2Digits()
1021 AliITSgeom *geom = GetITSgeom();
1024 AliITSDetType *iDetType;
1025 iDetType=DetType(0);
1026 AliITSsegmentationSPD *seg0=(AliITSsegmentationSPD*)iDetType->GetSegmentationModel();
1027 AliITSresponseSPD *res0 = (AliITSresponseSPD*)iDetType->GetResponseModel();
1028 AliITSsimulationSPD *sim0=new AliITSsimulationSPD(seg0,res0);
1029 SetSimulationModel(0,sim0);
1031 // printf("SPD dimensions %f %f \n",seg0->Dx(),seg0->Dz());
1032 // printf("SPD npixels %d %d \n",seg0->Npz(),seg0->Npx());
1033 // printf("SPD pitches %d %d \n",seg0->Dpz(0),seg0->Dpx(0));
1037 //Set response functions
1038 Float_t baseline = 10.;
1039 Float_t noise = 1.75;
1041 // SDD compression param: 2 fDecrease, 2fTmin, 2fTmax or disable, 2 fTolerance
1043 iDetType=DetType(1);
1044 AliITSresponseSDD *res1 = (AliITSresponseSDD*)iDetType->GetResponseModel();
1046 res1=new AliITSresponseSDD();
1047 SetResponseModel(1,res1);
1049 res1->SetMagicValue(900.);
1050 Float_t maxadc = res1->MaxAdc();
1051 Float_t topValue = res1->MagicValue();
1052 Float_t norm = maxadc/topValue;
1054 Float_t fCutAmp = baseline + 2.*noise;
1056 Int_t cp[8]={0,0,(int)fCutAmp,(int)fCutAmp,0,0,0,0}; //1D
1058 //res1->SetZeroSupp("2D");
1059 res1->SetZeroSupp("1D");
1060 res1->SetNoiseParam(noise,baseline);
1061 res1->SetDo10to8(kTRUE);
1062 res1->SetCompressParam(cp);
1064 res1->SetDiffCoeff(3.6,40.);
1065 //res1->SetMagicValue(96.95);
1066 AliITSsegmentationSDD *seg1=(AliITSsegmentationSDD*)iDetType->GetSegmentationModel();
1068 seg1 = new AliITSsegmentationSDD(geom,res1);
1069 SetSegmentationModel(1,seg1);
1071 AliITSsimulationSDD *sim1=new AliITSsimulationSDD(seg1,res1);
1073 sim1->SetCheckNoise(kFALSE);
1074 SetSimulationModel(1,sim1);
1077 iDetType=DetType(2);
1078 AliITSsegmentationSSD *seg2=(AliITSsegmentationSSD*)iDetType->GetSegmentationModel();
1079 AliITSresponseSSD *res2 = (AliITSresponseSSD*)iDetType->GetResponseModel();
1080 res2->SetSigmaSpread(3.,2.);
1081 AliITSsimulationSSD *sim2=new AliITSsimulationSSD(seg2,res2);
1082 SetSimulationModel(2,sim2);
1084 cerr<<"Digitizing ITS...\n";
1088 HitsToDigits(0,0,-1," ","All"," ");
1089 timer.Stop(); timer.Print();
1097 //____________________________________________________________________________
1098 void AliITS::HitsToDigits(Int_t evNumber,Int_t bgrev,Int_t size, Option_t *option, Option_t *opt,Text_t *filename)
1100 // keep galice.root for signal and name differently the file for
1101 // background when add! otherwise the track info for signal will be lost !
1103 // the condition below will disappear when the geom class will be
1104 // initialised for all versions - for the moment it is only for v5 !
1105 // 7 is the SDD beam test version
1106 Int_t ver = this->IsVersion();
1107 if(ver!=5 && ver!=7) return;
1109 char *all = strstr(opt,"All");
1110 char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),strstr(opt,"SSD")};
1113 InitModules(size,nmodules);
1114 FillModules(evNumber,bgrev,nmodules,option,filename);
1117 AliITSsimulation* sim;
1118 //TObjArray *branches=gAlice->TreeD()->GetListOfBranches();
1119 AliITSgeom *geom = GetITSgeom();
1123 for (id=0;id<kNTYPES;id++) {
1124 if (!all && !det[id]) continue;
1125 //branch = (TBranch*)branches->UncheckedAt(id);
1126 AliITSDetType *iDetType=DetType(id);
1127 sim = (AliITSsimulation*)iDetType->GetSimulationModel();
1129 Error("HitsToDigits","The simulation class was not instantiated!");
1131 // or SetDefaultSimulation();
1134 first = geom->GetStartDet(id);
1135 last = geom->GetLastDet(id);
1136 } else first=last=0;
1137 cout << "det type " << id << " first, last "<< first << last << endl;
1138 for(module=first;module<=last;module++) {
1139 AliITSmodule *mod = (AliITSmodule *)fITSmodules->At(module);
1140 sim->DigitiseModule(mod,module,evNumber);
1141 // fills all branches - wasted disk space
1142 gAlice->TreeD()->Fill();
1144 // try and fill only the branch
1147 } // loop over modules
1148 } // loop over detector types
1152 Int_t nentries=(Int_t)gAlice->TreeD()->GetEntries();
1153 cout << "nentries in TreeD" << nentries << endl;
1156 sprintf(hname,"TreeD%d",evNumber);
1157 gAlice->TreeD()->Write(hname,TObject::kOverwrite);
1159 gAlice->TreeD()->Reset();
1164 //____________________________________________________________________________
1165 void AliITS::DigitsToRecPoints(Int_t evNumber,Int_t lastentry,Option_t *opt)
1167 // cluster finding and reconstruction of space points
1169 // the condition below will disappear when the geom class will be
1170 // initialised for all versions - for the moment it is only for v5 !
1171 // 7 is the SDD beam test version
1172 Int_t ver = this->IsVersion();
1175 char *all = strstr(opt,"All");
1176 char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),strstr(opt,"SSD")};
1178 static Bool_t first=kTRUE;
1179 if (!TreeC() && first) {
1184 TTree *treeC=TreeC();
1188 AliITSClusterFinder* rec;
1190 //TObjArray *branches=gAlice->TreeR()->GetListOfBranches();
1191 AliITSgeom *geom = GetITSgeom();
1194 for (id=0;id<kNTYPES;id++) {
1195 if (!all && !det[id]) continue;
1196 //branch = (TBranch*)branches->UncheckedAt(id);
1197 AliITSDetType *iDetType=DetType(id);
1198 rec = (AliITSClusterFinder*)iDetType->GetReconstructionModel();
1200 Error("DigitsToRecPoints","The cluster finder class was not instantiated!");
1202 // or SetDefaultClusterFinders();
1204 TClonesArray *itsDigits = this->DigitsAddress(id);
1208 first = geom->GetStartDet(id);
1209 last = geom->GetLastDet(id);
1210 } else first=last=0;
1211 //printf("first last %d %d\n",first,last);
1212 for(module=first;module<=last;module++) {
1213 this->ResetDigits();
1214 if (all) gAlice->TreeD()->GetEvent(lastentry+module);
1215 else gAlice->TreeD()->GetEvent(lastentry+(module-first));
1216 Int_t ndigits = itsDigits->GetEntriesFast();
1217 if (ndigits) rec->FindRawClusters();
1218 gAlice->TreeR()->Fill();
1222 // try and fill only the branch
1224 //ResetRecPoints(id);
1225 } // loop over modules
1226 } // loop over detector types
1229 Int_t nentries=(Int_t)gAlice->TreeR()->GetEntries();
1230 Int_t ncentries=(Int_t)treeC->GetEntries();
1231 cout << " nentries ncentries " << nentries << ncentries << endl;
1234 sprintf(hname,"TreeR%d",evNumber);
1235 gAlice->TreeR()->Write(hname,TObject::kOverwrite);
1237 gAlice->TreeR()->Reset();
1239 sprintf(hname,"TreeC%d",evNumber);
1240 treeC->Write(hname,TObject::kOverwrite);
1245 //____________________________________________________________________________
1246 void AliITS::HitsToFastRecPoints(Int_t evNumber,Int_t bgrev,Int_t size,
1247 Option_t *option,Option_t *opt,Text_t *filename)
1249 // keep galice.root for signal and name differently the file for
1250 // background when add! otherwise the track info for signal will be lost !
1253 // the condition below will disappear when the geom class will be
1254 // initialised for all versions - for the moment it is only for v5 !
1255 Int_t ver = this->IsVersion();
1258 char *all = strstr(opt,"All");
1259 char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),strstr(opt,"SSD")};
1262 InitModules(size,nmodules);
1263 FillModules(evNumber,bgrev,nmodules,option,filename);
1266 AliITSsimulation* sim;
1267 AliITSgeom *geom = GetITSgeom();
1269 TRandom *random=new TRandom[9];
1270 random[0].SetSeed(111);
1271 random[1].SetSeed(222);
1272 random[2].SetSeed(333);
1273 random[3].SetSeed(444);
1274 random[4].SetSeed(555);
1275 random[5].SetSeed(666);
1276 random[6].SetSeed(777);
1277 random[7].SetSeed(888);
1278 random[8].SetSeed(999);
1282 for (id=0;id<kNTYPES;id++) {
1283 if (!all && !det[id]) continue;
1284 AliITSDetType *iDetType=DetType(id);
1285 sim = (AliITSsimulation*)iDetType->GetSimulationModel();
1287 Error("HitsToFastPoints","The simulation class was not instantiated!");
1289 // or SetDefaultSimulation();
1291 Int_t first = geom->GetStartDet(id);
1292 Int_t last = geom->GetLastDet(id);
1293 for(module=first;module<=last;module++) {
1294 AliITSmodule *mod = (AliITSmodule *)fITSmodules->At(module);
1295 sim->CreateFastRecPoints(mod,module,random);
1296 gAlice->TreeR()->Fill();
1298 } // loop over modules
1299 } // loop over detector types
1304 //Int_t nentries=(Int_t)gAlice->TreeR()->GetEntries();
1307 sprintf(hname,"TreeR%d",evNumber);
1308 gAlice->TreeR()->Write(hname,TObject::kOverwrite);
1310 gAlice->TreeR()->Reset();
1316 //________________________________________________________________
1318 AliITStrack AliITS::Tracking(AliITStrack &track, AliITStrack *reference,TObjArray *fastpoints, Int_t
1319 **vettid, Bool_t flagvert, AliITSRad *rl ) {
1321 //Origin A. Badala' and G.S. Pappalardo: e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it
1324 TList *list= new TList();
1326 AliITStrack tr(track);
1330 Double_t Pt=(tr).GetPt();
1331 //cout << "\n Pt = " << Pt <<"\n";
1333 AliITStracking obj(list, reference, this, fastpoints,TMath::Abs(Pt),vettid, flagvert, rl);
1338 TVector VecTotLabref(18);
1340 for(lay=5; lay>=0; lay--) {
1341 TVector VecLabref(3);
1342 VecLabref=(*reference).GetLabTrack(lay);
1343 for(k=0; k<3; k++) {itot++; VecTotLabref(itot)=VecLabref(k);}
1347 (*reference).Search(VecTotLabref, labref, freq);
1349 if(freq < 5) labref=-labref;
1350 (*reference).SetLabel(labref);
1358 //________________________________________________________________
1362 void AliITS::DoTracking(Int_t evNumber, Int_t min_t, Int_t max_t, TFile *file, Bool_t flagvert) {
1364 // ex macro for tracking ITS
1366 printf("begin DoTracking - file %p\n",file);
1368 const char *pname="75x40_100x60";
1370 Int_t imax=200,jmax=450;
1371 AliITSRad *rl = new AliITSRad(imax,jmax);
1372 //cout<<" dopo costruttore AliITSRad\n"; getchar();
1376 Float_t px,py,pz,x,y,z,pxg,pyg,pzg,ptg;
1381 gAlice->GetEvent(0);
1383 AliTPC *TPC=(AliTPC*)gAlice->GetDetector("TPC");
1384 AliTPCParam *digp = (AliTPCParam*)file->Get(pname);
1385 if (digp!=0) TPC->SetParam(digp);
1389 ifstream in("itsgood_tracks");
1391 cerr<<"Reading itsgood tracks...\n";
1392 while (in>>gt[ngood].lab>>gt[ngood].code
1393 >>gt[ngood].px >>gt[ngood].py>>gt[ngood].pz
1394 >>gt[ngood].x >>gt[ngood].y >>gt[ngood].z
1395 >>gt[ngood].pxg >>gt[ngood].pyg >>gt[ngood].pzg
1396 >>gt[ngood].ptg >>gt[ngood].flag) {
1400 cerr<<"Too many good tracks !\n";
1404 if (!in.eof()) cerr<<"Read error (itsgood_tracks) !\n";
1408 TFile *tf=TFile::Open("tpctracks.root");
1409 if (!tf->IsOpen()) {cerr<<"Can't open tpctracks.root !\n"; return ;}
1410 TObjArray tracks(200000);
1411 TTree *tracktree=(TTree*)tf->Get("TreeT");
1412 TBranch *tbranch=tracktree->GetBranch("tracks");
1413 Int_t nentr=(Int_t)tracktree->GetEntries();
1415 for (kk=0; kk<nentr; kk++) {
1416 AliTPCtrack *iotrack=new AliTPCtrack;
1417 tbranch->SetAddress(&iotrack);
1418 tracktree->GetEvent(kk);
1419 tracks.AddLast(iotrack);
1424 Int_t nt = tracks.GetEntriesFast();
1425 cerr<<"Number of found tracks "<<nt<<endl;
1430 Double_t ptg=0.,pxg=0.,pyg=0.,pzg=0.;
1432 ////////////////////////////// good tracks definition in TPC ////////////////////////////////
1434 ofstream out1 ("AliITSTrag.out");
1436 for (i=0; i<ngood; i++) out1 << gt[i].ptg << "\n";
1441 TTree *TR=gAlice->TreeR();
1442 Int_t nent=(Int_t)TR->GetEntries();
1443 TClonesArray *recPoints = RecPoints();
1445 Int_t totalpoints=0;
1446 Int_t *np = new Int_t[nent];
1447 Int_t **vettid = new Int_t* [nent];
1449 for (mod=0; mod<nent; mod++) {
1451 this->ResetRecPoints();
1452 //gAlice->TreeR()->GetEvent(mod+1); //first entry in TreeR is empty
1453 gAlice->TreeR()->GetEvent(mod); //first entry in TreeR is empty
1454 numbpoints = recPoints->GetEntries();
1455 totalpoints+=numbpoints;
1456 np[mod] = numbpoints;
1457 //cout<<" mod = "<<mod<<" numbpoints = "<<numbpoints<<"\n"; getchar();
1458 vettid[mod] = new Int_t[numbpoints];
1460 for (ii=0;ii<numbpoints; ii++) *(vettid[mod]+ii)=0;
1466 if(min_t < 0) {min_t = 0; max_t = nt-1;}
1469 ///////////////////////////////// Definition of vertex end its error ////////////////////////////
1470 ////////////////////////// In the future it will be given by a method ///////////////////////////
1475 Float_t sigmavx=0.0050; // 50 microns
1476 Float_t sigmavy=0.0050; // 50 microns
1477 Float_t sigmavz=0.010; // 100 microns
1479 //Vx+=gRandom->Gaus(0,sigmavx); Vy+=gRandom->Gaus(0,sigmavy); Vz+=gRandom->Gaus(0,sigmavz);
1480 TVector vertex(3), ervertex(3)
1481 vertex(0)=Vx; vertex(1)=Vy; vertex(2)=Vz;
1482 ervertex(0)=sigmavx; ervertex(1)=sigmavy; ervertex(2)=sigmavz;
1483 /////////////////////////////////////////////////////////////////////////////////////////////////
1486 //TDirectory *savedir=gDirectory;
1488 TTree tracktree1("TreeT","Tree with ITS tracks");
1489 AliITSiotrack *iotrack=0;
1490 tracktree1.Branch("ITStracks","AliITSiotrack",&iotrack,32000,0);
1492 ofstream out ("AliITSTra.out");
1495 for (j=min_t; j<=max_t; j++) {
1496 track=(AliTPCtrack*)tracks.UncheckedAt(j);
1498 if (!track) continue;
1499 ////// elimination of not good tracks ////////////
1500 Int_t ilab=TMath::Abs(track->GetLabel());
1502 for (iii=0;iii<ngood;iii++) {
1503 //cout<<" ilab, gt[iii].lab = "<<ilab<<" "<<gt[iii].lab<<"\n"; getchar();
1504 if (ilab==gt[iii].lab) {
1513 //cout<<" j flaglab = " <<j<<" "<<flaglab<<"\n"; getchar();
1514 if (!flaglab) continue;
1515 //cout<<" j = " <<j<<"\n"; getchar();
1517 ////// old propagation to the end of TPC //////////////
1519 track->PropagateTo(xk);
1521 track->PropagateTo(xk,42.7,2.27); //C
1523 track->PropagateTo(xk,36.2,1.98e-3); //C02
1525 track->PropagateTo(xk,42.7,2.27); //C
1526 ///////////////////////////////////////////////////
1529 ////// new propagation to the end of TPC //////////////
1531 track->PropagateTo(xk, 28.94, 1.204e-3); //Ne
1533 track->PropagateTo(xk, 44.77, 1.71); //Tedlar
1535 track->PropagateTo(xk, 44.86, 1.45); //Kevlar
1537 track->PropagateTo(xk, 41.28, 0.029); //Nomex
1539 track->PropagateTo(xk,36.2,1.98e-3); //C02
1541 track->PropagateTo(xk, 24.01, 2.7); //Al
1543 track->PropagateTo(xk, 44.77, 1.71); //Tedlar
1545 track->PropagateTo(xk, 44.86, 1.45); //Kevlar
1547 track->PropagateTo(xk, 41.28, 0.029); //Nomex
1549 ///////////////////////////////////////////////////////////////
1551 ///////////////////////////////////////////////////////////////
1552 AliITStrack trackITS(*track);
1553 AliITStrack result(*track);
1554 AliITStrack primarytrack(*track);
1556 ///////////////////////////////////////////////////////////////////////////////////////////////
1558 Vgeant=result.GetVertex();
1560 // Definition of Dv and Zv for vertex constraint
1561 Double_t sigmaDv=0.0050; Double_t sigmaZv=0.010;
1562 //Double_t sigmaDv=0.0015; Double_t sigmaZv=0.0015;
1563 Double_t uniform= gRandom->Uniform();
1565 if(uniform<=0.5) signdv=-1.;
1569 Double_t Vr=TMath::Sqrt(Vgeant(0)*Vgeant(0)+ Vgeant(1)*Vgeant(1));
1570 Double_t Dv=gRandom->Gaus(signdv*Vr,(Float_t)sigmaDv);
1571 Double_t Zv=gRandom->Gaus(Vgeant(2),(Float_t)sigmaZv);
1573 //cout<<" Dv e Zv = "<<Dv<<" "<<Zv<<"\n";
1574 trackITS.SetDv(Dv); trackITS.SetZv(Zv);
1575 trackITS.SetsigmaDv(sigmaDv); trackITS.SetsigmaZv(sigmaZv);
1576 result.SetDv(Dv); result.SetZv(Zv);
1577 result.SetsigmaDv(sigmaDv); result.SetsigmaZv(sigmaZv);
1578 primarytrack.SetDv(Dv); primarytrack.SetZv(Zv);
1579 primarytrack.SetsigmaDv(sigmaDv); primarytrack.SetsigmaZv(sigmaZv);
1581 /////////////////////////////////////////////////////////////////////////////////////////////////
1583 primarytrack.PrimaryTrack(rl);
1584 TVector d2=primarytrack.Getd2();
1585 TVector tgl2=primarytrack.Gettgl2();
1586 TVector dtgl=primarytrack.Getdtgl();
1587 trackITS.Setd2(d2); trackITS.Settgl2(tgl2); trackITS.Setdtgl(dtgl);
1588 result.Setd2(d2); result.Settgl2(tgl2); result.Setdtgl(dtgl);
1590 trackITS.SetVertex(vertex); trackITS.SetErrorVertex(ervertex);
1591 result.SetVertex(vertex); result.SetErrorVertex(ervertex);
1593 Tracking(trackITS,&result,recPoints,vettid, flagvert,rl);
1595 // cout<<" progressive track number = "<<j<<"\r";
1597 // cout<<" progressive track number = "<<j<<"\n";
1598 Long_t labITS=result.GetLabel();
1599 // cout << " ITS track label = " << labITS << "\n";
1600 int lab=track->GetLabel();
1601 // cout << " TPC track label = " << lab <<"\n";
1602 //result.GetClusters(); getchar(); //to print the cluster matrix
1604 //propagation to vertex
1608 result.Propagation(rbeam);
1611 cov=&result.GetCMatrix();
1612 Double_t pt=TMath::Abs(result.GetPt());
1613 Double_t Dr=result.GetD();
1614 Double_t Z=result.GetZ();
1615 Double_t tgl=result.GetTgl();
1616 Double_t C=result.GetC();
1618 Double_t Dz=Z-(tgl/Cy)*TMath::ASin(result.arga(rbeam));
1621 // cout<<" Dr e dz alla fine = "<<Dr<<" "<<Dz<<"\n"; getchar();
1622 Double_t phi=result.Getphi();
1623 Double_t phivertex = phi - TMath::ASin(result.argA(rbeam));
1624 Double_t duepi=2.*TMath::Pi();
1625 if(phivertex>duepi) phivertex-=duepi;
1626 if(phivertex<0.) phivertex+=duepi;
1627 Double_t Dtot=TMath::Sqrt(Dr*Dr+Dz*Dz);
1629 //////////////////////////////////////////////////////////////////////////////////////////
1630 Int_t NumofCluster, idmodule,idpoint;
1631 NumofCluster=result.GetNumClust();
1632 if(NumofCluster >=5) {
1635 AliITSiotrack outtrack;
1639 iotrack->SetStatePhi(phi);
1640 iotrack->SetStateZ(Z);
1641 iotrack->SetStateD(Dr);
1642 iotrack->SetStateTgl(tgl);
1643 iotrack->SetStateC(C);
1644 Double_t radius=result.Getrtrack();
1645 iotrack->SetRadius(radius);
1647 if(C>0.) charge=-1; else charge=1;
1648 iotrack->SetCharge(charge);
1652 iotrack->SetCovMatrix(cov);
1654 Double_t px=pt*TMath::Cos(phi);
1655 Double_t py=pt*TMath::Sin(phi);
1658 Double_t xtrack=Dr*TMath::Sin(phi);
1659 Double_t ytrack=Dr*TMath::Cos(phi);
1660 Double_t ztrack=Dz+Vgeant(2);
1666 iotrack->SetX(xtrack);
1667 iotrack->SetY(ytrack);
1668 iotrack->SetZ(ztrack);
1669 iotrack->SetLabel(labITS);
1672 for(il=0;il<6; il++){
1673 iotrack->SetIdPoint(il,result.GetIdPoint(il));
1674 iotrack->SetIdModule(il,result.GetIdModule(il));
1678 //cout<<" labITS = "<<labITS<<"\n";
1679 //cout<<" phi z Dr tgl C = "<<phi<<" "<<Z<<" "<<Dr<<" "<<tgl<<" "<<C<<"\n"; getchar();
1681 DataOut(kkk) = ptg; kkk++; DataOut(kkk)=labITS; kkk++; DataOut(kkk)=lab; kkk++;
1683 for (il=0;il<6;il++) {
1684 idpoint=result.GetIdPoint(il);
1685 idmodule=result.GetIdModule(il);
1686 *(vettid[idmodule]+idpoint)=1;
1687 iotrack->SetIdPoint(il,idpoint);
1688 iotrack->SetIdModule(il,idmodule);
1691 // cout<<" +++++++++++++ pt e ptg = "<<pt<<" "<<ptg<<" ++++++++++\n";
1692 Double_t difpt= (pt-ptg)/ptg*100.;
1693 DataOut(kkk)=difpt; kkk++;
1694 Double_t lambdag=TMath::ATan(pzg/ptg);
1695 Double_t lam=TMath::ATan(tgl);
1696 Double_t diflam = (lam - lambdag)*1000.;
1697 DataOut(kkk) = diflam; kkk++;
1698 Double_t phig=TMath::ATan(pyg/pxg);
1699 Double_t phi=phivertex;
1700 Double_t difphi = (phi - phig)*1000.;
1701 DataOut(kkk)=difphi; kkk++;
1702 DataOut(kkk)=Dtot*1.e4; kkk++;
1703 DataOut(kkk)=Dr*1.e4; kkk++;
1704 DataOut(kkk)=Dz*1.e4; kkk++;
1706 for (r=0; r<9; r++) { out<<DataOut(r)<<" ";}
1711 } // end if on NumofCluster
1712 //gObjectTable->Print(); // stampa memoria
1713 } // end for (int j=min_t; j<=max_t; j++)
1718 static Bool_t first=kTRUE;
1719 static TFile *tfile;
1722 tfile=new TFile("itstracks.root","RECREATE");
1723 //cout<<"I have opened itstracks.root file "<<endl;
1730 sprintf(hname,"TreeT%d",evNumber);
1732 tracktree1.Write(hname);
1736 TTree *fAli=gAlice->TreeK();
1739 if (fAli) fileAli =fAli->GetCurrentFile();
1742 ////////////////////////////////////////////////////////////////////////////////////////////////
1744 printf("delete vectors\n");
1745 if(np) delete [] np;
1746 if(vettid) delete [] vettid;