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.18 2000/07/12 05:32:20 fca
19 Correcting several syntax problem with static members
21 Revision 1.17 2000/07/10 16:07:18 fca
22 Release version of ITS code
24 Revision 1.9.2.3 2000/02/02 13:42:09 barbera
25 fixed AliITS.cxx for new AliRun structure. Added ITS hits list to list of hits which will have their track numbers updated
27 Revision 1.9.2.2 2000/01/23 03:03:13 nilsen
28 //fixed FillModule. Removed fi(fabs(xl)<dx....
30 Revision 1.9.2.1 2000/01/12 19:03:32 nilsen
31 This is the version of the files after the merging done in December 1999.
32 See the ReadMe110100.txt file for details
34 Revision 1.9 1999/11/14 14:33:25 fca
35 Correct problems with distructors and pointers, thanks to I.Hrivnacova
37 Revision 1.8 1999/09/29 09:24:19 fca
38 Introduction of the Copyright and cvs Log
42 ///////////////////////////////////////////////////////////////////////////////
44 // An overview of the basic philosophy of the ITS code development
45 // and analysis is show in the figure below.
48 <img src="picts/ITS/ITS_Analysis_schema.gif">
51 <font size=+2 color=red>
52 <p>Roberto Barbera is in charge of the ITS Offline code (1999).
53 <a href="mailto:roberto.barbera@ct.infn.it">Roberto Barbera</a>.
59 // AliITS. Inner Traking System base class.
60 // This class contains the base procedures for the Inner Tracking System
64 <img src="picts/ITS/AliITS_Class_Diagram.gif">
67 <font size=+2 color=red>
68 <p>This show the class diagram of the different elements that are part of
76 // Written by Rene Brun, Federico Carminati, and Roberto Barbera
79 // Modified and documented by Bjorn S. Nilsen
83 // Modified and documented by A. Bologna
86 // AliITS is the general base class for the ITS. Also see AliDetector for
87 // futher information.
89 ///////////////////////////////////////////////////////////////////////////////
95 #include <TObjArray.h>
97 #include <TObjectTable.h>
105 #include "AliITSMap.h"
106 #include "AliITSDetType.h"
107 #include "AliITSClusterFinder.h"
108 #include "AliITSsimulation.h"
109 #include "AliITSsegmentationSPD.h"
110 #include "AliITSresponseSPD.h"
111 #include "AliITSsegmentationSDD.h"
112 #include "AliITSresponseSDD.h"
113 #include "AliITSsegmentationSSD.h"
114 #include "AliITSresponseSSD.h"
115 #include "AliITShit.h"
116 #include "AliITSgeom.h"
117 #include "AliITSdigit.h"
118 #include "AliITSmodule.h"
119 #include "AliITSRecPoint.h"
120 #include "AliITSRawCluster.h"
122 const Int_t AliITS::fgkNTYPES=3;
126 //_____________________________________________________________________________
127 AliITS::AliITS() : AliDetector() {
129 // Default initialiser for ITS
130 // The default constructor of the AliITS class. In addition to
131 // creating the AliITS class it zeros the variables fIshunt (a member
132 // of AliDetector class), fEuclidOut, and fIdN, and zeros the pointers
133 // fITSpoints, fIdSens, and fIdName. The AliDetector default constructor
141 //fNDetTypes = fgkNTYPES;
160 //_____________________________________________________________________________
161 AliITS::AliITS(const char *name, const char *title):AliDetector(name,title){
163 // Default initialiser for ITS
164 // The constructor of the AliITS class. In addition to creating the
165 // AliITS class, it allocates memory for the TClonesArrays fHits and
166 // fDigits, and for the TObjArray fITSpoints. It also zeros the variables
167 // fIshunt (a member of AliDetector class), fEuclidOut, and fIdN, and zeros
168 // the pointers fIdSens and fIdName. To help in displaying hits via the ROOT
169 // macro display.C AliITS also sets the marker color to red. The variables
170 // passes with this constructor, const char *name and *title, are used by
171 // the constructor of AliDetector class. See AliDetector class for a
172 // description of these parameters and its constructor functions.
176 fHits = new TClonesArray("AliITShit", 1560);
177 gAlice->AddHitList(fHits);
179 //fNDetTypes = fgkNTYPES;
181 fNdtype = new Int_t[fgkNTYPES];
182 fDtype = new TObjArray(fgkNTYPES);
184 fNctype = new Int_t[fgkNTYPES];
185 fCtype = new TObjArray(fgkNTYPES);
201 fDetTypes = new TObjArray(fgkNTYPES);
204 for(i=0;i<fgkNTYPES;i++) {
205 (*fDetTypes)[i]=new AliITSDetType();
211 SetMarkerColor(kRed);
215 //___________________________________________________________________________
216 AliITS::AliITS(AliITS &source){
218 if(this==&source) return;
219 printf("Error: You are not allowed to make a copy of the AliITS\n");
222 //____________________________________________________________________________
223 AliITS& AliITS::operator=(AliITS &source){
224 // assignment operator
225 if(this==&source) return *this;
226 printf("Error: You are not allowed to make a copy of the AliITS\n");
228 return *this; //fake return
230 //____________________________________________________________________________
231 void AliITS::ClearModules(){
232 //clear the modules TObjArray
234 if(fITSmodules) fITSmodules->Delete();
237 //_____________________________________________________________________________
240 // Default distructor for ITS
241 // The default destructor of the AliITS class. In addition to deleting
242 // the AliITS class it deletes the memory pointed to by the fHits, fDigits,
243 // fIdSens, fIdName, and fITSpoints.
250 if(fIdName!=0) delete[] fIdName;
251 if(fIdSens!=0) delete[] fIdSens;
253 this->ClearModules();
255 }// end if fITSmodules!=0
275 if (fTreeC) delete fTreeC;
277 if (fITSgeom) delete fITSgeom;
281 //___________________________________________
282 AliITSDetType* AliITS::DetType(Int_t id)
284 //return pointer to id detector type
285 return ((AliITSDetType*) (*fDetTypes)[id]);
288 //___________________________________________
289 void AliITS::SetClasses(Int_t id, const char *digit, const char *cluster)
291 //set the digit and cluster classes to be used for the id detector type
292 ((AliITSDetType*) (*fDetTypes)[id])->ClassNames(digit,cluster);
295 //___________________________________________
296 void AliITS::SetResponseModel(Int_t id, AliITSresponse *response)
298 //set the response model for the id detector type
300 ((AliITSDetType*) (*fDetTypes)[id])->ResponseModel(response);
304 //___________________________________________
305 void AliITS::SetSegmentationModel(Int_t id, AliITSsegmentation *seg)
307 //set the segmentation model for the id detector type
309 ((AliITSDetType*) (*fDetTypes)[id])->SegmentationModel(seg);
313 //___________________________________________
314 void AliITS::SetSimulationModel(Int_t id, AliITSsimulation *sim)
316 //set the simulation model for the id detector type
318 ((AliITSDetType*) (*fDetTypes)[id])->SimulationModel(sim);
321 //___________________________________________
322 void AliITS::SetReconstructionModel(Int_t id, AliITSClusterFinder *reconst)
324 //set the cluster finder model for the id detector type
326 ((AliITSDetType*) (*fDetTypes)[id])->ReconstructionModel(reconst);
330 //_____________________________________________________________________________
331 void AliITS::AddHit(Int_t track, Int_t *vol, Float_t *hits){
334 // The function to add information to the AliITShit class. See the
335 // AliITShit class for a full description. This function allocates the
336 // necessary new space for the hit information and passes the variable
337 // track, and the pointers *vol and *hits to the AliITShit constructor
340 TClonesArray &lhits = *fHits;
341 new(lhits[fNhits++]) AliITShit(fIshunt,track,vol,hits);
343 //_____________________________________________________________________________
344 void AliITS::AddRealDigit(Int_t id, Int_t *digits)
346 // add a real digit - as coming from data
348 TClonesArray &ldigits = *((TClonesArray*)(*fDtype)[id]);
349 new(ldigits[fNdtype[id]++]) AliITSdigit(digits);
352 //_____________________________________________________________________________
353 void AliITS::AddSimDigit(Int_t id, AliITSdigit *d)
356 // add a simulated digit
358 TClonesArray &ldigits = *((TClonesArray*)(*fDtype)[id]);
363 new(ldigits[fNdtype[id]++]) AliITSdigitSPD(*((AliITSdigitSPD*)d));
366 new(ldigits[fNdtype[id]++]) AliITSdigitSDD(*((AliITSdigitSDD*)d));
369 new(ldigits[fNdtype[id]++]) AliITSdigitSSD(*((AliITSdigitSSD*)d));
375 //_____________________________________________________________________________
376 void AliITS::AddSimDigit(Int_t id,Float_t phys,Int_t *digits,Int_t *tracks,Int_t *hits,Float_t *charges){
378 // add a simulated digit to the list
380 TClonesArray &ldigits = *((TClonesArray*)(*fDtype)[id]);
384 new(ldigits[fNdtype[id]++]) AliITSdigitSPD(digits,tracks,hits);
387 new(ldigits[fNdtype[id]++]) AliITSdigitSDD(phys,digits,tracks,hits,charges);
390 new(ldigits[fNdtype[id]++]) AliITSdigitSSD(digits,tracks,hits);
396 //_____________________________________________________________________________
397 void AliITS::AddCluster(Int_t id, AliITSRawCluster *c)
400 // add a cluster to the list
402 TClonesArray &lcl = *((TClonesArray*)(*fCtype)[id]);
407 new(lcl[fNctype[id]++]) AliITSRawClusterSPD(*((AliITSRawClusterSPD*)c));
410 new(lcl[fNctype[id]++]) AliITSRawClusterSDD(*((AliITSRawClusterSDD*)c));
413 new(lcl[fNctype[id]++]) AliITSRawClusterSSD(*((AliITSRawClusterSSD*)c));
420 //_____________________________________________________________________________
421 void AliITS::AddRecPoint(const AliITSRecPoint &r)
424 // Add a reconstructed space point to the list
426 TClonesArray &lrecp = *fRecPoints;
427 new(lrecp[fNRecPoints++]) AliITSRecPoint(r);
431 //____________________________________________
432 void AliITS::ResetDigits()
435 // Reset number of digits and the digits array for the ITS detector
441 for (i=0;i<fgkNTYPES;i++ ) {
442 if ((*fDtype)[i]) ((TClonesArray*)(*fDtype)[i])->Clear();
443 if (fNdtype) fNdtype[i]=0;
447 //____________________________________________
448 void AliITS::ResetDigits(Int_t i)
451 // Reset number of digits and the digits array for this branch
453 if ((*fDtype)[i]) ((TClonesArray*)(*fDtype)[i])->Clear();
454 if (fNdtype) fNdtype[i]=0;
458 //____________________________________________
459 void AliITS::ResetClusters()
462 // Reset number of clusters and the clusters array for ITS
466 for (i=0;i<fgkNTYPES;i++ ) {
467 if ((*fCtype)[i]) ((TClonesArray*)(*fCtype)[i])->Clear();
468 if (fNctype) fNctype[i]=0;
473 //____________________________________________
474 void AliITS::ResetClusters(Int_t i)
477 // Reset number of clusters and the clusters array for this branch
479 if ((*fCtype)[i]) ((TClonesArray*)(*fCtype)[i])->Clear();
480 if (fNctype) fNctype[i]=0;
485 //____________________________________________
486 void AliITS::ResetRecPoints()
489 // Reset number of rec points and the rec points array
491 if (fRecPoints) fRecPoints->Clear();
496 //_____________________________________________________________________________
497 Int_t AliITS::DistancetoPrimitive(Int_t , Int_t ){
499 // Distance from mouse to ITS on the screen. Dummy routine
500 // A dummy routine used by the ROOT macro display.C to allow for the
501 // use of the mouse (pointing device) in the macro. In general this should
502 // never be called. If it is it returns the number 9999 for any value of
508 //_____________________________________________________________________________
511 // Initialise ITS after it has been built
512 // This routine initializes the AliITS class. It is intended to be called
513 // from the Init function in AliITSv?. Besides displaying a banner
514 // indicating that it has been called it initializes the array fIdSens
515 // and sets the default segmentation, response, digit and raw cluster classes
516 // Therefore it should be called after a call to CreateGeometry.
524 for(i=0;i<35;i++) printf("*");
525 printf(" ITS_INIT ");
526 for(i=0;i<35;i++) printf("*");
530 for(i=0;i<fIdN;i++) fIdSens[i] = gMC->VolId(fIdName[i]);
532 for(i=0;i<80;i++) printf("*");
536 //_____________________________________________________________________________
537 void AliITS::SetDefaults()
539 // sets the default segmentation, response, digit and raw cluster classes
541 printf("SetDefaults\n");
543 AliITSDetType *iDetType;
547 AliITSsegmentationSPD *seg0=new AliITSsegmentationSPD(fITSgeom);
548 AliITSresponseSPD *resp0=new AliITSresponseSPD();
550 if (!iDetType->GetSegmentationModel()) SetSegmentationModel(0,seg0);
551 if (!iDetType->GetResponseModel()) SetResponseModel(0,resp0);
552 // set digit and raw cluster classes to be used
553 const char *kData0=resp0->DataType();
554 if (strstr(kData0,"real")) {
555 iDetType->ClassNames("AliITSdigit","AliITSRawClusterSPD");
556 } else iDetType->ClassNames("AliITSdigitSPD","AliITSRawClusterSPD");
559 AliITSresponseSDD *resp1=new AliITSresponseSDD();
560 AliITSsegmentationSDD *seg1=new AliITSsegmentationSDD(fITSgeom,resp1);
562 printf("SetDefaults: iDetType %p\n",iDetType);
563 if (!iDetType->GetSegmentationModel()) SetSegmentationModel(1,seg1);
564 printf("SetDefaults: segm %p\n",iDetType->GetSegmentationModel());
565 if (!iDetType->GetResponseModel()) SetResponseModel(1,resp1);
566 printf("SetDefaults: resp %p\n",iDetType->GetResponseModel());
567 const char *kData1=resp1->DataType();
568 const char *kopt=resp1->ZeroSuppOption();
569 if ((!strstr(kopt,"2D")) && (!strstr(kopt,"1D")) || strstr(kData1,"real") ) {
570 iDetType->ClassNames("AliITSdigit","AliITSRawClusterSDD");
571 } else iDetType->ClassNames("AliITSdigitSDD","AliITSRawClusterSDD");
574 AliITSsegmentationSSD *seg2=new AliITSsegmentationSSD(fITSgeom);
575 AliITSresponseSSD *resp2=new AliITSresponseSSD();
577 if (!iDetType->GetSegmentationModel()) SetSegmentationModel(2,seg2);
578 if (!iDetType->GetResponseModel()) SetResponseModel(2,resp2);
579 const char *kData2=resp2->DataType();
580 if (strstr(kData2,"real")) {
581 iDetType->ClassNames("AliITSdigit","AliITSRawClusterSSD");
582 } else iDetType->ClassNames("AliITSdigitSSD","AliITSRawClusterSSD");
585 Warning("SetDefaults","Only the three basic detector types are initialised!");
591 //_____________________________________________________________________________
592 void AliITS::SetDefaultSimulation()
597 //_____________________________________________________________________________
598 void AliITS::SetDefaultClusterFinders()
603 //_____________________________________________________________________________
605 void AliITS::MakeTreeC(Option_t *option)
607 // create a separate tree to store the clusters
609 printf("MakeTreeC \n");
611 char *optC = strstr(option,"C");
612 if (optC && !fTreeC) fTreeC = new TTree("TC","Clusters in ITS");
615 Int_t buffersize = 4000;
618 char *det[3] = {"SPD","SDD","SSD"};
620 // one branch for Clusters per type of detector
622 for (i=0; i<fgkNTYPES ;i++) {
623 if (fgkNTYPES==3) sprintf(branchname,"%sClusters%s",GetName(),det[i]);
624 else sprintf(branchname,"%sClusters%d",GetName(),i+1);
625 if (fCtype && fTreeC) {
626 TreeC()->Branch(branchname,&((*fCtype)[i]), buffersize);
627 printf("Making Branch %s for Clusters of detector type %d\n",branchname,i+1);
633 //_____________________________________________________________________________
634 void AliITS::GetTreeC(Int_t event)
637 printf("GetTreeC \n");
639 // get the clusters tree for this event and set the branch address
643 char *det[3] = {"SPD","SDD","SSD"};
650 sprintf(treeName,"TreeC%d",event);
651 fTreeC = (TTree*)gDirectory->Get(treeName);
657 for (i=0; i<fgkNTYPES; i++) {
658 if (fgkNTYPES==3) sprintf(branchname,"%sClusters%s",GetName(),det[i]);
659 else sprintf(branchname,"%sClusters%d",GetName(),i+1);
661 branch = fTreeC->GetBranch(branchname);
662 if (branch) branch->SetAddress(&((*fCtype)[i]));
666 printf("ERROR: cannot find Clusters Tree for event:%d\n",event);
670 //_____________________________________________________________________________
671 void AliITS::MakeBranch(Option_t* option){
673 // Creates Tree branches for the ITS.
677 Int_t buffersize = 4000;
679 sprintf(branchname,"%s",GetName());
681 AliDetector::MakeBranch(option);
684 // one branch for digits per type of detector
686 char *det[3] = {"SPD","SDD","SSD"};
692 for (i=0; i<fgkNTYPES ;i++) {
693 AliITSDetType *iDetType=DetType(i);
694 iDetType->GetClassNames(digclass,clclass);
695 //printf("i, digclass, recclass %d %s %s\n",i,digclass,clclass);
697 (*fDtype)[i] = new TClonesArray(digclass,10000);
699 (*fCtype)[i] = new TClonesArray(clclass,10000);
703 for (i=0; i<fgkNTYPES ;i++) {
704 if (fgkNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]);
705 else sprintf(branchname,"%sDigits%d",GetName(),i+1);
707 if (fDtype && gAlice->TreeD()) {
708 gAlice->TreeD()->Branch(branchname,&((*fDtype)[i]), buffersize);
709 printf("Making Branch %s for digits of type %d\n",branchname,i+1);
713 // only one branch for rec points for all detector types
714 sprintf(branchname,"%sRecPoints",GetName());
716 fRecPoints=new TClonesArray("AliITSRecPoint",10000);
718 if (fRecPoints && gAlice->TreeR()) {
719 gAlice->TreeR()->Branch(branchname,&fRecPoints, buffersize);
720 printf("Making Branch %s for reconstructed space points\n",branchname);
726 //___________________________________________
727 void AliITS::SetTreeAddress()
730 // Set branch address for the Trees.
733 AliDetector::SetTreeAddress();
735 char *det[3] = {"SPD","SDD","SSD"};
738 TTree *treeD = gAlice->TreeD();
739 TTree *treeR = gAlice->TreeR();
743 for (i=0; i<fgkNTYPES; i++) {
744 if (fgkNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]);
745 else sprintf(branchname,"%sDigits%d",GetName(),i+1);
747 branch = treeD->GetBranch(branchname);
748 if (branch) branch->SetAddress(&((*fDtype)[i]));
755 sprintf(branchname,"%sRecPoints",GetName());
757 branch = treeR->GetBranch(branchname);
758 if (branch) branch->SetAddress(&fRecPoints);
765 //____________________________________________________________________________
766 void AliITS::InitModules(Int_t size,Int_t &nmodules){
768 //initialize the modules array
771 fITSmodules->Delete();
775 Int_t nl,indexMAX,index;
777 if(size<=0){ // default to using data stored in AliITSgeom
779 printf("Error in AliITS::InitModule fITSgeom not defined\n");
781 } // end if fITSgeom==0
782 nl = fITSgeom->GetNlayers();
783 indexMAX = fITSgeom->GetModuleIndex(nl,fITSgeom->GetNladders(nl),
784 fITSgeom->GetNdetectors(nl))+1;
786 fITSmodules = new TObjArray(indexMAX);
787 for(index=0;index<indexMAX;index++){
788 fITSmodules->AddAt( new AliITSmodule(index),index);
791 fITSmodules = new TObjArray(size);
792 for(index=0;index<size;index++) {
793 fITSmodules->AddAt( new AliITSmodule(index),index);
800 //____________________________________________________________________________
801 void AliITS::FillModules(Int_t evnt,Int_t bgrev,Int_t nmodules,Option_t *option,Text_t *filename){
803 // fill the modules with the sorted by module hits; add hits from background
807 static TTree *trH1; //Tree with background hits
808 static TClonesArray *fHits2; //List of hits for one track only
810 static Bool_t first=kTRUE;
812 char *addBgr = strstr(option,"Add");
817 cout<<"filename "<<filename<<endl;
818 file=new TFile(filename);
819 cout<<"I have opened "<<filename<<" file "<<endl;
820 fHits2 = new TClonesArray("AliITShit",1000 );
825 // Get Hits Tree header from file
826 if(fHits2) fHits2->Clear();
827 if(trH1) delete trH1;
831 sprintf(treeName,"TreeH%d",bgrev);
832 trH1 = (TTree*)gDirectory->Get(treeName);
833 //printf("TrH1 %p of treename %s for event %d \n",trH1,treeName,bgrev);
836 printf("ERROR: cannot find Hits Tree for event:%d\n",bgrev);
838 // Set branch addresses
841 sprintf(branchname,"%s",GetName());
842 if (trH1 && fHits2) {
843 branch = trH1->GetBranch(branchname);
844 if (branch) branch->SetAddress(&fHits2);
848 //Int_t ntracks1 =(Int_t)TrH1->GetEntries();
849 //printf("background - ntracks1 - %d\n",ntracks1);
852 Int_t npart = gAlice->GetEvent(evnt);
854 TClonesArray *itsHits = this->Hits();
855 Int_t lay,lad,det,index;
859 TTree *iTH = gAlice->TreeH();
860 Int_t ntracks =(Int_t) iTH->GetEntries();
863 for(t=0; t<ntracks; t++){
866 Int_t nhits = itsHits->GetEntriesFast();
867 //printf("nhits %d\n",nhits);
868 if (!nhits) continue;
869 for(h=0; h<nhits; h++){
870 itsHit = (AliITShit *)itsHits->UncheckedAt(h);
871 itsHit->GetDetectorID(lay,lad,det);
872 // temporarily index=det-1 !!!
873 if(fITSgeom) index = fITSgeom->GetModuleIndex(lay,lad,det);
876 mod = this->GetModule(index);
877 mod->AddHit(itsHit,t,h);
878 } // end loop over hits
879 } // end loop over tracks
881 // open the file with background
885 ntracks =(Int_t)trH1->GetEntries();
886 //printf("background - ntracks1 %d\n",ntracks);
887 //printf("background - Start loop over tracks \n");
890 for (track=0; track<ntracks; track++) {
892 if (fHits2) fHits2->Clear();
893 trH1->GetEvent(track);
895 for(i=0;i<fHits2->GetEntriesFast();++i) {
897 itsHit=(AliITShit*) (*fHits2)[i];
898 itsHit->GetDetectorID(lay,lad,det);
899 // temporarily index=det-1 !!!
900 if(fITSgeom) index = fITSgeom->GetModuleIndex(lay,lad,det);
903 mod = this->GetModule(index);
904 mod->AddHit(itsHit,track,i);
905 } // end loop over hits
906 } // end loop over tracks
908 TTree *fAli=gAlice->TreeK();
911 if (fAli) fileAli =fAli->GetCurrentFile();
916 //gObjectTable->Print();
921 //____________________________________________________________________________
922 void AliITS::HitsToDigits(Int_t evNumber,Int_t bgrev,Int_t size, Option_t *option, Option_t *opt,Text_t *filename)
924 // keep galice.root for signal and name differently the file for
925 // background when add! otherwise the track info for signal will be lost !
927 // the condition below will disappear when the geom class will be
928 // initialised for all versions - for the moment it is only for v5 !
929 // 7 is the SDD beam test version
930 Int_t ver = this->IsVersion();
931 if(ver!=5 && ver!=7) return;
933 char *all = strstr(opt,"All");
934 char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),strstr(opt,"SSD")};
937 InitModules(size,nmodules);
938 FillModules(evNumber,bgrev,nmodules,option,filename);
941 AliITSsimulation* sim;
942 //TObjArray *branches=gAlice->TreeD()->GetListOfBranches();
943 AliITSgeom *geom = GetITSgeom();
947 for (id=0;id<fgkNTYPES;id++) {
948 if (!all && !det[id]) continue;
949 //branch = (TBranch*)branches->UncheckedAt(id);
950 AliITSDetType *iDetType=DetType(id);
951 sim = (AliITSsimulation*)iDetType->GetSimulationModel();
953 Error("HitsToDigits","The simulation class was not instantiated!");
955 // or SetDefaultSimulation();
958 first = geom->GetStartDet(id);
959 last = geom->GetLastDet(id);
961 printf("det type %d first, last %d %d \n",id,first,last);
962 for(module=first;module<=last;module++) {
963 AliITSmodule *mod = (AliITSmodule *)fITSmodules->At(module);
964 sim->DigitiseModule(mod,module,evNumber);
965 // fills all branches - wasted disk space
966 gAlice->TreeD()->Fill();
968 // try and fill only the branch
971 } // loop over modules
972 } // loop over detector types
976 Int_t nentries=(Int_t)gAlice->TreeD()->GetEntries();
977 printf("nentries in TreeD %d\n",nentries);
980 sprintf(hname,"TreeD%d",evNumber);
981 gAlice->TreeD()->Write(hname);
983 gAlice->TreeD()->Reset();
988 //____________________________________________________________________________
989 void AliITS::DigitsToRecPoints(Int_t evNumber,Int_t lastentry,Option_t *opt)
991 // cluster finding and reconstruction of space points
993 // the condition below will disappear when the geom class will be
994 // initialised for all versions - for the moment it is only for v5 !
995 // 7 is the SDD beam test version
996 Int_t ver = this->IsVersion();
997 if(ver!=5 && ver!=7) return;
999 char *all = strstr(opt,"All");
1000 char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),strstr(opt,"SSD")};
1002 static Bool_t first=kTRUE;
1011 AliITSClusterFinder* rec;
1013 //TObjArray *branches=gAlice->TreeR()->GetListOfBranches();
1014 AliITSgeom *geom = GetITSgeom();
1017 for (id=0;id<fgkNTYPES;id++) {
1018 if (!all && !det[id]) continue;
1019 //branch = (TBranch*)branches->UncheckedAt(id);
1020 AliITSDetType *iDetType=DetType(id);
1021 rec = (AliITSClusterFinder*)iDetType->GetReconstructionModel();
1023 Error("DigitsToRecPoints","The cluster finder class was not instantiated!");
1025 // or SetDefaultClusterFinders();
1027 TClonesArray *itsDigits = this->DigitsAddress(id);
1031 first = geom->GetStartDet(id);
1032 last = geom->GetLastDet(id);
1033 } else first=last=0;
1034 //printf("first last %d %d\n",first,last);
1035 for(module=first;module<=last;module++) {
1036 this->ResetDigits();
1037 if (all) gAlice->TreeD()->GetEvent(lastentry+module);
1038 else gAlice->TreeD()->GetEvent(lastentry+(module-first));
1039 Int_t ndigits = itsDigits->GetEntriesFast();
1040 if (ndigits) rec->FindRawClusters();
1041 gAlice->TreeR()->Fill();
1045 // try and fill only the branch
1047 //ResetRecPoints(id);
1048 } // loop over modules
1049 } // loop over detector types
1052 Int_t nentries=(Int_t)gAlice->TreeR()->GetEntries();
1053 Int_t ncentries=(Int_t)iTC->GetEntries();
1054 printf(" nentries ncentries %d %d\n", nentries, ncentries);
1057 sprintf(hname,"TreeR%d",evNumber);
1058 gAlice->TreeR()->Write(hname);
1060 gAlice->TreeR()->Reset();
1062 sprintf(hname,"TreeC%d",evNumber);
1068 //____________________________________________________________________________
1069 void AliITS::HitsToFastRecPoints(Int_t evNumber,Int_t bgrev,Int_t size,
1070 Option_t *option,Option_t *opt,Text_t *filename)
1072 // keep galice.root for signal and name differently the file for
1073 // background when add! otherwise the track info for signal will be lost !
1076 // the condition below will disappear when the geom class will be
1077 // initialised for all versions - for the moment it is only for v5 !
1078 Int_t ver = this->IsVersion();
1081 char *all = strstr(opt,"All");
1082 char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),strstr(opt,"SSD")};
1085 InitModules(size,nmodules);
1086 FillModules(evNumber,bgrev,nmodules,option,filename);
1089 AliITSsimulation* sim;
1090 AliITSgeom *geom = GetITSgeom();
1092 TRandom *random=new TRandom[9];
1093 random[0].SetSeed(111);
1094 random[1].SetSeed(222);
1095 random[2].SetSeed(333);
1096 random[3].SetSeed(444);
1097 random[4].SetSeed(555);
1098 random[5].SetSeed(666);
1099 random[6].SetSeed(777);
1100 random[7].SetSeed(888);
1101 random[8].SetSeed(999);
1105 for (id=0;id<fgkNTYPES;id++) {
1106 if (!all && !det[id]) continue;
1107 AliITSDetType *iDetType=DetType(id);
1108 sim = (AliITSsimulation*)iDetType->GetSimulationModel();
1110 Error("HitsToFastPoints","The simulation class was not instantiated!");
1112 // or SetDefaultSimulation();
1114 Int_t first = geom->GetStartDet(id);
1115 Int_t last = geom->GetLastDet(id);
1116 for(module=first;module<=last;module++) {
1117 AliITSmodule *mod = (AliITSmodule *)fITSmodules->At(module);
1118 sim->CreateFastRecPoints(mod,module,random);
1119 gAlice->TreeR()->Fill();
1121 } // loop over modules
1122 } // loop over detector types
1127 //Int_t nentries=(Int_t)gAlice->TreeR()->GetEntries();
1130 sprintf(hname,"TreeR%d",evNumber);
1131 gAlice->TreeR()->Write(hname);
1133 gAlice->TreeR()->Reset();
1139 //____________________________________________________________________________
1140 void AliITS::Streamer(TBuffer &R__b){
1141 // Stream an object of class AliITS.
1145 if (R__b.IsReading()) {
1146 Version_t R__v = R__b.ReadVersion();
1148 AliDetector::Streamer(R__b);
1150 R__b.ReadArray(fIdSens);
1151 for(i=0;i<fIdN;i++) fIdName[i].Streamer(R__b);
1153 R__b >> fITSmodules;
1155 R__b >> fMajorVersion;
1156 R__b >> fMinorVersion;
1160 fNdtype = new Int_t[fgkNTYPES];
1161 R__b.ReadFastArray(fNdtype,fgkNTYPES);
1164 fNctype = new Int_t[fgkNTYPES];
1165 R__b.ReadFastArray(fNctype,fgkNTYPES);
1167 R__b >> fNRecPoints;
1171 R__b.WriteVersion(AliITS::IsA());
1172 AliDetector::Streamer(R__b);
1174 R__b.WriteArray(fIdSens,fIdN);
1175 for(i=0;i<fIdN;i++) fIdName[i].Streamer(R__b);
1177 R__b << fITSmodules;
1179 R__b << fMajorVersion;
1180 R__b << fMinorVersion;
1183 R__b.WriteFastArray(fNdtype,fgkNTYPES);
1185 R__b.WriteFastArray(fNctype,fgkNTYPES);
1187 R__b << fNRecPoints;