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.32 2001/02/08 23:55:31 nilsen
19 Removed fMajor/MinorVersion variables in favor of variables in derived classes.
20 Set arrays char *det[3] = {"SPD","SDD","SSD"} as const.
22 Revision 1.31 2001/02/02 23:57:28 nilsen
23 Added include file that are no londer included in AliITSgeom.h
25 Revision 1.30 2001/01/30 09:23:13 hristov
26 Streamers removed (R.Brun)
28 Revision 1.29 2001/01/26 20:01:09 hristov
29 Major upgrade of AliRoot code
31 Revision 1.28 2000/12/18 14:02:00 barbera
32 new version of the ITS tracking to take into account the new TPC track parametrization
34 Revision 1.27 2000/12/08 13:49:27 barbera
35 Hidden declaration in a for loop removed to be compliant with HP-UX compiler
37 Revision 1.26 2000/11/27 13:12:13 barbera
38 New version containing the files for tracking
40 Revision 1.25 2000/11/12 22:38:05 barbera
41 Added header file for the SPD Bari model
43 Revision 1.24 2000/10/09 22:18:12 barbera
44 Bug fixes from MAriana to le AliITStest.C run correctly
46 Revision 1.23 2000/10/05 20:47:42 nilsen
47 fixed dependencies of include files. Tryed but failed to get a root automaticly
48 generates streamer function to work. Modified SetDefaults.
50 Revision 1.9.2.15 2000/10/04 16:56:40 nilsen
51 Needed to include stdlib.h
54 Revision 1.22 2000/10/04 19:45:52 barbera
55 Corrected by F. Carminati for v3.04
57 Revision 1.21 2000/10/02 21:28:08 fca
58 Removal of useless dependecies via forward declarations
60 Revision 1.20 2000/10/02 16:31:39 barbera
63 Revision 1.9.2.14 2000/10/02 15:43:51 barbera
64 General code clean-up (e.g., printf -> cout)
66 Revision 1.19 2000/09/22 12:13:25 nilsen
67 Patches and updates for fixes to this and other routines.
69 Revision 1.18 2000/07/12 05:32:20 fca
70 Correcting several syntax problem with static members
72 Revision 1.17 2000/07/10 16:07:18 fca
73 Release version of ITS code
75 Revision 1.9.2.3 2000/02/02 13:42:09 barbera
76 fixed AliITS.cxx for new AliRun structure. Added ITS hits list to list of hits which will have their track numbers updated
78 Revision 1.9.2.2 2000/01/23 03:03:13 nilsen
79 //fixed FillModule. Removed fi(fabs(xl)<dx....
81 Revision 1.9.2.1 2000/01/12 19:03:32 nilsen
82 This is the version of the files after the merging done in December 1999.
83 See the ReadMe110100.txt file for details
85 Revision 1.9 1999/11/14 14:33:25 fca
86 Correct problems with distructors and pointers, thanks to I.Hrivnacova
88 Revision 1.8 1999/09/29 09:24:19 fca
89 Introduction of the Copyright and cvs Log
93 ///////////////////////////////////////////////////////////////////////////////
95 // An overview of the basic philosophy of the ITS code development
96 // and analysis is show in the figure below.
99 <img src="picts/ITS/ITS_Analysis_schema.gif">
102 <font size=+2 color=red>
103 <p>Roberto Barbera is in charge of the ITS Offline code (1999).
104 <a href="mailto:roberto.barbera@ct.infn.it">Roberto Barbera</a>.
110 // AliITS. Inner Traking System base class.
111 // This class contains the base procedures for the Inner Tracking System
115 <img src="picts/ITS/AliITS_Class_Diagram.gif">
118 <font size=+2 color=red>
119 <p>This show the class diagram of the different elements that are part of
127 // Written by Rene Brun, Federico Carminati, and Roberto Barbera
130 // Modified and documented by Bjorn S. Nilsen
134 // Modified and documented by A. Bologna
137 // AliITS is the general base class for the ITS. Also see AliDetector for
138 // futher information.
140 ///////////////////////////////////////////////////////////////////////////////
141 #include <iostream.h>
149 #include <TClonesArray.h>
151 #include <TObjectTable.h>
160 #include "AliITSMap.h"
161 #include "AliITSDetType.h"
162 #include "AliITSClusterFinder.h"
163 //#include "AliITSsimulation.h"
164 #include "AliITSsimulationSPD.h"
165 #include "AliITSsimulationSDD.h"
166 #include "AliITSsimulationSSD.h"
167 #include "AliITSresponse.h"
168 #include "AliITSsegmentationSPD.h"
169 #include "AliITSresponseSPD.h"
170 #include "AliITSresponseSPDbari.h"
171 #include "AliITSsegmentationSDD.h"
172 #include "AliITSresponseSDD.h"
173 #include "AliITSsegmentationSSD.h"
174 #include "AliITSresponseSSD.h"
175 #include "AliITShit.h"
176 #include "AliITSgeom.h"
177 #include "AliITSdigit.h"
178 #include "AliITSmodule.h"
179 #include "AliITSRecPoint.h"
180 #include "AliITSRawCluster.h"
184 #include "AliITStrack.h"
185 #include "AliITSiotrack.h"
186 #include "AliITStracking.h"
187 #include "../TPC/AliTPC.h"
188 #include "../TPC/AliTPCParam.h"
193 //_____________________________________________________________________________
194 AliITS::AliITS() : AliDetector() {
196 // Default initialiser for ITS
197 // The default constructor of the AliITS class. In addition to
198 // creating the AliITS class it zeros the variables fIshunt (a member
199 // of AliDetector class), fEuclidOut, and fIdN, and zeros the pointers
200 // fITSpoints, fIdSens, and fIdName. The AliDetector default constructor
208 fNDetTypes = kNTYPES;
227 //_____________________________________________________________________________
228 AliITS::AliITS(const char *name, const char *title):AliDetector(name,title){
230 // Default initialiser for ITS
231 // The constructor of the AliITS class. In addition to creating the
232 // AliITS class, it allocates memory for the TClonesArrays fHits and
233 // fDigits, and for the TObjArray fITSpoints. It also zeros the variables
234 // fIshunt (a member of AliDetector class), fEuclidOut, and fIdN, and zeros
235 // the pointers fIdSens and fIdName. To help in displaying hits via the ROOT
236 // macro display.C AliITS also sets the marker color to red. The variables
237 // passes with this constructor, const char *name and *title, are used by
238 // the constructor of AliDetector class. See AliDetector class for a
239 // description of these parameters and its constructor functions.
243 fHits = new TClonesArray("AliITShit", 1560);
244 gAlice->AddHitList(fHits);
246 fNDetTypes = kNTYPES;
248 fNdtype = new Int_t[kNTYPES];
249 fDtype = new TObjArray(kNTYPES);
251 fNctype = new Int_t[kNTYPES];
252 fCtype = new TObjArray(kNTYPES);
268 fDetTypes = new TObjArray(kNTYPES);
271 for(i=0;i<kNTYPES;i++) {
272 (*fDetTypes)[i]=new AliITSDetType();
278 SetMarkerColor(kRed);
282 //___________________________________________________________________________
283 AliITS::AliITS(AliITS &source){
285 if(this==&source) return;
286 Error("AliITS::Copy constructor",
287 "You are not allowed to make a copy of the AliITS");
290 //____________________________________________________________________________
291 AliITS& AliITS::operator=(AliITS &source){
292 // assignment operator
293 if(this==&source) return *this;
294 Error("AliITS::operator=",
295 "You are not allowed to make a copy of the AliITS");
297 return *this; //fake return
299 //____________________________________________________________________________
300 void AliITS::ClearModules(){
301 //clear the modules TObjArray
303 if(fITSmodules) fITSmodules->Delete();
306 //_____________________________________________________________________________
309 // Default distructor for ITS
310 // The default destructor of the AliITS class. In addition to deleting
311 // the AliITS class it deletes the memory pointed to by the fHits, fDigits,
312 // fIdSens, fIdName, and fITSpoints.
319 // delete fIdName; // TObjArray of TObjStrings
320 if(fIdName!=0) delete[] fIdName; // Array of TStrings
321 if(fIdSens!=0) delete[] fIdSens;
323 this->ClearModules();
325 }// end if fITSmodules!=0
345 if (fTreeC) delete fTreeC;
347 if (fITSgeom) delete fITSgeom;
351 //___________________________________________
352 AliITSDetType* AliITS::DetType(Int_t id)
354 //return pointer to id detector type
355 return ((AliITSDetType*) (*fDetTypes)[id]);
358 //___________________________________________
359 void AliITS::SetClasses(Int_t id, const char *digit, const char *cluster)
361 //set the digit and cluster classes to be used for the id detector type
362 ((AliITSDetType*) (*fDetTypes)[id])->ClassNames(digit,cluster);
365 //___________________________________________
366 void AliITS::SetResponseModel(Int_t id, AliITSresponse *response)
368 //set the response model for the id detector type
370 ((AliITSDetType*) (*fDetTypes)[id])->ResponseModel(response);
374 //___________________________________________
375 void AliITS::SetSegmentationModel(Int_t id, AliITSsegmentation *seg)
377 //set the segmentation model for the id detector type
379 ((AliITSDetType*) (*fDetTypes)[id])->SegmentationModel(seg);
383 //___________________________________________
384 void AliITS::SetSimulationModel(Int_t id, AliITSsimulation *sim)
386 //set the simulation model for the id detector type
388 ((AliITSDetType*) (*fDetTypes)[id])->SimulationModel(sim);
391 //___________________________________________
392 void AliITS::SetReconstructionModel(Int_t id, AliITSClusterFinder *reconst)
394 //set the cluster finder model for the id detector type
396 ((AliITSDetType*) (*fDetTypes)[id])->ReconstructionModel(reconst);
400 //_____________________________________________________________________________
401 void AliITS::AddHit(Int_t track, Int_t *vol, Float_t *hits){
404 // The function to add information to the AliITShit class. See the
405 // AliITShit class for a full description. This function allocates the
406 // necessary new space for the hit information and passes the variable
407 // track, and the pointers *vol and *hits to the AliITShit constructor
410 TClonesArray &lhits = *fHits;
411 new(lhits[fNhits++]) AliITShit(fIshunt,track,vol,hits);
413 //_____________________________________________________________________________
414 void AliITS::AddRealDigit(Int_t id, Int_t *digits)
416 // add a real digit - as coming from data
418 TClonesArray &ldigits = *((TClonesArray*)(*fDtype)[id]);
419 new(ldigits[fNdtype[id]++]) AliITSdigit(digits);
422 //_____________________________________________________________________________
423 void AliITS::AddSimDigit(Int_t id, AliITSdigit *d)
426 // add a simulated digit
428 TClonesArray &ldigits = *((TClonesArray*)(*fDtype)[id]);
433 new(ldigits[fNdtype[id]++]) AliITSdigitSPD(*((AliITSdigitSPD*)d));
436 new(ldigits[fNdtype[id]++]) AliITSdigitSDD(*((AliITSdigitSDD*)d));
439 new(ldigits[fNdtype[id]++]) AliITSdigitSSD(*((AliITSdigitSSD*)d));
445 //_____________________________________________________________________________
446 void AliITS::AddSimDigit(Int_t id,Float_t phys,Int_t *digits,Int_t *tracks,Int_t *hits,Float_t *charges){
448 // add a simulated digit to the list
450 TClonesArray &ldigits = *((TClonesArray*)(*fDtype)[id]);
454 new(ldigits[fNdtype[id]++]) AliITSdigitSPD(digits,tracks,hits);
457 new(ldigits[fNdtype[id]++]) AliITSdigitSDD(phys,digits,tracks,hits,charges);
460 new(ldigits[fNdtype[id]++]) AliITSdigitSSD(digits,tracks,hits);
466 //_____________________________________________________________________________
467 void AliITS::AddCluster(Int_t id, AliITSRawCluster *c)
470 // add a cluster to the list
472 TClonesArray &lcl = *((TClonesArray*)(*fCtype)[id]);
477 new(lcl[fNctype[id]++]) AliITSRawClusterSPD(*((AliITSRawClusterSPD*)c));
480 new(lcl[fNctype[id]++]) AliITSRawClusterSDD(*((AliITSRawClusterSDD*)c));
483 new(lcl[fNctype[id]++]) AliITSRawClusterSSD(*((AliITSRawClusterSSD*)c));
490 //_____________________________________________________________________________
491 void AliITS::AddRecPoint(const AliITSRecPoint &r)
494 // Add a reconstructed space point to the list
496 TClonesArray &lrecp = *fRecPoints;
497 new(lrecp[fNRecPoints++]) AliITSRecPoint(r);
501 //____________________________________________
502 void AliITS::ResetDigits()
505 // Reset number of digits and the digits array for the ITS detector
511 for (i=0;i<kNTYPES;i++ ) {
512 if ((*fDtype)[i]) ((TClonesArray*)(*fDtype)[i])->Clear();
513 if (fNdtype) fNdtype[i]=0;
517 //____________________________________________
518 void AliITS::ResetDigits(Int_t i)
521 // Reset number of digits and the digits array for this branch
523 if ((*fDtype)[i]) ((TClonesArray*)(*fDtype)[i])->Clear();
524 if (fNdtype) fNdtype[i]=0;
528 //____________________________________________
529 void AliITS::ResetClusters()
532 // Reset number of clusters and the clusters array for ITS
536 for (i=0;i<kNTYPES;i++ ) {
537 if ((*fCtype)[i]) ((TClonesArray*)(*fCtype)[i])->Clear();
538 if (fNctype) fNctype[i]=0;
543 //____________________________________________
544 void AliITS::ResetClusters(Int_t i)
547 // Reset number of clusters and the clusters array for this branch
549 if ((*fCtype)[i]) ((TClonesArray*)(*fCtype)[i])->Clear();
550 if (fNctype) fNctype[i]=0;
555 //____________________________________________
556 void AliITS::ResetRecPoints()
559 // Reset number of rec points and the rec points array
561 if (fRecPoints) fRecPoints->Clear();
566 //_____________________________________________________________________________
567 Int_t AliITS::DistancetoPrimitive(Int_t , Int_t ){
569 // Distance from mouse to ITS on the screen. Dummy routine
570 // A dummy routine used by the ROOT macro display.C to allow for the
571 // use of the mouse (pointing device) in the macro. In general this should
572 // never be called. If it is it returns the number 9999 for any value of
578 //_____________________________________________________________________________
581 // Initialise ITS after it has been built
582 // This routine initializes the AliITS class. It is intended to be called
583 // from the Init function in AliITSv?. Besides displaying a banner
584 // indicating that it has been called it initializes the array fIdSens
585 // and sets the default segmentation, response, digit and raw cluster classes
586 // Therefore it should be called after a call to CreateGeometry.
593 for(i=0;i<fIdN;i++) fIdSens[i] = gMC->VolId(fIdName[i]);
597 //_____________________________________________________________________________
598 void AliITS::SetDefaults()
600 // sets the default segmentation, response, digit and raw cluster classes
602 printf("SetDefaults\n");
604 AliITSDetType *iDetType;
610 if (!iDetType->GetSegmentationModel()) {
611 AliITSsegmentationSPD *seg0=new AliITSsegmentationSPD(fITSgeom);
612 SetSegmentationModel(0,seg0);
614 if (!iDetType->GetResponseModel()) {
615 SetResponseModel(0,new AliITSresponseSPD());
617 // set digit and raw cluster classes to be used
619 const char *kData0=(iDetType->GetResponseModel())->DataType();
620 if (strstr(kData0,"real")) {
621 iDetType->ClassNames("AliITSdigit","AliITSRawClusterSPD");
622 } else iDetType->ClassNames("AliITSdigitSPD","AliITSRawClusterSPD");
626 if (!iDetType->GetResponseModel()) {
627 SetResponseModel(1,new AliITSresponseSDD());
629 AliITSresponse *resp1=iDetType->GetResponseModel();
630 if (!iDetType->GetSegmentationModel()) {
631 AliITSsegmentationSDD *seg1=new AliITSsegmentationSDD(fITSgeom,resp1);
632 SetSegmentationModel(1,seg1);
634 const char *kData1=(iDetType->GetResponseModel())->DataType();
635 const char *kopt=iDetType->GetResponseModel()->ZeroSuppOption();
636 if ((!strstr(kopt,"2D")) && (!strstr(kopt,"1D")) || strstr(kData1,"real") ) {
637 iDetType->ClassNames("AliITSdigit","AliITSRawClusterSDD");
638 } else iDetType->ClassNames("AliITSdigitSDD","AliITSRawClusterSDD");
642 if (!iDetType->GetSegmentationModel()) {
643 AliITSsegmentationSSD *seg2=new AliITSsegmentationSSD(fITSgeom);
644 SetSegmentationModel(2,seg2);
646 if (!iDetType->GetResponseModel()) {
647 SetResponseModel(2,new AliITSresponseSSD());
649 const char *kData2=(iDetType->GetResponseModel())->DataType();
650 if (strstr(kData2,"real")) {
651 iDetType->ClassNames("AliITSdigit","AliITSRawClusterSSD");
652 } else iDetType->ClassNames("AliITSdigitSSD","AliITSRawClusterSSD");
655 Warning("SetDefaults","Only the three basic detector types are initialised!");
662 //_____________________________________________________________________________
663 void AliITS::SetDefaultSimulation()
668 //_____________________________________________________________________________
669 void AliITS::SetDefaultClusterFinders()
674 //_____________________________________________________________________________
676 void AliITS::MakeTreeC(Option_t *option)
678 // create a separate tree to store the clusters
680 cout << "AliITS::MakeTreeC" << endl;
682 char *optC = strstr(option,"C");
683 if (optC && !fTreeC) fTreeC = new TTree("TC","Clusters in ITS");
686 Int_t buffersize = 4000;
689 const char *det[3] = {"SPD","SDD","SSD"};
694 // one branch for Clusters per type of detector
696 for (i=0; i<kNTYPES ;i++) {
697 AliITSDetType *iDetType=DetType(i);
698 iDetType->GetClassNames(digclass,clclass);
699 //printf("i, digclass, recclass %d %s %s\n",i,digclass,clclass);
701 (*fCtype)[i] = new TClonesArray(clclass,10000);
702 if (kNTYPES==3) sprintf(branchname,"%sClusters%s",GetName(),det[i]);
703 else sprintf(branchname,"%sClusters%d",GetName(),i+1);
704 if (fCtype && fTreeC) {
705 TreeC()->Branch(branchname,&((*fCtype)[i]), buffersize);
706 cout << "Making Branch " << branchname;
707 cout << " for Clusters of detector type " << i+1 << endl;
713 //_____________________________________________________________________________
714 void AliITS::GetTreeC(Int_t event)
717 cout << "AliITS::GetTreeC" << endl;
719 // get the clusters tree for this event and set the branch address
723 const char *det[3] = {"SPD","SDD","SSD"};
730 sprintf(treeName,"TreeC%d",event);
731 fTreeC = (TTree*)gDirectory->Get(treeName);
736 for (i=0; i<kNTYPES; i++) {
737 if (kNTYPES==3) sprintf(branchname,"%sClusters%s",GetName(),det[i]);
738 else sprintf(branchname,"%sClusters%d",GetName(),i+1);
740 branch = fTreeC->GetBranch(branchname);
741 if (branch) branch->SetAddress(&((*fCtype)[i]));
745 Error("AliITS::GetTreeC",
746 "cannot find Clusters Tree for event:%d\n",event);
750 //_____________________________________________________________________________
751 void AliITS::MakeBranch(Option_t* option, char *file)
754 // Creates Tree branches for the ITS.
757 Int_t buffersize = 4000;
759 sprintf(branchname,"%s",GetName());
761 AliDetector::MakeBranch(option,file);
763 char *cD = strstr(option,"D");
764 char *cR = strstr(option,"R");
768 // one branch for digits per type of detector
770 const char *det[3] = {"SPD","SDD","SSD"};
776 for (i=0; i<kNTYPES ;i++) {
777 AliITSDetType *iDetType=DetType(i);
778 iDetType->GetClassNames(digclass,clclass);
779 //printf("i, digclass, recclass %d %s %s\n",i,digclass,clclass);
781 (*fDtype)[i] = new TClonesArray(digclass,10000);
783 //(*fCtype)[i] = new TClonesArray(clclass,10000);
786 for (i=0; i<kNTYPES ;i++) {
787 if (kNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]);
788 else sprintf(branchname,"%sDigits%d",GetName(),i+1);
789 if (fDtype && gAlice->TreeD()) {
790 gAlice->MakeBranchInTree(gAlice->TreeD(),
791 branchname, &((*fDtype)[i]), buffersize, file) ;
792 cout << "Making Branch " << branchname;
793 cout << " for digits of type "<< i+1 << endl;
800 // only one branch for rec points for all detector types
802 sprintf(branchname,"%sRecPoints",GetName());
804 fRecPoints=new TClonesArray("AliITSRecPoint",10000);
806 if (fRecPoints && gAlice->TreeR()) {
807 gAlice->MakeBranchInTree(gAlice->TreeR(),
808 branchname, &fRecPoints, buffersize, file) ;
809 cout << "Making Branch " << branchname;
810 cout << " for reconstructed space points" << endl;
815 //___________________________________________
816 void AliITS::SetTreeAddress()
819 // Set branch address for the Trees.
822 AliDetector::SetTreeAddress();
824 const char *det[3] = {"SPD","SDD","SSD"};
827 TTree *treeD = gAlice->TreeD();
828 TTree *treeR = gAlice->TreeR();
832 for (i=0; i<kNTYPES; i++) {
833 if (kNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]);
834 else sprintf(branchname,"%sDigits%d",GetName(),i+1);
836 branch = treeD->GetBranch(branchname);
837 if (branch) branch->SetAddress(&((*fDtype)[i]));
844 sprintf(branchname,"%sRecPoints",GetName());
846 branch = treeR->GetBranch(branchname);
847 if (branch) branch->SetAddress(&fRecPoints);
854 //____________________________________________________________________________
855 void AliITS::InitModules(Int_t size,Int_t &nmodules){
857 //initialize the modules array
860 fITSmodules->Delete();
864 Int_t nl,indexMAX,index;
866 if(size<=0){ // default to using data stored in AliITSgeom
868 Error("AliITS::InitModules",
869 "in AliITS::InitModule fITSgeom not defined\n");
871 } // end if fITSgeom==0
872 nl = fITSgeom->GetNlayers();
873 indexMAX = fITSgeom->GetModuleIndex(nl,fITSgeom->GetNladders(nl),
874 fITSgeom->GetNdetectors(nl))+1;
876 fITSmodules = new TObjArray(indexMAX);
877 for(index=0;index<indexMAX;index++){
878 fITSmodules->AddAt( new AliITSmodule(index),index);
881 fITSmodules = new TObjArray(size);
882 for(index=0;index<size;index++) {
883 fITSmodules->AddAt( new AliITSmodule(index),index);
890 //____________________________________________________________________________
891 void AliITS::FillModules(Int_t evnt,Int_t bgrev,Int_t nmodules,Option_t *option,Text_t *filename){
893 // fill the modules with the sorted by module hits; add hits from background
897 static TTree *trH1; //Tree with background hits
898 static TClonesArray *fHits2; //List of hits for one track only
900 static Bool_t first=kTRUE;
902 char *addBgr = strstr(option,"Add");
907 cout<<"filename "<<filename<<endl;
908 file=new TFile(filename);
909 cout<<"I have opened "<<filename<<" file "<<endl;
910 fHits2 = new TClonesArray("AliITShit",1000 );
915 // Get Hits Tree header from file
916 if(fHits2) fHits2->Clear();
917 if(trH1) delete trH1;
921 sprintf(treeName,"TreeH%d",bgrev);
922 trH1 = (TTree*)gDirectory->Get(treeName);
923 //printf("TrH1 %p of treename %s for event %d \n",trH1,treeName,bgrev);
926 Error("AliITS::FillModules",
927 "cannot find Hits Tree for event:%d\n",bgrev);
929 // Set branch addresses
932 sprintf(branchname,"%s",GetName());
933 if (trH1 && fHits2) {
934 branch = trH1->GetBranch(branchname);
935 if (branch) branch->SetAddress(&fHits2);
939 //Int_t ntracks1 =(Int_t)TrH1->GetEntries();
940 //printf("background - ntracks1 - %d\n",ntracks1);
943 //Int_t npart = gAlice->GetEvent(evnt);
944 //if(npart<=0) return;
945 TClonesArray *itsHits = this->Hits();
946 Int_t lay,lad,det,index;
950 TTree *iTH = gAlice->TreeH();
951 Int_t ntracks =(Int_t) iTH->GetEntries();
954 for(t=0; t<ntracks; t++){
957 Int_t nhits = itsHits->GetEntriesFast();
958 //printf("nhits %d\n",nhits);
959 if (!nhits) continue;
960 for(h=0; h<nhits; h++){
961 itsHit = (AliITShit *)itsHits->UncheckedAt(h);
962 itsHit->GetDetectorID(lay,lad,det);
963 // temporarily index=det-1 !!!
964 if(fITSgeom) index = fITSgeom->GetModuleIndex(lay,lad,det);
967 mod = this->GetModule(index);
968 mod->AddHit(itsHit,t,h);
969 } // end loop over hits
970 } // end loop over tracks
972 // open the file with background
976 ntracks =(Int_t)trH1->GetEntries();
977 //printf("background - ntracks1 %d\n",ntracks);
978 //printf("background - Start loop over tracks \n");
981 for (track=0; track<ntracks; track++) {
983 if (fHits2) fHits2->Clear();
984 trH1->GetEvent(track);
986 for(i=0;i<fHits2->GetEntriesFast();++i) {
988 itsHit=(AliITShit*) (*fHits2)[i];
989 itsHit->GetDetectorID(lay,lad,det);
990 // temporarily index=det-1 !!!
991 if(fITSgeom) index = fITSgeom->GetModuleIndex(lay,lad,det);
994 mod = this->GetModule(index);
995 mod->AddHit(itsHit,track,i);
996 } // end loop over hits
997 } // end loop over tracks
999 TTree *fAli=gAlice->TreeK();
1002 if (fAli) fileAli =fAli->GetCurrentFile();
1007 //gObjectTable->Print();
1011 //____________________________________________________________________________
1013 void AliITS::SDigits2Digits()
1016 AliITSgeom *geom = GetITSgeom();
1019 AliITSDetType *iDetType;
1020 iDetType=DetType(0);
1021 AliITSsegmentationSPD *seg0=(AliITSsegmentationSPD*)iDetType->GetSegmentationModel();
1022 AliITSresponseSPD *res0 = (AliITSresponseSPD*)iDetType->GetResponseModel();
1023 AliITSsimulationSPD *sim0=new AliITSsimulationSPD(seg0,res0);
1024 SetSimulationModel(0,sim0);
1026 // printf("SPD dimensions %f %f \n",seg0->Dx(),seg0->Dz());
1027 // printf("SPD npixels %d %d \n",seg0->Npz(),seg0->Npx());
1028 // printf("SPD pitches %d %d \n",seg0->Dpz(0),seg0->Dpx(0));
1032 //Set response functions
1033 Float_t baseline = 10.;
1034 Float_t noise = 1.75;
1036 // SDD compression param: 2 fDecrease, 2fTmin, 2fTmax or disable, 2 fTolerance
1038 iDetType=DetType(1);
1039 AliITSresponseSDD *res1 = (AliITSresponseSDD*)iDetType->GetResponseModel();
1041 res1=new AliITSresponseSDD();
1042 SetResponseModel(1,res1);
1044 res1->SetMagicValue(900.);
1045 Float_t maxadc = res1->MaxAdc();
1046 Float_t topValue = res1->MagicValue();
1047 Float_t norm = maxadc/topValue;
1049 Float_t fCutAmp = baseline + 2.*noise;
1051 Int_t cp[8]={0,0,(int)fCutAmp,(int)fCutAmp,0,0,0,0}; //1D
1053 //res1->SetZeroSupp("2D");
1054 res1->SetZeroSupp("1D");
1055 res1->SetNoiseParam(noise,baseline);
1056 res1->SetDo10to8(kTRUE);
1057 res1->SetCompressParam(cp);
1059 res1->SetDiffCoeff(3.6,40.);
1060 //res1->SetMagicValue(96.95);
1061 AliITSsegmentationSDD *seg1=(AliITSsegmentationSDD*)iDetType->GetSegmentationModel();
1063 seg1 = new AliITSsegmentationSDD(geom,res1);
1064 SetSegmentationModel(1,seg1);
1066 AliITSsimulationSDD *sim1=new AliITSsimulationSDD(seg1,res1);
1068 sim1->SetCheckNoise(kFALSE);
1069 SetSimulationModel(1,sim1);
1072 iDetType=DetType(2);
1073 AliITSsegmentationSSD *seg2=(AliITSsegmentationSSD*)iDetType->GetSegmentationModel();
1074 AliITSresponseSSD *res2 = (AliITSresponseSSD*)iDetType->GetResponseModel();
1075 res2->SetSigmaSpread(3.,2.);
1076 AliITSsimulationSSD *sim2=new AliITSsimulationSSD(seg2,res2);
1077 SetSimulationModel(2,sim2);
1079 cerr<<"Digitizing ITS...\n";
1083 HitsToDigits(0,0,-1," ","All"," ");
1084 timer.Stop(); timer.Print();
1092 //____________________________________________________________________________
1093 void AliITS::HitsToDigits(Int_t evNumber,Int_t bgrev,Int_t size, Option_t *option, Option_t *opt,Text_t *filename)
1095 // keep galice.root for signal and name differently the file for
1096 // background when add! otherwise the track info for signal will be lost !
1098 // the condition below will disappear when the geom class will be
1099 // initialised for all versions - for the moment it is only for v5 !
1100 // 7 is the SDD beam test version
1101 Int_t ver = this->IsVersion();
1102 if(ver!=5 && ver!=7) return;
1104 char *all = strstr(opt,"All");
1105 char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),strstr(opt,"SSD")};
1108 InitModules(size,nmodules);
1109 FillModules(evNumber,bgrev,nmodules,option,filename);
1112 AliITSsimulation* sim;
1113 //TObjArray *branches=gAlice->TreeD()->GetListOfBranches();
1114 AliITSgeom *geom = GetITSgeom();
1118 for (id=0;id<kNTYPES;id++) {
1119 if (!all && !det[id]) continue;
1120 //branch = (TBranch*)branches->UncheckedAt(id);
1121 AliITSDetType *iDetType=DetType(id);
1122 sim = (AliITSsimulation*)iDetType->GetSimulationModel();
1124 Error("HitsToDigits","The simulation class was not instantiated!");
1126 // or SetDefaultSimulation();
1129 first = geom->GetStartDet(id);
1130 last = geom->GetLastDet(id);
1131 } else first=last=0;
1132 cout << "det type " << id << " first, last "<< first << last << endl;
1133 for(module=first;module<=last;module++) {
1134 AliITSmodule *mod = (AliITSmodule *)fITSmodules->At(module);
1135 sim->DigitiseModule(mod,module,evNumber);
1136 // fills all branches - wasted disk space
1137 gAlice->TreeD()->Fill();
1139 // try and fill only the branch
1142 } // loop over modules
1143 } // loop over detector types
1147 Int_t nentries=(Int_t)gAlice->TreeD()->GetEntries();
1148 cout << "nentries in TreeD" << nentries << endl;
1151 sprintf(hname,"TreeD%d",evNumber);
1152 gAlice->TreeD()->Write(hname,TObject::kOverwrite);
1154 gAlice->TreeD()->Reset();
1159 //____________________________________________________________________________
1160 void AliITS::DigitsToRecPoints(Int_t evNumber,Int_t lastentry,Option_t *opt)
1162 // cluster finding and reconstruction of space points
1164 // the condition below will disappear when the geom class will be
1165 // initialised for all versions - for the moment it is only for v5 !
1166 // 7 is the SDD beam test version
1167 Int_t ver = this->IsVersion();
1168 if(ver!=5 && ver!=7) return;
1170 char *all = strstr(opt,"All");
1171 char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),strstr(opt,"SSD")};
1173 static Bool_t first=kTRUE;
1174 if (!TreeC() && first) {
1179 TTree *treeC=TreeC();
1183 AliITSClusterFinder* rec;
1185 //TObjArray *branches=gAlice->TreeR()->GetListOfBranches();
1186 AliITSgeom *geom = GetITSgeom();
1189 for (id=0;id<kNTYPES;id++) {
1190 if (!all && !det[id]) continue;
1191 //branch = (TBranch*)branches->UncheckedAt(id);
1192 AliITSDetType *iDetType=DetType(id);
1193 rec = (AliITSClusterFinder*)iDetType->GetReconstructionModel();
1195 Error("DigitsToRecPoints","The cluster finder class was not instantiated!");
1197 // or SetDefaultClusterFinders();
1199 TClonesArray *itsDigits = this->DigitsAddress(id);
1203 first = geom->GetStartDet(id);
1204 last = geom->GetLastDet(id);
1205 } else first=last=0;
1206 //printf("first last %d %d\n",first,last);
1207 for(module=first;module<=last;module++) {
1208 this->ResetDigits();
1209 if (all) gAlice->TreeD()->GetEvent(lastentry+module);
1210 else gAlice->TreeD()->GetEvent(lastentry+(module-first));
1211 Int_t ndigits = itsDigits->GetEntriesFast();
1212 if (ndigits) rec->FindRawClusters();
1213 gAlice->TreeR()->Fill();
1217 // try and fill only the branch
1219 //ResetRecPoints(id);
1220 } // loop over modules
1221 } // loop over detector types
1224 Int_t nentries=(Int_t)gAlice->TreeR()->GetEntries();
1225 Int_t ncentries=(Int_t)treeC->GetEntries();
1226 cout << " nentries ncentries " << nentries << ncentries << endl;
1229 sprintf(hname,"TreeR%d",evNumber);
1230 gAlice->TreeR()->Write(hname,TObject::kOverwrite);
1232 gAlice->TreeR()->Reset();
1234 sprintf(hname,"TreeC%d",evNumber);
1235 treeC->Write(hname,TObject::kOverwrite);
1240 //____________________________________________________________________________
1241 void AliITS::HitsToFastRecPoints(Int_t evNumber,Int_t bgrev,Int_t size,
1242 Option_t *option,Option_t *opt,Text_t *filename)
1244 // keep galice.root for signal and name differently the file for
1245 // background when add! otherwise the track info for signal will be lost !
1248 // the condition below will disappear when the geom class will be
1249 // initialised for all versions - for the moment it is only for v5 !
1250 Int_t ver = this->IsVersion();
1253 char *all = strstr(opt,"All");
1254 char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),strstr(opt,"SSD")};
1257 InitModules(size,nmodules);
1258 FillModules(evNumber,bgrev,nmodules,option,filename);
1261 AliITSsimulation* sim;
1262 AliITSgeom *geom = GetITSgeom();
1264 TRandom *random=new TRandom[9];
1265 random[0].SetSeed(111);
1266 random[1].SetSeed(222);
1267 random[2].SetSeed(333);
1268 random[3].SetSeed(444);
1269 random[4].SetSeed(555);
1270 random[5].SetSeed(666);
1271 random[6].SetSeed(777);
1272 random[7].SetSeed(888);
1273 random[8].SetSeed(999);
1277 for (id=0;id<kNTYPES;id++) {
1278 if (!all && !det[id]) continue;
1279 AliITSDetType *iDetType=DetType(id);
1280 sim = (AliITSsimulation*)iDetType->GetSimulationModel();
1282 Error("HitsToFastPoints","The simulation class was not instantiated!");
1284 // or SetDefaultSimulation();
1286 Int_t first = geom->GetStartDet(id);
1287 Int_t last = geom->GetLastDet(id);
1288 for(module=first;module<=last;module++) {
1289 AliITSmodule *mod = (AliITSmodule *)fITSmodules->At(module);
1290 sim->CreateFastRecPoints(mod,module,random);
1291 gAlice->TreeR()->Fill();
1293 } // loop over modules
1294 } // loop over detector types
1299 //Int_t nentries=(Int_t)gAlice->TreeR()->GetEntries();
1302 sprintf(hname,"TreeR%d",evNumber);
1303 gAlice->TreeR()->Write(hname,TObject::kOverwrite);
1305 gAlice->TreeR()->Reset();
1311 //________________________________________________________________
1313 AliITStrack AliITS::Tracking(AliITStrack &track, AliITStrack *reference,TObjArray *fastpoints, Int_t
1314 **vettid, Bool_t flagvert ) {
1316 //Origin A. Badala' and G.S. Pappalardo: e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it
1319 TList *list= new TList();
1321 AliITStrack tr(track);
1325 Double_t Pt=(tr).GetPt();
1326 //cout << "\n Pt = " << Pt <<"\n";
1328 AliITStracking obj(list, reference, this, fastpoints,TMath::Abs(Pt),vettid, flagvert);
1333 TVector VecTotLabref(18);
1335 for(lay=5; lay>=0; lay--) {
1336 TVector VecLabref(3);
1337 VecLabref=(*reference).GetLabTrack(lay);
1338 for(k=0; k<3; k++) {itot++; VecTotLabref(itot)=VecLabref(k);}
1342 (*reference).Search(VecTotLabref, labref, freq);
1344 if(freq < 5) labref=-labref;
1345 (*reference).SetLabel(labref);
1353 //________________________________________________________________
1357 void AliITS::DoTracking(Int_t evNumber, Int_t min_t, Int_t max_t, TFile *file, Bool_t flagvert) {
1359 // ex macro for tracking ITS
1361 printf("begin DoTracking - file %p\n",file);
1363 const char *pname="75x40_100x60";
1367 Float_t px,py,pz,x,y,z,pxg,pyg,pzg,ptg;
1372 gAlice->GetEvent(0);
1374 AliTPC *TPC=(AliTPC*)gAlice->GetDetector("TPC");
1375 AliTPCParam *digp = (AliTPCParam*)file->Get(pname);
1376 if (digp!=0) TPC->SetParam(digp);
1380 ifstream in("good_tracks");
1382 cerr<<"Reading good tracks...\n";
1383 while (in>>gt[ngood].lab>>gt[ngood].code
1384 >>gt[ngood].px >>gt[ngood].py>>gt[ngood].pz
1385 >>gt[ngood].x >>gt[ngood].y >>gt[ngood].z
1386 >>gt[ngood].pxg >>gt[ngood].pyg >>gt[ngood].pzg
1387 >>gt[ngood].ptg >>gt[ngood].flag) {
1391 cerr<<"Too many good tracks !\n";
1395 if (!in.eof()) cerr<<"Read error (good_tracks) !\n";
1399 TFile *tf=TFile::Open("tpctracks.root");
1400 if (!tf->IsOpen()) {cerr<<"Can't open tpctracks.root !\n"; return ;}
1401 TObjArray tracks(200000);
1402 TTree *tracktree=(TTree*)tf->Get("TreeT");
1403 TBranch *tbranch=tracktree->GetBranch("tracks");
1404 Int_t nentr=(Int_t)tracktree->GetEntries();
1406 for (kk=0; kk<nentr; kk++) {
1407 AliTPCtrack *iotrack=new AliTPCtrack;
1408 tbranch->SetAddress(&iotrack);
1409 tracktree->GetEvent(kk);
1410 tracks.AddLast(iotrack);
1415 Int_t nt = tracks.GetEntriesFast();
1416 cerr<<"Number of found tracks "<<nt<<endl;
1421 Double_t ptg=0.,pxg=0.,pyg=0.,pzg=0.;
1423 ////////////////////////////// good tracks definition in TPC ////////////////////////////////
1425 ofstream out1 ("AliITSTrag.out");
1427 for (i=0; i<ngood; i++) out1 << gt[i].ptg << "\n";
1432 TTree *TR=gAlice->TreeR();
1433 Int_t nent=(Int_t)TR->GetEntries();
1434 TClonesArray *recPoints = RecPoints();
1436 Int_t totalpoints=0;
1437 Int_t *np = new Int_t[nent];
1438 Int_t **vettid = new Int_t* [nent];
1440 for (mod=0; mod<nent; mod++) {
1442 this->ResetRecPoints();
1443 gAlice->TreeR()->GetEvent(mod+1); //first entry in TreeR is empty
1444 numbpoints = recPoints->GetEntries();
1445 totalpoints+=numbpoints;
1446 np[mod] = numbpoints;
1447 //cout<<" mod = "<<mod<<" numbpoints = "<<numbpoints<<"\n"; getchar();
1448 vettid[mod] = new Int_t[numbpoints];
1450 for (ii=0;ii<numbpoints; ii++) *(vettid[mod]+ii)=0;
1456 if(min_t < 0) {min_t = 0; max_t = nt-1;}
1459 ///////////////////////////////// Definition of vertex end its error ////////////////////////////
1460 ////////////////////////// In the future it will be given by a method ///////////////////////////
1465 Float_t sigmavx=0.0050; // 50 microns
1466 Float_t sigmavy=0.0050; // 50 microns
1467 Float_t sigmavz=0.010; // 100 microns
1469 //Vx+=gRandom->Gaus(0,sigmavx); Vy+=gRandom->Gaus(0,sigmavy); Vz+=gRandom->Gaus(0,sigmavz);
1470 TVector vertex(3), ervertex(3)
1471 vertex(0)=Vx; vertex(1)=Vy; vertex(2)=Vz;
1472 ervertex(0)=sigmavx; ervertex(1)=sigmavy; ervertex(2)=sigmavz;
1473 /////////////////////////////////////////////////////////////////////////////////////////////////
1476 //TDirectory *savedir=gDirectory;
1478 TTree tracktree1("TreeT","Tree with ITS tracks");
1479 AliITSiotrack *iotrack=0;
1480 tracktree1.Branch("ITStracks","AliITSiotrack",&iotrack,32000,0);
1482 ofstream out ("AliITSTra.out");
1485 for (j=min_t; j<=max_t; j++) {
1486 track=(AliTPCtrack*)tracks.UncheckedAt(j);
1488 if (!track) continue;
1489 ////// elimination of not good tracks ////////////
1490 Int_t ilab=TMath::Abs(track->GetLabel());
1492 for (iii=0;iii<ngood;iii++) {
1493 //cout<<" ilab, gt[iii].lab = "<<ilab<<" "<<gt[iii].lab<<"\n"; getchar();
1494 if (ilab==gt[iii].lab) {
1503 //cout<<" j flaglab = " <<j<<" "<<flaglab<<"\n"; getchar();
1504 if (!flaglab) continue;
1505 //cout<<" j = " <<j<<"\n"; getchar();
1507 ////// old propagation to the end of TPC //////////////
1509 track->PropagateTo(xk);
1511 track->PropagateTo(xk,42.7,2.27); //C
1513 track->PropagateTo(xk,36.2,1.98e-3); //C02
1515 track->PropagateTo(xk,42.7,2.27); //C
1516 ///////////////////////////////////////////////////
1519 ////// new propagation to the end of TPC //////////////
1521 track->PropagateTo(xk, 28.94, 1.204e-3); //Ne
1523 track->PropagateTo(xk, 44.77, 1.71); //Tedlar
1525 track->PropagateTo(xk, 44.86, 1.45); //Kevlar
1527 track->PropagateTo(xk, 41.28, 0.029); //Nomex
1529 track->PropagateTo(xk,36.2,1.98e-3); //C02
1531 track->PropagateTo(xk, 24.01, 2.7); //Al
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 ///////////////////////////////////////////////////////////////
1541 ///////////////////////////////////////////////////////////////
1542 AliITStrack trackITS(*track);
1543 AliITStrack result(*track);
1544 AliITStrack primarytrack(*track);
1546 ///////////////////////////////////////////////////////////////////////////////////////////////
1548 Vgeant=result.GetVertex();
1550 // Definition of Dv and Zv for vertex constraint
1551 Double_t sigmaDv=0.0050; Double_t sigmaZv=0.010;
1552 //Double_t sigmaDv=0.0015; Double_t sigmaZv=0.0015;
1553 Double_t uniform= gRandom->Uniform();
1555 if(uniform<=0.5) signdv=-1.;
1559 Double_t Vr=TMath::Sqrt(Vgeant(0)*Vgeant(0)+ Vgeant(1)*Vgeant(1));
1560 Double_t Dv=gRandom->Gaus(signdv*Vr,(Float_t)sigmaDv);
1561 Double_t Zv=gRandom->Gaus(Vgeant(2),(Float_t)sigmaZv);
1563 //cout<<" Dv e Zv = "<<Dv<<" "<<Zv<<"\n";
1564 trackITS.SetDv(Dv); trackITS.SetZv(Zv);
1565 trackITS.SetsigmaDv(sigmaDv); trackITS.SetsigmaZv(sigmaZv);
1566 result.SetDv(Dv); result.SetZv(Zv);
1567 result.SetsigmaDv(sigmaDv); result.SetsigmaZv(sigmaZv);
1568 primarytrack.SetDv(Dv); primarytrack.SetZv(Zv);
1569 primarytrack.SetsigmaDv(sigmaDv); primarytrack.SetsigmaZv(sigmaZv);
1571 /////////////////////////////////////////////////////////////////////////////////////////////////
1573 primarytrack.PrimaryTrack();
1574 TVector d2=primarytrack.Getd2();
1575 TVector tgl2=primarytrack.Gettgl2();
1576 TVector dtgl=primarytrack.Getdtgl();
1577 trackITS.Setd2(d2); trackITS.Settgl2(tgl2); trackITS.Setdtgl(dtgl);
1578 result.Setd2(d2); result.Settgl2(tgl2); result.Setdtgl(dtgl);
1580 trackITS.SetVertex(vertex); trackITS.SetErrorVertex(ervertex);
1581 result.SetVertex(vertex); result.SetErrorVertex(ervertex);
1583 Tracking(trackITS,&result,recPoints,vettid, flagvert);
1585 cout<<" progressive track number = "<<j<<"\r";
1587 //cout<<" progressive track number = "<<j<<"\n";
1588 Long_t labITS=result.GetLabel();
1589 //cout << " ITS track label = " << labITS << "\n";
1590 int lab=track->GetLabel();
1591 // cout << " TPC track label = " << lab <<"\n";
1592 //result.GetClusters(); getchar(); //to print the cluster matrix
1594 //propagation to vertex
1598 result.Propagation(rbeam);
1601 cov=&result.GetCMatrix();
1602 Double_t pt=TMath::Abs(result.GetPt());
1603 Double_t Dr=result.GetD();
1604 Double_t Z=result.GetZ();
1605 Double_t tgl=result.GetTgl();
1606 Double_t C=result.GetC();
1608 Double_t Dz=Z-(tgl/Cy)*TMath::ASin(result.arga(rbeam));
1611 // cout<<" Dr e dz alla fine = "<<Dr<<" "<<Dz<<"\n"; getchar();
1612 Double_t phi=result.Getphi();
1613 Double_t phivertex = phi - TMath::ASin(result.argA(rbeam));
1614 Double_t duepi=2.*TMath::Pi();
1615 if(phivertex>duepi) phivertex-=duepi;
1616 if(phivertex<0.) phivertex+=duepi;
1617 Double_t Dtot=TMath::Sqrt(Dr*Dr+Dz*Dz);
1619 //////////////////////////////////////////////////////////////////////////////////////////
1620 Int_t NumofCluster, idmodule,idpoint;
1621 NumofCluster=result.GetNumClust();
1622 if(NumofCluster >=5) {
1625 AliITSiotrack outtrack;
1629 iotrack->SetStatePhi(phi);
1630 iotrack->SetStateZ(Z);
1631 iotrack->SetStateD(Dr);
1632 iotrack->SetStateTgl(tgl);
1633 iotrack->SetStateC(C);
1634 Double_t radius=result.Getrtrack();
1635 iotrack->SetRadius(radius);
1637 if(C>0.) charge=-1; else charge=1;
1638 iotrack->SetCharge(charge);
1642 iotrack->SetCovMatrix(cov);
1644 Double_t px=pt*TMath::Cos(phi);
1645 Double_t py=pt*TMath::Sin(phi);
1648 Double_t xtrack=Dr*TMath::Sin(phi);
1649 Double_t ytrack=Dr*TMath::Cos(phi);
1650 Double_t ztrack=Dz+Vgeant(2);
1656 iotrack->SetX(xtrack);
1657 iotrack->SetY(ytrack);
1658 iotrack->SetZ(ztrack);
1659 iotrack->SetLabel(labITS);
1662 for(il=0;il<6; il++){
1663 iotrack->SetIdPoint(il,result.GetIdPoint(il));
1664 iotrack->SetIdModule(il,result.GetIdModule(il));
1668 //cout<<" labITS = "<<labITS<<"\n";
1669 //cout<<" phi z Dr tgl C = "<<phi<<" "<<Z<<" "<<Dr<<" "<<tgl<<" "<<C<<"\n"; getchar();
1671 DataOut(kkk) = ptg; kkk++; DataOut(kkk)=labITS; kkk++; DataOut(kkk)=lab; kkk++;
1673 for (il=0;il<6;il++) {
1674 idpoint=result.GetIdPoint(il);
1675 idmodule=result.GetIdModule(il);
1676 *(vettid[idmodule]+idpoint)=1;
1677 iotrack->SetIdPoint(il,idpoint);
1678 iotrack->SetIdModule(il,idmodule);
1681 // cout<<" +++++++++++++ pt e ptg = "<<pt<<" "<<ptg<<" ++++++++++\n";
1682 Double_t difpt= (pt-ptg)/ptg*100.;
1683 DataOut(kkk)=difpt; kkk++;
1684 Double_t lambdag=TMath::ATan(pzg/ptg);
1685 Double_t lam=TMath::ATan(tgl);
1686 Double_t diflam = (lam - lambdag)*1000.;
1687 DataOut(kkk) = diflam; kkk++;
1688 Double_t phig=TMath::ATan(pyg/pxg);
1689 Double_t phi=phivertex;
1690 Double_t difphi = (phi - phig)*1000.;
1691 DataOut(kkk)=difphi; kkk++;
1692 DataOut(kkk)=Dtot*1.e4; kkk++;
1693 DataOut(kkk)=Dr*1.e4; kkk++;
1694 DataOut(kkk)=Dz*1.e4; kkk++;
1696 for (r=0; r<9; r++) { out<<DataOut(r)<<" ";}
1701 } // end if on NumofCluster
1702 //gObjectTable->Print(); // stampa memoria
1703 } // end for (int j=min_t; j<=max_t; j++)
1708 static Bool_t first=kTRUE;
1709 static TFile *tfile;
1712 tfile=new TFile("itstracks.root","RECREATE");
1713 //cout<<"I have opened itstracks.root file "<<endl;
1720 sprintf(hname,"TreeT%d",evNumber);
1722 tracktree1.Write(hname);
1726 TTree *fAli=gAlice->TreeK();
1729 if (fAli) fileAli =fAli->GetCurrentFile();
1732 ////////////////////////////////////////////////////////////////////////////////////////////////
1734 printf("delete vectors\n");
1735 if(np) delete [] np;
1736 if(vettid) delete [] vettid;