fHisClusErrX(0),
fHisClusErrZ(0){
for (UInt_t i=0; i<kNModule*kNChip*kNWing*kNSubWing; i++){
+ // default constructor
fFound[i]=0;
fTried[i]=0;
}
- // default constructor
AliDebug(1,Form("Calling default constructor"));
}
//______________________________________________________________________
// Return:
if(this==&s) return *this;
+ this->~AliITSPlaneEffSDD();
+ new(this) AliITSPlaneEffSDD();
s.Copy(*this);
return *this;
}
}
return;
}
-/* Commented out by M.Masera 8/3/08
-//______________________________________________________________________
-AliITSPlaneEff& AliITSPlaneEffSDD::operator=(const
- AliITSPlaneEff &s){
- // Assignment operator
- // Inputs:
- // AliITSPlaneEffSDD &s The original class for which
- // this class is a copy of
- // Outputs:
- // none.
- // Return:
- if(&s == this) return *this;
- AliError("operator=: Not allowed to make a =, use default creater instead");
- return *this;
-}
-*/
//_______________________________________________________________________
Int_t AliITSPlaneEffSDD::GetMissingTracksForGivenEff(Double_t eff, Double_t RelErr,
UInt_t im, UInt_t ic, UInt_t iw, UInt_t is) const {
if (im>=kNModule || ic>=kNChip || iw>=kNWing || is>=kNSubWing)
{AliError("GetMissingTracksForGivenEff: you asked for a non existing block");
return -1;}
-else return GetNTracksForGivenEff(eff,RelErr)-fTried[GetKey(im,ic,iw,is)];
+else {
+ UInt_t key=GetKey(im,ic,iw,is);
+ if (key<kNModule*kNChip*kNWing*kNSubWing) return GetNTracksForGivenEff(eff,RelErr)-fTried[key];
+ else return -1;
+}
}
//_________________________________________________________________________
Double_t AliITSPlaneEffSDD::PlaneEff(const UInt_t im,const UInt_t ic,
// is -> chip number [0,kNSubWing-1]
if (im>=kNModule || ic>=kNChip || iw>=kNWing || is>=kNSubWing)
{AliError("PlaneEff(UInt_t,UInt_t,UInt_t,UInt_t): you asked for a non existing block"); return -1.;}
- Int_t nf=fFound[GetKey(im,ic,iw,is)];
- Int_t nt=fTried[GetKey(im,ic,iw,is)];
+UInt_t key=GetKey(im,ic,iw,is);
+Int_t nf=-1;
+Int_t nt=-1;
+if (key<kNModule*kNChip*kNWing*kNSubWing) {
+ nf=fFound[key];
+ nt=fTried[key];
+}
return AliITSPlaneEff::PlaneEff(nf,nt);
}
//_________________________________________________________________________
// is -> chip number [0,kNSubWing-1]
if (im>=kNModule || ic>=kNChip || iw>=kNWing || is>=kNSubWing)
{AliError("ErrPlaneEff(UInt_t,UInt_t,UInt_t,UInt_t): you asked for a non existing block"); return -1.;}
-Int_t nf=fFound[GetKey(im,ic,iw,is)];
-Int_t nt=fTried[GetKey(im,ic,iw,is)];
+UInt_t key=GetKey(im,ic,iw,is);
+Int_t nf=-1;
+Int_t nt=-1;
+if (key<kNModule*kNChip*kNWing*kNSubWing) {
+ nf=fFound[key];
+ nt=fTried[key];
+}
return AliITSPlaneEff::ErrPlaneEff(nf,nt);
}
//_________________________________________________________________________
// Update efficiency for a basic block
if (im>=kNModule || ic>=kNChip || iw>=kNWing || is>=kNSubWing)
{AliError("UpDatePlaneEff: you asked for a non existing block"); return kFALSE;}
- fTried[GetKey(im,ic,iw,is)]++;
- if(Kfound) fFound[GetKey(im,ic,iw,is)]++;
- return kTRUE;
+ UInt_t key=GetKey(im,ic,iw,is);
+ if (key<kNModule*kNChip*kNWing*kNSubWing) {
+ fTried[key]++;
+ if(Kfound) fFound[key]++;
+ return kTRUE;
+ }
+ else {
+ return kFALSE;
+ }
}
//_________________________________________________________________________
void AliITSPlaneEffSDD::ChipAndWingFromAnode(const UInt_t anode, UInt_t& chip,
}
//_____________________________________________________________________________
Bool_t AliITSPlaneEffSDD::AddFromCDB(AliCDBId *cdbId) {
+// read efficiency values from CDB
AliCDBEntry *cdbEntry=0;
if (!cdbId) {
if(!fInitCDBCalled)
}
//__________________________________________________________
void AliITSPlaneEffSDD::DeleteHistos() {
+ // delete the histograms and clean the memory
if(fHisResX) {
for (Int_t i=0; i<kNHisto; i++ ) delete fHisResX[i];
delete [] fHisResX; fHisResX=0;
}
//__________________________________________________________
Bool_t AliITSPlaneEffSDD::FillHistos(UInt_t key, Bool_t found,
- // Float_t tXZ[2], Float_t cXZ[2], Int_t ctXZ[2]) {
- Float_t *tr, Float_t *clu, Int_t *csize) {
+ Float_t *tr, Float_t *clu, Int_t *csize, Float_t*) {
// this method fill the histograms
// input: - key: unique key of the basic block
// - found: Boolean to asses whether a cluster has been associated to the track or not
AliWarning("WriteHistosToFile: null output filename!");
return kFALSE;
}
- char branchname[30];
+ char branchname[51];
TFile *hFile=new TFile(filename.Data(),option,
"The File containing the TREEs with ITS PlaneEff Histos");
TTree *SDDTree=new TTree("SDDTree","Tree whith Residuals and Cluster Type distributions for SDD");
SDDTree->Branch("histClusterType","TH2I",&histClusterType,128000,0);
SDDTree->Branch("profileResXvsCluSizeX","TProfile",&profileResXvsCluSizeX,128000,0);
for(Int_t clu=0;clu<kNclu;clu++) {
- //sprintf(branchname,"histXclu_%d",clu+1);
+ //snprintf(branchname,50,"histXclu_%d",clu+1);
//SDDTree->Branch(branchname,"TH1F",&histXclu[clu],128000,0);
- sprintf(branchname,"histZclu_%d",clu+1);
+ snprintf(branchname,50,"histZclu_%d",clu+1);
SDDTree->Branch(branchname,"TH1F",&histZclu[clu],128000,0);
}
SDDTree->Branch("profileResXvsX","TProfile",&profileResXvsX,128000,0);
AliWarning("ReadHistosFromFile: incorrect output filename!");
return kFALSE;
}
- char branchname[30];
+ char branchname[51];
TH1F *h = 0;
TH2F *h2 = 0;
//TBranch *histXclu[kNclu], *histZclu[kNclu];
TBranch *histZclu[kNclu];
for(Int_t clu=0; clu<kNclu; clu++) {
- //sprintf(branchname,"histXclu_%d",clu+1);
+ //snprintf(branchname,50,"histXclu_%d",clu+1);
//histXclu[clu]= (TBranch*) tree->GetBranch(branchname);
- sprintf(branchname,"histZclu_%d",clu+1);
+ snprintf(branchname,50,"histZclu_%d",clu+1);
histZclu[clu]= (TBranch*) tree->GetBranch(branchname);
}
TBranch *profileResXvsX = (TBranch*) tree->GetBranch("profileResXvsX");
{AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;}
histX->SetAddress(&h);
for(Int_t j=0;j<kNHisto;j++){
- delete h; h=0;
histX->GetEntry(j);
fHisResX[j]->Add(h);
}
{AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;}
histZ->SetAddress(&h);
for(Int_t j=0;j<kNHisto;j++){
- delete h; h=0;
histZ->GetEntry(j);
fHisResZ[j]->Add(h);
}
{AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;}
histXZ->SetAddress(&h2);
for(Int_t j=0;j<kNHisto;j++){
- delete h2; h2=0;
histXZ->GetEntry(j);
fHisResXZ[j]->Add(h2);
}
{AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;}
histClusterType->SetAddress(&h2i);
for(Int_t j=0;j<kNHisto;j++){
- delete h2i; h2i=0;
histClusterType->GetEntry(j);
fHisClusterSize[j]->Add(h2i);
}
{AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;}
profileResXvsCluSizeX->SetAddress(&p);
for(Int_t j=0;j<kNHisto;j++){
- delete p; p=0;
profileResXvsCluSizeX->GetEntry(j);
fProfResXvsCluSizeX[j]->Add(p);
}
{AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;}
histXclu[clu]->SetAddress(&h);
for(Int_t j=0;j<kNHisto;j++){
- delete h; h=0;
histXclu[clu]->GetEntry(j);
fHisResXclu[j][clu]->Add(h);
}*/
{AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;}
histZclu[clu]->SetAddress(&h);
for(Int_t j=0;j<kNHisto;j++){
- delete h; h=0;
histZclu[clu]->GetEntry(j);
fHisResZclu[j][clu]->Add(h);
}
{AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;}
profileResXvsX->SetAddress(&p);
for(Int_t j=0;j<kNHisto;j++){
- delete p; p=0;
profileResXvsX->GetEntry(j);
fProfResXvsX[j]->Add(p);
}
{AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;}
profileResZvsX->SetAddress(&p);
for(Int_t j=0;j<kNHisto;j++){
- delete p; p=0;
profileResZvsX->GetEntry(j);
fProfResZvsX[j]->Add(p);
}
{AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;}
profileClSizXvsX->SetAddress(&p);
for(Int_t j=0;j<kNHisto;j++){
- delete p; p=0;
profileClSizXvsX->GetEntry(j);
fProfClustSizeXvsX[j]->Add(p);
}
{AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;}
profileClSizZvsX->SetAddress(&p);
for(Int_t j=0;j<kNHisto;j++){
- delete p; p=0;
profileClSizZvsX->GetEntry(j);
fProfClustSizeZvsX[j]->Add(p);
}
{AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;}
histTrErrX->SetAddress(&h);
for(Int_t j=0;j<kNHisto;j++){
- delete h; h=0;
histTrErrX->GetEntry(j);
fHisTrackErrX[j]->Add(h);
}
{AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;}
histTrErrZ->SetAddress(&h);
for(Int_t j=0;j<kNHisto;j++){
- delete h; h=0;
histTrErrZ->GetEntry(j);
fHisTrackErrZ[j]->Add(h);
}
{AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;}
histClErrX->SetAddress(&h);
for(Int_t j=0;j<kNHisto;j++){
- delete h; h=0;
histClErrX->GetEntry(j);
fHisClusErrX[j]->Add(h);
}
{AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;}
histClErrZ->SetAddress(&h);
for(Int_t j=0;j<kNHisto;j++){
- delete h; h=0;
histClErrZ->GetEntry(j);
fHisClusErrZ[j]->Add(h);
}
- delete h; h=0;
- delete h2; h2=0;
- delete h2i; h2i=0;
- delete p; p=0;
+ delete h;
+ delete h2;
+ delete h2i;
+ delete p;
if (file) {
file->Close();
+ delete file;
}
return kTRUE;
}