]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSdcsSSD.cxx
added the delete of EMCAL object posted in the folder when new file is opened
[u/mrichter/AliRoot.git] / ITS / AliITSdcsSSD.cxx
index e89b3b8900e0f368a7d7bf69da6511554e5d4eb4..d046ef4406e3c826b513433eaa13e5727d0e8588 100644 (file)
@@ -1,3 +1,5 @@
+#include <TRandom.h>
+#include <TArrayS.h>
 
 #include "AliITSdcsSSD.h"
 #include "AliITSresponseSSD.h"
@@ -5,18 +7,17 @@
 
 ClassImp(AliITSdcsSSD)
 
-
-//_____________________________________________________________________
-//
 // Constructor and Destructor
-//_____________________________________________________________________
+//______________________________________________________________________
+AliITSdcsSSD::AliITSdcsSSD(){
+    // Default Constructor
 
-
-AliITSdcsSSD::AliITSdcsSSD(AliITSsegmentation *seg, AliITSresponse *resp) 
-{
-  // constructor
-
-    fRandom = new TRandom();
+    fInvalidP = 0;
+    fInvalidN = 0;
+}
+//______________________________________________________________________
+AliITSdcsSSD::AliITSdcsSSD(AliITSsegmentation *seg, AliITSresponse *resp){
+    // Standard constructor
 
     fNstrips = seg->Npx();
     
@@ -25,119 +26,108 @@ AliITSdcsSSD::AliITSdcsSSD(AliITSsegmentation *seg, AliITSresponse *resp)
 
     Int_t npar=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];
+    Float_t *detpar= new Float_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;
+    char opt[30],dummy[20];
     resp->ParamOptions(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){
-  //     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;
-}
+    //     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;
+
+    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 +137,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) {
-  // get invalid param
+    // 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();
 }
-
 //_____________________________________________________________________
 
 
 
 
 
-
-