]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSdcsSSD.cxx
Updated macro
[u/mrichter/AliRoot.git] / ITS / AliITSdcsSSD.cxx
index e89b3b8900e0f368a7d7bf69da6511554e5d4eb4..e08796ce5d867b2eb9113dc0bb793aa161d18759 100644 (file)
+#include <TRandom.h>
+#include <TArrayS.h>
 
 #include "AliITSdcsSSD.h"
+#include "AliITSCalibrationSSD.h"
 #include "AliITSresponseSSD.h"
 #include "AliITSsegmentationSSD.h"
+///////////////////////////////////////////////////////////////////////////
+//                                                                       //
+//  Class AliITSdcsSSD                                                   //
+//  describes Detector Control System parameters for one SSD module.     //
+//                                                                       //
+//  This class stores parametrers such as gain, threshold                //
+//  capacitive coupling.                                                 //
+//                                                                       //
+//  Class takes care of invalid strip menagement during                  //
+//  simulation and runtime                                               //
+//                                                                       //
+//                                                                       //
+//  created at: Warsaw University of Technology                          //
+//  ver. 1.0    WARSAW, 23.12.1999                                       //
+//                                                                       //
+///////////////////////////////////////////////////////////////////////////
 
 ClassImp(AliITSdcsSSD)
 
-
-//_____________________________________________________________________
-//
 // Constructor and Destructor
-//_____________________________________________________________________
+//______________________________________________________________________
+  AliITSdcsSSD::AliITSdcsSSD():
+fCouplingPR(0),
+fCouplingPL(0),
+fCouplingNR(0),
+fCouplingNL(0),
+fNstrips(0),
+fNInvalid(0),
+fISigma(0),
+fInvalidP(0),
+fInvalidN(0){
+    // Default Constructor
 
-
-AliITSdcsSSD::AliITSdcsSSD(AliITSsegmentation *seg, AliITSresponse *resp) 
-{
-  // constructor
-
-    fRandom = new TRandom();
-
-    fNstrips = seg->Npx();
+}
+//______________________________________________________________________
+AliITSdcsSSD::AliITSdcsSSD(AliITSsegmentation *seg, AliITSCalibration *resp):
+fCouplingPR(0),
+fCouplingPL(0),
+fCouplingNR(0),
+fCouplingNL(0),
+fNstrips(0),
+fNInvalid(0),
+fISigma(0),
+fInvalidP(0),
+fInvalidN(0){
+    // Standard constructor
+
+    fNstrips =(Float_t) (((AliITSsegmentationSSD*)seg)->Npx());
     
     fInvalidP = new TArrayS();
     fInvalidN = new TArrayS();
 
-    Int_t npar=resp->NDetParam();
+    Int_t npar=((AliITSCalibrationSSD*)resp)->NDetParam();
     if (npar < 6) {
-       Warning("AliITSdcsSSD","I need 6 parameters ");
-       npar=6;
-    }
+       Warning("AliITSdcsSSD","I need 6 parameters ");
+       npar=6;
+    } // end if
 
-    Float_t *detpar = new Float_t [npar];
+    Double_t *detpar= new Double_t[npar];
     resp->GetDetParam(detpar);
 
     fNInvalid = detpar[0];
-    fISigma = detpar[1];
+    fISigma   = detpar[1];
 
     fCouplingPR = detpar[2];
     fCouplingPL = detpar[3];
     fCouplingNR = detpar[4];
-    fCouplingNL = detpar[5]; 
+    fCouplingNL = detpar[5];
 
-
-    Option_t *opt,*dummy;
-    resp->ParamOptions(opt,dummy);
+    char opt[30],dummy[20];
+    ((AliITSCalibrationSSD*)resp)->GetParamOptions(opt,dummy);
     if (strstr(opt,"SetInvalid")) SetInvalidMC(fNInvalid,fISigma);
-        
-        delete [] detpar;
-        delete detpar;
 
+    delete [] detpar;
 }
-
-//_____________________________________________________________________
-
-
+//______________________________________________________________________
 AliITSdcsSSD::~AliITSdcsSSD() {
-  // destructor
+    // destructor
+
     delete fInvalidP;
     delete fInvalidN;
 }
+//______________________________________________________________________
+AliITSdcsSSD::AliITSdcsSSD(const AliITSdcsSSD &source) : TObject(source),
+fCouplingPR(source.fCouplingPR),
+fCouplingPL(source.fCouplingPL),
+fCouplingNR(source.fCouplingNR),
+fCouplingNL(source.fCouplingNL),
+fNstrips(source.fNstrips),
+fNInvalid(source.fNInvalid),
+fISigma(source.fISigma),
+fInvalidP(source.fInvalidP),
+fInvalidN(source.fInvalidN){
+    //     Copy Constructor 
 
-//__________________________________________________________________________
-AliITSdcsSSD::AliITSdcsSSD(const AliITSdcsSSD &source){
-  //     Copy Constructor 
-  if(&source == this) return;
-  this->fCouplingPR = source.fCouplingPR;
-  this->fCouplingPL = source.fCouplingPL;
-  this->fCouplingNR = source.fCouplingNR;
-  this->fCouplingNL = source.fCouplingNL;
-  this->fNstrips = source.fNstrips;
-  this->fNInvalid = source.fNInvalid;
-  this->fISigma = source.fISigma;
-  this->fInvalidP = source.fInvalidP;
-  this->fInvalidN = source.fInvalidN;
-  this->fRandom = source.fRandom;
-  return;
 }
-
 //_________________________________________________________________________
-AliITSdcsSSD& 
-  AliITSdcsSSD::operator=(const AliITSdcsSSD &source) {
-  //    Assignment operator
-  if(&source == this) return *this;
-  this->fCouplingPR = source.fCouplingPR;
-  this->fCouplingPL = source.fCouplingPL;
-  this->fCouplingNR = source.fCouplingNR;
-  this->fCouplingNL = source.fCouplingNL;
-  this->fNstrips = source.fNstrips;
-  this->fNInvalid = source.fNInvalid;
-  this->fISigma = source.fISigma;
-  this->fInvalidP = source.fInvalidP;
-  this->fInvalidN = source.fInvalidN;
-  this->fRandom = source.fRandom;
-  return *this;
+AliITSdcsSSD& AliITSdcsSSD::operator=(const AliITSdcsSSD &source) {
+    //    Assignment operator
+
+    if(&source == this) return *this;
+
+    this->fCouplingPR = source.fCouplingPR;
+    this->fCouplingPL = source.fCouplingPL;
+    this->fCouplingNR = source.fCouplingNR;
+    this->fCouplingNL = source.fCouplingNL;
+    this->fNstrips = source.fNstrips;
+    this->fNInvalid = source.fNInvalid;
+    this->fISigma = source.fISigma;
+    this->fInvalidP = source.fInvalidP;
+    this->fInvalidN = source.fInvalidN;
+
+    return *this;
 }
-
 //_____________________________________________________________________
 //
 //  Methods for creating invalid strips
 //_____________________________________________________________________
-//
-
-
 void AliITSdcsSSD::SetInvalidMC(Float_t mean, Float_t sigma) {
-  // set invalid MC
+    // set invalid MC
+
     SetInvalidParam(mean, sigma);
     SetInvalidMC();
 }
-
-//_____________________________________________________________________
-
+//______________________________________________________________________
 void AliITSdcsSSD::SetInvalidMC() {
-  // set invalid MC
+    // set invalid MC
     Int_t pside;
     Int_t nside;
     Int_t i;
     Int_t strip;
 
-    pside = (Int_t)fRandom->Gaus(fNInvalid, fISigma);
-    nside = (Int_t)fRandom->Gaus(fNInvalid, fISigma);
+    pside = (Int_t)gRandom->Gaus(fNInvalid, fISigma);
+    nside = (Int_t)gRandom->Gaus(fNInvalid, fISigma);
     
     fInvalidP->Set(pside);
     fInvalidN->Set(nside);
      
     for(i=0 ;i<pside; i++) {
-       strip = (Int_t)(fRandom->Rndm() * fNstrips);
+       strip = (Int_t)(gRandom->Rndm() * fNstrips);
        fInvalidP->AddAt(strip, i); 
-    }
+    } // end for i
     
     for(i=0 ;i<nside; i++) {
-       strip = (Int_t)(fRandom->Rndm() * fNstrips);
+       strip = (Int_t)(gRandom->Rndm() * fNstrips);
        fInvalidN->AddAt(strip, i); 
-    }  
+    } // end for i
 }
-
-//_____________________________________________________________________
-
-
+//______________________________________________________________________
 void AliITSdcsSSD::SetInvalidParam(Float_t mean, Float_t sigma) {
-  // set invalid param
+    // set invalid param
+
     fNInvalid = mean;
     fISigma = sigma;
 
@@ -147,74 +166,59 @@ void AliITSdcsSSD::SetInvalidParam(Float_t mean, Float_t sigma) {
     fISigma = (fISigma < 0)? 0 : fISigma;
     fISigma = (fISigma > fNstrips/10) ? fNstrips/10 : fISigma;
 }
+//______________________________________________________________________
+void AliITSdcsSSD::GetInvalidParam(Float_t &mean, Float_t &sigma) const {
+    // get invalid param
 
-
-//_____________________________________________________________________
-
-
-void AliITSdcsSSD::GetInvalidParam(Float_t &mean, Float_t &sigma) {
-  // get invalid param
     mean = fNInvalid;
     sigma = fISigma;
-
 }
-
-
 //_____________________________________________________________________
 //
 //  Methods for accessing to invalid strips
 //_____________________________________________________________________
-//
-
-
 Bool_t AliITSdcsSSD::IsValidP(Int_t strip) {
-  // isvalidP
+    // isvalidP
     Int_t nElem = fInvalidP->GetSize();
-    Int_t i;
-    for(i = 0; i<nElem; i++)
-       if(fInvalidP->At(i) == strip) return kFALSE;
+
+    for(Int_t i = 0; i<nElem; i++) if(fInvalidP->At(i) == strip) return kFALSE;
     return kTRUE;
 }
-
-//_____________________________________________________________________
-
+//______________________________________________________________________
 Bool_t AliITSdcsSSD::IsValidN(Int_t strip) {
-  // is valid N
+    // is valid N
     Int_t nElem = fInvalidN->GetSize();
-    Int_t i;
-    for(i = 0; i<nElem; i++)
-       if(fInvalidN->At(i) == strip) return kFALSE;
+
+    for(Int_t i = 0; i<nElem; i++) if(fInvalidN->At(i) == strip) return kFALSE;
     return kTRUE;
 }
-
-//_____________________________________________________________________
-
-
+//______________________________________________________________________
 TArrayS* AliITSdcsSSD::GetInvalidP() {
-  // get invalid P
+    // get invalid P
+
     return fInvalidP;
 }
-
+//______________________________________________________________________
 TArrayS* AliITSdcsSSD::GetInvalidN() {
-  // get invalid N
+    // get invalid N
+
     return fInvalidN;
 }
-
+//______________________________________________________________________
 Int_t AliITSdcsSSD::GetNInvalidP(){
-  // get numeber of invalid P    
+    // get numeber of invalid P
+
     return fInvalidP->GetSize();
 }
-
+//______________________________________________________________________
 Int_t AliITSdcsSSD::GetNInvalidN() {
-  // // get number of invalid N
+    // get number of invalid N
+
     return fInvalidN->GetSize();
 }
-
 //_____________________________________________________________________
 
 
 
 
 
-
-