X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=ITS%2FAliITSv5asymm.cxx;h=eed6e7ea6e8dc5c5d0b90cebfd80455c3443d76d;hb=68ec3d3dbdfac0b2d6d0b989a14fdbd978fe53cd;hp=2c7fe339731d448cedc71333533673abaf6f7614;hpb=d683f3d57a07c8a59d76fffd38458f25f07e4224;p=u%2Fmrichter%2FAliRoot.git diff --git a/ITS/AliITSv5asymm.cxx b/ITS/AliITSv5asymm.cxx index 2c7fe339731..eed6e7ea6e8 100644 --- a/ITS/AliITSv5asymm.cxx +++ b/ITS/AliITSv5asymm.cxx @@ -15,6 +15,80 @@ /* $Log$ +Revision 1.20 2002/10/22 14:45:47 alibrary +Introducing Riostream.h + +Revision 1.19 2002/10/14 14:57:08 hristov +Merging the VirtualMC branch to the main development branch (HEAD) + +Revision 1.18.10.2 2002/08/30 15:45:54 alibrary +Adding geant4vmc support + +Revision 1.18.10.1 2002/06/10 17:51:15 hristov +Merged with v3-08-02 + +Revision 1.18 2001/05/30 16:15:47 fca +Correct comparison wiht AliGeant3::Class() introduced. Thanks to I.Hrivnacova + +Revision 1.17 2001/05/30 15:55:35 hristov +Strings compared instead of pointers + +Revision 1.16 2001/05/30 14:04:31 hristov +Dynamic cast replaced (F.Carminati) + +Revision 1.15 2001/05/25 06:47:16 hristov +Bug fix in the creation of the AliITSgeom::fShape entry for SPD. Now there is both a proper shape entry and a default, should there be future changes. This bug was related to fMinorVersion=3 was not antisipated. (B.Nilsen) + +Revision 1.14 2001/05/16 14:57:16 alibrary +New files for folders and Stack + +Revision 1.13 2001/05/09 01:00:19 nilsen +Fixed up a typo in the cout of Init(). Now properly indecates which version +of code is being used. + +Revision 1.12 2001/04/18 12:06:02 barbera +Number of modules in layer 5 and 6 re-set to 23 and 26 + +Revision 1.11 2001/03/23 00:12:23 nilsen +Set Reading of AliITSgeom data from Geant3 common blocks as the default and +not a .det file. Removed redundent calls to BuildGeometry. + +Revision 1.10 2001/02/14 14:22:58 nilsen +Now looking in the right director for the old .det. + +Revision 1.9 2001/02/14 14:12:43 nilsen +Forgot about the nonexisting v in ITSgeometry_5.det. + +Revision 1.8 2001/02/14 14:06:23 nilsen +Wrong default .det file name for old .det file format. + +Revision 1.7 2001/02/13 16:53:35 nilsen +Fixed a but when trying to use GEANT4. Needed to replace +if(!((TGeant3*)gMC)) with if(!(dynamic_casst(gMC))) +because just casting gMC to be TGeant3* even when it realy is a TGeant3 pointer +did not result in a zero value. For AliITSv5asymm and AliITSv5symm, needed +to fix a bug in the initilizers and a bug in BuildGeometry. This is now done +in the same way as in AliITSv5.cxx. + +Revision 1.6 2001/02/09 20:06:26 nilsen +Fixed bug in distructor. Can't distroy fixxed length arrays. Thanks Peter. + +Revision 1.5 2001/02/09 00:05:31 nilsen +Added fMajor/MinorVersion variables and made other changes to better make +use of the new code changes in AliITSgeom related classes. + +Revision 1.4 2001/02/02 23:57:29 nilsen +Added include file that are no londer included in AliITSgeom.h + +Revision 1.3 2001/01/30 09:23:13 hristov +Streamers removed (R.Brun) + +Revision 1.2 2000/11/30 11:13:11 barbera + Added changes suggested by Federico Carminati on nov, 30, 2000 + +Revision 1.1 2000/10/07 15:46:38 barbera +Version 5 of the geometry with asymmetric services + Revision 1.25 2000/10/05 20:50:00 nilsen Now using root generated streamers. @@ -61,11 +135,7 @@ Introduction of the Copyright and cvs Log // Created October 7 2000. // /////////////////////////////////////////////////////////////////////////////// - -// See AliITSv5asymm::StepManager(). -#define ALIITSPRINTGEOM 0 // default. don't print out gemetry information -//#define ALIITSPRINTGEOM 1 // print out geometry information - +#include #include #include #include @@ -77,18 +147,19 @@ Introduction of the Copyright and cvs Log #include #include #include +#include #include #include -#include "AliMC.h" #include "AliRun.h" -#if ALIITSPRINTGEOM==1 -#include "../TGeant3/TGeant3.h" -#endif #include "AliITShit.h" +#include "AliITSGeant3Geometry.h" #include "AliITS.h" #include "AliITSv5asymm.h" #include "AliITSgeom.h" +#include "AliITSgeomSPD.h" +#include "AliITSgeomSDD.h" +#include "AliITSgeomSSD.h" ClassImp(AliITSv5asymm) @@ -97,12 +168,52 @@ AliITSv5asymm::AliITSv5asymm() { //////////////////////////////////////////////////////////////////////// // Standard default constructor for the ITS version 5. //////////////////////////////////////////////////////////////////////// + Int_t i; fIdN = 0; fIdName = 0; fIdSens = 0; - fMajorVersion = 5; - fMinorVersion = -1; + fEuclidOut = kFALSE; // Don't write Euclide file + fGeomDetOut = kFALSE; // Don't write .det file + fGeomDetIn = kFALSE; // Don't Read .det file + fGeomOldDetIn = kFALSE; // Don't Read old formatted .det file + fMajorVersion = IsVersion(); + fMinorVersion = 3; + 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'; +} +//_____________________________________________________________________________ +AliITSv5asymm::AliITSv5asymm(const char *name, const char *title) : AliITS(name, title){ +///////////////////////////////////////////////////////////////////////////// +// Standard constructor for the ITS version 5 with symmetrical services. +///////////////////////////////////////////////////////////////////////////// + Int_t i; + + fIdN = 6; + fIdName = new TString[fIdN]; + fIdName[0] = "ITS1"; + fIdName[1] = "ITS2"; + fIdName[2] = "ITS3"; + fIdName[3] = "ITS4"; + fIdName[4] = "ITS5"; + fIdName[5] = "ITS6"; + fIdSens = new Int_t[fIdN]; + for (i=0;iAddAt(new TObjString("ITS1"),0); - fIdName->AddAt(new TObjString("ITS2"),1); - fIdName->AddAt(new TObjString("ITS3"),2); - fIdName->AddAt(new TObjString("ITS4"),3); - fIdName->AddAt(new TObjString("ITS5"),4); - fIdName->AddAt(new TObjString("ITS6"),5); -*/ -// Array of TStrings. - fIdName = new TString[fIdN]; - fIdName[0] = "ITS1"; - fIdName[1] = "ITS2"; - fIdName[2] = "ITS3"; - fIdName[3] = "ITS4"; - fIdName[4] = "ITS5"; - fIdName[5] = "ITS6"; - fIdSens = new Int_t[fIdN]; - for (Int_t i=0;iGetGeometry()->GetNode("alice"); AliITSgeom *gm = this->GetITSgeom(); + if(gm==0) return; + top=gAlice->GetGeometry()->GetNode("alice"); Int_t lay,lad,det,i; Text_t name[10]; @@ -194,7 +274,7 @@ void AliITSv5asymm::BuildGeometry(){ for(lad=1;lad<=gm->GetNladders(lay);lad++) for(det=1;det<=gm->GetNdetectors(lay);det++){ try { - box = new TBRIK ("ActiveSPD","Active volume of SPD","SPD SI DET", + box = new TBRIK("ActiveSPD","Active volume of SPD","SPD SI DET", 0.64,0.0075,4.19); } catch (...) { cout << "EXCEPTION in box = new TBRIK" << endl; @@ -531,8 +611,6 @@ void AliITSv5asymm::CreateGeometry(){ // // Read a file containing the geometry for the ITS version 5. //////////////////////////////////////////////////////////////////////// - - Int_t size; char topvol[5]; char *filtmp; @@ -541,14 +619,13 @@ void AliITSv5asymm::CreateGeometry(){ delete [] filtmp; if(file) { fclose(file); - printf("Ready to read Euclid geometry file\n"); + if(fDebug) cout << ClassName() << ": Ready to read Euclid geometry file" << endl; ReadEuclid(fEuclidGeometry.Data(),topvol); - printf("Read in euclid geometries\n"); - } else { - Error("CreateGeometry"," THE GEOM FILE %s DOES NOT EXIST !", + if(fDebug) cout << ClassName() << ": Read in euclid geometries" << endl; + } else + Fatal("CreateGeometry"," THE GEOM FILE %s DOES NOT EXIST !", fEuclidGeometry.Data()); - exit(1); - } // end if(file) + // end if(file) // // Place the ITS ghost volume ITSV in its mother volume (ALIC) and make it // invisible @@ -561,37 +638,189 @@ void AliITSv5asymm::CreateGeometry(){ gMC->WriteEuclid("ITSgeometry", "ITSV", 1, 5); } // end if (fEuclidOut) + if(fDebug) cout << ClassName() << ": finished with euclid geometrys" << endl; +} + +//______________________________________________________________________ +void AliITSv5asymm::ReadOldGeometry(const char *filename){ // read in the file containing the transformations for the active // volumes for the ITS version 5. This is expected to be in a file // ending in .det. This geometry is kept in the AliITSgeom class. - filtmp = gSystem->ExpandPathName(fEuclidGeometry.Data()); + Int_t size; + char *filtmp; + FILE *file; + + filtmp = gSystem->ExpandPathName(filename); size = strlen(filtmp); - if(size>4){ - filtmp[size-3] = 'd'; // change from .euc to .det + if(size>4 && fGeomDetIn){ + filtmp[size-3] = 'd'; // change from .euc to .det filtmp[size-2] = 'e'; filtmp[size-1] = 't'; - file = fopen(filtmp,"r"); - if(file){ // if file exists use it to fill AliITSgeom structure. - fclose(file); - printf("ready to read .det file %s\n",filtmp); - fITSgeom = new AliITSgeom(filtmp); - }else{ - fITSgeom = 0; - // fill AliITSgeom structure from geant structure just filled above - }// end if(file) + file = fopen(filtmp,"r"); + if(file){ // if file exists use it to fill AliITSgeom structure. + fclose(file); + fITSgeom = new AliITSgeom(filtmp); + fITSgeom->DefineShapes(3); // if fShape isn't defined define it. + // Now define the detector types/shapes. + fITSgeom->ReSetShape(kSPD,(TObject *) new AliITSgeomSPD300()); + fITSgeom->ReSetShape(kSDD,(TObject *) new AliITSgeomSDD300()); + fITSgeom->ReSetShape(kSSD,(TObject *) new AliITSgeomSSD()); + }else{ + fITSgeom = 0; + // fill AliITSgeom structure from geant structure just filled above + }// end if(file) delete [] filtmp; }// end if(size>4) - printf("finished with euclid geometrys\n"); +} +//______________________________________________________________________ +void AliITSv5asymm::InitAliITSgeom(){ +// Based on the geometry tree defined in Geant 3.21, this +// routine initilizes the Class AliITSgeom from the Geant 3.21 ITS geometry +// sturture. +// if(gMC->IsA()!=TGeant3::Class()) { + if(strcmp(gMC->GetName(),"TGeant3")) { + Error("InitAliITSgeom", + "Wrong Monte Carlo. InitAliITSgeom uses TGeant3 calls"); + return; + } // end if + if(fDebug) cout << ClassName() + << ": Reading Geometry transformation directly from Geant 3." << endl; + const Int_t nlayers = 6; + const Int_t ndeep = 7; + Int_t itsGeomTreeNames[nlayers][ndeep],lnam[20],lnum[20]; + Int_t nlad[nlayers],ndet[nlayers]; + 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,lay,lad,det,i,j,k; + char *names[nlayers][ndeep] = { + {"ALIC","ITSV","ITSD","IT12","I132","I186","ITS1"}, // lay=1 + {"ALIC","ITSV","ITSD","IT12","I132","I131","ITS2"}, // lay=2 + {"ALIC","ITSV","ITSD","IT34","I004","I302","ITS3"}, // lay=3 + {"ALIC","ITSV","ITSD","IT34","I005","I402","ITS4"}, // lay=4 + {"ALIC","ITSV","ITSD","IT56","I565","I562","ITS5"}, // lay=5 + {"ALIC","ITSV","ITSD","IT56","I569","I566","ITS6"}};// lay=6 + Int_t itsGeomTreeCopys[nlayers][ndeep] = {{1,1,1,1,10, 2,4}, // lay=1 + {1,1,1,1,10, 4,4}, // lay=2 + {1,1,1,1,14, 6,1}, // lay=3 + {1,1,1,1,22, 8,1}, // lay=4 + {1,1,1,1,34,23,1}, // lay=5 + {1,1,1,1,38,26,1}};// lay=6 + + // Sorry, but this is not very pritty code. It should be replaced + // at some point with a version that can search through the geometry + // tree its self. + if(fDebug) cout << ClassName() + << ": Reading Geometry informaton from Geant3 common blocks" << endl; + for(i=0;i<20;i++) lnam[i] = lnum[i] = 0; + for(i=0;iStringToInt(names[i][j]); + mod = 0; + for(i=0;iGetGeometry(ndeep,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))) + if(fMinorVersion==1){ + fITSgeom->ReSetShape(kSPD, + new AliITSgeomSPD300()); + } else if(fMinorVersion==2){ + fITSgeom->ReSetShape(kSPD, + new AliITSgeomSPD300()); + }else if(fMinorVersion==3){ + fITSgeom->ReSetShape(kSPD, + new AliITSgeomSPD425Long()); + }else{ + fITSgeom->ReSetShape(kSPD, + new AliITSgeomSPD300()); + } // end if + } // end for det + } // end for k + } // end for j + break; + case 3: case 4: case 5: case 6: // layers 3-6 + lnum[6] = 1; + for(lad=1;lad<=itsGeomTreeCopys[lay-1][4];lad++){ + lnum[4] = lad; + for(det=1;det<=itsGeomTreeCopys[lay-1][5];det++){ + lnum[5] = det; + mod++; + ig->GetGeometry(7,lnam,lnum,t,r,idshape,npar,natt, + par,att,imat,imed); + switch (lay){ + case 3: case 4: + fITSgeom->CreatMatrix(mod,lay,lad,det,kSDD,t,r); + if(!(fITSgeom->IsShapeDefined(kSDD))) + fITSgeom->ReSetShape(kSDD,new AliITSgeomSDD300()); + break; + case 5: case 6: + fITSgeom->CreatMatrix(mod,lay,lad,det,kSSD,t,r); + if(!(fITSgeom->IsShapeDefined(kSSD))) + fITSgeom->ReSetShape(kSSD,new AliITSgeomSSD175()); + break; + } // end switch + } // end for det + } // end for lad + break; + } // end switch + } // end for lay + return; } //_____________________________________________________________________________ void AliITSv5asymm::Init(){ //////////////////////////////////////////////////////////////////////// // Initialise the ITS after it has been created. //////////////////////////////////////////////////////////////////////// + Int_t i; + if(fDebug) { + cout << endl << ClassName() << ": "; + for(i=0;i<28;i++) cout << "*";cout << " ITSv5_Init "; + for(i=0;i<27;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 && !fGeomOldDetIn) fITSgeom->ReadNewFile(fRead); + if(fGeomDetIn && fGeomOldDetIn) this->ReadOldGeometry(fRead); + + if(!fGeomDetIn) this->InitAliITSgeom(); + if(fGeomDetOut) fITSgeom->WriteNewFile(fWrite); AliITS::Init(); - fMajorVersion = 5; - fMinorVersion = 0; +// + if(fDebug) { + cout << ClassName() << ": "; + for(i=0;i<72;i++) cout << "*"; + cout << endl; + } } //_____________________________________________________________________________ void AliITSv5asymm::StepManager(){ @@ -610,19 +839,6 @@ void AliITSv5asymm::StepManager(){ Int_t vol[4]; TLorentzVector position, momentum; TClonesArray &lhits = *fHits; -#if ALIITSPRINTGEOM==1 - FILE *fp; - Int_t i; - Float_t xl[3],xt[3],angl[6]; -// Float_t par[20],att[20]; - Float_t mat[9]; - static Bool_t first=kTRUE,printit[6][50][50]; - if(first){ for(copy1=0;copy1<6;copy1++)for(copy2=0;copy2<50;copy2++) - for(id=0;id<50;id++) printit[copy1][copy2][id] = kTRUE; - first = kFALSE; - } - // end if first -#endif // // Track status vol[3] = 0; @@ -706,74 +922,5 @@ void AliITSv5asymm::StepManager(){ hits[7]=gMC->TrackTime(); // Fill hit structure with this new hit. new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->CurrentTrack(),vol,hits); -#if ALIITSPRINTGEOM==1 - if(printit[vol[0]][vol[2]][vol[1]]){ - printit[vol[0]][vol[2]][vol[1]] = kFALSE; - xl[0] = xl[1] = xl[2] = 0.0; - gMC->Gdtom(xl,xt,1); - for(i=0;i<9;i++) mat[i] = 0.0; - mat[0] = mat[4] = mat[8] = 1.0; // default with identity matrix - xl[0] = 1.0; - xl[1] = xl[2] =0.0; - gMC->Gdtom(xl,&(mat[0]),2); - xl[1] = 1.0; - xl[0] = xl[2] =0.0; - gMC->Gdtom(xl,&(mat[3]),2); - xl[2] = 1.0; - xl[1] = xl[0] =0.0; - gMC->Gdtom(xl,&(mat[6]),2); - - angl[0] = TMath::ACos(mat[2]); - if(mat[2]==1.0) angl[0] = 0.0; - angl[1] = TMath::ATan2(mat[1],mat[0]); - if(angl[1]<0.0) angl[1] += 2.0*TMath::Pi(); - - angl[2] = TMath::ACos(mat[5]); - if(mat[5]==1.0) angl[2] = 0.0; - angl[3] = TMath::ATan2(mat[4],mat[3]); - if(angl[3]<0.0) angl[3] += 2.0*TMath::Pi(); - - angl[4] = TMath::ACos(mat[8]); - if(mat[8]==1.0) angl[4] = 0.0; - angl[5] = TMath::ATan2(mat[7],mat[6]); - if(angl[5]<0.0) angl[5] += 2.0*TMath::Pi(); - - for(i=0;i<6;i++) angl[i] *= 180.0/TMath::Pi(); // degrees - fp = fopen("ITSgeometry_v5.det","a"); - fprintf(fp,"%2d %2d %2d %9e %9e %9e %9e %9e %9e %9e %9e %9e ", - vol[0],vol[2],vol[1], // layer ladder detector - xt[0],xt[1],xt[2], // Translation vector - angl[0],angl[1],angl[2],angl[3],angl[4],angl[5] // Geant rotaion - // angles (degrees) - ); - fprintf(fp,"%9e %9e %9e %9e %9e %9e %9e %9e %9e", - mat[0],mat[1],mat[2],mat[3],mat[4],mat[5],mat[6],mat[7],mat[8] - ); // Adding the rotation matrix. - fprintf(fp,"\n"); - fclose(fp); - } // end if printit[layer][ladder][detector] -#endif return; } -/* -//____________________________________________________________________________ -void AliITSv5asymm::Streamer(TBuffer &R__b){ -//////////////////////////////////////////////////////////////////////// -// A dummy Streamer function for this class AliITSv5asymm. By default it -// only streams the AliITS class as it is required. Since this class -// dosen't contain any "real" data to be saved, it doesn't. -//////////////////////////////////////////////////////////////////////// - - if (R__b.IsReading()) { - Version_t R__v = R__b.ReadVersion(); - if (R__v==1) { - AliITS::Streamer(R__b); - }else{ - AliITS::Streamer(R__b); - } // end if R__v==1 - } else { - R__b.WriteVersion(AliITSv5asymm::IsA()); - AliITS::Streamer(R__b); - } // end if R__b.IsReading() -} -*/