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.31 2001/02/02 23:57:28 nilsen
19 Added include file that are no londer included in AliITSgeom.h
21 Revision 1.30 2001/01/30 09:23:13 hristov
22 Streamers removed (R.Brun)
24 Revision 1.29 2001/01/26 20:01:09 hristov
25 Major upgrade of AliRoot code
27 Revision 1.28 2000/12/18 14:02:00 barbera
28 new version of the ITS tracking to take into account the new TPC track parametrization
30 Revision 1.27 2000/12/08 13:49:27 barbera
31 Hidden declaration in a for loop removed to be compliant with HP-UX compiler
33 Revision 1.26 2000/11/27 13:12:13 barbera
34 New version containing the files for tracking
36 Revision 1.25 2000/11/12 22:38:05 barbera
37 Added header file for the SPD Bari model
39 Revision 1.24 2000/10/09 22:18:12 barbera
40 Bug fixes from MAriana to le AliITStest.C run correctly
42 Revision 1.23 2000/10/05 20:47:42 nilsen
43 fixed dependencies of include files. Tryed but failed to get a root automaticly
44 generates streamer function to work. Modified SetDefaults.
46 Revision 1.9.2.15 2000/10/04 16:56:40 nilsen
47 Needed to include stdlib.h
50 Revision 1.22 2000/10/04 19:45:52 barbera
51 Corrected by F. Carminati for v3.04
53 Revision 1.21 2000/10/02 21:28:08 fca
54 Removal of useless dependecies via forward declarations
56 Revision 1.20 2000/10/02 16:31:39 barbera
59 Revision 1.9.2.14 2000/10/02 15:43:51 barbera
60 General code clean-up (e.g., printf -> cout)
62 Revision 1.19 2000/09/22 12:13:25 nilsen
63 Patches and updates for fixes to this and other routines.
65 Revision 1.18 2000/07/12 05:32:20 fca
66 Correcting several syntax problem with static members
68 Revision 1.17 2000/07/10 16:07:18 fca
69 Release version of ITS code
71 Revision 1.9.2.3 2000/02/02 13:42:09 barbera
72 fixed AliITS.cxx for new AliRun structure. Added ITS hits list to list of hits which will have their track numbers updated
74 Revision 1.9.2.2 2000/01/23 03:03:13 nilsen
75 //fixed FillModule. Removed fi(fabs(xl)<dx....
77 Revision 1.9.2.1 2000/01/12 19:03:32 nilsen
78 This is the version of the files after the merging done in December 1999.
79 See the ReadMe110100.txt file for details
81 Revision 1.9 1999/11/14 14:33:25 fca
82 Correct problems with distructors and pointers, thanks to I.Hrivnacova
84 Revision 1.8 1999/09/29 09:24:19 fca
85 Introduction of the Copyright and cvs Log
89 ///////////////////////////////////////////////////////////////////////////////
91 // An overview of the basic philosophy of the ITS code development
92 // and analysis is show in the figure below.
95 <img src="picts/ITS/ITS_Analysis_schema.gif">
98 <font size=+2 color=red>
99 <p>Roberto Barbera is in charge of the ITS Offline code (1999).
100 <a href="mailto:roberto.barbera@ct.infn.it">Roberto Barbera</a>.
106 // AliITS. Inner Traking System base class.
107 // This class contains the base procedures for the Inner Tracking System
111 <img src="picts/ITS/AliITS_Class_Diagram.gif">
114 <font size=+2 color=red>
115 <p>This show the class diagram of the different elements that are part of
123 // Written by Rene Brun, Federico Carminati, and Roberto Barbera
126 // Modified and documented by Bjorn S. Nilsen
130 // Modified and documented by A. Bologna
133 // AliITS is the general base class for the ITS. Also see AliDetector for
134 // futher information.
136 ///////////////////////////////////////////////////////////////////////////////
137 #include <iostream.h>
145 #include <TObjArray.h>
147 #include <TObjectTable.h>
156 #include "AliITSMap.h"
157 #include "AliITSDetType.h"
158 #include "AliITSClusterFinder.h"
159 #include "AliITSsimulation.h"
160 #include "AliITSresponse.h"
161 #include "AliITSsegmentationSPD.h"
162 #include "AliITSresponseSPD.h"
163 #include "AliITSresponseSPDbari.h"
164 #include "AliITSsegmentationSDD.h"
165 #include "AliITSresponseSDD.h"
166 #include "AliITSsegmentationSSD.h"
167 #include "AliITSresponseSSD.h"
168 #include "AliITShit.h"
169 #include "AliITSgeom.h"
170 #include "AliITSdigit.h"
171 #include "AliITSmodule.h"
172 #include "AliITSRecPoint.h"
173 #include "AliITSRawCluster.h"
177 #include "AliITStrack.h"
178 #include "AliITSiotrack.h"
179 #include "AliITStracking.h"
180 #include "../TPC/AliTPC.h"
181 #include "../TPC/AliTPCParam.h"
186 //_____________________________________________________________________________
187 AliITS::AliITS() : AliDetector() {
189 // Default initialiser for ITS
190 // The default constructor of the AliITS class. In addition to
191 // creating the AliITS class it zeros the variables fIshunt (a member
192 // of AliDetector class), fEuclidOut, and fIdN, and zeros the pointers
193 // fITSpoints, fIdSens, and fIdName. The AliDetector default constructor
201 fNDetTypes = kNTYPES;
220 //_____________________________________________________________________________
221 AliITS::AliITS(const char *name, const char *title):AliDetector(name,title){
223 // Default initialiser for ITS
224 // The constructor of the AliITS class. In addition to creating the
225 // AliITS class, it allocates memory for the TClonesArrays fHits and
226 // fDigits, and for the TObjArray fITSpoints. It also zeros the variables
227 // fIshunt (a member of AliDetector class), fEuclidOut, and fIdN, and zeros
228 // the pointers fIdSens and fIdName. To help in displaying hits via the ROOT
229 // macro display.C AliITS also sets the marker color to red. The variables
230 // passes with this constructor, const char *name and *title, are used by
231 // the constructor of AliDetector class. See AliDetector class for a
232 // description of these parameters and its constructor functions.
236 fHits = new TClonesArray("AliITShit", 1560);
237 gAlice->AddHitList(fHits);
239 fNDetTypes = kNTYPES;
241 fNdtype = new Int_t[kNTYPES];
242 fDtype = new TObjArray(kNTYPES);
244 fNctype = new Int_t[kNTYPES];
245 fCtype = new TObjArray(kNTYPES);
261 fDetTypes = new TObjArray(kNTYPES);
264 for(i=0;i<kNTYPES;i++) {
265 (*fDetTypes)[i]=new AliITSDetType();
271 SetMarkerColor(kRed);
275 //___________________________________________________________________________
276 AliITS::AliITS(AliITS &source){
278 if(this==&source) return;
279 Error("AliITS::Copy constructor",
280 "You are not allowed to make a copy of the AliITS");
283 //____________________________________________________________________________
284 AliITS& AliITS::operator=(AliITS &source){
285 // assignment operator
286 if(this==&source) return *this;
287 Error("AliITS::operator=",
288 "You are not allowed to make a copy of the AliITS");
290 return *this; //fake return
292 //____________________________________________________________________________
293 void AliITS::ClearModules(){
294 //clear the modules TObjArray
296 if(fITSmodules) fITSmodules->Delete();
299 //_____________________________________________________________________________
302 // Default distructor for ITS
303 // The default destructor of the AliITS class. In addition to deleting
304 // the AliITS class it deletes the memory pointed to by the fHits, fDigits,
305 // fIdSens, fIdName, and fITSpoints.
312 // delete fIdName; // TObjArray of TObjStrings
313 if(fIdName!=0) delete[] fIdName; // Array of TStrings
314 if(fIdSens!=0) delete[] fIdSens;
316 this->ClearModules();
318 }// end if fITSmodules!=0
338 if (fTreeC) delete fTreeC;
340 if (fITSgeom) delete fITSgeom;
344 //___________________________________________
345 AliITSDetType* AliITS::DetType(Int_t id)
347 //return pointer to id detector type
348 return ((AliITSDetType*) (*fDetTypes)[id]);
351 //___________________________________________
352 void AliITS::SetClasses(Int_t id, const char *digit, const char *cluster)
354 //set the digit and cluster classes to be used for the id detector type
355 ((AliITSDetType*) (*fDetTypes)[id])->ClassNames(digit,cluster);
358 //___________________________________________
359 void AliITS::SetResponseModel(Int_t id, AliITSresponse *response)
361 //set the response model for the id detector type
363 ((AliITSDetType*) (*fDetTypes)[id])->ResponseModel(response);
367 //___________________________________________
368 void AliITS::SetSegmentationModel(Int_t id, AliITSsegmentation *seg)
370 //set the segmentation model for the id detector type
372 ((AliITSDetType*) (*fDetTypes)[id])->SegmentationModel(seg);
376 //___________________________________________
377 void AliITS::SetSimulationModel(Int_t id, AliITSsimulation *sim)
379 //set the simulation model for the id detector type
381 ((AliITSDetType*) (*fDetTypes)[id])->SimulationModel(sim);
384 //___________________________________________
385 void AliITS::SetReconstructionModel(Int_t id, AliITSClusterFinder *reconst)
387 //set the cluster finder model for the id detector type
389 ((AliITSDetType*) (*fDetTypes)[id])->ReconstructionModel(reconst);
393 //_____________________________________________________________________________
394 void AliITS::AddHit(Int_t track, Int_t *vol, Float_t *hits){
397 // The function to add information to the AliITShit class. See the
398 // AliITShit class for a full description. This function allocates the
399 // necessary new space for the hit information and passes the variable
400 // track, and the pointers *vol and *hits to the AliITShit constructor
403 TClonesArray &lhits = *fHits;
404 new(lhits[fNhits++]) AliITShit(fIshunt,track,vol,hits);
406 //_____________________________________________________________________________
407 void AliITS::AddRealDigit(Int_t id, Int_t *digits)
409 // add a real digit - as coming from data
411 TClonesArray &ldigits = *((TClonesArray*)(*fDtype)[id]);
412 new(ldigits[fNdtype[id]++]) AliITSdigit(digits);
415 //_____________________________________________________________________________
416 void AliITS::AddSimDigit(Int_t id, AliITSdigit *d)
419 // add a simulated digit
421 TClonesArray &ldigits = *((TClonesArray*)(*fDtype)[id]);
426 new(ldigits[fNdtype[id]++]) AliITSdigitSPD(*((AliITSdigitSPD*)d));
429 new(ldigits[fNdtype[id]++]) AliITSdigitSDD(*((AliITSdigitSDD*)d));
432 new(ldigits[fNdtype[id]++]) AliITSdigitSSD(*((AliITSdigitSSD*)d));
438 //_____________________________________________________________________________
439 void AliITS::AddSimDigit(Int_t id,Float_t phys,Int_t *digits,Int_t *tracks,Int_t *hits,Float_t *charges){
441 // add a simulated digit to the list
443 TClonesArray &ldigits = *((TClonesArray*)(*fDtype)[id]);
447 new(ldigits[fNdtype[id]++]) AliITSdigitSPD(digits,tracks,hits);
450 new(ldigits[fNdtype[id]++]) AliITSdigitSDD(phys,digits,tracks,hits,charges);
453 new(ldigits[fNdtype[id]++]) AliITSdigitSSD(digits,tracks,hits);
459 //_____________________________________________________________________________
460 void AliITS::AddCluster(Int_t id, AliITSRawCluster *c)
463 // add a cluster to the list
465 TClonesArray &lcl = *((TClonesArray*)(*fCtype)[id]);
470 new(lcl[fNctype[id]++]) AliITSRawClusterSPD(*((AliITSRawClusterSPD*)c));
473 new(lcl[fNctype[id]++]) AliITSRawClusterSDD(*((AliITSRawClusterSDD*)c));
476 new(lcl[fNctype[id]++]) AliITSRawClusterSSD(*((AliITSRawClusterSSD*)c));
483 //_____________________________________________________________________________
484 void AliITS::AddRecPoint(const AliITSRecPoint &r)
487 // Add a reconstructed space point to the list
489 TClonesArray &lrecp = *fRecPoints;
490 new(lrecp[fNRecPoints++]) AliITSRecPoint(r);
494 //____________________________________________
495 void AliITS::ResetDigits()
498 // Reset number of digits and the digits array for the ITS detector
504 for (i=0;i<kNTYPES;i++ ) {
505 if ((*fDtype)[i]) ((TClonesArray*)(*fDtype)[i])->Clear();
506 if (fNdtype) fNdtype[i]=0;
510 //____________________________________________
511 void AliITS::ResetDigits(Int_t i)
514 // Reset number of digits and the digits array for this branch
516 if ((*fDtype)[i]) ((TClonesArray*)(*fDtype)[i])->Clear();
517 if (fNdtype) fNdtype[i]=0;
521 //____________________________________________
522 void AliITS::ResetClusters()
525 // Reset number of clusters and the clusters array for ITS
529 for (i=0;i<kNTYPES;i++ ) {
530 if ((*fCtype)[i]) ((TClonesArray*)(*fCtype)[i])->Clear();
531 if (fNctype) fNctype[i]=0;
536 //____________________________________________
537 void AliITS::ResetClusters(Int_t i)
540 // Reset number of clusters and the clusters array for this branch
542 if ((*fCtype)[i]) ((TClonesArray*)(*fCtype)[i])->Clear();
543 if (fNctype) fNctype[i]=0;
548 //____________________________________________
549 void AliITS::ResetRecPoints()
552 // Reset number of rec points and the rec points array
554 if (fRecPoints) fRecPoints->Clear();
559 //_____________________________________________________________________________
560 Int_t AliITS::DistancetoPrimitive(Int_t , Int_t ){
562 // Distance from mouse to ITS on the screen. Dummy routine
563 // A dummy routine used by the ROOT macro display.C to allow for the
564 // use of the mouse (pointing device) in the macro. In general this should
565 // never be called. If it is it returns the number 9999 for any value of
571 //_____________________________________________________________________________
574 // Initialise ITS after it has been built
575 // This routine initializes the AliITS class. It is intended to be called
576 // from the Init function in AliITSv?. Besides displaying a banner
577 // indicating that it has been called it initializes the array fIdSens
578 // and sets the default segmentation, response, digit and raw cluster classes
579 // Therefore it should be called after a call to CreateGeometry.
586 for(i=0;i<fIdN;i++) fIdSens[i] = gMC->VolId(fIdName[i]);
590 //_____________________________________________________________________________
591 void AliITS::SetDefaults()
593 // sets the default segmentation, response, digit and raw cluster classes
595 printf("SetDefaults\n");
597 AliITSDetType *iDetType;
603 if (!iDetType->GetSegmentationModel()) {
604 AliITSsegmentationSPD *seg0=new AliITSsegmentationSPD(fITSgeom);
605 SetSegmentationModel(0,seg0);
607 if (!iDetType->GetResponseModel()) {
608 SetResponseModel(0,new AliITSresponseSPD());
610 // set digit and raw cluster classes to be used
612 const char *kData0=(iDetType->GetResponseModel())->DataType();
613 if (strstr(kData0,"real")) {
614 iDetType->ClassNames("AliITSdigit","AliITSRawClusterSPD");
615 } else iDetType->ClassNames("AliITSdigitSPD","AliITSRawClusterSPD");
619 if (!iDetType->GetResponseModel()) {
620 SetResponseModel(1,new AliITSresponseSDD());
622 AliITSresponse *resp1=iDetType->GetResponseModel();
623 if (!iDetType->GetSegmentationModel()) {
624 AliITSsegmentationSDD *seg1=new AliITSsegmentationSDD(fITSgeom,resp1);
625 SetSegmentationModel(1,seg1);
627 const char *kData1=(iDetType->GetResponseModel())->DataType();
628 const char *kopt=iDetType->GetResponseModel()->ZeroSuppOption();
629 if ((!strstr(kopt,"2D")) && (!strstr(kopt,"1D")) || strstr(kData1,"real") ) {
630 iDetType->ClassNames("AliITSdigit","AliITSRawClusterSDD");
631 } else iDetType->ClassNames("AliITSdigitSDD","AliITSRawClusterSDD");
635 if (!iDetType->GetSegmentationModel()) {
636 AliITSsegmentationSSD *seg2=new AliITSsegmentationSSD(fITSgeom);
637 SetSegmentationModel(2,seg2);
639 if (!iDetType->GetResponseModel()) {
640 SetResponseModel(2,new AliITSresponseSSD());
642 const char *kData2=(iDetType->GetResponseModel())->DataType();
643 if (strstr(kData2,"real")) {
644 iDetType->ClassNames("AliITSdigit","AliITSRawClusterSSD");
645 } else iDetType->ClassNames("AliITSdigitSSD","AliITSRawClusterSSD");
648 Warning("SetDefaults","Only the three basic detector types are initialised!");
655 //_____________________________________________________________________________
656 void AliITS::SetDefaultSimulation()
661 //_____________________________________________________________________________
662 void AliITS::SetDefaultClusterFinders()
667 //_____________________________________________________________________________
669 void AliITS::MakeTreeC(Option_t *option)
671 // create a separate tree to store the clusters
673 cout << "AliITS::MakeTreeC" << endl;
675 char *optC = strstr(option,"C");
676 if (optC && !fTreeC) fTreeC = new TTree("TC","Clusters in ITS");
679 Int_t buffersize = 4000;
682 const char *det[3] = {"SPD","SDD","SSD"};
684 // one branch for Clusters per type of detector
686 for (i=0; i<kNTYPES ;i++) {
687 if (kNTYPES==3) sprintf(branchname,"%sClusters%s",GetName(),det[i]);
688 else sprintf(branchname,"%sClusters%d",GetName(),i+1);
689 if (fCtype && fTreeC) {
690 TreeC()->Branch(branchname,&((*fCtype)[i]), buffersize);
691 cout << "Making Branch " << branchname;
692 cout << " for Clusters of detector type " << i+1 << endl;
698 //_____________________________________________________________________________
699 void AliITS::GetTreeC(Int_t event)
702 cout << "AliITS::GetTreeC" << endl;
704 // get the clusters tree for this event and set the branch address
708 const char *det[3] = {"SPD","SDD","SSD"};
715 sprintf(treeName,"TreeC%d",event);
716 fTreeC = (TTree*)gDirectory->Get(treeName);
722 for (i=0; i<kNTYPES; i++) {
723 if (kNTYPES==3) sprintf(branchname,"%sClusters%s",GetName(),det[i]);
724 else sprintf(branchname,"%sClusters%d",GetName(),i+1);
726 branch = fTreeC->GetBranch(branchname);
727 if (branch) branch->SetAddress(&((*fCtype)[i]));
731 Error("AliITS::GetTreeC",
732 "cannot find Clusters Tree for event:%d\n",event);
736 //_____________________________________________________________________________
737 void AliITS::MakeBranch(Option_t* option, char *file)
740 // Creates Tree branches for the ITS.
743 Int_t buffersize = 4000;
745 sprintf(branchname,"%s",GetName());
747 AliDetector::MakeBranch(option,file);
749 char *cD = strstr(option,"D");
750 char *cR = strstr(option,"R");
754 // one branch for digits per type of detector
756 const char *det[3] = {"SPD","SDD","SSD"};
762 for (i=0; i<kNTYPES ;i++) {
763 AliITSDetType *iDetType=DetType(i);
764 iDetType->GetClassNames(digclass,clclass);
765 //printf("i, digclass, recclass %d %s %s\n",i,digclass,clclass);
767 (*fDtype)[i] = new TClonesArray(digclass,10000);
769 (*fCtype)[i] = new TClonesArray(clclass,10000);
772 for (i=0; i<kNTYPES ;i++) {
773 if (kNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]);
774 else sprintf(branchname,"%sDigits%d",GetName(),i+1);
775 if (fDtype && gAlice->TreeD()) {
776 gAlice->MakeBranchInTree(gAlice->TreeD(),
777 branchname, &((*fDtype)[i]), buffersize, file) ;
778 cout << "Making Branch " << branchname;
779 cout << " for digits of type "<< i+1 << endl;
786 // only one branch for rec points for all detector types
788 sprintf(branchname,"%sRecPoints",GetName());
790 fRecPoints=new TClonesArray("AliITSRecPoint",10000);
792 if (fRecPoints && gAlice->TreeR()) {
793 gAlice->MakeBranchInTree(gAlice->TreeR(),
794 branchname, &fRecPoints, buffersize, file) ;
795 cout << "Making Branch " << branchname;
796 cout << " for reconstructed space points" << endl;
801 //___________________________________________
802 void AliITS::SetTreeAddress()
805 // Set branch address for the Trees.
808 AliDetector::SetTreeAddress();
810 const char *det[3] = {"SPD","SDD","SSD"};
813 TTree *treeD = gAlice->TreeD();
814 TTree *treeR = gAlice->TreeR();
818 for (i=0; i<kNTYPES; i++) {
819 if (kNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]);
820 else sprintf(branchname,"%sDigits%d",GetName(),i+1);
822 branch = treeD->GetBranch(branchname);
823 if (branch) branch->SetAddress(&((*fDtype)[i]));
830 sprintf(branchname,"%sRecPoints",GetName());
832 branch = treeR->GetBranch(branchname);
833 if (branch) branch->SetAddress(&fRecPoints);
840 //____________________________________________________________________________
841 void AliITS::InitModules(Int_t size,Int_t &nmodules){
843 //initialize the modules array
846 fITSmodules->Delete();
850 Int_t nl,indexMAX,index;
852 if(size<=0){ // default to using data stored in AliITSgeom
854 Error("AliITS::InitModules",
855 "in AliITS::InitModule fITSgeom not defined\n");
857 } // end if fITSgeom==0
858 nl = fITSgeom->GetNlayers();
859 indexMAX = fITSgeom->GetModuleIndex(nl,fITSgeom->GetNladders(nl),
860 fITSgeom->GetNdetectors(nl))+1;
862 fITSmodules = new TObjArray(indexMAX);
863 for(index=0;index<indexMAX;index++){
864 fITSmodules->AddAt( new AliITSmodule(index),index);
867 fITSmodules = new TObjArray(size);
868 for(index=0;index<size;index++) {
869 fITSmodules->AddAt( new AliITSmodule(index),index);
876 //____________________________________________________________________________
877 void AliITS::FillModules(Int_t evnt,Int_t bgrev,Int_t nmodules,Option_t *option,Text_t *filename){
879 // fill the modules with the sorted by module hits; add hits from background
883 static TTree *trH1; //Tree with background hits
884 static TClonesArray *fHits2; //List of hits for one track only
886 static Bool_t first=kTRUE;
888 char *addBgr = strstr(option,"Add");
893 cout<<"filename "<<filename<<endl;
894 file=new TFile(filename);
895 cout<<"I have opened "<<filename<<" file "<<endl;
896 fHits2 = new TClonesArray("AliITShit",1000 );
901 // Get Hits Tree header from file
902 if(fHits2) fHits2->Clear();
903 if(trH1) delete trH1;
907 sprintf(treeName,"TreeH%d",bgrev);
908 trH1 = (TTree*)gDirectory->Get(treeName);
909 //printf("TrH1 %p of treename %s for event %d \n",trH1,treeName,bgrev);
912 Error("AliITS::FillModules",
913 "cannot find Hits Tree for event:%d\n",bgrev);
915 // Set branch addresses
918 sprintf(branchname,"%s",GetName());
919 if (trH1 && fHits2) {
920 branch = trH1->GetBranch(branchname);
921 if (branch) branch->SetAddress(&fHits2);
925 //Int_t ntracks1 =(Int_t)TrH1->GetEntries();
926 //printf("background - ntracks1 - %d\n",ntracks1);
929 //Int_t npart = gAlice->GetEvent(evnt);
930 //if(npart<=0) return;
931 TClonesArray *itsHits = this->Hits();
932 Int_t lay,lad,det,index;
936 TTree *iTH = gAlice->TreeH();
937 Int_t ntracks =(Int_t) iTH->GetEntries();
940 for(t=0; t<ntracks; t++){
943 Int_t nhits = itsHits->GetEntriesFast();
944 //printf("nhits %d\n",nhits);
945 if (!nhits) continue;
946 for(h=0; h<nhits; h++){
947 itsHit = (AliITShit *)itsHits->UncheckedAt(h);
948 itsHit->GetDetectorID(lay,lad,det);
949 // temporarily index=det-1 !!!
950 if(fITSgeom) index = fITSgeom->GetModuleIndex(lay,lad,det);
953 mod = this->GetModule(index);
954 mod->AddHit(itsHit,t,h);
955 } // end loop over hits
956 } // end loop over tracks
958 // open the file with background
962 ntracks =(Int_t)trH1->GetEntries();
963 //printf("background - ntracks1 %d\n",ntracks);
964 //printf("background - Start loop over tracks \n");
967 for (track=0; track<ntracks; track++) {
969 if (fHits2) fHits2->Clear();
970 trH1->GetEvent(track);
972 for(i=0;i<fHits2->GetEntriesFast();++i) {
974 itsHit=(AliITShit*) (*fHits2)[i];
975 itsHit->GetDetectorID(lay,lad,det);
976 // temporarily index=det-1 !!!
977 if(fITSgeom) index = fITSgeom->GetModuleIndex(lay,lad,det);
980 mod = this->GetModule(index);
981 mod->AddHit(itsHit,track,i);
982 } // end loop over hits
983 } // end loop over tracks
985 TTree *fAli=gAlice->TreeK();
988 if (fAli) fileAli =fAli->GetCurrentFile();
993 //gObjectTable->Print();
997 //____________________________________________________________________________
999 void AliITS::SDigits2Digits()
1002 AliITSgeom *geom = GetITSgeom();
1005 AliITSDetType *iDetType;
1006 iDetType=DetType(0);
1007 AliITSsegmentationSPD *seg0=(AliITSsegmentationSPD*)iDetType->GetSegmentationModel();
1008 AliITSresponseSPD *res0 = (AliITSresponseSPD*)iDetType->GetResponseModel();
1009 AliITSsimulationSPD *sim0=new AliITSsimulationSPD(seg0,res0);
1010 SetSimulationModel(0,sim0);
1012 // printf("SPD dimensions %f %f \n",seg0->Dx(),seg0->Dz());
1013 // printf("SPD npixels %d %d \n",seg0->Npz(),seg0->Npx());
1014 // printf("SPD pitches %d %d \n",seg0->Dpz(0),seg0->Dpx(0));
1018 //Set response functions
1019 Float_t baseline = 10.;
1020 Float_t noise = 1.75;
1022 // SDD compression param: 2 fDecrease, 2fTmin, 2fTmax or disable, 2 fTolerance
1024 iDetType=DetType(1);
1025 AliITSresponseSDD *res1 = (AliITSresponseSDD*)iDetType->GetResponseModel();
1027 res1=new AliITSresponseSDD();
1028 SetResponseModel(1,res1);
1030 res1->SetMagicValue(900.);
1031 Float_t maxadc = res1->MaxAdc();
1032 Float_t topValue = res1->MagicValue();
1033 Float_t norm = maxadc/topValue;
1035 Float_t fCutAmp = baseline + 2.*noise;
1037 Int_t cp[8]={0,0,(int)fCutAmp,(int)fCutAmp,0,0,0,0}; //1D
1039 //res1->SetZeroSupp("2D");
1040 res1->SetZeroSupp("1D");
1041 res1->SetNoiseParam(noise,baseline);
1042 res1->SetDo10to8(kTRUE);
1043 res1->SetCompressParam(cp);
1045 res1->SetDiffCoeff(3.6,40.);
1046 //res1->SetMagicValue(96.95);
1047 AliITSsegmentationSDD *seg1=(AliITSsegmentationSDD*)iDetType->GetSegmentationModel();
1049 seg1 = new AliITSsegmentationSDD(geom,res1);
1050 SetSegmentationModel(1,seg1);
1052 AliITSsimulationSDD *sim1=new AliITSsimulationSDD(seg1,res1);
1054 sim1->SetCheckNoise(kFALSE);
1055 SetSimulationModel(1,sim1);
1058 iDetType=DetType(2);
1059 AliITSsegmentationSSD *seg2=(AliITSsegmentationSSD*)iDetType->GetSegmentationModel();
1060 AliITSresponseSSD *res2 = (AliITSresponseSSD*)iDetType->GetResponseModel();
1061 res2->SetSigmaSpread(3.,2.);
1062 AliITSsimulationSSD *sim2=new AliITSsimulationSSD(seg2,res2);
1063 SetSimulationModel(2,sim2);
1065 cerr<<"Digitizing ITS...\n";
1069 HitsToDigits(0,0,-1," ","All"," ");
1070 timer.Stop(); timer.Print();
1078 //____________________________________________________________________________
1079 void AliITS::HitsToDigits(Int_t evNumber,Int_t bgrev,Int_t size, Option_t *option, Option_t *opt,Text_t *filename)
1081 // keep galice.root for signal and name differently the file for
1082 // background when add! otherwise the track info for signal will be lost !
1084 // the condition below will disappear when the geom class will be
1085 // initialised for all versions - for the moment it is only for v5 !
1086 // 7 is the SDD beam test version
1087 Int_t ver = this->IsVersion();
1088 if(ver!=5 && ver!=7) return;
1090 char *all = strstr(opt,"All");
1091 char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),strstr(opt,"SSD")};
1094 InitModules(size,nmodules);
1095 FillModules(evNumber,bgrev,nmodules,option,filename);
1098 AliITSsimulation* sim;
1099 //TObjArray *branches=gAlice->TreeD()->GetListOfBranches();
1100 AliITSgeom *geom = GetITSgeom();
1104 for (id=0;id<kNTYPES;id++) {
1105 if (!all && !det[id]) continue;
1106 //branch = (TBranch*)branches->UncheckedAt(id);
1107 AliITSDetType *iDetType=DetType(id);
1108 sim = (AliITSsimulation*)iDetType->GetSimulationModel();
1110 Error("HitsToDigits","The simulation class was not instantiated!");
1112 // or SetDefaultSimulation();
1115 first = geom->GetStartDet(id);
1116 last = geom->GetLastDet(id);
1117 } else first=last=0;
1118 cout << "det type " << id << " first, last "<< first << last << endl;
1119 for(module=first;module<=last;module++) {
1120 AliITSmodule *mod = (AliITSmodule *)fITSmodules->At(module);
1121 sim->DigitiseModule(mod,module,evNumber);
1122 // fills all branches - wasted disk space
1123 gAlice->TreeD()->Fill();
1125 // try and fill only the branch
1128 } // loop over modules
1129 } // loop over detector types
1133 Int_t nentries=(Int_t)gAlice->TreeD()->GetEntries();
1134 cout << "nentries in TreeD" << nentries << endl;
1137 sprintf(hname,"TreeD%d",evNumber);
1138 gAlice->TreeD()->Write(hname,TObject::kOverwrite);
1140 gAlice->TreeD()->Reset();
1145 //____________________________________________________________________________
1146 void AliITS::DigitsToRecPoints(Int_t evNumber,Int_t lastentry,Option_t *opt)
1148 // cluster finding and reconstruction of space points
1150 // the condition below will disappear when the geom class will be
1151 // initialised for all versions - for the moment it is only for v5 !
1152 // 7 is the SDD beam test version
1153 Int_t ver = this->IsVersion();
1154 if(ver!=5 && ver!=7) return;
1156 char *all = strstr(opt,"All");
1157 char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),strstr(opt,"SSD")};
1159 static Bool_t first=kTRUE;
1168 AliITSClusterFinder* rec;
1170 //TObjArray *branches=gAlice->TreeR()->GetListOfBranches();
1171 AliITSgeom *geom = GetITSgeom();
1174 for (id=0;id<kNTYPES;id++) {
1175 if (!all && !det[id]) continue;
1176 //branch = (TBranch*)branches->UncheckedAt(id);
1177 AliITSDetType *iDetType=DetType(id);
1178 rec = (AliITSClusterFinder*)iDetType->GetReconstructionModel();
1180 Error("DigitsToRecPoints","The cluster finder class was not instantiated!");
1182 // or SetDefaultClusterFinders();
1184 TClonesArray *itsDigits = this->DigitsAddress(id);
1188 first = geom->GetStartDet(id);
1189 last = geom->GetLastDet(id);
1190 } else first=last=0;
1191 //printf("first last %d %d\n",first,last);
1192 for(module=first;module<=last;module++) {
1193 this->ResetDigits();
1194 if (all) gAlice->TreeD()->GetEvent(lastentry+module);
1195 else gAlice->TreeD()->GetEvent(lastentry+(module-first));
1196 Int_t ndigits = itsDigits->GetEntriesFast();
1197 if (ndigits) rec->FindRawClusters();
1198 gAlice->TreeR()->Fill();
1202 // try and fill only the branch
1204 //ResetRecPoints(id);
1205 } // loop over modules
1206 } // loop over detector types
1209 Int_t nentries=(Int_t)gAlice->TreeR()->GetEntries();
1210 Int_t ncentries=(Int_t)iTC->GetEntries();
1211 cout << " nentries ncentries " << nentries << ncentries << endl;
1214 sprintf(hname,"TreeR%d",evNumber);
1215 gAlice->TreeR()->Write(hname,TObject::kOverwrite);
1217 gAlice->TreeR()->Reset();
1219 sprintf(hname,"TreeC%d",evNumber);
1225 //____________________________________________________________________________
1226 void AliITS::HitsToFastRecPoints(Int_t evNumber,Int_t bgrev,Int_t size,
1227 Option_t *option,Option_t *opt,Text_t *filename)
1229 // keep galice.root for signal and name differently the file for
1230 // background when add! otherwise the track info for signal will be lost !
1233 // the condition below will disappear when the geom class will be
1234 // initialised for all versions - for the moment it is only for v5 !
1235 Int_t ver = this->IsVersion();
1238 char *all = strstr(opt,"All");
1239 char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),strstr(opt,"SSD")};
1242 InitModules(size,nmodules);
1243 FillModules(evNumber,bgrev,nmodules,option,filename);
1246 AliITSsimulation* sim;
1247 AliITSgeom *geom = GetITSgeom();
1249 TRandom *random=new TRandom[9];
1250 random[0].SetSeed(111);
1251 random[1].SetSeed(222);
1252 random[2].SetSeed(333);
1253 random[3].SetSeed(444);
1254 random[4].SetSeed(555);
1255 random[5].SetSeed(666);
1256 random[6].SetSeed(777);
1257 random[7].SetSeed(888);
1258 random[8].SetSeed(999);
1262 for (id=0;id<kNTYPES;id++) {
1263 if (!all && !det[id]) continue;
1264 AliITSDetType *iDetType=DetType(id);
1265 sim = (AliITSsimulation*)iDetType->GetSimulationModel();
1267 Error("HitsToFastPoints","The simulation class was not instantiated!");
1269 // or SetDefaultSimulation();
1271 Int_t first = geom->GetStartDet(id);
1272 Int_t last = geom->GetLastDet(id);
1273 for(module=first;module<=last;module++) {
1274 AliITSmodule *mod = (AliITSmodule *)fITSmodules->At(module);
1275 sim->CreateFastRecPoints(mod,module,random);
1276 gAlice->TreeR()->Fill();
1278 } // loop over modules
1279 } // loop over detector types
1284 //Int_t nentries=(Int_t)gAlice->TreeR()->GetEntries();
1287 sprintf(hname,"TreeR%d",evNumber);
1288 gAlice->TreeR()->Write(hname,TObject::kOverwrite);
1290 gAlice->TreeR()->Reset();
1296 //________________________________________________________________
1298 AliITStrack AliITS::Tracking(AliITStrack &track, AliITStrack *reference,TObjArray *fastpoints, Int_t
1299 **vettid, Bool_t flagvert ) {
1301 //Origin A. Badala' and G.S. Pappalardo: e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it
1304 TList *list= new TList();
1306 AliITStrack tr(track);
1310 Double_t Pt=(tr).GetPt();
1311 //cout << "\n Pt = " << Pt <<"\n";
1313 AliITStracking obj(list, reference, this, fastpoints,TMath::Abs(Pt),vettid, flagvert);
1318 TVector VecTotLabref(18);
1320 for(lay=5; lay>=0; lay--) {
1321 TVector VecLabref(3);
1322 VecLabref=(*reference).GetLabTrack(lay);
1323 for(k=0; k<3; k++) {itot++; VecTotLabref(itot)=VecLabref(k);}
1327 (*reference).Search(VecTotLabref, labref, freq);
1329 if(freq < 5) labref=-labref;
1330 (*reference).SetLabel(labref);
1338 //________________________________________________________________
1342 void AliITS::DoTracking(Int_t evNumber, Int_t min_t, Int_t max_t, TFile *file, Bool_t flagvert) {
1344 // ex macro for tracking ITS
1346 printf("begin DoTracking - file %p\n",file);
1348 const char *pname="75x40_100x60";
1352 Float_t px,py,pz,x,y,z,pxg,pyg,pzg,ptg;
1357 gAlice->GetEvent(0);
1359 AliTPC *TPC=(AliTPC*)gAlice->GetDetector("TPC");
1360 AliTPCParam *digp = (AliTPCParam*)file->Get(pname);
1361 if (digp!=0) TPC->SetParam(digp);
1365 ifstream in("good_tracks");
1367 cerr<<"Reading good tracks...\n";
1368 while (in>>gt[ngood].lab>>gt[ngood].code
1369 >>gt[ngood].px >>gt[ngood].py>>gt[ngood].pz
1370 >>gt[ngood].x >>gt[ngood].y >>gt[ngood].z
1371 >>gt[ngood].pxg >>gt[ngood].pyg >>gt[ngood].pzg
1372 >>gt[ngood].ptg >>gt[ngood].flag) {
1376 cerr<<"Too many good tracks !\n";
1380 if (!in.eof()) cerr<<"Read error (good_tracks) !\n";
1384 TFile *tf=TFile::Open("tpctracks.root");
1385 if (!tf->IsOpen()) {cerr<<"Can't open tpctracks.root !\n"; return ;}
1386 TObjArray tracks(200000);
1387 TTree *tracktree=(TTree*)tf->Get("TreeT");
1388 TBranch *tbranch=tracktree->GetBranch("tracks");
1389 Int_t nentr=(Int_t)tracktree->GetEntries();
1391 for (kk=0; kk<nentr; kk++) {
1392 AliTPCtrack *iotrack=new AliTPCtrack;
1393 tbranch->SetAddress(&iotrack);
1394 tracktree->GetEvent(kk);
1395 tracks.AddLast(iotrack);
1400 Int_t nt = tracks.GetEntriesFast();
1401 cerr<<"Number of found tracks "<<nt<<endl;
1406 Double_t ptg=0.,pxg=0.,pyg=0.,pzg=0.;
1408 ////////////////////////////// good tracks definition in TPC ////////////////////////////////
1410 ofstream out1 ("AliITSTrag.out");
1412 for (i=0; i<ngood; i++) out1 << gt[i].ptg << "\n";
1417 TTree *TR=gAlice->TreeR();
1418 Int_t nent=(Int_t)TR->GetEntries();
1419 TClonesArray *recPoints = RecPoints();
1421 Int_t totalpoints=0;
1422 Int_t *np = new Int_t[nent];
1423 Int_t **vettid = new Int_t* [nent];
1425 for (mod=0; mod<nent; mod++) {
1427 this->ResetRecPoints();
1428 gAlice->TreeR()->GetEvent(mod+1); //first entry in TreeR is empty
1429 numbpoints = recPoints->GetEntries();
1430 totalpoints+=numbpoints;
1431 np[mod] = numbpoints;
1432 //cout<<" mod = "<<mod<<" numbpoints = "<<numbpoints<<"\n"; getchar();
1433 vettid[mod] = new Int_t[numbpoints];
1435 for (ii=0;ii<numbpoints; ii++) *(vettid[mod]+ii)=0;
1441 if(min_t < 0) {min_t = 0; max_t = nt-1;}
1444 ///////////////////////////////// Definition of vertex end its error ////////////////////////////
1445 ////////////////////////// In the future it will be given by a method ///////////////////////////
1450 Float_t sigmavx=0.0050; // 50 microns
1451 Float_t sigmavy=0.0050; // 50 microns
1452 Float_t sigmavz=0.010; // 100 microns
1454 //Vx+=gRandom->Gaus(0,sigmavx); Vy+=gRandom->Gaus(0,sigmavy); Vz+=gRandom->Gaus(0,sigmavz);
1455 TVector vertex(3), ervertex(3)
1456 vertex(0)=Vx; vertex(1)=Vy; vertex(2)=Vz;
1457 ervertex(0)=sigmavx; ervertex(1)=sigmavy; ervertex(2)=sigmavz;
1458 /////////////////////////////////////////////////////////////////////////////////////////////////
1461 //TDirectory *savedir=gDirectory;
1463 TTree tracktree1("TreeT","Tree with ITS tracks");
1464 AliITSiotrack *iotrack=0;
1465 tracktree1.Branch("ITStracks","AliITSiotrack",&iotrack,32000,0);
1467 ofstream out ("AliITSTra.out");
1470 for (j=min_t; j<=max_t; j++) {
1471 track=(AliTPCtrack*)tracks.UncheckedAt(j);
1473 if (!track) continue;
1474 ////// elimination of not good tracks ////////////
1475 Int_t ilab=TMath::Abs(track->GetLabel());
1477 for (iii=0;iii<ngood;iii++) {
1478 //cout<<" ilab, gt[iii].lab = "<<ilab<<" "<<gt[iii].lab<<"\n"; getchar();
1479 if (ilab==gt[iii].lab) {
1488 //cout<<" j flaglab = " <<j<<" "<<flaglab<<"\n"; getchar();
1489 if (!flaglab) continue;
1490 //cout<<" j = " <<j<<"\n"; getchar();
1492 ////// old propagation to the end of TPC //////////////
1494 track->PropagateTo(xk);
1496 track->PropagateTo(xk,42.7,2.27); //C
1498 track->PropagateTo(xk,36.2,1.98e-3); //C02
1500 track->PropagateTo(xk,42.7,2.27); //C
1501 ///////////////////////////////////////////////////
1504 ////// new propagation to the end of TPC //////////////
1506 track->PropagateTo(xk, 28.94, 1.204e-3); //Ne
1508 track->PropagateTo(xk, 44.77, 1.71); //Tedlar
1510 track->PropagateTo(xk, 44.86, 1.45); //Kevlar
1512 track->PropagateTo(xk, 41.28, 0.029); //Nomex
1514 track->PropagateTo(xk,36.2,1.98e-3); //C02
1516 track->PropagateTo(xk, 24.01, 2.7); //Al
1518 track->PropagateTo(xk, 44.77, 1.71); //Tedlar
1520 track->PropagateTo(xk, 44.86, 1.45); //Kevlar
1522 track->PropagateTo(xk, 41.28, 0.029); //Nomex
1524 ///////////////////////////////////////////////////////////////
1526 ///////////////////////////////////////////////////////////////
1527 AliITStrack trackITS(*track);
1528 AliITStrack result(*track);
1529 AliITStrack primarytrack(*track);
1531 ///////////////////////////////////////////////////////////////////////////////////////////////
1533 Vgeant=result.GetVertex();
1535 // Definition of Dv and Zv for vertex constraint
1536 Double_t sigmaDv=0.0050; Double_t sigmaZv=0.010;
1537 //Double_t sigmaDv=0.0015; Double_t sigmaZv=0.0015;
1538 Double_t uniform= gRandom->Uniform();
1540 if(uniform<=0.5) signdv=-1.;
1544 Double_t Vr=TMath::Sqrt(Vgeant(0)*Vgeant(0)+ Vgeant(1)*Vgeant(1));
1545 Double_t Dv=gRandom->Gaus(signdv*Vr,(Float_t)sigmaDv);
1546 Double_t Zv=gRandom->Gaus(Vgeant(2),(Float_t)sigmaZv);
1548 //cout<<" Dv e Zv = "<<Dv<<" "<<Zv<<"\n";
1549 trackITS.SetDv(Dv); trackITS.SetZv(Zv);
1550 trackITS.SetsigmaDv(sigmaDv); trackITS.SetsigmaZv(sigmaZv);
1551 result.SetDv(Dv); result.SetZv(Zv);
1552 result.SetsigmaDv(sigmaDv); result.SetsigmaZv(sigmaZv);
1553 primarytrack.SetDv(Dv); primarytrack.SetZv(Zv);
1554 primarytrack.SetsigmaDv(sigmaDv); primarytrack.SetsigmaZv(sigmaZv);
1556 /////////////////////////////////////////////////////////////////////////////////////////////////
1558 primarytrack.PrimaryTrack();
1559 TVector d2=primarytrack.Getd2();
1560 TVector tgl2=primarytrack.Gettgl2();
1561 TVector dtgl=primarytrack.Getdtgl();
1562 trackITS.Setd2(d2); trackITS.Settgl2(tgl2); trackITS.Setdtgl(dtgl);
1563 result.Setd2(d2); result.Settgl2(tgl2); result.Setdtgl(dtgl);
1565 trackITS.SetVertex(vertex); trackITS.SetErrorVertex(ervertex);
1566 result.SetVertex(vertex); result.SetErrorVertex(ervertex);
1568 Tracking(trackITS,&result,recPoints,vettid, flagvert);
1570 cout<<" progressive track number = "<<j<<"\r";
1572 //cout<<" progressive track number = "<<j<<"\n";
1573 Long_t labITS=result.GetLabel();
1574 //cout << " ITS track label = " << labITS << "\n";
1575 int lab=track->GetLabel();
1576 // cout << " TPC track label = " << lab <<"\n";
1577 //result.GetClusters(); getchar(); //to print the cluster matrix
1579 //propagation to vertex
1583 result.Propagation(rbeam);
1586 cov=&result.GetCMatrix();
1587 Double_t pt=TMath::Abs(result.GetPt());
1588 Double_t Dr=result.GetD();
1589 Double_t Z=result.GetZ();
1590 Double_t tgl=result.GetTgl();
1591 Double_t C=result.GetC();
1593 Double_t Dz=Z-(tgl/Cy)*TMath::ASin(result.arga(rbeam));
1596 // cout<<" Dr e dz alla fine = "<<Dr<<" "<<Dz<<"\n"; getchar();
1597 Double_t phi=result.Getphi();
1598 Double_t phivertex = phi - TMath::ASin(result.argA(rbeam));
1599 Double_t duepi=2.*TMath::Pi();
1600 if(phivertex>duepi) phivertex-=duepi;
1601 if(phivertex<0.) phivertex+=duepi;
1602 Double_t Dtot=TMath::Sqrt(Dr*Dr+Dz*Dz);
1604 //////////////////////////////////////////////////////////////////////////////////////////
1605 Int_t NumofCluster, idmodule,idpoint;
1606 NumofCluster=result.GetNumClust();
1607 if(NumofCluster >=5) {
1610 AliITSiotrack outtrack;
1614 iotrack->SetStatePhi(phi);
1615 iotrack->SetStateZ(Z);
1616 iotrack->SetStateD(Dr);
1617 iotrack->SetStateTgl(tgl);
1618 iotrack->SetStateC(C);
1619 Double_t radius=result.Getrtrack();
1620 iotrack->SetRadius(radius);
1622 if(C>0.) charge=-1; else charge=1;
1623 iotrack->SetCharge(charge);
1627 iotrack->SetCovMatrix(cov);
1629 Double_t px=pt*TMath::Cos(phi);
1630 Double_t py=pt*TMath::Sin(phi);
1633 Double_t xtrack=Dr*TMath::Sin(phi);
1634 Double_t ytrack=Dr*TMath::Cos(phi);
1635 Double_t ztrack=Dz+Vgeant(2);
1641 iotrack->SetX(xtrack);
1642 iotrack->SetY(ytrack);
1643 iotrack->SetZ(ztrack);
1644 iotrack->SetLabel(labITS);
1647 for(il=0;il<6; il++){
1648 iotrack->SetIdPoint(il,result.GetIdPoint(il));
1649 iotrack->SetIdModule(il,result.GetIdModule(il));
1653 //cout<<" labITS = "<<labITS<<"\n";
1654 //cout<<" phi z Dr tgl C = "<<phi<<" "<<Z<<" "<<Dr<<" "<<tgl<<" "<<C<<"\n"; getchar();
1656 DataOut(kkk) = ptg; kkk++; DataOut(kkk)=labITS; kkk++; DataOut(kkk)=lab; kkk++;
1658 for (il=0;il<6;il++) {
1659 idpoint=result.GetIdPoint(il);
1660 idmodule=result.GetIdModule(il);
1661 *(vettid[idmodule]+idpoint)=1;
1662 iotrack->SetIdPoint(il,idpoint);
1663 iotrack->SetIdModule(il,idmodule);
1666 // cout<<" +++++++++++++ pt e ptg = "<<pt<<" "<<ptg<<" ++++++++++\n";
1667 Double_t difpt= (pt-ptg)/ptg*100.;
1668 DataOut(kkk)=difpt; kkk++;
1669 Double_t lambdag=TMath::ATan(pzg/ptg);
1670 Double_t lam=TMath::ATan(tgl);
1671 Double_t diflam = (lam - lambdag)*1000.;
1672 DataOut(kkk) = diflam; kkk++;
1673 Double_t phig=TMath::ATan(pyg/pxg);
1674 Double_t phi=phivertex;
1675 Double_t difphi = (phi - phig)*1000.;
1676 DataOut(kkk)=difphi; kkk++;
1677 DataOut(kkk)=Dtot*1.e4; kkk++;
1678 DataOut(kkk)=Dr*1.e4; kkk++;
1679 DataOut(kkk)=Dz*1.e4; kkk++;
1681 for (r=0; r<9; r++) { out<<DataOut(r)<<" ";}
1686 } // end if on NumofCluster
1687 //gObjectTable->Print(); // stampa memoria
1688 } // end for (int j=min_t; j<=max_t; j++)
1693 static Bool_t first=kTRUE;
1694 static TFile *tfile;
1697 tfile=new TFile("itstracks.root","RECREATE");
1698 //cout<<"I have opened itstracks.root file "<<endl;
1705 sprintf(hname,"TreeT%d",evNumber);
1707 tracktree1.Write(hname);
1711 TTree *fAli=gAlice->TreeK();
1714 if (fAli) fileAli =fAli->GetCurrentFile();
1717 ////////////////////////////////////////////////////////////////////////////////////////////////
1719 printf("delete vectors\n");
1720 if(np) delete [] np;
1721 if(vettid) delete [] vettid;