From 023ae34bddd5e368420a6f37f069b61b7d98fa4a Mon Sep 17 00:00:00 2001 From: masera Date: Mon, 12 Jun 2006 17:04:55 +0000 Subject: [PATCH] Initialization of AliITSgeom from TGeo for the reconstruction pass. AliITSLoader used to store the pointer to AliITSgeom (simulation and reconstruction) --- ITS/AliITS.cxx | 42 +- ITS/AliITS.h | 10 +- ITS/AliITSDetTypeSim.cxx | 469 ++++++----- ITS/AliITSDetTypeSim.h | 39 +- ITS/AliITSInitGeometry.cxx | 899 +++++++++++++++++++++ ITS/AliITSInitGeometry.h | 70 ++ ITS/AliITSLoader.cxx | 20 + ITS/AliITSLoader.h | 2 +- ITS/AliITSReconstructor.cxx | 27 +- ITS/AliITSReconstructor.h | 3 +- ITS/AliITSgeom.cxx | 1429 +++++++++++++++++++-------------- ITS/AliITSgeom.h | 432 +++++----- ITS/AliITSgeomMatrix.cxx | 931 +++++++++++++++------ ITS/AliITSgeomMatrix.h | 54 +- ITS/AliITSgeomSDD.cxx | 81 +- ITS/AliITSgeomSDD.h | 29 +- ITS/AliITSgeomSPD.cxx | 100 ++- ITS/AliITSgeomSPD.h | 29 +- ITS/AliITSgeomSSD.cxx | 71 +- ITS/AliITSgeomSSD.h | 23 +- ITS/AliITSsegmentationSDD.h | 5 +- ITS/AliITSv11.cxx | 2 +- ITS/AliITSv11GeometrySDD.cxx | 2 +- ITS/AliITSvBeamTestITS04.cxx | 13 +- ITS/AliITSvPPRasymmFMD.cxx | 85 +- ITS/AliITSvPPRcoarseasymm.cxx | 2 +- ITS/AliITSvSDD03.cxx | 25 +- ITS/AliITSvSPD02.cxx | 10 +- ITS/AliITSvSSD03.cxx | 10 +- ITS/AliITSvtest.cxx | 8 +- ITS/ITSbaseLinkDef.h | 18 +- ITS/libITSbase.pkg | 3 +- 32 files changed, 3369 insertions(+), 1574 deletions(-) create mode 100644 ITS/AliITSInitGeometry.cxx create mode 100644 ITS/AliITSInitGeometry.h diff --git a/ITS/AliITS.cxx b/ITS/AliITS.cxx index 36df1727d56..9d729977539 100644 --- a/ITS/AliITS.cxx +++ b/ITS/AliITS.cxx @@ -146,6 +146,8 @@ AliITS::AliITS(const char *name, const char *title):AliDetector(name,title){ fDetTypeSim = new AliITSDetTypeSim(); SetMarkerColor(kRed); + if(!fLoader) MakeLoader(AliConfig::GetDefaultEventFolderName()); + fDetTypeSim->SetLoader((AliITSLoader*)fLoader); } //______________________________________________________________________ @@ -160,6 +162,7 @@ AliITS::~AliITS(){ // none. // Return: // none. + if (fHits) { fHits->Delete(); delete fHits; @@ -251,7 +254,7 @@ void AliITS::Init(){ //______________________________________________________________________ void AliITS::WriteGeometry(){ - //Writes ITS geomtry on gAlice + //Writes ITS geometry on gAlice if(!fLoader) MakeLoader(AliConfig::GetDefaultEventFolderName()); AliRunLoader* rl = fLoader->GetRunLoader(); @@ -270,7 +273,7 @@ void AliITS::SetDefaults(){ // none. // Return: // none. - AliInfoClass("Setting Defaults"); + AliInfoClass("AliITS::Setting Defaults"); if(!fDetTypeSim) { Error("SetDefaults()","fDetTypeSim is 0!"); @@ -363,7 +366,7 @@ void AliITS::MakeBranchD(const char* file){ Warning("MakeBranchD","fDetTypeSim is 0!"); return; } - fDetTypeSim->SetLoader(fLoader); + fDetTypeSim->SetLoader((AliITSLoader*)fLoader); MakeBranchInTreeD(fLoader->TreeD(),file); } @@ -374,7 +377,7 @@ void AliITS:: MakeBranchInTreeD(TTree* treeD, const char* file){ if(!fDetTypeSim){ Error("MakeBranchS","fDetTypeSim is 0!"); } - fDetTypeSim->SetLoader(fLoader); + fDetTypeSim->SetLoader((AliITSLoader*)fLoader); const Char_t *det[3] = {"SPD","SDD","SSD"}; Char_t* digclass; @@ -407,13 +410,13 @@ void AliITS::SetTreeAddress(){ // none. // Return: // none. - + if(!fDetTypeSim) { Error("SetTreeAddress","fDetTypeSim is 0!"); return; } - fDetTypeSim->SetLoader(fLoader); + fDetTypeSim->SetLoader((AliITSLoader*)fLoader); TTree *treeS = fLoader->TreeS(); TTree *treeD = fLoader->TreeD(); @@ -424,8 +427,6 @@ void AliITS::SetTreeAddress(){ fDetTypeSim->SetTreeAddressS(treeS, (Char_t*)GetName()); fDetTypeSim->SetTreeAddressD(treeD, (Char_t*)GetName()); - - } //______________________________________________________________________ void AliITS::AddHit(Int_t track, Int_t *vol, Float_t *hits){ @@ -608,7 +609,7 @@ void AliITS::Hits2SDigits(){ fLoader->LoadHits("read"); fLoader->LoadSDigits("recreate"); AliRunLoader* rl = fLoader->GetRunLoader(); - fDetTypeSim->SetLoader(fLoader); + fDetTypeSim->SetLoader((AliITSLoader*)fLoader); for (Int_t iEvent = 0; iEvent < rl->GetNumberOfEvents(); iEvent++) { // Do the Hits to Digits operation. Use Standard input values. // Event number from file, no background hit merging , use size from @@ -633,7 +634,7 @@ void AliITS::Hits2Digits(){ return; } - fDetTypeSim->SetLoader(fLoader); + fDetTypeSim->SetLoader((AliITSLoader*)fLoader); SetDefaults(); fLoader->LoadHits("read"); @@ -678,7 +679,7 @@ void AliITS::HitsToDigits(Int_t evNumber,Int_t bgrev,Int_t size, Error("HitsToDigits","fDetTypeSim is null!"); return; } - fDetTypeSim->SetLoader(fLoader); + fDetTypeSim->SetLoader((AliITSLoader*)fLoader); if(!GetITSgeom()) return; // need transformations to do digitization. AliITSgeom *geom = GetITSgeom(); @@ -729,7 +730,7 @@ void AliITS::Hits2PreDigits(){ return; } - fDetTypeSim->SetLoader(fLoader); + fDetTypeSim->SetLoader((AliITSLoader*)fLoader); SetDefaults(); HitsToPreDigits(fLoader->GetRunLoader()->GetEventNumber(), @@ -763,7 +764,7 @@ void AliITS::HitsToPreDigits(Int_t evNumber,Int_t bgrev,Int_t size, Error("HitsToPreDigits","fDetTypeSim is null!"); return; } - fDetTypeSim->SetLoader(fLoader); + fDetTypeSim->SetLoader((AliITSLoader*)fLoader); if(!GetITSgeom()){ Error("HitsToPreDigits","fGeom is null!"); @@ -866,8 +867,7 @@ void AliITS::HitsToFastRecPoints(Int_t evNumber,Int_t bgrev,Int_t size, TBranch* branch = (TBranch*)lTR->Branch("ITSRecPointsF",&ptarray); branch->SetAddress(&ptarray); //m.b. : this change is nothing but a nice way to make sure - //the CPU goes up ! - AliDebug(1,Form("N mod = %d",geom->GetIndexMax())); + //the CPU goes up ! for(module=0;moduleGetIndexMax();module++){ id = geom->GetModuleType(module); if (!all && !det[id]) continue; @@ -965,7 +965,7 @@ void AliITS::SDigitsToDigits(Option_t *opt){ return; } - fDetTypeSim->SetLoader(fLoader); + fDetTypeSim->SetLoader((AliITSLoader*)fLoader); SetDefaults(); fDetTypeSim->SDigitsToDigits(opt,(Char_t*)GetName()); @@ -1095,7 +1095,7 @@ void AliITS::Digits2Raw(){ Error("Digits2Raw","fDetTypeSim is 0!"); return; } - fDetTypeSim->SetLoader(fLoader); + fDetTypeSim->SetLoader((AliITSLoader*)fLoader); SetDefaults(); fDetTypeSim->GetLoader()->LoadDigits(); TTree* digits = fDetTypeSim->GetLoader()->TreeD(); @@ -1129,15 +1129,7 @@ void AliITS::Digits2Raw(){ rawWriter.RawDataSSD(digits->GetBranch("ITSDigitsSSD")); fLoader->UnloadDigits(); - - - - } - - - - //______________________________________________________________________ AliLoader* AliITS::MakeLoader(const char* topfoldername){ //builds ITSgetter (AliLoader type) diff --git a/ITS/AliITS.h b/ITS/AliITS.h index 14c6f326c54..6f8c11230c7 100644 --- a/ITS/AliITS.h +++ b/ITS/AliITS.h @@ -96,8 +96,8 @@ class AliITS : public AliDetector { //=================== Hits ========================================= virtual void StepManager() {} // See Step Manager for specific geometry. //------------ sort hits by module for Digitisation ---------------- - virtual void FillModules(Int_t evnt,Int_t bgrev,Int_t nmodules, Option_t *opt, const char *filename); - + virtual void FillModules(Int_t evnt,Int_t bgrev,Int_t nmodules, + Option_t *opt, const char *filename); virtual void InitModules(Int_t size,Int_t &nmodules); virtual void FillModules(TTree *treeH, Int_t mask = 0); virtual void ClearModules(){if(fITSmodules) fITSmodules->Delete();} @@ -128,13 +128,13 @@ class AliITS : public AliDetector { virtual void ResetDigits(Int_t branch); virtual void AddSumDigit(AliITSpListItem &sdig); virtual void AddRealDigit(Int_t branch, Int_t *digits); - - virtual void AddSimDigit(Int_t branch, AliITSdigit *d); + virtual void AddSimDigit(Int_t branch, AliITSdigit *d); virtual void AddSimDigit(Int_t branch,Float_t phys,Int_t* digits, Int_t* tracks,Int_t *hits,Float_t* trkcharges); TObjArray* GetDigits() const {return fDetTypeSim->GetDigits();} Int_t* GetNDigitArray() const {return fDetTypeSim->GetNDigitArray();} - TClonesArray *DigitsAddress(Int_t id) { return fDetTypeSim->DigitsAddress(id);} + TClonesArray *DigitsAddress(Int_t id) { + return fDetTypeSim->DigitsAddress(id);} //Fast simulation virtual void HitsToFastRecPoints(Int_t evNumber,Int_t bgrev,Int_t size, Option_t *add, Option_t *det, const char *filename); diff --git a/ITS/AliITSDetTypeSim.cxx b/ITS/AliITSDetTypeSim.cxx index 2b3371c7194..6b5b2b1a7fe 100644 --- a/ITS/AliITSDetTypeSim.cxx +++ b/ITS/AliITSDetTypeSim.cxx @@ -64,7 +64,6 @@ ClassImp(AliITSDetTypeSim) //---------------------------------------------------------------------- AliITSDetTypeSim::AliITSDetTypeSim(): TObject(), -fGeom(), // fSimulation(), // [NDet] fSegmentation(), // [NDet] fCalibration(), // [NMod] @@ -73,10 +72,13 @@ fPostProcess(), // [] e.g. Wright Raw data fNSDigits(0), //! number of SDigits fSDigits(), //! [NMod][NSDigits] fNDigits(0), //! number of Digits +fRunNumber(0), //! Run number (to access DB) fDigits(), //! [NMod][NDigits] fHitClassName(), // String with Hit class name. fSDigClassName(),// String with SDigit class name. -fDigClassName(){ // String with digit class name. +fDigClassName(), // String with digit class name. +fLoader(0), // local pointer to loader +fFirstcall(kTRUE){ // flag // Default Constructor // Inputs: // none. @@ -84,23 +86,17 @@ fDigClassName(){ // String with digit class name. // none. // Return: // A properly zero-ed AliITSDetTypeSim class. - fGeom = 0; + fSimulation = new TObjArray(fgkNdettypes); fSegmentation = new TObjArray(fgkNdettypes); fSegmentation->SetOwner(kTRUE); - fCalibration = 0; - fPreProcess = 0; - fPostProcess = 0; - fNSDigits = 0; fSDigits = new TClonesArray("AliITSpListItem",1000); fDigits = new TObjArray(fgkNdettypes); fNDigits = new Int_t[fgkNdettypes]; - fLoader = 0; fNMod[0] = fgkDefaultNModulesSPD; fNMod[1] = fgkDefaultNModulesSDD; fNMod[2] = fgkDefaultNModulesSSD; SetRunNumber(); - fFirstcall = kTRUE; } //---------------------------------------------------------------------- AliITSDetTypeSim::~AliITSDetTypeSim(){ @@ -111,85 +107,114 @@ AliITSDetTypeSim::~AliITSDetTypeSim(){ // none. // Return: // Nothing. - + if(fSimulation){ - fSimulation->Delete(); - delete fSimulation; - fSimulation = 0; + fSimulation->Delete(); + delete fSimulation; } - + fSimulation = 0; if(fSegmentation){ - fSegmentation->Delete(); - delete fSegmentation; - fSegmentation = 0; + fSegmentation->Delete(); + delete fSegmentation; } - + fSegmentation = 0; if(fCalibration && fRunNumber<0){ - AliITSresponse* rspd = ((AliITSCalibration*)fCalibration->At(fGeom->GetStartSPD()))->GetResponse(); - AliITSresponse* rsdd = ((AliITSCalibration*)fCalibration->At(fGeom->GetStartSDD()))->GetResponse(); - AliITSresponse* rssd = ((AliITSCalibration*)fCalibration->At(fGeom->GetStartSSD()))->GetResponse(); - if(rspd) delete rspd; - if(rsdd) delete rsdd; - if(rssd) delete rssd; - fCalibration->Delete(); - delete fCalibration; - fCalibration = 0; + AliITSresponse* rspd = ((AliITSCalibration*)fCalibration->At( + GetITSgeom()->GetStartSPD()))->GetResponse(); + AliITSresponse* rsdd = ((AliITSCalibration*)fCalibration->At( + GetITSgeom()->GetStartSDD()))->GetResponse(); + AliITSresponse* rssd = ((AliITSCalibration*)fCalibration->At( + GetITSgeom()->GetStartSSD()))->GetResponse(); + if(rspd) delete rspd; + if(rsdd) delete rsdd; + if(rssd) delete rssd; + fCalibration->Delete(); + delete fCalibration; } - - if(fGeom) delete fGeom; - + fCalibration = 0; if(fPreProcess){ - fPreProcess->Delete(); - delete fPreProcess; - fPreProcess = 0; + fPreProcess->Delete(); + delete fPreProcess; } - + fPreProcess = 0; if(fPostProcess){ - fPostProcess->Delete(); - delete fPostProcess; - fPostProcess = 0; + fPostProcess->Delete(); + delete fPostProcess; } - + fPostProcess = 0; if(fNDigits) delete [] fNDigits; - - if (fLoader) - { - fLoader->GetModulesFolder()->Remove(this); - } - + fNDigits = 0; + if (fLoader)fLoader->GetModulesFolder()->Remove(this); + fLoader = 0; // Not deleting it. if (fSDigits) { - fSDigits->Delete(); - delete fSDigits; - fSDigits=0; + fSDigits->Delete(); + delete fSDigits; } + fSDigits=0; if (fDigits) { fDigits->Delete(); delete fDigits; - fDigits=0; } - + fDigits=0; } //---------------------------------------------------------------------- AliITSDetTypeSim::AliITSDetTypeSim(const AliITSDetTypeSim &source) : TObject(source){ // Copy Constructor for object AliITSDetTypeSim not allowed - if(this==&source) return; - Error("Copy constructor", - "You are not allowed to make a copy of the AliITSDetTypeSim"); - exit(1); - + if(this==&source) return; + Error("Copy constructor", + "You are not allowed to make a copy of the AliITSDetTypeSim"); + exit(1); } //---------------------------------------------------------------------- AliITSDetTypeSim& AliITSDetTypeSim::operator=(const AliITSDetTypeSim &source){ // The = operator for object AliITSDetTypeSim if(&source==this) return *this; - Error("operator=","You are not allowed to make a copy of the AliITSDetTypeSIm"); + Error("operator=", + "You are not allowed to make a copy of the AliITSDetTypeSIm"); exit(1); return *this; } - +//______________________________________________________________________ +void AliITSDetTypeSim::SetITSgeom(AliITSgeom *geom){ + // Sets/replaces the existing AliITSgeom object kept in AliITSLoader + // + // Inputs: + // AliITSgoem *geom The AliITSgeom object to be used. + // Output: + // none. + // Return: + // none. + if(!fLoader){ + Error("SetITSgeom","No pointer to loader - nothing done"); + return; + } + else { + fLoader->SetITSgeom(geom); // protections in AliITSLoader::SetITSgeom + } + +} +//______________________________________________________________________ +void AliITSDetTypeSim::SetLoader(AliITSLoader *loader){ + // Sets the local copy of the AliITSLoader, and passes on the + // AliITSgeom object as needed. + // Inputs + // AliITSLoader *loader pointer to AliITSLoader for local use + // Outputs: + // none. + // Return: + // none. + + if(fLoader==loader) return; // Same do nothing + if(fLoader){ // alread have an existing loader + Error("SetLoader", + "Already have an exisiting loader ptr=%p Nothing done", + fLoader); + } // end if + fLoader = loader; +} //______________________________________________________________________ void AliITSDetTypeSim::SetSimulationModel(Int_t dettype,AliITSsimulation *sim){ @@ -212,37 +237,38 @@ AliITSsimulation* AliITSDetTypeSim::GetSimulationModel(Int_t dettype){ AliITSsimulation* AliITSDetTypeSim::GetSimulationModelByModule(Int_t module){ //Get simulation model by module number - if(fGeom==0) { - Warning("GetSimulationModelByModule","fGeom is 0!"); + if(GetITSgeom()==0) { + Warning("GetSimulationModelByModule","GetITSgeom() is 0!"); return 0; } - return GetSimulationModel(fGeom->GetModuleType(module)); + return GetSimulationModel(GetITSgeom()->GetModuleType(module)); } //_______________________________________________________________________ void AliITSDetTypeSim::SetDefaultSegmentation(Int_t idet){ - // Set default segmentation model objects - AliITSsegmentation *seg; - if(fSegmentation==0x0){ - fSegmentation = new TObjArray(fgkNdettypes); - fSegmentation->SetOwner(kTRUE); - } - if(GetSegmentationModel(idet))delete (AliITSsegmentation*)fSegmentation->At(idet); - if(idet==0){ - seg = new AliITSsegmentationSPD(fGeom); - } - else if(idet==1){ - AliITSCalibration* res = GetCalibrationModel(fGeom->GetStartSDD()); - seg = new AliITSsegmentationSDD(fGeom,res); - } - else { - seg = new AliITSsegmentationSSD(fGeom); - } - SetSegmentationModel(idet,seg); -} + // Set default segmentation model objects + AliITSsegmentation *seg; + if(fSegmentation==0x0){ + fSegmentation = new TObjArray(fgkNdettypes); + fSegmentation->SetOwner(kTRUE); + } + if(GetSegmentationModel(idet)) + delete (AliITSsegmentation*)fSegmentation->At(idet); + if(idet==0){ + seg = new AliITSsegmentationSPD(GetITSgeom()); + }else if(idet==1){ + AliITSCalibration* res=GetCalibrationModel( + GetITSgeom()->GetStartSDD()); + seg = new AliITSsegmentationSDD(GetITSgeom(),res); + }else { + seg = new AliITSsegmentationSSD(GetITSgeom()); + } + SetSegmentationModel(idet,seg); +} //______________________________________________________________________ -void AliITSDetTypeSim::SetSegmentationModel(Int_t dettype,AliITSsegmentation *seg){ +void AliITSDetTypeSim::SetSegmentationModel(Int_t dettype, + AliITSsegmentation *seg){ //Set segmentation model for detector type if(fSegmentation==0x0){ @@ -250,152 +276,136 @@ void AliITSDetTypeSim::SetSegmentationModel(Int_t dettype,AliITSsegmentation *se fSegmentation->SetOwner(kTRUE); } fSegmentation->AddAt(seg,dettype); - } //______________________________________________________________________ AliITSsegmentation* AliITSDetTypeSim::GetSegmentationModel(Int_t dettype){ - //Get segmentation model for detector type if(fSegmentation==0) { - Warning("GetSegmentationModel","fSegmentation is 0!"); - return 0; + Warning("GetSegmentationModel","fSegmentation is 0!"); + return 0; } return (AliITSsegmentation*)(fSegmentation->At(dettype)); - } //_______________________________________________________________________ AliITSsegmentation* AliITSDetTypeSim::GetSegmentationModelByModule(Int_t module){ - - //Get segmentation model by module number - if(fGeom==0){ - Warning("GetSegmentationModelByModule","fGeom is 0!"); - return 0; - } - return GetSegmentationModel(fGeom->GetModuleType(module)); - + //Get segmentation model by module number + if(GetITSgeom()==0){ + Warning("GetSegmentationModelByModule","GetITSgeom() is 0!"); + return 0; + } + return GetSegmentationModel(GetITSgeom()->GetModuleType(module)); } //_______________________________________________________________________ void AliITSDetTypeSim::CreateCalibrationArray() { + //Create the container of calibration functions with correct size + if (fCalibration) { + Warning("CreateCalibration","pointer to calibration object exists\n"); + fCalibration->Delete(); + delete fCalibration; + } - //Create the container of calibration functions with correct size - if (fCalibration) { - Warning("CreateCalibration","pointer to calibration object exists\n"); - fCalibration->Delete(); - delete fCalibration; - } - - Int_t nModTot = fGeom->GetIndexMax(); - fCalibration = new TObjArray(nModTot); - fCalibration->SetOwner(kTRUE); - fCalibration->Clear(); - + Int_t nModTot = GetITSgeom()->GetIndexMax(); + fCalibration = new TObjArray(nModTot); + fCalibration->SetOwner(kTRUE); + fCalibration->Clear(); } //_______________________________________________________________________ void AliITSDetTypeSim::SetCalibrationModel(Int_t iMod, AliITSCalibration *resp){ + //Set response model for modules - //Set response model for modules - - if (fCalibration==0) CreateCalibrationArray(); + if (fCalibration==0) CreateCalibrationArray(); - if (fCalibration->At(iMod)!=0) - delete (AliITSCalibration*) fCalibration->At(iMod); - fCalibration->AddAt(resp, iMod); - + if (fCalibration->At(iMod)!=0) + delete (AliITSCalibration*) fCalibration->At(iMod); + fCalibration->AddAt(resp, iMod); } - //______________________________________________________________________ void AliITSDetTypeSim::ResetCalibrationArray(){ - - //resets response array - if(fCalibration && fRunNumber<0){ // if fRunNumber<0 fCalibration is owner - AliITSresponse* rspd = ((AliITSCalibration*)fCalibration->At(fGeom->GetStartSPD()))->GetResponse(); - AliITSresponse* rsdd = ((AliITSCalibration*)fCalibration->At(fGeom->GetStartSDD()))->GetResponse(); - AliITSresponse* rssd = ((AliITSCalibration*)fCalibration->At(fGeom->GetStartSSD()))->GetResponse(); - if(rspd) delete rspd; - if(rsdd) delete rsdd; - if(rssd) delete rssd; - fCalibration->Clear(); - } - else if (fCalibration && fRunNumber>=0){ - fCalibration->Clear(); - } + //resets response array + if(fCalibration && fRunNumber<0){ // if fRunNumber<0 fCalibration is owner + AliITSresponse* rspd = ((AliITSCalibration*)fCalibration->At( + GetITSgeom()->GetStartSPD()))->GetResponse(); + AliITSresponse* rsdd = ((AliITSCalibration*)fCalibration->At( + GetITSgeom()->GetStartSDD()))->GetResponse(); + AliITSresponse* rssd = ((AliITSCalibration*)fCalibration->At( + GetITSgeom()->GetStartSSD()))->GetResponse(); + if(rspd) delete rspd; + if(rsdd) delete rsdd; + if(rssd) delete rssd; + fCalibration->Clear(); + }else if (fCalibration && fRunNumber>=0){ + fCalibration->Clear(); + } } //______________________________________________________________________ void AliITSDetTypeSim::ResetSegmentation(){ - - //Resets segmentation array - if(fSegmentation) fSegmentation->Clear(); + //Resets segmentation array + if(fSegmentation) fSegmentation->Clear(); } - //_______________________________________________________________________ AliITSCalibration* AliITSDetTypeSim::GetCalibrationModel(Int_t iMod){ - //Get response model for module number iMod + //Get response model for module number iMod - if(fCalibration==0) { - AliError("fCalibration is 0!"); - return 0; - } - + if(fCalibration==0) { + AliError("fCalibration is 0!"); + return 0; + } return (AliITSCalibration*)(fCalibration->At(iMod)); - } //_______________________________________________________________________ void AliITSDetTypeSim::SetDefaults(){ - - //Set defaults for segmentation and response - - if(fGeom==0){ - Warning("SetDefaults","fGeom is 0!"); - return; - } - if (fCalibration==0) { - CreateCalibrationArray(); - } - - ResetSegmentation(); - if(!GetCalibration()){AliFatal("Exit"); exit(0);} - - for(Int_t idet=0;idetGetStartSPD()))->DataType(); - if (strstr(kData0,"real")) { - SetDigitClassName(idet,"AliITSdigit"); - } - else { - SetDigitClassName(idet,"AliITSdigitSPD"); - } - } - //SDD - if(idet==1){ - if(!GetSegmentationModel(idet)) SetDefaultSegmentation(idet); - AliITSCalibrationSDD* rsp = (AliITSCalibrationSDD*)GetCalibrationModel(fGeom->GetStartSDD()); - const char *kopt = ((AliITSresponseSDD*)rsp->GetResponse())->ZeroSuppOption(); - if((!strstr(kopt,"2D"))&&(!strstr(kopt,"1D"))) { - SetDigitClassName(idet,"AliITSdigit"); - } - else { - SetDigitClassName(idet,"AliITSdigitSDD"); - } - - } - //SSD - if(idet==2){ - if(!GetSegmentationModel(idet))SetDefaultSegmentation(idet); - - const char *kData2 = (GetCalibrationModel(fGeom->GetStartSSD())->DataType()); - if (strstr(kData2,"real")) { - SetDigitClassName(idet,"AliITSdigit"); - } - else { - SetDigitClassName(idet,"AliITSdigitSSD"); - } - } - } + //Set defaults for segmentation and response + + if(GetITSgeom()==0){ + Warning("SetDefaults","GetITSgeom() is 0!"); + return; + } // end if + if (fCalibration==0) { + CreateCalibrationArray(); + } // end if + + ResetSegmentation(); + if(!GetCalibration()){AliFatal("Exit"); exit(0);} + + for(Int_t idet=0;idetGetStartSPD()))->DataType(); + if (strstr(kData0,"real")) { + SetDigitClassName(idet,"AliITSdigit"); + }else { + SetDigitClassName(idet,"AliITSdigitSPD"); + } // end if + } // end if idet==0 + //SDD + if(idet==1){ + if(!GetSegmentationModel(idet)) SetDefaultSegmentation(idet); + AliITSCalibrationSDD* rsp = + (AliITSCalibrationSDD*)GetCalibrationModel( + GetITSgeom()->GetStartSDD()); + const char *kopt = ((AliITSresponseSDD*)rsp->GetResponse())-> + ZeroSuppOption(); + if((!strstr(kopt,"2D"))&&(!strstr(kopt,"1D"))) { + SetDigitClassName(idet,"AliITSdigit"); + }else { + SetDigitClassName(idet,"AliITSdigitSDD"); + } // end if + } // end if idet==1 + //SSD + if(idet==2){ + if(!GetSegmentationModel(idet))SetDefaultSegmentation(idet); + const char *kData2 = (GetCalibrationModel( + GetITSgeom()->GetStartSSD())->DataType()); + if (strstr(kData2,"real")) { + SetDigitClassName(idet,"AliITSdigit"); + }else { + SetDigitClassName(idet,"AliITSdigitSSD"); + } // end if + } // end if idet==2 + }// end for idet } - //______________________________________________________________________ Bool_t AliITSDetTypeSim::GetCalibration() { // Get Default calibration if a storage is not defined. @@ -514,19 +524,14 @@ Bool_t AliITSDetTypeSim::GetCalibration() { Int_t iMod = i + fNMod[0] + fNMod[1]; SetCalibrationModel(iMod, cal); } - return kTRUE; } - - - //_______________________________________________________________________ void AliITSDetTypeSim::SetDefaultSimulation(){ - //Set default simulation for detector type - if(fGeom==0){ - Warning("SetDefaultSimulation","fGeom is 0!"); + if(GetITSgeom()==0){ + Warning("SetDefaultSimulation","GetITSgeom() is 0!"); return; } if(fCalibration==0){ @@ -536,22 +541,17 @@ void AliITSDetTypeSim::SetDefaultSimulation(){ if(fSegmentation==0){ Warning("SetDefaultSimulation","fSegmentation is 0!"); for(Int_t i=0;iGetBranch(name); Int_t id; - for(Int_t module=0;moduleGetIndexMax();module++){ - id = fGeom->GetModuleType(module); + for(Int_t module=0;moduleGetIndexMax();module++){ + id = GetITSgeom()->GetModuleType(module); if (!all && !det[id]) continue; sim = (AliITSsimulation*)GetSimulationModel(id); - printf("module=%d name=%s\n",module,sim->ClassName()); if(!sim){ Error("SDigit2Digits","The simulation class was not " "instanciated for module %d type %s!",module, - fGeom->GetModuleTypeName(module)); + GetITSgeom()->GetModuleTypeName(module)); exit(1); } sim->InitSimulationModule(module,gAlice->GetEvNumber()); @@ -716,26 +707,24 @@ void AliITSDetTypeSim::SDigitsToDigits(Option_t* opt, Char_t* name){ fLoader->TreeD()->AutoSave(); fLoader->TreeD()->Reset(); } - - - //_________________________________________________________ -void AliITSDetTypeSim::AddSumDigit(AliITSpListItem &sdig){ - +void AliITSDetTypeSim::AddSumDigit(AliITSpListItem &sdig){ //Adds the module full of summable digits to the summable digits tree. + TClonesArray &lsdig = *fSDigits; new(lsdig[fNSDigits++]) AliITSpListItem(sdig); } //__________________________________________________________ void AliITSDetTypeSim::AddRealDigit(Int_t branch, Int_t *digits){ // Add a real digit - as coming from data. + TClonesArray &ldigits = *((TClonesArray*)fDigits->At(branch)); new(ldigits[fNDigits[branch]++]) AliITSdigit(digits); } //__________________________________________________________ -void AliITSDetTypeSim::AddSimDigit(Int_t branch, AliITSdigit* d){ - +void AliITSDetTypeSim::AddSimDigit(Int_t branch, AliITSdigit* d){ // Add a simulated digit. + TClonesArray &ldigits = *((TClonesArray*)fDigits->At(branch)); switch(branch){ case 0: @@ -747,10 +736,8 @@ void AliITSDetTypeSim::AddSimDigit(Int_t branch, AliITSdigit* d){ case 2: new(ldigits[fNDigits[branch]++]) AliITSdigitSSD(*((AliITSdigitSSD*)d)); break; - } - + } } - //______________________________________________________________________ void AliITSDetTypeSim::AddSimDigit(Int_t branch,Float_t phys,Int_t *digits, Int_t *tracks,Int_t *hits,Float_t *charges){ @@ -763,7 +750,8 @@ void AliITSDetTypeSim::AddSimDigit(Int_t branch,Float_t phys,Int_t *digits, new(ldigits[fNDigits[branch]++]) AliITSdigitSPD(digits,tracks,hits); break; case 1: - resp = (AliITSCalibrationSDD*)GetCalibrationModel(fGeom->GetStartSDD()); + resp = (AliITSCalibrationSDD*)GetCalibrationModel( + GetITSgeom()->GetStartSDD()); new(ldigits[fNDigits[branch]++]) AliITSdigitSDD(phys,digits,tracks, hits,charges,resp); break; @@ -772,14 +760,10 @@ void AliITSDetTypeSim::AddSimDigit(Int_t branch,Float_t phys,Int_t *digits, break; } } - - - //______________________________________________________________________ -void AliITSDetTypeSim::StoreCalibration(Int_t firstRun, Int_t lastRun, AliCDBMetaData &md) { - +void AliITSDetTypeSim::StoreCalibration(Int_t firstRun, Int_t lastRun, + AliCDBMetaData &md) { // Store calibration in the calibration database - // The database must be created in an external piece of code (i.e. // a configuration macro ) @@ -822,9 +806,6 @@ void AliITSDetTypeSim::StoreCalibration(Int_t firstRun, Int_t lastRun, AliCDBMet AliCDBManager::Instance()->Put(&respSPD, idRespSPD, &md); AliCDBManager::Instance()->Put(&respSDD, idRespSDD, &md); AliCDBManager::Instance()->Put(&respSSD, idRespSSD, &md); - - - } diff --git a/ITS/AliITSDetTypeSim.h b/ITS/AliITSDetTypeSim.h index 7d1d11ec7ab..daa05c689c2 100644 --- a/ITS/AliITSDetTypeSim.h +++ b/ITS/AliITSDetTypeSim.h @@ -16,6 +16,7 @@ $Id$ #include #include #include "AliITSCalibration.h" +#include "AliITSLoader.h" #include "AliITSgeom.h" class TTree; @@ -26,7 +27,6 @@ class AliITSpListItem; class AliITSsimulation; class AliITSsegmentation; class AliITSresponse; -class AliLoader; class AliITSDetTypeSim : public TObject { public: @@ -35,8 +35,10 @@ class AliITSDetTypeSim : public TObject { virtual ~AliITSDetTypeSim(); AliITSDetTypeSim(const AliITSDetTypeSim &source); AliITSDetTypeSim& operator=(const AliITSDetTypeSim &source); - AliITSgeom *GetITSgeom() const {return fGeom;} - void SetITSgeom(AliITSgeom *geom){fGeom=geom;} + AliITSgeom *GetITSgeom() const { + if(fLoader)return ((AliITSLoader*)fLoader)->GetITSgeom(); + else return 0;} + void SetITSgeom(AliITSgeom *geom); virtual void SetSimulationModel(Int_t dettype,AliITSsimulation *sim); virtual AliITSsimulation* GetSimulationModel(Int_t dettype); @@ -48,15 +50,16 @@ class AliITSDetTypeSim : public TObject { virtual void SetCalibrationModel(Int_t iMod,AliITSCalibration *resp); virtual AliITSCalibration* GetCalibrationModel(Int_t iMod); - virtual AliITSresponse* GetResponse(Int_t dettype) {return GetCalibrationModel(GetITSgeom()->GetStartDet(dettype))->GetResponse();} - + virtual AliITSresponse* GetResponse(Int_t dettype) { + return GetCalibrationModel( + GetITSgeom()->GetStartDet(dettype))->GetResponse();} TObjArray* GetCalibrationArray() const {return fCalibration;} TObjArray* GetSegmentation() const {return fSegmentation;} void ResetCalibrationArray(); void ResetSegmentation(); - virtual void SetLoader(AliLoader* loader) {fLoader=loader;} - AliLoader* GetLoader() const {return fLoader;} + virtual void SetLoader(AliITSLoader* loader); + AliITSLoader* GetLoader() const {return fLoader;} virtual void SetDefaults(); virtual void SetDefaultSimulation(); @@ -70,8 +73,8 @@ class AliITSDetTypeSim : public TObject { TClonesArray* GetSDigits() const {return fSDigits;} TObjArray* GetDigits() const {return fDigits;} Int_t* GetNDigitArray() const {return fNDigits;} - TClonesArray *DigitsAddress(Int_t id) const { return ((TClonesArray*)(*fDigits)[id]);} - + TClonesArray *DigitsAddress(Int_t id) const { + return ((TClonesArray*)(*fDigits)[id]);} virtual void ResetSDigits(){fNSDigits=0;if(fSDigits!=0) fSDigits->Clear();} virtual void ResetDigits(); virtual void ResetDigits(Int_t branch); @@ -82,19 +85,16 @@ class AliITSDetTypeSim : public TObject { virtual void AddSimDigit(Int_t branch, AliITSdigit *d); virtual void AddSimDigit(Int_t branch,Float_t phys,Int_t* digits, Int_t* tracks,Int_t *hits,Float_t* trkcharges); - - virtual void SetDigitClassName(Int_t i, Char_t* name) {fDigClassName[i]=name;} + virtual void SetDigitClassName(Int_t i, Char_t* name) { + fDigClassName[i]=name;} Char_t* GetDigitClassName(Int_t i) const {return fDigClassName[i];} - void StoreCalibration(Int_t firstRun, Int_t lastRun, AliCDBMetaData &md); protected: - virtual void CreateCalibrationArray(); virtual Bool_t GetCalibration(); private: - void SetDefaultSegmentation(Int_t idet); // creates def segm. static const Int_t fgkNdettypes; // number of different det. types static const Int_t fgkDefaultNModulesSPD; // Total numbers of SPD modules by default @@ -102,7 +102,6 @@ class AliITSDetTypeSim : public TObject { static const Int_t fgkDefaultNModulesSSD; // Total numbers of SSD modules by default Int_t fNMod[3]; // numbers of modules from different types - AliITSgeom *fGeom; // pointer to ITS geom TObjArray *fSimulation; //! [NDet] TObjArray *fSegmentation; //! [NDet] TObjArray *fCalibration; //! [NMod] @@ -111,15 +110,15 @@ class AliITSDetTypeSim : public TObject { Int_t fNSDigits; //! number of SDigits TClonesArray *fSDigits; //! [NMod][NSDigits] Int_t* fNDigits; //! [NDet] number of Digits for det. - Int_t fRunNumber; //! run number (to access DB) - TObjArray *fDigits; //! [NMod][NDigits] + Int_t fRunNumber; //! run number (to access DB) + TObjArray *fDigits; //! [NMod][NDigits] TString fHitClassName; //! String with Hit class name TString fSDigClassName;//! String with SDigit class name. Char_t* fDigClassName[3]; //! String with digit class name. - AliLoader* fLoader; //! loader - Bool_t fFirstcall; //! flag + AliITSLoader* fLoader; //! loader + Bool_t fFirstcall; //! flag - ClassDef(AliITSDetTypeSim,4) // ITS Simulation structure + ClassDef(AliITSDetTypeSim,5) // ITS Simulation structure }; diff --git a/ITS/AliITSInitGeometry.cxx b/ITS/AliITSInitGeometry.cxx new file mode 100644 index 00000000000..124faee9f46 --- /dev/null +++ b/ITS/AliITSInitGeometry.cxx @@ -0,0 +1,899 @@ +/************************************************************************** + * 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. * + **************************************************************************/ + +/* +$Id$ +*/ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include "AliITSgeom.h" +#include "AliITSInitGeometry.h" + +ClassImp(AliITSInitGeometry) +//______________________________________________________________________ +AliITSInitGeometry::AliITSInitGeometry(): +TObject(), +fName(), +fMinorVersion(0), +fMajorVersion(0), +fTiming(kFALSE), +fSegGeom(kFALSE), +fDecode(kFALSE){ + // Default Creator + // Inputs: + // none. + // Outputs: + // none. + // Return: + // A default inilized AliITSInitGeometry object +} +//______________________________________________________________________ +AliITSInitGeometry::AliITSInitGeometry(const Char_t *name,Int_t minorversion): +TObject(), +fName(name), +fMinorVersion(minorversion), +fMajorVersion(0), +fTiming(kFALSE), +fSegGeom(kFALSE), +fDecode(kFALSE){ + // Default Creator + // Inputs: + // none. + // Outputs: + // none. + // Return: + // A default inilized AliITSInitGeometry object + + if(fName.CompareTo("AliITSvPPRasymmFMD")==0)if(fMinorVersion==1|| + fMinorVersion==2){ + fMajorVersion=10; + return; + } // end if + // if not defined geometry error + Error("AliITSInitGeometry(name,version)"," Name must be AliITSvPPRasymmFMD" + " and version must be 1 or 2 for now."); + fMinorVersion = 0; + fName = ""; + return; +} +//______________________________________________________________________ +AliITSgeom* AliITSInitGeometry::CreateAliITSgeom(){ + // Creates and Initilizes the geometry transformation class AliITSgeom + // to values appropreate to this specific geometry. Now that + // the segmentation is part of AliITSgeom, the detector + // segmentations are also defined here. + // Inputs: + // none. + // Outputs: + // none. + // Return: + // A pointer to a new properly inilized AliITSgeom class. If + // pointer = 0 then failed to init. + + AliITSgeom *geom = new AliITSgeom(); + if(!InitAliITSgeom(geom)){ // Error initilization failed + delete geom; + geom = 0; + } // end if + return geom; +} +//______________________________________________________________________ +Bool_t AliITSInitGeometry::InitAliITSgeom(AliITSgeom *geom){ + // Initilizes the geometry transformation class AliITSgeom + // to values appropreate to this specific geometry. Now that + // the segmentation is part of AliITSgeom, the detector + // segmentations are also defined here. + // Inputs: + // AliITSgeom *geom A pointer to the AliITSgeom class + // Outputs: + // AliITSgeom *geom This pointer recreated and properly inilized. + // Return: + // none. + + switch(fMajorVersion){ + case 10:{ // only case defined so far + return InitAliITSgeomPPRasymmFMD(geom); + }break; // end case + default:{ + Error("InitAliITSgeom","Undefine geomtery"); + return kFALSE; + } break; // end case + } // end switch + return kFALSE; +} +//______________________________________________________________________ +Bool_t AliITSInitGeometry::InitAliITSgeomPPRasymmFMD(AliITSgeom *geom){ + // Initilizes the geometry transformation class AliITSgeom + // to values appropreate to this specific geometry. Now that + // the segmentation is part of AliITSgeom, the detector + // segmentations are also defined here. + // Inputs: + // AliITSgeom *geom A pointer to the AliITSgeom class + // Outputs: + // AliITSgeom *geom This pointer recreated and properly inilized. + // Return: + // none. + // const Double_t kcm2micron = 1.0E4; + const Int_t kItype=0; // Type of transormation defined 0=> Geant + const Int_t klayers = 6; // number of layers in the ITS + const Int_t kladders[klayers] = {20,40,14,22,34,38}; // Number of ladders + const Int_t kdetectors[klayers] = {4,4,6,8,22,25};// number of detector/lad + const AliITSDetector idet[6] = {kSPD,kSPD,kSDD,kSDD,kSSD,kSSD}; + const TString pathbase = "/ALIC_1/ITSV_1/ITSD_1/"; + const TString names[2][klayers] = { + {"%sIT12_1/I12A_%d/I10A_%d/I103_%d/I101_1/ITS1_1", // lay=1 + "%sIT12_1/I12A_%d/I20A_%d/I1D3_%d/I1D1_1/ITS2_1", // lay=2 + "%sIT34_1/I004_%d/I302_%d/ITS3_%d/", // lay=3 + "%sIT34_1/I005_%d/I402_%d/ITS4_%d/", // lay=4 + "%sIT56_1/I565_%d/I562_%d/ITS5_%d/", // lay=5 + "%sIT56_1/I569_%d/I566_%d/ITS6_%d/"},// lay=6 + {"%sIT12_1/I12B_%d/I10B_%d/I107_%d/I101_1/ITS1_1", // lay=1 + "%sIT12_1/I12B_%d/I20B_%d/I1D7_%d/I1D1_1/ITS2_1", // lay=2 + "%sIT34_1/I004_%d/I302_%d/ITS3_%d", // lay=3 + "%sIT34_1/I005_%d/I402_%d/ITS4_%d", // lay=4 + "%sIT56_1/I565_%d/I562_%d/ITS5_%d", // lay=5 + "%sIT56_1/I569_%d/I566_%d/ITS6_%d"}};// Lay=6 + /* + Int_t itsGeomTreeCopys[knlayers][3]= {{10, 2, 4},// lay=1 + {10, 4, 4},// lay=2 + {14, 6, 1},// lay=3 + {22, 8, 1},// lay=4 + {34,22, 1},// lay=5 + {38,25, 1}};//lay=6 + */ + Int_t mod,nmods=0,lay,lad,det,cpn0,cpn1,cpn2; + Double_t tran[3]={0.0,0.0,0.0},rot[10]={9*0.0,1.0}; + TArrayD shapePar; + TString path,shapeName; + TGeoHMatrix materix; + Bool_t initSeg[3]={kFALSE,kFALSE,kFALSE}; + TStopwatch *time;if(fTiming) time=new TStopwatch(); + + if(fTiming) time->Start(); + for(mod=0;modInit(kItype,klayers,kladders,kdetectors,nmods); + for(mod=0;modCreateMatrix(mod,lay,lad,det,idet[lay-1],tran,rot); + RecodeDetector(mod,cpn0,cpn1,cpn2); // Write reusing lay,lad,det. + path.Form(names[fMinorVersion-1][lay-1].Data(), + pathbase.Data(),cpn0,cpn1,cpn2); + geom->GetGeomMatrix(mod)->SetPath(path); + GetTransformation(path.Data(),materix); + geom->SetTrans(mod,materix.GetTranslation()); + geom->SetRotMatrix(mod,materix.GetRotationMatrix()); + if(initSeg[idet[lay-1]]) continue; + GetShape(path,shapeName,shapePar); + if(shapeName.CompareTo("BOX")){ + Error("InitITSgeom","Geometry changed without proper code update" + "or error in reading geometry. Shape is not BOX."); + return kFALSE; + } // end if + InitGeomShapePPRasymmFMD(idet[lay-1],initSeg,shapePar,geom); + } // end for module + if(fTiming){ + time->Stop(); + time->Print(); + delete time; + } // end if + return kTRUE; +} +//______________________________________________________________________ +Bool_t AliITSInitGeometry::InitGeomShapePPRasymmFMD(AliITSDetector idet, + Bool_t *initSeg, + TArrayD &shapePar, + AliITSgeom *geom){ + // Initilizes the geometry segmentation class AliITSgeomS?D, or + // AliITSsegmentationS?D depending on the vaule of fSegGeom, + // to values appropreate to this specific geometry. Now that + // the segmentation is part of AliITSgeom, the detector + // segmentations are also defined here. + // Inputs: + // Int_t lay The layer number/name. + // AliITSgeom *geom A pointer to the AliITSgeom class + // Outputs: + // AliITSgeom *geom This pointer recreated and properly inilized. + // Return: + // none. + // const Double_t kcm2micron = 1.0E4; + const Double_t kmicron2cm = 1.0E-4; + Int_t i; + TArrayF shapeParF; + + shapeParF.Set(shapePar.GetSize()); + for(i=0;iReSetBins(shapeParF[1],256,bx,160,bz); + geom->ReSetShape(idet,geomSPD); + }break; + case kSDD:{ + initSeg[idet] = kTRUE; + AliITSgeomSDD *geomSDD = new AliITSgeomSDD256(shapeParF.GetSize(), + shapeParF.GetArray()); + geom->ReSetShape(idet,geomSDD); + }break; + case kSSD:{ + initSeg[idet] = kTRUE; + AliITSgeomSSD *geomSSD = new AliITSgeomSSD275and75( + shapeParF.GetSize(),shapeParF.GetArray()); + geom->ReSetShape(idet,geomSSD); + }break; + default:{// Others, Note no kSDDp or kSSDp in this geometry. + geom->ReSetShape(idet,0); + Info("InitGeomShapePPRasymmFMD", + "default Dx=%f Dy=%f Dz=%f default=%d", + shapePar[0],shapePar[1],shapePar[2],idet); + }break; + } // end switch + return kTRUE; +} +//______________________________________________________________________ +Bool_t AliITSInitGeometry::InitSegmentationPPRasymmFMD(AliITSDetector idet, + Bool_t *initSeg, + TArrayD &shapePar, + AliITSgeom *geom){ + // Initilizes the geometry segmentation class AliITSgeomS?D, or + // AliITSsegmentationS?D depending on the vaule of fSegGeom, + // to values appropreate to this specific geometry. Now that + // the segmentation is part of AliITSgeom, the detector + // segmentations are also defined here. + // Inputs: + // Int_t lay The layer number/name. + // AliITSgeom *geom A pointer to the AliITSgeom class + // Outputs: + // AliITSgeom *geom This pointer recreated and properly inilized. + // Return: + // none. + const Double_t kcm2micron = 1.0E4; + Int_t i; + + switch (idet){ + case kSPD:{ + initSeg[idet] = kTRUE; + AliITSsegmentationSPD *segSPD = new AliITSsegmentationSPD(); + segSPD->SetDetSize(2.*shapePar[0]*kcm2micron, // X + 2.*shapePar[2]*kcm2micron, // Z + 2.*shapePar[1]*kcm2micron);// Y Microns + segSPD->SetNPads(256,160);// Number of Bins in x and z + Float_t bx[256],bz[280]; + for(i=000;i<256;i++) bx[i] = 50.0; // in x all are 50 microns. + for(i=000;i<160;i++) bz[i] = 425.0; // most are 425 microns + // except below + for(i=160;i<280;i++) bz[i] = 0.0; // Outside of detector. + bz[ 31] = bz[ 32] = 625.0; // first chip boundry + bz[ 63] = bz[ 64] = 625.0; // first chip boundry + bz[ 95] = bz[ 96] = 625.0; // first chip boundry + bz[127] = bz[128] = 625.0; // first chip boundry + bz[160] = 425.0;// Set so that there is no zero pixel size for fNz. + segSPD->SetBinSize(bx,bz); // Based on AliITSgeomSPD for now. + geom->ReSetShape(idet,segSPD); + }break; + case kSDD:{ + initSeg[idet] = kTRUE; + AliITSsegmentationSDD *segSDD = new AliITSsegmentationSDD(); + segSDD->SetDetSize(shapePar[0]*kcm2micron, // X + 2.*shapePar[2]*kcm2micron, // Z + 2.*shapePar[1]*kcm2micron);// Y Microns + segSDD->SetNPads(256,256);// Anodes, Samples + geom->ReSetShape(idet,segSDD); + }break; + case kSSD:{ + initSeg[idet] = kTRUE; + AliITSsegmentationSSD *segSSD = new AliITSsegmentationSSD(); + segSSD->SetDetSize(2.*shapePar[0]*kcm2micron, // X + 2.*shapePar[2]*kcm2micron, // Z + 2.*shapePar[1]*kcm2micron);// Y Microns. + segSSD->SetPadSize(95.,0.); // strip x pitch in microns + segSSD->SetNPads(768,2); // number of strips on each side, sides. + segSSD->SetAngles(0.0075,0.0275); // strip angels rad P and N side. + segSSD->SetAnglesLay5(0.0075,0.0275);//strip angels rad P and N + segSSD->SetAnglesLay6(0.0275,0.0075);//strip angels rad P and N + geom->ReSetShape(idet,segSSD); + }break; + default:{// Others, Note no kSDDp or kSSDp in this geometry. + geom->ReSetShape(idet,0); + Info("InitSegmentationPPRasymmFMD", + "default segmentation Dx=%f Dy=%f Dz=%f default=%d", + shapePar[0],shapePar[1],shapePar[2],idet); + }break; + } // end switch + return kTRUE; +} +//______________________________________________________________________ +Bool_t AliITSInitGeometry::GetTransformation(const TString &volumePath, + TGeoHMatrix &mat){ + // Returns the Transformation matrix between the volume specified + // by the path volumePath and the Top or mater volume. The format + // of the path volumePath is as follows (assuming ALIC is the Top volume) + // "/ALIC_1/DDIP_1/S05I_2/S05H_1/S05G_3". Here ALIC is the top most + // or master volume which has only 1 instance of. Of all of the daughter + // volumes of ALICE, DDIP volume copy #1 is indicated. Similarly for + // the daughter volume of DDIP is S05I copy #2 and so on. + // Inputs: + // TString& volumePath The volume path to the specific volume + // for which you want the matrix. Volume name + // hierarchy is separated by "/" while the + // copy number is appended using a "_". + // Outputs: + // TGeoHMatrix &mat A matrix with its values set to those + // appropriate to the Local to Master transformation + // Return: + // A logical value if kFALSE then an error occurred and no change to + // mat was made. + + // We have to preserve the modeler state + + // Preserve the modeler state. + gGeoManager->PushPath(); + if (!gGeoManager->cd(volumePath.Data())) { + gGeoManager->PopPath(); + Error("GetTransformation","Error in cd-ing to ",volumePath.Data()); + return kFALSE; + } // end if !gGeoManager + mat = *gGeoManager->GetCurrentMatrix(); + // Retstore the modeler state. + gGeoManager->PopPath(); + return kTRUE; +} +//______________________________________________________________________ +Bool_t AliITSInitGeometry::GetShape(const TString &volumePath, + TString &shapeType,TArrayD &par){ + // Returns the shape and its parameters for the volume specified + // by volumeName. + // Inputs: + // TString& volumeName The volume name + // Outputs: + // TString &shapeType Shape type + // TArrayD &par A TArrayD of parameters with all of the + // parameters of the specified shape. + // Return: + // A logical indicating whether there was an error in getting this + // information + Int_t npar; + gGeoManager->PushPath(); + if (!gGeoManager->cd(volumePath.Data())) { + gGeoManager->PopPath(); + return kFALSE; + } + TGeoVolume * vol = gGeoManager->GetCurrentVolume(); + gGeoManager->PopPath(); + if (!vol) return kFALSE; + TGeoShape *shape = vol->GetShape(); + TClass *class_type = shape->IsA(); + if (class_type==TGeoBBox::Class()) { + shapeType = "BOX"; + npar = 3; + par.Set(npar); + TGeoBBox *box = (TGeoBBox*)shape; + par.AddAt(box->GetDX(),0); + par.AddAt(box->GetDY(),1); + par.AddAt(box->GetDZ(),2); + return kTRUE; + } + if (class_type==TGeoTrd1::Class()) { + shapeType = "TRD1"; + npar = 4; + par.Set(npar); + TGeoTrd1 *trd1 = (TGeoTrd1*)shape; + par.AddAt(trd1->GetDx1(),0); + par.AddAt(trd1->GetDx2(),1); + par.AddAt(trd1->GetDy(), 2); + par.AddAt(trd1->GetDz(), 3); + return kTRUE; + } + if (class_type==TGeoTrd2::Class()) { + shapeType = "TRD2"; + npar = 5; + par.Set(npar); + TGeoTrd2 *trd2 = (TGeoTrd2*)shape; + par.AddAt(trd2->GetDx1(),0); + par.AddAt(trd2->GetDx2(),1); + par.AddAt(trd2->GetDy1(),2); + par.AddAt(trd2->GetDy2(),3); + par.AddAt(trd2->GetDz(), 4); + return kTRUE; + } + if (class_type==TGeoTrap::Class()) { + shapeType = "TRAP"; + npar = 11; + par.Set(npar); + TGeoTrap *trap = (TGeoTrap*)shape; + Double_t tth = TMath::Tan(trap->GetTheta()*TMath::DegToRad()); + par.AddAt(trap->GetDz(),0); + par.AddAt(tth*TMath::Cos(trap->GetPhi()*TMath::DegToRad()),1); + par.AddAt(tth*TMath::Sin(trap->GetPhi()*TMath::DegToRad()),2); + par.AddAt(trap->GetH1(),3); + par.AddAt(trap->GetBl1(),4); + par.AddAt(trap->GetTl1(),5); + par.AddAt(TMath::Tan(trap->GetAlpha1()*TMath::DegToRad()),6); + par.AddAt(trap->GetH2(),7); + par.AddAt(trap->GetBl2(),8); + par.AddAt(trap->GetTl2(),9); + par.AddAt(TMath::Tan(trap->GetAlpha2()*TMath::DegToRad()),10); + return kTRUE; + } + if (class_type==TGeoTube::Class()) { + shapeType = "TUBE"; + npar = 3; + par.Set(npar); + TGeoTube *tube = (TGeoTube*)shape; + par.AddAt(tube->GetRmin(),0); + par.AddAt(tube->GetRmax(),1); + par.AddAt(tube->GetDz(),2); + return kTRUE; + } + if (class_type==TGeoTubeSeg::Class()) { + shapeType = "TUBS"; + npar = 5; + par.Set(npar); + TGeoTubeSeg *tubs = (TGeoTubeSeg*)shape; + par.AddAt(tubs->GetRmin(),0); + par.AddAt(tubs->GetRmax(),1); + par.AddAt(tubs->GetDz(),2); + par.AddAt(tubs->GetPhi1(),3); + par.AddAt(tubs->GetPhi2(),4); + return kTRUE; + } + if (class_type==TGeoCone::Class()) { + shapeType = "CONE"; + npar = 5; + par.Set(npar); + TGeoCone *cone = (TGeoCone*)shape; + par.AddAt(cone->GetDz(),0); + par.AddAt(cone->GetRmin1(),1); + par.AddAt(cone->GetRmax1(),2); + par.AddAt(cone->GetRmin2(),3); + par.AddAt(cone->GetRmax2(),4); + return kTRUE; + } + if (class_type==TGeoConeSeg::Class()) { + shapeType = "CONS"; + npar = 7; + par.Set(npar); + TGeoConeSeg *cons = (TGeoConeSeg*)shape; + par.AddAt(cons->GetDz(),0); + par.AddAt(cons->GetRmin1(),1); + par.AddAt(cons->GetRmax1(),2); + par.AddAt(cons->GetRmin2(),3); + par.AddAt(cons->GetRmax2(),4); + par.AddAt(cons->GetPhi1(),5); + par.AddAt(cons->GetPhi2(),6); + return kTRUE; + } + if (class_type==TGeoSphere::Class()) { + shapeType = "SPHE"; + npar = 6; + par.Set(npar); + + TGeoSphere *sphe = (TGeoSphere*)shape; + par.AddAt(sphe->GetRmin(),0); + par.AddAt(sphe->GetRmax(),1); + par.AddAt(sphe->GetTheta1(),2); + par.AddAt(sphe->GetTheta2(),3); + par.AddAt(sphe->GetPhi1(),4); + par.AddAt(sphe->GetPhi2(),5); + return kTRUE; + } + if (class_type==TGeoPara::Class()) { + shapeType = "PARA"; + npar = 6; + par.Set(npar); + TGeoPara *para = (TGeoPara*)shape; + par.AddAt(para->GetX(),0); + par.AddAt(para->GetY(),1); + par.AddAt(para->GetZ(),2); + par.AddAt(para->GetTxy(),3); + par.AddAt(para->GetTxz(),4); + par.AddAt(para->GetTyz(),5); + return kTRUE; + } + if (class_type==TGeoPgon::Class()) { + shapeType = "PGON"; + TGeoPgon *pgon = (TGeoPgon*)shape; + Int_t nz = pgon->GetNz(); + const Double_t *rmin = pgon->GetRmin(); + const Double_t *rmax = pgon->GetRmax(); + const Double_t *z = pgon->GetZ(); + npar = 4 + 3*nz; + par.Set(npar); + par.AddAt(pgon->GetPhi1(),0); + par.AddAt(pgon->GetDphi(),1); + par.AddAt(pgon->GetNedges(),2); + par.AddAt(pgon->GetNz(),3); + for (Int_t i=0; iGetNz(); + const Double_t *rmin = pcon->GetRmin(); + const Double_t *rmax = pcon->GetRmax(); + const Double_t *z = pcon->GetZ(); + npar = 3 + 3*nz; + par.Set(npar); + par.AddAt(pcon->GetPhi1(),0); + par.AddAt(pcon->GetDphi(),1); + par.AddAt(pcon->GetNz(),2); + for (Int_t i=0; iGetA(),0); + par.AddAt(eltu->GetB(),1); + par.AddAt(eltu->GetDz(),2); + return kTRUE; + } + if (class_type==TGeoHype::Class()) { + shapeType = "HYPE"; + npar = 5; + par.Set(npar); + TGeoHype *hype = (TGeoHype*)shape; + par.AddAt(TMath::Sqrt(hype->RadiusHypeSq(0.,kTRUE)),0); + par.AddAt(TMath::Sqrt(hype->RadiusHypeSq(0.,kFALSE)),1); + par.AddAt(hype->GetDZ(),2); + par.AddAt(hype->GetStIn(),3); + par.AddAt(hype->GetStOut(),4); + return kTRUE; + } + if (class_type==TGeoGtra::Class()) { + shapeType = "GTRA"; + npar = 12; + par.Set(npar); + TGeoGtra *trap = (TGeoGtra*)shape; + Double_t tth = TMath::Tan(trap->GetTheta()*TMath::DegToRad()); + par.AddAt(trap->GetDz(),0); + par.AddAt(tth*TMath::Cos(trap->GetPhi()*TMath::DegToRad()),1); + par.AddAt(tth*TMath::Sin(trap->GetPhi()*TMath::DegToRad()),2); + par.AddAt(trap->GetH1(),3); + par.AddAt(trap->GetBl1(),4); + par.AddAt(trap->GetTl1(),5); + par.AddAt(TMath::Tan(trap->GetAlpha1()*TMath::DegToRad()),6); + par.AddAt(trap->GetH2(),7); + par.AddAt(trap->GetBl2(),8); + par.AddAt(trap->GetTl2(),9); + par.AddAt(TMath::Tan(trap->GetAlpha2()*TMath::DegToRad()),10); + par.AddAt(trap->GetTwistAngle(),11); + return kTRUE; + } + if (class_type==TGeoCtub::Class()) { + shapeType = "CTUB"; + npar = 11; + par.Set(npar); + TGeoCtub *ctub = (TGeoCtub*)shape; + const Double_t *lx = ctub->GetNlow(); + const Double_t *tx = ctub->GetNhigh(); + par.AddAt(ctub->GetRmin(),0); + par.AddAt(ctub->GetRmax(),1); + par.AddAt(ctub->GetDz(),2); + par.AddAt(ctub->GetPhi1(),3); + par.AddAt(ctub->GetPhi2(),4); + par.AddAt(lx[0],5); + par.AddAt(lx[1],6); + par.AddAt(lx[2],7); + par.AddAt(tx[0],8); + par.AddAt(tx[1],9); + par.AddAt(tx[2],10); + return kTRUE; + } + Error("GetShape","Getting shape parameters for shape %s not implemented", + shape->ClassName()); + return kFALSE; +} +//______________________________________________________________________ +void AliITSInitGeometry::DecodeDetector(Int_t &mod,Int_t layer,Int_t cpn0, + Int_t cpn1,Int_t cpn2){ + // decode geometry into detector module number. There are two decoding + // Scheams. Old which does not follow the ALICE coordinate system + // requirements, and New which dose. + // Inputs: + // Int_t layer The ITS layer + // Int_t cpn0 The lowest copy number + // Int_t cpn1 The middle copy number + // Int_t cpn2 the highest copy number + // Output: + // Int_t &mod The module number assoicated with this set + // of copy numbers. + // Return: + // none. + const Int_t detPerLadderSPD[2]={2,4}; + const Int_t detPerLadder[6]={4,4,6,8,22,25}; + const Int_t ladPerLayer[6]={20,40,14,22,34,38}; + Int_t lay,lad,det,i; + + if(fDecode){ // New decoding scheam + switch (layer){ + case 1:{ + lay = layer; + det = 5-cpn2; + if(cpn0==4&&cpn1==1) lad=1; + else if(cpn0==4&&cpn1==2) lad=20; + else if(cpn0<4){ + lad = 8-cpn1-detPerLadderSPD[layer-1]*(cpn0-1); + }else{ // cpn0>4 + lad = 28-cpn1-detPerLadderSPD[layer-1]*(cpn0-1); + } // end if + } break; + case 2:{ + lay = layer; + det = 5-cpn2; + if(cpn0==4&&cpn1==1) lad=1; + else if(cpn0<4){ + lad = 14-cpn1-detPerLadderSPD[layer-1]*(cpn0-1); + }else{ // cpn0>4 + lad = 54-cpn1-detPerLadderSPD[layer-1]*(cpn0-1); + } // end if + } break; + case 3:{ + lay = layer; + if(cpn0<5) lad = 5-cpn0; + else lad = 19-cpn0; + det = 7-cpn1; + } break; + case 4:{ + lay = layer; + if(cpn0<7) lad = 7-cpn0; + else lad = 29-cpn0; + det = 9-cpn1; + } break; + case 5:{ + lay = layer; + if(cpn0<10) lad = 10-cpn0; + else lad = 44-cpn0; + det = 23-cpn1; + } break; + case 6:{ + lay = layer; + if(cpn0<9) lad = 9-cpn0; + else lad = 47-cpn0; + det = 26-cpn1; + } break; + } // end switch + mod = 0; + for(i=0;i27) cpn0 = 15-(lad+detPerLadderSPD[lay-1])/ + detPerLadderSPD[lay-1]; + } break; + case 2:{ + cpn2 = 5-det; // Detector 1-4 + cpn1 = 4-(lad+2)%detPerLadderSPD[lay-1]; + cpn0 = 1+(14-cpn1-lad)/detPerLadderSPD[lay-1]; + if(mod>131) cpn0 = 1+(54-lad-cpn1)/detPerLadderSPD[lay-1]; + } break; + case 3:{ + cpn2 = 1; + if(lad<5) cpn0 = 5-lad; + else cpn0 = 19-lad; + cpn1 = 7-det; + } break; + case 4:{ + cpn2 = 1; + if(lad<7) cpn0 = 7-lad; + else cpn0 = 29-lad; + cpn1 = 9-det; + } break; + case 5:{ + cpn2 = 1; + if(lad<10) cpn0 = 10-lad; + else cpn0 = 44-lad; + cpn1 = 23-det; + } break; + case 6:{ + cpn2 = 1; + if(lad<9) cpn0 = 9-lad; + else cpn0 = 47-lad; + cpn1 = 26-det; + } break; + default:{ + Error("RecodeDetector","New: mod=%d lay=%d not 1-6."); + return; + } break; + } // end switch + if(cpn0<1||cpn1<1||cpn2<1|| + cpn0>itsGeomTreeCopys[lay-1][0]|| + cpn1>itsGeomTreeCopys[lay-1][1]|| + cpn2>itsGeomTreeCopys[lay-1][2]) + Error("RecodeDetector", + "cpn0=%d cpn1=%d cpn2=%d mod=%d lay=%d lad=%d det=%d", + cpn0,cpn1,cpn2,mod,lay,lad,det); + return; + } // end if + // Old encoding + switch (lay){ + case 1: case 2:{ + cpn2 = det; // Detector 1-4 + cpn0 = (lad+detPerLadderSPD[lay-1]-1)/detPerLadderSPD[lay-1]; + cpn1 = (lad+detPerLadderSPD[lay-1]-1)%detPerLadderSPD[lay-1] + 1; + } break; + case 3: case 4: case 5 : case 6:{ + cpn2 = 1; + cpn1 = det; + cpn0 = lad; + } break; + default:{ + Error("RecodeDetector","Old: mod=%d lay=%d not 1-6."); + return; + } break; + } // end switch + if(cpn0<1||cpn1<1||cpn2<1|| + cpn0>itsGeomTreeCopys[lay-1][0]|| + cpn1>itsGeomTreeCopys[lay-1][1]|| + cpn2>itsGeomTreeCopys[lay-1][2]) + Error("RecodeDetector", + "cpn0=%d cpn1=%d cpn2=%d mod=%d lay=%d lad=%d det=%d", + cpn0,cpn1,cpn2,mod,lay,lad,det); + return; +} +//______________________________________________________________________ +void AliITSInitGeometry::DecodeDetectorLayers(Int_t mod,Int_t &lay, + Int_t &lad,Int_t &det){ + // decode geometry into detector module number. There are two decoding + // Scheams. Old which does not follow the ALICE coordinate system + // requirements, and New which dose. Note, this use of layer ladder + // and detector numbers are strictly for internal use of this + // specific code. They do not represent the "standard" layer ladder + // or detector numbering except in a very old and obsoleate sence. + // Inputs: + // Int_t mod The module number assoicated with this set + // of copy numbers. + // Output: + // Int_t lay The layer number + // Int_t lad The ladder number + // Int_t det the dettector number + // Return: + // none. + // const Int_t detPerLadderSPD[2]={2,4}; + const Int_t detPerLadder[6]={4,4,6,8,22,25}; + const Int_t ladPerLayer[6]={20,40,14,22,34,38}; + Int_t mod2; + + det = 0; + lad = 0; + lay = 0; + mod2 = 0; + do{ + mod2 += ladPerLayer[lay]*detPerLadder[lay]; + lay++; + }while(mod2<=mod); // end while + if(lay>6||lay<1) Error("DecodeDetectorLayers","06",lay); + mod2 -= ladPerLayer[lay-1]*detPerLadder[lay-1]; + do{ + lad++; + mod2 += detPerLadder[lay-1]; + }while(mod2<=mod); // end while + if(lad>ladPerLayer[lay-1]||lad<1) Error("DecodeDetectorLayera", + "lad=%d>ladPerLayer[lay-1=%d]=%d mod=%d mod2=%d",lad,lay-1, + ladPerLayer[lay-1],mod,mod2); + mod2 -= detPerLadder[lay-1]; + det = mod-mod2+1; + if(det>detPerLadder[lay-1]||det<1) Error("DecodeDetectorLayers", + "det=%d>detPerLayer[lay-1=%d]=%d mod=%d mod2=%d lad=%d",det, + lay-1,detPerLadder[lay-1],mod,mod2,lad); + return; +} + diff --git a/ITS/AliITSInitGeometry.h b/ITS/AliITSInitGeometry.h new file mode 100644 index 00000000000..cb77d2b73d4 --- /dev/null +++ b/ITS/AliITSInitGeometry.h @@ -0,0 +1,70 @@ +#ifndef ALIITSINITGEOMETRY_H +#define ALIITSINITGEOMETRY_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* +$Id$ +*/ + +/* + Class to inilize AliITSgeom and the like for both simulation + and reconstriction. + */ +#include +#include +#include +#include + +#include "AliITSgeom.h" + +class AliITSInitGeometry : public TObject{ + public: + AliITSInitGeometry(); // Default Creator + AliITSInitGeometry(const Char_t *name,Int_t minorversion);//Standard Creator + //virtual ~AliITSInitGeometry(); // Destructor + // + AliITSgeom* CreateAliITSgeom(); // Create and intilize geometry from TGeom + Bool_t InitAliITSgeom(AliITSgeom *geom);//Initilize goemetry from gGeoManager + // Getters and Setters + TString GetGeometryName()const {return fName;}// Return geometry name + void SetGeometryName(const Char_t *name){fName = name;}// Set Geometry name + Int_t GetMajorVersion()const {return fMajorVersion;} // Return geometry major version + void SetMajorVersion(Int_t majorVersion){fMajorVersion = majorVersion;} // Set geometry major version + Int_t GetMinorVersion()const{return fMinorVersion;}// Return geometry minor version + void SetMinorVersion(Int_t minorVersion){fMinorVersion = minorVersion;} + Bool_t GetTiming()const{return fTiming;} // return routine timing flag + void SetTiming(Bool_t time=kTRUE){fTiming=time;}// Set routine timing (on) + Bool_t GetSegGeom()const{return fSegGeom;} // return flag indecating the use of AliITSsegmentation or AliITSgeomS?D class in fShape. + void SetSegGeom(Bool_t seg=kTRUE){fSegGeom = seg;}// Set the use of AliITSsegmentation class' instead of AliITSgeomS?D class in fShape + Bool_t GetDecoding()const{return fDecode;}// Return flag indecating wether to use new/old decoding + void SetDecoding(Bool_t newdec=kFALSE){fDecode = newdec;}// Set flag to use new/old decoding + + private: + // Virtual MC code reproduction + Bool_t InitAliITSgeomPPRasymmFMD(AliITSgeom *geom); + Bool_t InitGeomShapePPRasymmFMD(AliITSDetector idet,Bool_t *initSeg, + TArrayD &shapePar,AliITSgeom *geom); + Bool_t InitSegmentationPPRasymmFMD(AliITSDetector idet,Bool_t *initSeg, + TArrayD &shapePar,AliITSgeom *geom); + Bool_t GetTransformation(const TString &volumePath,TGeoHMatrix &mat); + Bool_t GetShape(const TString &volumePath,TString &shapeType,TArrayD &par); + void DecodeDetectorLayers(Int_t mod,Int_t &lay,Int_t &lad,Int_t &det); + void DecodeDetector(Int_t &mod,Int_t lay,Int_t cpn0,Int_t cpn1,Int_t cpn2); + void RecodeDetector(Int_t mod,Int_t &cpn0,Int_t &cpn1,Int_t &cpn2); + + TString fName; // Geometry name + Int_t fMinorVersion; // Geometry minor version + Int_t fMajorVersion; // Geometry swich value + Bool_t fTiming; // Flag to start inilization timing + Bool_t fSegGeom; // Flag to switch between the old use of + // AliITSgeomS?D class, or AliITSsegmentation + // class in fShape of AliITSgeom class. + Bool_t fDecode; // Flag for new/old decoding + + ClassDef(AliITSInitGeometry,0) // create/Init AliITSgeom + // 0 in ClassDef indicates that this class will not be "saved" in a file. +}; + +#endif + diff --git a/ITS/AliITSLoader.cxx b/ITS/AliITSLoader.cxx index 51f88f2248c..c53a5816936 100644 --- a/ITS/AliITSLoader.cxx +++ b/ITS/AliITSLoader.cxx @@ -144,6 +144,7 @@ AliITSLoader::~AliITSLoader(){ fDataLoaders->Remove(dl); if(fITSpid)delete fITSpid; if(fGeom)delete fGeom; + fGeom = 0; } /* //---------------------------------------------------------------------- @@ -339,4 +340,23 @@ AliITSgeom* AliITSLoader::GetITSgeom(Bool_t force) { AliWarning("AliITSgeom object has been fetched from galice.root file"); return fGeom; } +//______________________________________________________________________ +void AliITSLoader::SetITSgeom(AliITSgeom *geom){ + // Replaces the AliITSgeom object read from file with the one + // given. + // Inputs: + // AliITSgeom *geom The AliITSgeom object to replace the one + // read from the file + // Outputs: + // none. + // Return: + // none. + + if(fGeom==geom) return; // Same do nothing + if(fGeom) { + delete fGeom; + fGeom=0; + }// end if + fGeom=geom; +} diff --git a/ITS/AliITSLoader.h b/ITS/AliITSLoader.h index bbe9a900e88..e718bf87c94 100644 --- a/ITS/AliITSLoader.h +++ b/ITS/AliITSLoader.h @@ -112,7 +112,7 @@ class AliITSLoader: public AliLoader{ // Geometry. Geom is read from file, unless already loaded // readout from file can be forced if force=kTRUE AliITSgeom* GetITSgeom(Bool_t force=kFALSE); - void SetITSgeom(AliITSgeom* g){fGeom=g;} + void SetITSgeom(AliITSgeom* g); // PID AliITSpidESD* GetITSpid() const {return fITSpid;} void AdoptITSpid(AliITSpidESD* pid) {fITSpid=pid;} diff --git a/ITS/AliITSReconstructor.cxx b/ITS/AliITSReconstructor.cxx index 429f71e056c..dabc5c10569 100644 --- a/ITS/AliITSReconstructor.cxx +++ b/ITS/AliITSReconstructor.cxx @@ -40,6 +40,7 @@ #include "AliITSpidESD2.h" #include "AliV0vertexer.h" #include "AliCascadeVertexer.h" +#include "AliITSInitGeometry.h" ClassImp(AliITSReconstructor) @@ -67,7 +68,32 @@ AliITSReconstructor& AliITSReconstructor::operator=(const AliITSReconstructor& / Error("= operator","Assignment operator not allowed\n"); return *this; } +//______________________________________________________________________ +void AliITSReconstructor::Init(AliRunLoader *runLoader){ + // Initalize this constructor bet getting/creating the objects + // nesseary for a proper ITS reconstruction. + // Inputs: + // AliRunLoader *runLoader Pointer to the run loader to allow + // the getting of files/folders data + // needed to do reconstruction + // Output: + // none. + // Return: + // none. + AliITSInitGeometry *initgeom = new AliITSInitGeometry("AliITSvPPRasymmFMD", + 2); + AliITSgeom *geom = initgeom->CreateAliITSgeom(); + delete initgeom; // once created, do not need initgeom any more. + AliITSLoader* loader = static_cast + (runLoader->GetLoader("ITSLoader")); + if (!loader) { + Error("Init", "ITS loader not found"); + return; + } + loader->SetITSgeom(geom); + return; +} //_____________________________________________________________________________ void AliITSReconstructor::Reconstruct(AliRunLoader* runLoader) const { @@ -263,4 +289,3 @@ AliITSgeom* AliITSReconstructor::GetITSgeom(AliRunLoader* runLoader) const return geom; } - diff --git a/ITS/AliITSReconstructor.h b/ITS/AliITSReconstructor.h index 7efb77049a5..0f818367df5 100644 --- a/ITS/AliITSReconstructor.h +++ b/ITS/AliITSReconstructor.h @@ -24,7 +24,8 @@ public: virtual ~AliITSReconstructor(); AliITSReconstructor(const AliITSReconstructor &ob); // copy constructor AliITSReconstructor& operator=(const AliITSReconstructor & /* source */); // ass. op. - + virtual void Init(AliRunLoader* runLoader); + virtual void Reconstruct(AliRunLoader* runLoader) const; virtual void Reconstruct(AliRunLoader* runLoader, AliRawReader* rawReader) const; diff --git a/ITS/AliITSgeom.cxx b/ITS/AliITSgeom.cxx index aae9928ab31..bee4a805022 100644 --- a/ITS/AliITSgeom.cxx +++ b/ITS/AliITSgeom.cxx @@ -22,8 +22,9 @@ // By: Bjorn S. Nilsen // // version: 0.0.1 // // Updated May 27 1999. // -// Added Cylindrical random and global based changes. // +// Added Cylindrical random and global based changes. // // Added function PrintComparison. // +// Modified and added functions Feb. 7 2006 // /////////////////////////////////////////////////////////////////////// @@ -83,134 +84,199 @@ pixel coordinate system. // // Data Members: // +// TString fVersion +// Transformation version. +// Int_t fTrans +// Flag to keep track of which transformation +// Int_t fNmodules +// The total number of modules // Int_t fNlayers // The number of ITS layers for this geometry. By default this // is 6, but can be modified by the creator function if there are // more layers defined. // -// Int_t *fNlad +// TArrayI fNlad // A pointer to an array fNlayers long containing the number of // ladders for each layer. This array is typically created and filled // by the AliITSgeom creator function. // -// Int_t *fNdet +// TArrayI fNdet // A pointer to an array fNlayers long containing the number of // active detector volumes for each ladder. This array is typically // created and filled by the AliITSgeom creator function. // -// AliITSgeomMatrix *fGm +// TObjArray fGm containing objects of type AliITSgeomMatrix // A pointer to an array of AliITSgeomMatrix classes. One element // per module (detector) in the ITS. AliITSgeomMatrix basicly contains // all of the necessary information about the detector and it's coordinate // transformations. // -// TObjArray *fShape +// TObjArray fShape containting objects of type AliITSgeom // A pointer to an array of TObjects containing the detailed shape // information for each type of detector used in the ITS. For example -// I have created AliITSgeomSPD, AliITSgeomSDD, and AliITSgeomSSD as -// example structures, derived from TObjects, to hold the detector -// information. I would recommend that one element in each of these -// structures, that which describes the shape of the active volume, -// be one of the ROOT classes derived from TShape. In this way it would -// be easy to have the display program display the correct active -// ITS volumes. See the example classes AliITSgeomSPD, AliITSgeomSDD, -// and AliITSgeomSSD for a more detailed example. +// I have created AliITSgeomSPD, AliITSgeomSDD, and +// AliITSsegmenttionSSD as example structures, derived from TObjects, +// to hold the detector information. I would recommend that one element +// in each of these structures, that which describes the shape of the +// active volume, be one of the ROOT classes derived from TShape. In this +// way it would be easy to have the display program display the correct +// active ITS volumes. See the example classes AliITSgeomSPD, +// AliITSgeomSDD, and AliITSgeomSSD for a more detailed +// example. //////////////////////////////////////////////////////////////////////// #include #include #include +#include -#include "AliITSgeom.h" -#include "AliITSgeomSDD.h" #include "AliITSgeomSPD.h" +#include "AliITSgeomSDD.h" #include "AliITSgeomSSD.h" +#include "AliITSgeom.h" #include "AliLog.h" ClassImp(AliITSgeom) //______________________________________________________________________ -AliITSgeom::AliITSgeom(){ +AliITSgeom::AliITSgeom(): +TObject(), +fVersion("GEANT"),// Transformation version. +fTrans(0), // Flag to keep track of which transformation +fNmodules(0), // The total number of modules +fNlayers(0), // The number of layers. +fNlad(), //[] Array of the number of ladders/layer(layer) +fNdet(), //[] Array of the number of detector/ladder(layer) +fGm(0,0), // Structure of translation. and rotation. +fShape(0,0) // Array of shapes and detector information. +{ // The default constructor for the AliITSgeom class. It, by default, // sets fNlayers to zero and zeros all pointers. // Do not allocate anything zero everything. + // Inputs: + // none. + // Outputs: + // none. + // Return: + // a zeroed AliITSgeom object. - fTrans = 0; // standard GEANT global/local coordinate system. - fNlayers = 0; - fNlad = 0; - fNdet = 0; - fGm = 0; - fShape = 0; - strcpy(fVersion,"test"); + fGm.SetOwner(kTRUE); + fShape.SetOwner(kTRUE); return; } //______________________________________________________________________ -AliITSgeom::AliITSgeom(Int_t itype,Int_t nlayers,Int_t *nlads,Int_t *ndets, - Int_t mods){ +AliITSgeom::AliITSgeom(Int_t itype,Int_t nlayers,const Int_t *nlads, + const Int_t *ndets,Int_t mods): +TObject(), +fVersion("GEANT"), // Transformation version. +fTrans(itype), // Flag to keep track of which transformation +fNmodules(mods), // The total number of modules +fNlayers(nlayers), // The number of layers. +fNlad(nlayers,nlads),//[] Array of the number of ladders/layer(layer) +fNdet(nlayers,ndets),//[] Array of the number of detector/ladder(layer) +fGm(mods,0), // Structure of translation. and rotation. +fShape(5,0) // Array of shapes and detector information. +{ // A simple constructor to set basic geometry class variables // Inputs: - // Int_t itype the type of transformation kept. - // bit 0 => Standard GEANT - // bit 1 => ITS tracking - // bit 2 => A change in the coordinate system has been made. - // others are still to be defined as needed. - // Int_t nlayers The number of ITS layers also set the size of the arrays - // Int_t *nlads an array of the number of ladders for each layer. This - // array must be nlayers long. - // Int_t *ndets an array of the number of detectors per ladder for each - // layer. This array must be nlayers long. - // Int_t mods The number of modules. Typicaly the sum of all the - // detectors on every layer and ladder. + // Int_t itype the type of transformation kept. + // bit 0 => Standard GEANT + // bit 1 => ITS tracking + // bit 2 => A change in the coordinate system has been made. + // others are still to be defined as needed. + // Int_t nlayers The number of ITS layers also set the size of the arrays + // Int_t *nlads an array of the number of ladders for each layer. This + // array must be nlayers long. + // Int_t *ndets an array of the number of detectors per ladder for each + // layer. This array must be nlayers long. + // Int_t mods The number of modules. Typically the sum of all the + // detectors on every layer and ladder. // Outputs: - // none - Int_t i; + // none + // Return: + // A properly inilized AliITSgeom object. + + fGm.SetOwner(kTRUE); + fShape.SetOwner(kTRUE); + return; +} +//______________________________________________________________________ +void AliITSgeom::Init(Int_t itype,Int_t nlayers,const Int_t *nlads, + const Int_t *ndets,Int_t mods){ + // A simple Inilizer to set basic geometry class variables + // Inputs: + // Int_t itype the type of transformation kept. + // bit 0 => Standard GEANT + // bit 1 => ITS tracking + // bit 2 => A change in the coordinate system has been made. + // others are still to be defined as needed. + // Int_t nlayers The number of ITS layers also set the size of the arrays + // Int_t *nlads an array of the number of ladders for each layer. This + // array must be nlayers long. + // Int_t *ndets an array of the number of detectors per ladder for each + // layer. This array must be nlayers long. + // Int_t mods The number of modules. Typically the sum of all the + // detectors on every layer and ladder. + // Outputs: + // none + // Return: + // A properly inilized AliITSgeom object. - fTrans = itype; - fNlayers = nlayers; - fNlad = new Int_t[nlayers]; - fNdet = new Int_t[nlayers]; - for(i=0;iAddAt(0,i); - strcpy(fVersion,"test"); + fVersion = "GEANT"; // Transformation version. + fTrans = itype; // Flag to keep track of which transformation + fNmodules = mods; // The total number of modules + fNlayers = nlayers; // The number of layers. + fNlad.Set(nlayers,nlads);//[] Array of the number of ladders/layer(layer) + fNdet.Set(nlayers,ndets);//[] Array of the number of detector/ladder(layer) + fGm.Clear(); + fGm.Expand(mods); // Structure of translation. and rotation. + fGm.SetOwner(kTRUE); + fShape.Clear(); + fShape.Expand(5); // Array of shapes and detector information. + fShape.SetOwner(kTRUE); return; } //______________________________________________________________________ -void AliITSgeom::CreatMatrix(Int_t mod,Int_t lay,Int_t lad,Int_t det, - AliITSDetector idet,const Double_t tran[3], - const Double_t rot[10]){ +void AliITSgeom::CreateMatrix(Int_t mod,Int_t lay,Int_t lad,Int_t det, + AliITSDetector idet,const Double_t tran[3], + const Double_t rot[10]){ // Given the translation vector tran[3] and the rotation matrix rot[1], // this function creates and adds to the TObject Array fGm the // AliITSgeomMatrix object. - // Inputs are: - // Int_t mod The module number. The location in TObjArray - // Int_t lay The layer where this module is - // Int_t lad On which ladder this module is - // Int_t det Which detector on this ladder this module is - // AliITSDetector idet The type of detector see AliITSgeom.h - // Double_t tran[3] The translation vector - // Double_t rot[10] The rotation matrix. - // Outputs are: - // none // The rot[10] matrix is set up like: /* / rot[0] rot[1] rot[2] \ // | rot[3] rot[4] rot[5] | // \ rot[6] rot[7] rot[8] / if(rot[9]!=0) then the Identity matrix // is used regardless of the values in rot[0]-rot[8]. */ + // Inputs: + // Int_t mod The module number. The location in TObjArray + // Int_t lay The layer where this module is + // Int_t lad On which ladder this module is + // Int_t det Which detector on this ladder this module is + // AliITSDetector idet The type of detector see AliITSgeom.h + // Double_t tran[3] The translation vector + // Double_t rot[10] The rotation matrix. + // Outputs: + // none + // Return: + // none. Int_t id[3]; Double_t r[3][3] = {{1.0,0.0,0.0},{0.0,1.0,0.0},{0.0,0.0,1.0}}; - if(fGm->At(mod)!=0) delete fGm->At(mod); + if(mod<0||mod>=fGm.GetSize()){ + Error("CreateMatrix","mod=%d is out of bounds max value=%d",mod, + fGm.GetSize()); + return; + } // end if + delete fGm.At(mod); id[0] = lay; id[1] = lad; id[2] = det; if(rot[9]!=0.0) { // null rotation - r[0][0] = rot[0]; r[0][1] = rot[1]; r[0][2] = rot[2]; - r[1][0] = rot[3]; r[1][1] = rot[4]; r[1][2] = rot[5]; - r[2][0] = rot[6]; r[2][1] = rot[7]; r[2][2] = rot[8]; + r[0][0] = rot[0]; r[0][1] = rot[1]; r[0][2] = rot[2]; + r[1][0] = rot[3]; r[1][1] = rot[4]; r[1][2] = rot[5]; + r[2][0] = rot[6]; r[2][1] = rot[7]; r[2][2] = rot[8]; } // end if - fGm->AddAt(new AliITSgeomMatrix(idet,id,r,tran),mod); + fGm.AddAt(new AliITSgeomMatrix(idet,id,r,tran),mod); } //______________________________________________________________________ AliITSgeom::~AliITSgeom(){ @@ -219,23 +285,18 @@ AliITSgeom::~AliITSgeom(){ // are non zero, then this memory space is freed and they are set // to zero. In addition, fNlayers is set to zero. The destruction of // TObjArray fShape is, by default, handled by the TObjArray destructor. + // Inputs: + // none. + // Outputs: + // none. + // Return: + // none. - if(fGm!=0){ - //for(Int_t i=0;iAt(i); - fGm->Delete(); - delete fGm; - } // end if fGm!=0 - if(fNlad!=0) delete[] fNlad; - if(fNdet!=0) delete[] fNdet; - fNlayers = 0; - fNlad = 0; - fNdet = 0; - fGm = 0; - return; + return; } //______________________________________________________________________ void AliITSgeom::ReadNewFile(const char *filename){ - // It is generaly preferred to define the geometry in AliITSgeom + // It is generally preferred to define the geometry in AliITSgeom // directly from the GEANT geometry, see AliITSvPPRasymm.cxx for // and example. Under some circumstances this may not be possible. // This function will read in a formatted file for all of the @@ -244,124 +305,129 @@ void AliITSgeom::ReadNewFile(const char *filename){ // and the order of the data does not need to be completely // respected. A file can be created using the function WriteNewFile // defined below. - // Inputs are: - // const char *filename The file name of the file to be read in. - // Outputs are: - // none + // Inputs: + // const char *filename The file name of the file to be read in. + // Outputs: + // none + // Return: + // none. Int_t ncmd=9; const char *cmda[]={"Version" ,"fTrans" ,"fNmodules", "fNlayers" ,"fNladers","fNdetectors", "fNDetectorTypes","fShape" ,"Matrix"}; Int_t i,j,lNdetTypes,ldet; char cmd[20],c; - AliITSgeomSPD *spd=0; - AliITSgeomSDD *sdd=0; - AliITSgeomSSD *ssd=0; AliITSgeomMatrix *m=0; ifstream *fp=0; char *filtmp=0; + Bool_t arrayGm = kFALSE, arrayShape = kFALSE; filtmp = gSystem->ExpandPathName(filename); AliInfo(Form("Reading New .det file %s",filtmp)); fp = new ifstream(filtmp,ios::in); // open file to write while(fp->get(c)!=NULL){ // for ever loop - if(c==' ') continue; // remove blanks - if(c=='\n') continue; - if(c=='#' || c=='!') {while(fp->get(c)) if(c=='\n') break; continue;} - if(c=='/'){ - fp->get(c);{ - if(c=='/') {while(fp->get(c)) if(c=='\n') break; continue;} - if(c=='*'){ - NotYet: - while(fp->get(c)) if(c=='*') break; - fp->get(c);{ - if(c=='/') continue; - goto NotYet; - } // - } // end if c=='*' - } // end if second / - } // end if first / - fp->putback(c); - *fp >> cmd; - for(i=0;i> fVersion; - break; - case 1: // fTrans - *fp >> fTrans; - break; - case 2: // fNModules - *fp >> fNmodules; - if(fGm!=0){ - for(j=0;jGetEntriesFast();j++) delete fGm->At(j); - delete fGm; - } // end if - fGm = new TObjArray(fNmodules,0); - break; - case 3: // fNlayers - *fp >> fNlayers; - if(fNlad!=0) delete fNlad; - if(fNdet!=0) delete fNdet; - fNlad = new Int_t[fNlayers]; - fNdet = new Int_t[fNlayers]; - break; - case 4: // fNladers - for(j=0;j> fNlad[j]; - break; - case 5: // fNdetectors - for(j=0;j> fNdet[j]; - break; - case 6: // fNDetectorTypes - *fp >> lNdetTypes; - if(fShape!=0){ - for(j=0;jGetEntriesFast();j++) delete fShape->At(j); - delete fShape; + if(c==' ') continue; // remove blanks + if(c=='\n') continue; + if(c=='#' || c=='!') {while(fp->get(c)) if(c=='\n') break; continue;} + if(c=='/'){ + fp->get(c);{ + if(c=='/') {while(fp->get(c)) if(c=='\n') break; continue;} + if(c=='*'){ + NotYet: + while(fp->get(c)) if(c=='*') break; + fp->get(c);{ + if(c=='/') continue; + goto NotYet; + } // + } // end if c=='*' + } // end if second / + } // end if first / + fp->putback(c); + *fp >> cmd; + for(i=0;i> j; + fVersion.Resize(j); + for(j=0;j> fVersion[j]; + break; + case 1: // fTrans + *fp >> fTrans; + break; + case 2: // fNModules + *fp >> fNmodules; + fGm.Clear(); + fGm.Expand(fNmodules); + fGm.SetOwner(kTRUE); + arrayGm = kTRUE; + break; + case 3: // fNlayers + *fp >> fNlayers; + fNlad.Set(fNlayers); + fNdet.Set(fNlayers); + break; + case 4: // fNladers + for(j=0;j> fNlad[j]; + break; + case 5: // fNdetectors + for(j=0;j> fNdet[j]; + break; + case 6: // fNDetectorTypes + *fp >> lNdetTypes; + fShape.Clear(); + fShape.Expand(lNdetTypes); + fShape.SetOwner(kTRUE); + arrayShape = kTRUE; + break; + case 7: // fShape + *fp >> ldet; + if(!arrayShape) fShape.Expand(5); + fShape.SetOwner(kTRUE); + switch (ldet){ + case kSPD :{ + AliITSgeomSPD *spd = new AliITSgeomSPD(); + *fp >> *spd; + ReSetShape(ldet,spd); + } break; + case kSDD : case kSDDp:{ + AliITSgeomSDD *sdd = new AliITSgeomSDD(); + *fp >> *sdd; + ReSetShape(ldet,sdd); + }break; + case kSSD : case kSSDp :{ + AliITSgeomSSD *ssd = new AliITSgeomSSD(); + *fp >> *ssd; + ReSetShape(ldet,ssd); + }break; + default:{ + AliError(Form("Unknown fShape type number=%d c=%c",ldet,c)); + while(fp->get(c)) if(c=='\n') break; // skip to end of line. + }break; + } // end switch + break; + case 8: // Matrix + *fp >> ldet; + if(!arrayGm){ + fGm.Clear(); + fGm.Expand(2270); + arrayGm = kTRUE; + } // end if + if(ldet<0||ldet>=fGm.GetSize()){ + Error("ReadNewFile","ldet<0||ldet>=fGm.GetSize()=%d", + ldet,fGm.GetSize()); + return; } // end if - fShape = new TObjArray(lNdetTypes,0); - break; - case 7: // fShape - *fp >> ldet; - if(fShape==0) fShape = new TObjArray(5,0); - switch (ldet){ - case kSPD : - spd = new AliITSgeomSPD(); - *fp >> *spd; - ReSetShape(ldet,spd); - spd = 0; - break; - case kSDD : case kSDDp: - sdd = new AliITSgeomSDD(); - *fp >> *sdd; - ReSetShape(ldet,sdd); - sdd = 0; - break; - case kSSD : case kSSDp : - ssd = new AliITSgeomSSD(); - *fp >> *ssd; - ReSetShape(ldet,ssd); - ssd = 0; - break; - default: - AliError(Form("Unknown fShape type number=%d c=%c",ldet,c)); - while(fp->get(c)) if(c=='\n') break; // skip to end of line. - break; - } // end switch - break; - case 8: // Matrix - *fp >> ldet; - if(fGm==0) fGm = new TObjArray(2270,0); - if(fGm->At(ldet)!=0) delete (fGm->At(ldet)); - fGm->AddAt((TObject*)new AliITSgeomMatrix(),ldet); - m = (AliITSgeomMatrix*) fGm->At(ldet); - *fp >> *m; - m = 0; - break; - default: - AliError(Form("ReadNewFile","Data line i=%d c=%c",i,c)); - while(fp->get(c)) if(c=='\n') break; // skip this line - break; - } // end switch i + delete fGm.At(ldet); + fGm.AddAt((TObject*)new AliITSgeomMatrix(),ldet); + m = (AliITSgeomMatrix*) fGm.At(ldet); + *fp >> *m; + m = 0; + break; + default: + AliError(Form("ReadNewFile","Data line i=%d c=%c",i,c)); + while(fp->get(c)) if(c=='\n') break; // skip this line + break; + } // end switch i } // end while delete fp; @@ -369,18 +435,20 @@ void AliITSgeom::ReadNewFile(const char *filename){ } //______________________________________________________________________ void AliITSgeom::WriteNewFile(const char *filename){ - // Writes AliITSgeom, AliITSgeomMatrix, and the defined AliITSgeomS*D - // classes to a file in a format that is more readable and commendable. - // Inputs are: - // const char *filename The file name of the file to be write to. - // Outputs are: - // none + // Writes AliITSgeom, AliITSgeomMatrix, and the defined + // AliITSgeomS*D classes to a file in a format that + // is more readable and commendable. + // Inputs: + // const char *filename The file name of the file to be write to. + // Outputs: + // none + // Return: + // none ofstream *fp; Int_t i; char *filtmp; filtmp = gSystem->ExpandPathName(filename); - cout << "AliITSgeom, Writing New .det file " << filtmp << endl; fp = new ofstream(filtmp,ios::out); // open file to write *fp << "//Comment lines begin with two //, one #, or one !" << endl; *fp << "#Blank lines are skipped including /* and */ sections." << endl; @@ -390,8 +458,8 @@ void AliITSgeom::WriteNewFile(const char *filename){ *fp << ", kSDD=" << (Int_t) kSDD << ", kSSD=" << (Int_t) kSSD; *fp << ", kSSDp=" << (Int_t) kSSDp << ", and kSDDp=" << (Int_t) kSDDp; *fp << "*/" << endl; - *fp << "Version " << fVersion << endl;//This should be consistent with the - // geometry version. + *fp << "Version "<< fVersion.Length()<<" " << fVersion.Data() << endl;//This should be consistent + // with the geometry version. *fp << "fTrans " << fTrans << endl; *fp << "fNmodules " << fNmodules << endl; *fp << "fNlayers " << fNlayers << endl; @@ -401,21 +469,21 @@ void AliITSgeom::WriteNewFile(const char *filename){ *fp << "fNdetectors "; for(i=0;iGetEntriesFast() << endl; - for(i=0;iGetEntriesFast();i++){ + *fp << "fNDetectorTypes " << fShape.GetEntriesFast() << endl; + for(i=0;iAt(i))); + *fp << *((AliITSgeomSPD*)(fShape.At(i))); break; case kSDD : *fp << "fShape " << (Int_t) kSDD << " "; - *fp << *((AliITSgeomSDD*)(fShape->At(i))); + *fp << *((AliITSgeomSDD*)(fShape.At(i))); break; case kSSD : case kSSDp : *fp << "fShape " << i << " "; - *fp << *((AliITSgeomSSD*)(fShape->At(i))); + *fp << *((AliITSgeomSSD*)(fShape.At(i))); break; default: Error("AliITSgeom::WriteNewFile","Unknown Shape value"); @@ -431,68 +499,78 @@ void AliITSgeom::WriteNewFile(const char *filename){ return; } //______________________________________________________________________ -AliITSgeom::AliITSgeom(const char *filename){ +AliITSgeom::AliITSgeom(const char *filename): +TObject(), +fVersion("test"),// Transformation version. +fTrans(0), // Flag to keep track of which transformation +fNmodules(0), // The total number of modules +fNlayers(0), // The number of layers. +fNlad(), // TArrayI of the number of ladders/layer(layer) +fNdet(), // TArrayI of the number of detector/ladder(layer) +fGm(0,0), // TObjArray Structure of translation. and rotation. +fShape(0,0) // TObjArray of detector geom. +{ // The constructor for the AliITSgeom class. All of the data to fill // this structure is read in from the file given my the input filename. - // Inputs are: - // const char *filename The file name of the file to be read in. - // Outputs are: - // none + // Inputs: + // const char *filename The file name of the file to be read in. + // Outputs: + // none + // Return: + // An AliITSgeom class initialized from a file. FILE *pf=0; Int_t i,lm=0,id[3]; Int_t l,a,d; Float_t x,y,z,o,p,q,r,s,t; Double_t rot6[6],tran[3]; char buf[200],*buff=0; // input character buffer; - char *filtmp; + char *filtmp; filtmp = gSystem->ExpandPathName(filename); - cout << "AliITSgeom reading old .det file " << filtmp << endl; - fShape = 0; - strcpy(fVersion,"DefauleV5"); + Info("AliITSgeom","reading old .det file %s",filtmp); + fVersion="GEANT5"; pf = fopen(filtmp,"r"); fNlayers = 6; // set default number of ladders - TryAgain: - fNlad = new Int_t[fNlayers]; - fNdet = new Int_t[fNlayers]; + TryAgain: + fNlad.Set(fNlayers); + fNdet.Set(fNlayers); fNmodules = 0; // find the number of ladders and detectors in this geometry. for(i=0;ilm) lm = l; - if(l<1 || l>fNlayers) { - printf("error in file %s layer=%d min. is 1 max is %d\n", - filename,l,fNlayers); - continue; - }// end if l - fNmodules++; - if(l<=fNlayers&&fNlad[l-1]lm) lm = l; + if(l<1 || l>fNlayers) { + printf("error in file %s layer=%d min. is 1 max is %d\n", + filename,l,fNlayers); + continue; + }// end if l + fNmodules++; + if(l<=fNlayers&&fNlad[l-1]fNlayers){ - delete[] fNlad; - delete[] fNdet; - fNlayers = lm; - goto TryAgain; + fNlayers = lm; + goto TryAgain; } // end if lm>fNlayers // counted the number of ladders and detectors now allocate space. - fGm = new TObjArray(fNmodules,0); + fGm.Expand(fNmodules); + fGm.SetOwner(kTRUE); + fShape.SetOwner(kTRUE); // Set up Shapes for a default configuration of 6 layers. fTrans = 0; // standard GEANT global/local coordinate system. @@ -500,38 +578,43 @@ AliITSgeom::AliITSgeom(const char *filename){ lm = 0; // reuse lm as counter of modules. rewind(pf); // start over reading file while(fgets(buf,200,pf)!=NULL){ // for ever loop - for(i=0;i<200;i++)if(buf[i]!=' '){ // remove blank spaces. - buff = &(buf[i]); - break; - } // end for i - // remove blank lines and comments. - if(buff[0]=='\n'||buff[0]=='#'||buff[0]=='!'|| - (buff[0]=='/'&&buff[1]=='/')) continue; - x = y = z = o = p = q = r = s = t = 0.0; - sscanf(buff,"%d %d %d %f %f %f %f %f %f %f %f %f", - &l,&a,&d,&x,&y,&z,&o,&p,&q,&r,&s,&t); - if(l<1 || l>fNlayers) { - printf("error in file %s layer=%d min. is 1 max is %d/n", - filename,l,fNlayers); - continue; - }// end if l - id[0] = l;id[1] = a;id[2] = d; - tran[0] = tran[1] = tran[2] = 0.0; - tran[0] = (Double_t)x;tran[1] = (Double_t)y;tran[2] = (Double_t)z; - rot6[0] = rot6[1] = rot6[2] = rot6[3] = rot6[4] = rot6[5] =0.0; - rot6[0] = (Double_t)o;rot6[1] = (Double_t)p;rot6[2] = (Double_t)q; - rot6[3] = (Double_t)r;rot6[4] = (Double_t)s;rot6[5] = (Double_t)t; - switch (l){ - case 1: case 2: // layer 1 or2 SPD - fGm->AddAt(new AliITSgeomMatrix(rot6,kSPD,id,tran),lm++); - break; - case 3: case 4: // layer 3 or 4 SDD - fGm->AddAt(new AliITSgeomMatrix(rot6,kSDD,id,tran),lm++); - break; - case 5: case 6: // layer 5 or 6 SSD - fGm->AddAt(new AliITSgeomMatrix(rot6,kSSD,id,tran),lm++); - break; - } // end switch + for(i=0;i<200;i++)if(buf[i]!=' '){ // remove blank spaces. + buff = &(buf[i]); + break; + } // end for i + // remove blank lines and comments. + if(buff[0]=='\n'||buff[0]=='#'||buff[0]=='!'|| + (buff[0]=='/'&&buff[1]=='/')) continue; + x = y = z = o = p = q = r = s = t = 0.0; + sscanf(buff,"%d %d %d %f %f %f %f %f %f %f %f %f", + &l,&a,&d,&x,&y,&z,&o,&p,&q,&r,&s,&t); + if(l<1 || l>fNlayers) { + Warning("AliITSgeom","error in file %s layer=%d min. is 1 max is %d", + filename,l,fNlayers); + continue; + }// end if l + id[0] = l;id[1] = a;id[2] = d; + tran[0] = tran[1] = tran[2] = 0.0; + tran[0] = (Double_t)x;tran[1] = (Double_t)y;tran[2] = (Double_t)z; + rot6[0] = rot6[1] = rot6[2] = rot6[3] = rot6[4] = rot6[5] =0.0; + rot6[0] = (Double_t)o;rot6[1] = (Double_t)p;rot6[2] = (Double_t)q; + rot6[3] = (Double_t)r;rot6[4] = (Double_t)s;rot6[5] = (Double_t)t; + if(lm<0||lm>=fGm.GetSize()){ + Error("AliITSgeom(filename)","lm<0||lm>=fGm.GetSize()=%d", + lm,fGm.GetSize()); + return; + } // end if + switch (l){ + case 1: case 2: // layer 1 or2 SPD + fGm.AddAt(new AliITSgeomMatrix(rot6,kSPD,id,tran),lm++); + break; + case 3: case 4: // layer 3 or 4 SDD + fGm.AddAt(new AliITSgeomMatrix(rot6,kSDD,id,tran),lm++); + break; + case 5: case 6: // layer 5 or 6 SSD + fGm.AddAt(new AliITSgeomMatrix(rot6,kSSD,id,tran),lm++); + break; + } // end switch } // end while ever loop fclose(pf); } @@ -539,11 +622,13 @@ AliITSgeom::AliITSgeom(const char *filename){ AliITSgeom::AliITSgeom(const AliITSgeom &source) : TObject(source){ // The copy constructor for the AliITSgeom class. It calls the // = operator function. See the = operator function for more details. - // Inputs are: - // AliITSgeom &source The AliITSgeom class with which to make this - // a copy of. - // Outputs are: - // none. + // Inputs: + // AliITSgeom &source The AliITSgeom class with which to make this + // a copy of. + // Outputs: + // none. + // Return: + // none. *this = source; // Just use the = operator for now. return; @@ -555,37 +640,41 @@ AliITSgeom& AliITSgeom::operator=(const AliITSgeom &source){ // to the copied class will not affect the source class in any way. // This is required for many ITS alignment studies where the copied // class is then modified by introducing some misalignment. - // Inputs are: - // AliITSgeom &source The AliITSgeom class with which to make this - // a copy of. - // Outputs are: - // return *this The a new copy of source. - Int_t i; + // Inputs: + // AliITSgeom &source The AliITSgeom class with which to make this + // a copy of. + // Outputs: + // none. + // Return: + // *this The a new copy of source. + Int_t i; - if(this == &source) return *this; // don't assign to ones self. + if(this == &source) return *this; // don't assign to ones self. - // if there is an old structure allocated delete it first. - if(this->fGm != 0){ - for(i=0;ifNmodules;i++) delete this->fGm->At(i); - delete this->fGm; - } // end if fGm != 0 - if(fNlad != 0) delete[] fNlad; - if(fNdet != 0) delete[] fNdet; + // if there is an old structure allocated delete it first. + this->fGm.Clear(); + this->fShape.Clear(); - this->fTrans = source.fTrans; - this->fNmodules = source.fNmodules; - this->fNlayers = source.fNlayers; - this->fNlad = new Int_t[fNlayers]; - for(i=0;ifNlayers;i++) this->fNlad[i] = source.fNlad[i]; - this->fNdet = new Int_t[fNlayers]; - for(i=0;ifNlayers;i++) this->fNdet[i] = source.fNdet[i]; - this->fShape = new TObjArray(*(source.fShape));//This does not make a proper copy. - this->fGm = new TObjArray(this->fNmodules,0); - for(i=0;ifNmodules;i++){ - this->fGm->AddAt(new AliITSgeomMatrix(*( - (AliITSgeomMatrix*)(source.fGm->At(i)))),i); - } // end for i - return *this; + this->fVersion = source.fVersion; + this->fTrans = source.fTrans; + this->fNmodules = source.fNmodules; + this->fNlayers = source.fNlayers; + this->fNlad.Set(fNlayers,source.fNlad.GetArray()); + this->fNdet.Set(fNlayers,source.fNdet.GetArray()); + this->fShape.Expand(source.fShape.GetEntriesFast()); + for(i=0;ifShape.AddAt(new TObject(*(source.fShape.At(i))),i); + this->fShape.SetOwner(kTRUE); + this->fGm.Expand(this->fNmodules); + this->fGm.SetOwner(kTRUE); + for(i=0;ifNmodules;i++) + if(i<0||i>=fGm.GetSize()){ + Error("ReadNewFile","i<0||i>=fGm.GetSize()=%d", + i,fGm.GetSize()); + return *this; + } // end if + this->fGm.AddAt(new TObject(*(source.fGm.At(i))),i); + return *this; } //______________________________________________________________________ Int_t AliITSgeom::GetModuleIndex(Int_t lay,Int_t lad,Int_t det){ @@ -593,12 +682,14 @@ Int_t AliITSgeom::GetModuleIndex(Int_t lay,Int_t lad,Int_t det){ // ladder, and detector numbers. The number of ladders and detectors // per layer is determined when this geometry package is constructed, // see AliITSgeom(const char *filename) for specifics. - // Inputs are: - // Int_t lay The layer number. Starting from 1. - // Int_t lad The ladder number. Starting from 1. - // Int_t det The detector number. Starting from 1. - // Outputs are: - // return the module index number, starting from zero. + // Inputs: + // Int_t lay The layer number. Starting from 1. + // Int_t lad The ladder number. Starting from 1. + // Int_t det The detector number. Starting from 1. + // Outputs: + // none. + // Return: + // the module index number, starting from zero. Int_t i,j,k,id[3]; i = fNdet[lay-1] * (lad-1) + det - 1; @@ -610,8 +701,8 @@ Int_t AliITSgeom::GetModuleIndex(Int_t lay,Int_t lad,Int_t det){ if(id[0]==lay&&id[1]==lad&&id[2]==det) return i; // Array of modules fGm is not in expected order. Search for this index for(i=0;iGetIndex(id); - if(id[0]==lay&&id[1]==lad&&id[2]==det) return i; + GetGeomMatrix(i)->GetIndex(id); + if(id[0]==lay&&id[1]==lad&&id[2]==det) return i; } // end for i // This layer ladder and detector combination does not exist return -1. return -1; @@ -622,26 +713,25 @@ void AliITSgeom::GetModuleId(Int_t index,Int_t &lay,Int_t &lad,Int_t &det){ // given the module index number. The number of ladders and detectors // per layer is determined when this geometry package is constructed, // see AliITSgeom(const char *filename) for specifics. - // Inputs are: - // Int_t index The module index number, starting from zero. - // Outputs are: - // Int_t lay The layer number. Starting from 1. - // Int_t lad The ladder number. Starting from 1. - // Int_t det The detector number. Starting from 1. + // Inputs: + // Int_t index The module index number, starting from zero. + // Outputs: + // Int_t lay The layer number. Starting from 1. + // Int_t lad The ladder number. Starting from 1. + // Int_t det The detector number. Starting from 1. + // Return: + // none. Int_t id[3]; AliITSgeomMatrix *g = GetGeomMatrix(index); - if (g == 0x0) - { - Error("GetModuleId","Can not get GeoMatrix for index = %d",index); - lay = -1; lad = -1; det = -1; - } - else - { - g->GetIndex(id); - lay = id[0]; lad = id[1]; det = id[2]; - } - return; + if (g == 0x0){ + Error("GetModuleId","Can not get GeoMatrix for index = %d",index); + lay = -1; lad = -1; det = -1; + }else{ + g->GetIndex(id); + lay = id[0]; lad = id[1]; det = id[2]; + }// End if + return; // The old way kept for posterity. /* Int_t i,j,k; @@ -663,28 +753,94 @@ void AliITSgeom::GetModuleId(Int_t index,Int_t &lay,Int_t &lad,Int_t &det){ */ } //______________________________________________________________________ +Int_t AliITSgeom::GetNDetTypes(Int_t &max){ + // Finds and returns the number of detector types used and the + // maximum detector type value. Only counts id >=0 (no undefined + // values. See AliITSgeom.h for list of AliITSDetecor enumerated types. + // Inputs: + // none. + // Outputs: + // The maximum detector type used + // Return: + // The number of detector types used + Int_t i,*n,id; + + max = -1; + for(i=0;imax) max=id; + } // end for i + n = new Int_t[max+1]; + for(i=0;i-1)n[id]++; // note id=-1 => undefined. + } // end for i + id = 0; + for(i=0;i=0 (no undefined + // values. See AliITSgeom.h for list of AliITSDetecor enumerated types. + // Inputs: + // none. + // Outputs: + // The maximum detector type used + // Return: + // The number of detector types used + Int_t i,j,*n,id,max; + + max = -1; + for(i=0;imax) max=id; + } // end for i + n = new Int_t[max+1]; + for(i=0;i-1)n[id]++; // note id=-1 => undefined. + } // end for i + id = 0; + for(i=0;i<=max;i++) if(n[i]!=0) id++; + maxs.Set(id); + j = 0; + for(i=0;i<=max;i++) if(n[i]!=0){ + maxs[j] = n[i]; + types[j++] = (AliITSDetector) i; + } // end for i/end if + delete[] n; + return id; +} +//______________________________________________________________________ Int_t AliITSgeom::GetStartDet(Int_t dtype){ // returns the starting module index value for a give type of detector id. // This assumes that the detector types are different on different layers // and that they are not mixed up. - // Inputs are: - // Int_t dtype A detector type number. 0 for SPD, 1 for SDD, and 2 for SSD. - // outputs: - // return the module index for the first occurance of that detector type. + // Inputs: + // Int_t dtype A detector type number. 0 for SPD, 1 for SDD, and 2 for SSD. + // Outputs: + // none. + // Return: + // the module index for the first occurrence of that detector type. switch(dtype){ case 0: - return GetModuleIndex(1,1,1); - break; + return GetModuleIndex(1,1,1); + break; case 1: - return GetModuleIndex(3,1,1); - break; + return GetModuleIndex(3,1,1); + break; case 2: - return GetModuleIndex(5,1,1); - break; + return GetModuleIndex(5,1,1); + break; default: - Warning("GetStartDet","undefined detector type %d",dtype); - return 0; + Warning("GetStartDet","undefined detector type %d",dtype); + return 0; } // end switch Warning("GetStartDet","undefined detector type %d",dtype); @@ -695,24 +851,25 @@ Int_t AliITSgeom::GetLastDet(Int_t dtype){ // returns the last module index value for a give type of detector id. // This assumes that the detector types are different on different layers // and that they are not mixed up. - // Inputs are: - // Int_t dtype A detector type number. 0 for SPD, 1 for SDD, and 2 for SSD. - // outputs are: - // return the module index for the last occurance of that detector type. + // Inputs: + // Int_t dtype A detector type number. 0 for SPD, 1 for SDD, and 2 for SSD. + // Outputs: + // Return: + // the module index for the last occurrence of that detector type. switch(dtype){ case 0: - return GetLastSPD(); - break; + return GetLastSPD(); + break; case 1: - return GetLastSDD(); - break; + return GetLastSDD(); + break; case 2: - return GetLastSSD(); - break; + return GetLastSSD(); + break; default: - Warning("GetLastDet","undefined detector type %d",dtype); - return 0; + Warning("GetLastDet","undefined detector type %d",dtype); + return 0; } // end switch Warning("GetLastDet","undefined detector type %d",dtype); @@ -722,7 +879,7 @@ Int_t AliITSgeom::GetLastDet(Int_t dtype){ void AliITSgeom::PrintComparison(FILE *fp,AliITSgeom *other){ // This function was primarily created for diagnostic reasons. It // print to a file pointed to by the file pointer fp the difference - // between two AliITSgeom classes. The format of the file is basicly, + // between two AliITSgeom classes. The format of the file is basically, // define d? to be the difference between the same element of the two // classes. For example dfrx = this->GetGeomMatrix(i)->frx // - other->GetGeomMatrix(i)->frx. @@ -737,52 +894,54 @@ void AliITSgeom::PrintComparison(FILE *fp,AliITSgeom *other){ // printed out and it is usually easier to read them in some nice editor // rather than zooming quickly past you on a screen. fprintf is used to // do the printing. The fShapeIndex difference is not printed at this time. - // Inputs are: - // FILE *fp A file pointer to an opened file for writing in which - // the results of the comparison will be written. - // AliITSgeom *other The other AliITSgeom class to which this one is - // being compared. - // outputs are: - // none + // Inputs: + // FILE *fp A file pointer to an opened file for writing in which + // the results of the comparison will be written. + // AliITSgeom *other The other AliITSgeom class to which this one is + // being compared. + // Outputs: + // none. + // Return: + // none. Int_t i,j,idt[3],ido[3]; Double_t tt[3],to[3]; // translation Double_t rt[3],ro[3]; // phi in radians - Double_t mt[3][3],mo[3][3]; // matrixes + Double_t mt[3][3],mo[3][3]; // matrices AliITSgeomMatrix *gt,*go; Bool_t t; for(i=0;ifNmodules;i++){ - gt = this->GetGeomMatrix(i); - go = other->GetGeomMatrix(i); - gt->GetIndex(idt); - go->GetIndex(ido); - t = kFALSE; - for(i=0;i<3;i++) t = t&&idt[i]!=ido[i]; - if(t) fprintf(fp,"%4.4d %1.1d %2.2d %2.2d %1.1d %2.2d %2.2d\n",i, - idt[0],idt[1],idt[2],ido[0],ido[1],ido[2]); - gt->GetTranslation(tt); - go->GetTranslation(to); - gt->GetAngles(rt); - go->GetAngles(ro); - t = kFALSE; - for(i=0;i<3;i++) t = t&&tt[i]!=to[i]; - if(t) fprintf(fp,"%1.1d %2.2d %2.2d dTrans=%f %f %f drot=%f %f %f\n", - idt[0],idt[1],idt[2], - tt[0]-to[0],tt[1]-to[1],tt[2]-to[2], - rt[0]-ro[0],rt[1]-ro[1],rt[2]-ro[2]); - t = kFALSE; - gt->GetMatrix(mt); - go->GetMatrix(mo); - for(i=0;i<3;i++)for(j=0;j<3;j++) t = mt[i][j] != mo[i][j]; - if(t){ - fprintf(fp,"%1.1d %2.2d %2.2d dfr= %e %e %e\n", - idt[0],idt[1],idt[2], - mt[0][0]-mo[0][0],mt[0][1]-mo[0][1],mt[0][2]-mo[0][2]); - fprintf(fp," dfr= %e %e %e\n", - mt[1][0]-mo[1][0],mt[1][1]-mo[1][1],mt[1][2]-mo[1][2]); - fprintf(fp," dfr= %e %e %e\n", - mt[2][0]-mo[2][0],mt[2][1]-mo[2][1],mt[2][2]-mo[2][2]); - } // end if t + gt = this->GetGeomMatrix(i); + go = other->GetGeomMatrix(i); + gt->GetIndex(idt); + go->GetIndex(ido); + t = kFALSE; + for(i=0;i<3;i++) t = t&&idt[i]!=ido[i]; + if(t) fprintf(fp,"%4.4d %1.1d %2.2d %2.2d %1.1d %2.2d %2.2d\n",i, + idt[0],idt[1],idt[2],ido[0],ido[1],ido[2]); + gt->GetTranslation(tt); + go->GetTranslation(to); + gt->GetAngles(rt); + go->GetAngles(ro); + t = kFALSE; + for(i=0;i<3;i++) t = t&&tt[i]!=to[i]; + if(t) fprintf(fp,"%1.1d %2.2d %2.2d dTrans=%f %f %f drot=%f %f %f\n", + idt[0],idt[1],idt[2], + tt[0]-to[0],tt[1]-to[1],tt[2]-to[2], + rt[0]-ro[0],rt[1]-ro[1],rt[2]-ro[2]); + t = kFALSE; + gt->GetMatrix(mt); + go->GetMatrix(mo); + for(i=0;i<3;i++)for(j=0;j<3;j++) t = mt[i][j] != mo[i][j]; + if(t){ + fprintf(fp,"%1.1d %2.2d %2.2d dfr= %e %e %e\n", + idt[0],idt[1],idt[2], + mt[0][0]-mo[0][0],mt[0][1]-mo[0][1],mt[0][2]-mo[0][2]); + fprintf(fp," dfr= %e %e %e\n", + mt[1][0]-mo[1][0],mt[1][1]-mo[1][1],mt[1][2]-mo[1][2]); + fprintf(fp," dfr= %e %e %e\n", + mt[2][0]-mo[2][0],mt[2][1]-mo[2][1],mt[2][2]-mo[2][2]); + } // end if t } // end for i return; } @@ -800,14 +959,16 @@ void AliITSgeom::PrintData(FILE *fp,Int_t lay,Int_t lad,Int_t det){ // By indicating which detector, some control over the information // is given to the user. The output it written to the file pointed // to by the file pointer fp. This can be set to stdout if you want. - // Inputs are: - // FILE *fp A file pointer to an opened file for writing in which - // the results of the comparison will be written. - // Int_t lay The layer number. Starting from 1. - // Int_t lad The ladder number. Starting from 1. - // Int_t det The detector number. Starting from 1. - // outputs are: - // none + // Inputs: + // FILE *fp A file pointer to an opened file for writing in which + // the results of the comparison will be written. + // Int_t lay The layer number. Starting from 1. + // Int_t lad The ladder number. Starting from 1. + // Int_t det The detector number. Starting from 1. + // Outputs: + // none + // Return: + // none. AliITSgeomMatrix *gt; Double_t t[3],r[3],m[3][3]; @@ -815,8 +976,8 @@ void AliITSgeom::PrintData(FILE *fp,Int_t lay,Int_t lad,Int_t det){ gt->GetTranslation(t); gt->GetAngles(r); fprintf(fp,"%1.1d %2.2d %2.2d Trans=%f %f %f rot=%f %f %f Shape=%d\n", - lay,lad,det,t[0],t[1],t[2],r[0],r[1],r[2], - gt->GetDetectorIndex()); + lay,lad,det,t[0],t[1],t[2],r[0],r[1],r[2], + gt->GetDetectorIndex()); gt->GetMatrix(m); fprintf(fp," dfr= %e %e %e\n",m[0][0],m[0][1],m[0][2]); fprintf(fp," dfr= %e %e %e\n",m[1][0],m[1][1],m[1][2]); @@ -826,11 +987,13 @@ void AliITSgeom::PrintData(FILE *fp,Int_t lay,Int_t lad,Int_t det){ //______________________________________________________________________ ofstream & AliITSgeom::PrintGeom(ofstream &rb){ // Stream out an object of class AliITSgeom to standard output. - // Intputs are: - // ofstream &rb The output streaming buffer. - // Outputs are: - // ofstream &rb The output streaming buffer. - Int_t i; + // Intputs: + // ofstream &rb The output streaming buffer. + // Outputs: + // none. + // Return: + // ofstream &rb The output streaming buffer. + Int_t i,nshapes; rb.setf(ios::scientific); rb << fTrans << " "; @@ -839,85 +1002,90 @@ ofstream & AliITSgeom::PrintGeom(ofstream &rb){ for(i=0;iGetEntries()<GetEntries();i++) if(fShape->At(i)!=0) switch (i){ + nshapes = fShape.GetEntries(); + rb << nshapes <At(kSPD)); - break; + rb << kSPD <<","<< (AliITSgeomSPD*)(fShape.At(kSPD)); + break; case kSDD: - rb << kSDD <<","<< (AliITSgeomSDD*)(fShape->At(kSDD)); - break; + rb << kSDD <<","<< (AliITSgeomSDD*)(fShape.At(kSDD)); + break; case kSSD: - rb << kSSD <<","<< (AliITSgeomSSD*)(fShape->At(kSSD)); - break; + rb << kSSD <<","<< (AliITSgeomSSD*)(fShape.At(kSSD)); + break; case kSSDp: - rb << kSSDp <<","<< (AliITSgeomSSD*)(fShape->At(kSSDp)); - break; + rb << kSSDp <<","<< (AliITSgeomSSD*)(fShape.At(kSSDp)); + break; case kSDDp: - rb << kSDDp <<","<< (AliITSgeomSDD*)(fShape->At(kSDDp)); - break; + rb << kSDDp <<","<< (AliITSgeomSDD*)(fShape.At(kSDDp)); + break; } // end for i / switch return rb; } //______________________________________________________________________ ifstream & AliITSgeom::ReadGeom(ifstream &rb){ // Stream in an object of class AliITSgeom from standard input. - // Intputs are: - // ifstream &rb The input streaming buffer. - // Outputs are: - // ifstream &rb The input streaming buffer. + // Intputs: + // ifstream &rb The input streaming buffer. + // Outputs: + // none. + // Return: + // ifstream &rb The input streaming buffer. Int_t i,j; - fNlad = new Int_t[fNlayers]; - fNdet = new Int_t[fNlayers]; - if(fGm!=0){ - for(i=0;i> fTrans >> fNmodules >> fNlayers; - fNlad = new Int_t[fNlayers]; - fNdet = new Int_t[fNlayers]; + fNlad.Set(fNlayers); + fNdet.Set(fNlayers); for(i=0;i> fNlad[i]; for(i=0;i> fNdet[i]; - fGm = new TObjArray(fNmodules,0); + fGm.Expand(fNmodules); + fGm.SetOwner(kTRUE); for(i=0;iAddAt(new AliITSgeomMatrix,i); - rb >> *(GetGeomMatrix(i)); + if(i<0||i>=fGm.GetSize()){ + Error("ReadGeom","i<0||i>=fGm.GetSize()=%d", + i,fGm.GetSize()); + return rb; + } // end if + fGm.AddAt(new AliITSgeomMatrix,i); + rb >> *(GetGeomMatrix(i)); } // end for i rb >> i; - fShape = new TObjArray(i); - for(i=0;iGetEntries();i++) { - rb >> j; - switch (j){ - case kSPD:{ - AliITSgeomSPD *s = new AliITSgeomSPD(); - rb >> *s; - fShape->AddAt(s,kSPD);} - break; - case kSDD:{ - AliITSgeomSDD *s = new AliITSgeomSDD(); - rb >> *s; - fShape->AddAt(s,kSDD);} - break; - case kSSD:{ - AliITSgeomSSD *s = new AliITSgeomSSD(); - rb >> *s; - fShape->AddAt(s,kSSD);} - break; - case kSSDp:{ - AliITSgeomSSD *s = new AliITSgeomSSD(); - rb >> *s; - fShape->AddAt(s,kSSDp);} - break; - case kSDDp:{ - AliITSgeomSDD *s = new AliITSgeomSDD(); - rb >> *s; - fShape->AddAt(s,kSDDp);} - break; - } // end switch + fShape.Expand(i); + fShape.SetOwner(kTRUE); + for(i=0;i> j; + switch (j){ + case kSPD:{ + AliITSgeomSPD *s = new AliITSgeomSPD(); + rb >> *s; + fShape.AddAt(s,kSPD);} + break; + case kSDD:{ + AliITSgeomSDD *s = new AliITSgeomSDD(); + rb >> *s; + fShape.AddAt(s,kSDD);} + break; + case kSSD:{ + AliITSgeomSSD *s = new AliITSgeomSSD(); + rb >> *s; + fShape.AddAt(s,kSSD);} + break; + case kSSDp:{ + AliITSgeomSSD *s = new AliITSgeomSSD(); + rb >> *s; + fShape.AddAt(s,kSSDp);} + break; + case kSDDp:{ + AliITSgeomSDD *s = new AliITSgeomSDD(); + rb >> *s; + fShape.AddAt(s,kSDDp);} + break; + } // end switch } // end for i return rb; } @@ -942,28 +1110,30 @@ void AliITSgeom::GlobalChange(const Float_t *tran,const Float_t *rot){ // A change in the angles will result in the inclination of the ITS with // respect to the beam line, except for an effective rotation about the // beam axis which will just rotate the ITS as a hole about the beam axis. - // Intputs are: - // Float_t *tran A 3 element array representing the global translations. - // the elements are x,y,z in cm. - // Float_t *rot A 3 element array representing the global rotation - // angles about the three axis x,y,z in radians - // Outputs are: - // none. + // Intputs: + // Float_t *tran A 3 element array representing the global translations. + // the elements are x,y,z in cm. + // Float_t *rot A 3 element array representing the global rotation + // angles about the three axis x,y,z in radians + // Outputs: + // none. + // Return: + // none. Int_t i,j; Double_t t[3],r[3]; AliITSgeomMatrix *g; fTrans = (fTrans && 0xfffd) + 2; // set bit 1 true. for(i=0;iGetGeomMatrix(i); - g->GetTranslation(t); - g->GetAngles(r); - for(j=0;j<3;j++){ - t[j] += tran[j]; - r[j] += rot[j]; - } // end for j - g->SetTranslation(t); - g->SetAngles(r); + g = this->GetGeomMatrix(i); + g->GetTranslation(t); + g->GetAngles(r); + for(j=0;j<3;j++){ + t[j] += tran[j]; + r[j] += rot[j]; + } // end for j + g->SetTranslation(t); + g->SetAngles(r); } // end for i return; } @@ -989,36 +1159,38 @@ void AliITSgeom::GlobalCylindericalChange(const Float_t *tran, // will result in the inclination of the ITS with respect to the beam // line, except for an effective rotation about the beam axis which will // just rotate the ITS as a hole about the beam axis. - // Intputs are: - // Float_t *tran A 3 element array representing the global translations. - // the elements are r,theta,z in cm/radians. - // Float_t *rot A 3 element array representing the global rotation - // angles about the three axis x,y,z in radians - // Outputs are: - // none. + // Intputs: + // Float_t *tran A 3 element array representing the global translations. + // the elements are r,theta,z in cm/radians. + // Float_t *rot A 3 element array representing the global rotation + // angles about the three axis x,y,z in radians + // Outputs: + // none. + // Return: + // none. Int_t i,j; Double_t t[3],ro[3],r,r0,phi,rphi; AliITSgeomMatrix *g; fTrans = (fTrans && 0xfffd) + 2; // set bit 1 true. for(i=0;iGetGeomMatrix(i); - g->GetTranslation(t); - g->GetAngles(ro); - r = r0= TMath::Hypot(t[1],t[0]); - phi = TMath::ATan2(t[1],t[0]); - rphi = r0*phi; - r += tran[0]; - rphi += tran[1]; - phi = rphi/r0; - t[0] = r*TMath::Cos(phi); - t[1] = r*TMath::Sin(phi); - t[2] += tran[2]; - for(j=0;j<3;j++){ - ro[j] += rot[j]; - } // end for j - g->SetTranslation(t); - g->SetAngles(ro); + g = this->GetGeomMatrix(i); + g->GetTranslation(t); + g->GetAngles(ro); + r = r0= TMath::Hypot(t[1],t[0]); + phi = TMath::ATan2(t[1],t[0]); + rphi = r0*phi; + r += tran[0]; + rphi += tran[1]; + phi = rphi/r0; + t[0] = r*TMath::Cos(phi); + t[1] = r*TMath::Sin(phi); + t[2] += tran[2]; + for(j=0;j<3;j++){ + ro[j] += rot[j]; + } // end for j + g->SetTranslation(t); + g->SetAngles(ro); } // end for i return; } @@ -1030,28 +1202,30 @@ void AliITSgeom::RandomChange(const Float_t *stran,const Float_t *srot){ // is determined by the three element array stran, for the // x y and z translations, and the three element array srot, // for the three rotation about the axis x y and z. - // Intputs are: - // Float_t *stran A 3 element array representing the global translations - // variances. The elements are x,y,z in cm. - // Float_t *srot A 3 element array representing the global rotation - // angles variances about the three axis x,y,z in radians. - // Outputs are: - // none. + // Intputs: + // Float_t *stran A 3 element array representing the global translations + // variances. The elements are x,y,z in cm. + // Float_t *srot A 3 element array representing the global rotation + // angles variances about the three axis x,y,z in radians. + // Outputs: + // none. + // Return: + // none. Int_t i,j; Double_t t[3],r[3]; AliITSgeomMatrix *g; fTrans = (fTrans && 0xfffd) + 2; // set bit 1 true. for(i=0;iGetGeomMatrix(i); - g->GetTranslation(t); - g->GetAngles(r); - for(j=0;j<3;j++){ - t[j] += gRandom->Gaus(0.0,stran[j]); - r[j] += gRandom->Gaus(0.0, srot[j]); - } // end for j - g->SetTranslation(t); - g->SetAngles(r); + g = this->GetGeomMatrix(i); + g->GetTranslation(t); + g->GetAngles(r); + for(j=0;j<3;j++){ + t[j] += gRandom->Gaus(0.0,stran[j]); + r[j] += gRandom->Gaus(0.0, srot[j]); + } // end for j + g->SetTranslation(t); + g->SetAngles(r); } // end for i return; } @@ -1066,13 +1240,15 @@ void AliITSgeom::RandomCylindericalChange(const Float_t *stran, // for the three rotation about the axis x y and z. This random change // in detector position allow for the simulation of a random uncertainty // in the detector positions of the ITS. - // Intputs are: - // Float_t *stran A 3 element array representing the global translations - // variances. The elements are r,theta,z in cm/readians. - // Float_t *srot A 3 element array representing the global rotation - // angles variances about the three axis x,y,z in radians. - // Outputs are: - // none. + // Intputs: + // Float_t *stran A 3 element array representing the global translations + // variances. The elements are r,theta,z in cm/radians. + // Float_t *srot A 3 element array representing the global rotation + // angles variances about the three axis x,y,z in radians. + // Outputs: + // none. + // Return: + // none. Int_t i,j; Double_t t[3],ro[3],r,r0,phi,rphi; TRandom ran; @@ -1080,23 +1256,23 @@ void AliITSgeom::RandomCylindericalChange(const Float_t *stran, fTrans = (fTrans && 0xfffd) + 2; // set bit 1 true. for(i=0;iGetGeomMatrix(i); - g->GetTranslation(t); - g->GetAngles(ro); - r = r0= TMath::Hypot(t[1],t[0]); - phi = TMath::ATan2(t[1],t[0]); - rphi = r0*phi; - r += ran.Gaus(0.0,stran[0]); - rphi += ran.Gaus(0.0,stran[1]); - phi = rphi/r0; - t[0] = r*TMath::Cos(phi); - t[1] = r*TMath::Sin(phi); - t[2] += ran.Gaus(0.0,stran[2]); - for(j=0;j<3;j++){ - ro[j] += ran.Gaus(0.0, srot[j]); - } // end for j - g->SetTranslation(t); - g->SetAngles(ro); + g = this->GetGeomMatrix(i); + g->GetTranslation(t); + g->GetAngles(ro); + r = r0= TMath::Hypot(t[1],t[0]); + phi = TMath::ATan2(t[1],t[0]); + rphi = r0*phi; + r += ran.Gaus(0.0,stran[0]); + rphi += ran.Gaus(0.0,stran[1]); + phi = rphi/r0; + t[0] = r*TMath::Cos(phi); + t[1] = r*TMath::Sin(phi); + t[2] += ran.Gaus(0.0,stran[2]); + for(j=0;j<3;j++){ + ro[j] += ran.Gaus(0.0, srot[j]); + } // end for j + g->SetTranslation(t); + g->SetAngles(ro); } // end for i return; } @@ -1109,16 +1285,18 @@ void AliITSgeom::GeantToTracking(AliITSgeom &source){ // ALICE ITS geometry. For tracking the Z axis is left alone but X-> -Y // and Y-> X such that X always points out of the ITS cylinder for every // layer including layer 1 (where the detectors are mounted upside down). - // Inputs are: - // AliITSgeom &source The AliITSgeom class with which to make this - // a copy of. - // Outputs are: - // return *this The a new copy of source. //Begin_Html /* */ //End_Html + // Input: + // AliITSgeom &source The AliITSgeom class with which to make this + // a copy of. + // Output: + // none. + // Return: + // none. Int_t i,j,k,l,id[3]; Double_t r0[3][3],r1[3][3]; Double_t a0[3][3] = {{0.,+1.,0.},{-1.,0.,0.},{0.,0.,+1.}}; @@ -1126,20 +1304,20 @@ void AliITSgeom::GeantToTracking(AliITSgeom &source){ *this = source; // copy everything for(i=0;iGetIndex(id); - GetGeomMatrix(i)->GetMatrix(r0); - if(id[0]==1){ // Layer 1 is treated different from the others. - for(j=0;j<3;j++) for(k=0;k<3;k++){ - r1[j][k] = 0.; - for(l=0;l<3;l++) r1[j][k] += a0[j][l]*r0[l][k]; - } // end for j,k - }else{ - for(j=0;j<3;j++) for(k=0;k<3;k++){ - r1[j][k] = 0.; - for(l=0;l<3;l++) r1[j][k] += a1[j][l]*r0[l][k]; - } // end for j,k - } // end if - GetGeomMatrix(i)->SetMatrix(r1); + GetGeomMatrix(i)->GetIndex(id); + GetGeomMatrix(i)->GetMatrix(r0); + if(id[0]==1){ // Layer 1 is treated different from the others. + for(j=0;j<3;j++) for(k=0;k<3;k++){ + r1[j][k] = 0.; + for(l=0;l<3;l++) r1[j][k] += a0[j][l]*r0[l][k]; + } // end for j,k + }else{ + for(j=0;j<3;j++) for(k=0;k<3;k++){ + r1[j][k] = 0.; + for(l=0;l<3;l++) r1[j][k] += a1[j][l]*r0[l][k]; + } // end for j,k + } // end if + GetGeomMatrix(i)->SetMatrix(r1); } // end for i this->fTrans = (this->fTrans && 0xfffe) + 1; // set bit 0 true. return; @@ -1149,23 +1327,25 @@ Int_t AliITSgeom::GetNearest(const Double_t g[3],Int_t lay){ // Finds the Detector (Module) that is nearest the point g [cm] in // ALICE Global coordinates. If layer !=0 then the search is restricted // to Detectors (Modules) in that particular layer. - // Inputs are: - // Double_t g[3] The ALICE Cartesean global coordinate from which the - // distance is to be calculated with. - // Int_t lay The layer to restrict the search to. If layer=0 then - // all layers are searched. Default is lay=0. - // Outputs are: - // return The module number representing the nearest module. + // Inputs: + // Double_t g[3] The ALICE Cartesian global coordinate from which the + // distance is to be calculated with. + // Int_t lay The layer to restrict the search to. If layer=0 then + // all layers are searched. Default is lay=0. + // Output: + // none. + // Return: + // The module number representing the nearest module. Int_t i,l,a,e,in=0; Double_t d,dn=1.0e10; Bool_t t=lay!=0; // skip if lay = 0 default value check all layers. for(i=0;iDistance2(g))Distance2(g))Distance2(g); - if(da;e--){dn[e] = dn[e-1];in[e] = in[e-1];} - dn[a] = d; in[a] = i; - } // end if dDistance2(g); + if(da;e--){dn[e] = dn[e-1];in[e] = in[e-1];} + dn[a] = d; in[a] = i; + } // end if dGetDx(); + dl[1] = ((AliITSgeomSPD*)GetShape(i))->GetDy(); + dl[2] = ((AliITSgeomSPD*)GetShape(i))->GetDz(); + } break; + case 1: case 4:{ + dl[0] = ((AliITSgeomSDD*)GetShape(i))->GetDx(); + dl[1] = ((AliITSgeomSDD*)GetShape(i))->GetDy(); + dl[2] = ((AliITSgeomSDD*)GetShape(i))->GetDz(); + } break; + case 2: case 3:{ + dl[0] = ((AliITSgeomSSD*)GetShape(i))->GetDx(); + dl[1] = ((AliITSgeomSSD*)GetShape(i))->GetDy(); + dl[2] = ((AliITSgeomSSD*)GetShape(i))->GetDz(); + } break; + }// end switch. + } // end of + n++; + GetTransCyln(i,t); + rp = t[0]; + r += rp; + if(rmin>rp) rmin = rp; + if(rmax3) l[2] = -dl[2]; + LtoG(i,l,t); + rp = TMath::Sqrt(t[0]*t[0]+t[1]*t[1]); + if(rmin>rp) rmin = rp; + if(rmax #include #include +#include +#include +class TArrayI; #include "AliITSgeomMatrix.h" @@ -33,20 +36,23 @@ class AliITSgeom : public TObject { public: AliITSgeom(); // Default constructor AliITSgeom(const char *filename); // Constructor - AliITSgeom(Int_t itype,Int_t nlayers,Int_t *nlads,Int_t *ndets, - Int_t nmods); // Constructor + AliITSgeom(Int_t itype,Int_t nlayers,const Int_t *nlads,const Int_t *ndets, + Int_t nmods); // Constructor AliITSgeom(const AliITSgeom &source); // Copy constructor AliITSgeom& operator=(const AliITSgeom &source);// = operator virtual ~AliITSgeom(); // Default destructor + // Zero and reinitilizes this class. + void Init(Int_t itype,Int_t nlayers,const Int_t *nlads, + const Int_t *ndets,Int_t mods); // this function allocates a AliITSgeomMatrix for a particular module. - void CreatMatrix(Int_t mod,Int_t lay,Int_t lad,Int_t det, - AliITSDetector idet,const Double_t tran[3], - const Double_t rot[10]); + void CreateMatrix(Int_t mod,Int_t lay,Int_t lad,Int_t det, + AliITSDetector idet,const Double_t tran[3], + const Double_t rot[10]); void ReadNewFile(const char *filename); // Constructor for new format. void WriteNewFile(const char *filename); // Output for new format. -// Getters + // Getters Int_t GetTransformationType() const {return fTrans;} -// + // // returns kTRUE if the transformation defined by this class is // for Global GEANT coordinate system to the local GEANT coordinate system // of the detector. These are the transformation used by GEANT. @@ -63,14 +69,22 @@ class AliITSgeom : public TObject { Bool_t IsGeantToDisplaced() const {return ((fTrans&&0xfffd)!= 0);} // returns kTRUE if the shape defined by ishape has been defined in this // set of transformations. Typical values of ishape are kSPD, kSDD, kSSD, - // SSD2. + // kSSD2. Bool_t IsShapeDefined(Int_t ishape)const { - if(fShape!=0){return ((fShape->At(ishape))!=0);}else return kFALSE;} -// + return ((fShape.At(ishape))!=0);} + // // This function returns a pointer to the particular AliITSgeomMatrix // class for a specific module index. - AliITSgeomMatrix *GetGeomMatrix(Int_t index){ - return (AliITSgeomMatrix*)(fGm->At(index));} + AliITSgeomMatrix *GetGeomMatrix(Int_t index){if(index=0) + return (AliITSgeomMatrix*)(fGm.At(index));else Error("GetGeomMatrix","index=%d<0||>=GetSize()=%d",index,fGm.GetSize());return 0;} + // This function find and return the number of detector types only. + Int_t GetNDetTypes(){Int_t max;return GetNDetTypes(max);}; + // This function find and return the number of detector types and the + // maximum det type value. + Int_t GetNDetTypes(Int_t &max); + // This function finds and return the number of detector types and the + // and the number of each type in the TArrayI and their types. + Int_t GetNDetTypes(TArrayI &maxs,AliITSDetector *types); // This function returns the number of detectors/ladder for a give // layer. In particular it returns fNdet[layer-1]. Int_t GetNdetectors(Int_t lay) const {return fNdet[lay-1];} @@ -84,16 +98,20 @@ class AliITSgeom : public TObject { // This function returns the module index number given the layer, // ladder and detector numbers put into the array id[3]. Int_t GetModuleIndex(const Int_t *id){ - return GetModuleIndex(id[0],id[1],id[2]);} + return GetModuleIndex(id[0],id[1],id[2]);} void GetModuleId(Int_t index,Int_t &lay,Int_t &lad,Int_t &det); // Returns the detector type Int_t GetModuleType(Int_t index){ - return GetGeomMatrix(index)->GetDetectorIndex();} + return GetGeomMatrix(index)->GetDetectorIndex();} // Returns the detector type as a string - const char * GetModuleTypeName(Int_t index){switch(GetModuleType(index)) { - case kSPD: return "kSPD";case kSDD: return "kSDD";case kSSD: return "kSSD"; - case kSSDp: return"kSSDp";case kSDDp: return "kSDDp"; default: return "";}} -// + const char * GetModuleTypeName(Int_t index){ + return GetDetectorTypeName(GetModuleType(index));} + // Returns the detector type as a string + const char * GetDetectorTypeName(Int_t index){switch(index) { + case kSPD : return "kSPD" ; case kSDD : return "kSDD" ; + case kSSD : return "kSSD" ; case kSSDp: return "kSSDp"; + case kSDDp: return "kSDDp"; default : return "Undefined";};} + // Int_t GetStartDet(Int_t dtype ); Int_t GetLastDet(Int_t dtype); // Returns the starting module index number for SPD detector, @@ -122,173 +140,169 @@ class AliITSgeom : public TObject { Int_t GetLastSSD() {return GetModuleIndex(6,fNlad[5],fNdet[5]);} // Returns the last module index number. Int_t GetIndexMax() const {return fNmodules;} -// + // // This function returns the rotation angles for a give module // in the Double point array ang[3]. The angles are in radians void GetAngles(Int_t index,Double_t *ang) { - GetGeomMatrix(index)->GetAngles(ang);} + GetGeomMatrix(index)->GetAngles(ang);} // This function returns the rotation angles for a give module // in the three floating point variables provided. rx = frx, // fy = fry, rz = frz. The angles are in radians void GetAngles(Int_t index,Float_t &rx,Float_t &ry,Float_t &rz) { - Double_t a[3];GetAngles(index,a); - rx = a[0];ry = a[1];rz = a[2];} + Double_t a[3];GetAngles(index,a);rx = a[0];ry = a[1];rz = a[2];} // This function returns the rotation angles for a give detector on // a give ladder in a give layer in the three floating point variables // provided. rx = frx, fy = fry, rz = frz. The angles are in radians void GetAngles(Int_t lay,Int_t lad,Int_t det, Float_t &rx,Float_t &ry,Float_t &rz) { - GetAngles(GetModuleIndex(lay,lad,det),rx,ry,rz);} -// + GetAngles(GetModuleIndex(lay,lad,det),rx,ry,rz);} + // // This function returns the 6 GEANT rotation angles for a give // module in the double point array ang[3]. The angles are in degrees void GetGeantAngles(Int_t index,Double_t *ang){ GetGeomMatrix(index)->SixAnglesFromMatrix(ang);} -// + // // This function returns the Cartesian translation for a give // module in the Double array t[3]. The units are // those of the Monte Carlo, generally cm. void GetTrans(Int_t index,Double_t *t) { - GetGeomMatrix(index)->GetTranslation(t);} + GetGeomMatrix(index)->GetTranslation(t);} // This function returns the Cartesian translation for a give // module index in the three floating point variables provided. // x = fx0, y = fy0, z = fz0. The units are those of the Mont // Carlo, generally cm. void GetTrans(Int_t index,Float_t &x,Float_t &y,Float_t &z) { - Double_t t[3];GetTrans(index,t); - x = t[0];y = t[1];z = t[2];} + Double_t t[3];GetTrans(index,t);x = t[0];y = t[1];z = t[2];} // This function returns the Cartesian translation for a give // detector on a give ladder in a give layer in the three floating // point variables provided. x = fx0, y = fy0, z = fz0. The units are // those of the Monte Carlo, generally cm. void GetTrans(Int_t lay,Int_t lad,Int_t det, Float_t &x,Float_t &y,Float_t &z) { - GetTrans(GetModuleIndex(lay,lad,det),x,y,z);} -// + GetTrans(GetModuleIndex(lay,lad,det),x,y,z);} + // // This function returns the Cartesian translation for a give // module in the Double array t[3]. The units are // those of the Monte Carlo, generally cm. void GetTransCyln(Int_t index,Double_t *t) { - GetGeomMatrix(index)->GetTranslationCylinderical(t);} + GetGeomMatrix(index)->GetTranslationCylinderical(t);} // This function returns the Cartesian translation for a give // module index in the three floating point variables provided. // x = fx0, y = fy0, z = fz0. The units are those of the Mont // Carlo, generally cm. void GetTransCyln(Int_t index,Float_t &x,Float_t &y,Float_t &z) { - Double_t t[3];GetTransCyln(index,t); - x = t[0];y = t[1];z = t[2];} + Double_t t[3];GetTransCyln(index,t);x = t[0];y = t[1];z = t[2];} // This function returns the Cartesian translation for a give // detector on a give ladder in a give layer in the three floating // point variables provided. x = fx0, y = fy0, z = fz0. The units are // those of the Monte Carlo, generally cm. void GetTransCyln(Int_t lay,Int_t lad,Int_t det, - Float_t &x,Float_t &y,Float_t &z) { - GetTransCyln(GetModuleIndex(lay,lad,det),x,y,z);} -// + Float_t &x,Float_t &y,Float_t &z) { + GetTransCyln(GetModuleIndex(lay,lad,det),x,y,z);} + // // This function returns the Cartesian translation [cm] and the // 6 GEANT rotation angles [degrees]for a given layer ladder and // detector number, in the TVector x (at least 9 elements large). - // This function is required to be inlined for speed. + // This function is required to be in-lined for speed. void GetCenterThetaPhi(Int_t lay,Int_t lad,Int_t det,TVector &x){ - Double_t t[3],a[6];Int_t i=GetModuleIndex(lay,lad,det);GetTrans(i,t); - GetGeantAngles(i,a);x(0)=t[0];x(1)=t[1];x(2)=t[2];x(3)=a[0];x(4)=a[1]; - x(5)=a[2];x(6)=a[3];x(7)=a[4];x(8)=a[5];} -// + Double_t t[3],a[6];Int_t i=GetModuleIndex(lay,lad,det);GetTrans(i,t); + GetGeantAngles(i,a);x(0)=t[0];x(1)=t[1];x(2)=t[2];x(3)=a[0];x(4)=a[1]; + x(5)=a[2];x(6)=a[3];x(7)=a[4];x(8)=a[5];} + // // This function returns the rotation matrix in Double // precision for a given module. void GetRotMatrix(Int_t index,Double_t mat[3][3]){ - GetGeomMatrix(index)->GetMatrix(mat);} + GetGeomMatrix(index)->GetMatrix(mat);} // This function returns the rotation matrix in a Double // precision pointer for a given module. mat[i][j] => mat[3*i+j]. void GetRotMatrix(Int_t index,Double_t *mat){ - Double_t rot[3][3];GetRotMatrix(index,rot); - for(Int_t i=0;i<3;i++)for(Int_t j=0;j<3;j++) mat[3*i+j] = rot[i][j];} + Double_t rot[3][3];GetRotMatrix(index,rot); + for(Int_t i=0;i<3;i++)for(Int_t j=0;j<3;j++) mat[3*i+j] = rot[i][j];} // This function returns the rotation matrix in a floating // precision pointer for a given layer ladder and detector module. // mat[i][j] => mat[3*i+j]. - void GetRotMatrix(Int_t lay,Int_t lad,Int_t det, - Float_t *mat){GetRotMatrix(GetModuleIndex(lay,lad,det),mat);} + void GetRotMatrix(Int_t lay,Int_t lad,Int_t det,Float_t *mat){ + GetRotMatrix(GetModuleIndex(lay,lad,det),mat);} // This function returns the rotation matrix in a Double // precision pointer for a given layer ladder and detector module. // mat[i][j] => mat[3*i+j]. - void GetRotMatrix(Int_t lay,Int_t lad,Int_t det, - Double_t *mat){GetRotMatrix(GetModuleIndex(lay,lad,det),mat);} + void GetRotMatrix(Int_t lay,Int_t lad,Int_t det,Double_t *mat){ + GetRotMatrix(GetModuleIndex(lay,lad,det),mat);} // This function returns the rotation matrix in a floating // precision pointer for a given module. mat[i][j] => mat[3*i+j]. void GetRotMatrix(Int_t index,Float_t *mat){ Double_t rot[3][3]; - GetGeomMatrix(index)->GetMatrix(rot); + GetGeomMatrix(index)->GetMatrix(rot); for(Int_t i=0;i<3;i++)for(Int_t j=0;j<3;j++) mat[3*i+j] = rot[i][j];} // This function sets the rotation matrix in a Double // precision pointer for a given module. mat[i][j] => mat[3*i+j]. void SetRotMatrix(Int_t index,Double_t *mat){Double_t rot[3][3]; for(Int_t i=0;i<3;i++)for(Int_t j=0;j<3;j++) rot[i][j]=mat[3*i+j]; GetGeomMatrix(index)->SetMatrix(rot);} - -// + // // Will define fShape if it isn't already defined. - void DefineShapes(Int_t size=4) - {if(fShape==0) fShape = new TObjArray(size);else fShape->Expand(size);} + void DefineShapes(Int_t size=5){fShape.Expand(size);} + // this function returns a pointer to the array of detector + // descriptions, Segmentation. + virtual TObjArray *GetShapeArray(){return &fShape;}; // this function returns a pointer to the class describing a particular // detector type based on AliITSDetector value. This will return a pointer - // to one of the classes AliITSgeomSPD, AliITSgeomSDD, or AliITSgeomSSD, - // for example. - virtual TObject *GetShape(AliITSDetector idet) - {return fShape->At((Int_t)idet);}; + // to one of the classes AliITSgeomSPD, AliITSgeomSDD, or + // AliITSgeomSSD, for example. + virtual TObject *GetShape(AliITSDetector idet){ + return fShape.At((Int_t)idet);}; // This function returns a pointer to the class describing the // detector for a particular module index. This will return a pointer - // to one of the classes AliITSgeomSPD, AliITSgeomSDD, or AliITSgeomSSD, - // for example. + // to one of the classes AliITSgeomSPD, AliITSgeomSDD, + // or AliITSgeomSSD, for example. virtual TObject *GetShape(Int_t index){ - return fShape->At(GetGeomMatrix(index)-> - GetDetectorIndex());} + return fShape.At(GetGeomMatrix(index)->GetDetectorIndex());} // This function returns a pointer to the class describing the // detector for a particular layer ladder and detector numbers. This // will return a pointer to one of the classes AliITSgeomSPD, // AliITSgeomSDD, or AliITSgeomSSD, for example. virtual TObject *GetShape(Int_t lay,Int_t lad,Int_t det) - {return GetShape(GetModuleIndex(lay,lad,det));} -// -// Setters + {return GetShape(GetModuleIndex(lay,lad,det));} + // + // Setters // Sets the rotation angles and matrix for a give module index // via the double precision array a[3] [radians]. void SetByAngles(Int_t index,const Double_t a[]){ - GetGeomMatrix(index)->SetAngles(a);} + GetGeomMatrix(index)->SetAngles(a);} // Sets the rotation angles and matrix for a give module index // via the 3 floating precision variables rx, ry, and rz [radians]. - void SetByAngles(Int_t index, - Float_t rx, Float_t ry, Float_t rz) { - Double_t a[3];a[0] = rx;a[1] = ry;a[2] = rz; - GetGeomMatrix(index)->SetAngles(a);} + void SetByAngles(Int_t index,Float_t rx, Float_t ry, Float_t rz) { + Double_t a[3];a[0] = rx;a[1] = ry;a[2] = rz; + GetGeomMatrix(index)->SetAngles(a);} // Sets the rotation angles and matrix for a give layer, ladder, // and detector numbers via the 3 floating precision variables rx, // ry, and rz [radians]. void SetByAngles(Int_t lay,Int_t lad,Int_t det, Float_t rx, Float_t ry, Float_t rz) { - SetByAngles(GetModuleIndex(lay,lad,det),rx,ry,rz);} -// + SetByAngles(GetModuleIndex(lay,lad,det),rx,ry,rz);} + // // Sets the rotation angles and matrix for a give module index // via the Double precision array a[6] [degree]. The angles are those // defined by GEANT 3.12. void SetByGeantAngles(Int_t index,const Double_t *ang){ - GetGeomMatrix(index)->MatrixFromSixAngles(ang);} + GetGeomMatrix(index)->MatrixFromSixAngles(ang);} // Sets the rotation angles and matrix for a give layer, ladder // and detector, in the array id[3] via the Double precision array // a[6] [degree]. The angles are those defined by GEANT 3.12. void SetByGeantAngles(const Int_t *id,const Double_t *ang){ - SetByGeantAngles(GetModuleIndex(id),ang);} + SetByGeantAngles(GetModuleIndex(id),ang);} // Sets the rotation angles and matrix for a give layer, ladder // and detector, via the Double precision array a[6] [degree]. The // angles are those defined by GEANT 3.12. void SetByGeantAngles(Int_t lay,Int_t lad,Int_t det, - const Double_t *ang){ - SetByGeantAngles(GetModuleIndex(lay,lad,det),ang);} -// + const Double_t *ang){ + SetByGeantAngles(GetModuleIndex(lay,lad,det),ang);} + // // This function sets a new translation vector, given by the // array x[3], for the Cartesian coordinate transformation // for a give module index. void SetTrans(Int_t index,Double_t x[]){ - GetGeomMatrix(index)->SetTranslation(x);} + GetGeomMatrix(index)->SetTranslation(x);} // This function sets a new translation vector, given by the three // variables x, y, and z, for the Cartesian coordinate transformation // for the detector defined by layer, ladder and detector. @@ -296,321 +310,321 @@ class AliITSgeom : public TObject { Float_t x,Float_t y,Float_t z){Double_t t[3]; t[0] = x;t[1] = y;t[2] = z; SetTrans(GetModuleIndex(lay,lad,det),t);} -// + // // This function adds one more shape element to the TObjArray // fShape. It is primarily used in the constructor functions of the // AliITSgeom class. The pointer *shape can be the pointer to any // class that is derived from TObject (this is true for nearly every // ROOT class). This does not appear to be working properly at this time. - void AddShape(TObject *shp){fShape->AddLast(shp);} + void AddShape(TObject *shp){fShape.AddLast(shp);} // This function deletes an existing shape element, of type TObject, // and replaces it with the one specified. This is primarily used to - // changes the parameters to the segmentation class for a particular + // changes the parameters to the geom class for a particular // type of detector. void ReSetShape(Int_t dtype,TObject *shp){ - fShape->RemoveAt(dtype);fShape->AddAt(shp,dtype);} -// -// transformations + delete (fShape.At(dtype));fShape.AddAt(shp,dtype);} + // + // transformations // Transforms from the ALICE Global coordinate system // to the detector local coordinate system for the detector // defined by the layer, ladder, and detector numbers. The // global and local coordinate are given in two floating point // arrays g[3], and l[3]. void GtoL(Int_t lay,Int_t lad,Int_t det, - const Float_t *g,Float_t *l){ - GtoL(GetModuleIndex(lay,lad,det),g,l);} + const Float_t *g,Float_t *l){ + GtoL(GetModuleIndex(lay,lad,det),g,l);} // Transforms from the ALICE Global coordinate system // to the detector local coordinate system for the detector // defined by the id[0], id[1], and id[2] numbers. The // global and local coordinate are given in two floating point // arrays g[3], and l[3]. void GtoL(const Int_t *id,const Float_t *g,Float_t *l){ - GtoL(GetModuleIndex(id),g,l);} + GtoL(GetModuleIndex(id),g,l);} // Transforms from the ALICE Global coordinate system // to the detector local coordinate system for the detector // module index number. The global and local coordinate are // given in two floating point arrays g[3], and l[3]. void GtoL(Int_t index,const Float_t *g,Float_t *l){ - Double_t dg[3],dl[3];Int_t i;for(i=0;i<3;i++) dg[i] = g[i]; - GetGeomMatrix(index)->GtoLPosition(dg,dl); - for(i=0;i<3;i++) l[i] =dl[i];} + Double_t dg[3],dl[3];Int_t i;for(i=0;i<3;i++) dg[i] = g[i]; + GetGeomMatrix(index)->GtoLPosition(dg,dl); + for(i=0;i<3;i++) l[i] =dl[i];} // Transforms from the ALICE Global coordinate system // to the detector local coordinate system for the detector // defined by the layer, ladder, and detector numbers. The // global and local coordinate are given in two Double point // arrays g[3], and l[3]. void GtoL(Int_t lay,Int_t lad,Int_t det, - const Double_t *g,Double_t *l){ - GtoL(GetModuleIndex(lay,lad,det),g,l);} + const Double_t *g,Double_t *l){ + GtoL(GetModuleIndex(lay,lad,det),g,l);} // Transforms from the ALICE Global coordinate system // to the detector local coordinate system for the detector // defined by the id[0], id[1], and id[2] numbers. The // global and local coordinate are given in two Double point // arrays g[3], and l[3]. void GtoL(const Int_t *id,const Double_t *g,Double_t *l){ - GtoL(GetModuleIndex(id),g,l);} + GtoL(GetModuleIndex(id),g,l);} // Transforms from the ALICE Global coordinate system // to the detector local coordinate system for the detector // module index number. The global and local coordinate are // given in two Double point arrays g[3], and l[3]. void GtoL(Int_t index,const Double_t *g,Double_t *l){ - Double_t dg[3],dl[3];Int_t i;for(i=0;i<3;i++) dg[i] = g[i]; - GetGeomMatrix(index)->GtoLPosition(dg,dl); - for(i=0;i<3;i++) l[i] =dl[i];} -// + Double_t dg[3],dl[3];Int_t i;for(i=0;i<3;i++) dg[i] = g[i]; + GetGeomMatrix(index)->GtoLPosition(dg,dl); + for(i=0;i<3;i++) l[i] =dl[i];} + // // Transforms from the ALICE Global coordinate system // to the detector local coordinate system (used for ITS tracking) // for the detector module index number. The global and local // coordinate are given in two Double point arrays g[3], and l[3]. void GtoLtracking(Int_t index,const Double_t *g,Double_t *l){ - if(IsGeantToTracking()) GtoL(index,g,l); - else GetGeomMatrix(index)->GtoLPositionTracking(g,l);} + if(IsGeantToTracking()) GtoL(index,g,l); + else GetGeomMatrix(index)->GtoLPositionTracking(g,l);} // Transforms from the ALICE Global coordinate system // to the detector local coordinate system (used for ITS tracking) // for the detector id[3]. The global and local // coordinate are given in two Double point arrays g[3], and l[3]. void GtoLtracking(const Int_t *id,const Double_t *g,Double_t *l){ - GtoLtracking(GetModuleIndex(id),g,l);} + GtoLtracking(GetModuleIndex(id),g,l);} // Transforms from the ALICE Global coordinate system // to the detector local coordinate system (used for ITS tracking) // for the detector layer ladder and detector numbers. The global // and local coordinate are given in two Double point arrays g[3], // and l[3]. void GtoLtracking(Int_t lay,Int_t lad,Int_t det, - const Double_t *g,Double_t *l){ - GtoLtracking(GetModuleIndex(lay,lad,det),g,l);} -// + const Double_t *g,Double_t *l){ + GtoLtracking(GetModuleIndex(lay,lad,det),g,l);} + // // Transforms of momentum types of quantities from the ALICE // Global coordinate system to the detector local coordinate system // for the detector layer ladder and detector numbers. The global // and local coordinate are given in two float point arrays g[3], // and l[3]. void GtoLMomentum(Int_t lay,Int_t lad,Int_t det, - const Float_t *g,Float_t *l){ - GtoLMomentum(GetModuleIndex(lay,lad,det),g,l);} + const Float_t *g,Float_t *l){ + GtoLMomentum(GetModuleIndex(lay,lad,det),g,l);} // Transforms of momentum types of quantities from the ALICE // Global coordinate system to the detector local coordinate system // for the detector module index number. The global and local // coordinate are given in two float point arrays g[3], and l[3]. void GtoLMomentum(Int_t index,const Float_t *g,Float_t *l){ - Double_t dg[3],dl[3];Int_t i;for(i=0;i<3;i++) dg[i] = g[i]; - GetGeomMatrix(index)->GtoLMomentum(dg,dl); - for(i=0;i<3;i++) l[i] =dl[i];} + Double_t dg[3],dl[3];Int_t i;for(i=0;i<3;i++) dg[i] = g[i]; + GetGeomMatrix(index)->GtoLMomentum(dg,dl); + for(i=0;i<3;i++) l[i] =dl[i];} // Transforms of momentum types of quantities from the ALICE // Global coordinate system to the detector local coordinate system // for the detector layer ladder and detector numbers. The global // and local coordinate are given in two Double point arrays g[3], // and l[3]. void GtoLMomentum(Int_t lay,Int_t lad,Int_t det, - const Double_t *g,Double_t *l){ - GtoLMomentum(GetModuleIndex(lay,lad,det),g,l);} + const Double_t *g,Double_t *l){ + GtoLMomentum(GetModuleIndex(lay,lad,det),g,l);} // Transforms of momentum types of quantities from the ALICE // Global coordinate system to the detector local coordinate system // for the detector module index number. The global and local // coordinate are given in two Double point arrays g[3], and l[3]. void GtoLMomentum(Int_t index,const Double_t *g,Double_t *l){ - Double_t dg[3],dl[3];Int_t i;for(i=0;i<3;i++) dg[i] = g[i]; - GetGeomMatrix(index)->GtoLMomentum(dg,dl); - for(i=0;i<3;i++) l[i] =dl[i];} -// + Double_t dg[3],dl[3];Int_t i;for(i=0;i<3;i++) dg[i] = g[i]; + GetGeomMatrix(index)->GtoLMomentum(dg,dl); + for(i=0;i<3;i++) l[i] =dl[i];} + // // Transforms of momentum types of quantities from the ALICE // Global coordinate system to the detector local coordinate system // (used for ITS tracking) for the detector module index number. // The global and local coordinate are given in two Double point // arrays g[3], and l[3]. void GtoLMomentumTracking(Int_t index,const Double_t *g,Double_t *l){ - if(IsGeantToTracking()) GtoLMomentum(index,g,l); - else GetGeomMatrix(index)->GtoLMomentumTracking(g,l);} + if(IsGeantToTracking()) GtoLMomentum(index,g,l); + else GetGeomMatrix(index)->GtoLMomentumTracking(g,l);} // Transforms of momentum types of quantities from the ALICE // Global coordinate system to the detector local coordinate system // (used for ITS tracking) for the detector id[3]. // The global and local coordinate are given in two Double point // arrays g[3], and l[3]. void GtoLMomentumTracking(const Int_t *id,const Double_t *g,Double_t *l){ - GtoLMomentumTracking(GetModuleIndex(id),g,l);} + GtoLMomentumTracking(GetModuleIndex(id),g,l);} // Transforms of momentum types of quantities from the ALICE // Global coordinate system to the detector local coordinate system // (used for ITS tracking) for the detector layer ladder and detector // numbers. The global and local coordinate are given in two Double point // arrays g[3], and l[3]. void GtoLMomentumTracking(Int_t lay,Int_t lad,Int_t det, - const Double_t *g,Double_t *l){ - GtoLMomentumTracking(GetModuleIndex(lay,lad,det),g,l);} -// + const Double_t *g,Double_t *l){ + GtoLMomentumTracking(GetModuleIndex(lay,lad,det),g,l);} + // // Transforms from the detector local coordinate system // to the ALICE Global coordinate system for the detector // defined by the layer, ladder, and detector numbers. The // global and local coordinate are given in two floating point // arrays g[3], and l[3]. void LtoG(Int_t lay,Int_t lad,Int_t det, - const Float_t *l,Float_t *g){ - LtoG(GetModuleIndex(lay,lad,det),l,g);} + const Float_t *l,Float_t *g){ + LtoG(GetModuleIndex(lay,lad,det),l,g);} // Transforms from the detector local coordinate system // to the ALICE Global coordinate system for the detector // defined by the id[0], id[1], and id[2] numbers. The // global and local coordinate are given in two floating point // arrays g[3], and l[3]. void LtoG(const Int_t *id,const Float_t *l,Float_t *g){ - LtoG(GetModuleIndex(id),l,g);} + LtoG(GetModuleIndex(id),l,g);} // Transforms from the detector local coordinate system // to the ALICE Global coordinate system for the detector // module index number. The global and local coordinate are // given in two floating point arrays g[3], and l[3]. void LtoG(Int_t index,const Float_t *l,Float_t *g){ - Double_t dg[3],dl[3];Int_t i;for(i=0;i<3;i++) dl[i] = l[i]; - GetGeomMatrix(index)->LtoGPosition(dl,dg); - for(i=0;i<3;i++) g[i] =dg[i];} + Double_t dg[3],dl[3];Int_t i;for(i=0;i<3;i++) dl[i] = l[i]; + GetGeomMatrix(index)->LtoGPosition(dl,dg); + for(i=0;i<3;i++) g[i] =dg[i];} // Transforms from the detector local coordinate system // to the ALICE Global coordinate system for the detector // defined by the layer, ladder, and detector numbers. The // global and local coordinate are given in two Double point // arrays g[3], and l[3]. void LtoG(Int_t lay,Int_t lad,Int_t det, - const Double_t *l,Double_t *g){ - LtoG(GetModuleIndex(lay,lad,det),l,g);} + const Double_t *l,Double_t *g){ + LtoG(GetModuleIndex(lay,lad,det),l,g);} // Transforms from the detector local coordinate system // to the ALICE Global coordinate system for the detector // defined by the id[0], id[1], and id[2] numbers. The // global and local coordinate are given in two Double point // arrays g[3], and l[3]. void LtoG(const Int_t *id,const Double_t *l,Double_t *g){ - LtoG(GetModuleIndex(id),l,g);} + LtoG(GetModuleIndex(id),l,g);} // Transforms from the detector local coordinate system // to the ALICE Global coordinate system for the detector // module index number. The global and local coordinate are // given in two Double point arrays g[3], and l[3]. void LtoG(Int_t index,const Double_t *l,Double_t *g){ - Double_t dg[3],dl[3];Int_t i;for(i=0;i<3;i++) dl[i] = l[i]; - GetGeomMatrix(index)->LtoGPosition(dl,dg); - for(i=0;i<3;i++) g[i] =dg[i];} -// + Double_t dg[3],dl[3];Int_t i;for(i=0;i<3;i++) dl[i] = l[i]; + GetGeomMatrix(index)->LtoGPosition(dl,dg); + for(i=0;i<3;i++) g[i] =dg[i];} + // // Transforms from the detector local coordinate system (used // for ITS tracking) to the ALICE Global coordinate system // for the detector module index number. The global and local // coordinate are given in two Double point arrays g[3], and l[3]. void LtoGtracking(Int_t index,const Double_t *l,Double_t *g){ - if(IsGeantToTracking()) LtoG(index,l,g); - else GetGeomMatrix(index)->LtoGPositionTracking(l,g);} + if(IsGeantToTracking()) LtoG(index,l,g); + else GetGeomMatrix(index)->LtoGPositionTracking(l,g);} // Transforms from the detector local coordinate system (used // for ITS tracking) to the ALICE Global coordinate system // for the detector id[3]. The global and local // coordinate are given in two Double point arrays g[3], and l[3]. void LtoGtracking(const Int_t *id,const Double_t *l,Double_t *g){ - LtoGtracking(GetModuleIndex(id),l,g);} + LtoGtracking(GetModuleIndex(id),l,g);} // Transforms from the detector local coordinate system (used // for ITS tracking) to the detector local coordinate system // for the detector layer ladder and detector numbers. The global // and local coordinate are given in two Double point arrays g[3], // and l[3]. void LtoGtracking(Int_t lay,Int_t lad,Int_t det, - const Double_t *l,Double_t *g){ - LtoGtracking(GetModuleIndex(lay,lad,det),l,g);} -// + const Double_t *l,Double_t *g){ + LtoGtracking(GetModuleIndex(lay,lad,det),l,g);} + // // Transforms of momentum types of quantities from the detector // local coordinate system to the ALICE Global coordinate system // for the detector layer ladder and detector numbers. The global // and local coordinate are given in two float point arrays g[3], // and l[3]. void LtoGMomentum(Int_t lay,Int_t lad,Int_t det, - const Float_t *l,Float_t *g){ - LtoGMomentum(GetModuleIndex(lay,lad,det),l,g);} + const Float_t *l,Float_t *g){ + LtoGMomentum(GetModuleIndex(lay,lad,det),l,g);} // Transforms of momentum types of quantities from the detector // local coordinate system to the ALICE Global coordinate system // for the detector module index number. The global and local // coordinate are given in two float point arrays g[3], and l[3]. void LtoGMomentum(Int_t index,const Float_t *l,Float_t *g){ - Double_t dg[3],dl[3];Int_t i;for(i=0;i<3;i++) dl[i] = l[i]; - GetGeomMatrix(index)->LtoGMomentum(dl,dg); - for(i=0;i<3;i++) g[i] =dg[i];} + Double_t dg[3],dl[3];Int_t i;for(i=0;i<3;i++) dl[i] = l[i]; + GetGeomMatrix(index)->LtoGMomentum(dl,dg); + for(i=0;i<3;i++) g[i] =dg[i];} // Transforms of momentum types of quantities from the detector // local coordinate system to the ALICE Global coordinate system // for the detector layer ladder and detector numbers. The global // and local coordinate are given in two Double point arrays g[3], // and l[3]. void LtoGMomentum(Int_t lay,Int_t lad,Int_t det, - const Double_t *l,Double_t *g){ - LtoGMomentum(GetModuleIndex(lay,lad,det),l,g);} + const Double_t *l,Double_t *g){ + LtoGMomentum(GetModuleIndex(lay,lad,det),l,g);} // Transforms of momentum types of quantities from the detector // local coordinate system to the ALICE Global coordinate system // for the detector module index number. The global and local // coordinate are given in two Double point arrays g[3], and l[3]. void LtoGMomentum(Int_t index,const Double_t *l,Double_t *g){ - GetGeomMatrix(index)->LtoGMomentum(l,g);} -// + GetGeomMatrix(index)->LtoGMomentum(l,g);} + // // Transforms of momentum types of quantities from the detector // local coordinate system (used for ITS tracking) to the detector // system ALICE Global for the detector module index number. // The global and local coordinate are given in two Double point // arrays g[3], and l[3]. void LtoGMomentumTracking(Int_t index,const Double_t *l,Double_t *g){ - if(IsGeantToTracking()) LtoGMomentum(index,l,g); - else GetGeomMatrix(index)->LtoGMomentumTracking(l,g);} + if(IsGeantToTracking()) LtoGMomentum(index,l,g); + else GetGeomMatrix(index)->LtoGMomentumTracking(l,g);} // Transforms of momentum types of quantities from the detector // local coordinate system (used for ITS tracking) to the ALICE // Global coordinate system for the detector id[3]. // The global and local coordinate are given in two Double point // arrays g[3], and l[3]. void LtoGMomentumTracking(const Int_t *id,const Double_t *l,Double_t *g){ - LtoGMomentumTracking(GetModuleIndex(id),l,g);} + LtoGMomentumTracking(GetModuleIndex(id),l,g);} // Transforms of momentum types of quantities from the detector // local coordinate system (used for ITS tracking) to the ALICE // Global coordinate system for the detector layer ladder and detector // numbers. The global and local coordinate are given in two Double point // arrays g[3], and l[3]. void LtoGMomentumTracking(Int_t lay,Int_t lad,Int_t det, - const Double_t *l,Double_t *g){ + const Double_t *l,Double_t *g){ LtoGMomentumTracking(GetModuleIndex(lay,lad,det),l,g);} -// + // // Transforms from one detector local coordinate system // to another detector local coordinate system for the detector // module index1 number to the detector module index2 number. The // local coordinates are given in two Double point arrays l1[3], // and l2[3]. void LtoL(Int_t index1,Int_t index2,Double_t *l1,Double_t *l2){ - Double_t g[3]; LtoG(index1,l1,g);GtoL(index2,g,l2);} + Double_t g[3]; LtoG(index1,l1,g);GtoL(index2,g,l2);} // Transforms from one detector local coordinate system // to another detector local coordinate system for the detector // id1[3] to the detector id2[3]. The local coordinates are given // in two Double point arrays l1[3], and l2[3]. void LtoL(const Int_t *id1,const Int_t *id2,Double_t *l1,Double_t *l2){ - LtoL(GetModuleIndex(id1[0],id1[1],id1[2]), + LtoL(GetModuleIndex(id1[0],id1[1],id1[2]), GetModuleIndex(id2[0],id2[1],id2[2]),l1,l2);} -// + // // Transforms from one detector local coordinate system (used for // ITS tracking) to another detector local coordinate system (used // for ITS tracking) for the detector module index1 number to the // detector module index2 number. The local coordinates are given // in two Double point arrays l1[3], and l2[3]. void LtoLtracking(Int_t index1,Int_t index2, - Double_t *l1,Double_t *l2){ - Double_t g[3]; LtoGtracking(index1,l1,g);GtoLtracking(index2,g,l2);} + Double_t *l1,Double_t *l2){ + Double_t g[3]; LtoGtracking(index1,l1,g);GtoLtracking(index2,g,l2);} // Transforms from one detector local coordinate system (used for // ITS tracking) to another detector local coordinate system (used // for ITS tracking) for the detector id1[3] to the detector id2[3]. // The local coordinates are given in two Double point arrays l1[3], // and l2[3]. void LtoLtracking(const Int_t *id1,const Int_t *id2, - Double_t *l1,Double_t *l2){ - LtoLtracking(GetModuleIndex(id1[0],id1[1],id1[2]), - GetModuleIndex(id2[0],id2[1],id2[2]),l1,l2);} -// + Double_t *l1,Double_t *l2){ + LtoLtracking(GetModuleIndex(id1[0],id1[1],id1[2]), + GetModuleIndex(id2[0],id2[1],id2[2]),l1,l2);} + // // Transforms of momentum types of quantities from one detector // local coordinate system to another detector local coordinate // system for the detector module index1 number to the detector // module index2 number. The local coordinates are given in two // Double point arrays l1[3], and l2[3]. void LtoLMomentum(Int_t index1,Int_t index2, - const Double_t *l1,Double_t *l2){ - Double_t g[3]; LtoGMomentum(index1,l1,g);GtoLMomentum(index2,g,l2);} + const Double_t *l1,Double_t *l2){ + Double_t g[3]; LtoGMomentum(index1,l1,g);GtoLMomentum(index2,g,l2);} // Transforms of momentum types of quantities from one detector // local coordinate system to another detector local coordinate // system for the detector id1[3] to the detector id2[3]. The local // coordinates are given in two Double point arrays l1[3], and l2[3]. void LtoLMomentum(const Int_t *id1,const Int_t *id2, - const Double_t *l1,Double_t *l2){ - LtoLMomentum(GetModuleIndex(id1[0],id1[1],id1[2]), - GetModuleIndex(id2[0],id2[1],id2[2]),l1,l2);} -// + const Double_t *l1,Double_t *l2){ + LtoLMomentum(GetModuleIndex(id1[0],id1[1],id1[2]), + GetModuleIndex(id2[0],id2[1],id2[2]),l1,l2);} + // // Transforms of momentum types of quantities from one detector // local coordinate system (used by ITS tracking) to another detector // local coordinate system (used by ITS tracking) for the detector @@ -618,75 +632,76 @@ class AliITSgeom : public TObject { // local coordinates are given in two Double point arrays l1[3], // and l2[3]. void LtoLMomentumTracking(Int_t index1,Int_t index2, - Double_t *l1,Double_t *l2){ - Double_t g[3]; LtoGMomentumTracking(index1,l1,g); - GtoLMomentumTracking(index2,g,l2);} + Double_t *l1,Double_t *l2){ + Double_t g[3]; LtoGMomentumTracking(index1,l1,g); + GtoLMomentumTracking(index2,g,l2);} // Transforms of momentum types of quantities from one detector // local coordinate system (used by ITS tracking) to another detector // local coordinate system (used by ITS tracking) for the detector // id1[3] to the detector id2[3]. The local coordinates are given in // two Double point arrays l1[3], and l2[3]. void LtoLMomentumTracking(const Int_t *id1,const Int_t *id2, - Double_t *l1,Double_t *l2){ - LtoLMomentumTracking(GetModuleIndex(id1[0],id1[1],id1[2]), + Double_t *l1,Double_t *l2){ + LtoLMomentumTracking(GetModuleIndex(id1[0],id1[1],id1[2]), GetModuleIndex(id2[0],id2[1],id2[2]),l1,l2);} -// + // // Transforms a matrix, like an Uncertainty or Error matrix from // the ALICE Global coordinate system to a detector local coordinate // system. The specific detector is determined by the module index // number. void GtoLErrorMatrix(Int_t index,const Double_t **g,Double_t **l){ - GetGeomMatrix(index)->GtoLPositionError((Double_t (*)[3])g,(Double_t (*)[3])l);} -// + GetGeomMatrix(index)->GtoLPositionError((Double_t (*)[3])g,(Double_t (*)[3])l);} + // // Transforms a matrix, like an Uncertainty or Error matrix from // the ALICE Global coordinate system to a detector local coordinate // system (used by ITS tracking). The specific detector is determined // by the module index number. void GtoLErrorMatrixTracking(Int_t index,const Double_t **g, - Double_t **l){ - if(IsGeantToTracking()) GetGeomMatrix(index)->GtoLPositionError(( - Double_t (*)[3])g,(Double_t (*)[3])l); - else GetGeomMatrix(index)->GtoLPositionErrorTracking( - (Double_t (*)[3])g,(Double_t (*)[3])l);} -// + Double_t **l){ + if(IsGeantToTracking()) GetGeomMatrix(index)->GtoLPositionError(( + Double_t (*)[3])g,(Double_t (*)[3])l); + else GetGeomMatrix(index)->GtoLPositionErrorTracking( + (Double_t (*)[3])g,(Double_t (*)[3])l);} + // // Transforms a matrix, like an Uncertainty or Error matrix from // the detector local coordinate system to a ALICE Global coordinate // system. The specific detector is determined by the module index // number. void LtoGErrorMatrix(Int_t index,const Double_t **l,Double_t **g){ - GetGeomMatrix(index)->LtoGPositionError((Double_t (*)[3])l,(Double_t (*)[3])g);} -// + GetGeomMatrix(index)->LtoGPositionError((Double_t (*)[3])l,(Double_t (*)[3])g);} + // // Transforms a matrix, like an Uncertainty or Error matrix from // the detector local coordinate system (used by ITS tracking) to a // ALICE Global coordinate system. The specific detector is determined // by the module index number. void LtoGErrorMatrixTracking(Int_t index,const Double_t **l, - Double_t **g){ - if(IsGeantToTracking()) GetGeomMatrix(index)->LtoGPositionError(( - Double_t (*)[3])g,(Double_t (*)[3])l); - else GetGeomMatrix(index)->LtoGPositionErrorTracking((Double_t (*)[3])l, - (Double_t (*)[3])g);} -// + Double_t **g){ + if(IsGeantToTracking()) GetGeomMatrix(index)->LtoGPositionError(( + Double_t (*)[3])g,(Double_t (*)[3])l); + else GetGeomMatrix(index)->LtoGPositionErrorTracking((Double_t (*)[3])l, + (Double_t (*)[3])g);} + // // Transforms a matrix, like an Uncertainty or Error matrix from // one detector local coordinate system to another detector local // coordinate system. The specific detector is determined by the // two module index number index1 and index2. void LtoLErrorMatrix(Int_t index1,Int_t index2, - const Double_t **l1,Double_t **l2){ - Double_t g[3][3]; - LtoGErrorMatrix(index1,l1,(Double_t **)g); - GtoLErrorMatrix(index2,(const Double_t **)g,l2);} -// + const Double_t **l1,Double_t **l2){ + Double_t g[3][3]; + LtoGErrorMatrix(index1,l1,(Double_t **)g); + GtoLErrorMatrix(index2,(const Double_t **)g,l2);} + // // Transforms a matrix, like an Uncertainty or Error matrix from // one detector local coordinate system (used by ITS tracking) to // another detector local coordinate system (used by ITS tracking). // The specific detector is determined by the two module index number // index1 and index2. void LtoLErrorMatrixTraking(Int_t index1,Int_t index2, - const Double_t **l1,Double_t **l2){Double_t g[3][3]; - LtoGErrorMatrixTracking(index1,l1,(Double_t **)g); - GtoLErrorMatrixTracking(index2,(const Double_t **)g,l2);} -// Find Specific Modules + const Double_t **l1,Double_t **l2){ + Double_t g[3][3]; + LtoGErrorMatrixTracking(index1,l1,(Double_t **)g); + GtoLErrorMatrixTracking(index2,(const Double_t **)g,l2);} + // Find Specific Modules // Locate the nearest module to the point g, in ALICE global Cartesian // coordinates [cm] in a give layer. If layer = 0 then it search in // all layers. @@ -699,8 +714,11 @@ class AliITSgeom : public TObject { // Returns the distance [cm] between the point g[3] and the center of // the detector/module specified by the the module index number. Double_t Distance(Int_t index,const Double_t g[3]){ - return TMath::Sqrt(GetGeomMatrix(index)->Distance2(g));} -// Geometry manipulation + return TMath::Sqrt(GetGeomMatrix(index)->Distance2(g));} + // loops over modules and computes the average cylindrical + // radius to a given layer and the range. + Double_t GetAverageRadiusOfLayer(Int_t layer,Double_t &range); + // Geometry manipulation // This function performs a Cartesian translation and rotation of // the full ITS from its default position by an amount determined by // the three element arrays tran and rot. @@ -721,7 +739,7 @@ class AliITSgeom : public TObject { // This function converts these transformations from Alice global and // local to Tracking global and local. void GeantToTracking(AliITSgeom &source); // This converts the geometry -// Other routines. + // Other routines. // This routine prints, to a file, the difference between this class // and "other". void PrintComparison(FILE *fp,AliITSgeom *other); @@ -741,16 +759,16 @@ class AliITSgeom : public TObject { void TrackingV2ToDetL(Int_t md,Float_t yin,Float_t zin,Float_t &xout,Float_t &zout); private: - char fVersion[20];// Transformation version. + TString fVersion; // Transformation version. Int_t fTrans; // Flag to keep track of which transformation Int_t fNmodules;// The total number of modules Int_t fNlayers; // The number of layers. - Int_t *fNlad; //[fNlayers] Array of the number of ladders/layer(layer) - Int_t *fNdet;//[fNlayers] Array of the number of detector/ladder(layer) - TObjArray *fGm; // Structure of translation. and rotation. - TObjArray *fShape; // Array of shapes and detector information. + TArrayI fNlad; // Array of the number of ladders/layer(layer) + TArrayI fNdet; // Array of the number of detector/ladder(layer) + TObjArray fGm; // Structure of translation. and rotation. + TObjArray fShape; // Array of shapes and detector information. - ClassDef(AliITSgeom,2) // ITS geometry class + ClassDef(AliITSgeom,3) // ITS geometry class }; #endif diff --git a/ITS/AliITSgeomMatrix.cxx b/ITS/AliITSgeomMatrix.cxx index 20a8251c45f..cb6f2216b51 100644 --- a/ITS/AliITSgeomMatrix.cxx +++ b/ITS/AliITSgeomMatrix.cxx @@ -13,44 +13,67 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* $Id$ */ - -//////////////////////////////////////////////////////////////////////// -// This is the implementation file for AliITSgeomMatrix class. It -// contains the routines to manipulate, setup, and queary the geometry -// of a given ITS module. An ITS module may be one of at least three -// ITS detector technologies, Silicon Pixel, Drift, or Strip Detectors, -// and variations of these in size and/or layout. These routines let -// one go between ALICE global coordiantes (cm) to a given modules -// specific local coordinates (cm). -//////////////////////////////////////////////////////////////////////// +/* +$Id$ +*/ +/* + This is the implementation file for AliITSgeomMatrix class. It + contains the routines to manipulate, setup, and queary the geometry + of a given ITS module. An ITS module may be one of at least three + ITS detector technologies, Silicon Pixel, Drift, or Strip Detectors, + and variations of these in size and/or layout. These routines let + one go between ALICE global coordiantes (cm) to a given modules + specific local coordinates (cm). +*/ #include #include #include #include +#include +#include +#include +//#include +#include +#include +#include +#include #include "AliITSgeomMatrix.h" ClassImp(AliITSgeomMatrix) //---------------------------------------------------------------------- -AliITSgeomMatrix::AliITSgeomMatrix(){ -//////////////////////////////////////////////////////////////////////// -// The Default constructor for the AliITSgeomMatrix class. By Default -// the angles of rotations are set to zero, meaning that the rotation -// matrix is the unit matrix. The translation vector is also set to zero -// as are the module id number. The detector type is set to -1 (an undefined -// value). The full rotation matrix is kept so that the evaluation -// of a coordinate transformation can be done quickly and with a minimum -// of CPU overhead. The basic coordinate systems are the ALICE global -// coordinate system and the detector local coordinate system. In general -// this structure is not limited to just those two coordinate systems. -//Begin_Html -/* - -*/ -//End_Html -//////////////////////////////////////////////////////////////////////// +AliITSgeomMatrix::AliITSgeomMatrix(): +TObject(), +fDetectorIndex(0), // Detector type index (like fShapeIndex was) +fid(), // layer, ladder, detector numbers. +frot(), //! vector of rotations about x,y,z [radians]. +ftran(), // Translation vector of module x,y,z. +fCylR(0.0), //! R Translation in Cylinderical coordinates +fCylPhi(0.0),//! Phi Translation vector in Cylindrical coord. +fm(), // Rotation matrix based on frot. +fPath(){ // Path in geometry to this module + // The Default constructor for the AliITSgeomMatrix class. By Default + // the angles of rotations are set to zero, meaning that the rotation + // matrix is the unit matrix. The translation vector is also set to + // zero as are the module id number. The detector type is set to -1 + // (an undefined value). The full rotation matrix is kept so that + // the evaluation of a coordinate transformation can be done + // quickly and with a minimum of CPU overhead. The basic coordinate + // systems are the ALICE global coordinate system and the detector + // local coordinate system. In general this structure is not limited + // to just those two coordinate systems. + //Begin_Html + /* + + */ + //End_Html + // Inputs: + // none. + // Outputs: + // none. + // Return: + // A default constructes AliITSgeomMatrix class. Int_t i,j; fDetectorIndex = -1; // a value never defined. @@ -65,10 +88,14 @@ AliITSgeomMatrix::AliITSgeomMatrix(){ //---------------------------------------------------------------------- AliITSgeomMatrix::AliITSgeomMatrix(const AliITSgeomMatrix &sourse) : TObject(sourse){ -//////////////////////////////////////////////////////////////////////// -// The standard Copy constructor. This make a full / proper copy of -// this class. -//////////////////////////////////////////////////////////////////////// + // The standard Copy constructor. This make a full / proper copy of + // this class. + // Inputs: + // AliITSgeomMatrix &source The source of this copy + // Outputs: + // none. + // Return: + // A copy constructes AliITSgeomMatrix class. Int_t i,j; this->fDetectorIndex = sourse.fDetectorIndex; @@ -80,13 +107,20 @@ AliITSgeomMatrix::AliITSgeomMatrix(const AliITSgeomMatrix &sourse) : this->fCylPhi = sourse.fCylPhi; for(j=0;j<3;j++) this->fm[i][j] = sourse.fm[i][j]; }// end for i + this->fPath = sourse.fPath; } //---------------------------------------------------------------------- void AliITSgeomMatrix::operator=(const AliITSgeomMatrix &sourse){ -//////////////////////////////////////////////////////////////////////// -// The standard = operator. This make a full / proper copy of -// this class. -//////////////////////////////////////////////////////////////////////// + // The standard = operator. This make a full / proper copy of + // this class. + // The standard Copy constructor. This make a full / proper copy of + // this class. + // Inputs: + // AliITSgeomMatrix &source The source of this copy + // Outputs: + // none. + // Return: + // A copy of the source AliITSgeomMatrix class. Int_t i,j; this->fDetectorIndex = sourse.fDetectorIndex; @@ -98,26 +132,43 @@ void AliITSgeomMatrix::operator=(const AliITSgeomMatrix &sourse){ this->fCylPhi = sourse.fCylPhi; for(j=0;j<3;j++) this->fm[i][j] = sourse.fm[i][j]; }// end for i + this->fPath = sourse.fPath; } //---------------------------------------------------------------------- AliITSgeomMatrix::AliITSgeomMatrix(Int_t idt,const Int_t id[3], - const Double_t rot[3],const Double_t tran[3]){ -//////////////////////////////////////////////////////////////////////// -// This is a constructor for the AliITSgeomMatrix class. The matrix is -// defined by 3 standard rotation angles [radians], and the translation -// vector tran [cm]. In addition the layer, ladder, and detector number -// for this particular module and the type of module must be given. -// The full rotation matrix is kept so that the evaluation -// of a coordinate transformation can be done quickly and with a minimum -// of CPU overhead. The basic coordinate systems are the ALICE global -// coordinate system and the detector local coordinate system. In general -// this structure is not limited to just those two coordinate systems. -//Begin_Html -/* - -*/ -//End_Html -//////////////////////////////////////////////////////////////////////// + const Double_t rot[3],const Double_t tran[3]): +TObject(), +fDetectorIndex(0), // Detector type index (like fShapeIndex was) +fid(), // layer, ladder, detector numbers. +frot(), //! vector of rotations about x,y,z [radians]. +ftran(), // Translation vector of module x,y,z. +fCylR(0.0), //! R Translation in Cylinderical coordinates +fCylPhi(0.0),//! Phi Translation vector in Cylindrical coord. +fm(), // Rotation matrix based on frot. +fPath(){ // Path in geometry to this moduel + // This is a constructor for the AliITSgeomMatrix class. The matrix is + // defined by 3 standard rotation angles [radians], and the translation + // vector tran [cm]. In addition the layer, ladder, and detector number + // for this particular module and the type of module must be given. + // The full rotation matrix is kept so that the evaluation + // of a coordinate transformation can be done quickly and with a minimum + // of CPU overhead. The basic coordinate systems are the ALICE global + // coordinate system and the detector local coordinate system. In general + // this structure is not limited to just those two coordinate systems. + //Begin_Html + /* + + */ + //End_Html + // Inputs: + // Int_t idt The detector index value + // Int_t id[3] The layer, ladder, and detector numbers + // Double_t rot[3] The 3 Cartician rotaion angles [radians] + // Double_t tran[3] The 3 Cartician translation distnaces + // Outputs: + // none. + // Return: + // A properly inilized AliITSgeomMatrix class. Int_t i; fDetectorIndex = idt; // a value never defined. @@ -134,23 +185,40 @@ AliITSgeomMatrix::AliITSgeomMatrix(Int_t idt,const Int_t id[3], //---------------------------------------------------------------------- AliITSgeomMatrix::AliITSgeomMatrix(Int_t idt, const Int_t id[3], Double_t matrix[3][3], - const Double_t tran[3]){ -//////////////////////////////////////////////////////////////////////// -// This is a constructor for the AliITSgeomMatrix class. The rotation matrix -// is given as one of the inputs, and the translation vector tran [cm]. In -// addition the layer, ladder, and detector number for this particular -// module and the type of module must be given. The full rotation matrix -// is kept so that the evaluation of a coordinate transformation can be -// done quickly and with a minimum of CPU overhead. The basic coordinate -// systems are the ALICE global coordinate system and the detector local -// coordinate system. In general this structure is not limited to just -// those two coordinate systems. -//Begin_Html -/* - -*/ -//End_Html -//////////////////////////////////////////////////////////////////////// + const Double_t tran[3]): +TObject(), +fDetectorIndex(0), // Detector type index (like fShapeIndex was) +fid(), // layer, ladder, detector numbers. +frot(), //! vector of rotations about x,y,z [radians]. +ftran(), // Translation vector of module x,y,z. +fCylR(0.0), //! R Translation in Cylinderical coordinates +fCylPhi(0.0),//! Phi Translation vector in Cylindrical coord. +fm(), // Rotation matrix based on frot. +fPath(){ // Path in geometry to this module + // This is a constructor for the AliITSgeomMatrix class. The + // rotation matrix is given as one of the inputs, and the + // translation vector tran [cm]. In addition the layer, ladder, + // and detector number for this particular module and the type of + // module must be given. The full rotation matrix is kept so that + // the evaluation of a coordinate transformation can be done quickly + // and with a minimum of CPU overhead. The basic coordinate systems + // are the ALICE global coordinate system and the detector local + // coordinate system. In general this structure is not limited to just + // those two coordinate systems. + //Begin_Html + /* + + */ + //End_Html + // Inputs: + // Int_t idt The detector index value + // Int_t id[3] The layer, ladder, and detector numbers + // Double_t rot[3][3] The 3x3 Cartician rotaion matrix + // Double_t tran[3] The 3 Cartician translation distnaces + // Outputs: + // none. + // Return: + // A properly inilized AliITSgeomMatrix class. Int_t i,j; fDetectorIndex = idt; // a value never defined. @@ -166,10 +234,14 @@ AliITSgeomMatrix::AliITSgeomMatrix(Int_t idt, const Int_t id[3], } //---------------------------------------------------------------------- void AliITSgeomMatrix::SixAnglesFromMatrix(Double_t *ang){ -//////////////////////////////////////////////////////////////////////// -// This function returns the 6 GEANT 3.21 rotation angles [degrees] in -// the array ang which must be at least [6] long. -//////////////////////////////////////////////////////////////////////// + // This function returns the 6 GEANT 3.21 rotation angles [degrees] in + // the array ang which must be at least [6] long. + // Inputs: + // none. + // Outputs: + // Double_t ang[6] The 6 Geant3.21 rotation angles. [degrees] + // Return: + // noting Double_t si,c=180./TMath::Pi(); ang[1] = TMath::ATan2(fm[0][1],fm[0][0]); @@ -191,12 +263,16 @@ void AliITSgeomMatrix::SixAnglesFromMatrix(Double_t *ang){ } //---------------------------------------------------------------------- void AliITSgeomMatrix::MatrixFromSixAngles(const Double_t *ang){ -//////////////////////////////////////////////////////////////////////// -// Given the 6 GEANT 3.21 rotation angles [degree], this will compute and -// set the rotations matrix and 3 standard rotation angles [radians]. -// These angles and rotation matrix are overwrite the existing values in -// this class. -//////////////////////////////////////////////////////////////////////// + // Given the 6 GEANT 3.21 rotation angles [degree], this will compute and + // set the rotations matrix and 3 standard rotation angles [radians]. + // These angles and rotation matrix are overwrite the existing values in + // this class. + // Inputs: + // Double_t ang[6] The 6 Geant3.21 rotation angles. [degrees] + // Outputs: + // none. + // Return: + // noting Int_t i,j; Double_t si,lr[9],c=TMath::Pi()/180.; @@ -244,23 +320,27 @@ void AliITSgeomMatrix::MatrixFromSixAngles(const Double_t *ang){ //---------------------------------------------------------------------- AliITSgeomMatrix::AliITSgeomMatrix(const Double_t rotd[6]/*degrees*/, Int_t idt,const Int_t id[3], - const Double_t tran[3]){ -//////////////////////////////////////////////////////////////////////// -// This is a constructor for the AliITSgeomMatrix class. The matrix is -// defined by the 6 GEANT 3.21 rotation angles [degrees], and the translation -// vector tran [cm]. In addition the layer, ladder, and detector number -// for this particular module and the type of module must be given. -// The full rotation matrix is kept so that the evaluation -// of a coordinate transformation can be done quickly and with a minimum -// of CPU overhead. The basic coordinate systems are the ALICE global -// coordinate system and the detector local coordinate system. In general -// this structure is not limited to just those two coordinate systems. -//Begin_Html -/* - -*/ -//End_Html -//////////////////////////////////////////////////////////////////////// + const Double_t tran[3]){ + // This is a constructor for the AliITSgeomMatrix class. The matrix + // is defined by the 6 GEANT 3.21 rotation angles [degrees], and + // the translation vector tran [cm]. In addition the layer, ladder, + // and detector number for this particular module and the type of + // module must be given. The full rotation matrix is kept so that + // the evaluation of a coordinate transformation can be done + // quickly and with a minimum of CPU overhead. The basic coordinate + // systems are the ALICE global coordinate system and the detector + // local coordinate system. In general this structure is not limited + // to just those two coordinate systems. + //Begin_Html + /* + + */ + //End_Html + // Inputs: + // Double_t rotd[6] The 6 Geant 3.21 rotation angles [degrees] + // Int_t idt The module Id number + // Int_t id[3] The layer, ladder and detector number + // Double_t tran[3] The translation vector Int_t i; fDetectorIndex = idt; // a value never defined. @@ -275,9 +355,14 @@ AliITSgeomMatrix::AliITSgeomMatrix(const Double_t rotd[6]/*degrees*/, } //---------------------------------------------------------------------- void AliITSgeomMatrix::AngleFromMatrix(){ -//////////////////////////////////////////////////////////////////////// -// Computes the angles from the rotation matrix up to a phase of 180 degrees. -//////////////////////////////////////////////////////////////////////// + // Computes the angles from the rotation matrix up to a phase of + // 180 degrees. + // Inputs: + // none + // Outputs: + // none + // Return: + // none Double_t rx,ry,rz; // get angles from matrix up to a phase of 180 degrees. @@ -291,10 +376,14 @@ void AliITSgeomMatrix::AngleFromMatrix(){ } //---------------------------------------------------------------------- void AliITSgeomMatrix::MatrixFromAngle(){ -//////////////////////////////////////////////////////////////////////// -// Computes the Rotation matrix from the angles [radians] kept in this -// class. -//////////////////////////////////////////////////////////////////////// + // Computes the Rotation matrix from the angles [radians] kept in this + // class. + // Inputs: + // none + // Outputs: + // none + // Return: + // none Double_t sx,sy,sz,cx,cy,cz; sx = TMath::Sin(frot[0]); cx = TMath::Cos(frot[0]); @@ -313,9 +402,15 @@ void AliITSgeomMatrix::MatrixFromAngle(){ } //---------------------------------------------------------------------- void AliITSgeomMatrix::GtoLPosition(const Double_t g0[3],Double_t l[3]) const { -//////////////////////////////////////////////////////////////////////// -// Returns the local coordinates given the global coordinates [cm]. -//////////////////////////////////////////////////////////////////////// + // Returns the local coordinates given the global coordinates [cm]. + // Inputs: + // Double_t g[3] The position represented in the ALICE + // global coordinate system + // Outputs: + // Double_t l[3] The poistion represented in the local + // detector coordiante system + // Return: + // none Int_t i,j; Double_t g[3]; @@ -329,9 +424,15 @@ void AliITSgeomMatrix::GtoLPosition(const Double_t g0[3],Double_t l[3]) const { } //---------------------------------------------------------------------- void AliITSgeomMatrix::LtoGPosition(const Double_t l[3],Double_t g[3]) const { -//////////////////////////////////////////////////////////////////////// -// Returns the global coordinates given the local coordinates [cm]. -//////////////////////////////////////////////////////////////////////// + // Returns the global coordinates given the local coordinates [cm]. + // Inputs: + // Double_t l[3] The poistion represented in the detector + // local coordinate system + // Outputs: + // Double_t g[3] The poistion represented in the ALICE + // Global coordinate system + // Return: + // none. Int_t i,j; for(i=0;i<3;i++){ @@ -344,11 +445,17 @@ void AliITSgeomMatrix::LtoGPosition(const Double_t l[3],Double_t g[3]) const { } //---------------------------------------------------------------------- void AliITSgeomMatrix::GtoLMomentum(const Double_t g[3],Double_t l[3]) const{ -//////////////////////////////////////////////////////////////////////// -// Returns the local coordinates of the momentum given the global -// coordinates of the momentum. It transforms just like GtoLPosition -// except that the translation vector is zero. -//////////////////////////////////////////////////////////////////////// + // Returns the local coordinates of the momentum given the global + // coordinates of the momentum. It transforms just like GtoLPosition + // except that the translation vector is zero. + // Inputs: + // Double_t g[3] The momentum represented in the ALICE global + // coordinate system + // Outputs: + // Double_t l[3] the momentum represented in the detector + // local coordinate system + // Return: + // none. Int_t i,j; for(i=0;i<3;i++){ @@ -360,11 +467,17 @@ void AliITSgeomMatrix::GtoLMomentum(const Double_t g[3],Double_t l[3]) const{ } //---------------------------------------------------------------------- void AliITSgeomMatrix::LtoGMomentum(const Double_t l[3],Double_t g[3]) const { -//////////////////////////////////////////////////////////////////////// -// Returns the Global coordinates of the momentum given the local -// coordinates of the momentum. It transforms just like LtoGPosition -// except that the translation vector is zero. -//////////////////////////////////////////////////////////////////////// + // Returns the Global coordinates of the momentum given the local + // coordinates of the momentum. It transforms just like LtoGPosition + // except that the translation vector is zero. + // Inputs: + // Double_t l[3] the momentum represented in the detector + // local coordinate system + // Outputs: + // Double_t g[3] The momentum represented in the ALICE global + // coordinate system + // Return: + // none. Int_t i,j; for(i=0;i<3;i++){ @@ -375,13 +488,20 @@ void AliITSgeomMatrix::LtoGMomentum(const Double_t l[3],Double_t g[3]) const { return; } //---------------------------------------------------------------------- -void AliITSgeomMatrix::GtoLPositionError( Double_t g[3][3], - Double_t l[3][3]) const { -//////////////////////////////////////////////////////////////////////// -// Given an Uncertainty matrix in Global coordinates it is rotated so that -// its representation in local coordinates can be returned. There is no -// effect due to the translation vector or its uncertainty. -//////////////////////////////////////////////////////////////////////// +void AliITSgeomMatrix::GtoLPositionError(const Double_t g[3][3], + Double_t l[3][3]) const { + // Given an Uncertainty matrix in Global coordinates it is + // rotated so that its representation in local coordinates can + // be returned. There is no effect due to the translation vector + // or its uncertainty. + // Inputs: + // Double_t g[3][3] The error matrix represented in the ALICE global + // coordinate system + // Outputs: + // Double_t l[3][3] the error matrix represented in the detector + // local coordinate system + // Return: + // none. Int_t i,j,k,m; for(i=0;i<3;i++)for(m=0;m<3;m++){ @@ -393,13 +513,19 @@ void AliITSgeomMatrix::GtoLPositionError( Double_t g[3][3], return; } //---------------------------------------------------------------------- -void AliITSgeomMatrix::LtoGPositionError( Double_t l[3][3], +void AliITSgeomMatrix::LtoGPositionError(const Double_t l[3][3], Double_t g[3][3]) const { -//////////////////////////////////////////////////////////////////////// -// Given an Uncertainty matrix in Local coordinates it is rotated so that -// its representation in global coordinates can be returned. There is no -// effect due to the translation vector or its uncertainty. -//////////////////////////////////////////////////////////////////////// + // Given an Uncertainty matrix in Local coordinates it is rotated so that + // its representation in global coordinates can be returned. There is no + // effect due to the translation vector or its uncertainty. + // Inputs: + // Double_t l[3][3] the error matrix represented in the detector + // local coordinate system + // Outputs: + // Double_t g[3][3] The error matrix represented in the ALICE global + // coordinate system + // Return: + // none. Int_t i,j,k,m; for(i=0;i<3;i++)for(m=0;m<3;m++){ @@ -411,24 +537,30 @@ void AliITSgeomMatrix::LtoGPositionError( Double_t l[3][3], return; } //---------------------------------------------------------------------- -void AliITSgeomMatrix::GtoLPositionTracking(const Double_t g0[3], - Double_t l[3]) const { -//////////////////////////////////////////////////////////////////////// -// A slightly different coordinate system is used when tracking. -// This coordinate system is only relevant when the geometry represents -// the cylindrical ALICE ITS geometry. For tracking the Z axis is left -// alone but X -> -Y and Y -> X such that X always points out of the -// ITS Cylinder for every layer including layer 1 (where the detector -// are mounted upside down). -//Begin_Html -/* - - */ -//End_Html -//////////////////////////////////////////////////////////////////////// +void AliITSgeomMatrix::GtoLPositionTracking(const Double_t g[3], + Double_t l[3]) const { + // A slightly different coordinate system is used when tracking. + // This coordinate system is only relevant when the geometry represents + // the cylindrical ALICE ITS geometry. For tracking the Z axis is left + // alone but X -> -Y and Y -> X such that X always points out of the + // ITS Cylinder for every layer including layer 1 (where the detector + // are mounted upside down). + //Begin_Html + /* + + */ + //End_Html + // Inputs: + // Double_t g[3] The position represented in the ALICE + // global coordinate system + // Outputs: + // Double_t l[3] The poistion represented in the local + // detector coordiante system + // Return: + // none Double_t l0[3]; - this->GtoLPosition(g0,l0); + this->GtoLPosition(g,l0); if(fid[0]==1){ // for layer 1 the detector are flipped upside down // with respect to the others. l[0] = +l0[1]; @@ -443,20 +575,26 @@ void AliITSgeomMatrix::GtoLPositionTracking(const Double_t g0[3], } //---------------------------------------------------------------------- void AliITSgeomMatrix::LtoGPositionTracking(const Double_t l[3], - Double_t g[3]) const { -//////////////////////////////////////////////////////////////////////// -// A slightly different coordinate system is used when tracking. -// This coordinate system is only relevant when the geometry represents -// the cylindrical ALICE ITS geometry. For tracking the Z axis is left -// alone but X -> -Y and Y -> X such that X always points out of the -// ITS Cylinder for every layer including layer 1 (where the detector -// are mounted upside down). -//Begin_Html -/* - - */ -//End_Html -//////////////////////////////////////////////////////////////////////// + Double_t g[3]) const { + // A slightly different coordinate system is used when tracking. + // This coordinate system is only relevant when the geometry represents + // the cylindrical ALICE ITS geometry. For tracking the Z axis is left + // alone but X -> -Y and Y -> X such that X always points out of the + // ITS Cylinder for every layer including layer 1 (where the detector + // are mounted upside down). + //Begin_Html + /* + + */ + //End_Html + // Inputs: + // Double_t l[3] The poistion represented in the detector + // local coordinate system + // Outputs: + // Double_t g[3] The poistion represented in the ALICE + // Global coordinate system + // Return: + // none. Double_t l0[3]; if(fid[0]==1){ // for layer 1 the detector are flipped upside down @@ -474,20 +612,26 @@ void AliITSgeomMatrix::LtoGPositionTracking(const Double_t l[3], } //---------------------------------------------------------------------- void AliITSgeomMatrix::GtoLMomentumTracking(const Double_t g[3], - Double_t l[3]) const { -//////////////////////////////////////////////////////////////////////// -// A slightly different coordinate system is used when tracking. -// This coordinate system is only relevant when the geometry represents -// the cylindrical ALICE ITS geometry. For tracking the Z axis is left -// alone but X -> -Y and Y -> X such that X always points out of the -// ITS Cylinder for every layer including layer 1 (where the detector -// are mounted upside down). -//Begin_Html -/* - - */ -//End_Html -//////////////////////////////////////////////////////////////////////// + Double_t l[3]) const { + // A slightly different coordinate system is used when tracking. + // This coordinate system is only relevant when the geometry represents + // the cylindrical ALICE ITS geometry. For tracking the Z axis is left + // alone but X -> -Y and Y -> X such that X always points out of the + // ITS Cylinder for every layer including layer 1 (where the detector + // are mounted upside down). + //Begin_Html + /* + + */ + //End_Html + // Inputs: + // Double_t g[3] The momentum represented in the ALICE global + // coordinate system + // Outputs: + // Double_t l[3] the momentum represented in the detector + // local coordinate system + // Return: + // none. Double_t l0[3]; this->GtoLMomentum(g,l0); @@ -505,20 +649,26 @@ void AliITSgeomMatrix::GtoLMomentumTracking(const Double_t g[3], } //---------------------------------------------------------------------- void AliITSgeomMatrix::LtoGMomentumTracking(const Double_t l[3], - Double_t g[3]) const { -//////////////////////////////////////////////////////////////////////// -// A slightly different coordinate system is used when tracking. -// This coordinate system is only relevant when the geometry represents -// the cylindrical ALICE ITS geometry. For tracking the Z axis is left -// alone but X -> -Y and Y -> X such that X always points out of the -// ITS Cylinder for every layer including layer 1 (where the detector -// are mounted upside down). -//Begin_Html -/* - - */ -//End_Html -//////////////////////////////////////////////////////////////////////// + Double_t g[3]) const { + // A slightly different coordinate system is used when tracking. + // This coordinate system is only relevant when the geometry represents + // the cylindrical ALICE ITS geometry. For tracking the Z axis is left + // alone but X -> -Y and Y -> X such that X always points out of the + // ITS Cylinder for every layer including layer 1 (where the detector + // are mounted upside down). + //Begin_Html + /* + + */ + //End_Html + // Inputs: + // Double_t l[3] the momentum represented in the detector + // local coordinate system + // Outputs: + // Double_t g[3] The momentum represented in the ALICE global + // coordinate system + // Return: + // none. Double_t l0[3]; if(fid[0]==1){ // for layer 1 the detector are flipped upside down @@ -535,21 +685,26 @@ void AliITSgeomMatrix::LtoGMomentumTracking(const Double_t l[3], return; } //---------------------------------------------------------------------- -void AliITSgeomMatrix::GtoLPositionErrorTracking( Double_t g[3][3], - Double_t l[3][3]) const { -//////////////////////////////////////////////////////////////////////// -// A slightly different coordinate system is used when tracking. -// This coordinate system is only relevant when the geometry represents -// the cylindrical ALICE ITS geometry. For tracking the Z axis is left -// alone but X -> -Y and Y -> X such that X always points out of the -// ITS Cylinder for every layer including layer 1 (where the detector -// are mounted upside down). -//Begin_Html -/* - - */ -//End_Html -//////////////////////////////////////////////////////////////////////// +void AliITSgeomMatrix::GtoLPositionErrorTracking(const Double_t g[3][3], + Double_t l[3][3]) const { + // A slightly different coordinate system is used when tracking. + // This coordinate system is only relevant when the geometry represents + // the cylindrical ALICE ITS geometry. For tracking the Z axis is left + // alone but X -> -Y and Y -> X such that X always points out of the + // ITS Cylinder for every layer including layer 1 (where the detector + // are mounted upside down). + //Begin_Html + /* + + */ + //End_Html + // Inputs: + // Double_t g[3][3] The error matrix represented in the ALICE global + // coordinate system + // Outputs: + // Double_t l[3][3] the error matrix represented in the detector + // local coordinate system + // Return: Int_t i,j,k,m; Double_t rt[3][3]; Double_t a0[3][3] = {{0.,+1.,0.},{-1.,0.,0.},{0.,0.,+1.}}; @@ -568,21 +723,27 @@ void AliITSgeomMatrix::GtoLPositionErrorTracking( Double_t g[3][3], return; } //---------------------------------------------------------------------- -void AliITSgeomMatrix::LtoGPositionErrorTracking( Double_t l[3][3], - Double_t g[3][3]) const { -//////////////////////////////////////////////////////////////////////// -// A slightly different coordinate system is used when tracking. -// This coordinate system is only relevant when the geometry represents -// the cylindrical ALICE ITS geometry. For tracking the Z axis is left -// alone but X -> -Y and Y -> X such that X always points out of the -// ITS Cylinder for every layer including layer 1 (where the detector -// are mounted upside down). -//Begin_Html -/* - - */ -//End_Html -//////////////////////////////////////////////////////////////////////// +void AliITSgeomMatrix::LtoGPositionErrorTracking(const Double_t l[3][3], + Double_t g[3][3]) const { + // A slightly different coordinate system is used when tracking. + // This coordinate system is only relevant when the geometry represents + // the cylindrical ALICE ITS geometry. For tracking the Z axis is left + // alone but X -> -Y and Y -> X such that X always points out of the + // ITS Cylinder for every layer including layer 1 (where the detector + // are mounted upside down). + //Begin_Html + /* + + */ + //End_Html + // Inputs: + // Double_t l[3][3] the error matrix represented in the detector + // local coordinate system + // Outputs: + // Double_t g[3][3] The error matrix represented in the ALICE global + // coordinate system + // Return: + // none. Int_t i,j,k,m; Double_t rt[3][3]; Double_t a0[3][3] = {{0.,+1.,0.},{-1.,0.,0.},{0.,0.,+1.}}; @@ -602,10 +763,14 @@ void AliITSgeomMatrix::LtoGPositionErrorTracking( Double_t l[3][3], } //---------------------------------------------------------------------- void AliITSgeomMatrix::PrintTitles(ostream *os) const { -//////////////////////////////////////////////////////////////////////// -// Standard output format for this class but it includes variable -// names and formatting that makes it easer to read. -//////////////////////////////////////////////////////////////////////// + // Standard output format for this class but it includes variable + // names and formatting that makes it easer to read. + // Inputs: + // ostream *os The output stream to print the title on + // Outputs: + // none. + // Return: + // none. Int_t i,j; *os << "fDetectorIndex=" << fDetectorIndex << " fid[3]={"; @@ -621,9 +786,13 @@ void AliITSgeomMatrix::PrintTitles(ostream *os) const { } //---------------------------------------------------------------------- void AliITSgeomMatrix::PrintComment(ostream *os) const { -//////////////////////////////////////////////////////////////////////// -// output format used by Print.. -//////////////////////////////////////////////////////////////////////// + // output format used by Print. + // Inputs: + // ostream *os The output stream to print the comments on + // Outputs: + // none. + // Return: + // none. *os << "fDetectorIndex fid[0] fid[1] fid[2] ftran[0] ftran[1] ftran[2] "; *os << "fm[0][0] fm[0][1] fm[0][2] fm[1][0] fm[1][1] fm[1][2] "; *os << "fm[2][0] fm[2][1] fm[2][2] "; @@ -631,9 +800,13 @@ void AliITSgeomMatrix::PrintComment(ostream *os) const { } //---------------------------------------------------------------------- void AliITSgeomMatrix::Print(ostream *os){ -//////////////////////////////////////////////////////////////////////// -// Standard output format for this class. -//////////////////////////////////////////////////////////////////////// + // Standard output format for this class. + // Inputs: + // ostream *os The output stream to print the class data on + // Outputs: + // none. + // Return: + // none. Int_t i,j; #if defined __GNUC__ #if __GNUC__ > 2 @@ -656,15 +829,21 @@ void AliITSgeomMatrix::Print(ostream *os){ for(i=0;i<3;i++) *os << setprecision(16) << ftran[i] << " "; for(i=0;i<3;i++)for(j=0;j<3;j++) *os << setprecision(16) << fm[i][j] << " "; + *os << fPath.Length()<< " "; + for(i=0;iflags(fmt); // reset back to old formating. return; } //---------------------------------------------------------------------- void AliITSgeomMatrix::Read(istream *is){ -//////////////////////////////////////////////////////////////////////// -// Standard input format for this class. -//////////////////////////////////////////////////////////////////////// + // Standard input format for this class. + // Inputs: + // istream *is The input stream to read on + // Outputs: + // none. + // Return: + // none. Int_t i,j; *is >> fDetectorIndex; @@ -672,6 +851,9 @@ void AliITSgeomMatrix::Read(istream *is){ // for(i=0;i<3;i++) *is >> frot[i]; // Redundant with fm[][]. for(i=0;i<3;i++) *is >> ftran[i]; for(i=0;i<3;i++)for(j=0;j<3;j++) *is >> fm[i][j]; + *is >> j; // string length + fPath.Resize(j); + for(i=0;i> fPath[i];} AngleFromMatrix(); // compute angles frot[]. fCylR = TMath::Sqrt(ftran[0]*ftran[0]+ftran[1]*ftran[1]); fCylPhi = TMath::ATan2(ftran[1],ftran[0]); @@ -681,40 +863,281 @@ void AliITSgeomMatrix::Read(istream *is){ //______________________________________________________________________ void AliITSgeomMatrix::Streamer(TBuffer &R__b){ // Stream an object of class AliITSgeomMatrix. + // Inputs: + // TBuffer &R__b The output buffer to stream data on. + // Outputs: + // none. + // Return: + // none. - if (R__b.IsReading()) { - AliITSgeomMatrix::Class()->ReadBuffer(R__b, this); - fCylR = TMath::Sqrt(ftran[0]*ftran[0]+ftran[1]*ftran[1]); - fCylPhi = TMath::ATan2(ftran[1],ftran[0]); - this->AngleFromMatrix(); - if(fCylPhi<0.0) fCylPhi += TMath::Pi(); - } else { - AliITSgeomMatrix::Class()->WriteBuffer(R__b, this); - } + if (R__b.IsReading()) { + AliITSgeomMatrix::Class()->ReadBuffer(R__b, this); + fCylR = TMath::Sqrt(ftran[0]*ftran[0]+ftran[1]*ftran[1]); + fCylPhi = TMath::ATan2(ftran[1],ftran[0]); + this->AngleFromMatrix(); + if(fCylPhi<0.0) fCylPhi += TMath::Pi(); + } else { + AliITSgeomMatrix::Class()->WriteBuffer(R__b, this); + } // end if } //______________________________________________________________________ void AliITSgeomMatrix::SetTranslation(const Double_t tran[3]){ - // Sets the translation vector and computes fCylR and fCylPhi. - for(Int_t i=0;i<3;i++) ftran[i] = tran[i]; - fCylR = TMath::Sqrt(ftran[0]*ftran[0]+ftran[1]*ftran[1]); - fCylPhi = TMath::ATan2(ftran[1],ftran[0]); - if(fCylPhi<0.0) fCylPhi += TMath::Pi(); + // Sets the translation vector and computes fCylR and fCylPhi. + // Inputs: + // Double_t trans[3] The translation vector to be used + // Outputs: + // none. + // Return: + // none. + for(Int_t i=0;i<3;i++) ftran[i] = tran[i]; + fCylR = TMath::Sqrt(ftran[0]*ftran[0]+ftran[1]*ftran[1]); + fCylPhi = TMath::ATan2(ftran[1],ftran[0]); + if(fCylPhi<0.0) fCylPhi += TMath::Pi(); +} +//---------------------------------------------------------------------- +TPolyLine3D* AliITSgeomMatrix::CreateLocalAxis(){ + // This class is used as part of the documentation of this class + // Inputs: + // none. + // Outputs: + // none. + // Return: + // A pointer to a new TPolyLine3D object showing the 3 line + // segments that make up the this local axis in the global + // reference system. + Float_t gf[15]; + Double_t g[5][3]; + Double_t l[5][3]={{1.0,0.0,0.0},{0.0,0.0,0.0},{0.0,1.0,0.0},{0.0,0.0,0.0}, + {0.0,0.0,1.0}}; + Int_t i; + + for(i=0;i<5;i++) { + LtoGPosition(l[i],g[i]); + gf[3*i]=(Float_t)g[i][0]; + gf[3*i+1]=(Float_t)g[i][1]; + gf[3*i+2]=(Float_t)g[i][2]; + } // end for i + return new TPolyLine3D(5,gf); +} +//---------------------------------------------------------------------- +TPolyLine3D* AliITSgeomMatrix::CreateLocalAxisTracking(){ + // This class is used as part of the documentation of this class + // Inputs: + // none. + // Outputs: + // none. + // Return: + // A pointer to a new TPolyLine3D object showing the 3 line + // segments that make up the this local axis in the global + // reference system. + Float_t gf[15]; + Double_t g[5][3]; + Double_t l[5][3]={{1.0,0.0,0.0},{0.0,0.0,0.0},{0.0,1.0,0.0},{0.0,0.0,0.0}, + {0.0,0.0,1.0}}; + Int_t i; + + for(i=0;i<5;i++) { + LtoGPositionTracking(l[i],g[i]); + gf[3*i]=(Float_t)g[i][0]; + gf[3*i+1]=(Float_t)g[i][1]; + gf[3*i+2]=(Float_t)g[i][2]; + } // end for i + return new TPolyLine3D(5,gf); +} +//---------------------------------------------------------------------- +TNode* AliITSgeomMatrix::CreateNode(const Char_t *nodeName, + const Char_t *nodeTitle,TNode *mother, + TShape *shape,Bool_t axis){ + // Creates a node inside of the node mother out of the shape shape + // in the position, with respect to mother, indecated by "this". If axis + // is ture, it will insert an axis within this node/shape. + // Inputs: + // Char_t *nodeName This name of this node + // Char_t *nodeTitle This node title + // TNode *mother The node this node will be inside of/with respect to + // TShape *shape The shape of this node + // Bool_t axis If ture, a set of x,y,z axis will be included + // Outputs: + // none. + // Return: + // A pointer to "this" node. + Double_t trans[3],matrix[3][3],*matr; + TRotMatrix *rot = new TRotMatrix(); + TString name,title; + + matr = &(matrix[0][0]); + this->GetTranslation(trans); + this->GetMatrix(matrix); + rot->SetMatrix(matr); + // + name = nodeName; + title = nodeTitle; + // + mother->cd(); + TNode *node1 = new TNode(name.Data(),title.Data(),shape,trans[0],trans[1],trans[2],rot); + if(axis){ + Int_t i,j; + const Float_t scale=0.5,lw=0.2; + Float_t xchar[13][2]={{0.5*lw,1.},{0.,0.5*lw},{0.5-0.5*lw,0.5}, + {0.,0.5*lw},{0.5*lw,0.},{0.5,0.5-0.5*lw}, + {1-0.5*lw,0.},{1.,0.5*lw},{0.5+0.5*lw,0.5}, + {1.,1.-0.5*lw},{1.-0.5*lw,1.},{0.5,0.5+0.5*lw}, + {0.5*lw,1.}}; + Float_t ychar[10][2]={{.5-0.5*lw,0.},{.5+0.5*lw,0.},{.5+0.5*lw,0.5-0.5*lw}, + {1.,1.-0.5*lw},{1.-0.5*lw,1.},{0.5+0.5*lw,0.5}, + {0.5*lw,1.} ,{0.,1-0.5*lw} ,{0.5-0.5*lw,0.5}, + {.5-0.5*lw,0.}}; + Float_t zchar[11][2]={{0.,1.},{0,1.-lw},{1.-lw,1.-lw},{0.,lw} ,{0.,0.}, + {1.,0.},{1.,lw} ,{lw,lw} ,{1.,1.-lw},{1.,1.}, + {0.,1.}}; + for(i=0;i<13;i++)for(j=0;j<2;j++){ + if(i<13) xchar[i][j] = scale*xchar[i][j]; + if(i<10) ychar[i][j] = scale*ychar[i][j]; + if(i<11) zchar[i][j] = scale*zchar[i][j]; + } // end for i,j + TXTRU *axisxl = new TXTRU("x","x","text",12,2); + for(i=0;i<12;i++) axisxl->DefineVertex(i,xchar[i][0],xchar[i][1]); + axisxl->DefineSection(0,-0.5*lw);axisxl->DefineSection(1,0.5*lw); + TXTRU *axisyl = new TXTRU("y","y","text",9,2); + for(i=0;i<9;i++) axisyl->DefineVertex(i,ychar[i][0],ychar[i][1]); + axisyl->DefineSection(0,-0.5*lw);axisyl->DefineSection(1,0.5*lw); + TXTRU *axiszl = new TXTRU("z","z","text",10,2); + for(i=0;i<10;i++) axiszl->DefineVertex(i,zchar[i][0],zchar[i][1]); + axiszl->DefineSection(0,-0.5*lw);axiszl->DefineSection(1,0.5*lw); + Float_t lxy[13][2]={{-0.5*lw,-0.5*lw},{0.8,-0.5*lw},{0.8,-0.1},{1.0,0.0}, + {0.8,0.1},{0.8,0.5*lw},{0.5*lw,0.5*lw},{0.5*lw,0.8}, + {0.1,0.8},{0.0,1.0},{-0.1,0.8},{-0.5*lw,0.8}, + {-0.5*lw,-0.5*lw}}; + TXTRU *axisxy = new TXTRU("axisxy","axisxy","text",13,2); + for(i=0;i<13;i++) axisxy->DefineVertex(i,lxy[i][0],lxy[i][1]); + axisxy->DefineSection(0,-0.5*lw);axisxy->DefineSection(1,0.5*lw); + Float_t lz[8][2]={{0.5*lw,-0.5*lw},{0.8,-0.5*lw},{0.8,-0.1},{1.0,0.0}, + {0.8,0.1},{0.8,0.5*lw},{0.5*lw,0.5*lw}, + {0.5*lw,-0.5*lw}}; + TXTRU *axisz = new TXTRU("axisz","axisz","text",8,2); + for(i=0;i<8;i++) axisz->DefineVertex(i,lz[i][0],lz[i][1]); + axisz->DefineSection(0,-0.5*lw);axisz->DefineSection(1,0.5*lw); + //TRotMatrix *xaxis90= new TRotMatrix("xaixis90","",90.0, 0.0, 0.0); + TRotMatrix *yaxis90= new TRotMatrix("yaixis90","", 0.0,90.0, 0.0); + TRotMatrix *zaxis90= new TRotMatrix("zaixis90","", 0.0, 0.0,90.0); + // + node1->cd(); + title = name.Append("axisxy"); + TNode *nodeaxy = new TNode(title.Data(),title.Data(),axisxy); + title = name.Append("axisz"); + TNode *nodeaz = new TNode(title.Data(),title.Data(),axisz,0.,0.,0.,yaxis90); + TNode *textboxX0 = new TNode("textboxX0","textboxX0",axisxl, + lxy[3][0],lxy[3][1],0.0); + TNode *textboxX1 = new TNode("textboxX1","textboxX1",axisxl, + lxy[3][0],lxy[3][1],0.0,yaxis90); + TNode *textboxX2 = new TNode("textboxX2","textboxX2",axisxl, + lxy[3][0],lxy[3][1],0.0,zaxis90); + TNode *textboxY0 = new TNode("textboxY0","textboxY0",axisyl, + lxy[9][0],lxy[9][1],0.0); + TNode *textboxY1 = new TNode("textboxY1","textboxY1",axisyl, + lxy[9][0],lxy[9][1],0.0,yaxis90); + TNode *textboxY2 = new TNode("textboxY2","textboxY2",axisyl, + lxy[9][0],lxy[9][1],0.0,zaxis90); + TNode *textboxZ0 = new TNode("textboxZ0","textboxZ0",axiszl, + 0.0,0.0,lz[3][0]); + TNode *textboxZ1 = new TNode("textboxZ1","textboxZ1",axiszl, + 0.0,0.0,lz[3][0],yaxis90); + TNode *textboxZ2 = new TNode("textboxZ2","textboxZ2",axiszl, + 0.0,0.0,lz[3][0],zaxis90); + nodeaxy->Draw(); + nodeaz->Draw(); + textboxX0->Draw(); + textboxX1->Draw(); + textboxX2->Draw(); + textboxY0->Draw(); + textboxY1->Draw(); + textboxY2->Draw(); + textboxZ0->Draw(); + textboxZ1->Draw(); + textboxZ2->Draw(); + } // end if + mother->cd(); + return node1; } +//---------------------------------------------------------------------- +void AliITSgeomMatrix::MakeFigures(){ + // make figures to help document this class + // Inputs: + // none. + // Outputs: + // none. + // Return: + // none. + const Double_t dx0=550.,dy0=550.,dz0=550.; // cm + const Double_t dx=1.0,dy=0.300,dz=3.0,rmax=0.1; // cm + Float_t l[5][3]={{1.0,0.0,0.0},{0.0,0.0,0.0},{0.0,1.0,0.0},{0.0,0.0,0.0}, + {0.0,0.0,1.0}}; + TCanvas *c = new TCanvas(kFALSE);// create a batch mode canvas. + TView *view = new TView(1); // Create Cartesian coordiante view + TBRIK *mother = new TBRIK("Mother","Mother","void",dx0,dy0,dz0); + TBRIK *det = new TBRIK("Detector","","Si",dx,dy,dz); + TPolyLine3D *axis = new TPolyLine3D(5,&(l[0][0])); + TPCON *arrow = new TPCON("arrow","","air",0.0,360.,2); + TRotMatrix *xarrow= new TRotMatrix("xarrow","",90.,0.0,0.0); + TRotMatrix *yarrow= new TRotMatrix("yarrow","",0.0,90.,0.0); + det->SetLineColor(0); // black + det->SetLineStyle(1); // solid line + det->SetLineWidth(2); // pixel units + det->SetFillColor(1); // black + det->SetFillStyle(4010); // window is 90% transparent + arrow->SetLineColor(det->GetLineColor()); + arrow->SetLineWidth(det->GetLineWidth()); + arrow->SetLineStyle(det->GetLineStyle()); + arrow->SetFillColor(1); // black + arrow->SetFillStyle(4100); // window is 100% opaque + arrow->DefineSection(0,0.0,0.0,rmax); + arrow->DefineSection(1,2.*rmax,0.0,0.0); + view->SetRange(-dx0,-dy0,-dz0,dx0,dy0,dz0); + // + TNode *node0 = new TNode("NODE0","NODE0",mother); + node0->cd(); + TNode *node1 = new TNode("NODE1","NODE1",det); + node1->cd(); + TNode *nodex = new TNode("NODEx","NODEx",arrow,l[0][0],l[0][1],l[0][2],xarrow); + TNode *nodey = new TNode("NODEy","NODEy",arrow,l[2][0],l[2][1],l[2][2],yarrow); + TNode *nodez = new TNode("NODEz","NODEz",arrow,l[4][0],l[4][1],l[4][2]); + // + axis->Draw(); + nodex->Draw(); + nodey->Draw(); + nodez->Draw(); + + // + node0->cd(); + node0->Draw(); + c->Update(); + c->SaveAs("AliITSgeomMatrix_L1.gif"); +} //---------------------------------------------------------------------- ostream &operator<<(ostream &os,AliITSgeomMatrix &p){ -//////////////////////////////////////////////////////////////////////// -// Standard output streaming function. -//////////////////////////////////////////////////////////////////////// + // Standard output streaming function. + // Inputs: + // ostream &os The output stream to print the class data on + // AliITSgeomMatrix &p This class + // Outputs: + // none. + // Return: + // none. p.Print(&os); return os; } //---------------------------------------------------------------------- istream &operator>>(istream &is,AliITSgeomMatrix &r){ -//////////////////////////////////////////////////////////////////////// -// Standard input streaming function. -//////////////////////////////////////////////////////////////////////// + // Standard input streaming function. + // Inputs: + // ostream &os The input stream to print the class data on + // AliITSgeomMatrix &p This class + // Outputs: + // none. + // Return: + // none. r.Read(&is); return is; diff --git a/ITS/AliITSgeomMatrix.h b/ITS/AliITSgeomMatrix.h index 97591533f57..09ed5be75bf 100644 --- a/ITS/AliITSgeomMatrix.h +++ b/ITS/AliITSgeomMatrix.h @@ -2,16 +2,21 @@ #define ALIITSGEOMMATRIX_H /* Copyright(c) 2000, ALICE Experiment at CERN, All rights reserved. * * see cxx source for full Copyright notice. */ -/* $Id: */ -//////////////////////////////////////////////////////////////////////// -// ITS geometry manipulation routines on the module level. This class is -// to replace the structure ITS_geom in the class AliITSgeom. -// Created May 30 2000. -// version 0.0.0 -// By Bjorn S. Nilsen -//////////////////////////////////////////////////////////////////////// - +/* +$Id: +*/ +/* + ITS geometry manipulation routines on the module level. This class is + to replace the structure ITS_geom in the class AliITSgeom. + Created May 30 2000. + version 0.0.0 + By Bjorn S. Nilsen +*/ #include +#include +class TPolyLine3D; +class TNode; +class TShape; class AliITSgeomMatrix : public TObject { public: @@ -40,9 +45,15 @@ class AliITSgeomMatrix : public TObject { void PrintTitles(ostream *os) const; // Reads in the content of this class in the format of Print void Read(istream *is); - virtual void Print(Option_t *option="") const {TObject::Print(option);} - virtual Int_t Read(const char *name) {return TObject::Read(name);} + virtual void Print(Option_t *option="") const { + TObject::Print(option);} + virtual Int_t Read(const char *name) {return TObject::Read(name);} + // Returns the geometry path corresponding to this transformation + TString& GetPath(){return fPath;} + // Sets the geometry path + void SetPath(const Char_t *p){fPath = p;} + void SetPath(const TString &p){fPath = p;} // Given the rotation angles [radians] it fills frot and computes // the rotation matrix fm. void SetAngles(const Double_t rot[3]){// [radians] @@ -50,7 +61,7 @@ class AliITSgeomMatrix : public TObject { // Sets the translation vector and computes fCylR and fCylPhi. void SetTranslation(const Double_t tran[3]); // sets the rotation matrix and computes the rotation angles [radians] - void SetMatrix(Double_t matrix[3][3]){ for(Int_t i=0;i<3;i++) + void SetMatrix(const Double_t matrix[3][3]){ for(Int_t i=0;i<3;i++) for(Int_t j=0;j<3;j++) fm[i][j]=matrix[i][j];this->AngleFromMatrix();} // Sets the detector index value void SetDetectorIndex(Int_t idt) {fDetectorIndex = idt;} @@ -101,11 +112,11 @@ class AliITSgeomMatrix : public TObject { // given a position error matrix in ALICE Cartesian global // coordinates [cm] returns a position error matrix in detector/ // module local Cartesian local coordinates [cm] - void GtoLPositionError(Double_t g[3][3],Double_t l[3][3]) const; + void GtoLPositionError(const Double_t g[3][3],Double_t l[3][3]) const; // given a position error matrix in detector/module Cartesian local // coordinates [cm] returns a position error matrix in ALICE // Cartesian global coordinates [cm] - void LtoGPositionError(Double_t l[3][3],Double_t g[3][3]) const; + void LtoGPositionError(const Double_t l[3][3],Double_t g[3][3]) const; // Tracking Related Routines void GtoLPositionTracking(const Double_t g[3],Double_t l[3]) const; // Given a position in Cartesian Tracking global coordinates [cm] @@ -122,18 +133,26 @@ class AliITSgeomMatrix : public TObject { // given a position error matrix in Tracking Cartesian global // coordinates [cm] returns a position error matrix in detector/ // module local Cartesian local coordinates [cm] - void GtoLPositionErrorTracking(Double_t g[3][3], + void GtoLPositionErrorTracking(const Double_t g[3][3], Double_t l[3][3]) const; // given a position error matrix in detector/module Cartesian local // coordinates [cm] returns a position error matrix in Tracking // Cartesian global coordinates [cm] - void LtoGPositionErrorTracking(Double_t l[3][3], + void LtoGPositionErrorTracking(const Double_t l[3][3], Double_t g[3][3]) const; // Computes the distance squared [cm^2] between a point t[3] and // this module/detector Double_t Distance2(const Double_t t[3]) const {Double_t d=0.0,q; for(Int_t i=0;i<3;i++){q = t[i]-ftran[i]; d += q*q;} return d;} + // + // Documentation related Class + TPolyLine3D* CreateLocalAxis(); + TPolyLine3D* CreateLocalAxisTracking(); + TNode* CreateNode(const Char_t *nodeName,const Char_t *nodeTitle, + TNode *mother,TShape *shape,Bool_t axis=kTRUE); + void MakeFigures(); + // private: // private functions // Given the rotation matrix fm it fills the rotation angles frot void MatrixFromAngle(); @@ -146,13 +165,14 @@ class AliITSgeomMatrix : public TObject { Double_t ftran[3]; // Translation vector of module x,y,z. Double_t fCylR,fCylPhi; //! Translation vector in Cylindrical coord. Double_t fm[3][3]; // Rotation matrix based on frot. + TString fPath; // Path within Geometry to this volume // Note, fCylR and fCylPhi are added as data members because it costs // about a factor of 10 to compute them over looking them up. Since // they are used in some tracking algorithms this can be a large cost // in computing time. They are not written out but computed. - ClassDef(AliITSgeomMatrix,1) // Matrix class used by AliITSgeom. + ClassDef(AliITSgeomMatrix,2) // Matrix class used by AliITSgeom. }; // Input and output function for standard C++ input/output. ostream &operator<<(ostream &os,AliITSgeomMatrix &source); diff --git a/ITS/AliITSgeomSDD.cxx b/ITS/AliITSgeomSDD.cxx index dafb880455f..2ede369735d 100644 --- a/ITS/AliITSgeomSDD.cxx +++ b/ITS/AliITSgeomSDD.cxx @@ -29,7 +29,22 @@ #include "AliITSgeomSDD.h" ClassImp(AliITSgeomSDD) -AliITSgeomSDD::AliITSgeomSDD(){ +AliITSgeomSDD::AliITSgeomSDD(): +TObject(), +fPeriod(0.0), +fDvelocity(0.0), +fNAnodesL(0), +fNAnodesR(0), +fAnodeXL(0.0), +fAnodeXR(0.0), +fAnodeLowEdgeL(0), +fAnodeLowEdgeR(0), +fName(), +fTitle(), +fMat(), +fDx(0.0), +fDy(0.0), +fDz(0.0){ //////////////////////////////////////////////////////////////////////// // default constructor //////////////////////////////////////////////////////////////////////// @@ -37,7 +52,6 @@ AliITSgeomSDD::AliITSgeomSDD(){ // const Float_t kDy = 0.014;//cm. (Geant 3.12 units) Radialy from the Beam // const Float_t kDz = 3.763;//cm. (Geant 3.12 units) Allong the Beam Pipe -// cout << "AliITSgeomSDD default creator called: start" << endl; fPeriod = 0.0; fDvelocity = 0.0; fNAnodesL = 0; @@ -46,14 +60,27 @@ AliITSgeomSDD::AliITSgeomSDD(){ fAnodeXR = 0.0; fAnodeLowEdgeL = 0; fAnodeLowEdgeR = 0; - fShapeSDD = 0; -// cout << "AliITSgeomSDD default creator called: end" << endl; } //________________________________________________________________________ AliITSgeomSDD::AliITSgeomSDD(const Float_t *box,Float_t per,Float_t vel, Float_t axL,Float_t axR, Int_t nAL,Float_t *leL, - Int_t nAR,Float_t *leR){ + Int_t nAR,Float_t *leR): +TObject(), +fPeriod(0.0), +fDvelocity(0.0), +fNAnodesL(0), +fNAnodesR(0), +fAnodeXL(0.0), +fAnodeXR(0.0), +fAnodeLowEdgeL(0), +fAnodeLowEdgeR(0), +fName(), +fTitle(), +fMat(), +fDx(0.0), +fDy(0.0), +fDz(0.0){ //////////////////////////////////////////////////////////////////////// // Standard constructor //////////////////////////////////////////////////////////////////////// @@ -65,7 +92,6 @@ AliITSgeomSDD::AliITSgeomSDD(const Float_t *box,Float_t per,Float_t vel, fAnodeXR = 0.0; fAnodeLowEdgeL = 0; fAnodeLowEdgeR = 0; - fShapeSDD = 0; ResetSDD(box,per,vel,axL,axR,nAL,leL,nAR,leR); } //________________________________________________________________________ @@ -84,23 +110,25 @@ void AliITSgeomSDD::ResetSDD(const Float_t *box,Float_t per,Float_t vel, fNAnodesR = nAR; fAnodeXL = axL; fAnodeXR = axR; -// if(fAnodeLowEdgeL!=0) delete fAnodeLowEdgeL; + if(fAnodeLowEdgeL!=0) delete fAnodeLowEdgeL; fAnodeLowEdgeL = new Float_t[fNAnodesL]; -// if(fAnodeLowEdgeR!=0) delete fAnodeLowEdgeR; + if(fAnodeLowEdgeR!=0) delete fAnodeLowEdgeR; fAnodeLowEdgeR = new Float_t[fNAnodesR]; for(i=0;ifShapeSDD = new TBRIK(*(source.fShapeSDD)); + fName=source.fName; + fTitle=source.fTitle; + fMat=source.fMat; + fDx=source.fDx; + fDy=source.fDy; + fDz=source.fDz; this->fPeriod = source.fPeriod; this->fDvelocity = source.fDvelocity; this->fNAnodesL = source.fNAnodesL; @@ -137,7 +170,12 @@ AliITSgeomSDD& AliITSgeomSDD::operator=(AliITSgeomSDD &source){ Int_t i; if(this==&source) return *this; - this->fShapeSDD = new TBRIK(*(source.fShapeSDD)); + fName=source.fName; + fTitle=source.fTitle; + fMat=source.fMat; + fDx=source.fDx; + fDy=source.fDy; + fDz=source.fDz; this->fPeriod = source.fPeriod; this->fDvelocity = source.fDvelocity; this->fNAnodesL = source.fNAnodesL; @@ -236,14 +274,13 @@ void AliITSgeomSDD::Read(istream *is){ // Standard input format for this class. //////////////////////////////////////////////////////////////////////// Int_t i; - Float_t dx,dy,dz; char shp[20]; *is >> shp; - *is >> dx >> dy >> dz; - if(fShapeSDD!=0) delete fShapeSDD; - fShapeSDD = new TBRIK("ActiveSDD","Active volume of SDD","SDD SI DET", - dx,dy,dz); + *is >> fDx >> fDy >> fDz; + fName="AcrtiveSDD"; + fTitle="Active volulme of SDD"; + fMat="SDD Si Det"; *is >> fPeriod >> fDvelocity >> fNAnodesL >> fNAnodesR; *is >> fAnodeXL >> fAnodeXR; if(fAnodeLowEdgeL!=0) delete fAnodeLowEdgeL; @@ -693,13 +730,11 @@ _____________________________________________ npar); return; } // end if -// cout << "AliITSgeomSDD256 default creator called: start" << end; anodeLowEdges[0] = kAnodesZ; for(i=0;iGetDx(); - else return 0.0;} - virtual Float_t GetDy() const {// Get TBRIK Dy - if(fShapeSDD!=0) return fShapeSDD->GetDy(); - else return 0.0;} - virtual Float_t GetDz() const {// Get TBRIK Dz - if(fShapeSDD!=0) return fShapeSDD->GetDz(); - else return 0.0;} + virtual TShape *GetShape() const {return new TBRIK(fName.Data(), + fTitle.Data(),fMat.Data(),GetDx(),GetDy(),GetDz());} + virtual Float_t GetDx() const {return fDx;} // Get TBRIK Dx + virtual Float_t GetDy() const {return fDy;}// Get TBRIK Dy + virtual Float_t GetDz() const {return fDz;}// Get TBRIK Dz virtual Float_t GetAnodeX(Int_t a,Int_t s) const { // returns X position of anode a = 0; if(s==0) return fAnodeXL; else return fAnodeXR;} @@ -56,8 +51,8 @@ class AliITSgeomSDD: public TObject { virtual void SetDriftVelocity(Float_t s) {fDvelocity = s;} // sets the SDD Drift velocity cm/s. virtual void SetShape(char *name,char *title,char *mat, - Float_t dx,Float_t dy,Float_t dz) - {fShapeSDD = new TBRIK(name,title,mat,dx,dy,dz);} + Float_t dx,Float_t dy,Float_t dz){fName=name; + fTitle=title;fMat=mat;fDx=dx;fDy=dy;fDz=dz;} virtual void Local2Det(Float_t xl,Float_t zl,Int_t &a,Int_t &t,Int_t &s); virtual void Det2Local(Int_t a,Int_t t,Int_t s,Float_t &xl,Float_t &zl); virtual void Print(ostream *os) const; // Output streamer to standard out. @@ -78,9 +73,14 @@ class AliITSgeomSDD: public TObject { Float_t fAnodeXR; // Anode location in x Right side Float_t *fAnodeLowEdgeL; //[fNAnodesL] Anode spacing left edge Float_t *fAnodeLowEdgeR; //[fNAnodesR] Anode spacing right edge - TBRIK *fShapeSDD; // shape of sensitive volume + TString fName; // Object name + TString fTitle; // Ojbect title + TString fMat; // Object material name Replacement for TBRIK + Float_t fDx; // half length in z Replacement for TBRIK + Float_t fDy; // half length in y Replacement for TBRIK + Float_t fDz; // half length in z Replacement for TBRIK - ClassDef(AliITSgeomSDD,1) // ITS SDD detector geometry class + ClassDef(AliITSgeomSDD,2) // ITS SDD detector geometry class }; // Input and output function for standard C++ input/output. @@ -129,7 +129,6 @@ istream &operator>>(istream &os,AliITSgeomSDD256 &source); //#include "AliITSgeomSDD.h" - class AliITSgeomSDD300 : public AliITSgeomSDD { public: diff --git a/ITS/AliITSgeomSPD.cxx b/ITS/AliITSgeomSPD.cxx index 189c6b4cd20..90fb66459d7 100644 --- a/ITS/AliITSgeomSPD.cxx +++ b/ITS/AliITSgeomSPD.cxx @@ -23,6 +23,7 @@ //////////////////////////////////////////////////////////////////////// #include +#include #include #include @@ -30,25 +31,36 @@ ClassImp(AliITSgeomSPD) -AliITSgeomSPD::AliITSgeomSPD(){ +AliITSgeomSPD::AliITSgeomSPD(): +TObject(), +fName(), +fTitle(), +fMat(), +fDx(0.0), +fDy(0.0), +fDz(0.0), +fNbinx(0), +fNbinz(0), +fLowBinEdgeX(0), +fLowBinEdgeZ(0){ // Default Constructor. Set everthing to null. - - fShapeSPD = 0; - fNbinx = 0; - fNbinz = 0; - fLowBinEdgeX = 0; - fLowBinEdgeZ = 0; } //______________________________________________________________________ AliITSgeomSPD::AliITSgeomSPD(Float_t dy,Int_t nx,Float_t *bx, - Int_t nz,Float_t *bz){ + Int_t nz,Float_t *bz): +TObject(), +fName(), +fTitle(), +fMat(), +fDx(0.0), +fDy(0.0), +fDz(0.0), +fNbinx(0), +fNbinz(0), +fLowBinEdgeX(0), +fLowBinEdgeZ(0){ // Standard Constructor. Set everthing to null. - fShapeSPD = 0; - fNbinx = 0; - fNbinz = 0; - fLowBinEdgeX = 0; - fLowBinEdgeZ = 0; ReSetBins(dy,nx,bx,nz,bz); return; } @@ -65,9 +77,10 @@ void AliITSgeomSPD::ReSetBins(Float_t dy,Int_t nx,Float_t *bx, dx *= 0.5; dz *= 0.5; - delete fShapeSPD; // delete existing shape - if(this->fLowBinEdgeX) delete[] this->fLowBinEdgeX; // delete existing - if(this->fLowBinEdgeZ) delete[] this->fLowBinEdgeZ; // delete existing + if(fLowBinEdgeX) delete[] fLowBinEdgeX; // delete existing + if(fLowBinEdgeZ) delete[] fLowBinEdgeZ; // delete existing + fLowBinEdgeX = 0; + fLowBinEdgeZ = 0; SetNbinX(nx); SetNbinZ(nz); @@ -77,7 +90,7 @@ void AliITSgeomSPD::ReSetBins(Float_t dy,Int_t nx,Float_t *bx, fLowBinEdgeZ[0] = -dz; for(i=0;ifShapeSPD = new TBRIK(*(source.fShapeSPD)); - if(this->fLowBinEdgeX) delete[] this->fLowBinEdgeX; - if(this->fLowBinEdgeZ) delete[] this->fLowBinEdgeZ; + fName=source.fName; + fTitle=source.fTitle; + fMat=source.fMat; + fDx=source.fDx; + fDy=source.fDy; + fDz=source.fDz; + if(this->fLowBinEdgeX) delete[] (this->fLowBinEdgeX); + if(this->fLowBinEdgeZ) delete[] (this->fLowBinEdgeZ); this->fNbinx = source.fNbinx; this->fNbinz = source.fNbinz; this->InitLowBinEdgeX(); @@ -108,16 +126,38 @@ AliITSgeomSPD& AliITSgeomSPD::operator=(AliITSgeomSPD &source){ AliITSgeomSPD::~AliITSgeomSPD(){ // Destructor - delete fShapeSPD; - if(this->fLowBinEdgeX) delete[] this->fLowBinEdgeX; - if(this->fLowBinEdgeZ) delete[] this->fLowBinEdgeZ; - fShapeSPD = 0; + if(fLowBinEdgeX) delete[] fLowBinEdgeX; + if(fLowBinEdgeZ) delete[] fLowBinEdgeZ; fNbinx = 0; fNbinz = 0; fLowBinEdgeX = 0; fLowBinEdgeZ = 0; } //______________________________________________________________________ +void AliITSgeomSPD::SetShape(const char *name,const char *title, + const char *mat,Float_t dx,Float_t dy,Float_t dz){ + // Delete any existing shape info and replace it with a new + // shape information. + // Inputs: + // char * name Name of the shape + // char * title Title of the shape + // char * mat Material name for the shape + // Float_t dx half width of the shape [cm] + // Float_t dy half thickness of the shape [cm] + // Float_t dz half length of the shape [cm] + // Outputs: + // none. + // Return: + // none. + + fName = name; + fTitle = title; + fDx = dx; + fDy = dy; + fDz = dz; + return; +} +//______________________________________________________________________ void AliITSgeomSPD::LToDet(Float_t xl,Float_t zl,Int_t &row,Int_t &col){ // Returns the row and column pixel numbers for a given local coordinate // system. If they are outside then it will return -1 or fNbinx/z. @@ -188,8 +228,7 @@ void AliITSgeomSPD::Read(istream *is){ *is >> shape; if(strcmp(shape,"TBRIK")) Warning("::Read","Shape not a TBRIK"); *is >> dx >> dy >> dz; - if(fShapeSPD!=0) delete fShapeSPD; - SetShape("ActiveSPD","Active volume of SPD","SPD SI DET",dx,dy,dz); + SetShape("ActiveSPD","Active volume of SPD","",dx,dy,dz); *is >> i >> j; SetNbinX(i); SetNbinZ(j); @@ -239,8 +278,6 @@ const Int_t knbinz = 279; // number of pixels along z direction. Int_t i; Float_t dx=0.0,dz=0.0; -// cout << "AliITSgeomSPD300 default creator called: start" << endl; - SetNbinX(knbinx); // default number of bins in x. SetNbinZ(knbinz); // default number of bins in z. @@ -260,8 +297,7 @@ const Int_t knbinz = 279; // number of pixels along z direction. if(TMath::Abs(dx-kdx)>1.0E-4 || TMath::Abs(dz-kdz)>1.0E-4) Warning("Default Creator","Detector size may not be write."); - SetShape("ActiveSPD","Active volume of SPD","SPD SI DET",dx,kdy,dz); -// cout << "AliITSgeomSPD300 default creator called: end" << endl; + SetShape("ActiveSPD","Active volume of SPD","",dx,kdy,dz); } //---------------------------------------------------------------------- ostream &operator<<(ostream &os,AliITSgeomSPD300 &p){ @@ -348,7 +384,7 @@ AliITSgeomSPD425Short::AliITSgeomSPD425Short(Int_t npar,Float_t *par) : "npar=%d<3 array par must be at least [3] or larger",npar); return; } // end if - SetShape("ActiveSPD","Active volume of SPD","SPD SI DET", + SetShape("ActiveSPD","Active volume of SPD","", par[0],par[1],par[2]); if(TMath::Abs(dx-kdx)>1.0E-4 || TMath::Abs(dz-kdz)>1.0E-4) Warning("Default Creator","Detector size may not be write."); @@ -433,7 +469,7 @@ AliITSgeomSPD425Long::AliITSgeomSPD425Long(){ for(i=0;i1.0E-4 || TMath::Abs(dz-kdz)>1.0E-4) Warning("Default Creator","Detector size may not be write."); diff --git a/ITS/AliITSgeomSPD.h b/ITS/AliITSgeomSPD.h index ec6f1444f51..858565cfb29 100644 --- a/ITS/AliITSgeomSPD.h +++ b/ITS/AliITSgeomSPD.h @@ -4,7 +4,7 @@ * See cxx source for full Copyright notice */ /* $Id$ */ - +#include #include #include @@ -27,16 +27,11 @@ class AliITSgeomSPD : public TObject { virtual ~AliITSgeomSPD(); virtual void ReSetBins(Float_t dy,Int_t nx,Float_t *bx, Int_t nz,Float_t *bz); - virtual TShape *GetShape() const {return fShapeSPD;} - virtual Float_t GetDx() const { // Get TBRIK Dx - if(fShapeSPD!=0) return fShapeSPD->GetDx(); - else return 0.0;} - virtual Float_t GetDy() const {// Get TBRIK Dy - if(fShapeSPD!=0) return fShapeSPD->GetDy(); - else return 0.0;} - virtual Float_t GetDz() const {// Get TBRIK Dz - if(fShapeSPD!=0) return fShapeSPD->GetDz(); - else return 0.0;} + virtual TShape *GetShape() const {return new TBRIK(fName.Data(), + fTitle.Data(),fMat.Data(),GetDx(),GetDy(),GetDz());} + virtual Float_t GetDx() const {return fDx;} // Get TBRIK Dx + virtual Float_t GetDy() const {return fDy;}// Get TBRIK Dy + virtual Float_t GetDz() const {return fDz;}// Get TBRIK Dz virtual Int_t GetNbinsX() const {return fNbinx-1;} // returns the number of bins x virtual Int_t GetNbinsZ() const {return fNbinz-1;} // returns the number of bins z virtual Float_t GetBinSizeX(Int_t i) const @@ -58,8 +53,7 @@ class AliITSgeomSPD : public TObject { if(fLowBinEdgeZ!=0) delete[] fLowBinEdgeZ; if(fNbinz>0) fLowBinEdgeZ = new Float_t[fNbinz];else fLowBinEdgeZ = 0;} virtual void SetShape(const char *name,const char *title,const char *mat, - Float_t dx,Float_t dy,Float_t dz) - {fShapeSPD = new TBRIK(name,title,mat,dx,dy,dz);}; + Float_t dx,Float_t dy,Float_t dz); virtual void SetNbinX(Int_t i){fNbinx = i+1;} // Set nubmer of pixels in x virtual void SetNbinZ(Int_t i){fNbinz = i+1;} // Set nubmer of pixels in z virtual void SetLowBinEdgeX(Int_t i,Float_t s){//puts value in fLowbinEdgeX @@ -74,13 +68,18 @@ class AliITSgeomSPD : public TObject { virtual Int_t Read(const char *name) {return TObject::Read(name);} protected: - TBRIK *fShapeSPD; // SPD active area shape + TString fName; // Object name Replacement for TBRIK + TString fTitle; // Ojbect title Replacement for TBRIK + TString fMat; // Object material name Replacement for TBRIK + Float_t fDx; // half length in z Replacement for TBRIK + Float_t fDy; // half length in y Replacement for TBRIK + Float_t fDz; // half length in z Replacement for TBRIK Int_t fNbinx; // the number of elements in fLowBinEdgeX (#bins-1) Int_t fNbinz; // the number of elements in fLowBinEdgeZ (#bins-1) Float_t *fLowBinEdgeX; //[fNbinx] Array of X lower bin edges for the pixels Float_t *fLowBinEdgeZ; //[fNbinz] Array of Z lower bin edges for the pixels - ClassDef(AliITSgeomSPD,1) // ITS SPD detector geometry class.. + ClassDef(AliITSgeomSPD,2) // ITS SPD detector geometry class.. }; // Input and output function for standard C++ input/output. diff --git a/ITS/AliITSgeomSSD.cxx b/ITS/AliITSgeomSSD.cxx index 1727ac43a9a..4f46d4b98a2 100644 --- a/ITS/AliITSgeomSSD.cxx +++ b/ITS/AliITSgeomSSD.cxx @@ -32,9 +32,21 @@ ClassImp(AliITSgeomSSD) -AliITSgeomSSD::AliITSgeomSSD(){ +AliITSgeomSSD::AliITSgeomSSD(): +TObject(), +fName(), +fTitle(), +fMat(), +fDx(0.0), +fDy(0.0), +fDz(0.0), +fNp(0), +fNn(0), +fLowEdgeP(0), +fLowEdgeN(0), +fAngleP(0.0), +fAngleN(0.0){ // Default constructor - fShapeSSD = 0; fNp = 0; fNn = 0; fLowEdgeP = 0; @@ -44,13 +56,25 @@ AliITSgeomSSD::AliITSgeomSSD(){ } //---------------------------------------------------------------------- AliITSgeomSSD::AliITSgeomSSD(const Float_t *box,Float_t ap,Float_t an, - Int_t np,Float_t *p,Int_t nn,Float_t *n){ + Int_t np,Float_t *p,Int_t nn,Float_t *n): +TObject(), +fName(), +fTitle(), +fMat(), +fDx(0.0), +fDy(0.0), +fDz(0.0), +fNp(0), +fNn(0), +fLowEdgeP(0), +fLowEdgeN(0), +fAngleP(0.0), +fAngleN(0.0){ //////////////////////////////////////////////////////////////////////// // Standard Constructor. *box={dx,dy,dz}, ap=anode angle, an=cathode angle, // nn= number of cathodes+1,*n= array of cathode low edges+highest edge, // np= number of anodes+1, *p= array of anode low edges+lighest edge. /////////////////////////////////////////////////////////////////////// - fShapeSSD = 0; fNp = 0; fNn = 0; fLowEdgeP = 0; @@ -69,10 +93,14 @@ void AliITSgeomSSD::ResetSSD(const Float_t *box,Float_t ap,Float_t an, /////////////////////////////////////////////////////////////////////// Int_t i; - fShapeSSD = new TBRIK("ActiveSSD","Active volume of SSD","SSD SI DET", - box[0],box[1],box[2]); -// if(fLowEdgeP!=0) delete fLowEdgeP; -// if(fLowEdgeN!=0) delete fLowEdgeN; + fName = "ActiveSSD"; + fTitle = "Active volume of SSD"; + fMat = "SSD Si Det"; + fDx = box[0]; + fDy = box[1]; + fDz = box[2]; + if(fLowEdgeP!=0) delete fLowEdgeP; + if(fLowEdgeN!=0) delete fLowEdgeN; fNp = np; fNn = nn; fAngleP = ap; @@ -88,7 +116,6 @@ AliITSgeomSSD::~AliITSgeomSSD(){ if(fLowEdgeP) delete [] fLowEdgeP; fLowEdgeP = 0; if(fLowEdgeN) delete [] fLowEdgeN; fLowEdgeN = 0; - if(fShapeSSD) delete fShapeSSD; fShapeSSD = 0; fNp = 0; fNn = 0; fAngleP = 0.0; @@ -102,7 +129,12 @@ AliITSgeomSSD::AliITSgeomSSD(const AliITSgeomSSD &source) : TObject(source){ Int_t i; if(this == &source) return; - this->fShapeSSD = new TBRIK(*(source.fShapeSSD)); + fName = source.fName; + fTitle = source.fTitle; + fMat = source.fMat; + fDx = source.fDx; + fDy = source.fDy; + fDz = source.fDz; this->fNp = source.fNp; this->fNn = source.fNn; delete fLowEdgeP; @@ -123,7 +155,12 @@ AliITSgeomSSD& AliITSgeomSSD::operator=(const AliITSgeomSSD &source) { Int_t i; if(this == &source) return *this; - this->fShapeSSD = new TBRIK(*(source.fShapeSSD)); + fName = source.fName; + fTitle = source.fTitle; + fMat = source.fMat; + fDx = source.fDx; + fDy = source.fDy; + fDz = source.fDz; this->fNp = source.fNp; this->fNn = source.fNn; delete fLowEdgeP; @@ -214,15 +251,11 @@ void AliITSgeomSSD::Read(istream *is){ //////////////////////////////////////////////////////////////////////// // Standard input format for this class. //////////////////////////////////////////////////////////////////////// - Float_t dx,dy,dz; Int_t i; char shp[20]; *is >> shp; - *is >> dx >> dy >> dz; - if(fShapeSSD!=0) delete fShapeSSD; - fShapeSSD = new TBRIK("ActiveSSD","Active volume of SSD","SSD SI DET", - dx,dy,dz); + *is >> fDx >> fDy >> fDz; *is >> fNp >> fNn; *is >> fAngleP >> fAngleN; if(fLowEdgeP !=0) delete fLowEdgeP; @@ -279,12 +312,10 @@ AliITSgeomSSD175::AliITSgeomSSD175() : AliITSgeomSSD(){ } // end for i leA[kNstrips] = kDxyz[0]; leC[kNstrips] = -kDxyz[0]; -// cout << "AliITSgeomSSD175 default creator called: start" << endl; AliITSgeomSSD::ResetSSD(kDxyz,kangle,-kangle, kNstrips+1,leA,kNstrips+1,leC); delete leA; delete leC; -// cout << "AliITSgeomSSD175 default creator called: end" << endl; } //________________________________________________________________________ ostream &operator<<(ostream &os,AliITSgeomSSD175 &p){ @@ -358,12 +389,10 @@ AliITSgeomSSD275and75::AliITSgeomSSD275and75(Int_t npar,Float_t *par) : } // end for i leA[kNstrips] = kDxyz[0]; leC[kNstrips] = -kDxyz[0]; -// cout << "AliITSgeomSSD275and75 default creator called: start" << endl; AliITSgeomSSD::ResetSSD(par,kangleA,kangleC, kNstrips+1,leA,kNstrips+1,leC); delete [] leA; delete [] leC; -// cout << "AliITSgeomSSD275and75 default creator called: end" << endl; } //________________________________________________________________________ ostream &operator<<(ostream &os,AliITSgeomSSD275and75 &p){ @@ -437,12 +466,10 @@ AliITSgeomSSD75and275::AliITSgeomSSD75and275(Int_t npar,Float_t *par) : } // end for i leA[kNstrips] = kDxyz[0]; leC[kNstrips] = -kDxyz[0]; -// cout << "AliITSgeomSSD275and75 default creator called: start" << endl; AliITSgeomSSD::ResetSSD(par,kangleA,kangleC, kNstrips+1,leA,kNstrips+1,leC); delete leA; delete leC; -// cout << "AliITSgeomSSD275and75 default creator called: end" << endl; } //________________________________________________________________________ ostream &operator<<(ostream &os,AliITSgeomSSD75and275 &p){ diff --git a/ITS/AliITSgeomSSD.h b/ITS/AliITSgeomSSD.h index cc6ea84c2fb..3f13f973a92 100644 --- a/ITS/AliITSgeomSSD.h +++ b/ITS/AliITSgeomSSD.h @@ -28,13 +28,11 @@ class AliITSgeomSSD : public TObject { virtual AliITSgeomSSD& operator=(const AliITSgeomSSD &source); // = opt. void ResetSSD(const Float_t *box,Float_t ap,Float_t an, Int_t np,Float_t *p,Int_t nn,Float_t *n); // Filler - virtual TShape *GetShape() const {return fShapeSSD;}// get shape - virtual Float_t GetDx() const {if(fShapeSSD!=0) return fShapeSSD->GetDx(); - else return 0.0;}// get Dx - virtual Float_t GetDy() const {if(fShapeSSD!=0) return fShapeSSD->GetDy(); - else return 0.0;}// get Dy - virtual Float_t GetDz() const {if(fShapeSSD!=0) return fShapeSSD->GetDz(); - else return 0.0;}// get Dz + virtual TShape *GetShape() const {return new TBRIK(fName.Data(), + fTitle.Data(),fMat.Data(),GetDx(),GetDy(),GetDz());}// get shape + virtual Float_t GetDx() const {return fDx;}// get Dx + virtual Float_t GetDy() const {return fDy;}// get Dy + virtual Float_t GetDz() const {return fDz;}// get Dz virtual Int_t GetNAnodes() const {return fNp-1;}//the number of Anodes "P" virtual Int_t GetNCathodess() const {return fNn-1;}//the number of Cathodes "N" virtual Float_t GetAnodePitch(Int_t i=0) const { //anode pitch for anode i @@ -46,7 +44,7 @@ class AliITSgeomSSD : public TObject { virtual void SetShape(char *name,char *title,char *mat, Float_t dx,Float_t dy,Float_t dz){ // defines TBRIK with given paramters - fShapeSSD = new TBRIK(name,title,mat,dx,dy,dz);}; + fName = name;fTitle = title;fMat = mat; fDx=dx;fDy=dy;fDz=dz;}; virtual void SetNAnodes(Int_t n) {// sets the number of Anodes "P" and // allocates array of low edges. fNp=n+1;delete fLowEdgeP;fLowEdgeP = new Float_t[fNp];} @@ -73,7 +71,12 @@ class AliITSgeomSSD : public TObject { // | // V // z - TBRIK *fShapeSSD; // comment + TString fName; // Object name Replacement for TBRIK + TString fTitle; // Ojbect title Replacement for TBRIK + TString fMat; // Object material name Replacement for TBRIK + Float_t fDx; // half length in z Replacement for TBRIK + Float_t fDy; // half length in y Replacement for TBRIK + Float_t fDz; // half length in z Replacement for TBRIK Int_t fNp; // Number of Anode strips. Int_t fNn; // Number of Cathode strips. Float_t *fLowEdgeP; //[fNp] Anode side strip pitch angle==0. @@ -82,7 +85,7 @@ class AliITSgeomSSD : public TObject { Float_t fAngleN; // Cathode side strip angle (rad). // or what other or different information that is needed. - ClassDef(AliITSgeomSSD,1) // ITS SSD detector geometry class + ClassDef(AliITSgeomSSD,2) // ITS SSD detector geometry class }; // Input and output function for standard C++ input/output. diff --git a/ITS/AliITSsegmentationSDD.h b/ITS/AliITSsegmentationSDD.h index b5f7b01d313..a21e34ac502 100644 --- a/ITS/AliITSsegmentationSDD.h +++ b/ITS/AliITSsegmentationSDD.h @@ -22,7 +22,10 @@ public AliITSsegmentation { // Set Detector Segmentation Parameters // - + // get the drift speed used for this segmentation + virtual Float_t GetDriftSpeed()const{return fDriftSpeed;} + // Set the drift speed needed for this segmentation + virtual void SetDriftSpeed(Float_t ds){fDriftSpeed = ds;} // Cell size dz*dx virtual void SetPadSize(Float_t pitch, Float_t clock) {fPitch=pitch;fTimeStep=1000./clock;} diff --git a/ITS/AliITSv11.cxx b/ITS/AliITSv11.cxx index 5877450d108..e57422996c3 100644 --- a/ITS/AliITSv11.cxx +++ b/ITS/AliITSv11.cxx @@ -1287,7 +1287,7 @@ void AliITSv11::InitAliITSgeom(){ gMC->GetShape(path.Data(),shapeName,shapePar); shapeParF.Set(shapePar.GetSize()); for(i=0;iCreatMatrix(mod,lay,lad,det,idet[lay-1],trans,rot); + geom->CreateMatrix(mod,lay,lad,det,idet[lay-1],trans,rot); geom->SetTrans(mod,materix.GetTranslation()); geom->SetRotMatrix(mod,materix.GetRotationMatrix()); switch (lay){ diff --git a/ITS/AliITSv11GeometrySDD.cxx b/ITS/AliITSv11GeometrySDD.cxx index d215b2e742e..4eae5a7e018 100755 --- a/ITS/AliITSv11GeometrySDD.cxx +++ b/ITS/AliITSv11GeometrySDD.cxx @@ -2654,7 +2654,7 @@ Int_t AliITSv11GeometrySDD::ExportSensorGeometry(AliITSgeom *geom, Int_t iLaySDD r[3],r[4],r[5], r[6],r[7],r[8], 1.0}; //rot[9]!=0.0 => not a unity matrix - geom->CreatMatrix(startMod,iLay+iLaySDD,iLadd+1,iDet+1, + geom->CreateMatrix(startMod,iLay+iLaySDD,iLadd+1,iDet+1, kSDD,trans,rot); // iLadd+1, iDet+1 because ladd. and det. start at +1 // elsewhere diff --git a/ITS/AliITSvBeamTestITS04.cxx b/ITS/AliITSvBeamTestITS04.cxx index c6310cb0f96..b8e4b077d17 100644 --- a/ITS/AliITSvBeamTestITS04.cxx +++ b/ITS/AliITSvBeamTestITS04.cxx @@ -325,7 +325,7 @@ void AliITSvBeamTestITS04::InitAliITSgeom() Int_t iLad = 1; Int_t iLay = 1; if (i+1>2) iLay = 2; - GetITSgeom()->CreatMatrix(startMod,iLay,iLad,iDet,kSPD,trans,rot); + GetITSgeom()->CreateMatrix(startMod,iLay,iLad,iDet,kSPD,trans,rot); startMod++; }; }; @@ -344,7 +344,7 @@ void AliITSvBeamTestITS04::InitAliITSgeom() Int_t iDet = 1; Int_t iLad = 1; Int_t iLay = fNspd-1+i; - GetITSgeom()->CreatMatrix(startMod,iLay,iLad,iDet,kSDD,trans,rot); + GetITSgeom()->CreateMatrix(startMod,iLay,iLad,iDet,kSDD,trans,rot); startMod++; }; }; @@ -365,7 +365,7 @@ void AliITSvBeamTestITS04::InitAliITSgeom() Int_t iLad = 1; Int_t iLay = 5; if (i+1>2) iLay = 6; - GetITSgeom()->CreatMatrix(startMod,iLay,iLad,iDet,kSSD,trans,rot); + GetITSgeom()->CreateMatrix(startMod,iLay,iLad,iDet,kSSD,trans,rot); startMod++; }; }; @@ -408,7 +408,7 @@ void AliITSvBeamTestITS04::SetDefaults() AliITSCalibration *resp0=new AliITSCalibrationSPD(); SetCalibrationModel(kSPD,resp0); - AliITSsegmentationSPD *seg0=new AliITSsegmentationSPD(GetITSgeom()); + 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. @@ -436,10 +436,11 @@ void AliITSvBeamTestITS04::SetDefaults() if (s1) { AliITSCalibrationSDD *resp1=new AliITSCalibrationSDD("simulated"); SetCalibrationModel(kSDD,resp1); - AliITSsegmentationSDD *seg1=new AliITSsegmentationSDD(GetITSgeom(),resp1); + AliITSsegmentationSDD *seg1=new AliITSsegmentationSDD(); seg1->SetDetSize(s1->GetDx()*kconv, // base this on AliITSgeomSDD s1->GetDz()*4.*kconv, // for now. s1->GetDy()*4.*kconv); // x,z,y full width in microns. + seg1->SetDriftSpeed(resp1->GetDriftSpeed()); seg1->SetNPads(256,256);// Use AliITSgeomSDD for now SetSegmentationModel(kSDD,seg1); const char *kData1=(fDetTypeSim->GetCalibrationModel(kSDD))->DataType(); @@ -456,7 +457,7 @@ void AliITSvBeamTestITS04::SetDefaults() AliITSCalibration *resp2=new AliITSCalibrationSSD("simulated"); SetCalibrationModel(kSSD,resp2); - AliITSsegmentationSSD *seg2=new AliITSsegmentationSSD(GetITSgeom()); + AliITSsegmentationSSD *seg2=new AliITSsegmentationSSD(); 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. diff --git a/ITS/AliITSvPPRasymmFMD.cxx b/ITS/AliITSvPPRasymmFMD.cxx index 2126bb4d683..0400ed21c4d 100644 --- a/ITS/AliITSvPPRasymmFMD.cxx +++ b/ITS/AliITSvPPRasymmFMD.cxx @@ -4713,7 +4713,7 @@ void AliITSvPPRasymmFMD::CreateMaterials(){ // Monte Carlo simulations for the geometries AliITSv1, AliITSv3, // AliITSvPPRasymmFMD. // 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. @@ -4885,7 +4885,6 @@ void AliITSvPPRasymmFMD::CreateMaterials(){ Float_t wAlOxide[2] = {0.4707, 0.5293}; Float_t dAlOxide = 3.97; - AliMaterial(1,"SI$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03); AliMedium(1,"SI$",1,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi); @@ -5263,6 +5262,7 @@ void AliITSvPPRasymmFMD::InitAliITSgeom(){ Double_t trans[3]={3*0.0},rot[10]={9*0.0,1.0}; TArrayD shapePar; TArrayF shapeParF; + Bool_t shapeDefined[3]={kFALSE,kFALSE,kFALSE}; AliDebug(1,"Reading Geometry transformation directly from Modler."); mod = 0; @@ -5273,7 +5273,6 @@ void AliITSvPPRasymmFMD::InitAliITSgeom(){ mod += k; } // end for i - if(GetITSgeom()!=0) delete GetITSgeom(); SetITSgeom(0); nlad[0]=20;nlad[1]=40;nlad[2]=14;nlad[3]=22;nlad[4]=34;nlad[5]=38; ndet[0]= 4;ndet[1]= 4;ndet[2]= 6;ndet[3]= 8;ndet[4]=22;ndet[5]=25; @@ -5306,21 +5305,27 @@ void AliITSvPPRasymmFMD::InitAliITSgeom(){ gMC->GetShape(path.Data(),shapeName,shapePar); shapeParF.Set(shapePar.GetSize()); for(i=0;iCreatMatrix(mod,lay,lad,det,idet[lay-1],trans,rot); + geom->CreateMatrix(mod,lay,lad,det,idet[lay-1],trans,rot); geom->SetTrans(mod,materix.GetTranslation()); geom->SetRotMatrix(mod,materix.GetRotationMatrix()); switch (lay){ - case 1: case 2:{ + case 1: case 2: + if(!shapeDefined[kSPD]){ geom->ReSetShape(kSPD,new AliITSgeomSPD425Short( shapeParF.GetSize(),shapeParF.GetArray())); + shapeDefined[kSPD] = kTRUE; }break; - case 3: case 4:{ + case 3: case 4: + if(!shapeDefined[kSDD]){ geom->ReSetShape(kSDD,new AliITSgeomSDD256( shapeParF.GetSize(),shapeParF.GetArray())); + shapeDefined[kSDD] = kTRUE; }break; - case 5: case 6:{ + case 5: case 6: + if(!shapeDefined[kSSD]){ geom->ReSetShape(kSSD,new AliITSgeomSSD75and275( shapeParF.GetSize(),shapeParF.GetArray())); + shapeDefined[kSSD] = kTRUE; }break; default:{ }break; @@ -5342,11 +5347,11 @@ void AliITSvPPRasymmFMD::Init(){ // Return: // none. - AliInfo(Form("Minor version %d",fMinorVersion)); + AliInfo(Form("Init: Major version %d Minor version %d",fMajorVersion, + fMinorVersion)); // if(fRead[0]=='\0') strncpy(fRead,fEuclidGeomDet,60); if(fWrite[0]=='\0') strncpy(fWrite,fEuclidGeomDet,60); - if(GetITSgeom()!=0) SetITSgeom(0x0); AliITSgeom* geom = new AliITSgeom(); SetITSgeom(geom); if(fGeomDetIn) GetITSgeom()->ReadNewFile(fRead); @@ -5367,27 +5372,26 @@ void AliITSvPPRasymmFMD::SetDefaults(){ // none. const Float_t kconv = 1.0e+04; // convert cm to microns - AliInfo("Called"); - if(!fDetTypeSim) fDetTypeSim = new AliITSDetTypeSim(); - fDetTypeSim->SetITSgeom(GetITSgeom()); - + if(!fDetTypeSim){ + Warning("SetDefaults","Error fDetTypeSim not defined"); + return; + } + AliITSgeomSPD *s0; AliITSgeomSDD *s1; AliITSgeomSSD *s2; Int_t i; Float_t bx[256],bz[280]; - - + fDetTypeSim->SetDefaults(); //SPD - s0 = (AliITSgeomSPD*) GetITSgeom()->GetShape(kSPD);// Get shape info. Do it this way for now. + s0 = (AliITSgeomSPD*) GetITSgeom()->GetShape(kSPD); + // Get shape info. Do it this way for now. //AliITSCalibrationSPD* resp0=new AliITSCalibrationSPD(); - - //AliITSsegmentationSPD *seg0=new AliITSsegmentationSPD(GetITSgeom()); - - AliITSsegmentationSPD* seg0 = (AliITSsegmentationSPD*)fDetTypeSim->GetSegmentationModel(0); + AliITSsegmentationSPD* seg0 = + (AliITSsegmentationSPD*)fDetTypeSim->GetSegmentationModel(0); 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. @@ -5403,37 +5407,42 @@ void AliITSvPPRasymmFMD::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=(fDetTypeSim->GetCalibrationModel(GetITSgeom()->GetStartSPD()))->DataType(); - if (strstr(kData0,"real")) fDetTypeSim->SetDigitClassName(kSPD,"AliITSdigit"); + const char *kData0=(fDetTypeSim->GetCalibrationModel( + GetITSgeom()->GetStartSPD()))->DataType(); + if (strstr(kData0,"real")) fDetTypeSim->SetDigitClassName(kSPD, + "AliITSdigit"); else fDetTypeSim->SetDigitClassName(kSPD,"AliITSdigitSPD"); // SDD - s1 = (AliITSgeomSDD*) GetITSgeom()->GetShape(kSDD);// Get shape info. Do it this way for now. + s1 = (AliITSgeomSDD*) GetITSgeom()->GetShape(kSDD); + // Get shape info. Do it this way for now. //AliITSCalibrationSDD* resp1=new AliITSCalibrationSDD("simulated"); - - //AliITSsegmentationSDD *seg1=new AliITSsegmentationSDD(GetITSgeom(),resp1); - - AliITSsegmentationSDD* seg1 = (AliITSsegmentationSDD*)fDetTypeSim->GetSegmentationModel(1); + AliITSsegmentationSDD* seg1 = + (AliITSsegmentationSDD*)fDetTypeSim->GetSegmentationModel(1); 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. seg1->SetNPads(256,256);// Use AliITSgeomSDD for now SetSegmentationModel(kSDD,seg1); - const char *kData1=(fDetTypeSim->GetCalibrationModel(GetITSgeom()->GetStartSDD()))->DataType(); - AliITSCalibrationSDD* rsp = (AliITSCalibrationSDD*)fDetTypeSim->GetCalibrationModel(GetITSgeom()->GetStartSDD()); + const char *kData1=(fDetTypeSim->GetCalibrationModel( + GetITSgeom()->GetStartSDD()))->DataType(); + AliITSCalibrationSDD* rsp = + (AliITSCalibrationSDD*)fDetTypeSim->GetCalibrationModel( + GetITSgeom()->GetStartSDD()); const char *kopt=rsp->GetZeroSuppOption(); if((!strstr(kopt,"2D")) && (!strstr(kopt,"1D")) || strstr(kData1,"real") ){ fDetTypeSim->SetDigitClassName(kSDD,"AliITSdigit"); } else fDetTypeSim->SetDigitClassName(kSDD,"AliITSdigitSDD"); // SSD Layer 5 - s2 = (AliITSgeomSSD*) GetITSgeom()->GetShape(kSSD);// Get shape info. Do it this way for now. + s2 = (AliITSgeomSSD*) GetITSgeom()->GetShape(kSSD); + // Get shape info. Do it this way for now. - //SetCalibrationModel(GetITSgeom()->GetStartSSD(),new AliITSCalibrationSSD("simulated")); - - //AliITSsegmentationSSD *seg2=new AliITSsegmentationSSD(GetITSgeom()); - AliITSsegmentationSSD* seg2 = (AliITSsegmentationSSD*)fDetTypeSim->GetSegmentationModel(2); + //SetCalibrationModel(GetITSgeom()->GetStartSSD(), + // new AliITSCalibrationSSD("simulated")); + AliITSsegmentationSSD* seg2 = + (AliITSsegmentationSSD*)fDetTypeSim->GetSegmentationModel(2); 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. @@ -5443,15 +5452,15 @@ void AliITSvPPRasymmFMD::SetDefaults(){ seg2->SetAnglesLay5(0.0075,0.0275); // strip angels rad P and N side. seg2->SetAnglesLay6(0.0275,0.0075); // strip angels rad P and N side. SetSegmentationModel(kSSD,seg2); - const char *kData2=(fDetTypeSim->GetCalibrationModel(GetITSgeom()->GetStartSSD()))->DataType(); - if(strstr(kData2,"real") ) fDetTypeSim->SetDigitClassName(kSSD,"AliITSdigit"); + const char *kData2=(fDetTypeSim->GetCalibrationModel( + GetITSgeom()->GetStartSSD()))->DataType(); + if(strstr(kData2,"real") ) fDetTypeSim->SetDigitClassName(kSSD, + "AliITSdigit"); else fDetTypeSim->SetDigitClassName(kSSD,"AliITSdigitSSD"); if(fgkNTYPES>3){ Warning("SetDefaults", "Only the four basic detector types are initialised!"); }// end if - - return; } //______________________________________________________________________ diff --git a/ITS/AliITSvPPRcoarseasymm.cxx b/ITS/AliITSvPPRcoarseasymm.cxx index e73c39905f0..df969ae9c72 100644 --- a/ITS/AliITSvPPRcoarseasymm.cxx +++ b/ITS/AliITSvPPRcoarseasymm.cxx @@ -893,7 +893,7 @@ void AliITSvPPRcoarseasymm::CreateMaterials(){ // Monte Carlo simulations for the geometries AliITSv1, AliITSv3, // AliITSvPPRcoarseasymm. // 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. diff --git a/ITS/AliITSvSDD03.cxx b/ITS/AliITSvSDD03.cxx index f55c5fa9c91..84a82ee5e81 100644 --- a/ITS/AliITSvSDD03.cxx +++ b/ITS/AliITSvSDD03.cxx @@ -532,7 +532,7 @@ void AliITSvSDD03::CreateMaterials(){ // 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. @@ -783,13 +783,13 @@ void AliITSvSDD03::InitAliITSgeom(){ switch (typ){ case 2: - GetITSgeom()->CreatMatrix(mod,lay,lad,det,kSDD,t,r); + GetITSgeom()->CreateMatrix(mod,lay,lad,det,kSDD,t,r); if(!(GetITSgeom()->IsShapeDefined((Int_t)kSDD))){ GetITSgeom()->ReSetShape(kSDD,new AliITSgeomSDD256(npar,par)); } // end if break; case 1: - GetITSgeom()->CreatMatrix(mod,lay,lad,det,kSSD,t,r); + GetITSgeom()->CreateMatrix(mod,lay,lad,det,kSSD,t,r); if(!(GetITSgeom()->IsShapeDefined((Int_t)kSSD))){ GetITSgeom()->ReSetShape(kSSD,new AliITSgeomSSD(box,0.0,0.0, knp+1,p,knp+1,n)); @@ -837,7 +837,7 @@ void AliITSvSDD03::SetDefaults(){ // Return: // none. - const Float_t kconv = 1.0e+04; // convert cm to microns + // const Float_t kconv = 1.0e+04; // convert cm to microns if(!fDetTypeSim) fDetTypeSim = new AliITSDetTypeSim(); fDetTypeSim->SetITSgeom(GetITSgeom()); @@ -847,7 +847,8 @@ void AliITSvSDD03::SetDefaults(){ AliITSgeomSDD *s1; AliITSgeomSSD *s2; SetCalibrationModel(GetITSgeom()->GetStartSPD(),new AliITSCalibrationSPD()); - SetSegmentationModel(kSPD,new AliITSsegmentationSPD()); + SetSegmentationModel(kSPD,(AliITSsegmentationSPD*) + (GetITSgeom()->GetShape(kSPD))); fDetTypeSim->SetDigitClassName(kSPD,"AliITSdigitSPD"); // SDD @@ -855,11 +856,9 @@ void AliITSvSDD03::SetDefaults(){ AliITSCalibrationSDD *resp1=new AliITSCalibrationSDD("simulated"); SetCalibrationModel(GetITSgeom()->GetStartSDD(),resp1); - AliITSsegmentationSDD *seg1=new AliITSsegmentationSDD(GetITSgeom(),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. - + AliITSsegmentationSDD *seg1 = (AliITSsegmentationSDD*) + (GetITSgeom()->GetShape(kSDD)); + seg1->SetDriftSpeed(resp1->GetDriftSpeed()); seg1->SetNPads(256,256);// Use AliITSgeomSDD for now SetSegmentationModel(kSDD,seg1); const char *kData1=(fDetTypeSim->GetCalibrationModel(GetITSgeom()->GetStartSDD()))->DataType(); @@ -875,10 +874,8 @@ void AliITSvSDD03::SetDefaults(){ AliITSCalibration *resp2= new AliITSCalibrationSSD("simulated"); SetCalibrationModel(GetITSgeom()->GetStartSSD(),resp2); - AliITSsegmentationSSD *seg2=new AliITSsegmentationSSD(GetITSgeom()); - 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. + 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); diff --git a/ITS/AliITSvSPD02.cxx b/ITS/AliITSvSPD02.cxx index dfb11455722..abe2999ffd8 100644 --- a/ITS/AliITSvSPD02.cxx +++ b/ITS/AliITSvSPD02.cxx @@ -485,7 +485,7 @@ void AliITSvSPD02::CreateMaterials(){ // Monte Carlo simulations for the geometries AliITSv1, AliITSv3, // AliITSvSPD02. // 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. @@ -516,7 +516,7 @@ void AliITSvSPD02::CreateMaterials2002(){ // Monte Carlo simulations for the geometries AliITSv1, AliITSv3, // AliITSvSPD02. // 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. @@ -593,7 +593,7 @@ void AliITSvSPD02::InitAliITSgeom(){ lad = 1; det = mod+1; t[0] = tt[mod][0]; t[1] = tt[mod][1]; t[2] = tt[mod][2]; - GetITSgeom()->CreatMatrix(mod,lay,lad,det,kSPD,t,r); + GetITSgeom()->CreateMatrix(mod,lay,lad,det,kSPD,t,r); npar=3;par[0]=0.64;par[1]=0.5*300.0E-4;par[2]=3.48; GetITSgeom()->ReSetShape(kSPD,new AliITSgeomSPD425Short(npar,par)); } // end for det @@ -644,7 +644,7 @@ void AliITSvSPD02::InitAliITSgeom(){ mod = lay-1; ig->GetGeometry(kndeep,lnam,lnum,t,r,idshape,npar,natt,par,att, imat,imed); - GetITSgeom()->CreatMatrix(mod,lay,lad,det,kSPD,t,r); + GetITSgeom()->CreateMatrix(mod,lay,lad,det,kSPD,t,r); if(!(GetITSgeom()->IsShapeDefined((Int_t)kSPD))) GetITSgeom()->ReSetShape(kSPD, new AliITSgeomSPD425Short(npar,par)); @@ -714,7 +714,7 @@ void AliITSvSPD02::SetDefaults(){ resp0->SetDistanceOverVoltage(); SetCalibrationModel(0,resp0); - AliITSsegmentationSPD *seg0=new AliITSsegmentationSPD(GetITSgeom()); + 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. diff --git a/ITS/AliITSvSSD03.cxx b/ITS/AliITSvSSD03.cxx index 75146c12525..4d9803e0e70 100644 --- a/ITS/AliITSvSSD03.cxx +++ b/ITS/AliITSvSSD03.cxx @@ -381,7 +381,7 @@ void AliITSvSSD03::CreateMaterials(){ // Monte Carlo simulations for the geometries AliITSv1, AliITSv3, // AliITSvSSD03. // 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. @@ -412,7 +412,7 @@ void AliITSvSSD03::CreateMaterials2003(){ // Monte Carlo simulations for the geometries AliITSv1, AliITSv3, // AliITSvSSD03. // 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. @@ -528,7 +528,7 @@ void AliITSvSSD03::InitAliITSgeom(){ lad = 1; det = mod+1; t[0] = tt[mod][0]; t[1] = tt[mod][1]; t[2] = tt[mod][2]; - GetITSgeom()->CreatMatrix(mod,lay,lad,det,kSSD,t,r); + GetITSgeom()->CreateMatrix(mod,lay,lad,det,kSSD,t,r); npar=3;par[0]=3.5;par[1]=0.5*300.0E-4;par[2]=2.0; @@ -580,7 +580,7 @@ void AliITSvSSD03::InitAliITSgeom(){ mod = lay-1; ig->GetGeometry(kndeep,lnam,lnum,t,r,idshape,npar,natt,par,att, imat,imed); - GetITSgeom()->CreatMatrix(mod,lay,lad,det,kSSD,t,r); + GetITSgeom()->CreateMatrix(mod,lay,lad,det,kSSD,t,r); //cout<IsShapeDefined((Int_t)kSSD))) @@ -648,7 +648,7 @@ void AliITSvSSD03::SetDefaults(){ AliITSCalibration *resp0=new AliITSCalibrationSSD("simulated"); SetCalibrationModel(GetITSgeom()->GetStartSSD(),resp0); - AliITSsegmentationSSD *seg0=new AliITSsegmentationSSD(GetITSgeom()); + AliITSsegmentationSSD *seg0=new AliITSsegmentationSSD(); seg0->SetDetSize(s0->GetDx()*2.*kconv, // base this on AliITSgeomSSD s0->GetDz()*2.*kconv, // for now. s0->GetDy()*2.*kconv); // x,z,y full width in microns. diff --git a/ITS/AliITSvtest.cxx b/ITS/AliITSvtest.cxx index cb8ca2940ec..908b86ca68d 100644 --- a/ITS/AliITSvtest.cxx +++ b/ITS/AliITSvtest.cxx @@ -248,7 +248,7 @@ void AliITSvtest::InitAliITSgeom(){ mod++; ig->GetGeometry(kndeep,lnam,lnum,t,r,idshape,npar,natt, par,att,imat,imed); - GetITSgeom()->CreatMatrix(mod,lay,lad,det,kSPD,t,r); + GetITSgeom()->CreateMatrix(mod,lay,lad,det,kSPD,t,r); if(!(GetITSgeom()->IsShapeDefined((Int_t)kSPD))) if(fMinorVersion==1){ GetITSgeom()->ReSetShape(kSPD, @@ -271,17 +271,17 @@ void AliITSvtest::InitAliITSgeom(){ par,att,imat,imed); switch (lay){ case 3: case 4: - GetITSgeom()->CreatMatrix(mod,lay,lad,det,kSDD,t,r); + GetITSgeom()->CreateMatrix(mod,lay,lad,det,kSDD,t,r); if(!(GetITSgeom()->IsShapeDefined(kSDD))) GetITSgeom()->ReSetShape(kSDD,new AliITSgeomSDD256()); break; case 5: - GetITSgeom()->CreatMatrix(mod,lay,lad,det,kSSD,t,r); + GetITSgeom()->CreateMatrix(mod,lay,lad,det,kSSD,t,r); if(!(GetITSgeom()->IsShapeDefined(kSSD))) GetITSgeom()->ReSetShape(kSSD,new AliITSgeomSSD275and75()); break; case 6: - GetITSgeom()->CreatMatrix(mod,lay,lad,det,kSSD,t,r); + GetITSgeom()->CreateMatrix(mod,lay,lad,det,kSSD,t,r); if(!(GetITSgeom()->IsShapeDefined(kSSD))) GetITSgeom()->ReSetShape(kSSD,new AliITSgeomSSD75and275()); break; diff --git a/ITS/ITSbaseLinkDef.h b/ITS/ITSbaseLinkDef.h index 5ccb690d7cb..89d2439db70 100644 --- a/ITS/ITSbaseLinkDef.h +++ b/ITS/ITSbaseLinkDef.h @@ -20,21 +20,21 @@ #pragma link C++ class AliITSdigitSDD+; #pragma link C++ class AliITSdigitSSD+; #pragma link C++ class AliITSTransientDigit+; +#pragma link C++ class AliITSInitGeometry+; #pragma link C++ class AliITSgeom+; #pragma link C++ class AliITSgeomMatrix-; #pragma link C++ class AliITSgeomSPD+; #pragma link C++ class AliITSgeomSDD+; #pragma link C++ class AliITSgeomSSD+; // Standard ITS detector class initilizers -#pragma link C++ class AliITSgeomSPD300+; -#pragma link C++ class AliITSgeomSPD425Short+; -#pragma link C++ class AliITSgeomSPD425Long+; -#pragma link C++ class AliITSgeomSDD256+; -#pragma link C++ class AliITSgeomSDD300+; -#pragma link C++ class AliITSgeomSSD175+; -#pragma link C++ class AliITSgeomSSD275and75+; -#pragma link C++ class AliITSgeomSSD75and275+; - +#pragma link C++ class AliITSgeomSPD300+; +#pragma link C++ class AliITSgeomSPD425Short+; +#pragma link C++ class AliITSgeomSPD425Long+; +#pragma link C++ class AliITSgeomSDD256+; +#pragma link C++ class AliITSgeomSDD300+; +#pragma link C++ class AliITSgeomSSD175+; +#pragma link C++ class AliITSgeomSSD275and75+; +#pragma link C++ class AliITSgeomSSD75and275+; #pragma link C++ class AliITSMap+; #pragma link C++ class AliITSMapA1+; diff --git a/ITS/libITSbase.pkg b/ITS/libITSbase.pkg index 6cfd2b7ea0a..660dbef3ede 100644 --- a/ITS/libITSbase.pkg +++ b/ITS/libITSbase.pkg @@ -3,6 +3,7 @@ SRCS = AliITSgeom.cxx \ AliITSgeomSPD.cxx \ AliITSgeomSDD.cxx \ AliITSgeomSSD.cxx \ + AliITSInitGeometry.cxx \ AliITSLoader.cxx \ AliITSRecPoint.cxx \ AliITSclusterV2.cxx \ @@ -47,5 +48,5 @@ HDRS:= $(SRCS:.cxx=.h) DHDR=ITSbaseLinkDef.h -EINCLUDE:=$(ALICE)/geant3/TGeant3 TPC RAW +EINCLUDE:=$(GEANT3_ROOT)/TGeant3 TPC RAW -- 2.39.3