/*
$Log$
+Revision 1.18 2000/07/12 05:32:20 fca
+Correcting several syntax problem with static members
+
Revision 1.17 2000/07/10 16:07:18 fca
Release version of ITS code
#include <TMath.h>
#include <TRandom.h>
+#include <TBranch.h>
#include <TVector.h>
#include <TObjArray.h>
#include <TROOT.h>
#include <TObjectTable.h>
+#include <TFile.h>
+#include <TTree.h>
#include "AliITSresponseSDD.h"
#include "AliITSsegmentationSSD.h"
#include "AliITSresponseSSD.h"
+#include "AliITShit.h"
+#include "AliITSgeom.h"
+#include "AliITSdigit.h"
+#include "AliITSmodule.h"
+#include "AliITSRecPoint.h"
+#include "AliITSRawCluster.h"
const Int_t AliITS::fgkNTYPES=3;
// is also called.
//
+
fIshunt = 0;
fEuclidOut = 0;
// description of these parameters and its constructor functions.
//
+
fHits = new TClonesArray("AliITShit", 1560);
gAlice->AddHitList(fHits);
}
//____________________________________________________________________________
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(!fITSmodules->At(i)) continue;
- 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
+ if(fITSmodules) fITSmodules->Delete();
}
//_____________________________________________________________________________
}// end if fITSmodules!=0
//
- Int_t i;
if(fDtype) {
- for (i=0;i<fgkNTYPES;i++) {
- delete (*fDtype)[i];
- fNdtype[i]=0;
- }
+ fDtype->Delete();
+ delete fDtype;
}
-
- for (i=0;i<fgkNTYPES;i++) {
- delete (*fCtype)[i];
- fNctype[i]=0;
+ delete [] fNdtype;
+ if (fCtype) {
+ fCtype->Delete();
+ delete fCtype;
}
-
+ delete [] fNctype;
//
if (fDetTypes) {
if (fTreeC) delete fTreeC;
+ if (fITSgeom) delete fITSgeom;
+
}
//___________________________________________
void AliITS::ResetDigits()
{
//
- // Reset number of digits and the digits array for thE ITS detector
+ // Reset number of digits and the digits array for the ITS detector
//
if (!fDtype) return;
//
// Reset number of rec points and the rec points array
//
- fNRecPoints = 0;
if (fRecPoints) fRecPoints->Clear();
+ fNRecPoints = 0;
}
{
// sets the default segmentation, response, digit and raw cluster classes
+ printf("SetDefaults\n");
AliITSDetType *iDetType;
AliITSresponseSDD *resp1=new AliITSresponseSDD();
AliITSsegmentationSDD *seg1=new AliITSsegmentationSDD(fITSgeom,resp1);
iDetType=DetType(1);
+ printf("SetDefaults: iDetType %p\n",iDetType);
if (!iDetType->GetSegmentationModel()) SetSegmentationModel(1,seg1);
+ printf("SetDefaults: segm %p\n",iDetType->GetSegmentationModel());
if (!iDetType->GetResponseModel()) SetResponseModel(1,resp1);
+ printf("SetDefaults: resp %p\n",iDetType->GetResponseModel());
const char *kData1=resp1->DataType();
const char *kopt=resp1->ZeroSuppOption();
if ((!strstr(kopt,"2D")) && (!strstr(kopt,"1D")) || strstr(kData1,"real") ) {
{
// create a separate tree to store the clusters
+ printf("MakeTreeC \n");
+
char *optC = strstr(option,"C");
if (optC && !fTreeC) fTreeC = new TTree("TC","Clusters in ITS");
+ else return;
Int_t buffersize = 4000;
char branchname[30];
void AliITS::GetTreeC(Int_t event)
{
+ printf("GetTreeC \n");
+
// get the clusters tree for this event and set the branch address
char treeName[20];
char branchname[30];
//initialize the modules array
if(fITSmodules){
- //this->ClearModules();
+ fITSmodules->Delete();
delete fITSmodules;
}
Int_t nl,indexMAX,index;
- Int_t indSPD,indSDD;
if(size<=0){ // default to using data stored in AliITSgeom
if(fITSgeom==0) {
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);
+ for(index=0;index<size;index++) {
+ fITSmodules->AddAt( new AliITSmodule(index),index);
+ }
+
nmodules = size;
} // end i size<=0
}
// 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
gAlice->ResetHits();
iTH->GetEvent(t);
Int_t nhits = itsHits->GetEntriesFast();
+ //printf("nhits %d\n",nhits);
if (!nhits) continue;
for(h=0; h<nhits; h++){
itsHit = (AliITShit *)itsHits->UncheckedAt(h);
itsHit->GetDetectorID(lay,lad,det);
- index = fITSgeom->GetModuleIndex(lay,lad,det);
+ // temporarily index=det-1 !!!
+ if(fITSgeom) index = fITSgeom->GetModuleIndex(lay,lad,det);
+ else index=det-1;
+ //
mod = this->GetModule(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);
-
+ mod->AddHit(itsHit,t,h);
} // end loop over hits
} // end loop over tracks
itsHit=(AliITShit*) (*fHits2)[i];
itsHit->GetDetectorID(lay,lad,det);
- index = fITSgeom->GetModuleIndex(lay,lad,det);
+ // temporarily index=det-1 !!!
+ if(fITSgeom) index = fITSgeom->GetModuleIndex(lay,lad,det);
+ else index=det-1;
+ //
mod = this->GetModule(index);
-
- 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);
-
-
+ mod->AddHit(itsHit,track,i);
} // end loop over hits
} // end loop over tracks
TFile *fileAli=0;
if (fAli) fileAli =fAli->GetCurrentFile();
- file->cd();
+ fileAli->cd();
} // end if add
// keep galice.root for signal and name differently the file for
// background when add! otherwise the track info for signal will be lost !
+ // the condition below will disappear when the geom class will be
+ // initialised for all versions - for the moment it is only for v5 !
+ // 7 is the SDD beam test version
+ Int_t ver = this->IsVersion();
+ if(ver!=5 && ver!=7) return;
+
char *all = strstr(opt,"All");
char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),strstr(opt,"SSD")};
InitModules(size,nmodules);
FillModules(evNumber,bgrev,nmodules,option,filename);
- TBranch *branch;
+ //TBranch *branch;
AliITSsimulation* sim;
-
- TObjArray *branches=gAlice->TreeD()->GetListOfBranches();
+ //TObjArray *branches=gAlice->TreeD()->GetListOfBranches();
AliITSgeom *geom = GetITSgeom();
Int_t id,module;
+ Int_t first,last;
for (id=0;id<fgkNTYPES;id++) {
if (!all && !det[id]) continue;
- branch = (TBranch*)branches->UncheckedAt(id);
+ //branch = (TBranch*)branches->UncheckedAt(id);
AliITSDetType *iDetType=DetType(id);
sim = (AliITSsimulation*)iDetType->GetSimulationModel();
if (!sim) {
exit(1);
// or SetDefaultSimulation();
}
- Int_t first = geom->GetStartDet(id);
- Int_t last = geom->GetLastDet(id);
+ if(geom) {
+ first = geom->GetStartDet(id);
+ last = geom->GetLastDet(id);
+ } else first=last=0;
printf("det type %d first, last %d %d \n",id,first,last);
for(module=first;module<=last;module++) {
AliITSmodule *mod = (AliITSmodule *)fITSmodules->At(module);
{
// cluster finding and reconstruction of space points
+ // the condition below will disappear when the geom class will be
+ // initialised for all versions - for the moment it is only for v5 !
+ // 7 is the SDD beam test version
+ Int_t ver = this->IsVersion();
+ if(ver!=5 && ver!=7) return;
+
char *all = strstr(opt,"All");
char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),strstr(opt,"SSD")};
MakeTreeC("C");
first=kFALSE;
}
- TTree *iTC=TreeC();
- TBranch *branch;
+ TTree *iTC=TreeC();
+
+ //TBranch *branch;
AliITSClusterFinder* rec;
- TObjArray *branches=gAlice->TreeR()->GetListOfBranches();
+ //TObjArray *branches=gAlice->TreeR()->GetListOfBranches();
AliITSgeom *geom = GetITSgeom();
Int_t id,module;
for (id=0;id<fgkNTYPES;id++) {
if (!all && !det[id]) continue;
- branch = (TBranch*)branches->UncheckedAt(id);
+ //branch = (TBranch*)branches->UncheckedAt(id);
AliITSDetType *iDetType=DetType(id);
rec = (AliITSClusterFinder*)iDetType->GetReconstructionModel();
if (!rec) {
}
TClonesArray *itsDigits = this->DigitsAddress(id);
- Int_t first = geom->GetStartDet(id);
- Int_t last = geom->GetLastDet(id);
+ Int_t first,last;
+ if(geom) {
+ first = geom->GetStartDet(id);
+ last = geom->GetLastDet(id);
+ } else first=last=0;
+ //printf("first last %d %d\n",first,last);
for(module=first;module<=last;module++) {
this->ResetDigits();
if (all) gAlice->TreeD()->GetEvent(lastentry+module);
// keep galice.root for signal and name differently the file for
// background when add! otherwise the track info for signal will be lost !
+
+ // the condition below will disappear when the geom class will be
+ // initialised for all versions - for the moment it is only for v5 !
+ Int_t ver = this->IsVersion();
+ if(ver!=5) return;
+
char *all = strstr(opt,"All");
char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),strstr(opt,"SSD")};