X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=ITS%2FAliITSvSPD02.cxx;h=1455fe60f1931e2a96cc5ca4a9fa4c7a093df528;hb=5fbd4fd6c8c8ba10b9beda3cb8cd1e4411dc4145;hp=5152df120dea83b4f004b78687095bc02076cdcd;hpb=78b50563b6bf1b64db660cc907b1ae645f4988d3;p=u%2Fmrichter%2FAliRoot.git diff --git a/ITS/AliITSvSPD02.cxx b/ITS/AliITSvSPD02.cxx index 5152df120de..1455fe60f19 100644 --- a/ITS/AliITSvSPD02.cxx +++ b/ITS/AliITSvSPD02.cxx @@ -15,36 +15,31 @@ /* $Id$ */ -#include -#include #include +#include #include #include #include #include +#include +#include #include "AliRun.h" #include "AliMagF.h" -#include "AliITSGeant3Geometry.h" #include "AliTrackReference.h" + #include "AliITShit.h" #include "AliITS.h" #include "AliITSvSPD02.h" #include "AliITSgeom.h" #include "AliITSgeomSPD.h" -#include "AliITSgeomSSD.h" -#include "AliITSDetType.h" -#include "AliITSresponseSPDdubna.h" -#include "AliITSresponseSDD.h" -#include "AliITSresponseSSD.h" +#include "AliITSDetTypeSim.h" +#include "AliITSCalibrationSPD.h" #include "AliITSsegmentationSPD.h" -#include "AliITSsegmentationSDD.h" -#include "AliITSsegmentationSSD.h" -#include "AliITSsimulationSPDdubna.h" -#include "AliITSsimulationSDD.h" -#include "AliITSsimulationSSD.h" +#include "AliITSsimulationSPD.h" #include "AliMC.h" + /////////////////////////////////////////////////////////////////////// // Step manager and // geometry class @@ -56,7 +51,22 @@ ClassImp(AliITSvSPD02) //______________________________________________________________________ -AliITSvSPD02::AliITSvSPD02() { +AliITSvSPD02::AliITSvSPD02(): +AliITS(), +fGeomDetOut(kFALSE), +fGeomDetIn(kFALSE), +fMajorVersion((Int_t)kvSPD02), +fMinorVersion(2), +fGeomNumber(2002), +fEuclidGeomDet(), +fRead(), +fWrite(), +fDet1(300.0), +fDet2(300.0), +fChip1(300.0), +fChip2(300.0), +fIDMother(0), +fIgm(kvSPD02){ //////////////////////////////////////////////////////////////////////// // Standard default constructor for the ITS SPD test beam 2002 version 1. // Inputs: @@ -68,24 +78,31 @@ AliITSvSPD02::AliITSvSPD02() { //////////////////////////////////////////////////////////////////////// Int_t i; - fIdN = 0; - fIdName = 0; - fIdSens = 0; - fEuclidOut = kFALSE; // Don't write Euclide file - fGeomDetOut = kFALSE; // Don't write .det file - fGeomDetIn = kFALSE; // Don't Read .det file - fMajorVersion = IsVersion(); - fMinorVersion = -1; for(i=0;i<60;i++) fRead[i] = '\0'; for(i=0;i<60;i++) fWrite[i] = '\0'; for(i=0;i<60;i++) fEuclidGeomDet[i] = '\0'; } //______________________________________________________________________ -AliITSvSPD02::AliITSvSPD02(const char *title) : AliITS("ITS", title){ +AliITSvSPD02::AliITSvSPD02(const char *title,Int_t gn) : AliITS("ITS", title), +fGeomDetOut(kFALSE), +fGeomDetIn(kFALSE), +fMajorVersion(1), +fMinorVersion(2), +fGeomNumber(2002), +fEuclidGeomDet(), +fRead(), +fWrite(), +fDet1(300.0), +fDet2(300.0), +fChip1(300.0), +fChip2(300.0), +fIDMother(0), +fIgm(kvSPD02){ //////////////////////////////////////////////////////////////////////// // Standard constructor for the ITS SPD testbeam 2002 version 1. // Inputs: // const char *title title for this ITS geometry. + // Int_t gn Geometry version number (year) default 2002. // Outputs: // none. // Return: @@ -93,17 +110,13 @@ AliITSvSPD02::AliITSvSPD02(const char *title) : AliITS("ITS", title){ //////////////////////////////////////////////////////////////////////// Int_t i; + fGeomNumber = gn; fIdN = 2; fIdName = new TString[fIdN]; fIdName[0] = "IMBS"; fIdName[1] = "ITST"; fIdSens = new Int_t[fIdN]; for(i=0;icd(); // set ourselve into ITSV subvolume of aALIC // SPD part of telescope (MiniBuS) @@ -261,36 +275,36 @@ void AliITSvSPD02::BuildGeometry(){ 0.0,iIDETshape->GetDy()-spdY,0.0,0,0); TNode *iIPC0[5]; for(i=0;i<5;i++) { //place readout chips on the back of SPD chip under test - sprintf(name,"IPC0%d",i); - sprintf(title,"Readout chip #%d",i+1); - j = i-2; - iIPC0[i] = new TNode(name,title,iIPC0shape, - 0.0,spdchipY-iIDETshape->GetDy(), - j*2.0*spdchipZ+j*0.25*(spdZ-5.*spdchipZ),0,0); + sprintf(name,"IPC0%d",i); + sprintf(title,"Readout chip #%d",i+1); + j = i-2; + iIPC0[i] = new TNode(name,title,iIPC0shape, + 0.0,spdchipY-iIDETshape->GetDy(), + j*2.0*spdchipZ+j*0.25*(spdZ-5.*spdchipZ),0,0); } // end for i iITS0->cd(); TNode *iITST = new TNode("ITST","SPD sensitive volume",iITSTshape, - 0.0,0.0,0.0,0,0); + 0.0,0.0,0.0,0,0); for(Int_t i=0;i<4;i++){ - iITSV->cd(); - sprintf(name,"ITEL%d",i); - sprintf(title,"Test beam telescope element #%d",i+1); - iITEL[i] = new TNode(name,title,iITELshape,px,py,pz[i],r0,0); - iITEL[i]->cd(); - iICMB[i] = new TNode("ICMB","Chip MiniBus",iICMBshape, - 0.0,-iITELshape->GetDy()+detMiniBusY,0.0,0,0); - iIMB0[i] = new TNode("IMB0","Chip MiniBus",iIMB0shape, - 0.0, iITELshape->GetDy()-detMiniBusY,0.0,0,0); - iIMB0[i]->cd(); - iIMBS[i] = new TNode("IMBS","IMBS",iIMBSshape,0.0,0.0,0.0,0,0); - // place IMBS inside IMB0 with no translation and unit rotation matrix. + iITSV->cd(); + sprintf(name,"ITEL%d",i); + sprintf(title,"Test beam telescope element #%d",i+1); + iITEL[i] = new TNode(name,title,iITELshape,px,py,pz[i],r0,0); + iITEL[i]->cd(); + iICMB[i] = new TNode("ICMB","Chip MiniBus",iICMBshape, + 0.0,-iITELshape->GetDy()+detMiniBusY,0.0,0,0); + iIMB0[i] = new TNode("IMB0","Chip MiniBus",iIMB0shape, + 0.0, iITELshape->GetDy()-detMiniBusY,0.0,0,0); + iIMB0[i]->cd(); + iIMBS[i] = new TNode("IMBS","IMBS",iIMBSshape,0.0,0.0,0.0,0,0); + // place IMBS inside IMB0 with no translation and unit rotation matrix. } // end for i aALIC->cd(); iITST->SetLineColor(kYellow); fNodes->Add(iITST); for(i=0;i<4;i++){ - iIMBS[i]->SetLineColor(kGreen); - fNodes->Add(iIMBS[i]); + iIMBS[i]->SetLineColor(kGreen); + fNodes->Add(iIMBS[i]); } // end for i } //______________________________________________________________________ @@ -314,6 +328,42 @@ void AliITSvSPD02::CreateGeometry(){ // Return: // none. //////////////////////////////////////////////////////////////////////// + + switch (fGeomNumber){ + case 2002: + CreateGeometry2002(); + break; + default: + CreateGeometry2002(); + break; + } // end switch +} +//______________________________________________________________________ +void AliITSvSPD02::CreateGeometry2002(){ + //////////////////////////////////////////////////////////////////////// + // This routine defines and Creates the geometry for version 1 of the ITS. + // ALIC ALICE Mother Volume + // |- ITSV ITS Mother Volume + // |- IDET Detector under Test + // | |- ITS0 SPD Si Chip + // | | |- ITST SPD Sensitivve Volume + // | |- IPC0 *5 Readout chip + // |- ITEL *4 SPD Telescope + // |- IMB0 SPD Si Chip + // | |- IMBS SPD Sensitive volume + // |- ICMB Chip MiniBus. + // + // ITEL ITEL IDET ITEL ITEL + // Z-> -38 -36 02 36.5 38.5 + // | | | | | + // cpn1 1 2 1 3 4 + // Inputs: + // none. + // Outputs: + // none. + // Return: + // none. + //////////////////////////////////////////////////////////////////////// Float_t data[49]; // Define media off-set Int_t *idtmed = fIdtmed->GetArray()+1; // array of media indexes @@ -321,15 +371,36 @@ void AliITSvSPD02::CreateGeometry(){ Float_t ddettest=200.0E-4,ddettelescope=300.0E-4; Float_t dchipMiniBus=750.0E-4,dchiptest=300.0E-4; Float_t yposition= 0.0; + // These constant character strings are set by cvs during commit + // do not change them unless you know what you are doing! + const Char_t *cvsDate="$Date$"; + const Char_t *cvsRevision="$Revision$"; + if(gMC==0) return; // Define Rotation-reflextion Matrixes needed // 0 is the unit matrix AliMatrix(idrotm[0], 90.0,0.0, 0.0,0.0, 90.0,270.0); + /* data[0] = 10.0; data[1] = 50.0; data[2] = 100.0; gMC->Gsvolu("ITSV","BOX",idtmed[0],data,3); gMC->Gspos("ITSV",1,"ALIC",0.0,0.0,0.0,0,"ONLY"); + */ + TGeoVolumeAssembly *itsV = gGeoManager->MakeVolumeAssembly("ITSV"); + const Int_t length=100; + Char_t vstrng[length]; + if(fIgm.WriteVersionString(vstrng,length,(AliITSVersion_t)IsVersion(), + fMinorVersion,cvsDate,cvsRevision)) + itsV->SetTitle(vstrng); + else Error("CreateGeometry","Error writing/setting version string"); + TGeoVolume *alic = gGeoManager->GetVolume("ALIC"); + if(alic==0) { + Error("CreateGeometry","alic=0"); + return; + } // end if + // See idrotm[199] for angle definitions. + alic->AddNode(itsV,1,0); //cout << "idtmed[0]=" << idtmed[0]<GetName(),"TGeant3")) { - Error("InitAliITSgeom", - "Wrong Monte Carlo. InitAliITSgeom uses TGeant3 calls"); - return; - } // end if - cout << "Reading Geometry transformation directly from Geant 3." << endl; - const Int_t kltypess = 2; - const Int_t knlayers = 5; - const Int_t kndeep = 5; - 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; - 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","IMB0","IMBS"}, // lay=1 - {"ALIC","ITSV","IDET","ITS0","ITST"}};// Test SPD - Int_t itsGeomTreeCopysA[kltypess][kndeep]= {{1,1,4,1,1},// lay=1 - {1,1,1,1,1}};//lay=2 TestSPD - for(i=0;iStringToInt(names[i][j]); - mod = 5; - if(fITSgeom!=0) delete fITSgeom; - nlad[0]=1;nlad[1]=1;nlad[2]=1;nlad[3]=1;nlad[4]=1; - ndet[0]=1;ndet[1]=1;ndet[2]=1;ndet[3]=1;ndet[4]=1; - fITSgeom = new AliITSgeom(0,knlayers,nlad,ndet,mod); - for(typ=1;typ<=kltypess;typ++){ - for(j=0;j2 && typ==1) lay = cpy +1; - if(typ==2) lay = 3; - mod = lay-1; - ig->GetGeometry(kndeep,lnam,lnum,t,r,idshape,npar,natt,par,att, - imat,imed); - fITSgeom->CreatMatrix(mod,lay,lad,det,kSPD,t,r); - if(!(fITSgeom->IsShapeDefined((Int_t)kSPD))) - fITSgeom->ReSetShape(kSPD, - new AliITSgeomSPD425Short(npar,par)); - } // end for cpy - } // end for typ - return; + epsilSi,stminSi); } //______________________________________________________________________ void AliITSvSPD02::Init(){ - //////////////////////////////////////////////////////////////////////// // Initialise the ITS after it has been created. // Inputs: - // none. + // none. // Outputs: - // none. + // none. // Return: - // none. - //////////////////////////////////////////////////////////////////////// - Int_t i; + // none. - cout << endl; - for(i=0;i<26;i++) cout << "*"; - cout << " ITSvSPD02" << fMinorVersion << "_Init "; - for(i=0;i<25;i++) cout << "*";cout << endl; -// - 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(!fGeomDetIn) this->InitAliITSgeom(); - if(fGeomDetOut) fITSgeom->WriteNewFile(fWrite); + AliDebug(1,Form("Init: Major version %d Minor version %d",fMajorVersion, + fMinorVersion)); + // + UpdateInternalGeometry(); AliITS::Init(); -// - for(i=0;i<72;i++) cout << "*"; - cout << endl; + if(fGeomDetOut) GetITSgeom()->WriteNewFile(fWrite); + + // fIDMother = gMC->VolId("ITSV"); // ITS Mother Volume ID. + } +/* //______________________________________________________________________ void AliITSvSPD02::SetDefaults(){ // sets the default segmentation, response, digit and raw cluster classes @@ -566,20 +587,23 @@ void AliITSvSPD02::SetDefaults(){ Info("SetDefaults","Setting up only SPD detector"); - AliITSDetType *iDetType; + if(!fDetTypeSim) fDetTypeSim = new AliITSDetTypeSim(); + fDetTypeSim->SetITSgeom(GetITSgeom()); AliITSgeomSPD *s0; Int_t i; Float_t bx[256],bz[280]; - + fDetTypeSim->ResetCalibrationArray(); + fDetTypeSim->ResetSegmentation(); + //SPD - iDetType=DetType(kSPD); // Get shape info. Do it this way for now. - s0 = (AliITSgeomSPD*) fITSgeom->GetShape(kSPD); - AliITSresponse *resp0=new AliITSresponseSPDdubna(); + s0 = (AliITSgeomSPD*) GetITSgeom()->GetShape(kSPD); + AliITSCalibration *resp0=new AliITSCalibrationSPD(); resp0->SetTemperature(); resp0->SetDistanceOverVoltage(); - SetResponseModel(kSPD,resp0); - AliITSsegmentationSPD *seg0=new AliITSsegmentationSPD(fITSgeom); + SetCalibrationModel(0,resp0); + + AliITSsegmentationSPD *seg0=new AliITSsegmentationSPD(); seg0->SetDetSize(s0->GetDx()*2.*kconv, // base this on AliITSgeomSPD s0->GetDz()*2.*kconv, // for now. s0->GetDy()*2.*kconv); // x,z,y full width in microns. @@ -595,22 +619,22 @@ void AliITSvSPD02::SetDefaults(){ seg0->SetBinSize(bx,bz); // Based on AliITSgeomSPD for now. SetSegmentationModel(kSPD,seg0); // set digit and raw cluster classes to be used - const char *kData0=(iDetType->GetResponseModel())->DataType(); - if (strstr(kData0,"real")) iDetType->ClassNames("AliITSdigit", - "AliITSRawClusterSPD"); - else iDetType->ClassNames("AliITSdigitSPD","AliITSRawClusterSPD"); -// SetSimulationModel(kSPD,new AliITSsimulationSPD(seg0,resp0)); + const char *kData0=(fDetTypeSim->GetCalibrationModel(0))->DataType(); + if (strstr(kData0,"real")) fDetTypeSim->SetDigitClassName(kSPD,"AliITSdigit"); + else fDetTypeSim->SetDigitClassName(kSPD,"AliITSdigitSPD"); +// SetSimulationModel(kSPD,new AliITSsimulationSPDdubna(seg0,resp0)); // iDetType->ReconstructionModel(new AliITSClusterFinderSPD()); + - SetResponseModel(kSDD,new AliITSresponseSDD()); - SetSegmentationModel(kSDD,new AliITSsegmentationSDD()); - DetType(kSDD)->ClassNames("AliITSdigitSDD","AliITSRawClusterSDD"); +// SetResponseModel(kSDD,new AliITSCalibrationSDD()); +// SetSegmentationModel(kSDD,new AliITSsegmentationSDD()); +// DetType(kSDD)->ClassNames("AliITSdigitSDD","AliITSRawClusterSDD"); - SetResponseModel(kSSD,new AliITSresponseSSD()); - SetSegmentationModel(kSSD,new AliITSsegmentationSSD()); - DetType(kSSD)->ClassNames("AliITSdigitSSD","AliITSRawClusterSSD"); +// SetResponseModel(kSSD,new AliITSCalibrationSSD()); +// SetSegmentationModel(kSSD,new AliITSsegmentationSSD()); +// DetType(kSSD)->ClassNames("AliITSdigitSSD","AliITSRawClusterSSD"); - if(kNTYPES>3){ + if(fgkNTYPES>3){ Warning("SetDefaults", "Only the four basic detector types are initialised!"); }// end if @@ -626,60 +650,57 @@ void AliITSvSPD02::SetDefaultSimulation(){ // Return: // none. - AliITSDetType *iDetType; - AliITSsimulation *sim; - iDetType=DetType(0); - sim = iDetType->GetSimulationModel(); - if (!sim) { - AliITSsegmentation *seg0= - (AliITSsegmentation*)iDetType->GetSegmentationModel(); - AliITSresponse *res0 = (AliITSresponse*)iDetType->GetResponseModel(); - AliITSsimulationSPDdubna *sim0=new AliITSsimulationSPDdubna(seg0,res0); - SetSimulationModel(0,sim0); - }else{ // simulation exists, make sure it is set up properly. - ((AliITSsimulationSPDdubna*)sim)->Init( - (AliITSsegmentationSPD*) iDetType->GetSegmentationModel(), - (AliITSresponseSPDdubna*) iDetType->GetResponseModel()); -// if(sim->GetResponseModel()==0) sim->SetResponseModel( -// (AliITSresponse*)iDetType->GetResponseModel()); -// if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel( -// (AliITSsegmentation*)iDetType->GetSegmentationModel()); - } // end if - iDetType=DetType(1); - sim = iDetType->GetSimulationModel(); - if (!sim) { - AliITSsegmentation *seg1= - (AliITSsegmentation*)iDetType->GetSegmentationModel(); - AliITSresponse *res1 = (AliITSresponse*)iDetType->GetResponseModel(); - AliITSsimulationSDD *sim1=new AliITSsimulationSDD(seg1,res1); - SetSimulationModel(1,sim1); - }else{ // simulation exists, make sure it is set up properly. - ((AliITSsimulationSDD*)sim)->Init( - (AliITSsegmentationSDD*) iDetType->GetSegmentationModel(), - (AliITSresponseSDD*) iDetType->GetResponseModel()); -// if(sim->GetResponseModel()==0) sim->SetResponseModel( -// (AliITSresponse*)iDetType->GetResponseModel()); -// if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel( -// (AliITSsegmentation*)iDetType->GetSegmentationModel()); - } //end if - iDetType=DetType(2); - sim = iDetType->GetSimulationModel(); + if(GetITSgeom()==0){ + Warning("SetDefaultSimulation","ITS geometry is null!"); + return; + } + + if(!fDetTypeSim) fDetTypeSim = new AliITSDetTypeSim(); + AliITSsimulation *sim; + //AliITSsegmentation *seg; + //AliITSCalibration *res; + if(fDetTypeSim){ + sim = fDetTypeSim->GetSimulationModel(kSPD); if (!sim) { - AliITSsegmentation *seg2= - (AliITSsegmentation*)iDetType->GetSegmentationModel(); - AliITSresponse *res2 = (AliITSresponse*)iDetType->GetResponseModel(); - AliITSsimulationSSD *sim2=new AliITSsimulationSSD(seg2,res2); - SetSimulationModel(2,sim2); + //seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSPD); + //res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSPD()); + sim = new AliITSsimulationSPD(fDetTypeSim); + SetSimulationModel(kSPD,sim); }else{ // simulation exists, make sure it is set up properly. - ((AliITSsimulationSSD*)sim)->Init( - (AliITSsegmentationSSD*) iDetType->GetSegmentationModel(), - (AliITSresponseSSD*) iDetType->GetResponseModel()); -// if(sim->GetResponseModel()==0) sim->SetResponseModel( -// (AliITSresponse*)iDetType->GetResponseModel()); -// if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel( -// (AliITSsegmentation*)iDetType->GetSegmentationModel()); + sim->SetCalibrationModel(GetITSgeom()->GetStartSPD(),(AliITSCalibration*)fDetTypeSim->GetCalibrationModel(GetITSgeom()->GetStartSPD())); + sim->SetSegmentationModel(kSPD,(AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSPD)); + sim->Init(); } // end if + } // end if iDetType + +// if(fDetTypeSim){ +// sim = fDetTypeSim->GetSimulationModel(kSDD); +// if (!sim) { +// seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSDD); +// res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSDD()); +// sim = new AliITSsimulationSDD(seg,res); +// SetSimulationModel(kSDD,sim); +// }else{ // simulation exists, make sure it is set up properly. +// sim->SetResponseModel((AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSDD())); +// sim->SetSegmentationModel((AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSDD)); +// sim->Init(); +// } //end if +// } // end if iDetType +// if(fDetTypeSim){ +// sim = fDetTypeSim->GetSimulationModel(kSSD); +// if (!sim) { +// seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSSD); +// res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSSD()); +// sim = new AliITSsimulationSSD(seg,res); +// SetSimulationModel(kSSD,sim); +// }else{ // simulation exists, make sure it is set up properly. +// sim->SetResponseModel((AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSSD())); +// sim->SetSegmentationModel((AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSSD)); +// sim->Init(); +// } // end if +// } // } +*/ //______________________________________________________________________ void AliITSvSPD02::DrawModule() const { //////////////////////////////////////////////////////////////////////// @@ -728,67 +749,64 @@ void AliITSvSPD02::StepManager(){ // Return: // none. //////////////////////////////////////////////////////////////////////// - Int_t copy, id; - TLorentzVector position, momentum; - static TLorentzVector position0; - static Int_t stat0=0; - if((id=gMC->CurrentVolID(copy) == fIDMother)&& - (gMC->IsTrackEntering()||gMC->IsTrackExiting())){ - copy = fTrackReferences->GetEntriesFast(); - TClonesArray &lTR = *fTrackReferences; - // Fill TrackReference structure with this new TrackReference. - new(lTR[copy]) AliTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber()); - } // if Outer ITS mother Volume + if(!(this->IsActive())){ - return; + return; } // end if !Active volume. - Int_t vol[5]; - TClonesArray &lhits = *fHits; + if(!(gMC->TrackCharge())) return; + + Int_t cpy0=0,cpy1=0,id,mod,ncpys,status; + TLorentzVector position, momentum; + static AliITShit hit;// Saves on calls to construtors + //TClonesArray &lhits = *(GetDetTypeSim()->GetHits()); + TClonesArray &lhits = *(Hits()); // // Track status - vol[3] = 0; - vol[4] = 0; - if(gMC->IsTrackInside()) vol[3] += 1; - if(gMC->IsTrackEntering()) vol[3] += 2; - if(gMC->IsTrackExiting()) vol[3] += 4; - if(gMC->IsTrackOut()) vol[3] += 8; - if(gMC->IsTrackDisappeared()) vol[3] += 16; - if(gMC->IsTrackStop()) vol[3] += 32; - if(gMC->IsTrackAlive()) vol[3] += 64; + // Track status + status = 0; + if(gMC->IsTrackInside()) status += 1; + if(gMC->IsTrackEntering()) status += 2; + if(gMC->IsTrackExiting()) status += 4; + if(gMC->IsTrackOut()) status += 8; + if(gMC->IsTrackDisappeared()) status += 16; + if(gMC->IsTrackStop()) status += 32; + if(gMC->IsTrackAlive()) status += 64; // // Fill hit structure. - if(!(gMC->TrackCharge())) return; - id = gMC->CurrentVolID(copy); - if(id==fIdSens[0]){ // Volume name "IMBS" - vol[2] = vol[1] = 1; // Det, ladder - id = gMC->CurrentVolOffID(2,copy); - //detector copy in the ladder = 1<->4 (ITS1 < I101 < I103 < I10A) - vol[0] = copy; // Lay - if(copy>2) vol[0]++; + id = gMC->CurrentVolID(cpy0); + if(id==fIdSens[0]){ // Volume name "IMBS". Det=1, ladder=1 + ncpys = 4; } else if(id == fIdSens[1]){ // Volume name "ITST" - vol[0] = 3; // layer - vol[1] = 1; // ladder - id = gMC->CurrentVolOffID(2,copy); - //detector copy in the ladder = 1<->4 (ITS2 < I1D1 < I1D3 < I20A) - vol[2] = 1; // detector + ncpys = 1; } else return; // end if + id = gMC->CurrentVolOffID(2,cpy1); + fIgm.DecodeDetector(mod,ncpys,cpy0,cpy1,0); // + // Fill hit structure. + // + hit.SetModule(mod); + hit.SetTrack(gAlice->GetMCApp()->GetCurrentTrackNumber()); gMC->TrackPosition(position); gMC->TrackMomentum(momentum); - vol[4] = stat0; + hit.SetPosition(position); + hit.SetTime(gMC->TrackTime()); + hit.SetMomentum(momentum); + hit.SetStatus(status); + hit.SetEdep(gMC->Edep()); + hit.SetShunt(GetIshunt()); if(gMC->IsTrackEntering()){ - position0 = position; - stat0 = vol[3]; - return; + hit.SetStartPosition(position); + hit.SetStartTime(gMC->TrackTime()); + hit.SetStartStatus(status); + return; // don't save entering hit. } // end if IsEntering - // Fill hit structure with this new hit only for non-entrerance hits. - else new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->GetMCApp()->GetCurrentTrackNumber(),vol, - gMC->Edep(),gMC->TrackTime(),position, - position0,momentum); - // - position0 = position; - stat0 = vol[3]; - + // Fill hit structure with this new hit. + //Info("StepManager","Calling Copy Constructor"); + new(lhits[fNhits++]) AliITShit(hit); // Use Copy Construtor. + // Save old position... for next hit. + hit.SetStartPosition(position); + hit.SetStartTime(gMC->TrackTime()); + hit.SetStartStatus(status); return; }