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"
114 #include "AliITSclustererV2.h"
115 #include "AliITStrackerV2.h"
116 #include "AliITStrackerSA.h"
117 #include "AliITSpidESD.h"
118 #include "AliV0vertexer.h"
119 #include "AliITSVertexerPPZ.h"
120 #include "AliITSVertexerFast.h"
121 #include "AliITSVertexerZ.h"
122 #include "AliITSVertexerIons.h"
123 #include "AliCascadeVertexer.h"
129 //______________________________________________________________________
130 AliITS::AliITS() : AliDetector(),
148 fSelectedVertexer(0){
149 // Default initializer for ITS
150 // The default constructor of the AliITS class. In addition to
151 // creating the AliITS class it zeros the variables fIshunt (a member
152 // of AliDetector class), fEuclidOut, and fIdN, and zeros the pointers
153 // fITSpoints, fIdSens, and fIdName. The AliDetector default constructor
162 fIshunt = 0; // not zeroed in AliDetector.
165 // SetDetectors(); // default to fOpt="All". This variable not written out.
166 SetMarkerColor(kRed);
169 //______________________________________________________________________
170 AliITS::AliITS(const char *name, const char *title):AliDetector(name,title),
188 fSelectedVertexer(0){
189 // The standard Constructor for the ITS class. In addition to
190 // creating the AliITS class, it allocates memory for the TClonesArrays
191 // fHits, fSDigits, fDigits, fITSpoints, and the TObjArray of fCtype
192 // (clusters). It also zeros the variables
193 // fIshunt (a member of AliDetector class), fEuclidOut, and fIdN, and zeros
194 // the pointers fIdSens and fIdName. To help in displaying hits via the
195 // ROOT macro display.C AliITS also sets the marker color to red. The
196 // variables passes with this constructor, const char *name and *title,
197 // are used by the constructor of AliDetector class. See AliDetector
198 // class for a description of these parameters and its constructor
201 // const char *name Detector name. Should always be "ITS"
202 // const char *title Detector title.
208 fIshunt = 0; // not zeroed in AliDetector
209 fHits = new TClonesArray("AliITShit", 1560);//not done in AliDetector
210 if(gAlice->GetMCApp()) gAlice->GetMCApp()->AddHitList(fHits);// Not done in AliDetector.
215 SetDetectors(); // default to fOpt="All". This variable not written out.
221 fNDetTypes = kNTYPES;
222 fDetTypes = new TObjArray(fNDetTypes);
224 fSDigits = new TClonesArray("AliITSpListItem",1000);
227 fNdtype = new Int_t[fNDetTypes];
228 fDtype = new TObjArray(fNDetTypes);
230 fCtype = new TObjArray(fNDetTypes);
231 fNctype = new Int_t[fNDetTypes];
233 fRecPoints = new TClonesArray("AliITSRecPoint",1000);
237 for(i=0;i<fNDetTypes;i++) {
238 fDetTypes->AddAt(new AliITSDetType(),i);
243 SetMarkerColor(kRed);
246 //______________________________________________________________________
248 // Default destructor for ITS.
249 // The default destructor of the AliITS class. In addition to deleting
250 // the AliITS class it deletes the memory pointed to by the fHits, fDigits,
251 // fSDigits, fCtype, fITSmodules, fITSgeom, fRecPoints, fIdSens, fIdName,
252 // fITSpoints, fDetType and it's contents.
276 fRecPoints->Delete();
280 delete[] fIdName; // Array of TStrings
283 this->ClearModules();
286 }// end if fITSmodules!=0
304 } // end if fDetTypes
307 if (fITSgeom) delete fITSgeom;
309 //______________________________________________________________________
310 AliITS::AliITS(const AliITS &source) : AliDetector(source){
311 // Copy constructor. This is a function which is not allowed to be
312 // done to the ITS. It exits with an error.
314 // AliITS &source An AliITS class.
320 if(this==&source) return;
321 Error("Copy constructor",
322 "You are not allowed to make a copy of the AliITS");
325 //______________________________________________________________________
326 AliITS& AliITS::operator=(AliITS &source){
327 // Assignment operator. This is a function which is not allowed to be
328 // done to the ITS. It exits with an error.
330 // AliITS &source An AliITS class.
336 if(this==&source) return *this;
337 Error("operator=","You are not allowed to make a copy of the AliITS");
339 return *this; //fake return
341 //______________________________________________________________________
342 Int_t AliITS::DistancetoPrimitive(Int_t,Int_t) const{
343 // Distance from mouse to ITS on the screen. Dummy routine
344 // A dummy routine used by the ROOT macro display.C to allow for the
345 // use of the mouse (pointing device) in the macro. In general this should
346 // never be called. If it is it returns the number 9999 for any value of
349 // Int_t Dummy screen coordinate.
350 // Int_t Dummy screen coordinate.
354 // Int_t Dummy = 9999 distance to ITS.
358 //______________________________________________________________________
360 // Initializer ITS after it has been built
361 // This routine initializes the AliITS class. It is intended to be
362 // called from the Init function in AliITSv?. Besides displaying a banner
363 // indicating that it has been called it initializes the array fIdSens
364 // and sets the default segmentation, response, digit and raw cluster
365 // classes therefore it should be called after a call to CreateGeometry.
376 if(gMC) for(i=0;i<fIdN;i++) fIdSens[i] = gMC->VolId(fIdName[i]);
378 //______________________________________________________________________
379 void AliITS::SetDefaults(){
380 // sets the default segmentation, response, digit and raw cluster classes.
388 if(fDebug) printf("%s: SetDefaults\n",ClassName());
390 AliITSDetType *iDetType;
394 if (!iDetType->GetSegmentationModel()) {
395 AliITSsegmentationSPD *seg0=new AliITSsegmentationSPD(fITSgeom);
396 SetSegmentationModel(0,seg0);
398 if (!iDetType->GetResponseModel()) {
399 SetResponseModel(0,new AliITSresponseSPD());
401 // set digit and raw cluster classes to be used
403 const char *kData0=(iDetType->GetResponseModel())->DataType();
404 if (strstr(kData0,"real")) {
405 iDetType->ClassNames("AliITSdigit","AliITSRawClusterSPD");
406 } else iDetType->ClassNames("AliITSdigitSPD","AliITSRawClusterSPD");
410 if (!iDetType->GetResponseModel()) {
411 SetResponseModel(1,new AliITSresponseSDD("simulated"));
413 AliITSresponse *resp1=iDetType->GetResponseModel();
414 if (!iDetType->GetSegmentationModel()) {
415 AliITSsegmentationSDD *seg1=new AliITSsegmentationSDD(fITSgeom,resp1);
416 SetSegmentationModel(1,seg1);
418 const char *kData1=(iDetType->GetResponseModel())->DataType();
419 const char *kopt=iDetType->GetResponseModel()->ZeroSuppOption();
420 if((!strstr(kopt,"2D"))&&(!strstr(kopt,"1D")) || strstr(kData1,"real") ){
421 iDetType->ClassNames("AliITSdigit","AliITSRawClusterSDD");
422 } else iDetType->ClassNames("AliITSdigitSDD","AliITSRawClusterSDD");
426 if (!iDetType->GetSegmentationModel()) {
427 AliITSsegmentationSSD *seg2=new AliITSsegmentationSSD(fITSgeom);
428 SetSegmentationModel(2,seg2);
430 if (!iDetType->GetResponseModel()) {
431 SetResponseModel(2,new AliITSresponseSSD("simulated"));
433 const char *kData2=(iDetType->GetResponseModel())->DataType();
434 if (strstr(kData2,"real")) {
435 iDetType->ClassNames("AliITSdigit","AliITSRawClusterSSD");
436 } else iDetType->ClassNames("AliITSdigitSSD","AliITSRawClusterSSD");
439 Warning("SetDefaults",
440 "Only the three basic detector types are initialized!");
443 //______________________________________________________________________
444 void AliITS::SetDefaultSimulation(){
445 // sets the default simulation.
453 AliITSDetType *iDetType;
454 AliITSsimulation *sim;
456 sim = iDetType->GetSimulationModel();
458 AliITSsegmentation *seg0=
459 (AliITSsegmentation*)iDetType->GetSegmentationModel();
460 AliITSresponse *res0 = (AliITSresponse*)iDetType->GetResponseModel();
461 AliITSsimulationSPD *sim0=new AliITSsimulationSPD(seg0,res0);
462 SetSimulationModel(0,sim0);
463 }else{ // simulation exists, make sure it is set up properly.
464 ((AliITSsimulationSPD*)sim)->Init(
465 (AliITSsegmentationSPD*) iDetType->GetSegmentationModel(),
466 (AliITSresponseSPD*) iDetType->GetResponseModel());
467 // if(sim->GetResponseModel()==0) sim->SetResponseModel(
468 // (AliITSresponse*)iDetType->GetResponseModel());
469 // if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel(
470 // (AliITSsegmentation*)iDetType->GetSegmentationModel());
473 sim = iDetType->GetSimulationModel();
475 AliITSsegmentation *seg1=
476 (AliITSsegmentation*)iDetType->GetSegmentationModel();
477 AliITSresponse *res1 = (AliITSresponse*)iDetType->GetResponseModel();
478 AliITSsimulationSDD *sim1=new AliITSsimulationSDD(seg1,res1);
479 SetSimulationModel(1,sim1);
480 }else{ // simulation exists, make sure it is set up properly.
481 ((AliITSsimulationSDD*)sim)->Init(
482 (AliITSsegmentationSDD*) iDetType->GetSegmentationModel(),
483 (AliITSresponseSDD*) iDetType->GetResponseModel());
484 // if(sim->GetResponseModel()==0) sim->SetResponseModel(
485 // (AliITSresponse*)iDetType->GetResponseModel());
486 // if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel(
487 // (AliITSsegmentation*)iDetType->GetSegmentationModel());
490 sim = iDetType->GetSimulationModel();
492 AliITSsegmentation *seg2=
493 (AliITSsegmentation*)iDetType->GetSegmentationModel();
494 AliITSresponse *res2 = (AliITSresponse*)iDetType->GetResponseModel();
495 AliITSsimulationSSD *sim2=new AliITSsimulationSSD(seg2,res2);
496 SetSimulationModel(2,sim2);
497 }else{ // simulation exists, make sure it is set up properly.
498 ((AliITSsimulationSSD*)sim)->Init(
499 (AliITSsegmentationSSD*) iDetType->GetSegmentationModel(),
500 (AliITSresponseSSD*) iDetType->GetResponseModel());
501 // if(sim->GetResponseModel()==0) sim->SetResponseModel(
502 // (AliITSresponse*)iDetType->GetResponseModel());
503 // if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel(
504 // (AliITSsegmentation*)iDetType->GetSegmentationModel());
507 //______________________________________________________________________
508 void AliITS::SetDefaultClusterFinders(){
509 // Sets the default cluster finders. Used in finding RecPoints.
518 AliITSDetType *iDetType;
522 if (!iDetType->GetReconstructionModel()) {
523 AliITSsegmentation *seg0 =
524 (AliITSsegmentation*)iDetType->GetSegmentationModel();
525 TClonesArray *dig0=DigitsAddress(0);
526 TClonesArray *recp0=ClustersAddress(0);
527 AliITSClusterFinderSPD *rec0 = new AliITSClusterFinderSPD(seg0,dig0,
529 SetReconstructionModel(0,rec0);
534 if (!iDetType->GetReconstructionModel()) {
535 AliITSsegmentation *seg1 =
536 (AliITSsegmentation*)iDetType->GetSegmentationModel();
537 AliITSresponse *res1 = (AliITSresponse*)iDetType->GetResponseModel();
538 TClonesArray *dig1=DigitsAddress(1);
539 TClonesArray *recp1=ClustersAddress(1);
540 AliITSClusterFinderSDD *rec1 =
541 new AliITSClusterFinderSDD(seg1,res1,dig1,recp1);
542 SetReconstructionModel(1,rec1);
547 if (!iDetType->GetReconstructionModel()) {
548 AliITSsegmentation *seg2=
549 (AliITSsegmentation*)iDetType->GetSegmentationModel();
550 TClonesArray *dig2=DigitsAddress(2);
551 AliITSClusterFinderSSD *rec2= new AliITSClusterFinderSSD(seg2,dig2);
552 SetReconstructionModel(2,rec2);
555 //______________________________________________________________________
556 void AliITS::MakeBranch(Option_t* option){
557 // Creates Tree branches for the ITS.
559 // Option_t *option String of Tree types S,D, and/or R.
560 // const char *file String of the file name where these branches
561 // are to be stored. If blank then these branches
562 // are written to the same tree as the Hits were
568 Bool_t cH = (strstr(option,"H")!=0);
569 Bool_t cS = (strstr(option,"S")!=0);
570 Bool_t cD = (strstr(option,"D")!=0);
571 Bool_t cR = (strstr(option,"R")!=0);
572 Bool_t cRF = (strstr(option,"RF")!=0);
575 if(cH && (fHits == 0x0)) fHits = new TClonesArray("AliITShit", 1560);
577 AliDetector::MakeBranch(option);
579 if(cS) MakeBranchS(0);
580 if(cD) MakeBranchD(0);
581 if(cR) MakeBranchR(0);
582 if(cRF) MakeBranchRF(0);
584 //______________________________________________________________________
585 void AliITS::SetTreeAddress(){
586 // Set branch address for the Trees.
593 TTree *treeS = fLoader->TreeS();
594 TTree *treeD = fLoader->TreeD();
595 TTree *treeR = fLoader->TreeR();
596 if (fLoader->TreeH() && (fHits == 0x0)) fHits = new TClonesArray("AliITShit", 1560);
598 AliDetector::SetTreeAddress();
600 SetTreeAddressS(treeS);
601 SetTreeAddressD(treeD);
602 SetTreeAddressR(treeR);
604 //______________________________________________________________________
605 AliITSDetType* AliITS::DetType(Int_t id){
606 // Return pointer to id detector type.
608 // Int_t id detector id number.
612 // returned, a pointer to a AliITSDetType.
614 return ((AliITSDetType*) fDetTypes->At(id));
616 //______________________________________________________________________
617 void AliITS::SetResponseModel(Int_t id, AliITSresponse *response){
618 // Set the response model for the id detector type.
620 // Int_t id detector id number.
621 // AliITSresponse* a pointer containing an instance of AliITSresponse
622 // to be stored/owned b y AliITSDetType.
628 ((AliITSDetType*) fDetTypes->At(id))->ResponseModel(response);
630 //______________________________________________________________________
631 void AliITS::SetSegmentationModel(Int_t id, AliITSsegmentation *seg){
632 // Set the segmentation model for the id detector type.
634 // Int_t id detector id number.
635 // AliITSsegmentation* a pointer containing an instance of
636 // AliITSsegmentation to be stored/owned b y
643 ((AliITSDetType*) fDetTypes->At(id))->SegmentationModel(seg);
645 //______________________________________________________________________
646 void AliITS::SetSimulationModel(Int_t id, AliITSsimulation *sim){
647 // Set the simulation model for the id detector type.
649 // Int_t id detector id number.
650 // AliITSresponse* a pointer containing an instance of AliITSresponse
651 // to be stored/owned b y AliITSDetType.
657 ((AliITSDetType*) fDetTypes->At(id))->SimulationModel(sim);
660 //______________________________________________________________________
661 void AliITS::SetReconstructionModel(Int_t id, AliITSClusterFinder *reconst){
662 // Set the cluster finder model for the id detector type.
664 // Int_t id detector id number.
665 // AliITSClusterFinder* a pointer containing an instance of
666 // AliITSClusterFinder to be stored/owned b y
673 ((AliITSDetType*) fDetTypes->At(id))->ReconstructionModel(reconst);
675 //______________________________________________________________________
676 void AliITS::SetClasses(Int_t id, const char *digit, const char *cluster){
677 // Set the digit and cluster classes name to be used for the id detector
680 // Int_t id detector id number.
681 // const char *digit Digit class name for detector id.
682 // const char *cluster Cluster class name for detector id.
688 ((AliITSDetType*) fDetTypes->At(id))->ClassNames(digit,cluster);
690 //______________________________________________________________________
691 void AliITS::AddHit(Int_t track, Int_t *vol, Float_t *hits){
693 // The function to add information to the AliITShit class. See the
694 // AliITShit class for a full description. This function allocates the
695 // necessary new space for the hit information and passes the variable
696 // track, and the pointers *vol and *hits to the AliITShit constructor
699 // Int_t track Track number which produced this hit.
700 // Int_t *vol Array of Integer Hit information. See AliITShit.h
701 // Float_t *hits Array of Floating Hit information. see AliITShit.h
707 TClonesArray &lhits = *fHits;
708 new(lhits[fNhits++]) AliITShit(fIshunt,track,vol,hits);
710 //______________________________________________________________________
711 void AliITS::InitModules(Int_t size,Int_t &nmodules){
712 // Initialize the modules array.
714 // Int_t size Size of array of the number of modules to be
715 // created. If size <=0 then the number of modules
716 // is gotten from AliITSgeom class kept in fITSgeom.
718 // Int_t &nmodules The number of modules existing.
723 fITSmodules->Delete();
725 } // end fir fITSmoudles
727 Int_t nl,indexMAX,index;
729 if(size<=0){ // default to using data stored in AliITSgeom
731 Error("InitModules","fITSgeom not defined");
733 } // end if fITSgeom==0
734 nl = fITSgeom->GetNlayers();
735 indexMAX = fITSgeom->GetModuleIndex(nl,fITSgeom->GetNladders(nl),
736 fITSgeom->GetNdetectors(nl))+1;
738 fITSmodules = new TObjArray(indexMAX);
739 for(index=0;index<indexMAX;index++){
740 fITSmodules->AddAt( new AliITSmodule(index),index);
743 fITSmodules = new TObjArray(size);
744 for(index=0;index<size;index++) {
745 fITSmodules->AddAt( new AliITSmodule(index),index);
751 //______________________________________________________________________
752 void AliITS::FillModules(Int_t evnt,Int_t bgrev,Int_t nmodules,
753 Option_t *option, const char *filename){
754 // fill the modules with the sorted by module hits; add hits from
755 // background if option=Add.
757 // Int_t evnt Event to be processed.
758 // Int_t bgrev Background Hit tree number.
759 // Int_t nmodules Not used.
760 // Option_t *option String indicating if merging hits or not. To
761 // merge hits set equal to "Add". Otherwise no
762 // background hits are considered.
763 // Test_t *filename File name containing the background hits..
768 static TTree *trH1; //Tree with background hits
769 static Bool_t first=kTRUE;
771 const char *addBgr = strstr(option,"Add");
773 evnt = nmodules; // Dummy use of variables to remove warnings
776 file=new TFile(filename);
781 // Get Hits Tree header from file
782 if(trH1) delete trH1;
786 sprintf(treeName,"TreeH%d",bgrev);
787 trH1 = (TTree*)gDirectory->Get(treeName);
789 Error("FillModules","cannot find Hits Tree for event:%d",bgrev);
791 // Set branch addresses
794 FillModules(fLoader->TreeH(),0); // fill from this file's tree.
797 FillModules(trH1,10000000); // Default mask 10M.
798 TTree *fAli=fLoader->GetRunLoader()->TreeK();
800 if (fAli) fileAli =fAli->GetCurrentFile();
804 //______________________________________________________________________
805 void AliITS::FillModules(TTree *treeH, Int_t mask) {
806 // fill the modules with the sorted by module hits;
807 // can be called many times to do a merging
809 // TTree *treeH The tree containing the hits to be copied into
811 // Int_t mask The track number mask to indecate which file
812 // this hits came from.
820 Error("FillModules","Tree is NULL");
822 Int_t lay,lad,det,index;
826 sprintf(branchname,"%s",GetName());
827 TBranch *branch = treeH->GetBranch(branchname);
829 Error("FillModules","%s branch in TreeH not found",branchname);
832 branch->SetAddress(&fHits);
833 Int_t nTracks =(Int_t) treeH->GetEntries();
835 for(iPrimTrack=0; iPrimTrack<nTracks; iPrimTrack++){
837 Int_t nBytes = treeH->GetEvent(iPrimTrack);
838 if (nBytes <= 0) continue;
839 Int_t nHits = fHits->GetEntriesFast();
840 for(h=0; h<nHits; h++){
841 itsHit = (AliITShit *)fHits->UncheckedAt(h);
842 itsHit->GetDetectorID(lay,lad,det);
844 index = fITSgeom->GetModuleIndex(lay,lad,det);
846 index=det-1; // This should not be used.
847 } // end if [You must have fITSgeom for this to work!]
848 mod = GetModule(index);
849 itsHit->SetTrack(itsHit->GetTrack()+mask); // Set track mask.
850 mod->AddHit(itsHit,iPrimTrack,h);
851 } // end loop over hits
852 } // end loop over tracks
854 //______________________________________________________________________
855 void AliITS::ClearModules(){
856 // Clear the modules TObjArray.
862 if(fITSmodules) fITSmodules->Delete();
864 //______________________________________________________________________
865 void AliITS::MakeBranchS(const char *fl){
866 // Creates Tree Branch for the ITS summable digits.
868 // cont char *fl File name where SDigits branch is to be written
869 // to. If blank it write the SDigits to the same
870 // file in which the Hits were found.
875 Int_t buffersize = 4000;
878 // only one branch for SDigits.
879 sprintf(branchname,"%s",GetName());
882 if(fLoader->TreeS()){
883 if (fSDigits == 0x0) fSDigits = new TClonesArray("AliITSpListItem",1000);
884 MakeBranchInTree(fLoader->TreeS(),branchname,&fSDigits,buffersize,fl);
887 //______________________________________________________________________
888 void AliITS::SetTreeAddressS(TTree *treeS){
889 // Set branch address for the ITS summable digits Trees.
891 // TTree *treeS Tree containing the SDigits.
899 if (fSDigits == 0x0) fSDigits = new TClonesArray("AliITSpListItem",1000);
901 sprintf(branchname,"%s",GetName());
902 branch = treeS->GetBranch(branchname);
903 if (branch) branch->SetAddress(&fSDigits);
905 //______________________________________________________________________
906 void AliITS::MakeBranchInTreeD(TTree *treeD,const char *file){
907 // Creates Tree branches for the ITS.
909 // TTree *treeD Pointer to the Digits Tree.
910 // cont char *file File name where Digits branch is to be written
911 // to. If blank it write the SDigits to the same
912 // file in which the Hits were found.
917 Int_t buffersize = 4000;
920 sprintf(branchname,"%s",GetName());
921 // one branch for digits per type of detector
922 const char *det[3] = {"SPD","SDD","SSD"};
926 for (i=0; i<kNTYPES ;i++) {
927 DetType(i)->GetClassNames(digclass,clclass);
929 if (fDtype == 0x0) fDtype = new TObjArray(fNDetTypes);
930 if(!(fDtype->At(i))) fDtype->AddAt(new TClonesArray(digclass,1000),i);
933 for (i=0; i<kNTYPES ;i++) {
934 if (kNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]);
935 else sprintf(branchname,"%sDigits%d",GetName(),i+1);
936 if (fDtype && treeD) {
937 MakeBranchInTree(treeD, branchname, &((*fDtype)[i]),buffersize,file);
941 //______________________________________________________________________
942 void AliITS::SetTreeAddressD(TTree *treeD){
943 // Set branch address for the Trees.
945 // TTree *treeD Tree containing the Digits.
951 const char *det[3] = {"SPD","SDD","SSD"};
958 for (i=0; i<kNTYPES; i++) {
959 DetType(i)->GetClassNames(digclass,clclass);
961 if (fDtype == 0x0) fDtype = new TObjArray(fNDetTypes);
962 if(!(fDtype->At(i))) fDtype->AddAt(new TClonesArray(digclass,1000),i);
964 if (kNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]);
965 else sprintf(branchname,"%sDigits%d",GetName(),i+1);
967 branch = treeD->GetBranch(branchname);
968 if (branch) branch->SetAddress(&((*fDtype)[i]));
972 //______________________________________________________________________
973 void AliITS::Hits2SDigits(){
974 // Standard Hits to summable Digits function.
980 // return; // Using Hits in place of the larger sDigits.
981 fLoader->LoadHits("read");
982 fLoader->LoadSDigits("recreate");
983 AliRunLoader* rl = fLoader->GetRunLoader();
985 for (Int_t iEvent = 0; iEvent < rl->GetNumberOfEvents(); iEvent++) {
986 // Do the Hits to Digits operation. Use Standard input values.
987 // Event number from file, no background hit merging , use size from
988 // AliITSgeom class, option="All", input from this file only.
989 rl->GetEvent(iEvent);
990 if (!fLoader->TreeS()) fLoader->MakeTree("S");
993 HitsToSDigits(iEvent,0,-1," ",fOpt," ");
996 fLoader->UnloadHits();
997 fLoader->UnloadSDigits();
999 //______________________________________________________________________
1000 void AliITS::Hits2PreDigits(){
1001 // Standard Hits to summable Digits function.
1007 AliHeader *header=fLoader->GetRunLoader()->GetHeader(); // Get event number from this file.
1008 // Do the Hits to Digits operation. Use Standard input values.
1009 // Event number from file, no background hit merging , use size from
1010 // AliITSgeom class, option="All", input from this file only.
1011 HitsToPreDigits(header->GetEvent(),0,-1," ",fOpt," ");
1013 //______________________________________________________________________
1014 AliDigitizer* AliITS::CreateDigitizer(AliRunDigitizer* manager) const
1016 return new AliITSDigitizer(manager);
1018 //______________________________________________________________________
1019 void AliITS::SDigitsToDigits(Option_t *opt){
1020 // Standard Summable digits to Digits function.
1025 char name[20] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
1027 if(!GetITSgeom()) return; // need transformations to do digitization.
1028 AliITSgeom *geom = GetITSgeom();
1030 const char *all = strstr(opt,"All");
1031 const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
1033 if( !det[0] && !det[1] && !det[2] ) all = "All";
1035 static Bool_t setDef=kTRUE;
1036 if (setDef) SetDefaultSimulation();
1039 AliITSsimulation *sim = 0;
1040 AliITSDetType *iDetType = 0;
1041 TTree *trees = fLoader->TreeS();
1042 if( !(trees && this->GetSDigits()) ){
1043 Error("SDigits2Digits","Error: No trees or SDigits. Returning.");
1046 sprintf( name, "%s", this->GetName() );
1047 TBranch *brchSDigits = trees->GetBranch( name );
1050 for(module=0;module<geom->GetIndexMax();module++){
1051 id = geom->GetModuleType(module);
1052 if (!all && !det[id]) continue;
1053 iDetType = DetType(id);
1054 sim = (AliITSsimulation*)iDetType->GetSimulationModel();
1056 Error("SDigit2Digits","The simulation class was not "
1057 "instanciated for module %d type %s!",module,
1058 geom->GetModuleTypeName(module));
1061 sim->InitSimulationModule(module,gAlice->GetEvNumber());
1063 // add summable digits to module
1064 this->GetSDigits()->Clear();
1065 brchSDigits->GetEvent(module);
1066 sim->AddSDigitsToModule(GetSDigits(),0);
1068 // Digitise current module sum(SDigits)->Digits
1069 sim->FinishSDigitiseModule();
1071 // fills all branches - wasted disk space
1072 fLoader->TreeD()->Fill();
1073 this->ResetDigits();
1076 fLoader->TreeD()->GetEntries();
1078 fLoader->TreeD()->AutoSave();
1080 fLoader->TreeD()->Reset();
1083 //______________________________________________________________________
1084 void AliITS::Hits2Digits(){
1085 // Standard Hits to Digits function.
1091 fLoader->LoadHits("read");
1092 fLoader->LoadDigits("recreate");
1093 AliRunLoader* rl = fLoader->GetRunLoader();
1095 for (Int_t iEvent = 0; iEvent < rl->GetNumberOfEvents(); iEvent++) {
1096 // Do the Hits to Digits operation. Use Standard input values.
1097 // Event number from file, no background hit merging , use size from
1098 // AliITSgeom class, option="All", input from this file only.
1099 rl->GetEvent(iEvent);
1100 if (!fLoader->TreeD()) fLoader->MakeTree("D");
1103 HitsToDigits(iEvent,0,-1," ",fOpt," ");
1106 fLoader->UnloadHits();
1107 fLoader->UnloadDigits();
1109 //______________________________________________________________________
1110 void AliITS::HitsToSDigits(Int_t evNumber,Int_t bgrev,Int_t size,
1111 Option_t *option, Option_t *opt, const char *filename){
1112 // keep galice.root for signal and name differently the file for
1113 // background when add! otherwise the track info for signal will be lost !
1114 // the condition below will disappear when the geom class will be
1115 // initialized for all versions - for the moment it is only for v5 !
1116 // 7 is the SDD beam test version. Dummy routine. Hits are ITS's Summable
1119 // Int_t evnt Event to be processed.
1120 // Int_t bgrev Background Hit tree number.
1121 // Int_t nmodules Not used.
1122 // Option_t *option String indicating if merging hits or not. To
1123 // merge hits set equal to "Add". Otherwise no
1124 // background hits are considered.
1125 // Test_t *filename File name containing the background hits..
1130 // return; // using Hits instead of the larger sdigits.
1132 HitsToPreDigits(evNumber,bgrev,size,option,opt,filename);
1134 //______________________________________________________________________
1135 void AliITS::HitsToPreDigits(Int_t evNumber,Int_t bgrev,Int_t size,
1136 Option_t *option, Option_t *opt, const char *filename){
1137 // Keep galice.root for signal and name differently the file for
1138 // background when add! otherwise the track info for signal will be lost !
1139 // the condition below will disappear when the geom class will be
1140 // initialized for all versions - for the moment it is only for v5 !
1141 // 7 is the SDD beam test version.
1143 // Int_t evnt Event to be processed.
1144 // Int_t bgrev Background Hit tree number.
1145 // Int_t nmodules Not used.
1146 // Option_t *option String indicating if merging hits or not. To
1147 // merge hits set equal to "Add". Otherwise no
1148 // background hits are considered.
1149 // Test_t *filename File name containing the background hits..
1155 if(!GetITSgeom()) return; // need transformations to do digitization.
1156 AliITSgeom *geom = GetITSgeom();
1158 const char *all = strstr(opt,"All");
1159 const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
1161 static Bool_t setDef=kTRUE;
1162 if (setDef) SetDefaultSimulation();
1166 InitModules(size,nmodules);
1167 FillModules(evNumber,bgrev,nmodules,option,filename);
1169 AliITSsimulation *sim = 0;
1170 AliITSDetType *iDetType = 0;
1171 AliITSmodule *mod = 0;
1173 for(module=0;module<geom->GetIndexMax();module++){
1174 id = geom->GetModuleType(module);
1175 if (!all && !det[id]) continue;
1176 iDetType = DetType(id);
1177 sim = (AliITSsimulation*)iDetType->GetSimulationModel();
1179 Error("HitsToSDigits","The simulation class was not "
1180 "instanciated for module %d type %s!",module,
1181 geom->GetModuleTypeName(module));
1184 mod = (AliITSmodule *)fITSmodules->At(module);
1185 sim->SDigitiseModule(mod,module,evNumber);
1186 // fills all branches - wasted disk space
1187 fLoader->TreeS()->Fill();
1193 fLoader->TreeS()->GetEntries();
1194 fLoader->TreeS()->AutoSave();
1195 fLoader->WriteSDigits("OVERWRITE");
1197 fLoader->TreeS()->Reset();
1199 //______________________________________________________________________
1200 void AliITS::HitsToDigits(Int_t evNumber,Int_t bgrev,Int_t size,
1201 Option_t *option, Option_t *opt, const char *filename){
1202 // Keep galice.root for signal and name differently the file for
1203 // background when add! otherwise the track info for signal will be lost !
1204 // the condition below will disappear when the geom class will be
1205 // initialized for all versions - for the moment it is only for v5 !
1206 // 7 is the SDD beam test version.
1208 // Int_t evnt Event to be processed.
1209 // Int_t bgrev Background Hit tree number.
1210 // Int_t nmodules Not used.
1211 // Option_t *option String indicating if merging hits or not. To
1212 // merge hits set equal to "Add". Otherwise no
1213 // background hits are considered.
1214 // Test_t *filename File name containing the background hits..
1220 if(!GetITSgeom()) return; // need transformations to do digitization.
1221 AliITSgeom *geom = GetITSgeom();
1223 const char *all = strstr(opt,"All");
1224 const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
1226 static Bool_t setDef=kTRUE;
1227 if (setDef) SetDefaultSimulation();
1231 InitModules(size,nmodules);
1232 FillModules(evNumber,bgrev,nmodules,option,filename);
1234 AliITSsimulation *sim = 0;
1235 AliITSDetType *iDetType = 0;
1236 AliITSmodule *mod = 0;
1238 for(module=0;module<geom->GetIndexMax();module++){
1239 id = geom->GetModuleType(module);
1240 if (!all && !det[id]) continue;
1241 iDetType = DetType(id);
1242 sim = (AliITSsimulation*)iDetType->GetSimulationModel();
1244 Error("HitsToDigits","The simulation class was not "
1245 "instanciated for module %d type %s!",module,
1246 geom->GetModuleTypeName(module));
1249 mod = (AliITSmodule *)fITSmodules->At(module);
1250 sim->DigitiseModule(mod,module,evNumber);
1251 // fills all branches - wasted disk space
1252 fLoader->TreeD()->Fill();
1258 fLoader->TreeD()->GetEntries();
1259 fLoader->TreeD()->AutoSave();
1261 fLoader->TreeD()->Reset();
1263 //______________________________________________________________________
1264 void AliITS::ResetSDigits(){
1265 // Reset the Summable Digits array.
1271 if (fSDigits) fSDigits->Clear();
1274 //______________________________________________________________________
1275 void AliITS::ResetDigits(){
1276 // Reset number of digits and the digits array for the ITS detector.
1282 if (!fDtype) return;
1285 for (i=0;i<kNTYPES;i++ ) {
1286 if (fDtype->At(i)) ((TClonesArray*)fDtype->At(i))->Clear();
1287 if (fNdtype) fNdtype[i]=0;
1290 //______________________________________________________________________
1291 void AliITS::ResetDigits(Int_t i){
1292 // Reset number of digits and the digits array for this branch.
1298 if (fDtype->At(i)) ((TClonesArray*)fDtype->At(i))->Clear();
1299 if (fNdtype) fNdtype[i]=0;
1301 //______________________________________________________________________
1302 void AliITS::AddSumDigit(AliITSpListItem &sdig){
1303 // Adds the a module full of summable digits to the summable digits tree.
1305 // AliITSpListItem &sdig SDigit to be added to SDigits tree.
1311 TClonesArray &lsdig = *fSDigits;
1312 new(lsdig[fNSDigits++]) AliITSpListItem(sdig);
1314 //______________________________________________________________________
1315 void AliITS::AddRealDigit(Int_t id, Int_t *digits){
1316 // Add a real digit - as coming from data.
1318 // Int_t id Detector type number.
1319 // Int_t *digits Integer array containing the digits info. See
1326 TClonesArray &ldigits = *((TClonesArray*)fDtype->At(id));
1327 new(ldigits[fNdtype[id]++]) AliITSdigit(digits);
1329 //______________________________________________________________________
1330 void AliITS::AddSimDigit(Int_t id, AliITSdigit *d){
1331 // Add a simulated digit.
1333 // Int_t id Detector type number.
1334 // AliITSdigit *d Digit to be added to the Digits Tree. See
1341 TClonesArray &ldigits = *((TClonesArray*)fDtype->At(id));
1345 new(ldigits[fNdtype[id]++]) AliITSdigitSPD(*((AliITSdigitSPD*)d));
1348 new(ldigits[fNdtype[id]++]) AliITSdigitSDD(*((AliITSdigitSDD*)d));
1351 new(ldigits[fNdtype[id]++]) AliITSdigitSSD(*((AliITSdigitSSD*)d));
1355 //______________________________________________________________________
1356 void AliITS::AddSimDigit(Int_t id,Float_t phys,Int_t *digits,Int_t *tracks,
1357 Int_t *hits,Float_t *charges){
1358 // Add a simulated digit to the list.
1360 // Int_t id Detector type number.
1361 // Float_t phys Physics indicator. See AliITSdigits.h
1362 // Int_t *digits Integer array containing the digits info. See
1364 // Int_t *tracks Integer array [AliITSdigitS?D::GetNTracks()]
1365 // containing the track numbers that contributed to
1367 // Int_t *hits Integer array [AliITSdigitS?D::GetNTracks()]
1368 // containing the hit numbers, from AliITSmodule, that
1369 // contributed to this digit.
1370 // Float_t *charge Floating point array of the signals contributed
1371 // to this digit by each track.
1377 TClonesArray &ldigits = *((TClonesArray*)fDtype->At(id));
1378 AliITSresponseSDD *resp = 0;
1381 new(ldigits[fNdtype[id]++]) AliITSdigitSPD(digits,tracks,hits);
1384 resp = (AliITSresponseSDD*)DetType(1)->GetResponseModel();
1385 new(ldigits[fNdtype[id]++]) AliITSdigitSDD(phys,digits,tracks,
1389 new(ldigits[fNdtype[id]++]) AliITSdigitSSD(digits,tracks,hits);
1394 //______________________________________________________________________
1395 void AliITS::Digits2Raw()
1397 // convert digits of the current event to raw data
1399 fLoader->LoadDigits();
1400 TTree* digits = fLoader->TreeD();
1402 Error("Digits2Raw", "no digits tree");
1405 SetTreeAddressD(digits);
1407 AliITSDDLRawData rawWriter;
1411 // 2: txt files with digits
1412 //BE CAREFUL, verbose level 2 MUST be used only for debugging and
1413 //it is highly suggested to use this mode only for debugging digits files
1414 //reasonably small, because otherwise the size of the txt files can reach
1415 //quickly several MB wasting time and disk space.
1416 rawWriter.SetVerbose(0);
1418 //SILICON PIXEL DETECTOR
1419 Info("Digits2Raw", "Formatting raw data for SPD");
1420 rawWriter.RawDataSPD(digits->GetBranch("ITSDigitsSPD"));
1422 //SILICON DRIFT DETECTOR
1423 Info("Digits2Raw", "Formatting raw data for SDD");
1424 rawWriter.RawDataSDD(digits->GetBranch("ITSDigitsSDD"));
1426 //SILICON STRIP DETECTOR
1427 Info("Digits2Raw", "Formatting raw data for SSD");
1428 rawWriter.RawDataSSD(digits->GetBranch("ITSDigitsSSD"));
1430 fLoader->UnloadDigits();
1433 //______________________________________________________________________
1434 void AliITS::MakeTreeC(Option_t *option){
1435 // Create a separate tree to store the clusters.
1437 // Option_t *option string which must contain "C" otherwise
1438 // no Cluster Tree is created.
1444 AliITSLoader *pITSLoader = (AliITSLoader*)fLoader;
1446 if (pITSLoader == 0x0) {
1447 Error("MakeTreeC","fLoader == 0x0 option=%s",option);
1450 if (pITSLoader->TreeC() == 0x0) pITSLoader->MakeTree("C");
1454 void AliITS::MakeBranchC()
1456 //Makes barnches in treeC
1457 AliITSLoader *pITSLoader = (AliITSLoader*)fLoader;
1458 if (pITSLoader == 0x0)
1460 Error("MakeTreeC","fLoader == 0x0");
1463 TTree * lTC = pITSLoader->TreeC();
1466 Error("MakeTreeC","Can not get TreeC from Loader");
1470 Int_t buffersize = 4000;
1471 char branchname[30];
1472 const char *det[3] = {"SPD","SDD","SSD"};
1476 // one branch for Clusters per type of detector
1478 for (i=0; i<kNTYPES ;i++)
1480 AliITSDetType *iDetType=DetType(i);
1481 iDetType->GetClassNames(digclass,clclass);
1483 if (fCtype == 0x0) fCtype = new TObjArray(fNDetTypes);
1484 if(!ClustersAddress(i))
1486 fCtype->AddAt(new TClonesArray(clclass,1000),i);
1488 if (kNTYPES==3) sprintf(branchname,"%sClusters%s",GetName(),det[i]);
1489 else sprintf(branchname,"%sClusters%d",GetName(),i+1);
1492 if (lTC->GetBranch(branchname))
1494 Warning("MakeBranchC","Branch %s alread exists in TreeC",branchname);
1498 Info("MakeBranchC","Creating branch %s in TreeC",branchname);
1499 lTC->Branch(branchname,&((*fCtype)[i]), buffersize);
1501 } // end if fCtype && lTC
1505 //______________________________________________________________________
1506 void AliITS::GetTreeC(Int_t event){
1507 // Get the clusters tree for this event and set the branch address.
1509 // Int_t event Event number for the cluster tree.
1514 char branchname[30];
1515 const char *det[3] = {"SPD","SDD","SSD"};
1517 AliITSLoader *pITSLoader = (AliITSLoader*)fLoader;
1518 TTree * lTC = pITSLoader->TreeC();
1522 pITSLoader->CleanRawClusters();
1532 for (i=0; i<kNTYPES; i++) {
1533 AliITSDetType *iDetType=DetType(i);
1534 iDetType->GetClassNames(digclass,clclass);
1536 if (fCtype == 0x0) fCtype = new TObjArray(fNDetTypes);
1537 if(!fCtype->At(i)) fCtype->AddAt(new TClonesArray(clclass,1000),i);
1538 if(kNTYPES==3) sprintf(branchname,"%sClusters%s",GetName(),det[i]);
1539 else sprintf(branchname,"%sClusters%d",GetName(),i+1);
1541 branch = lTC->GetBranch(branchname);
1542 if (branch) branch->SetAddress(&((*fCtype)[i]));
1546 Error("GetTreeC","cannot find Clusters Tree for event:%d",event);
1549 //______________________________________________________________________
1550 void AliITS::AddCluster(Int_t id, AliITSRawCluster *c){
1551 // Add a cluster to the list.
1553 // Int_t id Detector type number.
1554 // AliITSRawCluster *c Cluster class to be added to the tree of
1561 TClonesArray &lc = *((TClonesArray*)fCtype->At(id));
1565 new(lc[fNctype[id]++]) AliITSRawClusterSPD(*((AliITSRawClusterSPD*)c));
1568 new(lc[fNctype[id]++]) AliITSRawClusterSDD(*((AliITSRawClusterSDD*)c));
1571 new(lc[fNctype[id]++]) AliITSRawClusterSSD(*((AliITSRawClusterSSD*)c));
1575 //______________________________________________________________________
1576 void AliITS::ResetClusters(){
1577 // Reset number of clusters and the clusters array for ITS.
1584 for (i=0;i<kNTYPES;i++ ) ResetClusters(i);
1586 //______________________________________________________________________
1587 void AliITS::ResetClusters(Int_t i){
1588 // Reset number of clusters and the clusters array for this branch.
1590 // Int_t i Detector type number.
1596 if (fCtype->At(i)) ((TClonesArray*)fCtype->At(i))->Clear();
1597 if (fNctype) fNctype[i]=0;
1599 //______________________________________________________________________
1600 void AliITS::MakeBranchR(const char *file, Option_t *opt){
1601 // Creates Tree branches for the ITS Reconstructed points.
1603 // cont char *file File name where RecPoints branch is to be written
1604 // to. If blank it write the SDigits to the same
1605 // file in which the Hits were found.
1610 Int_t buffsz = 4000;
1611 char branchname[30];
1613 // only one branch for rec points for all detector types
1614 Bool_t oFast= (strstr(opt,"Fast")!=0);
1616 sprintf(branchname,"%sRecPointsF",GetName());
1618 sprintf(branchname,"%sRecPoints",GetName());
1622 if(!fRecPoints)fRecPoints = new TClonesArray("AliITSRecPoint",1000);
1623 if (fLoader->TreeR()) {
1624 if (fRecPoints == 0x0) fRecPoints = new TClonesArray("AliITSRecPoint",1000);
1625 MakeBranchInTree(fLoader->TreeR(),branchname,&fRecPoints,buffsz,file);
1628 //______________________________________________________________________
1629 void AliITS::SetTreeAddressR(TTree *treeR){
1630 // Set branch address for the Reconstructed points Trees.
1632 // TTree *treeR Tree containing the RecPoints.
1637 char branchname[30];
1640 if (fRecPoints == 0x0) fRecPoints = new TClonesArray("AliITSRecPoint",1000);
1642 sprintf(branchname,"%sRecPoints",GetName());
1643 branch = treeR->GetBranch(branchname);
1645 branch->SetAddress(&fRecPoints);
1648 sprintf(branchname,"%sRecPointsF",GetName());
1649 branch = treeR->GetBranch(branchname);
1651 branch->SetAddress(&fRecPoints);
1655 //______________________________________________________________________
1656 void AliITS::AddRecPoint(const AliITSRecPoint &r){
1657 // Add a reconstructed space point to the list
1659 // const AliITSRecPoint &r RecPoint class to be added to the tree
1660 // of reconstructed points TreeR.
1666 TClonesArray &lrecp = *fRecPoints;
1667 new(lrecp[fNRecPoints++]) AliITSRecPoint(r);
1669 //______________________________________________________________________
1670 void AliITS::HitsToFastRecPoints(Int_t evNumber,Int_t bgrev,Int_t size,
1671 Option_t *opt0,Option_t *opt1, const char *flnm){
1672 // keep galice.root for signal and name differently the file for
1673 // background when add! otherwise the track info for signal will be lost !
1674 // the condition below will disappear when the geom class will be
1675 // initialized for all versions - for the moment it is only for v5 !
1677 // Int_t evnt Event to be processed.
1678 // Int_t bgrev Background Hit tree number.
1679 // Int_t size Size used by InitModules. See InitModules.
1680 // Option_t *opt0 Option passed to FillModules. See FillModules.
1681 // Option_t *opt1 String indicating if merging hits or not. To
1682 // merge hits set equal to "Add". Otherwise no
1683 // background hits are considered.
1684 // Test_t *flnm File name containing the background hits..
1690 if(!GetITSgeom()) return;
1691 AliITSLoader *pITSloader = (AliITSLoader*)fLoader;
1692 AliITSgeom *geom = GetITSgeom();
1694 const char *all = strstr(opt1,"All");
1695 const char *det[3] ={strstr(opt1,"SPD"),strstr(opt1,"SDD"),
1696 strstr(opt1,"SSD")};
1698 InitModules(size,nmodules);
1699 FillModules(evNumber,bgrev,nmodules,opt0,flnm);
1701 AliITSsimulation *sim = 0;
1702 AliITSDetType *iDetType = 0;
1703 AliITSmodule *mod = 0;
1706 //m.b. : this change is nothing but a nice way to make sure
1709 cout<<"HitsToFastRecPoints: N mod = "<<geom->GetIndexMax()<<endl;
1711 for(module=0;module<geom->GetIndexMax();module++){
1712 id = geom->GetModuleType(module);
1713 if (!all && !det[id]) continue;
1714 iDetType = DetType(id);
1715 sim = (AliITSsimulation*)iDetType->GetSimulationModel();
1718 Error("HitsToFastPoints","The simulation class was not "
1719 "instanciated for module %d type %x!",module,
1720 geom->GetModuleTypeName(module));
1723 mod = (AliITSmodule *)fITSmodules->At(module);
1724 sim->CreateFastRecPoints(mod,module,gRandom);
1725 cout<<module<<"\r";fflush(0);
1726 //gAlice->TreeR()->Fill();
1727 TTree *lTR = pITSloader->TreeR();
1728 TBranch *br=lTR->GetBranch("ITSRecPointsF");
1735 fLoader->WriteRecPoints("OVERWRITE");
1737 //______________________________________________________________________
1738 void AliITS::Digits2Reco(){
1739 // Find clusters and reconstruct space points.
1745 AliHeader *header=fLoader->GetRunLoader()->GetHeader();
1746 // to Digits to RecPoints for event in file, all digits in file, and
1747 // all ITS detectors.
1748 DigitsToRecPoints(header->GetEvent(),0,fOpt);
1750 //______________________________________________________________________
1751 void AliITS::DigitsToRecPoints(Int_t evNumber,Int_t lastentry,Option_t *opt){
1752 // cluster finding and reconstruction of space points
1753 // the condition below will disappear when the geom class will be
1754 // initialized for all versions - for the moment it is only for v5 !
1755 // 7 is the SDD beam test version
1757 // Int_t evNumber Event number to be processed.
1758 // Int_t lastentry Offset for module when not all of the modules
1760 // Option_t *opt String indicating which ITS sub-detectors should
1761 // be processed. If ="All" then all of the ITS
1762 // sub detectors are processed.
1768 if(!GetITSgeom()) return;
1769 AliITSgeom *geom = GetITSgeom();
1771 const char *all = strstr(opt,"All");
1772 const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
1774 static Bool_t setRec=kTRUE;
1775 if (setRec) SetDefaultClusterFinders();
1778 AliITSLoader *pITSloader = (AliITSLoader*)fLoader;
1779 TTree *treeC=pITSloader->TreeC();
1780 AliITSClusterFinder *rec = 0;
1781 AliITSDetType *iDetType = 0;
1782 Int_t id,module,first=0;
1783 for(module=0;module<geom->GetIndexMax();module++){
1784 id = geom->GetModuleType(module);
1785 if (!all && !det[id]) continue;
1786 if(det[id]) first = geom->GetStartDet(id);
1787 iDetType = DetType(id);
1788 rec = (AliITSClusterFinder*)iDetType->GetReconstructionModel();
1789 TClonesArray *itsDigits = this->DigitsAddress(id);
1791 Error("DigitsToRecPoints",
1792 "The reconstruction class was not instanciated! event=%d",
1796 this->ResetDigits();
1797 TTree *lTD = pITSloader->TreeD();
1799 lTD->GetEvent(lastentry+module);
1801 lTD->GetEvent(lastentry+(module-first));
1803 Int_t ndigits = itsDigits->GetEntriesFast();
1804 if (ndigits) rec->FindRawClusters(module);
1805 pITSloader->TreeR()->Fill();
1812 pITSloader->WriteRecPoints("OVERWRITE");
1813 pITSloader->WriteRawClusters("OVERWRITE");
1815 //______________________________________________________________________
1816 void AliITS::ResetRecPoints(){
1817 // Reset number of rec points and the rec points array.
1823 if (fRecPoints) fRecPoints->Clear();
1826 //______________________________________________________________________
1827 AliLoader* AliITS::MakeLoader(const char* topfoldername)
1829 //builds ITSgetter (AliLoader type)
1830 //if detector wants to use castomized getter, it must overload this method
1832 Info("MakeLoader","Creating AliITSLoader. Top folder is %s.",topfoldername);
1833 fLoader = new AliITSLoader(GetName(),topfoldername);
1838 //_____________________________________________________________________________
1839 void AliITS::Reconstruct() const
1841 // reconstruct clusters
1843 AliLoader* loader = GetLoader();
1844 loader->LoadRecPoints("recreate");
1845 loader->LoadDigits("read");
1847 AliITSclustererV2 clusterer(GetITSgeom());
1848 AliRunLoader* runLoader = loader->GetRunLoader();
1849 Int_t nEvents = runLoader->GetNumberOfEvents();
1850 runLoader->LoadKinematics();
1852 for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
1853 runLoader->GetEvent(iEvent);
1855 TTree* treeClusters = loader->TreeR();
1856 if (!treeClusters) {
1857 loader->MakeTree("R");
1858 treeClusters = loader->TreeR();
1860 TTree* treeDigits = loader->TreeD();
1862 Error("Reconstruct", "Can't get digits tree !");
1866 clusterer.Digits2Clusters(treeDigits, treeClusters);
1868 loader->WriteRecPoints("OVERWRITE");
1871 loader->UnloadRecPoints();
1872 loader->UnloadDigits();
1875 //_____________________________________________________________________________
1876 AliTracker* AliITS::CreateTracker() const
1878 // create an ITS tracker
1880 return new AliITStrackerSA(GetITSgeom());
1882 //_____________________________________________________________________________
1883 AliVertexer* AliITS::CreateVertexer() const
1885 // create a ITS vertexer
1887 if(fSelectedVertexer.Contains("ions") || fSelectedVertexer.Contains("IONS")){
1888 Info("CreateVertexer","a AliITSVertexerIons object has been selected\n");
1889 return new AliITSVertexerIons("null");
1891 if(fSelectedVertexer.Contains("smear") || fSelectedVertexer.Contains("SMEAR")){
1892 Double_t smear[3]={0.005,0.005,0.01};
1893 Info("CreateVertexer","a AliITSVertexerFast object has been selected\n");
1894 return new AliITSVertexerFast(smear);
1896 if(fSelectedVertexer.Contains("ppz") || fSelectedVertexer.Contains("PPZ")){
1897 Info("CreateVertexer","a AliITSVertexerPPZ object has been selected\n");
1898 return new AliITSVertexerPPZ("null");
1900 // by default an AliITSVertexerZ object is instatiated
1901 Info("CreateVertexer","a AliITSVertexerZ object has been selected\n");
1902 return new AliITSVertexerZ("null");
1905 //_____________________________________________________________________________
1906 void AliITS::FillESD(AliESD* esd) const
1908 // make PID, find V0s and cascades
1910 Double_t parITS[] = {34., 0.15, 10.};
1911 AliITSpidESD itsPID(parITS);
1912 itsPID.MakePID(esd);
1915 Double_t cuts[]={33, // max. allowed chi2
1916 0.16,// min. allowed negative daughter's impact parameter
1917 0.05,// min. allowed positive daughter's impact parameter
1918 0.08,// max. allowed DCA between the daughter tracks
1919 0.99,// max. allowed cosine of V0's pointing angle
1920 0.9, // min. radius of the fiducial volume
1921 2.9 // max. radius of the fiducial volume
1923 AliV0vertexer vtxer(cuts);
1924 Double_t vtx[3], cvtx[6];
1925 esd->GetVertex()->GetXYZ(vtx);
1926 esd->GetVertex()->GetSigmaXYZ(cvtx);
1927 vtxer.SetVertex(vtx);
1928 vtxer.Tracks2V0vertices(esd);
1931 Double_t cts[]={33., // max. allowed chi2
1932 0.05, // min. allowed V0 impact parameter
1933 0.008, // window around the Lambda mass
1934 0.035, // min. allowed bachelor's impact parameter
1935 0.10, // max. allowed DCA between a V0 and a track
1936 0.9985, //max. allowed cosine of the cascade pointing angle
1937 0.9, // min. radius of the fiducial volume
1938 2.9 // max. radius of the fiducial volume
1940 AliCascadeVertexer cvtxer=AliCascadeVertexer(cts);
1941 cvtxer.SetVertex(vtx);
1942 cvtxer.V0sTracks2CascadeVertices(esd);