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 **************************************************************************/
19 ///////////////////////////////////////////////////////////////////////////////
21 // An overview of the basic philosophy of the ITS code development
22 // and analysis is show in the figure below.
25 <img src="picts/ITS/ITS_Analysis_schema.gif">
28 <font size=+2 color=red>
29 <p>Roberto Barbera is in charge of the ITS Offline code (1999).
30 <a href="mailto:roberto.barbera@ct.infn.it">Roberto Barbera</a>.
36 // AliITS. Inner Traking System base class.
37 // This class contains the base procedures for the Inner Tracking System
41 <img src="picts/ITS/AliITS_Class_Diagram.gif">
44 <font size=+2 color=red>
45 <p>This show the class diagram of the different elements that are part of
53 // Written by Rene Brun, Federico Carminati, and Roberto Barbera
56 // Modified and documented by Bjorn S. Nilsen
60 // Modified and documented by A. Bologna
63 // AliITS is the general base class for the ITS. Also see AliDetector for
64 // futher information.
66 ///////////////////////////////////////////////////////////////////////////////
68 #include <Riostream.h>
72 #include <TClonesArray.h>
75 #include <TObjectTable.h>
81 #include <TVirtualMC.h>
83 #include "AliConfig.h"
84 #include "AliHeader.h"
86 #include "AliITSClusterFinderSDD.h"
87 #include "AliITSClusterFinderSPD.h"
88 #include "AliITSClusterFinderSSD.h"
89 #include "AliITSDetType.h"
90 #include "AliITSLoader.h"
91 #include "AliITSRawClusterSPD.h"
92 #include "AliITSRawClusterSDD.h"
93 #include "AliITSRawClusterSSD.h"
94 #include "AliITSRecPoint.h"
95 #include "AliITSdigitSPD.h"
96 #include "AliITSdigitSDD.h"
97 #include "AliITSdigitSSD.h"
98 #include "AliITSgeom.h"
99 #include "AliITShit.h"
100 #include "AliITSmodule.h"
101 #include "AliITSpList.h"
102 #include "AliITSresponseSDD.h"
103 #include "AliITSresponseSPD.h"
104 #include "AliITSresponseSSD.h"
105 #include "AliITSsegmentationSDD.h"
106 #include "AliITSsegmentationSPD.h"
107 #include "AliITSsegmentationSSD.h"
108 #include "AliITSsimulationSDD.h"
109 #include "AliITSsimulationSPD.h"
110 #include "AliITSsimulationSSD.h"
112 #include "AliITSDigitizer.h"
113 #include "AliITSDDLRawData.h"
118 //______________________________________________________________________
119 AliITS::AliITS() : AliDetector(),
137 fSelectedVertexer(0){
138 // Default initializer for ITS
139 // The default constructor of the AliITS class. In addition to
140 // creating the AliITS class it zeros the variables fIshunt (a member
141 // of AliDetector class), fEuclidOut, and fIdN, and zeros the pointers
142 // fITSpoints, fIdSens, and fIdName. The AliDetector default constructor
151 fIshunt = 0; // not zeroed in AliDetector.
154 // SetDetectors(); // default to fOpt="All". This variable not written out.
155 SetMarkerColor(kRed);
158 //______________________________________________________________________
159 AliITS::AliITS(const char *name, const char *title):AliDetector(name,title),
177 fSelectedVertexer(0){
178 // The standard Constructor for the ITS class. In addition to
179 // creating the AliITS class, it allocates memory for the TClonesArrays
180 // fHits, fSDigits, fDigits, fITSpoints, and the TObjArray of fCtype
181 // (clusters). 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
184 // ROOT macro display.C AliITS also sets the marker color to red. The
185 // variables passes with this constructor, const char *name and *title,
186 // are used by the constructor of AliDetector class. See AliDetector
187 // class for a description of these parameters and its constructor
190 // const char *name Detector name. Should always be "ITS"
191 // const char *title Detector title.
197 fIshunt = 0; // not zeroed in AliDetector
198 fHits = new TClonesArray("AliITShit", 1560);//not done in AliDetector
199 if(gAlice->GetMCApp()) gAlice->GetMCApp()->AddHitList(fHits);// Not done in AliDetector.
204 SetDetectors(); // default to fOpt="All". This variable not written out.
210 fNDetTypes = kNTYPES;
211 fDetTypes = new TObjArray(fNDetTypes);
213 fSDigits = new TClonesArray("AliITSpListItem",1000);
216 fNdtype = new Int_t[fNDetTypes];
217 fDtype = new TObjArray(fNDetTypes);
219 fCtype = new TObjArray(fNDetTypes);
220 fNctype = new Int_t[fNDetTypes];
222 fRecPoints = new TClonesArray("AliITSRecPoint",1000);
226 for(i=0;i<fNDetTypes;i++) {
227 fDetTypes->AddAt(new AliITSDetType(),i);
232 SetMarkerColor(kRed);
235 //______________________________________________________________________
237 // Default destructor for ITS.
238 // The default destructor of the AliITS class. In addition to deleting
239 // the AliITS class it deletes the memory pointed to by the fHits, fDigits,
240 // fSDigits, fCtype, fITSmodules, fITSgeom, fRecPoints, fIdSens, fIdName,
241 // fITSpoints, fDetType and it's contents.
265 fRecPoints->Delete();
269 delete[] fIdName; // Array of TStrings
272 this->ClearModules();
275 }// end if fITSmodules!=0
293 } // end if fDetTypes
296 if (fITSgeom) delete fITSgeom;
298 //______________________________________________________________________
299 AliITS::AliITS(const AliITS &source) : AliDetector(source){
300 // Copy constructor. This is a function which is not allowed to be
301 // done to the ITS. It exits with an error.
303 // AliITS &source An AliITS class.
309 if(this==&source) return;
310 Error("Copy constructor",
311 "You are not allowed to make a copy of the AliITS");
314 //______________________________________________________________________
315 AliITS& AliITS::operator=(AliITS &source){
316 // Assignment operator. This is a function which is not allowed to be
317 // done to the ITS. It exits with an error.
319 // AliITS &source An AliITS class.
325 if(this==&source) return *this;
326 Error("operator=","You are not allowed to make a copy of the AliITS");
328 return *this; //fake return
330 //______________________________________________________________________
331 Int_t AliITS::DistancetoPrimitive(Int_t,Int_t) const{
332 // Distance from mouse to ITS on the screen. Dummy routine
333 // A dummy routine used by the ROOT macro display.C to allow for the
334 // use of the mouse (pointing device) in the macro. In general this should
335 // never be called. If it is it returns the number 9999 for any value of
338 // Int_t Dummy screen coordinate.
339 // Int_t Dummy screen coordinate.
343 // Int_t Dummy = 9999 distance to ITS.
347 //______________________________________________________________________
349 // Initializer ITS after it has been built
350 // This routine initializes the AliITS class. It is intended to be
351 // called from the Init function in AliITSv?. Besides displaying a banner
352 // indicating that it has been called it initializes the array fIdSens
353 // and sets the default segmentation, response, digit and raw cluster
354 // classes therefore it should be called after a call to CreateGeometry.
365 if(gMC) for(i=0;i<fIdN;i++) fIdSens[i] = gMC->VolId(fIdName[i]);
367 //______________________________________________________________________
368 void AliITS::SetDefaults(){
369 // sets the default segmentation, response, digit and raw cluster classes.
377 if(fDebug) printf("%s: SetDefaults\n",ClassName());
379 AliITSDetType *iDetType;
383 if (!iDetType->GetSegmentationModel()) {
384 AliITSsegmentationSPD *seg0=new AliITSsegmentationSPD(fITSgeom);
385 SetSegmentationModel(0,seg0);
387 if (!iDetType->GetResponseModel()) {
388 SetResponseModel(0,new AliITSresponseSPD());
390 // set digit and raw cluster classes to be used
392 const char *kData0=(iDetType->GetResponseModel())->DataType();
393 if (strstr(kData0,"real")) {
394 iDetType->ClassNames("AliITSdigit","AliITSRawClusterSPD");
395 } else iDetType->ClassNames("AliITSdigitSPD","AliITSRawClusterSPD");
399 if (!iDetType->GetResponseModel()) {
400 SetResponseModel(1,new AliITSresponseSDD("simulated"));
402 AliITSresponse *resp1=iDetType->GetResponseModel();
403 if (!iDetType->GetSegmentationModel()) {
404 AliITSsegmentationSDD *seg1=new AliITSsegmentationSDD(fITSgeom,resp1);
405 SetSegmentationModel(1,seg1);
407 const char *kData1=(iDetType->GetResponseModel())->DataType();
408 const char *kopt=iDetType->GetResponseModel()->ZeroSuppOption();
409 if((!strstr(kopt,"2D"))&&(!strstr(kopt,"1D")) || strstr(kData1,"real") ){
410 iDetType->ClassNames("AliITSdigit","AliITSRawClusterSDD");
411 } else iDetType->ClassNames("AliITSdigitSDD","AliITSRawClusterSDD");
415 if (!iDetType->GetSegmentationModel()) {
416 AliITSsegmentationSSD *seg2=new AliITSsegmentationSSD(fITSgeom);
417 SetSegmentationModel(2,seg2);
419 if (!iDetType->GetResponseModel()) {
420 SetResponseModel(2,new AliITSresponseSSD("simulated"));
422 const char *kData2=(iDetType->GetResponseModel())->DataType();
423 if (strstr(kData2,"real")) {
424 iDetType->ClassNames("AliITSdigit","AliITSRawClusterSSD");
425 } else iDetType->ClassNames("AliITSdigitSSD","AliITSRawClusterSSD");
428 Warning("SetDefaults",
429 "Only the three basic detector types are initialized!");
432 //______________________________________________________________________
433 void AliITS::SetDefaultSimulation(){
434 // sets the default simulation.
442 AliITSDetType *iDetType;
443 AliITSsimulation *sim;
445 sim = iDetType->GetSimulationModel();
447 AliITSsegmentation *seg0=
448 (AliITSsegmentation*)iDetType->GetSegmentationModel();
449 AliITSresponse *res0 = (AliITSresponse*)iDetType->GetResponseModel();
450 AliITSsimulationSPD *sim0=new AliITSsimulationSPD(seg0,res0);
451 SetSimulationModel(0,sim0);
452 }else{ // simulation exists, make sure it is set up properly.
453 ((AliITSsimulationSPD*)sim)->Init(
454 (AliITSsegmentationSPD*) iDetType->GetSegmentationModel(),
455 (AliITSresponseSPD*) iDetType->GetResponseModel());
456 // if(sim->GetResponseModel()==0) sim->SetResponseModel(
457 // (AliITSresponse*)iDetType->GetResponseModel());
458 // if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel(
459 // (AliITSsegmentation*)iDetType->GetSegmentationModel());
462 sim = iDetType->GetSimulationModel();
464 AliITSsegmentation *seg1=
465 (AliITSsegmentation*)iDetType->GetSegmentationModel();
466 AliITSresponse *res1 = (AliITSresponse*)iDetType->GetResponseModel();
467 AliITSsimulationSDD *sim1=new AliITSsimulationSDD(seg1,res1);
468 SetSimulationModel(1,sim1);
469 }else{ // simulation exists, make sure it is set up properly.
470 ((AliITSsimulationSDD*)sim)->Init(
471 (AliITSsegmentationSDD*) iDetType->GetSegmentationModel(),
472 (AliITSresponseSDD*) iDetType->GetResponseModel());
473 // if(sim->GetResponseModel()==0) sim->SetResponseModel(
474 // (AliITSresponse*)iDetType->GetResponseModel());
475 // if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel(
476 // (AliITSsegmentation*)iDetType->GetSegmentationModel());
479 sim = iDetType->GetSimulationModel();
481 AliITSsegmentation *seg2=
482 (AliITSsegmentation*)iDetType->GetSegmentationModel();
483 AliITSresponse *res2 = (AliITSresponse*)iDetType->GetResponseModel();
484 AliITSsimulationSSD *sim2=new AliITSsimulationSSD(seg2,res2);
485 SetSimulationModel(2,sim2);
486 }else{ // simulation exists, make sure it is set up properly.
487 ((AliITSsimulationSSD*)sim)->Init(
488 (AliITSsegmentationSSD*) iDetType->GetSegmentationModel(),
489 (AliITSresponseSSD*) iDetType->GetResponseModel());
490 // if(sim->GetResponseModel()==0) sim->SetResponseModel(
491 // (AliITSresponse*)iDetType->GetResponseModel());
492 // if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel(
493 // (AliITSsegmentation*)iDetType->GetSegmentationModel());
496 //______________________________________________________________________
497 void AliITS::SetDefaultClusterFinders(){
498 // Sets the default cluster finders. Used in finding RecPoints.
507 AliITSDetType *iDetType;
511 if (!iDetType->GetReconstructionModel()) {
512 AliITSsegmentation *seg0 =
513 (AliITSsegmentation*)iDetType->GetSegmentationModel();
514 TClonesArray *dig0=DigitsAddress(0);
515 TClonesArray *recp0=ClustersAddress(0);
516 AliITSClusterFinderSPD *rec0 = new AliITSClusterFinderSPD(seg0,dig0,
518 SetReconstructionModel(0,rec0);
523 if (!iDetType->GetReconstructionModel()) {
524 AliITSsegmentation *seg1 =
525 (AliITSsegmentation*)iDetType->GetSegmentationModel();
526 AliITSresponse *res1 = (AliITSresponse*)iDetType->GetResponseModel();
527 TClonesArray *dig1=DigitsAddress(1);
528 TClonesArray *recp1=ClustersAddress(1);
529 AliITSClusterFinderSDD *rec1 =
530 new AliITSClusterFinderSDD(seg1,res1,dig1,recp1);
531 SetReconstructionModel(1,rec1);
536 if (!iDetType->GetReconstructionModel()) {
537 AliITSsegmentation *seg2=
538 (AliITSsegmentation*)iDetType->GetSegmentationModel();
539 TClonesArray *dig2=DigitsAddress(2);
540 AliITSClusterFinderSSD *rec2= new AliITSClusterFinderSSD(seg2,dig2);
541 SetReconstructionModel(2,rec2);
544 //______________________________________________________________________
545 void AliITS::MakeBranch(Option_t* option){
546 // Creates Tree branches for the ITS.
548 // Option_t *option String of Tree types S,D, and/or R.
549 // const char *file String of the file name where these branches
550 // are to be stored. If blank then these branches
551 // are written to the same tree as the Hits were
557 Bool_t cH = (strstr(option,"H")!=0);
558 Bool_t cS = (strstr(option,"S")!=0);
559 Bool_t cD = (strstr(option,"D")!=0);
560 Bool_t cR = (strstr(option,"R")!=0);
561 Bool_t cRF = (strstr(option,"RF")!=0);
564 if(cH && (fHits == 0x0)) fHits = new TClonesArray("AliITShit", 1560);
566 AliDetector::MakeBranch(option);
568 if(cS) MakeBranchS(0);
569 if(cD) MakeBranchD(0);
570 if(cR) MakeBranchR(0);
571 if(cRF) MakeBranchRF(0);
573 //______________________________________________________________________
574 void AliITS::SetTreeAddress(){
575 // Set branch address for the Trees.
582 TTree *treeS = fLoader->TreeS();
583 TTree *treeD = fLoader->TreeD();
584 TTree *treeR = fLoader->TreeR();
585 if (fLoader->TreeH() && (fHits == 0x0)) fHits = new TClonesArray("AliITShit", 1560);
587 AliDetector::SetTreeAddress();
589 SetTreeAddressS(treeS);
590 SetTreeAddressD(treeD);
591 SetTreeAddressR(treeR);
593 //______________________________________________________________________
594 AliITSDetType* AliITS::DetType(Int_t id){
595 // Return pointer to id detector type.
597 // Int_t id detector id number.
601 // returned, a pointer to a AliITSDetType.
603 return ((AliITSDetType*) fDetTypes->At(id));
605 //______________________________________________________________________
606 void AliITS::SetResponseModel(Int_t id, AliITSresponse *response){
607 // Set the response model for the id detector type.
609 // Int_t id detector id number.
610 // AliITSresponse* a pointer containing an instance of AliITSresponse
611 // to be stored/owned b y AliITSDetType.
617 ((AliITSDetType*) fDetTypes->At(id))->ResponseModel(response);
619 //______________________________________________________________________
620 void AliITS::SetSegmentationModel(Int_t id, AliITSsegmentation *seg){
621 // Set the segmentation model for the id detector type.
623 // Int_t id detector id number.
624 // AliITSsegmentation* a pointer containing an instance of
625 // AliITSsegmentation to be stored/owned b y
632 ((AliITSDetType*) fDetTypes->At(id))->SegmentationModel(seg);
634 //______________________________________________________________________
635 void AliITS::SetSimulationModel(Int_t id, AliITSsimulation *sim){
636 // Set the simulation model for the id detector type.
638 // Int_t id detector id number.
639 // AliITSresponse* a pointer containing an instance of AliITSresponse
640 // to be stored/owned b y AliITSDetType.
646 ((AliITSDetType*) fDetTypes->At(id))->SimulationModel(sim);
649 //______________________________________________________________________
650 void AliITS::SetReconstructionModel(Int_t id, AliITSClusterFinder *reconst){
651 // Set the cluster finder model for the id detector type.
653 // Int_t id detector id number.
654 // AliITSClusterFinder* a pointer containing an instance of
655 // AliITSClusterFinder to be stored/owned b y
662 ((AliITSDetType*) fDetTypes->At(id))->ReconstructionModel(reconst);
664 //______________________________________________________________________
665 void AliITS::SetClasses(Int_t id, const char *digit, const char *cluster){
666 // Set the digit and cluster classes name to be used for the id detector
669 // Int_t id detector id number.
670 // const char *digit Digit class name for detector id.
671 // const char *cluster Cluster class name for detector id.
677 ((AliITSDetType*) fDetTypes->At(id))->ClassNames(digit,cluster);
679 //______________________________________________________________________
680 void AliITS::AddHit(Int_t track, Int_t *vol, Float_t *hits){
682 // The function to add information to the AliITShit class. See the
683 // AliITShit class for a full description. This function allocates the
684 // necessary new space for the hit information and passes the variable
685 // track, and the pointers *vol and *hits to the AliITShit constructor
688 // Int_t track Track number which produced this hit.
689 // Int_t *vol Array of Integer Hit information. See AliITShit.h
690 // Float_t *hits Array of Floating Hit information. see AliITShit.h
696 TClonesArray &lhits = *fHits;
697 new(lhits[fNhits++]) AliITShit(fIshunt,track,vol,hits);
699 //______________________________________________________________________
700 void AliITS::InitModules(Int_t size,Int_t &nmodules){
701 // Initialize the modules array.
703 // Int_t size Size of array of the number of modules to be
704 // created. If size <=0 then the number of modules
705 // is gotten from AliITSgeom class kept in fITSgeom.
707 // Int_t &nmodules The number of modules existing.
712 fITSmodules->Delete();
714 } // end fir fITSmoudles
716 Int_t nl,indexMAX,index;
718 if(size<=0){ // default to using data stored in AliITSgeom
720 Error("InitModules","fITSgeom not defined");
722 } // end if fITSgeom==0
723 nl = fITSgeom->GetNlayers();
724 indexMAX = fITSgeom->GetModuleIndex(nl,fITSgeom->GetNladders(nl),
725 fITSgeom->GetNdetectors(nl))+1;
727 fITSmodules = new TObjArray(indexMAX);
728 for(index=0;index<indexMAX;index++){
729 fITSmodules->AddAt( new AliITSmodule(index),index);
732 fITSmodules = new TObjArray(size);
733 for(index=0;index<size;index++) {
734 fITSmodules->AddAt( new AliITSmodule(index),index);
740 //______________________________________________________________________
741 void AliITS::FillModules(Int_t evnt,Int_t bgrev,Int_t nmodules,
742 Option_t *option, const char *filename){
743 // fill the modules with the sorted by module hits; add hits from
744 // background if option=Add.
746 // Int_t evnt Event to be processed.
747 // Int_t bgrev Background Hit tree number.
748 // Int_t nmodules Not used.
749 // Option_t *option String indicating if merging hits or not. To
750 // merge hits set equal to "Add". Otherwise no
751 // background hits are considered.
752 // Test_t *filename File name containing the background hits..
757 static TTree *trH1; //Tree with background hits
758 static Bool_t first=kTRUE;
760 const char *addBgr = strstr(option,"Add");
762 evnt = nmodules; // Dummy use of variables to remove warnings
765 file=new TFile(filename);
770 // Get Hits Tree header from file
771 if(trH1) delete trH1;
775 sprintf(treeName,"TreeH%d",bgrev);
776 trH1 = (TTree*)gDirectory->Get(treeName);
778 Error("FillModules","cannot find Hits Tree for event:%d",bgrev);
780 // Set branch addresses
783 FillModules(fLoader->TreeH(),0); // fill from this file's tree.
786 FillModules(trH1,10000000); // Default mask 10M.
787 TTree *fAli=fLoader->GetRunLoader()->TreeK();
789 if (fAli) fileAli =fAli->GetCurrentFile();
793 //______________________________________________________________________
794 void AliITS::FillModules(TTree *treeH, Int_t mask) {
795 // fill the modules with the sorted by module hits;
796 // can be called many times to do a merging
798 // TTree *treeH The tree containing the hits to be copied into
800 // Int_t mask The track number mask to indecate which file
801 // this hits came from.
809 Error("FillModules","Tree is NULL");
811 Int_t lay,lad,det,index;
815 sprintf(branchname,"%s",GetName());
816 TBranch *branch = treeH->GetBranch(branchname);
818 Error("FillModules","%s branch in TreeH not found",branchname);
821 branch->SetAddress(&fHits);
822 Int_t nTracks =(Int_t) treeH->GetEntries();
824 for(iPrimTrack=0; iPrimTrack<nTracks; iPrimTrack++){
826 Int_t nBytes = treeH->GetEvent(iPrimTrack);
827 if (nBytes <= 0) continue;
828 Int_t nHits = fHits->GetEntriesFast();
829 for(h=0; h<nHits; h++){
830 itsHit = (AliITShit *)fHits->UncheckedAt(h);
831 itsHit->GetDetectorID(lay,lad,det);
833 index = fITSgeom->GetModuleIndex(lay,lad,det);
835 index=det-1; // This should not be used.
836 } // end if [You must have fITSgeom for this to work!]
837 mod = GetModule(index);
838 itsHit->SetTrack(itsHit->GetTrack()+mask); // Set track mask.
839 mod->AddHit(itsHit,iPrimTrack,h);
840 } // end loop over hits
841 } // end loop over tracks
843 //______________________________________________________________________
844 void AliITS::ClearModules(){
845 // Clear the modules TObjArray.
851 if(fITSmodules) fITSmodules->Delete();
853 //______________________________________________________________________
854 void AliITS::MakeBranchS(const char *fl){
855 // Creates Tree Branch for the ITS summable digits.
857 // cont char *fl File name where SDigits branch is to be written
858 // to. If blank it write the SDigits to the same
859 // file in which the Hits were found.
864 Int_t buffersize = 4000;
867 // only one branch for SDigits.
868 sprintf(branchname,"%s",GetName());
871 if(fLoader->TreeS()){
872 if (fSDigits == 0x0) fSDigits = new TClonesArray("AliITSpListItem",1000);
873 MakeBranchInTree(fLoader->TreeS(),branchname,&fSDigits,buffersize,fl);
876 //______________________________________________________________________
877 void AliITS::SetTreeAddressS(TTree *treeS){
878 // Set branch address for the ITS summable digits Trees.
880 // TTree *treeS Tree containing the SDigits.
888 if (fSDigits == 0x0) fSDigits = new TClonesArray("AliITSpListItem",1000);
890 sprintf(branchname,"%s",GetName());
891 branch = treeS->GetBranch(branchname);
892 if (branch) branch->SetAddress(&fSDigits);
894 //______________________________________________________________________
895 void AliITS::MakeBranchInTreeD(TTree *treeD,const char *file){
896 // Creates Tree branches for the ITS.
898 // TTree *treeD Pointer to the Digits Tree.
899 // cont char *file File name where Digits branch is to be written
900 // to. If blank it write the SDigits to the same
901 // file in which the Hits were found.
906 Int_t buffersize = 4000;
909 sprintf(branchname,"%s",GetName());
910 // one branch for digits per type of detector
911 const char *det[3] = {"SPD","SDD","SSD"};
915 for (i=0; i<kNTYPES ;i++) {
916 DetType(i)->GetClassNames(digclass,clclass);
918 if (fDtype == 0x0) fDtype = new TObjArray(fNDetTypes);
919 if(!(fDtype->At(i))) fDtype->AddAt(new TClonesArray(digclass,1000),i);
922 for (i=0; i<kNTYPES ;i++) {
923 if (kNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]);
924 else sprintf(branchname,"%sDigits%d",GetName(),i+1);
925 if (fDtype && treeD) {
926 MakeBranchInTree(treeD, branchname, &((*fDtype)[i]),buffersize,file);
930 //______________________________________________________________________
931 void AliITS::SetTreeAddressD(TTree *treeD){
932 // Set branch address for the Trees.
934 // TTree *treeD Tree containing the Digits.
940 const char *det[3] = {"SPD","SDD","SSD"};
947 for (i=0; i<kNTYPES; i++) {
948 DetType(i)->GetClassNames(digclass,clclass);
950 if (fDtype == 0x0) fDtype = new TObjArray(fNDetTypes);
951 if(!(fDtype->At(i))) fDtype->AddAt(new TClonesArray(digclass,1000),i);
953 if (kNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]);
954 else sprintf(branchname,"%sDigits%d",GetName(),i+1);
956 branch = treeD->GetBranch(branchname);
957 if (branch) branch->SetAddress(&((*fDtype)[i]));
961 //______________________________________________________________________
962 void AliITS::Hits2SDigits(){
963 // Standard Hits to summable Digits function.
969 // return; // Using Hits in place of the larger sDigits.
970 fLoader->LoadHits("read");
971 fLoader->LoadSDigits("recreate");
972 AliRunLoader* rl = fLoader->GetRunLoader();
974 for (Int_t iEvent = 0; iEvent < rl->GetNumberOfEvents(); iEvent++) {
975 // Do the Hits to Digits operation. Use Standard input values.
976 // Event number from file, no background hit merging , use size from
977 // AliITSgeom class, option="All", input from this file only.
978 rl->GetEvent(iEvent);
979 if (!fLoader->TreeS()) fLoader->MakeTree("S");
982 HitsToSDigits(iEvent,0,-1," ",fOpt," ");
985 fLoader->UnloadHits();
986 fLoader->UnloadSDigits();
988 //______________________________________________________________________
989 void AliITS::Hits2PreDigits(){
990 // Standard Hits to summable Digits function.
996 AliHeader *header=fLoader->GetRunLoader()->GetHeader(); // Get event number from this file.
997 // Do the Hits to Digits operation. Use Standard input values.
998 // Event number from file, no background hit merging , use size from
999 // AliITSgeom class, option="All", input from this file only.
1000 HitsToPreDigits(header->GetEvent(),0,-1," ",fOpt," ");
1002 //______________________________________________________________________
1003 AliDigitizer* AliITS::CreateDigitizer(AliRunDigitizer* manager) const
1005 return new AliITSDigitizer(manager);
1007 //______________________________________________________________________
1008 void AliITS::SDigitsToDigits(Option_t *opt){
1009 // Standard Summable digits to Digits function.
1014 char name[20] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
1016 if(!GetITSgeom()) return; // need transformations to do digitization.
1017 AliITSgeom *geom = GetITSgeom();
1019 const char *all = strstr(opt,"All");
1020 const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
1022 if( !det[0] && !det[1] && !det[2] ) all = "All";
1024 static Bool_t setDef=kTRUE;
1025 if (setDef) SetDefaultSimulation();
1028 AliITSsimulation *sim = 0;
1029 AliITSDetType *iDetType = 0;
1030 TTree *trees = fLoader->TreeS();
1031 if( !(trees && this->GetSDigits()) ){
1032 Error("SDigits2Digits","Error: No trees or SDigits. Returning.");
1035 sprintf( name, "%s", this->GetName() );
1036 TBranch *brchSDigits = trees->GetBranch( name );
1039 for(module=0;module<geom->GetIndexMax();module++){
1040 id = geom->GetModuleType(module);
1041 if (!all && !det[id]) continue;
1042 iDetType = DetType(id);
1043 sim = (AliITSsimulation*)iDetType->GetSimulationModel();
1045 Error("SDigit2Digits","The simulation class was not "
1046 "instanciated for module %d type %s!",module,
1047 geom->GetModuleTypeName(module));
1050 sim->InitSimulationModule(module,gAlice->GetEvNumber());
1052 // add summable digits to module
1053 this->GetSDigits()->Clear();
1054 brchSDigits->GetEvent(module);
1055 sim->AddSDigitsToModule(GetSDigits(),0);
1057 // Digitise current module sum(SDigits)->Digits
1058 sim->FinishSDigitiseModule();
1060 // fills all branches - wasted disk space
1061 fLoader->TreeD()->Fill();
1062 this->ResetDigits();
1065 fLoader->TreeD()->GetEntries();
1067 fLoader->TreeD()->AutoSave();
1069 fLoader->TreeD()->Reset();
1072 //______________________________________________________________________
1073 void AliITS::Hits2Digits(){
1074 // Standard Hits to Digits function.
1080 fLoader->LoadHits("read");
1081 fLoader->LoadDigits("recreate");
1082 AliRunLoader* rl = fLoader->GetRunLoader();
1084 for (Int_t iEvent = 0; iEvent < rl->GetNumberOfEvents(); iEvent++) {
1085 // Do the Hits to Digits operation. Use Standard input values.
1086 // Event number from file, no background hit merging , use size from
1087 // AliITSgeom class, option="All", input from this file only.
1088 rl->GetEvent(iEvent);
1089 if (!fLoader->TreeD()) fLoader->MakeTree("D");
1092 HitsToDigits(iEvent,0,-1," ",fOpt," ");
1095 fLoader->UnloadHits();
1096 fLoader->UnloadDigits();
1098 //______________________________________________________________________
1099 void AliITS::HitsToSDigits(Int_t evNumber,Int_t bgrev,Int_t size,
1100 Option_t *option, Option_t *opt, const char *filename){
1101 // keep galice.root for signal and name differently the file for
1102 // background when add! otherwise the track info for signal will be lost !
1103 // the condition below will disappear when the geom class will be
1104 // initialized for all versions - for the moment it is only for v5 !
1105 // 7 is the SDD beam test version. Dummy routine. Hits are ITS's Summable
1108 // Int_t evnt Event to be processed.
1109 // Int_t bgrev Background Hit tree number.
1110 // Int_t nmodules Not used.
1111 // Option_t *option String indicating if merging hits or not. To
1112 // merge hits set equal to "Add". Otherwise no
1113 // background hits are considered.
1114 // Test_t *filename File name containing the background hits..
1119 // return; // using Hits instead of the larger sdigits.
1121 HitsToPreDigits(evNumber,bgrev,size,option,opt,filename);
1123 //______________________________________________________________________
1124 void AliITS::HitsToPreDigits(Int_t evNumber,Int_t bgrev,Int_t size,
1125 Option_t *option, Option_t *opt, const char *filename){
1126 // Keep galice.root for signal and name differently the file for
1127 // background when add! otherwise the track info for signal will be lost !
1128 // the condition below will disappear when the geom class will be
1129 // initialized for all versions - for the moment it is only for v5 !
1130 // 7 is the SDD beam test version.
1132 // Int_t evnt Event to be processed.
1133 // Int_t bgrev Background Hit tree number.
1134 // Int_t nmodules Not used.
1135 // Option_t *option String indicating if merging hits or not. To
1136 // merge hits set equal to "Add". Otherwise no
1137 // background hits are considered.
1138 // Test_t *filename File name containing the background hits..
1144 if(!GetITSgeom()) return; // need transformations to do digitization.
1145 AliITSgeom *geom = GetITSgeom();
1147 const char *all = strstr(opt,"All");
1148 const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
1150 static Bool_t setDef=kTRUE;
1151 if (setDef) SetDefaultSimulation();
1155 InitModules(size,nmodules);
1156 FillModules(evNumber,bgrev,nmodules,option,filename);
1158 AliITSsimulation *sim = 0;
1159 AliITSDetType *iDetType = 0;
1160 AliITSmodule *mod = 0;
1162 for(module=0;module<geom->GetIndexMax();module++){
1163 id = geom->GetModuleType(module);
1164 if (!all && !det[id]) continue;
1165 iDetType = DetType(id);
1166 sim = (AliITSsimulation*)iDetType->GetSimulationModel();
1168 Error("HitsToSDigits","The simulation class was not "
1169 "instanciated for module %d type %s!",module,
1170 geom->GetModuleTypeName(module));
1173 mod = (AliITSmodule *)fITSmodules->At(module);
1174 sim->SDigitiseModule(mod,module,evNumber);
1175 // fills all branches - wasted disk space
1176 fLoader->TreeS()->Fill();
1182 fLoader->TreeS()->GetEntries();
1183 fLoader->TreeS()->AutoSave();
1184 fLoader->WriteSDigits("OVERWRITE");
1186 fLoader->TreeS()->Reset();
1188 //______________________________________________________________________
1189 void AliITS::HitsToDigits(Int_t evNumber,Int_t bgrev,Int_t size,
1190 Option_t *option, Option_t *opt, const char *filename){
1191 // Keep galice.root for signal and name differently the file for
1192 // background when add! otherwise the track info for signal will be lost !
1193 // the condition below will disappear when the geom class will be
1194 // initialized for all versions - for the moment it is only for v5 !
1195 // 7 is the SDD beam test version.
1197 // Int_t evnt Event to be processed.
1198 // Int_t bgrev Background Hit tree number.
1199 // Int_t nmodules Not used.
1200 // Option_t *option String indicating if merging hits or not. To
1201 // merge hits set equal to "Add". Otherwise no
1202 // background hits are considered.
1203 // Test_t *filename File name containing the background hits..
1209 if(!GetITSgeom()) return; // need transformations to do digitization.
1210 AliITSgeom *geom = GetITSgeom();
1212 const char *all = strstr(opt,"All");
1213 const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
1215 static Bool_t setDef=kTRUE;
1216 if (setDef) SetDefaultSimulation();
1220 InitModules(size,nmodules);
1221 FillModules(evNumber,bgrev,nmodules,option,filename);
1223 AliITSsimulation *sim = 0;
1224 AliITSDetType *iDetType = 0;
1225 AliITSmodule *mod = 0;
1227 for(module=0;module<geom->GetIndexMax();module++){
1228 id = geom->GetModuleType(module);
1229 if (!all && !det[id]) continue;
1230 iDetType = DetType(id);
1231 sim = (AliITSsimulation*)iDetType->GetSimulationModel();
1233 Error("HitsToDigits","The simulation class was not "
1234 "instanciated for module %d type %s!",module,
1235 geom->GetModuleTypeName(module));
1238 mod = (AliITSmodule *)fITSmodules->At(module);
1239 sim->DigitiseModule(mod,module,evNumber);
1240 // fills all branches - wasted disk space
1241 fLoader->TreeD()->Fill();
1247 fLoader->TreeD()->GetEntries();
1248 fLoader->TreeD()->AutoSave();
1250 fLoader->TreeD()->Reset();
1252 //______________________________________________________________________
1253 void AliITS::ResetSDigits(){
1254 // Reset the Summable Digits array.
1260 if (fSDigits) fSDigits->Clear();
1263 //______________________________________________________________________
1264 void AliITS::ResetDigits(){
1265 // Reset number of digits and the digits array for the ITS detector.
1271 if (!fDtype) return;
1274 for (i=0;i<kNTYPES;i++ ) {
1275 if (fDtype->At(i)) ((TClonesArray*)fDtype->At(i))->Clear();
1276 if (fNdtype) fNdtype[i]=0;
1279 //______________________________________________________________________
1280 void AliITS::ResetDigits(Int_t i){
1281 // Reset number of digits and the digits array for this branch.
1287 if (fDtype->At(i)) ((TClonesArray*)fDtype->At(i))->Clear();
1288 if (fNdtype) fNdtype[i]=0;
1290 //______________________________________________________________________
1291 void AliITS::AddSumDigit(AliITSpListItem &sdig){
1292 // Adds the a module full of summable digits to the summable digits tree.
1294 // AliITSpListItem &sdig SDigit to be added to SDigits tree.
1300 TClonesArray &lsdig = *fSDigits;
1301 new(lsdig[fNSDigits++]) AliITSpListItem(sdig);
1303 //______________________________________________________________________
1304 void AliITS::AddRealDigit(Int_t id, Int_t *digits){
1305 // Add a real digit - as coming from data.
1307 // Int_t id Detector type number.
1308 // Int_t *digits Integer array containing the digits info. See
1315 TClonesArray &ldigits = *((TClonesArray*)fDtype->At(id));
1316 new(ldigits[fNdtype[id]++]) AliITSdigit(digits);
1318 //______________________________________________________________________
1319 void AliITS::AddSimDigit(Int_t id, AliITSdigit *d){
1320 // Add a simulated digit.
1322 // Int_t id Detector type number.
1323 // AliITSdigit *d Digit to be added to the Digits Tree. See
1330 TClonesArray &ldigits = *((TClonesArray*)fDtype->At(id));
1334 new(ldigits[fNdtype[id]++]) AliITSdigitSPD(*((AliITSdigitSPD*)d));
1337 new(ldigits[fNdtype[id]++]) AliITSdigitSDD(*((AliITSdigitSDD*)d));
1340 new(ldigits[fNdtype[id]++]) AliITSdigitSSD(*((AliITSdigitSSD*)d));
1344 //______________________________________________________________________
1345 void AliITS::AddSimDigit(Int_t id,Float_t phys,Int_t *digits,Int_t *tracks,
1346 Int_t *hits,Float_t *charges){
1347 // Add a simulated digit to the list.
1349 // Int_t id Detector type number.
1350 // Float_t phys Physics indicator. See AliITSdigits.h
1351 // Int_t *digits Integer array containing the digits info. See
1353 // Int_t *tracks Integer array [AliITSdigitS?D::GetNTracks()]
1354 // containing the track numbers that contributed to
1356 // Int_t *hits Integer array [AliITSdigitS?D::GetNTracks()]
1357 // containing the hit numbers, from AliITSmodule, that
1358 // contributed to this digit.
1359 // Float_t *charge Floating point array of the signals contributed
1360 // to this digit by each track.
1366 TClonesArray &ldigits = *((TClonesArray*)fDtype->At(id));
1367 AliITSresponseSDD *resp = 0;
1370 new(ldigits[fNdtype[id]++]) AliITSdigitSPD(digits,tracks,hits);
1373 resp = (AliITSresponseSDD*)DetType(1)->GetResponseModel();
1374 new(ldigits[fNdtype[id]++]) AliITSdigitSDD(phys,digits,tracks,
1378 new(ldigits[fNdtype[id]++]) AliITSdigitSSD(digits,tracks,hits);
1383 //______________________________________________________________________
1384 void AliITS::Digits2Raw()
1386 // convert digits of the current event to raw data
1388 fLoader->LoadDigits();
1389 TTree* digits = fLoader->TreeD();
1391 Error("Digits2Raw", "no digits tree");
1394 SetTreeAddressD(digits);
1396 AliITSDDLRawData rawWriter;
1400 // 2: txt files with digits
1401 //BE CAREFUL, verbose level 2 MUST be used only for debugging and
1402 //it is highly suggested to use this mode only for debugging digits files
1403 //reasonably small, because otherwise the size of the txt files can reach
1404 //quickly several MB wasting time and disk space.
1405 rawWriter.SetVerbose(0);
1407 //SILICON PIXEL DETECTOR
1408 Info("Digits2Raw", "Formatting raw data for SPD");
1409 rawWriter.RawDataSPD(digits->GetBranch("ITSDigitsSPD"));
1411 //SILICON DRIFT DETECTOR
1412 Info("Digits2Raw", "Formatting raw data for SDD");
1413 rawWriter.RawDataSDD(digits->GetBranch("ITSDigitsSDD"));
1415 //SILICON STRIP DETECTOR
1416 Info("Digits2Raw", "Formatting raw data for SSD");
1417 rawWriter.RawDataSSD(digits->GetBranch("ITSDigitsSSD"));
1419 fLoader->UnloadDigits();
1422 //______________________________________________________________________
1423 void AliITS::MakeTreeC(Option_t *option){
1424 // Create a separate tree to store the clusters.
1426 // Option_t *option string which must contain "C" otherwise
1427 // no Cluster Tree is created.
1433 AliITSLoader *pITSLoader = (AliITSLoader*)fLoader;
1435 if (pITSLoader == 0x0) {
1436 Error("MakeTreeC","fLoader == 0x0 option=%s",option);
1439 if (pITSLoader->TreeC() == 0x0) pITSLoader->MakeTree("C");
1443 void AliITS::MakeBranchC()
1445 //Makes barnches in treeC
1446 AliITSLoader *pITSLoader = (AliITSLoader*)fLoader;
1447 if (pITSLoader == 0x0)
1449 Error("MakeTreeC","fLoader == 0x0");
1452 TTree * lTC = pITSLoader->TreeC();
1455 Error("MakeTreeC","Can not get TreeC from Loader");
1459 Int_t buffersize = 4000;
1460 char branchname[30];
1461 const char *det[3] = {"SPD","SDD","SSD"};
1465 // one branch for Clusters per type of detector
1467 for (i=0; i<kNTYPES ;i++)
1469 AliITSDetType *iDetType=DetType(i);
1470 iDetType->GetClassNames(digclass,clclass);
1472 if (fCtype == 0x0) fCtype = new TObjArray(fNDetTypes);
1473 if(!ClustersAddress(i))
1475 fCtype->AddAt(new TClonesArray(clclass,1000),i);
1477 if (kNTYPES==3) sprintf(branchname,"%sClusters%s",GetName(),det[i]);
1478 else sprintf(branchname,"%sClusters%d",GetName(),i+1);
1481 if (lTC->GetBranch(branchname))
1483 Warning("MakeBranchC","Branch %s alread exists in TreeC",branchname);
1487 Info("MakeBranchC","Creating branch %s in TreeC",branchname);
1488 lTC->Branch(branchname,&((*fCtype)[i]), buffersize);
1490 } // end if fCtype && lTC
1494 //______________________________________________________________________
1495 void AliITS::GetTreeC(Int_t event){
1496 // Get the clusters tree for this event and set the branch address.
1498 // Int_t event Event number for the cluster tree.
1503 char branchname[30];
1504 const char *det[3] = {"SPD","SDD","SSD"};
1506 AliITSLoader *pITSLoader = (AliITSLoader*)fLoader;
1507 TTree * lTC = pITSLoader->TreeC();
1511 pITSLoader->CleanRawClusters();
1521 for (i=0; i<kNTYPES; i++) {
1522 AliITSDetType *iDetType=DetType(i);
1523 iDetType->GetClassNames(digclass,clclass);
1525 if (fCtype == 0x0) fCtype = new TObjArray(fNDetTypes);
1526 if(!fCtype->At(i)) fCtype->AddAt(new TClonesArray(clclass,1000),i);
1527 if(kNTYPES==3) sprintf(branchname,"%sClusters%s",GetName(),det[i]);
1528 else sprintf(branchname,"%sClusters%d",GetName(),i+1);
1530 branch = lTC->GetBranch(branchname);
1531 if (branch) branch->SetAddress(&((*fCtype)[i]));
1535 Error("GetTreeC","cannot find Clusters Tree for event:%d",event);
1538 //______________________________________________________________________
1539 void AliITS::AddCluster(Int_t id, AliITSRawCluster *c){
1540 // Add a cluster to the list.
1542 // Int_t id Detector type number.
1543 // AliITSRawCluster *c Cluster class to be added to the tree of
1550 TClonesArray &lc = *((TClonesArray*)fCtype->At(id));
1554 new(lc[fNctype[id]++]) AliITSRawClusterSPD(*((AliITSRawClusterSPD*)c));
1557 new(lc[fNctype[id]++]) AliITSRawClusterSDD(*((AliITSRawClusterSDD*)c));
1560 new(lc[fNctype[id]++]) AliITSRawClusterSSD(*((AliITSRawClusterSSD*)c));
1564 //______________________________________________________________________
1565 void AliITS::ResetClusters(){
1566 // Reset number of clusters and the clusters array for ITS.
1573 for (i=0;i<kNTYPES;i++ ) ResetClusters(i);
1575 //______________________________________________________________________
1576 void AliITS::ResetClusters(Int_t i){
1577 // Reset number of clusters and the clusters array for this branch.
1579 // Int_t i Detector type number.
1585 if (fCtype->At(i)) ((TClonesArray*)fCtype->At(i))->Clear();
1586 if (fNctype) fNctype[i]=0;
1588 //______________________________________________________________________
1589 void AliITS::MakeBranchR(const char *file, Option_t *opt){
1590 // Creates Tree branches for the ITS Reconstructed points.
1592 // cont char *file File name where RecPoints branch is to be written
1593 // to. If blank it write the SDigits to the same
1594 // file in which the Hits were found.
1599 Int_t buffsz = 4000;
1600 char branchname[30];
1602 // only one branch for rec points for all detector types
1603 Bool_t oFast= (strstr(opt,"Fast")!=0);
1605 sprintf(branchname,"%sRecPointsF",GetName());
1607 sprintf(branchname,"%sRecPoints",GetName());
1611 if(!fRecPoints)fRecPoints = new TClonesArray("AliITSRecPoint",1000);
1612 if (fLoader->TreeR()) {
1613 if (fRecPoints == 0x0) fRecPoints = new TClonesArray("AliITSRecPoint",1000);
1614 MakeBranchInTree(fLoader->TreeR(),branchname,&fRecPoints,buffsz,file);
1617 //______________________________________________________________________
1618 void AliITS::SetTreeAddressR(TTree *treeR){
1619 // Set branch address for the Reconstructed points Trees.
1621 // TTree *treeR Tree containing the RecPoints.
1626 char branchname[30];
1629 if (fRecPoints == 0x0) fRecPoints = new TClonesArray("AliITSRecPoint",1000);
1631 sprintf(branchname,"%sRecPoints",GetName());
1632 branch = treeR->GetBranch(branchname);
1634 branch->SetAddress(&fRecPoints);
1637 sprintf(branchname,"%sRecPointsF",GetName());
1638 branch = treeR->GetBranch(branchname);
1640 branch->SetAddress(&fRecPoints);
1644 //______________________________________________________________________
1645 void AliITS::AddRecPoint(const AliITSRecPoint &r){
1646 // Add a reconstructed space point to the list
1648 // const AliITSRecPoint &r RecPoint class to be added to the tree
1649 // of reconstructed points TreeR.
1655 TClonesArray &lrecp = *fRecPoints;
1656 new(lrecp[fNRecPoints++]) AliITSRecPoint(r);
1658 //______________________________________________________________________
1659 void AliITS::HitsToFastRecPoints(Int_t evNumber,Int_t bgrev,Int_t size,
1660 Option_t *opt0,Option_t *opt1, const char *flnm){
1661 // keep galice.root for signal and name differently the file for
1662 // background when add! otherwise the track info for signal will be lost !
1663 // the condition below will disappear when the geom class will be
1664 // initialized for all versions - for the moment it is only for v5 !
1666 // Int_t evnt Event to be processed.
1667 // Int_t bgrev Background Hit tree number.
1668 // Int_t size Size used by InitModules. See InitModules.
1669 // Option_t *opt0 Option passed to FillModules. See FillModules.
1670 // Option_t *opt1 String indicating if merging hits or not. To
1671 // merge hits set equal to "Add". Otherwise no
1672 // background hits are considered.
1673 // Test_t *flnm File name containing the background hits..
1679 if(!GetITSgeom()) return;
1680 AliITSLoader *pITSloader = (AliITSLoader*)fLoader;
1681 AliITSgeom *geom = GetITSgeom();
1683 const char *all = strstr(opt1,"All");
1684 const char *det[3] ={strstr(opt1,"SPD"),strstr(opt1,"SDD"),
1685 strstr(opt1,"SSD")};
1687 InitModules(size,nmodules);
1688 FillModules(evNumber,bgrev,nmodules,opt0,flnm);
1690 AliITSsimulation *sim = 0;
1691 AliITSDetType *iDetType = 0;
1692 AliITSmodule *mod = 0;
1695 //m.b. : this change is nothing but a nice way to make sure
1698 cout<<"HitsToFastRecPoints: N mod = "<<geom->GetIndexMax()<<endl;
1700 for(module=0;module<geom->GetIndexMax();module++){
1701 id = geom->GetModuleType(module);
1702 if (!all && !det[id]) continue;
1703 iDetType = DetType(id);
1704 sim = (AliITSsimulation*)iDetType->GetSimulationModel();
1707 Error("HitsToFastPoints","The simulation class was not "
1708 "instanciated for module %d type %x!",module,
1709 geom->GetModuleTypeName(module));
1712 mod = (AliITSmodule *)fITSmodules->At(module);
1713 sim->CreateFastRecPoints(mod,module,gRandom);
1714 cout<<module<<"\r";fflush(0);
1715 //gAlice->TreeR()->Fill();
1716 TTree *lTR = pITSloader->TreeR();
1717 TBranch *br=lTR->GetBranch("ITSRecPointsF");
1724 fLoader->WriteRecPoints("OVERWRITE");
1726 //______________________________________________________________________
1727 void AliITS::Digits2Reco(){
1728 // Find clusters and reconstruct space points.
1734 AliHeader *header=fLoader->GetRunLoader()->GetHeader();
1735 // to Digits to RecPoints for event in file, all digits in file, and
1736 // all ITS detectors.
1737 DigitsToRecPoints(header->GetEvent(),0,fOpt);
1739 //______________________________________________________________________
1740 void AliITS::DigitsToRecPoints(Int_t evNumber,Int_t lastentry,Option_t *opt){
1741 // cluster finding and reconstruction of space points
1742 // the condition below will disappear when the geom class will be
1743 // initialized for all versions - for the moment it is only for v5 !
1744 // 7 is the SDD beam test version
1746 // Int_t evNumber Event number to be processed.
1747 // Int_t lastentry Offset for module when not all of the modules
1749 // Option_t *opt String indicating which ITS sub-detectors should
1750 // be processed. If ="All" then all of the ITS
1751 // sub detectors are processed.
1757 if(!GetITSgeom()) return;
1758 AliITSgeom *geom = GetITSgeom();
1760 const char *all = strstr(opt,"All");
1761 const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
1763 static Bool_t setRec=kTRUE;
1764 if (setRec) SetDefaultClusterFinders();
1767 AliITSLoader *pITSloader = (AliITSLoader*)fLoader;
1768 TTree *treeC=pITSloader->TreeC();
1769 AliITSClusterFinder *rec = 0;
1770 AliITSDetType *iDetType = 0;
1771 Int_t id,module,first=0;
1772 for(module=0;module<geom->GetIndexMax();module++){
1773 id = geom->GetModuleType(module);
1774 if (!all && !det[id]) continue;
1775 if(det[id]) first = geom->GetStartDet(id);
1776 iDetType = DetType(id);
1777 rec = (AliITSClusterFinder*)iDetType->GetReconstructionModel();
1778 TClonesArray *itsDigits = this->DigitsAddress(id);
1780 Error("DigitsToRecPoints",
1781 "The reconstruction class was not instanciated! event=%d",
1785 this->ResetDigits();
1786 TTree *lTD = pITSloader->TreeD();
1788 lTD->GetEvent(lastentry+module);
1790 lTD->GetEvent(lastentry+(module-first));
1792 Int_t ndigits = itsDigits->GetEntriesFast();
1793 if (ndigits) rec->FindRawClusters(module);
1794 pITSloader->TreeR()->Fill();
1801 pITSloader->WriteRecPoints("OVERWRITE");
1802 pITSloader->WriteRawClusters("OVERWRITE");
1804 //______________________________________________________________________
1805 void AliITS::ResetRecPoints(){
1806 // Reset number of rec points and the rec points array.
1812 if (fRecPoints) fRecPoints->Clear();
1815 //______________________________________________________________________
1816 AliLoader* AliITS::MakeLoader(const char* topfoldername)
1818 //builds ITSgetter (AliLoader type)
1819 //if detector wants to use castomized getter, it must overload this method
1821 Info("MakeLoader","Creating AliITSLoader. Top folder is %s.",topfoldername);
1822 fLoader = new AliITSLoader(GetName(),topfoldername);