// //
// //
/////////////////////////////////////////////////////////////////
-#include <Riostream.h>
-#include <TMath.h>
+
#include <TGeometry.h>
#include <TNode.h>
#include <TBRIK.h>
#include <TLorentzVector.h>
#include <TVirtualMC.h>
+#include <TGeoMatrix.h>
#include "AliMC.h"
#include "AliRun.h"
#include "AliMagF.h"
-#include "AliITSGeant3Geometry.h"
#include "AliTrackReference.h"
#include "AliITShit.h"
#include "AliITS.h"
#include "AliITSvSDD03.h"
#include "AliITSgeom.h"
-#include "AliITSgeomSPD.h"
#include "AliITSgeomSDD.h"
#include "AliITSgeomSSD.h"
-#include "AliITSDetType.h"
-#include "AliITSresponseSPD.h"
-#include "AliITSresponseSDD.h"
-#include "AliITSresponseSSD.h"
+#include "AliITSDetTypeSim.h"
+#include "AliITSCalibrationSPD.h"
+#include "AliITSCalibrationSDD.h"
+#include "AliITSCalibrationSSD.h"
#include "AliITSsegmentationSPD.h"
#include "AliITSsegmentationSDD.h"
#include "AliITSsegmentationSSD.h"
-#include "AliITSsimulationSPDdubna.h"
+#include "AliITSsimulationSPD.h"
#include "AliITSsimulationSDD.h"
#include "AliITSsimulationSSD.h"
+
ClassImp(AliITSvSDD03)
//______________________________________________________________________
// Monte Carlo simulations for the geometries AliITSv1, AliITSv3,
// AliITSvSDD03.
// In general it is automatically replaced by
- // the CreatMaterials routine defined in AliITSv?. Should the function
+ // the CreateMaterials 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.
// none.
// Return:
// none.
+ const Int_t knlayers=12;
+ // const Int_t kndeep=6;
+ const Int_t kltypess=2;
+ const AliITSDetector kidet[knlayers]={kSSD,kSDD};
+ const TString knames[kltypess]={
+ "/ALIC_1/ITSV_1/ITEL_%d/ITAI_1/IMB0_1/IMBS_1",
+ "/ALIC_1/ITSV_1/IDET_%d/IDAI_1/ITS0_1/ITST_1"};
+ const Int_t kitsGeomTreeCopys[kltypess]={10,2};
+ const Int_t knp=384;
+ const Float_t kpitch=50.E-4;/*cm*/
+ Float_t box[3]={0.5*kpitch*(Float_t)knp,150.E-4,1.0},p[knp+1],n[knp+1];
+ Int_t nlad[knlayers]={knlayers*1};
+ Int_t ndet[knlayers]={knlayers*1};
+ Int_t mod=knlayers,lay=0,lad=0,det=0,i,j,cp0;
+ TString path,shapeName;
+ TGeoHMatrix matrix;
+ Double_t trans[3]={3*0.0},rot[10]={10*0.0};
+ TArrayD shapePar;
+ TArrayF shapeParF;
+ Bool_t isShapeDefined[kltypess]={kltypess*kFALSE};
+ AliITSgeom *geom = new AliITSgeom(0,knlayers,nlad,ndet,mod);
+ if(GetITSgeom()!=0) SetITSgeom(0x0);// delet existing if there.
+ SetITSgeom(geom);
-
- if(strcmp(gMC->GetName(),"TGeant3")) {
- Error("InitAliITSgeom",
- "Wrong Monte Carlo. InitAliITSgeom uses TGeant3 calls");
+ p[0]=-box[0];
+ n[0]=box[0];
+ // Fill in anode and cathode strip locations (lower edge)
+ for(i=1;i<knp;i++){
+ p[i] =p[i-1]+kpitch;
+ n[i] =n[i-1]-kpitch;
+ } // end for i
+ p[knp]=box[0];
+ n[knp]=-box[0];
+ for(i=0;i<kltypess;i++)for(cp0=1;cp0<=kitsGeomTreeCopys[i];cp0++){
+ mod = DecodeDetector(fIdSens[i],cp0,lay,lad,det);
+ path.Form(knames[i].Data(),cp0);
+ gMC->GetTransformation(path.Data(),matrix);
+ gMC->GetShape(path.Data(),shapeName,shapePar);
+ shapeParF.Set(shapePar.GetSize());
+ for(j=0;j<shapePar.GetSize();j++)shapeParF[j]=shapePar[j];
+ geom->CreateMatrix(mod,lay,lad,det,kidet[i],trans,rot);
+ geom->SetTrans(mod,matrix.GetTranslation());
+ geom->SetRotMatrix(mod,matrix.GetRotationMatrix());
+ geom->GetGeomMatrix(mod)->SetPath(path.Data());
+ switch (kidet[i]){
+ case kSDD: if(!(GetITSgeom()->IsShapeDefined((Int_t)kSDD))){
+ geom->ReSetShape(kSDD,new AliITSgeomSDD256(shapeParF.GetSize(),
+ shapeParF.GetArray()));
+ isShapeDefined[i]=kTRUE;
+ } break;
+ case kSSD:if(!(GetITSgeom()->IsShapeDefined((Int_t)kSSD))){
+ geom->ReSetShape(kSSD,new AliITSgeomSSD(box,0.0,0.0,
+ knp+1,p,knp+1,n));
+ isShapeDefined[i]=kTRUE;
+ } break;
+ default:{} break;
+ } // end switch
+ } // end for i,cp0
return;
- } // end if
- Info("InitAliITSgeom","Reading geometry transformation directly from Geant 3");
- const Int_t knp=384;
- const Float_t kpitch=50.E-4;/*cm*/
- Float_t box[3]={0.5*kpitch*(Float_t)knp,150.E-4,1.0},p[knp+1],n[knp+1];
- const Int_t kltypess = 2;
- const Int_t knlayers = 12;
- const Int_t kndeep = 6;
- Int_t itsGeomTreeNames[kltypess][kndeep],lnam[20],lnum[20];
- Int_t nlad[knlayers],ndet[knlayers];
- Double_t t[3],r[10];
- Float_t par[20],att[20];
- Int_t npar,natt,idshape,imat,imed,id;
- AliITSGeant3Geometry *ig = new AliITSGeant3Geometry();
- Int_t mod,typ,lay,lad,det,cpy,i,j,k;
- Char_t names[kltypess][kndeep][4];
- Int_t itsGeomTreeCopys[kltypess][kndeep];
- Char_t *namesA[kltypess][kndeep] = {
- {"ALIC","ITSV","ITEL","ITAI","IMB0","IMBS"},
- {"ALIC","ITSV","IDET","IDAI","ITS0","ITST"}};
- Int_t itsGeomTreeCopysA[kltypess][kndeep]= {{1,1,10,1,1,1},
- {1,1,2,1,1,1}};
- for(i=0;i<kltypess;i++)for(j=0;j<kndeep;j++){
- for(k=0;k<4;k++) names[i][j][k] = namesA[i][j][k];
- itsGeomTreeCopys[i][j] = itsGeomTreeCopysA[i][j];
- } // end for i,j
- p[0]=-box[0];
- n[0]=box[0];
- for(i=1;i<knp;i++){// Fill in anode and cathode strip locations (lower edge)
- p[i] =p[i-1]+kpitch;
- n[i] =n[i-1]-kpitch;
- } // end for i
- p[knp+1]=box[0];
- n[knp+1]=-box[0];
-
- for(i=0;i<20;i++) lnam[i] = lnum[i] = 0;
- for(i=0;i<kltypess;i++)for(j=0;j<kndeep;j++)
- strncpy((char*) &itsGeomTreeNames[i][j],names[i][j],4);
- // itsGeomTreeNames[i][j] = ig->StringToInt(names[i][j]);
- mod = knlayers;
- if(fITSgeom!=0) delete fITSgeom;
- for(Int_t iMod=0; iMod<knlayers; iMod++){
- nlad[iMod]=1; ndet[iMod]=1;
- }
- fITSgeom = new AliITSgeom(0,knlayers,nlad,ndet,mod);
- fIdSens[0] = 0; fIdSens[1] = 1; // Properly reset in Init later.
- for(typ=1;typ<=kltypess;typ++){
- for(j=0;j<kndeep;j++) lnam[j] = itsGeomTreeNames[typ-1][j];
- for(j=0;j<kndeep;j++) lnum[j] = itsGeomTreeCopys[typ-1][j];
- if(typ == 1) id = fIdSens[0];
- else id = fIdSens[1];
- lad = 1;
- det = 1;
- for(cpy=1;cpy<=itsGeomTreeCopys[typ-1][2];cpy++){
- mod = DecodeDetector(id,cpy,lay,lad,det);
- //lunm[2] is the copy number, from 1 to 10 for SSD
- // 1,2 for SDD, depending on the module number
- if(mod<=3) lnum[2]=mod+1;
- if(mod>=6) lnum[2]=mod-1;
- if(mod==4) lnum[2]=1;
- if(mod==5) lnum[2]=2;
- ig->GetGeometry(kndeep,lnam,lnum,t,r,idshape,npar,natt,par,att,
- imat,imed);
-
- switch (typ){
- case 2:
- fITSgeom->CreatMatrix(mod,lay,lad,det,kSDD,t,r);
- if(!(fITSgeom->IsShapeDefined((Int_t)kSDD))){
- fITSgeom->ReSetShape(kSDD,new AliITSgeomSDD256(npar,par));
- } // end if
- break;
- case 1:
- fITSgeom->CreatMatrix(mod,lay,lad,det,kSSD,t,r);
- if(!(fITSgeom->IsShapeDefined((Int_t)kSSD))){
- fITSgeom->ReSetShape(kSSD,new AliITSgeomSSD(box,0.0,0.0,
- knp+1,p,knp+1,n));
- } // end if
- break;
- } // end switch
- } // end for cpy
- } // end for typ
- return;
}
//______________________________________________________________________
void AliITSvSDD03::Init(){
if(fRead[0]=='\0') strncpy(fRead,fEuclidGeomDet,60);
if(fWrite[0]=='\0') strncpy(fWrite,fEuclidGeomDet,60);
- if(fITSgeom!=0) delete fITSgeom;
- fITSgeom = new AliITSgeom();
- if(fGeomDetIn) fITSgeom->ReadNewFile(fRead);
+ if(GetITSgeom()!=0) SetITSgeom(0x0);
+ AliITSgeom* geom = new AliITSgeom();
+ SetITSgeom(geom);
+ if(fGeomDetIn) GetITSgeom()->ReadNewFile(fRead);
if(!fGeomDetIn) this->InitAliITSgeom();
- if(fGeomDetOut) fITSgeom->WriteNewFile(fWrite);
+ if(fGeomDetOut) GetITSgeom()->WriteNewFile(fWrite);
AliITS::Init();
fIDMother = gMC->VolId("ITSV"); // ITS Mother Volume ID.
// Return:
// none.
- const Float_t kconv = 1.0e+04; // convert cm to microns
-
- Info("SetDefaults","Setting up only SDD detector");
+ // const Float_t kconv = 1.0e+04; // convert cm to microns
- AliITSDetType *iDetType;
+ if(!fDetTypeSim) fDetTypeSim = new AliITSDetTypeSim();
+ fDetTypeSim->SetITSgeom(GetITSgeom());
+ fDetTypeSim->ResetCalibrationArray();
+ fDetTypeSim->ResetSegmentation();
+
AliITSgeomSDD *s1;
AliITSgeomSSD *s2;
- iDetType=DetType(kSPD);
- SetResponseModel(kSPD,new AliITSresponseSPD());
- SetSegmentationModel(kSPD,new AliITSsegmentationSPD());
- const char *kData0=(iDetType->GetResponseModel())->DataType();
- if(strstr(kData0,"real") ) iDetType->ClassNames("AliITSdigit",
- "AliITSRawClusterSPD");
- else iDetType->ClassNames("AliITSdigitSPD","AliITSRawClusterSPD");
+ SetCalibrationModel(GetITSgeom()->GetStartSPD(),new AliITSCalibrationSPD());
+ SetSegmentationModel(kSPD,(AliITSsegmentationSPD*)
+ (GetITSgeom()->GetShape(kSPD)));
+ fDetTypeSim->SetDigitClassName(kSPD,"AliITSdigitSPD");
// SDD
- iDetType=DetType(kSDD);
- s1 = (AliITSgeomSDD*) fITSgeom->GetShape(kSDD);// Get shape info. Do it this way for now.
- AliITSresponseSDD *resp1=new AliITSresponseSDD("simulated");
- SetResponseModel(kSDD,resp1);
- AliITSsegmentationSDD *seg1=new AliITSsegmentationSDD(fITSgeom,resp1);
- seg1->SetDetSize(s1->GetDx()*kconv, // base this on AliITSgeomSDD
- s1->GetDz()*2.*kconv, // for now.
- s1->GetDy()*2.*kconv); // x,z,y full width in microns.
+ s1 = (AliITSgeomSDD*) GetITSgeom()->GetShape(kSDD);// Get shape info. Do it this way for now.
+ AliITSCalibrationSDD *resp1=new AliITSCalibrationSDD("simulated");
+ SetCalibrationModel(GetITSgeom()->GetStartSDD(),resp1);
+ AliITSsegmentationSDD *seg1 = (AliITSsegmentationSDD*)
+ (GetITSgeom()->GetShape(kSDD));
+ seg1->SetDriftSpeed(resp1->GetDriftSpeed());
seg1->SetNPads(256,256);// Use AliITSgeomSDD for now
SetSegmentationModel(kSDD,seg1);
- const char *kData1=(iDetType->GetResponseModel())->DataType();
- const char *kopt=iDetType->GetResponseModel()->ZeroSuppOption();
+ const char *kData1=(fDetTypeSim->GetCalibrationModel(GetITSgeom()->GetStartSDD()))->DataType();
+ const char *kopt=resp1->GetZeroSuppOption();
if((!strstr(kopt,"2D")) && (!strstr(kopt,"1D")) || strstr(kData1,"real") ){
- iDetType->ClassNames("AliITSdigit","AliITSRawClusterSDD");
- } else iDetType->ClassNames("AliITSdigitSDD","AliITSRawClusterSDD");
+ fDetTypeSim->SetDigitClassName(kSDD,"AliITSdigit");
+ } else fDetTypeSim->SetDigitClassName(kSDD,"AliITSdigitSDD");
// SSD Layer 5
- iDetType=DetType(kSSD);
- s2 = (AliITSgeomSSD*) fITSgeom->GetShape(kSSD);// Get shape info. Do it this way for now.
- AliITSresponse *resp2=new AliITSresponseSSD("simulated");
- SetResponseModel(kSSD,resp2);
- AliITSsegmentationSSD *seg2=new AliITSsegmentationSSD(fITSgeom);
- seg2->SetDetSize(s2->GetDx()*2.*kconv, // base this on AliITSgeomSSD
- s2->GetDz()*2.*kconv, // for now.
- s2->GetDy()*2.*kconv); // x,z,y full width in microns.
+
+ s2 = (AliITSgeomSSD*) GetITSgeom()->GetShape(kSSD);// Get shape info. Do it this way for now.
+
+ AliITSCalibration *resp2= new AliITSCalibrationSSD("simulated");
+ SetCalibrationModel(GetITSgeom()->GetStartSSD(),resp2);
+
+ AliITSsegmentationSSD *seg2 = (AliITSsegmentationSSD*)
+ (GetITSgeom()->GetShape(kSSD));
seg2->SetPadSize(50.,0.); // strip x pitch in microns
seg2->SetNPads(384,0); // number of strips on each side.
seg2->SetLayer(5);
seg2->SetAnglesLay6(0.,0.); // strip angles rad P and N side.
SetSegmentationModel(kSSD,seg2);
- const char *kData2=(iDetType->GetResponseModel())->DataType();
- if(strstr(kData2,"real") ) iDetType->ClassNames("AliITSdigit",
- "AliITSRawClusterSSD");
- else iDetType->ClassNames("AliITSdigitSSD","AliITSRawClusterSSD");
+ const char *kData2=(fDetTypeSim->GetCalibrationModel(GetITSgeom()->GetStartSSD()))->DataType();
+ if(strstr(kData2,"real") ) fDetTypeSim->SetDigitClassName(kSSD,"AliITSdigit");
+ else fDetTypeSim->SetDigitClassName(kSSD,"AliITSdigitSSD");
- if(kNTYPES>3){
+ if(fgkNTYPES>3){
Warning("SetDefaults",
"Only the four basic detector types are initialised!");
}// end if
// Return:
// none.
- AliITSDetType *iDetType;
- AliITSsimulation *sim;
- AliITSsegmentation *seg;
- AliITSresponse *res;
- iDetType = DetType(kSPD);
- if(iDetType){
- sim = iDetType->GetSimulationModel();
- if (!sim) {
- seg =(AliITSsegmentation*)iDetType->GetSegmentationModel();
- if(seg==0) seg = new AliITSsegmentationSPD();
- res = (AliITSresponse*)iDetType->GetResponseModel();
- if(res==0) res = new AliITSresponseSPD();
- sim = new AliITSsimulationSPDdubna(seg,res,0);
- SetSimulationModel(kSPD,sim);
- }else{ // simulation exists, make sure it is set up properly.
- sim->Init();
- } // end if
- } // end if iDetType
- iDetType = DetType(kSDD);
- if(iDetType){
- sim = iDetType->GetSimulationModel();
- if (!sim) {
- seg = (AliITSsegmentation*)iDetType->GetSegmentationModel();
- res = (AliITSresponse*)iDetType->GetResponseModel();
- sim = new AliITSsimulationSDD(seg,res);
- SetSimulationModel(kSDD,sim);
- }else{ // simulation exists, make sure it is set up properly.
- sim->Init();
- } //end if
- } // end if iDetType
- iDetType = DetType(kSSD);
- if(iDetType){
- sim = iDetType->GetSimulationModel();
- if (!sim) {
- seg = (AliITSsegmentation*)iDetType->GetSegmentationModel();
- res = (AliITSresponse*)iDetType->GetResponseModel();
- sim = new AliITSsimulationSSD(seg,res);
- SetSimulationModel(kSSD,sim);
- }else{ // simulation exists, make sure it is set up properly.
- sim->Init();
- } // end if
- } // end if iDetType
+ if(!fDetTypeSim) fDetTypeSim = new AliITSDetTypeSim();
+ AliITSsimulation *sim;
+ //AliITSsegmentation *seg;
+ //AliITSCalibration *res;
+ //SPD
+ if(fDetTypeSim){
+ sim = fDetTypeSim->GetSimulationModel(kSPD);
+ if (!sim) {
+ //seg =(AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSPD);
+ //if(seg==0) seg = new AliITSsegmentationSPD();
+ //res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSPD());
+ //if(res==0) res = new AliITSCalibrationSPD();
+ sim = new AliITSsimulationSPD(fDetTypeSim);
+ SetSimulationModel(kSPD,sim);
+ }else{ // simulation exists, make sure it is set up properly.
+ sim->SetSegmentationModel(kSPD,(AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSPD));
+ sim->SetCalibrationModel(GetITSgeom()->GetStartSPD(),(AliITSCalibration*)fDetTypeSim->GetCalibrationModel(GetITSgeom()->GetStartSPD()));
+ sim->Init();
+ } // end if
+ } // end if iDetType
+ //SDD
+ if(fDetTypeSim){
+ sim = fDetTypeSim->GetSimulationModel(kSDD);
+ if (!sim) {
+ // seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSDD);
+ //res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSDD());
+ sim = new AliITSsimulationSDD(fDetTypeSim);
+ SetSimulationModel(kSDD,sim);
+ }else{ // simulation exists, make sure it is set up properly.
+ sim->SetSegmentationModel(kSDD,(AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSDD));
+ sim->SetCalibrationModel(GetITSgeom()->GetStartSDD(),(AliITSCalibration*)fDetTypeSim->GetCalibrationModel(GetITSgeom()->GetStartSDD()));
+
+ sim->Init();
+ } //end if
+ } // end if iDetType
+ //SSD
+ if(fDetTypeSim){
+ sim = fDetTypeSim->GetSimulationModel(kSSD);
+ if (!sim) {
+ // seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSSD);
+ // res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSSD());
+ sim = new AliITSsimulationSSD(fDetTypeSim);
+ SetSimulationModel(kSSD,sim);
+ }else{ // simulation exists, make sure it is set up properly.
+ sim->SetSegmentationModel(kSSD,(AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSSD));
+ sim->SetCalibrationModel(GetITSgeom()->GetStartSSD(),(AliITSCalibration*)fDetTypeSim->GetCalibrationModel(GetITSgeom()->GetStartSSD()));
+ sim->Init();
+ } // end if
+ } // end if iDetType
}
//______________________________________________________________________
void AliITSvSDD03::DrawModule() const{