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;
}
-/* 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)
for (Int_t nhist=0;nhist<kNHisto;nhist++){
aux=histnameResX;
aux+=nhist;
- fHisResX[nhist]=new TH1F("histname","histname",1500,-0.30,0.30); // +- 3000 micron; 1 bin=4 micron
+ fHisResX[nhist]=new TH1F("histname","histname",2000,-0.40,0.40); // +- 4000 micron; 1 bin=4 micron
fHisResX[nhist]->SetName(aux.Data());
fHisResX[nhist]->SetTitle(aux.Data());
aux=histnameResZ;
aux+=nhist;
- fHisResZ[nhist]=new TH1F("histname","histname",500,-0.15,0.15); // +-1500 micron; 1 bin=6 micron
+ fHisResZ[nhist]=new TH1F("histname","histname",1000,-0.30,0.30); // +-3000 micron; 1 bin=6 micron
fHisResZ[nhist]->SetName(aux.Data());
fHisResZ[nhist]->SetTitle(aux.Data());
aux=histnameResXZ;
aux+=nhist;
- fHisResXZ[nhist]=new TH2F("histname","histname",50,-0.2,0.2,30,-0.12,0.12); // binning:
+ fHisResXZ[nhist]=new TH2F("histname","histname",100,-0.4,0.4,60,-0.24,0.24); // binning:
// 80 micron in x;
// 80 micron in z;
fHisResXZ[nhist]->SetName(aux.Data());
aux+=nhist;
aux+="_clu_";
aux+=clu+1; // clu=0 --> cluster size 1
- fHisResZclu[nhist][clu]=new TH1F("histname","histname",500,-0.15,0.15); // +-1500 micron; 1 bin=6 micron
+ fHisResZclu[nhist][clu]=new TH1F("histname","histname",1000,-0.30,0.30); // +-3000 micron; 1 bin=6 micron
fHisResZclu[nhist][clu]->SetName(aux.Data());
fHisResZclu[nhist][clu]->SetTitle(aux.Data());
}
aux=histnameTrackErrX;
aux+=nhist;
- fHisTrackErrX[nhist]=new TH1F("histname","histname",200,0.,0.16); // 0-1600 micron; 1 bin=8 micron
+ fHisTrackErrX[nhist]=new TH1F("histname","histname",500,0.,0.50); // 0-5000 micron; 1 bin=10 micron
fHisTrackErrX[nhist]->SetName(aux.Data());
fHisTrackErrX[nhist]->SetTitle(aux.Data());
aux=histnameClusErrX;
aux+=nhist;
- fHisClusErrX[nhist]=new TH1F("histname","histname",200,0.,0.04); // 0-400 micron; 1 bin=2 micron
+ fHisClusErrX[nhist]=new TH1F("histname","histname",400,0.,0.24); // 0-2400 micron; 1 bin=6 micron
fHisClusErrX[nhist]->SetName(aux.Data());
fHisClusErrX[nhist]->SetTitle(aux.Data());
aux=histnameClusErrZ;
aux+=nhist;
- fHisClusErrZ[nhist]=new TH1F("histname","histname",200,0.,0.16); // 0-1600 micron; 1 bin=8 micron
+ fHisClusErrZ[nhist]=new TH1F("histname","histname",400,0.,0.32); // 0-3200 micron; 1 bin=8 micron
fHisClusErrZ[nhist]->SetName(aux.Data());
fHisClusErrZ[nhist]->SetTitle(aux.Data());
}
//__________________________________________________________
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
// Saves the histograms into a tree and saves the trees into a file
//
if (!fHis) return kFALSE;
- if (filename.Data()=="") {
+ if (filename.IsNull() || filename.IsWhitespace()) {
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);
// Read histograms from an already existing file
//
if (!fHis) return kFALSE;
- if (filename.Data()=="") {
+ if (filename.IsNull() || filename.IsWhitespace()) {
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;
}
-