/*
$Log$
-Revision 1.10 2000/01/19 17:16:51 fca
-Introducing a list of lists of hits -- more hits allowed for detector now
+Revision 1.9.2.8 2000/06/12 18:05:59 barbera
+fixed posible compilation errors on HP unix
+
+Revision 1.9.2.7 2000/06/11 20:20:18 barbera
+New AliITS base clase for the new structure.
+
+Revision 1.9.2.3 2000/02/02 13:42:09 barbera
+fixed AliITS.cxx for new AliRun structure. Added ITS hits list to list of hits which will have their track numbers updated
+
+Revision 1.9.2.2 2000/01/23 03:03:13 nilsen
+//fixed FillModule. Removed fi(fabs(xl)<dx....
+
+Revision 1.9.2.1 2000/01/12 19:03:32 nilsen
+This is the version of the files after the merging done in December 1999.
+See the ReadMe110100.txt file for details
Revision 1.9 1999/11/14 14:33:25 fca
Correct problems with distructors and pointers, thanks to I.Hrivnacova
// Modified and documented by Bjorn S. Nilsen
// July 11 1999
//
+// Version: 2
+// Modified and documented by A. Bologna
+// October 18 1999
+//
// AliITS is the general base class for the ITS. Also see AliDetector for
// futher information.
//
#include <TMath.h>
#include <TRandom.h>
#include <TVector.h>
-#include <TGeometry.h>
-#include <TNode.h>
-#include <TTUBE.h>
+#include <TObjArray.h>
+#include <TClonesArray.h>
+#include <TROOT.h>
+#include <TObjectTable.h>
+
+
-#include "AliITSmodule.h"
-#include "AliDetector.h"
-#include "AliITS.h"
-#include "TClonesArray.h"
-#include "TObjArray.h"
-#include "AliITShit.h"
-#include "AliITSdigit.h"
#include "AliRun.h"
+#include "AliITS.h"
+#include "AliITSMap.h"
+#include "AliITSClusterFinder.h"
+#include "AliITSsimulation.h"
+#include "AliITSsimulationFastPoints.h"
+#include "AliITSsegmentationSPD.h"
+#include "AliITSresponseSPD.h"
+#include "AliITSsegmentationSDD.h"
+#include "AliITSresponseSDD.h"
+#include "AliITSsegmentationSSD.h"
+#include "AliITSresponseSSD.h"
+//#include "AliITStrack.h"
-ClassImp(AliITS)
-////////////////////////////////////////////////////////////////////////
-//
-// An overview of the basic philosophy of the ITS code development
-// and analysis is show in the figure below.
-//Begin_Html
-/*
-<img src="picts/ITS/ITS_Analysis_schema.gif">
-</pre>
-<br clear=left>
-<font size=+2 color=red>
-<p>Roberto Barbera is in charge of the ITS Offline code (1999).
-<a href="mailto:roberto.barbera@ct.infn.it">Roberto Barbera</a>.
-</font>
-<pre>
-*/
-//End_Html
-//
-// Version: 0
-// Written by Rene Brun, Federico Carminati, and Roberto Barbera
-//
-// Version: 1
-// Modified and documented by Bjorn S. Nilsen
-// July 11 1999
-//
-// AliITS is the general base class for the ITS. Also see AliDetector for
-// futher information.
-//
-// Data members:
-//
-// AliITSgeom *fITSgeom
-// All of the geometry information about the active volumes that
-// make up the ITS are described in the AliITSgeom class. This includes
-// the transformation functions between the local and global coordinate
-// systems and the like. See the full description found in the AliITSgeom
-// class. Here in the AliITS class is kept the pointer to the geometry
-// used in the simulations or that thought to be the correct one for the
-// data. Until a more general class is define and a more appropriate
-// place is found to keep this geometry information, it is kept here in
-// AliITS.
-//
-// TObjArray *fITSpoints
-// This is a pointer to the points, to be used by the tracking algorithms
-// for example, found in the detectors of the ITS. To allow for the most
-// general points structure it is defined to be a pointer to a TObjArray where
-// each array element would be one point found in the ITS detectors. An
-// Addpoints function is defined below. By default an array of 16 TObjects are
-// defined during the initialization of AliITS. This is automatically expanded
-// when necessary by the Addpoints function.
-//
-// Bool_t fEuclidOut
-// This is a flag used to indicate that an Euclid compatible CAD
-// file will be created upon the creation of the ITS Monte Carlo
-// geometry definition, in the function CreatGeometry. If fEuclidOut is
-// true, then a file called ITSgeometry.euc will be created.
-//
-// Int_t fIdN
-// This variable contains the number of layers defined in the ITS
-// geometry. It is primarily used as a size indicator for fIdSens and
-// fIdName described below. In general the number of layers, ladders, or
-// detectors should be gotten from the AliITSgeom functions. Upon
-// creating the AliITS object it is set to zero.
-//
-// Int_t *fIdSens
-// This is a pointer to an array containing the Monte Carlo volume
-// numbers for the different layers of the ITS. These numbers are needed
-// by the StepManager function to determine what layer a hit was on. It
-// is sized and initialized in the Init function and the AliITSv? Init
-// function, called after a call to CreateGeometry. Upon creating the
-// AliITS object it points to zero. This variable is made a pointer
-// in order to keep the maximum flexibility at this level of the code.
-//
-// char **fIdName
-// This is a pointer to an array of characters containing the names of
-// the different ITS layers as defined in the Monte Carlo geometry data-
-// base. It is sized and filled in the AliITSv? Init function, called
-// after a call to CreatGeometry. Upon creating the AliITS object it
-// points to zero. This variable is make a pointer in order to keep the
-// maximum flexibility at this level of the code.
-//
-// Member Functions:
-//
-// AliITS()
-// The default constructor of the AliITS class. In addition to
-// creating the AliITS class it zeros the variables fIshunt (a member
-// of AliDetector class), fEuclidOut, and fIdN, and zeros the pointers
-// fITSpoints, fIdSens, and fIdName. The AliDetector default constructor
-// is also called.
-//
-// AliITS(const char *name, const char *title)
-// The constructor of the AliITS class. In addition to creating the
-// AliITS class, it allocates memory for the TClonesArrays fHits and
-// fDigits, and for the TObjArray fITSpoints. It also zeros the variables
-// fIshunt (a member of AliDetector class), fEuclidOut, and fIdN, and zeros
-// the pointers fIdSens and fIdName. To help in displaying hits via the ROOT
-// macro display.C AliITS also sets the marker color to red. The variables
-// passes with this constructor, const char *name and *title, are used by
-// the constructor of AliDetector class. See AliDetector class for a
-// description of these parameters and its constructor functions.
-//
-// ~AliITS()
-// The default destructor of the AliITS class. In addition to deleting
-// the AliITS class it deletes the memory pointed to by the fHits, fDigits,
-// fIdSens, fIdName, and fITSpoints.
-//
-// AddHit(Int_t track, Int_t *vol, Float_t *hits)
-// The function to add information to the AliITShit class. See the
-// AliITShit class for a full description. This function allocates the
-// necessary new space for the hit information and passes the variable
-// track, and the pointers *vol and *hits to the AliITShit constructor
-// function.
-//
-// AddDigit(Int_t *track, Int_t *digits)
-// The function to add information to the AliITSdigits class. See the
-// AliITSdigits class for a full description. This function allocates the
-// necessary new space for the digits information and passes the pointers
-// *track and *digits to the AliITSdigits constructor function.
-//
-// BuildGeometry()
-// This function builds a simple ITS geometry used by the ROOT macro
-// display.C. In general the geometry as coded is wrong.
-//
-// CreateGeometry()
-// This function builds the detailed geometry used by the Geant
-// Monte Carlo. As defined here it is a dummy routine to be replaced
-// by the version coded up in AliITSv? where the specific geometry to
-// be used by the simulation is defined. See the definition of AliITSv5
-// or the other routines for a complete definition.
-//
-// CreateMaterials()
-// This function defines the default materials used in the Geant
-// Monte Carlo simulations. In general it is automatically replaced by
-// the CreatMaterials routine defined in AliITSv?. Should the function
-// CreateMaterials not exist for the geometry version you are using this
-// one is used. See the definition found in AliITSv5 or the other routine
-// for a complete definition.
-//
-// IsVersion()
-// Returns the version number of the AliITS class. At present it is
-// version 1.
-//
-// DistancetoPrimitive(Int_t x, Int_t y)
-// A dummy routine used by the ROOT macro display.C to allow for the
-// use of the mouse (pointing device) in the macro. In general this should
-// never be called. If it is it returns the number 9999 for any value of
-// x and y.
-//
-// Init()
-// This routine initializes the AliITS class. It is intended to be called
-// from the Init function in AliITSv?. Besides displaying a banner
-// indicating that it has been called it initializes the array fIdSens.
-// Therefore it should be called after a call to CreateGeometry.
-//
-// MakeBranch(Option_t *Opt=" ")
-// Creates the TTree branch where the class AliITS is kept.
-//
-// SetEUCLID(bool_t euclid=1)
-// Sets the flag fEuclidOut to true (default) of false (euclid=0).
-// By setting or clearing the fEuclidOut flag you can controls whether
-// or not a euclid formatted output file of the ITS geometry is written.
-// If fEuclidOut is set true then a file called ITSgeometry.euc will be
-// written after the ITS geometry is defined in the Monte Carlo. If
-// fEuclidOut is set false then no file is created.
-//
-// StepManager()
-// Dummy routine which is replaced by the routine StepManager() defined
-// in AliITSv?. If no such routine exist then this routine returns zero.
-// See AliITSv? for a detailed description of the step manager routines.
-//
-// GetITSgeom()
-// Returns the value of the pointer fITSgeom. This is used to get
-// access to the ITS geometry stored in the file. See AliITSgeom for a
-// full description of the geometry package.
-//
-// GetITSpoints()
-// Returns the value of the pointer fITSpoints. This is used to get
-// access to the ITS cluster objects, if filled, stored in the file. See
-// AliITSCluster for a full description of the cluster data.
-////////////////////////////////////////////////////////////////////////
+ClassImp(AliITS)
+
//_____________________________________________________________________________
-AliITS::AliITS() {
+AliITS::AliITS() : AliDetector() {
//
// Default initialiser for ITS
// The default constructor of the AliITS class. In addition to
// creating the AliITS class it zeros the variables fIshunt (a member
// of AliDetector class), fEuclidOut, and fIdN, and zeros the pointers
- // fITSpoints, fIdSens, and fIdName.
+ // fITSpoints, fIdSens, and fIdName. The AliDetector default constructor
+ // is also called.
//
- fITSpoints = 0;
+
fIshunt = 0;
fEuclidOut = 0;
fIdN = 0;
fIdName = 0;
fIdSens = 0;
fITSmodules = 0;
-
+ //
+ fDetTypes = 0;
+ SetNDetTypes();
+ //
+ fDtype = 0;
+ fNdtype = 0;
+ fCtype = 0;
+ fNctype = 0;
+ fRecPoints = 0;
+ fNRecPoints = 0;
+ //
+ fITSgeom=0;
}
+
//_____________________________________________________________________________
AliITS::AliITS(const char *name, const char *title):AliDetector(name,title){
//
fHits = new TClonesArray("AliITShit", 1560);
gAlice->AddHitList(fHits);
- fDigits = new TClonesArray("AliITSdigit",1000);
- fITSpoints = new TObjArray();
- fITSmodules = 0; //new AliITSmodules();
+
+ SetNDetTypes();
+
+ fNdtype = 0;
+ fDtype = 0;
+ fCtype = 0;
+ fNctype = 0;
+
+ fRecPoints = 0;
+ fNRecPoints = 0;
+
+
+ fITSmodules = 0;
fIshunt = 0;
fEuclidOut = 0;
fIdN = 0;
fIdName = 0;
fIdSens = 0;
+
+ fDetTypes = new TObjArray(fNDetTypes);
+
+ Int_t i;
+ for(i=0;i<fNDetTypes;i++) {
+ (*fDetTypes)[i]=new AliITSDetType();
+ }
+ //
SetMarkerColor(kRed);
+ fITSgeom=0;
+}
+//___________________________________________________________________________
+AliITS::AliITS(AliITS &source){
+ if(this==&source) return;
+ printf("Error: You are not allowed to make a copy of the AliITS\n");
+ exit(1);
}
+//____________________________________________________________________________
+AliITS& AliITS::operator=(AliITS &source){
+ if(this==&source) return *this;
+ printf("Error: You are not allowed to make a copy of the AliITS\n");
+ exit(1);
+}
+//____________________________________________________________________________
+void AliITS::ClearModules(){
+ //clear the modules TObjArray
+ Int_t i;
+
+ if(fITSmodules!=0) {
+ Int_t indSPD = fITSgeom->GetModuleIndex(2,fITSgeom->GetNladders(2),
+ fITSgeom->GetNdetectors(2));
+ Int_t indSDD = fITSgeom->GetModuleIndex(4,fITSgeom->GetNladders(4),
+ fITSgeom->GetNdetectors(4));
+ for(i=0;i<fITSmodules->GetEntriesFast();i++){
+ if(i<indSPD)
+ delete (AliITSmodule *) fITSmodules->At(i);
+ else if(i<indSDD)
+ delete (AliITSmodule *) fITSmodules->At(i);
+ else
+ delete (AliITSmodule *) fITSmodules->At(i);
+ } // end for i
+ }// end if fITSmodules!=0
+}
//_____________________________________________________________________________
AliITS::~AliITS(){
//
// the AliITS class it deletes the memory pointed to by the fHits, fDigits,
// fIdSens, fIdName, and fITSpoints.
//
+
+
delete fHits;
delete fDigits;
+ delete fRecPoints;
if(fIdName!=0) delete[] fIdName;
if(fIdSens!=0) delete[] fIdSens;
- delete fITSmodules;
- if(fITSpoints!=0) delete fITSpoints;
-}
+ if(fITSmodules!=0) {
+ this->ClearModules();
+ delete fITSmodules;
+ }// end if fITSmodules!=0
-//_____________________________________________________________________________
-void AliITS::AddDigit(Int_t *tracks, Int_t *digits){
//
- // Add an ITS Digit
- // The function to add information to the AliITSdigits class. See the
- // AliITSdigits class for a full description. This function allocates the
- // necessary new space for the digits information and passes the pointers
- // *track and *digits to the AliITSdigits constructor function.
+ Int_t i;
+ if(fDtype) {
+ for(i=0;i<fNDetTypes;i++) {
+ delete (*fDtype)[i];
+ fNdtype[i]=0;
+ }
+ }
+
+ for(i=0;i<fNDetTypes;i++) {
+ delete (*fCtype)[i];
+ fNctype[i]=0;
+ }
+
//
- TClonesArray &ldigits = *fDigits;
- new(ldigits[fNdigits++]) AliITSdigit(tracks,digits);
+
+ if (fDetTypes) {
+ fDetTypes->Delete();
+ delete fDetTypes;
+ }
+
+ if (fTreeC) delete fTreeC;
+
+}
+
+//___________________________________________
+AliITSDetType* AliITS::DetType(Int_t id)
+{
+ //return pointer to id detector type
+ return ((AliITSDetType*) (*fDetTypes)[id]);
+
+}
+//___________________________________________
+void AliITS::SetClasses(Int_t id, TString digit, TString cluster)
+{
+ //set the digit and cluster classes to be used for the id detector type
+ ((AliITSDetType*) (*fDetTypes)[id])->ClassNames(digit,cluster);
+
+}
+//___________________________________________
+void AliITS::SetResponseModel(Int_t id, AliITSresponse *response)
+{
+ //set the response model for the id detector type
+
+ ((AliITSDetType*) (*fDetTypes)[id])->ResponseModel(response);
+
}
-Int_t AliITS::AddDigit(AliITSdigit* d) {
+//___________________________________________
+void AliITS::SetSegmentationModel(Int_t id, AliITSsegmentation *seg)
+{
+ //set the segmentation model for the id detector type
+
+ ((AliITSDetType*) (*fDetTypes)[id])->SegmentationModel(seg);
+
+}
+
+//___________________________________________
+void AliITS::SetSimulationModel(Int_t id, AliITSsimulation *sim)
+{
+ //set the simulation model for the id detector type
+
+ ((AliITSDetType*) (*fDetTypes)[id])->SimulationModel(sim);
+
+}
+//___________________________________________
+void AliITS::SetReconstructionModel(Int_t id, AliITSClusterFinder *reconst)
+{
+ //set the cluster finder model for the id detector type
+
+ ((AliITSDetType*) (*fDetTypes)[id])->ReconstructionModel(reconst);
- fDigits->Add(d);
- fNdigits = fDigits->GetEntriesFast();
- return fNdigits;
}
//_____________________________________________________________________________
TClonesArray &lhits = *fHits;
new(lhits[fNhits++]) AliITShit(fIshunt,track,vol,hits);
}
+//_____________________________________________________________________________
+void AliITS::AddRealDigit(Int_t id, Int_t *digits)
+{
+ // add a real digit - as coming from data
+
+ TClonesArray &ldigits = *((TClonesArray*)(*fDtype)[id]);
+ new(ldigits[fNdtype[id]++]) AliITSdigit(digits);
+
+}
+//_____________________________________________________________________________
+void AliITS::AddDigit(Int_t id, AliITSdigit *d)
+{
+
+ // add a simulated digit
+
+ // should have ctors of type AliITSdigitSDD(const AliITSdigitSDD &)
+
+ TClonesArray &ldigits = *((TClonesArray*)(*fDtype)[id]);
+
+ switch(id)
+ {
+ case 0:
+ new(ldigits[fNdtype[id]++]) AliITSdigitSPD(*((AliITSdigitSPD*)d));
+ break;
+ case 1:
+ new(ldigits[fNdtype[id]++]) AliITSdigitSDD(*((AliITSdigitSDD*)d));
+ break;
+ case 2:
+ new(ldigits[fNdtype[id]++]) AliITSdigitSSD(*((AliITSdigitSSD*)d));
+ break;
+ }
+
+}
+
+//_____________________________________________________________________________
+void AliITS::AddDigit(Int_t id,Float_t phys,Int_t *digits,Int_t *tracks,Float_t *charges){
+
+ // add a simulated digit to the list
+
+ TClonesArray &ldigits = *((TClonesArray*)(*fDtype)[id]);
+ switch(id)
+ {
+ case 0:
+ new(ldigits[fNdtype[id]++]) AliITSdigitSPD(digits,tracks);
+ break;
+ case 1:
+ new(ldigits[fNdtype[id]++]) AliITSdigitSDD(phys,digits,tracks,charges);
+ break;
+ case 2:
+ new(ldigits[fNdtype[id]++]) AliITSdigitSSD(digits,tracks);
+ break;
+ }
+
+}
+
+//_____________________________________________________________________________
+void AliITS::AddCluster(Int_t id, AliITSRawCluster *c)
+{
+
+ // add a cluster to the list
+
+ // should have ctors of type AliITSRawClusterSDD(const AliITSRawClusterSDD &)
+
+ TClonesArray &lcl = *((TClonesArray*)(*fCtype)[id]);
+
+ switch(id)
+ {
+ case 0:
+ new(lcl[fNctype[id]++]) AliITSRawClusterSPD(*((AliITSRawClusterSPD*)c));
+ break;
+ case 1:
+ new(lcl[fNctype[id]++]) AliITSRawClusterSDD(*((AliITSRawClusterSDD*)c));
+ break;
+ case 2:
+ new(lcl[fNctype[id]++]) AliITSRawClusterSSD(*((AliITSRawClusterSSD*)c));
+ break;
+ }
+
+}
+
+
+//_____________________________________________________________________________
+void AliITS::AddRecPoint(const AliITSRecPoint &r)
+{
+ //
+ // Add a reconstructed space point to the list
+ //
+ TClonesArray &lrecp = *fRecPoints;
+ new(lrecp[fNRecPoints++]) AliITSRecPoint(r);
+}
+
+
+//____________________________________________
+void AliITS::ResetDigits()
+{
+ //
+ // Reset number of digits and the digits array for thE ITS detector
+ //
+
+ if (!fDtype) return;
+
+ Int_t i;
+ for(i=0;i<fNDetTypes;i++ ) {
+ if ((*fDtype)[i]) ((TClonesArray*)(*fDtype)[i])->Clear();
+ if (fNdtype) fNdtype[i]=0;
+ }
+}
+
+//____________________________________________
+void AliITS::ResetDigits(Int_t i)
+{
+ //
+ // Reset number of digits and the digits array for this branch
+ //
+ if ((*fDtype)[i]) ((TClonesArray*)(*fDtype)[i])->Clear();
+ if (fNdtype) fNdtype[i]=0;
+
+}
+//____________________________________________
+void AliITS::ResetClusters()
+{
+ //
+ // Reset number of clusters and the clusters array for ITS
+ //
+
+ Int_t i;
+ for(i=0;i<fNDetTypes;i++ ) {
+ if ((*fCtype)[i]) ((TClonesArray*)(*fCtype)[i])->Clear();
+ if (fNctype) fNctype[i]=0;
+ }
+
+}
+//____________________________________________
+void AliITS::ResetClusters(Int_t i)
+{
+ //
+ // Reset number of clusters and the clusters array for this branch
+ //
+ if ((*fCtype)[i]) ((TClonesArray*)(*fCtype)[i])->Clear();
+ if (fNctype) fNctype[i]=0;
+
+}
+
+
+//____________________________________________
+void AliITS::ResetRecPoints()
+{
+ //
+ // Reset number of rec points and the rec points array
+ //
+ fNRecPoints = 0;
+ if (fRecPoints) fRecPoints->Clear();
+
+}
+
//_____________________________________________________________________________
Int_t AliITS::DistancetoPrimitive(Int_t , Int_t ){
//
// Initialise ITS after it has been built
// This routine initializes the AliITS class. It is intended to be called
// from the Init function in AliITSv?. Besides displaying a banner
- // indicating that it has been called it initializes the array fIdSens.
+ // indicating that it has been called it initializes the array fIdSens
+ // and sets the default segmentation, response, digit and raw cluster classes
// Therefore it should be called after a call to CreateGeometry.
//
+
+
+ SetDefaults();
+
Int_t i;
- //
+
printf("\n");
for(i=0;i<35;i++) printf("*");
printf(" ITS_INIT ");
printf("\n");
}
+//_____________________________________________________________________________
+void AliITS::SetDefaults()
+{
+ // sets the default segmentation, response, digit and raw cluster classes
+
+
+ AliITSDetType *iDetType;
+
+ //SPD
+
+ AliITSsegmentationSPD *seg0=new AliITSsegmentationSPD(fITSgeom);
+ AliITSresponseSPD *resp0=new AliITSresponseSPD();
+ iDetType=DetType(0);
+ if (!iDetType->GetSegmentationModel()) SetSegmentationModel(0,seg0);
+ if (!iDetType->GetResponseModel()) SetResponseModel(0,resp0);
+ // set digit and raw cluster classes to be used
+ const char *kData=resp0->DataType();
+ if (strstr(kData,"real")) {
+ iDetType->ClassNames("AliITSdigit","AliITSRawClusterSPD");
+ } else iDetType->ClassNames("AliITSdigitSPD","AliITSRawClusterSPD");
+
+ // SDD //
+ AliITSresponseSDD *resp1=new AliITSresponseSDD();
+ AliITSsegmentationSDD *seg1=new AliITSsegmentationSDD(fITSgeom,resp1);
+ iDetType=DetType(1);
+ if (!iDetType->GetSegmentationModel()) SetSegmentationModel(1,seg1);
+ if (!iDetType->GetResponseModel()) SetResponseModel(1,resp1);
+ kData=resp1->DataType();
+ Option_t *opt=resp1->ZeroSuppOption();
+ if ((!strstr(opt,"2D")) && (!strstr(opt,"1D")) || strstr(kData,"real") ) {
+ iDetType->ClassNames("AliITSdigit","AliITSRawClusterSDD");
+ } else iDetType->ClassNames("AliITSdigitSDD","AliITSRawClusterSDD");
+
+ // SSD
+ AliITSsegmentationSSD *seg2=new AliITSsegmentationSSD(fITSgeom);
+ AliITSresponseSSD *resp2=new AliITSresponseSSD();
+ iDetType=DetType(2);
+ if (!iDetType->GetSegmentationModel()) SetSegmentationModel(2,seg2);
+ if (!iDetType->GetResponseModel()) SetResponseModel(2,resp2);
+ kData=resp2->DataType();
+ if (strstr(kData,"real")) {
+ iDetType->ClassNames("AliITSdigit","AliITSRawClusterSSD");
+ } else iDetType->ClassNames("AliITSdigitSSD","AliITSRawClusterSSD");
+
+ if (fNDetTypes>3) {
+ Warning("SetDefaults","Only the three basic detector types are initialised!");
+ }
+
+}
+
+
+//_____________________________________________________________________________
+
+void AliITS::MakeTreeC(Option_t *option)
+{
+ // create a separate tree to store the clusters
+
+ char *optC = strstr(option,"C");
+ if (optC && !fTreeC) fTreeC = new TTree("TC","Clusters in ITS");
+
+ Int_t buffersize = 4000;
+ char branchname[30];
+
+ char *det[3] = {"SPD","SDD","SSD"};
+
+ // one branch for Clusters per type of detector
+ Int_t i;
+ for(i=0; i<fNDetTypes ;i++) {
+ if (fNDetTypes==3) sprintf(branchname,"%sClusters%s",GetName(),det[i]);
+ else sprintf(branchname,"%sClusters%d",GetName(),i+1);
+ if (fCtype && fTreeC) {
+ TreeC()->Branch(branchname,&((*fCtype)[i]), buffersize);
+ printf("Making Branch %s for Clusters of detector type %d\n",branchname,i+1);
+ }
+ }
+
+}
+
+//_____________________________________________________________________________
+void AliITS::GetTreeC(Int_t event)
+{
+
+ // get the clusters tree for this event and set the branch address
+ char treeName[20];
+ char branchname[30];
+
+ char *det[3] = {"SPD","SDD","SSD"};
+
+ ResetClusters();
+ if (fTreeC) {
+ delete fTreeC;
+ }
+
+ sprintf(treeName,"TreeC%d",event);
+ fTreeC = (TTree*)gDirectory->Get(treeName);
+
+
+ TBranch *branch;
+ if (fTreeC) {
+ Int_t i;
+ for(i=0; i<fNDetTypes; i++) {
+ if (fNDetTypes==3) sprintf(branchname,"%sClusters%s",GetName(),det[i]);
+ else sprintf(branchname,"%sClusters%d",GetName(),i+1);
+ if (fCtype) {
+ branch = fTreeC->GetBranch(branchname);
+ if (branch) branch->SetAddress(&((*fCtype)[i]));
+ }
+ }
+ } else {
+ printf("ERROR: cannot find Clusters Tree for event:%d\n",event);
+ }
+
+}
//_____________________________________________________________________________
void AliITS::MakeBranch(Option_t* option){
//
- // Create Tree branches for the ITS.
- // Creates the TTree branch where the class AliITS is kept.
+ // Creates Tree branches for the ITS.
//
+
+
Int_t buffersize = 4000;
- char branchname[10];
+ char branchname[30];
sprintf(branchname,"%s",GetName());
AliDetector::MakeBranch(option);
- char *D = strstr(option,"D");
- if (fDigits && gAlice->TreeD() && D) {
- gAlice->TreeD()->Branch(branchname,&fDigits, buffersize);
- printf("Making Branch %s for digits\n",branchname);
- } // end if
+// one branch for digits per type of detector
+
+ char *det[3] = {"SPD","SDD","SSD"};
+
+ fNdtype = new Int_t[fNDetTypes];
+ fDtype = new TObjArray(fNDetTypes);
+
+ fNctype = new Int_t[fNDetTypes];
+ fCtype = new TObjArray(fNDetTypes);
+
+ const char *kDigclass;
+ const char *kClclass;
+
+ Int_t i;
+ for(i=0; i<fNDetTypes ;i++) {
+ AliITSDetType *iDetType=DetType(i);
+ iDetType->GetClassNames(kDigclass,kClclass);
+ //printf("i, digclass, recclass %d %s %s\n",i,kDigclass,kClclass);
+ // digits
+ (*fDtype)[i] = new TClonesArray(kDigclass,100);
+ fNdtype[i]=0;
+ // clusters
+ (*fCtype)[i] = new TClonesArray(kClclass,100);
+ fNctype[i]=0;
+ }
+
+
+ for(i=0; i<fNDetTypes ;i++) {
+ if (fNDetTypes==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]);
+ else sprintf(branchname,"%sDigits%d",GetName(),i+1);
+
+ if (fDtype && gAlice->TreeD()) {
+ gAlice->TreeD()->Branch(branchname,&((*fDtype)[i]), buffersize);
+ printf("Making Branch %s for digits of type %d\n",branchname,i+1);
+ }
+ }
+
+ // only one branch for rec points for all detector types
+ sprintf(branchname,"%sRecPoints",GetName());
+
+ fRecPoints=new TClonesArray("AliITSRecPoint",1000);
+
+ if (fRecPoints && gAlice->TreeR()) {
+ gAlice->TreeR()->Branch(branchname,&fRecPoints, buffersize);
+ printf("Making Branch %s for reconstructed space points\n",branchname);
+ }
+
+
+}
+
+//___________________________________________
+void AliITS::SetTreeAddress()
+{
+
+ // Set branch address for the Trees.
+
+ char branchname[30];
+ AliDetector::SetTreeAddress();
+
+ char *det[3] = {"SPD","SDD","SSD"};
+
+ TBranch *branch;
+ TTree *treeD = gAlice->TreeD();
+ TTree *treeR = gAlice->TreeR();
+
+ Int_t i;
+ if (treeD) {
+ for(i=0; i<fNDetTypes; i++) {
+ if (fNDetTypes==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]);
+ else sprintf(branchname,"%sDigits%d",GetName(),i+1);
+ if (fDtype) {
+ branch = treeD->GetBranch(branchname);
+ if (branch) branch->SetAddress(&((*fDtype)[i]));
+ }
+ }
+ }
+
+
+ if (treeR) {
+ sprintf(branchname,"%sRecPoints",GetName());
+ if (fRecPoints) {
+ branch = treeR->GetBranch(branchname);
+ if (branch) branch->SetAddress(&fRecPoints);
+ }
+ }
+
+
+}
+
+//____________________________________________________________________________
+void AliITS::InitModules(Int_t size,Int_t &nmodules){
+
+ //initialize the modules array
+
+ Int_t nl,indexMAX,index;
+ Int_t indSPD,indSDD;
+
+ if(size<=0){ // default to using data stored in AliITSgeom
+ if(fITSgeom==0) {
+ printf("Error in AliITS::InitModule fITSgeom not defined\n");
+ return;
+ } // end if fITSgeom==0
+ nl = fITSgeom->GetNlayers();
+ indexMAX = fITSgeom->GetModuleIndex(nl,fITSgeom->GetNladders(nl),
+ fITSgeom->GetNdetectors(nl))+1;
+ nmodules = indexMAX;
+ fITSmodules = new TObjArray(indexMAX);
+ indSPD = fITSgeom->GetModuleIndex(2,fITSgeom->GetNladders(2),
+ fITSgeom->GetNdetectors(2));
+ indSDD = fITSgeom->GetModuleIndex(4,fITSgeom->GetNladders(4),
+ fITSgeom->GetNdetectors(4));
+ for(index=0;index<indexMAX;index++){
+ if(index<=indSPD)
+ fITSmodules->AddAt( new AliITSmodule(index),index);
+ else if(index<=indSDD)
+ fITSmodules->AddAt( new AliITSmodule(index),index);
+ else
+ fITSmodules->AddAt( new AliITSmodule(index),index);
+ } // end for index
+ }else{
+ fITSmodules = new TObjArray(size);
+ nmodules = size;
+ } // end i size<=0
+}
+
+//____________________________________________________________________________
+void AliITS::FillModules(Int_t evnt,Int_t bgrev,Int_t lastev,Int_t nmodules,Option_t *option,Text_t *filename){
+
+ // fill the modules with the sorted by module hits; add hits from background
+ // if option=Add
+
+ static TTree *trH1; //Tree with background hits
+ static TClonesArray *fHits2; //List of hits for one track only
+
+ static Bool_t first=kTRUE;
+ static TFile *file;
+ char *add = strstr(option,"Add");
+
+
+ if (add ) {
+ if(first) {
+ cout<<"filename "<<filename<<endl;
+ file=new TFile(filename);
+ cout<<"I have opened "<<filename<<" file "<<endl;
+ fHits2 = new TClonesArray("AliITShit",1000 );
+ }
+ first=kFALSE;
+ file->cd();
+ file->ls();
+ // Get Hits Tree header from file
+ if(fHits2) fHits2->Clear();
+ if(trH1) delete trH1;
+ trH1=0;
+
+ char treeName[20];
+ sprintf(treeName,"TreeH%d",bgrev);
+ trH1 = (TTree*)gDirectory->Get(treeName);
+ //printf("TrH1 %p of treename %s for event %d \n",trH1,treeName,bgrev);
+
+ if (!trH1) {
+ printf("ERROR: cannot find Hits Tree for event:%d\n",bgrev);
+ }
+ // Set branch addresses
+ TBranch *branch;
+ char branchname[20];
+ sprintf(branchname,"%s",GetName());
+ if (trH1 && fHits2) {
+ branch = trH1->GetBranch(branchname);
+ if (branch) branch->SetAddress(&fHits2);
+ }
+
+ // test
+ //Int_t ntracks1 =(Int_t)TrH1->GetEntries();
+ //printf("background - ntracks1 - %d\n",ntracks1);
+ }
+
+ // store temporarily coordinates of signal particles - see where delete
+ static Int_t *signal;
+ if(!signal) signal=new Int_t[nmodules];
+ memset(signal,0,sizeof(int)*nmodules);
+ Float_t xhit[nmodules][4];
+ Float_t yhit[nmodules][4];
+
+ Int_t npart = gAlice->GetEvent(evnt);
+ if(npart<=0) return;
+ TClonesArray *itsHits = this->Hits();
+ Int_t lay,lad,det,index;
+ AliITShit *itsHit=0;
+ AliITSmodule *mod=0;
+
+ TTree *iTH = gAlice->TreeH();
+ Int_t ntracks =(Int_t) iTH->GetEntries();
+
+ Int_t t,h;
+ for(t=0; t<ntracks; t++){
+ gAlice->ResetHits();
+ iTH->GetEvent(t);
+ Int_t nhits = itsHits->GetEntriesFast();
+ if (!nhits) continue;
+ // cout << nhits << " hits in track " << t << endl;
+ for(h=0; h<nhits; h++){
+ itsHit = (AliITShit *)itsHits->UncheckedAt(h);
+ itsHit->GetDetectorID(lay,lad,det);
+ index = fITSgeom->GetModuleIndex(lay,lad,det);
+ mod = this->GetModule(index);
+ if (add) {
+ xhit[index][signal[index]]=itsHit->fX;
+ yhit[index][signal[index]]=itsHit->fY;
+ signal[index]++;
+ if (signal[index] >4)
+ printf("index,nsignal %d %d\n",index,signal[index]);
+ }
+ if(lay == 1 || lay == 2)
+ mod->AddHit((AliITShit *) itsHit,t,h);
+ else if(lay == 3 || lay == 4)
+ mod->AddHit((AliITShit *) itsHit,t,h);
+ else if(lay == 5 || lay ==6)
+ mod->AddHit((AliITShit *)itsHit,t,h);
+ else
+ mod->AddHit(itsHit,t,h);
+
+ } // end loop over hits
+ } // end loop over tracks
+
+ // open the file with background
+
+ if (add ) {
+ Int_t track,i,isig;
+ ntracks =(Int_t)trH1->GetEntries();
+ //printf("background - ntracks1 %d\n",ntracks);
+ //printf("background - Start loop over tracks \n");
+ // Loop over tracks
+
+ for(track=0; track<ntracks; track++) {
+
+ if (fHits2) fHits2->Clear();
+ trH1->GetEvent(track);
+ // Loop over hits
+ for(i=0;i<fHits2->GetEntriesFast();++i) {
+
+ itsHit=(AliITShit*) (*fHits2)[i];
+ itsHit->GetDetectorID(lay,lad,det);
+ index = fITSgeom->GetModuleIndex(lay,lad,det);
+ mod = this->GetModule(index);
+
+ Float_t xbgr=itsHit->fX;
+ Float_t ybgr=itsHit->fY;
+ Float_t ebgr=itsHit->GetIonization();
+ Bool_t cond=kFALSE;
+
+ for(isig =0; isig < signal[index]; isig++) {
+ Float_t dist=
+ (xbgr-xhit[index][isig])*(xbgr-xhit[index][isig])
+ +(ybgr-yhit[index][isig])*(ybgr-yhit[index][isig]);
+ if (dist<0.2&& ebgr!=0) cond=kTRUE; // check this number for ITS!
+ }
+ if (!cond) continue;
+ if(lay == 1 || lay == 2)
+ mod->AddHit((AliITShit *) itsHit,track,i);
+ else if(lay == 3 || lay == 4)
+ mod->AddHit((AliITShit *) itsHit,track,i);
+ else if(lay == 5 || lay ==6)
+ mod->AddHit((AliITShit *)itsHit,track,i);
+ else
+ mod->AddHit(itsHit,track,i);
+
+
+ } // end loop over hits
+ } // end loop over tracks
+
+ TTree *fAli=gAlice->TreeK();
+ TFile *fileAli=0;
+
+ if (fAli) fileAli =fAli->GetCurrentFile();
+ //printf("fAli, file %p %p\n",fAli,file);
+ file->cd();
+
+ } // end if add
+
+ //if (evnt==lastev) {delete [] signal; delete signal;}
+
+ //gObjectTable->Print();
+
+}
+
+
+//____________________________________________________________________________
+void AliITS::HitsToDigits(Int_t evNumber,Int_t bgrev,Int_t lastev,Int_t size,
+Option_t *option,Option_t *opt,Text_t *filename)
+{
+ // keep galice.root for signal and name differently the file for
+ // background when add! otherwise the track info for signal will be lost !
+
+ char *all = strstr(opt,"All");
+ char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),strstr(opt,"SSD")};
+ //printf("Det 1 2 3 %s %s %s \n",det[0],det[1],det[2]);
+
+ Int_t nmodules;
+ InitModules(size,nmodules);
+ FillModules(evNumber,bgrev,lastev,nmodules,option,filename);
+ //printf("nmodules %d\n",nmodules);
+
+ TBranch *branch;
+ AliITSsimulation* sim;
+
+ TObjArray *branches=gAlice->TreeD()->GetListOfBranches();
+ AliITSgeom *geom = GetITSgeom();
+
+ Int_t id,module;
+ for(id=0;id<3;id++) {
+ //printf("id %d All %s det[id] %s \n",id,all,det[id]);
+ if (!all && !det[id]) continue;
+ branch = (TBranch*)branches->UncheckedAt(id);
+ AliITSDetType *iDetType=DetType(id);
+ sim = (AliITSsimulation*)iDetType->GetSimulationModel();
+ if (!sim) {
+ Error("HitsToDigits","The simulation class was not instantiated!");
+ exit(1);
+ // or SetDefaultSimulation(id,iDetType*);
+ }
+ Int_t first = geom->GetStartDet(id);
+ Int_t last = geom->GetLastDet(id);
+ //printf("det type %d first, last %d %d \n",id,first,last);
+ for(module=first;module<=last;module++) {
+ AliITSmodule *mod = (AliITSmodule *)fITSmodules->At(module);
+ sim->DigitiseModule(mod,module,evNumber);
+ // fills all branches - wasted disk space
+ gAlice->TreeD()->Fill();
+ ResetDigits();
+ // try and fill only the branch
+ //branch->Fill();
+ //ResetDigits(id);
+ } // loop over modules
+ } // loop over detector types
+
+
+ ClearModules();
+
+ //Int_t nentries=(Int_t)gAlice->TreeD()->GetEntries();
+
+ char hname[30];
+ sprintf(hname,"TreeD%d",evNumber);
+ gAlice->TreeD()->Write(hname);
+ // reset tree
+ gAlice->TreeD()->Reset();
+
+}
+
+
+//____________________________________________________________________________
+void AliITS::DigitsToRecPoints(Int_t evNumber,Int_t lastentry,Option_t *opt)
+{
+
+ char *all = strstr(opt,"All");
+ char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),strstr(opt,"SSD")};
+
+ static Bool_t first=kTRUE;
+ if (first) {
+ MakeTreeC("C");
+ first=kFALSE;
+ }
+ TTree *iTC=TreeC();
+
+ TBranch *branch;
+ AliITSClusterFinder* rec;
+
+ TObjArray *branches=gAlice->TreeR()->GetListOfBranches();
+ AliITSgeom *geom = GetITSgeom();
+
+ Int_t id,module;
+ for(id=0;id<fNDetTypes;id++) {
+ if (!all && !det[id]) continue;
+ branch = (TBranch*)branches->UncheckedAt(id);
+ AliITSDetType *iDetType=DetType(id);
+ rec = (AliITSClusterFinder*)iDetType->GetReconstructionModel();
+ if (!rec) {
+ Error("DigitsToRecPoints","The cluster finder class was not instantiated!");
+ exit(1);
+ // or SetDefaultClusterFinder(id,iDetType*);
+ }
+ TClonesArray *itsDigits = this->DigitsAddress(id);
+
+ Int_t first = geom->GetStartDet(id);
+ Int_t last = geom->GetLastDet(id);
+ //printf("det type %d first, last %d %d \n",id,first,last);
+ for(module=first;module<=last;module++) {
+ //printf("AliITS: module=%d\n",module);
+ this->ResetDigits();
+ if (all) gAlice->TreeD()->GetEvent(lastentry+module);
+ else gAlice->TreeD()->GetEvent(lastentry+(module-first));
+ Int_t ndigits = itsDigits->GetEntriesFast();
+ if (ndigits) rec->FindRawClusters();
+ gAlice->TreeR()->Fill();
+ ResetRecPoints();
+ iTC->Fill();
+ ResetClusters();
+ // try and fill only the branch
+ //branch->Fill();
+ //ResetRecPoints(id);
+ } // loop over modules
+ } // loop over detector types
+
+
+ //Int_t nentries=(Int_t)gAlice->TreeR()->GetEntries();
+
+ //Int_t ncentries=(Int_t)TC->GetEntries();
+
+ char hname[30];
+ sprintf(hname,"TreeR%d",evNumber);
+ gAlice->TreeR()->Write(hname);
+ // reset tree
+ gAlice->TreeR()->Reset();
+
+ sprintf(hname,"TreeC%d",evNumber);
+ iTC->Write(hname);
+ iTC->Reset();
+}
+
+
+//____________________________________________________________________________
+void AliITS::HitsToFastRecPoints(Int_t evNumber,Int_t bgrev,Int_t lastev,Int_t size,
+Option_t *option,Option_t *opt,Text_t *filename)
+{
+ // keep galice.root for signal and name differently the file for
+ // background when add! otherwise the track info for signal will be lost !
+
+ char *all = strstr(opt,"All");
+ char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),strstr(opt,"SSD")};
+
+ Int_t nmodules;
+ InitModules(size,nmodules);
+ FillModules(evNumber,bgrev,lastev,nmodules,option,filename);
+
+ static AliITSsimulationFastPoints* sim=0;
+ if (!sim) sim = new AliITSsimulationFastPoints();
+
+
+ AliITSgeom *geom = GetITSgeom();
+
+ Int_t id,module;
+ for(id=0;id<3;id++) {
+ if (!all && !det[id]) continue;
+ Int_t first = geom->GetStartDet(id);
+ Int_t last = geom->GetLastDet(id);
+ for(module=first;module<=last;module++) {
+ AliITSmodule *mod = (AliITSmodule *)fITSmodules->At(module);
+ sim->CreateFastRecPoints(mod);
+ gAlice->TreeR()->Fill();
+ ResetRecPoints();
+ } // loop over modules
+ } // loop over detector types
+
+
+ ClearModules();
+
+ //Int_t nentries=(Int_t)gAlice->TreeR()->GetEntries();
+
+ char hname[30];
+ sprintf(hname,"TreeR%d",evNumber);
+ gAlice->TreeR()->Write(hname);
+ // reset tree
+ gAlice->TreeR()->Reset();
+
}
//____________________________________________________________________________
// Stream an object of class AliITS.
Int_t i,j,l;
+ AliITSDetType *det;
+ AliITSresponse *response;
+ AliITSsegmentation *seg;
+ TClonesArray *digitsaddress;
+ TClonesArray *clustaddr;
+
+
if (R__b.IsReading()) {
Version_t R__v = R__b.ReadVersion();
if (R__v == 1) {
AliDetector::Streamer(R__b);
R__b >> fITSgeom;
-// R__b >> fITSmodules; //We do not write out modules so don't read them
- R__b >> fITSpoints;
R__b >> fEuclidOut;
R__b >> fIdN;
if(fIdSens!=0) delete[] fIdSens;
} // end for i
R__b >> fMajorVersion;
R__b >> fMinorVersion;
+ R__b >> fDtype;
+ R__b.ReadArray(fNdtype);
+ R__b >> fCtype;
+ R__b.ReadArray(fNctype);
+ R__b >> fDetTypes;
+ R__b >> fNDetTypes;
+ R__b >> fRecPoints;
+ R__b >> fNRecPoints;
+ // stream out only response and segmentation
+ for(i=0;i<fNDetTypes;i++) {
+ det=(AliITSDetType*)(*fDetTypes)[i];
+ det->Streamer(R__b);
+ response=det->GetResponseModel();
+ if (response) response->Streamer(R__b);
+ seg=det->GetSegmentationModel();
+ if (seg) seg->Streamer(R__b);
+ digitsaddress=(TClonesArray*) (*fDtype)[i];
+ digitsaddress->Streamer(R__b);
+ clustaddr=(TClonesArray*) (*fCtype)[i];
+ clustaddr->Streamer(R__b);
+ }
+
} // end if (R__v)
} else {
R__b.WriteVersion(AliITS::IsA());
AliDetector::Streamer(R__b);
R__b << fITSgeom;
-// R__b << fITSmodules; //We don't want to write out the modules class.
- R__b << fITSpoints;
R__b << fEuclidOut;
R__b << fIdN;
for(i=0;i<fIdN;i++) R__b <<fIdSens[i];
} // end for i
R__b << fMajorVersion;
R__b << fMinorVersion;
+ R__b << fDtype;
+ R__b.WriteArray(fNdtype, fNDetTypes);
+ R__b << fCtype;
+ R__b.WriteArray(fNctype, fNDetTypes);
+ R__b << fDetTypes;
+ R__b << fNDetTypes;
+ R__b << fRecPoints;
+ R__b << fNRecPoints;
+ for(i=0;i<fNDetTypes;i++) {
+ det=(AliITSDetType*)(*fDetTypes)[i];
+ det->Streamer(R__b);
+ response=det->GetResponseModel();
+ if(response) response->Streamer(R__b);
+ seg=det->GetSegmentationModel();
+ if (seg) seg->Streamer(R__b);
+ digitsaddress=(TClonesArray*) (*fDtype)[i];
+ digitsaddress->Streamer(R__b);
+ clustaddr=(TClonesArray*) (*fCtype)[i];
+ clustaddr->Streamer(R__b);
+ }
}
+
+
}
+
+ClassImp(AliITSRecPoint)
+ClassImp(AliITSsegmentation)
+ClassImp(AliITSresponse)
+//ClassImp(AliITStrack)
+
-#ifndef ITS_H
-#define ITS_H
+#ifndef ALIITS_H
+#define ALIITS_H
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */
/* $Id$ */
////////////////////////////////////////////////////////////////////////
-// Manager and hits classes for set: ITS //
+// Manager class for set: ITS //
////////////////////////////////////////////////////////////////////////
-#include "TObjArray.h"
+#include <TObjArray.h>
+#include <TBranch.h>
+#include <TTree.h>
+#include <TFile.h>
+#include <TObjectTable.h>
+
#include "AliDetector.h"
#include "AliITSgeom.h"
+#include "AliITSsegmentation.h"
+#include "AliITSresponse.h"
+#include "AliITSDetType.h"
+#include "AliITShit.h"
#include "AliITSdigit.h"
#include "AliITSmodule.h"
+#include "AliITSRecPoint.h"
+#include "AliITSRawCluster.h"
-class AliITS : public AliDetector {
- protected:
- AliITSgeom *fITSgeom; // Pointer to ITS geometry
- TObjArray *fITSmodules; // Pointer to ITS modules
- // Defined here since it doesn't have a place in AliDetector like fDigit
- TObjArray *fITSpoints; // Pointer to ITS points
-
- Bool_t fEuclidOut; // Flag to write out geometry in euclid format
- Int_t fIdN; // the number of layers
- Int_t *fIdSens; char **fIdName; //layer identifier
- // Geometry and Stepmanager version numbers used.
- Int_t fMajorVersion,fMinorVersion;
+class AliITSsimulation;
+class AliITSClusterFinder;
+//class AliITStrack;
+
+class AliITS : public AliDetector {
public:
- AliITS();
- AliITS(const char *name, const char *title);
- virtual ~AliITS();
-
- virtual void AddHit(Int_t, Int_t*, Float_t*);
- virtual void AddDigit(Int_t*, Int_t*);
- virtual Int_t AddDigit(AliITSdigit *d);
-// virtual void AddPoint(); // yet to be defined
-
- virtual void BuildGeometry() {};
- virtual void CreateGeometry() {};
- virtual void CreateMaterials() {};
-
- virtual TObjArray* GetModules() const {return fITSmodules;}
- virtual TObjArray* GetPoints() const {return fITSpoints;}
-
- void GetGeometryVersion(Int_t &a,Int_t &b) const
- {a = fMajorVersion;b=fMinorVersion;return;}
- virtual Int_t IsVersion() const {return 1;}
- Int_t DistancetoPrimitive(Int_t px, Int_t py);
- virtual void Init();
- virtual void MakeBranch(Option_t *opt=" ");
- virtual void SetEUCLID(Bool_t euclid=1) {fEuclidOut = euclid;}
- virtual void StepManager()=0;
+ AliITS();
+ AliITS(const char *name, const char *title);
+ virtual ~AliITS();
+ AliITS(AliITS &source);
+ AliITS & operator=(AliITS &source);
+
+ virtual void AddHit(Int_t track, Int_t *vol, Float_t *hits);
+ virtual void AddRealDigit(Int_t branch, Int_t *digits);
+ virtual void AddDigit(Int_t branch, AliITSdigit *d);
+ virtual void AddDigit(Int_t branch,Float_t phys,Int_t* digits, Int_t* tracks, Float_t* trkcharges);
//
+ virtual void AddCluster(Int_t branch, AliITSRawCluster *c);
+ virtual void AddRecPoint(const AliITSRecPoint &p);
+ virtual void AddTrack(Float_t* tracks) {}
+// virtual void AddTrack(const AliITStrack&) {}
+
+ virtual void ResetDigits(); // depending on how the
+ virtual void ResetDigits(Int_t branch); // tree will be filled only
+ virtual void ResetClusters(); // one of the methods in
+ virtual void ResetClusters(Int_t branch); // the pair will be kept
+ virtual void ResetRecPoints();
+
+ virtual void BuildGeometry() {}
+ virtual void CreateGeometry() {}
+ virtual void CreateMaterials() {}
+
+ void GetGeometryVersion(Int_t &a,Int_t &b) const
+ {a = fMajorVersion;b=fMinorVersion;return;}
+ virtual Int_t IsVersion() const {return 1;}
+ Int_t DistancetoPrimitive(Int_t px, Int_t py);
+ virtual void Init();
+ virtual void SetDefaults();
+ // create separate tree for clusters - declustering refining
+ virtual void MakeTreeC(Option_t *option="C");
+ void GetTreeC(Int_t event);
+ virtual void MakeBranch(Option_t *opt=" ");
+ void SetTreeAddress();
+ virtual void SetEUCLID(Bool_t euclid=1) {fEuclidOut = euclid;}
+ virtual void StepManager() {}
+ // sort hits by module
+ virtual void InitModules(Int_t size,Int_t &nmodules);
+ virtual void FillModules(Int_t evnt,Int_t bgrev,Int_t lastev,
+ Int_t nmodules,Option_t *opt,Text_t *filename);
+ virtual void ClearModules();
+ // Digitisation
+ void HitsToDigits(Int_t evNumber,Int_t bgrev,Int_t lastev,Int_t size,
+ Option_t *add, Option_t *det, Text_t *filename);
+ // Reconstruct hits
+ void DigitsToRecPoints(Int_t evNumber,Int_t lastEntry,Option_t *det);
+ // Fast simulation of space points from hits
+ void HitsToFastRecPoints(Int_t evNumber,Int_t bgrev,Int_t lastev,Int_t size,
+ Option_t *add, Option_t *det, Text_t *filename);
+
+
+
+ // Write digits into raw data format
+ virtual void Digits2RawData() {}
+
+ // Configuration Methods (per detector type )
+ // Set number of detector types
+ virtual void SetNDetTypes(Int_t ndtypes=3) {fNDetTypes=ndtypes;}
+ // Set response
+ virtual void SetResponseModel(Int_t id, AliITSresponse *response);
+ // Set segmentation
+ virtual void SetSegmentationModel(Int_t id, AliITSsegmentation *seg);
+ // Set simulation - temporary
+ virtual void SetSimulationModel(Int_t id, AliITSsimulation *sim);
+ // Set reconstruction
+ virtual void SetReconstructionModel(Int_t id, AliITSClusterFinder *rec);
+ // Set class names for digit and rec point
+ virtual void SetClasses(Int_t id, TString digit, TString cluster);
+
+
+ // Getters
// ITS geometry functions
- virtual AliITSgeom *GetITSgeom() const {return fITSgeom;}
- virtual TObjArray *GetITSpoints() const {return fITSpoints;}
+ virtual AliITSgeom *GetITSgeom() const {return fITSgeom;}
+ virtual TObjArray *GetModules() const {return fITSmodules;}
+ AliITSmodule *GetModule(Int_t index) {return (AliITSmodule *)
+ (fITSmodules->At(index));}
- ClassDef(AliITS,1)
+ // Return pointers to digits
+ TObjArray *Dtype() {return fDtype;}
+ Int_t *Ndtype() {return fNdtype;}
+ virtual TClonesArray *DigitsAddress(Int_t id)
+ {return ((TClonesArray *) (*fDtype)[id]);}
+ // Return pointers to clusters
+ TObjArray *Ctype() {return fCtype;}
+ Int_t *Nctype() {return fNctype;}
+ virtual TClonesArray *ClustersAddress(Int_t id)
+ {return ((TClonesArray *) (*fCtype)[id]);}
+
+ // Return pointer to rec points
+ TClonesArray *RecPoints() {return fRecPoints;}
+ // Return pointer to tracks
+ TClonesArray *Tracks() {return fTracks;}
+
+ // Return pointer to DetType #id
+ AliITSDetType *DetType(Int_t id);
+ Int_t NDetTypes() {return fNDetTypes;}
+
+ // Return pointer to the tree of clusters
+ TTree *TreeC() {return fTreeC;}
+
+ protected:
+
+ AliITSgeom *fITSgeom; // Pointer to ITS geometry
+ TObjArray *fITSmodules; // Pointer to ITS modules
+
+ Bool_t fEuclidOut; // Flag to write out geometry
+ //in euclid format
+ Int_t fIdN; // the number of layers
+ Int_t *fIdSens; char **fIdName; //layer identifier
+ // Geometry and Stepmanager version numbers used.
+ Int_t fMajorVersion,fMinorVersion; //detailed and coarse(minor) versions
+ //
+ //
+ TObjArray *fDetTypes; // List of detector types
+ Int_t fNDetTypes; // Number of Detector types
+
+ TObjArray *fDtype; // List of digits
+ Int_t *fNdtype; // Number of digits per type of
+ // detector
+ TObjArray *fCtype; // List of clusters
+ Int_t *fNctype; // Number of clusters per type
+ // of detector
+
+
+ TClonesArray *fRecPoints; // List of reconstructed points
+ Int_t fNRecPoints; // Number of rec points
+ TClonesArray *fTracks; // List of reconstructed tracks
+ TTree *fTreeC; // Tree for raw clusters
+
+
+ ClassDef(AliITS,1) // Base class for ITS
};
+
#endif
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * *
- * Author: The ALICE Off-line Project. *
- * Contributors are mentioned in the code where appropriate. *
- * *
- * Permission to use, copy, modify and distribute this software and its *
- * documentation strictly for non-commercial purposes is hereby granted *
- * without fee, provided that the above copyright notice appears in all *
- * copies and that both the copyright notice and this permission notice *
- * appear in the supporting documentation. The authors make no claims *
- * about the suitability of this software for any purpose. It is *
- * provided "as is" without express or implied warranty. *
- **************************************************************************/
-
-/*
-$Log$
-*/
-
-//
-#include "AliITS.h"
+////////////////////////////////////////////////
+// Digits classes for set:ITS //
+////////////////////////////////////////////////
+
+
#include "AliITSdigit.h"
-#include "AliRun.h"
-////////////////////////////////////////////////////////////////////////
-// Version: 0
-// Written by Rene Brun, Federico Carminati, and Roberto Barbera
-// Minor modifications made and documented by Bjorn S. Nilsen
-// July 11 1999
-//
-// The default ITS digit structure. This should either be replaced
-// or added on to later with the proper digit structure defined for
-// each detector type. See the proposed Digit structure defined by
-// Bjorn S. Nilsen for an example.
-//Begin_Html
-/*
-<img src="picts/ITS/AliITShit_Class_Diagram.gif">
-</pre>
-<br clear=left>
-<font size=+2 color=red>
-<p>This show the relasionships between the ITS digit class' and the rest of Aliroot.
-</font>
-<pre>
-*/
-//End_Html
-//_____________________________________________________________________________
+
ClassImp(AliITSdigit)
+//_____________________________________________________________________________
+
+AliITSdigit::AliITSdigit(Int_t *digits) {
+ //
+ // Creates a real data digit object
+ //
+ fCoord1 = digits[0];
+ fCoord2 = digits[1];
+ fSignal = digits[2];
+}
+
+
+ClassImp(AliITSdigitSPD)
+
+ //_________________________________________________________________________
+ AliITSdigitSPD::AliITSdigitSPD(Int_t *digits) {
+ //
+ // Creates a SPD digit object
+ //
+
+ fCoord1 = digits[0];
+ fCoord2 = digits[1];
+ fSignal = digits[2];
+
+}
-AliITSdigit::AliITSdigit(Int_t *tracks, Int_t *digits):
- AliDigit(tracks){
+//_____________________________________________________________________________
+AliITSdigitSPD::AliITSdigitSPD(Int_t *digits,Int_t *tracks) {
//
- // Create ITS digit
- // The creator for the AliITSdigit class. This routine fills the
- // AliITSdigit data members from the array digits. The array of track
- // numbers are passed to the AliDigit creator. The order of the elements
- // in the digits array are fEvent = digits[0], fLayer = digits[1],
- // fLadder = digits[2], fDet = digits[3], and fNoverl = digits[4].
- // Therefore the array digits is expected to be at least 5 elements long.
+ // Creates a simulated SPD digit object
//
- fEvent = digits[0];
- fLayer = digits[1];
- fLadder = digits[2];
- fDet = digits[3];
- fNoverl = digits[4];
+
+ fCoord1 = digits[0];
+ fCoord2 = digits[1];
+ fSignal = digits[2];
+
+ Int_t i;
+ for(i=0; i<3; i++) {
+ fTracks[i] = tracks[i];
+ }
}
+
+
+ClassImp(AliITSdigitSDD)
+ //________________________________________________________________________
+ AliITSdigitSDD::AliITSdigitSDD(Float_t phys,Int_t *digits) {
+ //
+ // Creates a simulated SDD digit object to be updated
+ //
+ fCoord1 = digits[0];
+ fCoord2 = digits[1];
+ fSignal = digits[2];
+ fPhysics = phys;
+}
+
+//_____________________________________________________________________________
+AliITSdigitSDD::AliITSdigitSDD(Float_t phys,Int_t *digits,Int_t *tracks, Float_t *charges) {
+ //
+ // Creates a simulated SDD digit object
+ //
+ fCoord1 = digits[0];
+ fCoord2 = digits[1];
+ fSignal = digits[2];
+ fPhysics = phys;
+
+ Int_t i;
+ for(i=0; i<3; i++) {
+ fTcharges[i] = charges[i];
+ fTracks[i] = tracks[i];
+ }
+}
+
+
+ClassImp(AliITSTransientDigit)
+ //_______________________________________________________________________
+ AliITSTransientDigit::AliITSTransientDigit(Float_t phys,Int_t *digits):
+ AliITSdigitSDD(phys,digits) {
+ //
+ // Creates a digit object in a list of digits to be updated
+ //
+ fTrackList = new TObjArray;
+}
+
+//__________________________________________________________________________
+AliITSTransientDigit::AliITSTransientDigit(const AliITSTransientDigit &source){
+ // Copy Constructor
+ if(&source == this) return;
+ this->fTrackList = source.fTrackList;
+ return;
+}
+
+//_________________________________________________________________________
+AliITSTransientDigit&
+ AliITSTransientDigit::operator=(const AliITSTransientDigit &source) {
+ // Assignment operator
+ if(&source == this) return *this;
+ this->fTrackList = source.fTrackList;
+ return *this;
+}
+
+ClassImp(AliITSdigitSSD)
+ //__________________________________________________________________________
+ AliITSdigitSSD::AliITSdigitSSD(Int_t *digits) {
+ //
+ // Creates a real SSD digit object
+ //
+
+ fCoord1 = digits[0];
+ fCoord2 = digits[1];
+ fSignal = digits[2];
+
+}
+
+//_____________________________________________________________________________
+AliITSdigitSSD::AliITSdigitSSD(Int_t *digits,Int_t *tracks) {
+ //
+ // Creates a simulated SSD digit object
+ //
+
+ fCoord1 = digits[0];
+ fCoord2 = digits[1];
+ fSignal = digits[2];
+
+ Int_t i;
+ for(i=0; i<3; i++) {
+ fTracks[i] = tracks[i];
+ }
+}
+
-#ifndef ITSDIGIT_H
-#define ITSDIGIT_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
+#ifndef ALIITSDIGIT_H
+#define ALIITSDIGIT_H
-/* $Id$ */
+////////////////////////////////////////////////
+// Digits classes for set:ITS //
+////////////////////////////////////////////////
-#include "AliDigit.h"
-#include "AliITS.h"
-#include "AliITSgeom.h"
+#include <TObject.h>
+#include <TObjArray.h>
//___________________________________________
-class AliITSdigit: public AliDigit {
-////////////////////////////////////////////////////////////////////////
-// Version: 0
-// Written by Rene Brun, Federico Carminati, and Roberto Barbera
-// Minor modifications made and documented by Bjorn S. Nilsen
-// July 11 1999
-//
-// The default ITS digit structure. This should either be replaced
-// or added on to later with the proper digit structure defined for
-// each detector type. See the proposed Digit structure defined by
-// Bjorn S. Nilsen for an example.
-//
-// Data members:
-//
-// Int_t fTracks[3]
-// See AliDigit for a full description. The track numbers, up to 3,
-// that make up this digit.
-//
-// Int_t fEvent
-// The event number for this digit. This information is probably
-// kept someplace else already (via the TTree structure already in use).
-//
-// Int_t fLayer
-// The layer number of this digit. This is part of the information
-// that determines the detector where this digit is located (layer, ladder,
-// and detector numbers).
-//
-// Int_t fLadder
-// The ladder number of this digit. This is part of the information
-// that determines the detector where this digit is located (layer, ladder,
-// and detector numbers).
-//
-// Int_t fDet
-// The detector number of this digit. This is part of the information
-// that determines the detector where this digit is located (layer, ladder,
-// and detector numbers).
-//
-// Int_t fNoverl
-// The number of hits that make up this digit.
-//
-// Member functions:
-//
-// int *GetTracks()
-// See AliDigit for a full description. Returns a pointer to the
-// array fTracks where the tracks number of the tracks that make up
-// this digit are stored.
-//
-// AliITSdigit()
-// The default creator for the AliITSdigit class.
-//
-// AliITSdigit(Int_t *tracks, Int_t *digits)
-// The creator for the AliITSdigit class. This routine fills the
-// AliITSdigit data members from the array digits. The array of track
-// numbers are passed to the AliDigit creator. The order of the elements
-// in the digits array are fEvent = digits[0], fLayer = digits[1],
-// fLadder = digits[2], fDet = digits[3], and fNoverl = digits[4].
-// Therefore the array digits is expected to be at least 5 elements long.
-//
-// ~AliITSdigit()
-// The destructor for the AliITSdigit class. At present the default
-// destructor is used.
-////////////////////////////////////////////////////////////////////////
- public:
- Int_t fEvent; // Event number
- Int_t fLayer; // Layer number
- Int_t fLadder; // Ladder number
- Int_t fDet; // Detector number
- Int_t fNoverl; // Number of overflow
+class AliITSdigit: public TObject {
+
+public:
+
+ Int_t fCoord1; // Cell number on Z axis (SPD+SDD) , flag for side type (SSD)
+ Int_t fCoord2 ; // Cell number on X axis (SPD+SDD) , strip number (SSD)
+ Int_t fSignal; // Signal
+
+public:
+ AliITSdigit() {
+ // constructor
+ fSignal=fCoord1=fCoord2=0;
+ }
+ AliITSdigit(Int_t *digits);
+ virtual ~AliITSdigit() {
+ // destructor
+ }
+
+ ClassDef(AliITSdigit,1) // Real data digit object for set:ITS
+ };
+
+//___________________________________________
+class AliITSdigitSPD: public AliITSdigit {
+
+public:
+
+ // debugging -- goes to the dictionary
+ Int_t fTracks[3]; // tracks making this digit
+
+public:
+ AliITSdigitSPD() {
+ // constructor
+ fSignal=fCoord1=fCoord2=0;
+ fTracks[0]=fTracks[1]=fTracks[2]=0;
+ }
+
+ AliITSdigitSPD(Int_t *digits);
+ AliITSdigitSPD(Int_t *digits, Int_t *tracks);
+
+ virtual ~AliITSdigitSPD(){
+ // destructor
+ }
+ virtual int *GetTracks() {
+ // returns pointer to the array of tracks which make this digit
+ return &fTracks[0];
+ }
+
+ ClassDef(AliITSdigitSPD,1) // Simulated digit object for SPD
+ };
+
+//___________________________________________
+class AliITSdigitSDD: public AliITSdigit {
+
+public:
+
+ // debugging -- goes to the dictionary
+ Int_t fTracks[3]; // tracks making this digit
+ Float_t fTcharges[3]; // charge per track making this digit
+ Float_t fPhysics; // signal particles contribution to signal
+
+public:
+ AliITSdigitSDD() {
+ // constructor
+ fSignal=fCoord1=fCoord2=0;
+ fTracks[0]=fTracks[1]=fTracks[2]=0;
+ fPhysics=0; fTcharges[0]=fTcharges[1]=fTcharges[2]=0;
+ }
+
+ AliITSdigitSDD(Float_t phys,Int_t *digits);
+ AliITSdigitSDD( Float_t phys, Int_t *digits, Int_t *tracks, Float_t *charges);
+
+ virtual ~AliITSdigitSDD(){
+ // destructor
+ }
+ virtual int *GetTracks() {
+ // returns pointer to the array of tracks which make this digit
+ return &fTracks[0];
+ }
+
+ ClassDef(AliITSdigitSDD,1) // Simulated digit object for SDD
+ };
+
+//_____________________________________________________________________________
+
+class AliITSTransientDigit : public AliITSdigitSDD {
+public:
+ TObjArray *fTrackList; // track list
+public:
+ AliITSTransientDigit() {
+ // constructor
+ fTrackList=0;
+ }
+ AliITSTransientDigit(Float_t phys,Int_t *digits);
+ virtual ~AliITSTransientDigit() {
+ // destructor
+ delete fTrackList;
+ }
+ AliITSTransientDigit(const AliITSTransientDigit &source); // copy constructor
+ AliITSTransientDigit& operator=(const AliITSTransientDigit &source); // ass. operator
+ TObjArray *TrackList() {
+ // returns pointer to the TObjArray of tracks and associated charges
+ return fTrackList;
+ }
+
+ ClassDef(AliITSTransientDigit,1) // Transient digit for set: ITS
+ };
+
+//___________________________________________
+class AliITSdigitSSD: public AliITSdigit {
+
+public:
+
+ // debugging -- goes to the dictionary
+ Int_t fTracks[3]; // tracks making this digit
+
+public:
+ AliITSdigitSSD() {
+ // constructor
+ fSignal=fCoord1=fCoord2=0;
+ fTracks[0]=fTracks[1]=fTracks[2]=0;
+ }
+
+ AliITSdigitSSD(Int_t *digits);
+ AliITSdigitSSD(Int_t *digits, Int_t *tracks);
+
+ virtual ~AliITSdigitSSD(){
+ // destructor
+ }
+
+ Int_t GetSignal() const {
+ // returns signal
+ return fSignal;
+ }
+
+ Int_t GetStripNumber() const {
+ // returns strip number
+ return fCoord2;
+ }
+
+ Int_t IsSideP() const {
+ //returns 1 when side P and 0 when side N
+ return fCoord1;
+ }
+
+ virtual int *GetTracks() {
+ // returns pointer to the array of tracks which make this digit
+ return &fTracks[0];
+ }
+
+ ClassDef(AliITSdigitSSD,1) // Simulated digit object for SSD
+ };
- public:
- AliITSdigit() {}
- AliITSdigit(Int_t *tracks, Int_t *digits);
- virtual ~AliITSdigit() {}
- ClassDef(AliITSdigit,1) //Digit (Header) object for set:ITS
-};
#endif
/*
$Log$
+Revision 1.2.4.6 2000/06/11 20:29:39 barbera
+Minore changes.
+
Revision 1.2.4.2 2000/03/04 23:55:35 nilsen
Fixed up comments/documentation.
/*
$Log$
+Revision 1.2.4.5 2000/06/11 20:30:05 barbera
+Minore changes.
+
Revision 1.3 2000/03/07 18:46:59 nilsen
Merged form ITS-working to HEAD. Minor changes
/*
$Log$
+Revision 1.1.2.6 2000/06/12 18:10:03 barbera
+fixed posible compilation errors on HP unix
+
+Revision 1.1.2.5 2000/06/11 20:30:36 barbera
+Minore changes.
+
+Revision 1.4 2000/06/10 20:34:37 nilsen
+Fixed compilation warning with HP unix.
+
Revision 1.3 2000/06/10 10:43:04 nilsen
Fixed bug in copy and operator =.
// correct detector size for bin size.
fdx = 0.0;
- for(Int_t i=0;i<fNbinx;i++) fdx +=fBinSizeX[i];
+ for(i=0;i<fNbinx;i++) fdx +=fBinSizeX[i];
fdx *= 0.5;
fdz = 0.0;
- for(Int_t i=0;i<fNbinz;i++) fdz +=fBinSizeZ[i];
+ for(i=0;i<fNbinz;i++) fdz +=fBinSizeZ[i];
fdz *= 0.5;
fShapeSPD = new TBRIK("ActiveSPD","Active volume of SPD","SPD SI DET",
/*
$Log$
+Revision 1.1.2.6 2000/06/12 18:10:18 barbera
+fixed posible compilation errors on HP unix
+
+Revision 1.1.2.5 2000/06/11 20:30:56 barbera
+Minore changes.
+
+Revision 1.4 2000/06/10 20:34:22 nilsen
+Fixed compilation warning with HP unix.
+
Revision 1.3 2000/06/10 10:42:49 nilsen
Fixed bug in copy and operator =.
//----------------------------------------------------------------------
void AliITSgeomSPD425::Streamer(TBuffer &R__b){
// Streamer function for the class AliITSgeomSPD425.
+ Int_t i;
UInt_t R__s, R__c;
if(R__b.IsReading()){
R__b >> fNbinx;
if(fBinSizeX!=0) delete[] fBinSizeX;
fBinSizeX = new Float_t[fNbinx];
- for(Int_t i=0;i<fNbinx;i++) R__b >> fBinSizeX[i];
+ for(i=0;i<fNbinx;i++) R__b >> fBinSizeX[i];
R__b >> fNbinz;
if(fBinSizeZ!=0) delete[] fBinSizeZ;
fBinSizeZ = new Float_t[fNbinz];
- for(Int_t i=0;i<fNbinz;i++) R__b >> fBinSizeZ[i];
+ for(i=0;i<fNbinz;i++) R__b >> fBinSizeZ[i];
R__b.CheckByteCount(R__s, R__c, AliITSgeomSPD425::IsA());
} // end if R__v==1
} else { // IsWriting.
R__b << fdy;
R__b << fdz;
R__b << fNbinx;
- for(Int_t i=0;i<fNbinx;i++) R__b << fBinSizeX[i];
+ for(i=0;i<fNbinx;i++) R__b << fBinSizeX[i];
R__b << fNbinz;
- for(Int_t i=0;i<fNbinz;i++) R__b << fBinSizeZ[i];
+ for(i=0;i<fNbinz;i++) R__b << fBinSizeZ[i];
R__b.SetByteCount(R__c, kTRUE);
} // end if R__b.IsReading()
}
/*
$Log$
+Revision 1.2.4.6 2000/06/11 20:30:21 barbera
+Minore changes.
+
Revision 1.2.4.2 2000/03/04 23:55:59 nilsen
Fixed up the comments/documentation
/*
$Log$
+Revision 1.3.4.4 2000/06/11 20:31:37 barbera
+Coding conventions update.
+
Revision 1.3.4.2 2000/03/04 23:43:57 nilsen
Fixed up the comments/documentation.
/**************************************************************************
* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * *
+ * *
* Author: The ALICE Off-line Project. *
* Contributors are mentioned in the code where appropriate. *
* *
/*
$Log$
+Revision 1.3.4.4 2000/06/12 18:10:32 barbera
+fixed posible compilation errors on HP unix
+
+Revision 1.3.4.3 2000/06/11 20:34:20 barbera
+Update class for the new structures.
+
+Revision 1.3.4.2 2000/03/02 21:42:29 nilsen
+Linked AliDetector::fDigit to AliITSmodule::fDigitsM and AliITS::fITSRecPoints
+to AliITSmodule::fRecPointsM. Renamed AliITSmodule::fPointsM to fRecPointsM.
+Removed the deletion of fDigitsM from the distructor since it is only a copy
+of what is in AliDetector. Fixed a bug in the functions LineSegmentL and
+LineSegmentG. Added two new versions of LineSegmentL and LineSegmentG to
+additionaly return track number from the hit. Removed FastPoint function,
+haven't found anywere it was used, also it had very many problems, should
+just call FastPointSPD... .
+
+Revision 1.3.4.1 2000/01/12 19:03:32 nilsen
+This is the version of the files after the merging done in December 1999.
+See the ReadMe110100.txt file for details
+
+Revision 1.3 1999/10/04 15:20:12 fca
+Correct syntax accepted by g++ but not standard for static members, remove minor warnings
+
Revision 1.2 1999/09/29 09:24:20 fca
Introduction of the Copyright and cvs Log
*/
#include "AliITSmodule.h"
+
#include "AliRun.h"
+#include "AliITS.h"
+#include "AliITShit.h"
ClassImp(AliITSmodule)
//
// Impementation of class AliITSmodule
//
-// created by: A. Bouchm, W. Peryt, S. Radomski, P. Skowronski
+// created by: A. Bouchm, W. Peryt, S. Radomski, P. Skowronski
// R. Barbers, B. Batyunia, B. S. Nilsen
// ver 1.0 CERN 16.09.1999
//_______________________________________________________________________
-//
-
//________________________________________________________________________
//
// Constructors and deconstructor
//________________________________________________________________________
//
+AliITSmodule::AliITSmodule() {
+ // constructor
+ fIndex = 0;
+ fHitsM = 0;
+ fTrackIndex = 0;
+ fHitIndex = 0;
+ fITS = 0;
+}
+//_________________________________________________________________________
+AliITSmodule::AliITSmodule(Int_t index) {
+ // constructor
-AliITSmodule::AliITSmodule() {
+ fIndex = index;
+ fHitsM = new TObjArray();
+ fTrackIndex = new TArrayI(16);
+ fHitIndex = new TArrayI(16);
+ fITS = (AliITS*)(gAlice->GetDetector("ITS"));
+}
+//__________________________________________________________________________
+AliITSmodule::~AliITSmodule() {
+ // The destructor for AliITSmodule. Before destoring AliITSmodule
+ // we must first destroy all of it's members.
- fIndex = 0;
- fHitsM = new TObjArray();
- fNhitsM = 0;
- fITS = (AliITS*)(gAlice->GetDetector("ITS"));
+ fIndex = 0;
+ Int_t i;
+ if(fHitsM){
+ for(i=0;i<fHitsM->GetEntriesFast();i++)
+ delete ((AliITShit *)(fHitsM->At(i)));
+ // must delete each object in the TObjArray.
+ delete fHitsM;
+ } // end if
+ delete fTrackIndex;
+ delete fHitIndex;
+ fITS = 0; // We don't delete this pointer since it is just a copy.
+}
+//____________________________________________________________________________
+AliITSmodule::AliITSmodule(const AliITSmodule &source){
+////////////////////////////////////////////////////////////////////////
+// Copy Constructor
+////////////////////////////////////////////////////////////////////////
+ printf("AliITSmodule error: AliITSmodule class has not to be copied! Exit.\n");
+ exit(1);
}
+//_____________________________________________________________________________
+AliITSmodule& AliITSmodule::operator=(const AliITSmodule &source){
+////////////////////////////////////////////////////////////////////////
+// Assignment operator
+////////////////////////////////////////////////////////////////////////
+ printf("AliITSmodule error: AliITSmodule class has not to be copied! Exit.\n");
+ exit(1);
+}
//_________________________________________________________________________
+//
+// Hits management
+//__________________________________________________________________________
+Int_t AliITSmodule::AddHit(AliITShit* hit,Int_t t,Int_t h) {
+// Hits management
-AliITSmodule::AliITSmodule(Int_t index) {
+ Int_t i;
+ fHitsM->AddLast(new AliITShit(*hit));
+ Int_t fNhitsM = fHitsM->GetEntriesFast();
+ if(fNhitsM-1>=fTrackIndex->GetSize()){ // need to expand the TArrayI
+ TArrayI *p = new TArrayI(fNhitsM+64);
+ for(i=0;i<fTrackIndex->GetSize();i++)
+ (*p)[i] = fTrackIndex->At(i);
+ delete fTrackIndex;
+ fTrackIndex = p;
+ } // end if
+ if(fNhitsM-1>=fHitIndex->GetSize()){ // need to expand the TArrayI
+ TArrayI *p = new TArrayI(fNhitsM+64);
+ for(i=0;i<fHitIndex->GetSize();i++)
+ (*p)[i] = fHitIndex->At(i);
+ delete fHitIndex;
+ fHitIndex = p;
+ } // end if
+ (*fTrackIndex)[fNhitsM-1] = t;
+ (*fHitIndex)[fNhitsM-1] = h;
+ return fNhitsM;
+}
+
+//___________________________________________________________________________
+void AliITSmodule::MedianHitG(Int_t index,
+ Float_t hitx1,Float_t hity1,Float_t hitz1,
+ Float_t hitx2,Float_t hity2,Float_t hitz2,
+ Float_t &xMg, Float_t &yMg, Float_t &zMg){
+ // median hit
+ AliITSgeom *gm = fITS->GetITSgeom();
+ Float_t x1l,y1l,z1l;
+ Float_t x2l,y2l,z2l;
+ Float_t xMl,yMl=0,zMl;
+ Float_t l[3], g[3];
+
+ g[0] = hitx1;
+ g[1] = hity1;
+ g[2] = hitz1;
+ gm->GtoL(index,g,l);
+ x1l = l[0];
+ y1l = l[1];
+ z1l = l[2];
+
+ g[0] = hitx2;
+ g[1] = hity2;
+ g[2] = hitz2;
+ gm->GtoL(index,g,l);
+ x2l = l[0];
+ y2l = l[1];
+ z2l = l[2];
+
+ xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l;
+ zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l;
- fIndex = index;
- fHitsM = new TObjArray();
- fNhitsM = 0;
- fITS = (AliITS*)(gAlice->GetDetector("ITS"));
+ l[0] = xMl;
+ l[1] = yMl;
+ l[2] = zMl;
+ gm->LtoG(index,l,g);
+ xMg = g[0];
+ yMg = g[1];
+ zMg = g[2];
}
+//___________________________________________________________________________
+Double_t AliITSmodule::PathLength(Int_t index,AliITShit *itsHit1,
+ AliITShit *itsHit2){
+ // path lenght
+ Float_t x1g,y1g,z1g;
+ Float_t x2g,y2g,z2g;
+ Double_t s;
+ itsHit1->GetPositionG(x1g,y1g,z1g);
+ itsHit2->GetPositionG(x2g,y2g,z2g);
-//__________________________________________________________________________
+ s = TMath::Sqrt( ((Double_t)(x2g-x1g)*(Double_t)(x2g-x1g)) +
+ ((Double_t)(y2g-y1g)*(Double_t)(y2g-y1g)) +
+ ((Double_t)(z2g-z1g)*(Double_t)(z2g-z1g)) );
+ return s;
+}
+//___________________________________________________________________________
+void AliITSmodule::PathLength(Int_t index,
+ Float_t x,Float_t y,Float_t z,
+ Int_t status,Int_t &nseg,
+ Float_t &x1,Float_t &y1,Float_t &z1,
+ Float_t &dx1,Float_t &dy1,Float_t &dz1,
+ Int_t &flag){
+ // path length
+ static Float_t x0,y0,z0;
-AliITSmodule::~AliITSmodule() {
- if(fHitsM) delete fHitsM;
- fNhitsM = 0;
+ if (status == 66){ // entering
+ x0 = x;
+ y0 = y;
+ z0 = z;
+ nseg = 0;
+ flag = 1;
+ }else{
+ x1 = x0;
+ y1 = y0;
+ z1 = z0;
+ dx1 = x-x1;
+ dy1 = y-y1;
+ dz1 = z-z1;
+ nseg++;
+ if (status == 68) flag = 0; //exiting
+ else flag = 2; //inside
+ x0 = x;
+ y0 = y;
+ z0 = z;
+ } // end if
}
+//___________________________________________________________________________
+Bool_t AliITSmodule::LineSegmentL(Int_t hitindex,Double_t &a,Double_t &b,
+ Double_t &c,Double_t &d,
+ Double_t &e,Double_t &f,Double_t &de){
+ // line segment
+ static Int_t hitindex0;
+ AliITShit *h0,*h1;
-//_________________________________________________________________________
-//
-// Hits menagement
-//__________________________________________________________________________
+ if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
+ h1 = (AliITShit *) (fHitsM->At(hitindex));
+ if(h1->StatusEntering()){ // if track entering volume, get index for next
+ // step
+ hitindex0 = hitindex;
+ return kFALSE;
+ } // end if StatusEntering()
+ // else stepping
+ h0 = (AliITShit *) (fHitsM->At(hitindex0));
+ de = h1->GetIonization();
+ h0->GetPositionL(a,c,e);
+ h1->GetPositionL(b,d,f);
+ b = b - a;
+ d = d - c;
+ f = f - e;
+ hitindex0 = hitindex;
+ return kTRUE;
+}
+//___________________________________________________________________________
+Bool_t AliITSmodule::LineSegmentG(Int_t hitindex,Double_t &a,Double_t &b,
+ Double_t &c,Double_t &d,
+ Double_t &e,Double_t &f,Double_t &de){
+ // line segment
+ static Int_t hitindex0;
+ AliITShit *h0,*h1;
-Int_t AliITSmodule::AddHit(AliITShit* hit ) {
- fHitsM->AddLast(hit);
- fNhitsM = fHitsM->GetEntriesFast();
- return fNhitsM;
+ if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
+
+ h1 = (AliITShit *) (fHitsM->At(hitindex));
+ if(h1->StatusEntering()){ // if track entering volume, get index for next
+ // step
+ hitindex0 = hitindex;
+ return kFALSE;
+ } // end if StatusEntering()
+ // else stepping
+ h0 = (AliITShit *) (fHitsM->At(hitindex0));
+ de = h1->GetIonization();
+ h0->GetPositionG(a,c,e);
+ h1->GetPositionG(b,d,f);
+ b = b - a;
+ d = d - c;
+ f = f - e;
+ hitindex0 = hitindex;
+ return kTRUE;
+}
+//___________________________________________________________________________
+Bool_t AliITSmodule::LineSegmentL(Int_t hitindex,Double_t &a,Double_t &b,
+ Double_t &c,Double_t &d,
+ Double_t &e,Double_t &f,
+ Double_t &de,Int_t &track){
+ // line segmente
+ static Int_t hitindex0;
+ AliITShit *h0,*h1;
+
+ if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
+
+ h1 = (AliITShit *) (fHitsM->At(hitindex));
+ if(h1->StatusEntering()){ // if track entering volume, get index for next
+ // step
+ hitindex0 = hitindex;
+ track = h1->GetTrack();
+ return kFALSE;
+ } // end if StatusEntering()
+ // else stepping
+ h0 = (AliITShit *) (fHitsM->At(hitindex0));
+ de = h1->GetIonization();
+ h0->GetPositionL(a,c,e);
+ h1->GetPositionL(b,d,f);
+ b = b - a;
+ d = d - c;
+ f = f - e;
+ hitindex0 = hitindex;
+ track = h1->GetTrack();
+ return kTRUE;
+}
+//___________________________________________________________________________
+Bool_t AliITSmodule::LineSegmentG(Int_t hitindex,Double_t &a,Double_t &b,
+ Double_t &c,Double_t &d,
+ Double_t &e,Double_t &f,
+ Double_t &de,Int_t &track){
+ // line segment
+ static Int_t hitindex0;
+ AliITShit *h0,*h1;
+
+ if(hitindex>= fHitsM->GetEntriesFast()) return kFALSE;
+
+ h1 = (AliITShit *) (fHitsM->At(hitindex));
+ if(h1->StatusEntering()){ // if track entering volume, get index for next
+ // step
+ hitindex0 = hitindex;
+ track = h1->GetTrack();
+ return kFALSE;
+ } // end if StatusEntering()
+ // else stepping
+ h0 = (AliITShit *) (fHitsM->At(hitindex0));
+ de = h1->GetIonization();
+ h0->GetPositionG(a,c,e);
+ h1->GetPositionG(b,d,f);
+ b = b - a;
+ d = d - c;
+ f = f - e;
+ hitindex0 = hitindex;
+ track = h1->GetTrack();
+ return kTRUE;
}
+//___________________________________________________________________________
+void AliITSmodule::MedianHitL(Int_t index,
+ AliITShit *itsHit1,
+ AliITShit *itsHit2,
+ Float_t &xMl, Float_t &yMl, Float_t &zMl){
+ // median hit
+ Float_t x1l,y1l,z1l;
+ Float_t x2l,y2l,z2l;
+
+ itsHit1->GetPositionL(x1l,y1l,z1l);
+ itsHit2->GetPositionL(x2l,y2l,z2l);
+ xMl = (-y1l / (y2l-y1l))*(x2l-x1l) + x1l;
+ yMl = 0.0;
+ zMl = (-y1l / (y2l-y1l))*(z2l-z1l) + z1l;
+}
//___________________________________________________________________________
-void AliITSmodule::Streamer(TBuffer & /*R__b*/){
- // Stream an object of class AliITSmodule.
-
- return;
-// This class is not to be written out to any file.
-// if (R__b.IsReading()) {
-// Version_t R__v = R__b.ReadVersion(); if (R__v) { }
-// TObject::Streamer(R__b);
-// R__b >> fITS;
-// R__b >> fIndex;
-// R__b >> fHitsM;
-// R__b >> fNhitsM;
-// R__b >> fIDigits;
-// R__b >> fNdigits;
-// R__b >> fIPoints;
-// R__b >> fNpoints;
-// } else {
-// R__b.WriteVersion(AliITSmodule::IsA());
-// TObject::Streamer(R__b);
-// R__b << fITS;
-// R__b << fIndex;
-// R__b << fHitsM;
-// R__b << fNhitsM;
-// R__b << fIDigits;
-// R__b << fNdigits;
-// R__b << fIPoints;
-// R__b << fNpoints;
-// }
+void AliITSmodule::MedianHit(Int_t index,
+ Float_t xg,Float_t yg,Float_t zg,
+ Int_t status,
+ Float_t &xMg,Float_t &yMg,Float_t &zMg,
+ Int_t &flag){
+ // median hit
+ static Float_t x1,y1,z1;
+
+ if (status == 66){ // entering
+ x1 = xg;
+ y1 = yg;
+ z1 = zg;
+ flag = 1;
+ } // end if
+ if (status == 68){ // exiting
+ MedianHitG(index,x1,y1,z1,xg,yg,zg,xMg,yMg,zMg);
+ flag = 0;
+ } // end if
+ if ((status != 66) && (status != 68)) flag = 1;
}
-//______________________________________________________________________
+//___________________________________________________________________________
+void AliITSmodule::GetID(Int_t &lay,Int_t &lad,Int_t &det){
+ // get ID
+ fITS->GetITSgeom()->GetModuleId(fIndex,lay,lad,det);
+ return ;
+}
+
/* $Id$ */
-//#include "AliITSpoint.h"
-#include "AliITS.h"
-#include "AliITSdigit.h"
-#include "AliITShit.h"
-#include "TObjArray.h"
-#include "TArray.h"
+#include <TObject.h>
+#include <TObjArray.h>
+#include <TArrayI.h>
+class AliITS;
+class AliITShit;
+
+class AliITSmodule:public TObject{
//________________________________________________________________
//
//________________________________________________________________
//
-
-class AliITSmodule : public TObject {
-
-public:
-
+ public:
//________________________________________________________________
//
// Constructors and deconstructor
//________________________________________________________________
- //
-
+ //
AliITSmodule(); // default constructor
- AliITSmodule(Int_t index); // index in TObjectArray in ITS object
-
- virtual ~AliITSmodule() ;
+ AliITSmodule(Int_t index); //index in TObjectArray in ITS object
+ virtual ~AliITSmodule();
//________________________________________________________________
//
- // Position menagenent
+ // Position managenent (id's getters)
//________________________________________________________________
//
-
- Int_t GetIndex() const { return fIndex;}
- //Int_t GetLayer() const { return fLayer;}
- //Int_t GetLadder() const { return fLadder;}
- //Int_t GetDet() const { return fDet;}
-
-
+
+ Int_t GetIndex() const {
+ // get index
+ return fIndex;
+ }
+ void GetID(Int_t &lay,Int_t &lad,Int_t &det);
+ Int_t GetLayer() {
+ // get layer
+ Int_t i,j,k;GetID(i,j,k);return i;
+ }
+ Int_t GetLadder(){
+ // get ladder
+ Int_t i,j,k;GetID(i,j,k);return j;
+ }
+ Int_t GetDet(){
+ // get det
+ Int_t i,j,k;GetID(i,j,k);return k;
+ }
//________________________________________________________________
//
- // Hits menagement
+ // Hits management
//________________________________________________________________
//
-
- Int_t GetNhits() const { return fNhitsM;}
- // returns number of hits in this module
-
- TObjArray *GetHits() const { return fHitsM; }
+ Int_t GetNhits() const {
+ // get num of hits
+ return fHitsM->GetEntriesFast();
+ }
+ AliITS *GetITS() const {
+ // get ITS
+ return fITS;
+ }
+ TObjArray *GetHits() const {
+ // get hits
+ return fHitsM;
+ }
+ AliITShit *GetHit(Int_t i) {
// returns pointer to array (TClonesArray) of pointers to hits
-
- Int_t AddHit(AliITShit *hit);
+ return (AliITShit*)fHitsM->At(i);
+ }
// Adds pointer of hit belonging to this module
// and returns number of hits in this module
-
- //________________________________________________________________
- //
- // Full Simulation
- //________________________________________________________________
- //
-
- virtual void HitToDigit() {};
- // this functon is virtual, becouse each type of a detector
- // make simulation in its own specific methods
-
- //________________________________________________________________
- //
- // Reconstruction
- //________________________________________________________________
- //
-
- virtual void DigitToPoint() {};
- // this functon is virtual, becouse each type of a detector
- // make reconstruction in its own specific methods
- // classes DIGIT and POINT are specyfic to detector type
-
- //________________________________________________________________
- //
- // Fast Simulation
- //________________________________________________________________
- //
-
- virtual void HitToPoint() {};
- // this functon is virtual, becouse each type of a detector
- // make fast simulation in its own specific methods
- // this simulation do not use DIGITS
-
-
-protected:
-
+ Int_t AddHit(AliITShit *hit,Int_t TrackIndex,Int_t HitIndex);
+ void MedianHitG(Int_t index, Float_t hitx1,Float_t hity1,Float_t hitz1,
+ Float_t hitx2,Float_t hity2,Float_t hitz2, Float_t &xMg,
+ Float_t &yMg, Float_t &zMg);
+ void MedianHitL(Int_t index, AliITShit *itsHit1, AliITShit *itsHit2,
+ Float_t &xMl, Float_t &yMl, Float_t &zMl);
+ Double_t PathLength(Int_t index, AliITShit *itsHit1, AliITShit *itsHit2);
+ Int_t GetHitTrackIndex(Int_t i) {
+ // get hit track index
+ return fTrackIndex->At(i);
+ }
+ Int_t GetHitHitIndex(Int_t i) {
+ // return the hit index number in TreeH for the given sorted hit in the module.
+ return fHitIndex->At(i);
+ }
+ void GetHitTrackAndHitIndex(Int_t i,Int_t &TrackIndex,Int_t &HitIndex) {
+ // return the hit index number for the given hit. Hits are kept on
+ // file according to their track index and hit index numbers.
+ TrackIndex = fTrackIndex->At(i);HitIndex = fHitIndex->At(i);
+ }
+ // returns both the track and hit index numbers for the given hit. Hits
+ // are kept on file according to their track index and hit index numbers.
+ void MedianHit(Int_t index, Float_t xg,Float_t yg,Float_t zg,
+ Int_t status,Float_t &xMg, Float_t &yMg, Float_t &zMg,
+ Int_t &flag);
+ void PathLength(Int_t index,Float_t x,Float_t y,Float_t z,Int_t status,
+ Int_t &nseg,Float_t &x1,Float_t &y1,Float_t &z1,
+ Float_t &dx1,Float_t &dy1, Float_t &dz1,Int_t &flag);
+ Bool_t LineSegmentL(Int_t hindex,Double_t &a,Double_t &b,
+ Double_t &c,Double_t &d,Double_t &e,Double_t &f,
+ Double_t &de);
+ Bool_t LineSegmentL(Int_t hindex,Double_t &a,Double_t &b,
+ Double_t &c,Double_t &d,Double_t &e,Double_t &f,
+ Double_t &de,Int_t &track);
+ // if returns kTRUE; gives the parameterization of the line segment
+ // from this step. x=a+b*t, y=c+d*t, and z=e+f*t for 0.0t<=1.0 and the
+ // energy lost during this step all in the local detector coordinates.
+ // if returns kFALSE; this is a begining step and no energy loss has
+ // occured. This step is used to set up the next steps. Do not use
+ // this parameterization.
+ Bool_t LineSegmentG(Int_t hindex,Double_t &a,Double_t &b,
+ Double_t &c,Double_t &d,Double_t &e,Double_t &f,
+ Double_t &de);
+ Bool_t LineSegmentG(Int_t hindex,Double_t &a,Double_t &b,
+ Double_t &c,Double_t &d,Double_t &e,Double_t &f,
+ Double_t &de,Int_t &track);
+ // if returns kTRUE; gives the parameterization of the line segment
+ // from this step. x=a+b*t, y=c+d*t, and z=e+f*t for 0.0t<=1.0 and the
+ // energy lost during this step all in the global detector coordinates.
+ // if returns kFALSE; this is a begining step and no energy loss has
+ // occured. This step is used to set up the next steps. Do not use
+ // this parameterization.
+
+ protected:
+ AliITSmodule(const AliITSmodule &source);
+ AliITSmodule& operator=(const AliITSmodule &source);
//________________________________________________________________
//
// Data members
//________________________________________________________________
//
-
- AliDetector *fITS; // Pointer to ITS detector
- Int_t fIndex; // Index of this module in ITSmodules TObjectArray
-
- TObjArray *fHitsM; // Pointer to list of hits on this module
- Int_t fNhitsM; // Number of hits
-
- TArrayI *fIdigits; // Indexes of DIGITS belonging to this module
- // in array in ITS
- Int_t fNdigits; // Number of DIGITS
-
- TArrayI *fIpoints; // Indexes of POINTS belonging to this module
- // in array in ITS
- Int_t fNpoints; // Number of POINTS
-
-public:
+ AliITS *fITS; // Pointer to ITS detector
+ Int_t fIndex; //Index of this module in ITSmodules TObjectArray
+ TObjArray *fHitsM; // Pointer to list of hits on this module
+ TArrayI *fTrackIndex,*fHitIndex; // track index, hit index
+
+ ClassDef(AliITSmodule,1) // Copy the hits into a more useful order
- //________________________________________________________________
- //
- // ROOT compatibility
- //________________________________________________________________
- //
- ClassDef(AliITSmodule,1)
};
#endif
+
+
+