X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=ITS%2FAliITSPlaneEffSPD.cxx;h=c453b8ddd3048ef2f49b1f94b8f3453211716afe;hb=6c62cb59c1ccddb350377a69c4ea74b64b1b1c26;hp=5bc0cc147f2d963c1289cedd34bd67ddaa03cf71;hpb=3ebe30ad50da453dc746879a30f1ee4c3c6511e6;p=u%2Fmrichter%2FAliRoot.git diff --git a/ITS/AliITSPlaneEffSPD.cxx b/ITS/AliITSPlaneEffSPD.cxx index 5bc0cc147f2..c453b8ddd30 100644 --- a/ITS/AliITSPlaneEffSPD.cxx +++ b/ITS/AliITSPlaneEffSPD.cxx @@ -35,25 +35,36 @@ #include "AliCDBEntry.h" #include "AliCDBManager.h" //#include "AliCDBRunRange.h" -//#include "AliITSsegmentationSPD.h" +#include "AliITSsegmentationSPD.h" #include "AliITSCalibrationSPD.h" ClassImp(AliITSPlaneEffSPD) //______________________________________________________________________ AliITSPlaneEffSPD::AliITSPlaneEffSPD(): AliITSPlaneEff(), - //fHis(kFALSE), fHisResX(0), fHisResZ(0), fHisResXZ(0), fHisClusterSize(0), fHisResXclu(0), - fHisResZclu(0){ + fHisResZclu(0), + fHisResXchip(0), + fHisResZchip(0), + fProfResXvsPhi(0), + fProfResZvsDip(0), + fProfResXvsPhiclu(0), + fProfResZvsDipclu(0), + fHisTrackErrX(0), + fHisTrackErrZ(0), + fHisClusErrX(0), + fHisClusErrZ(0){ for (UInt_t i=0; i cluster size 1 s.fHisResXclu[i][clu]->Copy(*fHisResXclu[i][clu]); s.fHisResZclu[i][clu]->Copy(*fHisResZclu[i][clu]); + s.fProfResXvsPhiclu[i][clu]->Copy(*fProfResXvsPhiclu[i][clu]); + s.fProfResZvsDipclu[i][clu]->Copy(*fProfResZvsDipclu[i][clu]); } + for(Int_t chip=0; chipCopy(*fHisResXchip[i][chip]); + s.fHisResZchip[i][chip]->Copy(*fHisResZchip[i][chip]); + } + s.fProfResXvsPhi[i]->Copy(*fProfResXvsPhi[i]); + s.fProfResZvsDip[i]->Copy(*fProfResZvsDip[i]); + s.fHisTrackErrX[i]->Copy(*fHisTrackErrX[i]); + s.fHisTrackErrZ[i]->Copy(*fHisTrackErrZ[i]); + s.fHisClusErrX[i]->Copy(*fHisClusErrX[i]); + s.fHisClusErrZ[i]->Copy(*fHisClusErrZ[i]); } } } @@ -125,7 +158,19 @@ AliITSPlaneEffSPD& AliITSPlaneEffSPD::operator+=(const AliITSPlaneEffSPD &add){ for(Int_t clu=0; clu cluster size 1 fHisResXclu[i][clu]->Add(add.fHisResXclu[i][clu]); fHisResZclu[i][clu]->Add(add.fHisResZclu[i][clu]); + fProfResXvsPhiclu[i][clu]->Add(add.fProfResXvsPhiclu[i][clu]); + fProfResZvsDipclu[i][clu]->Add(add.fProfResZvsDipclu[i][clu]); + } + for(Int_t chip=0; chipAdd(add.fHisResXchip[i][chip]); + fHisResZchip[i][chip]->Add(add.fHisResZchip[i][chip]); } + fProfResXvsPhi[i]->Add(add.fProfResXvsPhi[i]); + fProfResZvsDip[i]->Add(add.fProfResZvsDip[i]); + fHisTrackErrX[i]->Add(add.fHisTrackErrX[i]); + fHisTrackErrZ[i]->Add(add.fHisTrackErrZ[i]); + fHisClusErrX[i]->Add(add.fHisClusErrX[i]); + fHisClusErrZ[i]->Add(add.fHisClusErrZ[i]); } } return *this; @@ -168,6 +213,16 @@ void AliITSPlaneEffSPD::CopyHistos(AliITSPlaneEffSPD &target) const { target.fHisClusterSize=new TH2I*[kNHisto]; target.fHisResXclu=new TH1F**[kNHisto]; target.fHisResZclu=new TH1F**[kNHisto]; + target.fHisResXchip=new TH1F**[kNHisto]; + target.fHisResZchip=new TH1F**[kNHisto]; + target.fProfResXvsPhi=new TProfile*[kNHisto]; + target.fProfResZvsDip=new TProfile*[kNHisto]; + target.fProfResXvsPhiclu=new TProfile**[kNHisto]; + target.fProfResZvsDipclu=new TProfile**[kNHisto]; + target.fHisTrackErrX=new TH1F*[kNHisto]; + target.fHisTrackErrZ=new TH1F*[kNHisto]; + target.fHisClusErrX=new TH1F*[kNHisto]; + target.fHisClusErrZ=new TH1F*[kNHisto]; for(Int_t i=0; i cluster size 1 target.fHisResXclu[i][clu] = new TH1F(*fHisResXclu[i][clu]); target.fHisResZclu[i][clu] = new TH1F(*fHisResZclu[i][clu]); + target.fProfResXvsPhiclu[i][clu] = new TProfile(*fProfResXvsPhiclu[i][clu]); + target.fProfResZvsDipclu[i][clu] = new TProfile(*fProfResZvsDipclu[i][clu]); + } + target.fHisResXchip[i]=new TH1F*[kNChip]; + target.fHisResZchip[i]=new TH1F*[kNChip]; + for(Int_t chip=0; chip=kNModule || ic>=kNChip) {AliError("GetMissingTracksForGivenEff: you asked for a non existing chip"); return -1;} -else return GetNTracksForGivenEff(eff,RelErr)-fTried[GetKey(im,ic)]; +else { + UInt_t key=GetKey(im,ic); + if(key chip number [0,4] if (im>=kNModule || ic>=kNChip) {AliError("PlaneEff(Uint_t,Uint_t): you asked for a non existing chip"); return -1.;} - Int_t nf=fFound[GetKey(im,ic)]; - Int_t nt=fTried[GetKey(im,ic)]; +UInt_t key=GetKey(im,ic); +Int_t nf=-1; +Int_t nt=-1; +if(key chip number [0,4] if (im>=kNModule || ic>=kNChip) {AliError("ErrPlaneEff(Uint_t,Uint_t): you asked for a non existing chip"); return -1.;} -Int_t nf=fFound[GetKey(im,ic)]; -Int_t nt=fTried[GetKey(im,ic)]; +UInt_t key=GetKey(im,ic); +Int_t nf=-1; +Int_t nt=-1; +if(key=kNModule || ic>=kNChip) {AliError("UpDatePlaneEff: you asked for a non existing chip"); return kFALSE;} - fTried[GetKey(im,ic)]++; - if(Kfound) fFound[GetKey(im,ic)]++; - return kTRUE; + UInt_t key=GetKey(im,ic); + if(keyGet("ITS/Calib/SPDSparseDead", fRunNumber); +TObjArray* spdSparseDead; +if(cdbSPDSparseDead) { + spdSparseDead = (TObjArray*)cdbSPDSparseDead->GetObject(); + if(!spdSparseDead) + {AliError("GetDeadAndNoisyInChip: SPDSparseDead not found in CDB"); + return;} +} else { + AliError("GetDeadAndNoisyInChip: did not find Calib/SPDSparseDead."); + return; +} + // retrieve map of noisy Pixel AliCDBEntry *cdbSPDNoisy = man->Get("ITS/Calib/SPDNoisy", fRunNumber); TObjArray* spdNoisy; @@ -374,6 +462,12 @@ UInt_t nrDead = calibSPD->GetNrBad(); for (UInt_t index=0; indexGetBadColAt(index))==chip) nrDeadInChip++; } +// add the number of sparse dead to the previous dead +calibSPD=(AliITSCalibrationSPD*) spdSparseDead->At(mod); +UInt_t nrSparseDead = calibSPD->GetNrBad(); +for (UInt_t index=0; indexGetBadColAt(index))==chip) nrDeadInChip++; +} calibSPD=(AliITSCalibrationSPD*) spdNoisy->At(mod); UInt_t nrNoisy = calibSPD->GetNrBad(); for (UInt_t index=0; indexSetObjectClassName("AliITSPlaneEff"); + //md->SetObjectClassName("AliITSPlaneEff"); md->SetResponsible("Giuseppe Eugenio Bruno"); md->SetBeamPeriod(0); md->SetAliRootVersion("head 19/11/07"); //root version @@ -414,10 +508,8 @@ Bool_t AliITSPlaneEffSPD::ReadFromCDB() { if(!fInitCDBCalled) {AliError("ReadFromCDB: CDB not inizialized. Call InitCDB first"); return kFALSE;} -//if(!AliCDBManager::Instance()->IsDefaultStorageSet()) { -// AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT"); -// } AliCDBEntry *cdbEntry = AliCDBManager::Instance()->Get("ITS/PlaneEff/PlaneEffSPD",fRunNumber); +if(!cdbEntry) return kFALSE; AliITSPlaneEffSPD* eff= (AliITSPlaneEffSPD*)cdbEntry->GetObject(); if(this==eff) return kFALSE; if(fHis) CopyHistos(*eff); // If histos already exist then copy them to eff @@ -425,6 +517,22 @@ eff->Copy(*this); // copy everything (statistics and histos) from eff t return kTRUE; } //_____________________________________________________________________________ +Bool_t AliITSPlaneEffSPD::AddFromCDB(AliCDBId *cdbId) { +AliCDBEntry *cdbEntry=0; +// read efficiency values from CDB +if (!cdbId) { + if(!fInitCDBCalled) + {AliError("ReadFromCDB: CDB not inizialized. Call InitCDB first"); return kFALSE;} + cdbEntry = AliCDBManager::Instance()->Get("ITS/PlaneEff/PlaneEffSPD",fRunNumber); +} else { + cdbEntry = AliCDBManager::Instance()->Get(*cdbId); +} +if(!cdbEntry) return kFALSE; +AliITSPlaneEffSPD* eff= (AliITSPlaneEffSPD*)cdbEntry->GetObject(); +*this+=*eff; +return kTRUE; +} +//_____________________________________________________________________________ UInt_t AliITSPlaneEffSPD::GetKeyFromDetLocCoord(Int_t ilay, Int_t idet, Float_t, Float_t locz) const { // method to locate a basic block from Detector Local coordinate (to be used in tracking) @@ -446,17 +554,16 @@ return key; } //_____________________________________________________________________________ UInt_t AliITSPlaneEffSPD::GetColFromLocZ(Float_t zloc) const { -UInt_t col=0; -/* note: as it is now, the AliITSsegmentationSPD::Init() does not properly initialize (6 chips !!!) -AliITSsegmentationSPD spd; -spd.Init(); -Int_t ix,iz; -if(spd.LocalToDet(0,zloc,ix,iz)) col+=iz; -else { - AliError("GetColFromLocZ: cannot compute column number from local z"); - col=99999;} -return col; -*/ +// method to retrieve column number from the local z coordinate + UInt_t col=0; + AliITSsegmentationSPD spd; + Int_t ix,iz; + if(spd.LocalToDet(0,zloc,ix,iz)) col+=iz; + else { + AliDebug(1,Form("cannot compute column number from local z=%f",zloc)); + col=99999;} + return col; +/* const Float_t kconv = 1.0E-04; // converts microns to cm. Float_t bz[160]; for(Int_t i=000;i<160;i++) bz[i] = 425.0; // most are 425 microns except below @@ -479,6 +586,7 @@ for(j=0;j<160;j++){ col+=j; // return col; +*/ } //________________________________________________________ Bool_t AliITSPlaneEffSPD::GetBlockBoundaries(const UInt_t key, Float_t& xmn,Float_t& xmx, @@ -498,6 +606,7 @@ zmn=GetLocZFromCol(chip*kNCol); zmx=GetLocZFromCol((chip+1)*kNCol); xmn=GetLocXFromRow(0); xmx=GetLocXFromRow(kNRow); +// Float_t tmp=zmn; if(zmxkNRow) // not >= ! allow also computation of upper limit of the last row. {AliError("LocYFromRow: you asked for a non existing row"); return 9999999.;} -const Float_t kconv = 1.0E-04; // converts microns to cm. -Float_t bx[256]; -for(Int_t i=000;i<256;i++) bx[i] = 50.0; // in x all are 50 microns. -// -Float_t dx=0; -for(Int_t i=000;i<256;i++) dx+=bx[i]; -dx = -0.5*kconv*dx; -for(UInt_t j=0;jkNChip*kNCol) // not >= ! allow also computation of upper limit of the last column {AliError("LocZFromCol: you asked for a non existing column"); return 9999999.;} -const Float_t kconv = 1.0E-04; // converts microns to cm. -Float_t bz[160]; -for(Int_t i=000;i<160;i++) bz[i] = 425.0; // most are 425 microns except below -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 -// -Float_t dz=0; -for(Int_t i=000;i<160;i++) dz+=bz[i]; -dz = -0.5*kconv*dz; -for(UInt_t j=0;jSetName(aux.Data()); fHisResX[nhist]->SetTitle(aux.Data()); aux=histnameResZ; aux+=nhist; - fHisResZ[nhist]=new TH1F("histname","histname",800,-0.32,0.32); // +-3200 micron; 1 bin=8 micron + fHisResZ[nhist]=new TH1F("histname","histname",1200,-0.48,0.48); // +-4800 micron; 1 bin=8 micron fHisResZ[nhist]->SetName(aux.Data()); fHisResZ[nhist]->SetTitle(aux.Data()); aux=histnameResXZ; aux+=nhist; - fHisResXZ[nhist]=new TH2F("histname","histname",40,-0.02,0.02,40,-0.16,0.16); // binning: - // 10 micron in x; - // 80 micron in z; - fHisResXZ[nhist]->SetName(aux.Data()); - fHisResXZ[nhist]->SetTitle(aux.Data()); + fHisResXZ[nhist]=new TH2F("histname","histname",80,-0.16,0.16,80,-0.32,0.32); // binning: + fHisResXZ[nhist]->SetName(aux.Data()); // 40 micron in x; + fHisResXZ[nhist]->SetTitle(aux.Data()); // 80 micron in z; aux=histnameClusterType; aux+=nhist; @@ -608,7 +726,7 @@ void AliITSPlaneEffSPD::InitHistos() { aux+=nhist; aux+="_clu_"; aux+=clu+1; // clu=0 --> cluster size 1 - fHisResXclu[nhist][clu]=new TH1F("histname","histname",800,-0.04,0.04); // +- 400 micron; 1 bin=1 micron + fHisResXclu[nhist][clu]=new TH1F("histname","histname",1600,-0.32,0.32); // +- 3200 micron; 1 bin=4 micron fHisResXclu[nhist][clu]->SetName(aux.Data()); fHisResXclu[nhist][clu]->SetTitle(aux.Data()); @@ -616,16 +734,96 @@ void AliITSPlaneEffSPD::InitHistos() { aux+=nhist; aux+="_clu_"; aux+=clu+1; // clu=0 --> cluster size 1 - fHisResZclu[nhist][clu]=new TH1F("histname","histname",800,-0.32,0.32); // +-3200 micron; 1 bin=8 micron + fHisResZclu[nhist][clu]=new TH1F("histname","histname",1200,-0.48,0.48); // +-4800 micron; 1 bin=8 micron fHisResZclu[nhist][clu]->SetName(aux.Data()); fHisResZclu[nhist][clu]->SetTitle(aux.Data()); } - } + fHisResXchip[nhist]=new TH1F*[kNChip]; + fHisResZchip[nhist]=new TH1F*[kNChip]; + for(Int_t chip=0; chipSetName(aux.Data()); + fHisResXchip[nhist][chip]->SetTitle(aux.Data()); + + aux=histnameResZchip; + aux+=nhist; + aux+="_chip_"; + aux+=chip; + fHisResZchip[nhist][chip]=new TH1F("histname","histname",300,-0.48,0.48); // +-4800 micron; 1 bin=32 micron + fHisResZchip[nhist][chip]->SetName(aux.Data()); + fHisResZchip[nhist][chip]->SetTitle(aux.Data()); + } + + aux=histnameTrackErrX; + aux+=nhist; + fHisTrackErrX[nhist]=new TH1F("histname","histname",400,0.,0.32); // 0-3200 micron; 1 bin=8 micron + fHisTrackErrX[nhist]->SetName(aux.Data()); + fHisTrackErrX[nhist]->SetTitle(aux.Data()); + + aux=histnameTrackErrZ; + aux+=nhist; + fHisTrackErrZ[nhist]=new TH1F("histname","histname",200,0.,0.32); // 0-3200 micron; 1 bin=16 micron + fHisTrackErrZ[nhist]->SetName(aux.Data()); + fHisTrackErrZ[nhist]->SetTitle(aux.Data()); + + aux=histnameClusErrX; + aux+=nhist; + fHisClusErrX[nhist]=new TH1F("histname","histname",400,0.,0.08); // 0-800 micron; 1 bin=2 micron + fHisClusErrX[nhist]->SetName(aux.Data()); + fHisClusErrX[nhist]->SetTitle(aux.Data()); + + aux=histnameClusErrZ; + aux+=nhist; + 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()); + + aux=profnameResXvsPhi; + aux+=nhist; + fProfResXvsPhi[nhist]=new TProfile("histname","histname",40,-40.,40.0); // binning: range: -40°- 40° + fProfResXvsPhi[nhist]->SetName(aux.Data()); // bin width: 2° + fProfResXvsPhi[nhist]->SetTitle(aux.Data()); + + aux=profnameResZvsDip; + aux+=nhist; + fProfResZvsDip[nhist]=new TProfile("histname","histname",48,-72.,72.0); // binning: range: -70°-4° + fProfResZvsDip[nhist]->SetName(aux.Data()); // bin width: 3° + fProfResZvsDip[nhist]->SetTitle(aux.Data()); + + fProfResXvsPhiclu[nhist]=new TProfile*[kNclu]; + fProfResZvsDipclu[nhist]=new TProfile*[kNclu]; + for(Int_t clu=0; clu cluster size 1 + aux=profnameResXvsPhiclu; + aux+=nhist; + aux+="_clu_"; + aux+=clu+1; // clu=0 --> cluster size 1 + fProfResXvsPhiclu[nhist][clu]=new TProfile("histname","histname",40,-40.,40.0); // binning: range: -40°- 40 + fProfResXvsPhiclu[nhist][clu]->SetName(aux.Data()); // bin width: 2° + fProfResXvsPhiclu[nhist][clu]->SetTitle(aux.Data()); + + aux=profnameResZvsDipclu; + aux+=nhist; + aux+="_clu_"; + aux+=clu+1; // clu=0 --> cluster size 1 + fProfResZvsDipclu[nhist][clu]= new TProfile("histname","histname",48,-72.,72.0); // binning: range: -70°-7° + fProfResZvsDipclu[nhist][clu]->SetName(aux.Data()); // bin width: 3° + fProfResZvsDipclu[nhist][clu]->SetTitle(aux.Data()); + } + + } // end loop on module + + TH1::AddDirectory(kTRUE); + return; } //__________________________________________________________ void AliITSPlaneEffSPD::DeleteHistos() { +// Delete the histograms and clean the memory if(fHisResX) { for (Int_t i=0; i=kNModule*kNChip) {AliWarning("FillHistos: you asked for a non existing key"); return kFALSE;} Int_t id=GetModFromKey(key); + Int_t chip=GetChipFromKey(key); if(id>=kNHisto) {AliWarning("FillHistos: you want to fill a non-existing histos"); return kFALSE;} if(found) { - Float_t resx=tXZ[0]-cXZ[0]; - Float_t resz=tXZ[1]-cXZ[1]; + Float_t resx=tr[0]-clu[0]; + Float_t resz=tr[1]-clu[1]; fHisResX[id]->Fill(resx); fHisResZ[id]->Fill(resz); fHisResXZ[id]->Fill(resx,resz); - fHisClusterSize[id]->Fill((Double_t)ctXZ[0],(Double_t)ctXZ[1]); - if(ctXZ[0]>0 && ctXZ[0]<=kNclu) fHisResXclu[id][ctXZ[0]-1]->Fill(resx); - if(ctXZ[1]>0 && ctXZ[1]<=kNclu) fHisResZclu[id][ctXZ[1]-1]->Fill(resx); + fHisClusterSize[id]->Fill((Double_t)csize[0],(Double_t)csize[1]); + if(csize[0]>0 && csize[0]<=kNclu) fHisResXclu[id][csize[0]-1]->Fill(resx); + if(csize[1]>0 && csize[1]<=kNclu) fHisResZclu[id][csize[1]-1]->Fill(resz); + fHisResXchip[id][chip]->Fill(resx); + fHisResZchip[id][chip]->Fill(resz); + fProfResXvsPhi[id]->Fill(angtrkmod[0],resx); + fProfResZvsDip[id]->Fill(angtrkmod[1],resz); + if(csize[0]>0 && csize[0]<=kNclu) fProfResXvsPhiclu[id][csize[0]-1]->Fill(angtrkmod[0],resx); + if(csize[1]>0 && csize[1]<=kNclu) fProfResZvsDipclu[id][csize[1]-1]->Fill(angtrkmod[1],resz); } + fHisTrackErrX[id]->Fill(tr[2]); + fHisTrackErrZ[id]->Fill(tr[3]); + fHisClusErrX[id]->Fill(clu[2]); + fHisClusErrZ[id]->Fill(clu[3]); return kTRUE; } //__________________________________________________________ @@ -699,11 +968,11 @@ Bool_t AliITSPlaneEffSPD::WriteHistosToFile(TString filename, Option_t* option) // 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 *SPDTree=new TTree("SPDTree","Tree whith Residuals and Cluster Type distributions for SPD"); @@ -712,6 +981,12 @@ Bool_t AliITSPlaneEffSPD::WriteHistosToFile(TString filename, Option_t* option) TH2I *histClusterType; TH1F *histXclu[kNclu]; TH1F *histZclu[kNclu]; + TH1F *histXchip[kNChip]; + TH1F *histZchip[kNChip]; + TH1F *histTrErrZ,*histTrErrX; + TH1F *histClErrZ,*histClErrX; + TProfile *profXvsPhi,*profZvsDip; + TProfile *profXvsPhiclu[kNclu],*profZvsDipclu[kNclu]; histZ=new TH1F(); histX=new TH1F(); @@ -721,17 +996,50 @@ Bool_t AliITSPlaneEffSPD::WriteHistosToFile(TString filename, Option_t* option) histXclu[clu]=new TH1F(); histZclu[clu]=new TH1F(); } + for(Int_t chip=0;chipBranch("histX","TH1F",&histX,128000,0); SPDTree->Branch("histZ","TH1F",&histZ,128000,0); SPDTree->Branch("histXZ","TH2F",&histXZ,128000,0); SPDTree->Branch("histClusterType","TH2I",&histClusterType,128000,0); for(Int_t clu=0;cluBranch(branchname,"TH1F",&histXclu[clu],128000,0); - sprintf(branchname,"histZclu_%d",clu+1); + snprintf(branchname,50,"histZclu_%d",clu+1); SPDTree->Branch(branchname,"TH1F",&histZclu[clu],128000,0); } + for(Int_t chip=0;chipBranch(branchname,"TH1F",&histXchip[chip],128000,0); + snprintf(branchname,50,"histZchip_%d",chip); + SPDTree->Branch(branchname,"TH1F",&histZchip[chip],128000,0); + } + SPDTree->Branch("histTrErrX","TH1F",&histTrErrX,128000,0); + SPDTree->Branch("histTrErrZ","TH1F",&histTrErrZ,128000,0); + SPDTree->Branch("histClErrX","TH1F",&histClErrX,128000,0); + SPDTree->Branch("histClErrZ","TH1F",&histClErrZ,128000,0); + SPDTree->Branch("profXvsPhi","TProfile",&profXvsPhi,128000,0); + SPDTree->Branch("profZvsDip","TProfile",&profZvsDip,128000,0); + for(Int_t clu=0;cluBranch(branchname,"TProfile",&profXvsPhiclu[clu],128000,0); + snprintf(branchname,50,"profZvsDipclu_%d",clu+1); + SPDTree->Branch(branchname,"TProfile",&profZvsDipclu[clu],128000,0); + } for(Int_t j=0;jFill(); } hFile->Write(); @@ -754,15 +1077,16 @@ Bool_t AliITSPlaneEffSPD::ReadHistosFromFile(TString filename) { // 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; TH2I *h2i= 0; + TProfile *p = 0; TFile *file=TFile::Open(filename.Data(),"READONLY"); @@ -780,12 +1104,35 @@ Bool_t AliITSPlaneEffSPD::ReadHistosFromFile(TString filename) { TBranch *histXclu[kNclu], *histZclu[kNclu]; for(Int_t clu=0; cluGetBranch(branchname); - sprintf(branchname,"histZclu_%d",clu+1); + snprintf(branchname,50,"histZclu_%d",clu+1); histZclu[clu]= (TBranch*) tree->GetBranch(branchname); } + TBranch *histXchip[kNChip], *histZchip[kNChip]; + for(Int_t chip=0; chipGetBranch(branchname); + snprintf(branchname,50,"histZchip_%d",chip); + histZchip[chip]= (TBranch*) tree->GetBranch(branchname); + } + + TBranch *histTrErrX = (TBranch*) tree->GetBranch("histTrErrX"); + TBranch *histTrErrZ = (TBranch*) tree->GetBranch("histTrErrZ"); + TBranch *histClErrX = (TBranch*) tree->GetBranch("histClErrX"); + TBranch *histClErrZ = (TBranch*) tree->GetBranch("histClErrZ"); + TBranch *profXvsPhi = (TBranch*) tree->GetBranch("profXvsPhi"); + TBranch *profZvsDip = (TBranch*) tree->GetBranch("profZvsDip"); + + TBranch *profXvsPhiclu[kNclu], *profZvsDipclu[kNclu]; + for(Int_t clu=0; cluGetBranch(branchname); + snprintf(branchname,50,"profZvsDipclu_%d",clu+1); + profZvsDipclu[clu]= (TBranch*) tree->GetBranch(branchname); + } + gROOT->cd(); Int_t nevent = (Int_t)histX->GetEntries(); @@ -793,7 +1140,6 @@ Bool_t AliITSPlaneEffSPD::ReadHistosFromFile(TString filename) { {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} histX->SetAddress(&h); for(Int_t j=0;jGetEntry(j); fHisResX[j]->Add(h); } @@ -803,7 +1149,6 @@ Bool_t AliITSPlaneEffSPD::ReadHistosFromFile(TString filename) { {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} histZ->SetAddress(&h); for(Int_t j=0;jGetEntry(j); fHisResZ[j]->Add(h); } @@ -813,7 +1158,6 @@ Bool_t AliITSPlaneEffSPD::ReadHistosFromFile(TString filename) { {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} histXZ->SetAddress(&h2); for(Int_t j=0;jGetEntry(j); fHisResXZ[j]->Add(h2); } @@ -823,7 +1167,6 @@ Bool_t AliITSPlaneEffSPD::ReadHistosFromFile(TString filename) { {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} histClusterType->SetAddress(&h2i); for(Int_t j=0;jGetEntry(j); fHisClusterSize[j]->Add(h2i); } @@ -835,7 +1178,6 @@ Bool_t AliITSPlaneEffSPD::ReadHistosFromFile(TString filename) { {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} histXclu[clu]->SetAddress(&h); for(Int_t j=0;jGetEntry(j); fHisResXclu[j][clu]->Add(h); } @@ -845,18 +1187,118 @@ Bool_t AliITSPlaneEffSPD::ReadHistosFromFile(TString filename) { {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} histZclu[clu]->SetAddress(&h); for(Int_t j=0;jGetEntry(j); fHisResZclu[j][clu]->Add(h); } } - delete h; h=0; - delete h2; h2=0; - delete h2i; h2i=0; + + for(Int_t chip=0; chipGetEntries(); + if(nevent!=kNHisto) + {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} + histXchip[chip]->SetAddress(&h); + for(Int_t j=0;jGetEntry(j); + fHisResXchip[j][chip]->Add(h); + } + + nevent = (Int_t)histZchip[chip]->GetEntries(); + if(nevent!=kNHisto) + {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} + histZchip[chip]->SetAddress(&h); + for(Int_t j=0;jGetEntry(j); + fHisResZchip[j][chip]->Add(h); + } + } + + nevent = (Int_t)histTrErrX->GetEntries(); + if(nevent!=kNHisto) + {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} + histTrErrX->SetAddress(&h); + for(Int_t j=0;jGetEntry(j); + fHisTrackErrX[j]->Add(h); + } + + nevent = (Int_t)histTrErrZ->GetEntries(); + if(nevent!=kNHisto) + {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} + histTrErrZ->SetAddress(&h); + for(Int_t j=0;jGetEntry(j); + fHisTrackErrZ[j]->Add(h); + } + + nevent = (Int_t)histClErrX->GetEntries(); + if(nevent!=kNHisto) + {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} + histClErrX->SetAddress(&h); + for(Int_t j=0;jGetEntry(j); + fHisClusErrX[j]->Add(h); + } + + nevent = (Int_t)histClErrZ->GetEntries(); + if(nevent!=kNHisto) + {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} + histClErrZ->SetAddress(&h); + for(Int_t j=0;jGetEntry(j); + fHisClusErrZ[j]->Add(h); + } + + nevent = (Int_t)profXvsPhi->GetEntries(); + if(nevent!=kNHisto) + {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} + profXvsPhi->SetAddress(&p); + for(Int_t j=0;jGetEntry(j); + fProfResXvsPhi[j]->Add(p); + } + + nevent = (Int_t)profZvsDip->GetEntries(); + if(nevent!=kNHisto) + {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} + profZvsDip->SetAddress(&p); + for(Int_t j=0;jGetEntry(j); + fProfResZvsDip[j]->Add(p); + } + + for(Int_t clu=0; cluGetEntries(); + if(nevent!=kNHisto) + {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} + profXvsPhiclu[clu]->SetAddress(&p); + for(Int_t j=0;jGetEntry(j); + fProfResXvsPhiclu[j][clu]->Add(p); + } + + nevent = (Int_t)profZvsDipclu[clu]->GetEntries(); + if(nevent!=kNHisto) + {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} + profZvsDipclu[clu]->SetAddress(&p); + for(Int_t j=0;jGetEntry(j); + fProfResZvsDipclu[j][clu]->Add(p); + } + } + + + delete h; + delete h2; + delete h2i; + delete p; if (file) { file->Close(); + delete file; } return kTRUE; } +