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.21 2000/10/02 21:28:08 fca
19 Removal of useless dependecies via forward declarations
21 Revision 1.20 2000/10/02 16:31:39 barbera
24 Revision 1.9.2.14 2000/10/02 15:43:51 barbera
25 General code clean-up (e.g., printf -> cout)
27 Revision 1.19 2000/09/22 12:13:25 nilsen
28 Patches and updates for fixes to this and other routines.
30 Revision 1.18 2000/07/12 05:32:20 fca
31 Correcting several syntax problem with static members
33 Revision 1.17 2000/07/10 16:07:18 fca
34 Release version of ITS code
36 Revision 1.9.2.3 2000/02/02 13:42:09 barbera
37 fixed AliITS.cxx for new AliRun structure. Added ITS hits list to list of hits which will have their track numbers updated
39 Revision 1.9.2.2 2000/01/23 03:03:13 nilsen
40 //fixed FillModule. Removed fi(fabs(xl)<dx....
42 Revision 1.9.2.1 2000/01/12 19:03:32 nilsen
43 This is the version of the files after the merging done in December 1999.
44 See the ReadMe110100.txt file for details
46 Revision 1.9 1999/11/14 14:33:25 fca
47 Correct problems with distructors and pointers, thanks to I.Hrivnacova
49 Revision 1.8 1999/09/29 09:24:19 fca
50 Introduction of the Copyright and cvs Log
54 ///////////////////////////////////////////////////////////////////////////////
56 // An overview of the basic philosophy of the ITS code development
57 // and analysis is show in the figure below.
60 <img src="picts/ITS/ITS_Analysis_schema.gif">
63 <font size=+2 color=red>
64 <p>Roberto Barbera is in charge of the ITS Offline code (1999).
65 <a href="mailto:roberto.barbera@ct.infn.it">Roberto Barbera</a>.
71 // AliITS. Inner Traking System base class.
72 // This class contains the base procedures for the Inner Tracking System
76 <img src="picts/ITS/AliITS_Class_Diagram.gif">
79 <font size=+2 color=red>
80 <p>This show the class diagram of the different elements that are part of
88 // Written by Rene Brun, Federico Carminati, and Roberto Barbera
91 // Modified and documented by Bjorn S. Nilsen
95 // Modified and documented by A. Bologna
98 // AliITS is the general base class for the ITS. Also see AliDetector for
99 // futher information.
101 ///////////////////////////////////////////////////////////////////////////////
107 #include <TObjArray.h>
109 #include <TObjectTable.h>
118 #include "AliITSMap.h"
119 #include "AliITSDetType.h"
120 #include "AliITSClusterFinder.h"
121 #include "AliITSsimulation.h"
122 #include "AliITSsegmentationSPD.h"
123 #include "AliITSresponseSPD.h"
124 #include "AliITSsegmentationSDD.h"
125 #include "AliITSresponseSDD.h"
126 #include "AliITSsegmentationSSD.h"
127 #include "AliITSresponseSSD.h"
128 #include "AliITShit.h"
129 #include "AliITSgeom.h"
130 #include "AliITSdigit.h"
131 #include "AliITSmodule.h"
132 #include "AliITSRecPoint.h"
133 #include "AliITSRawCluster.h"
137 const Int_t AliITS::fgkNTYPES=3;
141 //_____________________________________________________________________________
142 AliITS::AliITS() : AliDetector() {
144 // Default initialiser for ITS
145 // The default constructor of the AliITS class. In addition to
146 // creating the AliITS class it zeros the variables fIshunt (a member
147 // of AliDetector class), fEuclidOut, and fIdN, and zeros the pointers
148 // fITSpoints, fIdSens, and fIdName. The AliDetector default constructor
156 //fNDetTypes = fgkNTYPES;
175 //_____________________________________________________________________________
176 AliITS::AliITS(const char *name, const char *title):AliDetector(name,title){
178 // Default initialiser for ITS
179 // The constructor of the AliITS class. In addition to creating the
180 // AliITS class, it allocates memory for the TClonesArrays fHits and
181 // fDigits, and for the TObjArray fITSpoints. It also zeros the variables
182 // fIshunt (a member of AliDetector class), fEuclidOut, and fIdN, and zeros
183 // the pointers fIdSens and fIdName. To help in displaying hits via the ROOT
184 // macro display.C AliITS also sets the marker color to red. The variables
185 // passes with this constructor, const char *name and *title, are used by
186 // the constructor of AliDetector class. See AliDetector class for a
187 // description of these parameters and its constructor functions.
191 fHits = new TClonesArray("AliITShit", 1560);
192 gAlice->AddHitList(fHits);
194 //fNDetTypes = fgkNTYPES;
196 fNdtype = new Int_t[fgkNTYPES];
197 fDtype = new TObjArray(fgkNTYPES);
199 fNctype = new Int_t[fgkNTYPES];
200 fCtype = new TObjArray(fgkNTYPES);
216 fDetTypes = new TObjArray(fgkNTYPES);
219 for(i=0;i<fgkNTYPES;i++) {
220 (*fDetTypes)[i]=new AliITSDetType();
226 SetMarkerColor(kRed);
230 //___________________________________________________________________________
231 AliITS::AliITS(AliITS &source){
233 if(this==&source) return;
234 Error("AliITS::Copy constructor",
235 "You are not allowed to make a copy of the AliITS");
238 //____________________________________________________________________________
239 AliITS& AliITS::operator=(AliITS &source){
240 // assignment operator
241 if(this==&source) return *this;
242 Error("AliITS::operator=",
243 "You are not allowed to make a copy of the AliITS");
245 return *this; //fake return
247 //____________________________________________________________________________
248 void AliITS::ClearModules(){
249 //clear the modules TObjArray
251 if(fITSmodules) fITSmodules->Delete();
254 //_____________________________________________________________________________
257 // Default distructor for ITS
258 // The default destructor of the AliITS class. In addition to deleting
259 // the AliITS class it deletes the memory pointed to by the fHits, fDigits,
260 // fIdSens, fIdName, and fITSpoints.
267 if(fIdName!=0) delete[] fIdName;
268 if(fIdSens!=0) delete[] fIdSens;
270 this->ClearModules();
272 }// end if fITSmodules!=0
292 if (fTreeC) delete fTreeC;
294 if (fITSgeom) delete fITSgeom;
298 //___________________________________________
299 AliITSDetType* AliITS::DetType(Int_t id)
301 //return pointer to id detector type
302 return ((AliITSDetType*) (*fDetTypes)[id]);
305 //___________________________________________
306 void AliITS::SetClasses(Int_t id, const char *digit, const char *cluster)
308 //set the digit and cluster classes to be used for the id detector type
309 ((AliITSDetType*) (*fDetTypes)[id])->ClassNames(digit,cluster);
312 //___________________________________________
313 void AliITS::SetResponseModel(Int_t id, AliITSresponse *response)
315 //set the response model for the id detector type
317 ((AliITSDetType*) (*fDetTypes)[id])->ResponseModel(response);
321 //___________________________________________
322 void AliITS::SetSegmentationModel(Int_t id, AliITSsegmentation *seg)
324 //set the segmentation model for the id detector type
326 ((AliITSDetType*) (*fDetTypes)[id])->SegmentationModel(seg);
330 //___________________________________________
331 void AliITS::SetSimulationModel(Int_t id, AliITSsimulation *sim)
333 //set the simulation model for the id detector type
335 ((AliITSDetType*) (*fDetTypes)[id])->SimulationModel(sim);
338 //___________________________________________
339 void AliITS::SetReconstructionModel(Int_t id, AliITSClusterFinder *reconst)
341 //set the cluster finder model for the id detector type
343 ((AliITSDetType*) (*fDetTypes)[id])->ReconstructionModel(reconst);
347 //_____________________________________________________________________________
348 void AliITS::AddHit(Int_t track, Int_t *vol, Float_t *hits){
351 // The function to add information to the AliITShit class. See the
352 // AliITShit class for a full description. This function allocates the
353 // necessary new space for the hit information and passes the variable
354 // track, and the pointers *vol and *hits to the AliITShit constructor
357 TClonesArray &lhits = *fHits;
358 new(lhits[fNhits++]) AliITShit(fIshunt,track,vol,hits);
360 //_____________________________________________________________________________
361 void AliITS::AddRealDigit(Int_t id, Int_t *digits)
363 // add a real digit - as coming from data
365 TClonesArray &ldigits = *((TClonesArray*)(*fDtype)[id]);
366 new(ldigits[fNdtype[id]++]) AliITSdigit(digits);
369 //_____________________________________________________________________________
370 void AliITS::AddSimDigit(Int_t id, AliITSdigit *d)
373 // add a simulated digit
375 TClonesArray &ldigits = *((TClonesArray*)(*fDtype)[id]);
380 new(ldigits[fNdtype[id]++]) AliITSdigitSPD(*((AliITSdigitSPD*)d));
383 new(ldigits[fNdtype[id]++]) AliITSdigitSDD(*((AliITSdigitSDD*)d));
386 new(ldigits[fNdtype[id]++]) AliITSdigitSSD(*((AliITSdigitSSD*)d));
392 //_____________________________________________________________________________
393 void AliITS::AddSimDigit(Int_t id,Float_t phys,Int_t *digits,Int_t *tracks,Int_t *hits,Float_t *charges){
395 // add a simulated digit to the list
397 TClonesArray &ldigits = *((TClonesArray*)(*fDtype)[id]);
401 new(ldigits[fNdtype[id]++]) AliITSdigitSPD(digits,tracks,hits);
404 new(ldigits[fNdtype[id]++]) AliITSdigitSDD(phys,digits,tracks,hits,charges);
407 new(ldigits[fNdtype[id]++]) AliITSdigitSSD(digits,tracks,hits);
413 //_____________________________________________________________________________
414 void AliITS::AddCluster(Int_t id, AliITSRawCluster *c)
417 // add a cluster to the list
419 TClonesArray &lcl = *((TClonesArray*)(*fCtype)[id]);
424 new(lcl[fNctype[id]++]) AliITSRawClusterSPD(*((AliITSRawClusterSPD*)c));
427 new(lcl[fNctype[id]++]) AliITSRawClusterSDD(*((AliITSRawClusterSDD*)c));
430 new(lcl[fNctype[id]++]) AliITSRawClusterSSD(*((AliITSRawClusterSSD*)c));
437 //_____________________________________________________________________________
438 void AliITS::AddRecPoint(const AliITSRecPoint &r)
441 // Add a reconstructed space point to the list
443 TClonesArray &lrecp = *fRecPoints;
444 new(lrecp[fNRecPoints++]) AliITSRecPoint(r);
448 //____________________________________________
449 void AliITS::ResetDigits()
452 // Reset number of digits and the digits array for the ITS detector
458 for (i=0;i<fgkNTYPES;i++ ) {
459 if ((*fDtype)[i]) ((TClonesArray*)(*fDtype)[i])->Clear();
460 if (fNdtype) fNdtype[i]=0;
464 //____________________________________________
465 void AliITS::ResetDigits(Int_t i)
468 // Reset number of digits and the digits array for this branch
470 if ((*fDtype)[i]) ((TClonesArray*)(*fDtype)[i])->Clear();
471 if (fNdtype) fNdtype[i]=0;
475 //____________________________________________
476 void AliITS::ResetClusters()
479 // Reset number of clusters and the clusters array for ITS
483 for (i=0;i<fgkNTYPES;i++ ) {
484 if ((*fCtype)[i]) ((TClonesArray*)(*fCtype)[i])->Clear();
485 if (fNctype) fNctype[i]=0;
490 //____________________________________________
491 void AliITS::ResetClusters(Int_t i)
494 // Reset number of clusters and the clusters array for this branch
496 if ((*fCtype)[i]) ((TClonesArray*)(*fCtype)[i])->Clear();
497 if (fNctype) fNctype[i]=0;
502 //____________________________________________
503 void AliITS::ResetRecPoints()
506 // Reset number of rec points and the rec points array
508 if (fRecPoints) fRecPoints->Clear();
513 //_____________________________________________________________________________
514 Int_t AliITS::DistancetoPrimitive(Int_t , Int_t ){
516 // Distance from mouse to ITS on the screen. Dummy routine
517 // A dummy routine used by the ROOT macro display.C to allow for the
518 // use of the mouse (pointing device) in the macro. In general this should
519 // never be called. If it is it returns the number 9999 for any value of
525 //_____________________________________________________________________________
528 // Initialise ITS after it has been built
529 // This routine initializes the AliITS class. It is intended to be called
530 // from the Init function in AliITSv?. Besides displaying a banner
531 // indicating that it has been called it initializes the array fIdSens
532 // and sets the default segmentation, response, digit and raw cluster classes
533 // Therefore it should be called after a call to CreateGeometry.
541 for(i=0;i<30;i++) cout << "*";cout << " ITS_INIT ";
542 for(i=0;i<30;i++) cout << "*";cout << endl;
543 for(i=0;i<fIdN;i++) fIdSens[i] = gMC->VolId(fIdName[i]);
545 for(i=0;i<70;i++) cout << "*";
549 //_____________________________________________________________________________
550 void AliITS::SetDefaults()
552 // sets the default segmentation, response, digit and raw cluster classes
554 cout << "AliITS::SetDefaults" << endl;
556 AliITSDetType *iDetType;
560 AliITSsegmentationSPD *seg0=new AliITSsegmentationSPD(fITSgeom);
561 AliITSresponseSPD *resp0=new AliITSresponseSPD();
563 if (!iDetType->GetSegmentationModel()) SetSegmentationModel(0,seg0);
564 if (!iDetType->GetResponseModel()) SetResponseModel(0,resp0);
565 // set digit and raw cluster classes to be used
566 const char *kData0=resp0->DataType();
567 if (strstr(kData0,"real")) {
568 iDetType->ClassNames("AliITSdigit","AliITSRawClusterSPD");
569 } else iDetType->ClassNames("AliITSdigitSPD","AliITSRawClusterSPD");
572 AliITSresponseSDD *resp1=new AliITSresponseSDD();
573 AliITSsegmentationSDD *seg1=new AliITSsegmentationSDD(fITSgeom,resp1);
575 //printf("SetDefaults: iDetType %p\n",iDetType);
576 if (!iDetType->GetSegmentationModel()) SetSegmentationModel(1,seg1);
577 //printf("SetDefaults: segm %p\n",iDetType->GetSegmentationModel());
578 if (!iDetType->GetResponseModel()) SetResponseModel(1,resp1);
579 //printf("SetDefaults: resp %p\n",iDetType->GetResponseModel());
580 const char *kData1=resp1->DataType();
581 const char *kopt=resp1->ZeroSuppOption();
582 if ((!strstr(kopt,"2D")) && (!strstr(kopt,"1D")) || strstr(kData1,"real") ) {
583 iDetType->ClassNames("AliITSdigit","AliITSRawClusterSDD");
584 } else iDetType->ClassNames("AliITSdigitSDD","AliITSRawClusterSDD");
587 AliITSsegmentationSSD *seg2=new AliITSsegmentationSSD(fITSgeom);
588 AliITSresponseSSD *resp2=new AliITSresponseSSD();
590 if (!iDetType->GetSegmentationModel()) SetSegmentationModel(2,seg2);
591 if (!iDetType->GetResponseModel()) SetResponseModel(2,resp2);
592 const char *kData2=resp2->DataType();
593 if (strstr(kData2,"real")) {
594 iDetType->ClassNames("AliITSdigit","AliITSRawClusterSSD");
595 } else iDetType->ClassNames("AliITSdigitSSD","AliITSRawClusterSSD");
598 Warning("SetDefaults","Only the three basic detector types are initialised!");
602 //_____________________________________________________________________________
603 void AliITS::SetDefaultSimulation()
608 //_____________________________________________________________________________
609 void AliITS::SetDefaultClusterFinders()
614 //_____________________________________________________________________________
616 void AliITS::MakeTreeC(Option_t *option)
618 // create a separate tree to store the clusters
620 cout << "AliITS::MakeTreeC" << endl;
622 char *optC = strstr(option,"C");
623 if (optC && !fTreeC) fTreeC = new TTree("TC","Clusters in ITS");
626 Int_t buffersize = 4000;
629 char *det[3] = {"SPD","SDD","SSD"};
631 // one branch for Clusters per type of detector
633 for (i=0; i<fgkNTYPES ;i++) {
634 if (fgkNTYPES==3) sprintf(branchname,"%sClusters%s",GetName(),det[i]);
635 else sprintf(branchname,"%sClusters%d",GetName(),i+1);
636 if (fCtype && fTreeC) {
637 TreeC()->Branch(branchname,&((*fCtype)[i]), buffersize);
638 cout << "Making Branch " << branchname;
639 cout << " for Clusters of detector type " << i+1 << endl;
645 //_____________________________________________________________________________
646 void AliITS::GetTreeC(Int_t event)
649 cout << "AliITS::GetTreeC" << endl;
651 // get the clusters tree for this event and set the branch address
655 char *det[3] = {"SPD","SDD","SSD"};
662 sprintf(treeName,"TreeC%d",event);
663 fTreeC = (TTree*)gDirectory->Get(treeName);
669 for (i=0; i<fgkNTYPES; i++) {
670 if (fgkNTYPES==3) sprintf(branchname,"%sClusters%s",GetName(),det[i]);
671 else sprintf(branchname,"%sClusters%d",GetName(),i+1);
673 branch = fTreeC->GetBranch(branchname);
674 if (branch) branch->SetAddress(&((*fCtype)[i]));
678 Error("AliITS::GetTreeC",
679 "cannot find Clusters Tree for event:%d\n",event);
683 //_____________________________________________________________________________
684 void AliITS::MakeBranch(Option_t* option){
686 // Creates Tree branches for the ITS.
690 Int_t buffersize = 4000;
692 sprintf(branchname,"%s",GetName());
694 AliDetector::MakeBranch(option);
697 // one branch for digits per type of detector
699 char *det[3] = {"SPD","SDD","SSD"};
705 for (i=0; i<fgkNTYPES ;i++) {
706 AliITSDetType *iDetType=DetType(i);
707 iDetType->GetClassNames(digclass,clclass);
708 //printf("i, digclass, recclass %d %s %s\n",i,digclass,clclass);
710 (*fDtype)[i] = new TClonesArray(digclass,10000);
712 (*fCtype)[i] = new TClonesArray(clclass,10000);
716 for (i=0; i<fgkNTYPES ;i++) {
717 if (fgkNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]);
718 else sprintf(branchname,"%sDigits%d",GetName(),i+1);
720 if (fDtype && gAlice->TreeD()) {
721 gAlice->TreeD()->Branch(branchname,&((*fDtype)[i]), buffersize);
722 cout << "Making Branch " << branchname;
723 cout << " for digits of type "<< i+1 << endl;
727 // only one branch for rec points for all detector types
728 sprintf(branchname,"%sRecPoints",GetName());
730 fRecPoints=new TClonesArray("AliITSRecPoint",10000);
732 if (fRecPoints && gAlice->TreeR()) {
733 gAlice->TreeR()->Branch(branchname,&fRecPoints, buffersize);
734 cout << "Making Branch " << branchname;
735 cout << " for reconstructed space points" << endl;
741 //___________________________________________
742 void AliITS::SetTreeAddress()
745 // Set branch address for the Trees.
748 AliDetector::SetTreeAddress();
750 char *det[3] = {"SPD","SDD","SSD"};
753 TTree *treeD = gAlice->TreeD();
754 TTree *treeR = gAlice->TreeR();
758 for (i=0; i<fgkNTYPES; i++) {
759 if (fgkNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]);
760 else sprintf(branchname,"%sDigits%d",GetName(),i+1);
762 branch = treeD->GetBranch(branchname);
763 if (branch) branch->SetAddress(&((*fDtype)[i]));
770 sprintf(branchname,"%sRecPoints",GetName());
772 branch = treeR->GetBranch(branchname);
773 if (branch) branch->SetAddress(&fRecPoints);
780 //____________________________________________________________________________
781 void AliITS::InitModules(Int_t size,Int_t &nmodules){
783 //initialize the modules array
786 fITSmodules->Delete();
790 Int_t nl,indexMAX,index;
792 if(size<=0){ // default to using data stored in AliITSgeom
794 Error("AliITS::InitModules",
795 "in AliITS::InitModule fITSgeom not defined\n");
797 } // end if fITSgeom==0
798 nl = fITSgeom->GetNlayers();
799 indexMAX = fITSgeom->GetModuleIndex(nl,fITSgeom->GetNladders(nl),
800 fITSgeom->GetNdetectors(nl))+1;
802 fITSmodules = new TObjArray(indexMAX);
803 for(index=0;index<indexMAX;index++){
804 fITSmodules->AddAt( new AliITSmodule(index),index);
807 fITSmodules = new TObjArray(size);
808 for(index=0;index<size;index++) {
809 fITSmodules->AddAt( new AliITSmodule(index),index);
816 //____________________________________________________________________________
817 void AliITS::FillModules(Int_t evnt,Int_t bgrev,Int_t nmodules,Option_t *option,Text_t *filename){
819 // fill the modules with the sorted by module hits; add hits from background
823 static TTree *trH1; //Tree with background hits
824 static TClonesArray *fHits2; //List of hits for one track only
826 static Bool_t first=kTRUE;
828 char *addBgr = strstr(option,"Add");
833 cout<<"filename "<<filename<<endl;
834 file=new TFile(filename);
835 cout<<"I have opened "<<filename<<" file "<<endl;
836 fHits2 = new TClonesArray("AliITShit",1000 );
841 // Get Hits Tree header from file
842 if(fHits2) fHits2->Clear();
843 if(trH1) delete trH1;
847 sprintf(treeName,"TreeH%d",bgrev);
848 trH1 = (TTree*)gDirectory->Get(treeName);
849 //printf("TrH1 %p of treename %s for event %d \n",trH1,treeName,bgrev);
852 Error("AliITS::FillModules",
853 "cannot find Hits Tree for event:%d\n",bgrev);
855 // Set branch addresses
858 sprintf(branchname,"%s",GetName());
859 if (trH1 && fHits2) {
860 branch = trH1->GetBranch(branchname);
861 if (branch) branch->SetAddress(&fHits2);
865 //Int_t ntracks1 =(Int_t)TrH1->GetEntries();
866 //printf("background - ntracks1 - %d\n",ntracks1);
869 Int_t npart = gAlice->GetEvent(evnt);
871 TClonesArray *itsHits = this->Hits();
872 Int_t lay,lad,det,index;
876 TTree *iTH = gAlice->TreeH();
877 Int_t ntracks =(Int_t) iTH->GetEntries();
880 for(t=0; t<ntracks; t++){
883 Int_t nhits = itsHits->GetEntriesFast();
884 //printf("nhits %d\n",nhits);
885 if (!nhits) continue;
886 for(h=0; h<nhits; h++){
887 itsHit = (AliITShit *)itsHits->UncheckedAt(h);
888 itsHit->GetDetectorID(lay,lad,det);
889 // temporarily index=det-1 !!!
890 if(fITSgeom) index = fITSgeom->GetModuleIndex(lay,lad,det);
893 mod = this->GetModule(index);
894 mod->AddHit(itsHit,t,h);
895 } // end loop over hits
896 } // end loop over tracks
898 // open the file with background
902 ntracks =(Int_t)trH1->GetEntries();
903 //printf("background - ntracks1 %d\n",ntracks);
904 //printf("background - Start loop over tracks \n");
907 for (track=0; track<ntracks; track++) {
909 if (fHits2) fHits2->Clear();
910 trH1->GetEvent(track);
912 for(i=0;i<fHits2->GetEntriesFast();++i) {
914 itsHit=(AliITShit*) (*fHits2)[i];
915 itsHit->GetDetectorID(lay,lad,det);
916 // temporarily index=det-1 !!!
917 if(fITSgeom) index = fITSgeom->GetModuleIndex(lay,lad,det);
920 mod = this->GetModule(index);
921 mod->AddHit(itsHit,track,i);
922 } // end loop over hits
923 } // end loop over tracks
925 TTree *fAli=gAlice->TreeK();
928 if (fAli) fileAli =fAli->GetCurrentFile();
933 //gObjectTable->Print();
938 //____________________________________________________________________________
939 void AliITS::HitsToDigits(Int_t evNumber,Int_t bgrev,Int_t size, Option_t *option, Option_t *opt,Text_t *filename)
941 // keep galice.root for signal and name differently the file for
942 // background when add! otherwise the track info for signal will be lost !
944 // the condition below will disappear when the geom class will be
945 // initialised for all versions - for the moment it is only for v5 !
946 // 7 is the SDD beam test version
947 Int_t ver = this->IsVersion();
948 if(ver!=5 && ver!=7) return;
950 char *all = strstr(opt,"All");
951 char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),strstr(opt,"SSD")};
954 InitModules(size,nmodules);
955 FillModules(evNumber,bgrev,nmodules,option,filename);
958 AliITSsimulation* sim;
959 //TObjArray *branches=gAlice->TreeD()->GetListOfBranches();
960 AliITSgeom *geom = GetITSgeom();
964 for (id=0;id<fgkNTYPES;id++) {
965 if (!all && !det[id]) continue;
966 //branch = (TBranch*)branches->UncheckedAt(id);
967 AliITSDetType *iDetType=DetType(id);
968 sim = (AliITSsimulation*)iDetType->GetSimulationModel();
970 Error("HitsToDigits","The simulation class was not instantiated!");
972 // or SetDefaultSimulation();
975 first = geom->GetStartDet(id);
976 last = geom->GetLastDet(id);
978 cout << "det type " << id << " first, last "<< first << last << endl;
979 for(module=first;module<=last;module++) {
980 AliITSmodule *mod = (AliITSmodule *)fITSmodules->At(module);
981 sim->DigitiseModule(mod,module,evNumber);
982 // fills all branches - wasted disk space
983 gAlice->TreeD()->Fill();
985 // try and fill only the branch
988 } // loop over modules
989 } // loop over detector types
993 Int_t nentries=(Int_t)gAlice->TreeD()->GetEntries();
994 cout << "nentries in TreeD" << nentries << endl;
997 sprintf(hname,"TreeD%d",evNumber);
998 gAlice->TreeD()->Write(hname);
1000 gAlice->TreeD()->Reset();
1005 //____________________________________________________________________________
1006 void AliITS::DigitsToRecPoints(Int_t evNumber,Int_t lastentry,Option_t *opt)
1008 // cluster finding and reconstruction of space points
1010 // the condition below will disappear when the geom class will be
1011 // initialised for all versions - for the moment it is only for v5 !
1012 // 7 is the SDD beam test version
1013 Int_t ver = this->IsVersion();
1014 if(ver!=5 && ver!=7) return;
1016 char *all = strstr(opt,"All");
1017 char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),strstr(opt,"SSD")};
1019 static Bool_t first=kTRUE;
1028 AliITSClusterFinder* rec;
1030 //TObjArray *branches=gAlice->TreeR()->GetListOfBranches();
1031 AliITSgeom *geom = GetITSgeom();
1034 for (id=0;id<fgkNTYPES;id++) {
1035 if (!all && !det[id]) continue;
1036 //branch = (TBranch*)branches->UncheckedAt(id);
1037 AliITSDetType *iDetType=DetType(id);
1038 rec = (AliITSClusterFinder*)iDetType->GetReconstructionModel();
1040 Error("DigitsToRecPoints","The cluster finder class was not instantiated!");
1042 // or SetDefaultClusterFinders();
1044 TClonesArray *itsDigits = this->DigitsAddress(id);
1048 first = geom->GetStartDet(id);
1049 last = geom->GetLastDet(id);
1050 } else first=last=0;
1051 //printf("first last %d %d\n",first,last);
1052 for(module=first;module<=last;module++) {
1053 this->ResetDigits();
1054 if (all) gAlice->TreeD()->GetEvent(lastentry+module);
1055 else gAlice->TreeD()->GetEvent(lastentry+(module-first));
1056 Int_t ndigits = itsDigits->GetEntriesFast();
1057 if (ndigits) rec->FindRawClusters();
1058 gAlice->TreeR()->Fill();
1062 // try and fill only the branch
1064 //ResetRecPoints(id);
1065 } // loop over modules
1066 } // loop over detector types
1069 Int_t nentries=(Int_t)gAlice->TreeR()->GetEntries();
1070 Int_t ncentries=(Int_t)iTC->GetEntries();
1071 cout << " nentries ncentries " << nentries << ncentries << endl;
1074 sprintf(hname,"TreeR%d",evNumber);
1075 gAlice->TreeR()->Write(hname);
1077 gAlice->TreeR()->Reset();
1079 sprintf(hname,"TreeC%d",evNumber);
1085 //____________________________________________________________________________
1086 void AliITS::HitsToFastRecPoints(Int_t evNumber,Int_t bgrev,Int_t size,
1087 Option_t *option,Option_t *opt,Text_t *filename)
1089 // keep galice.root for signal and name differently the file for
1090 // background when add! otherwise the track info for signal will be lost !
1093 // the condition below will disappear when the geom class will be
1094 // initialised for all versions - for the moment it is only for v5 !
1095 Int_t ver = this->IsVersion();
1098 char *all = strstr(opt,"All");
1099 char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),strstr(opt,"SSD")};
1102 InitModules(size,nmodules);
1103 FillModules(evNumber,bgrev,nmodules,option,filename);
1106 AliITSsimulation* sim;
1107 AliITSgeom *geom = GetITSgeom();
1109 TRandom *random=new TRandom[9];
1110 random[0].SetSeed(111);
1111 random[1].SetSeed(222);
1112 random[2].SetSeed(333);
1113 random[3].SetSeed(444);
1114 random[4].SetSeed(555);
1115 random[5].SetSeed(666);
1116 random[6].SetSeed(777);
1117 random[7].SetSeed(888);
1118 random[8].SetSeed(999);
1122 for (id=0;id<fgkNTYPES;id++) {
1123 if (!all && !det[id]) continue;
1124 AliITSDetType *iDetType=DetType(id);
1125 sim = (AliITSsimulation*)iDetType->GetSimulationModel();
1127 Error("HitsToFastPoints","The simulation class was not instantiated!");
1129 // or SetDefaultSimulation();
1131 Int_t first = geom->GetStartDet(id);
1132 Int_t last = geom->GetLastDet(id);
1133 for(module=first;module<=last;module++) {
1134 AliITSmodule *mod = (AliITSmodule *)fITSmodules->At(module);
1135 sim->CreateFastRecPoints(mod,module,random);
1136 gAlice->TreeR()->Fill();
1138 } // loop over modules
1139 } // loop over detector types
1144 //Int_t nentries=(Int_t)gAlice->TreeR()->GetEntries();
1147 sprintf(hname,"TreeR%d",evNumber);
1148 gAlice->TreeR()->Write(hname);
1150 gAlice->TreeR()->Reset();
1157 //____________________________________________________________________________
1158 void AliITS::Streamer(TBuffer &R__b){
1159 // Stream an object of class AliITS.
1163 if (R__b.IsReading()) {
1164 Version_t R__v = R__b.ReadVersion();
1166 AliDetector::Streamer(R__b);
1168 R__b.ReadArray(fIdSens);
1169 for(i=0;i<fIdN;i++) fIdName[i].Streamer(R__b);
1171 R__b >> fITSmodules;
1173 R__b >> fMajorVersion;
1174 R__b >> fMinorVersion;
1178 fNdtype = new Int_t[fgkNTYPES];
1179 R__b.ReadFastArray(fNdtype,fgkNTYPES);
1182 fNctype = new Int_t[fgkNTYPES];
1183 R__b.ReadFastArray(fNctype,fgkNTYPES);
1185 R__b >> fNRecPoints;
1189 R__b.WriteVersion(AliITS::IsA());
1190 AliDetector::Streamer(R__b);
1192 R__b.WriteArray(fIdSens,fIdN);
1193 for(i=0;i<fIdN;i++) fIdName[i].Streamer(R__b);
1195 R__b << fITSmodules;
1197 R__b << fMajorVersion;
1198 R__b << fMinorVersion;
1201 R__b.WriteFastArray(fNdtype,fgkNTYPES);
1203 R__b.WriteFastArray(fNctype,fgkNTYPES);
1205 R__b << fNRecPoints;