X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=blobdiff_plain;f=ITS%2FAliITSPlaneEffSDD.cxx;h=0bc4c7890443881f17687e1b5640a2755545e383;hp=4377c6c91618811608ceb572414f9a4474ba586f;hb=cef66441c16e4a204de021a7dff92597a17d1e83;hpb=3ebe30ad50da453dc746879a30f1ee4c3c6511e6 diff --git a/ITS/AliITSPlaneEffSDD.cxx b/ITS/AliITSPlaneEffSDD.cxx index 4377c6c9161..0bc4c789044 100644 --- a/ITS/AliITSPlaneEffSDD.cxx +++ b/ITS/AliITSPlaneEffSDD.cxx @@ -48,17 +48,22 @@ AliITSPlaneEffSDD::AliITSPlaneEffSDD(): fHisResZ(0), fHisResXZ(0), fHisClusterSize(0), - fHisResXclu(0), + fProfResXvsCluSizeX(0), + //fHisResXclu(0), fHisResZclu(0), fProfResXvsX(0), fProfResZvsX(0), fProfClustSizeXvsX(0), - fProfClustSizeZvsX(0){ + fProfClustSizeZvsX(0), + fHisTrackErrX(0), + fHisTrackErrZ(0), + fHisClusErrX(0), + fHisClusErrZ(0){ for (UInt_t i=0; iCopy(*fHisResZ[i]); s.fHisResXZ[i]->Copy(*fHisResXZ[i]); s.fHisClusterSize[i]->Copy(*fHisClusterSize[i]); + s.fProfResXvsCluSizeX[i]->Copy(*fProfResXvsCluSizeX[i]); for(Int_t clu=0; clu cluster size 1 - s.fHisResXclu[i][clu]->Copy(*fHisResXclu[i][clu]); + //s.fHisResXclu[i][clu]->Copy(*fHisResXclu[i][clu]); s.fHisResZclu[i][clu]->Copy(*fHisResZclu[i][clu]); } s.fProfResXvsX[i]->Copy(*fProfResXvsX[i]); s.fProfResZvsX[i]->Copy(*fProfResZvsX[i]); s.fProfClustSizeXvsX[i]->Copy(*fProfClustSizeXvsX[i]); s.fProfClustSizeZvsX[i]->Copy(*fProfClustSizeZvsX[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]); } } } @@ -135,14 +150,19 @@ AliITSPlaneEffSDD& AliITSPlaneEffSDD::operator+=(const AliITSPlaneEffSDD &add){ fHisResZ[i]->Add(add.fHisResZ[i]); fHisResXZ[i]->Add(add.fHisResXZ[i]); fHisClusterSize[i]->Add(add.fHisClusterSize[i]); + fProfResXvsCluSizeX[i]->Add(add.fProfResXvsCluSizeX[i]); for(Int_t clu=0; clu cluster size 1 - fHisResXclu[i][clu]->Add(add.fHisResXclu[i][clu]); + //fHisResXclu[i][clu]->Add(add.fHisResXclu[i][clu]); fHisResZclu[i][clu]->Add(add.fHisResZclu[i][clu]); } fProfResXvsX[i]->Add(add.fProfResXvsX[i]); fProfResZvsX[i]->Add(add.fProfResZvsX[i]); fProfClustSizeXvsX[i]->Add(add.fProfClustSizeXvsX[i]); fProfClustSizeZvsX[i]->Add(add.fProfClustSizeZvsX[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; @@ -183,47 +203,43 @@ void AliITSPlaneEffSDD::CopyHistos(AliITSPlaneEffSDD &target) const { target.fHisResZ=new TH1F*[kNHisto]; target.fHisResXZ=new TH2F*[kNHisto]; target.fHisClusterSize=new TH2I*[kNHisto]; - target.fHisResXclu=new TH1F**[kNHisto]; + target.fProfResXvsCluSizeX=new TProfile*[kNHisto]; + //target.fHisResXclu=new TH1F**[kNHisto]; target.fHisResZclu=new TH1F**[kNHisto]; target.fProfResXvsX=new TProfile*[kNHisto]; target.fProfResZvsX=new TProfile*[kNHisto]; target.fProfClustSizeXvsX=new TProfile*[kNHisto]; target.fProfClustSizeZvsX=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.fHisResXclu[i][clu] = new TH1F(*fHisResXclu[i][clu]); target.fHisResZclu[i][clu] = new TH1F(*fHisResZclu[i][clu]); } target.fProfResXvsX[i]=new TProfile(*fProfResXvsX[i]); target.fProfResZvsX[i]=new TProfile(*fProfResZvsX[i]); target.fProfClustSizeXvsX[i]=new TProfile(*fProfClustSizeXvsX[i]); target.fProfClustSizeZvsX[i]=new TProfile(*fProfClustSizeZvsX[i]); + target.fHisTrackErrX[i] = new TH1F(*fHisTrackErrX[i]); + target.fHisTrackErrZ[i] = new TH1F(*fHisTrackErrZ[i]); + target.fHisClusErrX[i] = new TH1F(*fHisClusErrX[i]); + target.fHisClusErrZ[i] = new TH1F(*fHisClusErrZ[i]); } } return; } -//______________________________________________________________________ -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 { @@ -243,7 +259,11 @@ Int_t AliITSPlaneEffSDD::GetMissingTracksForGivenEff(Double_t eff, Double_t RelE 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 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 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 || 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 (keyIsDefaultStorageSet()) { -// AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT"); -// } AliCDBEntry *cdbEntry = AliCDBManager::Instance()->Get("ITS/PlaneEff/PlaneEffSDD",fRunNumber); +if(!cdbEntry) return kFALSE; AliITSPlaneEffSDD* eff= (AliITSPlaneEffSDD*)cdbEntry->GetObject(); if(this==eff) return kFALSE; if(fHis) CopyHistos(*eff); // If histos already exist then copy them to eff @@ -494,10 +528,45 @@ eff->Copy(*this); // copy everything (statistics and histos) from eff t return kTRUE; } //_____________________________________________________________________________ +Bool_t AliITSPlaneEffSDD::AddFromCDB(AliCDBId *cdbId) { +// read efficiency values from CDB +AliCDBEntry *cdbEntry=0; +if (!cdbId) { + if(!fInitCDBCalled) + {AliError("ReadFromCDB: CDB not inizialized. Call InitCDB first"); return kFALSE;} + cdbEntry = AliCDBManager::Instance()->Get("ITS/PlaneEff/PlaneEffSDD",fRunNumber); +} else { + cdbEntry = AliCDBManager::Instance()->Get(*cdbId); +} +if(!cdbEntry) return kFALSE; +AliITSPlaneEffSDD* eff= (AliITSPlaneEffSDD*)cdbEntry->GetObject(); +*this+=*eff; +return kTRUE; +} +//_____________________________________________________________________________ UInt_t AliITSPlaneEffSDD::GetKeyFromDetLocCoord(Int_t ilay, Int_t idet, Float_t locx, Float_t locz) const { // method to locate a basic block from Detector Local coordinate (to be used in tracking) // +// From AliITSsegmentationSDD rev. 24315 2008-03-05: +// ^x_loc +// | +// _________________________|0_________________________ +// |0 1 .. | |. | 255| (anode numbers) +// | | |. | | +// | | |. | | CHANNEL (i.e. WING) = 1 +// | chip=0 | chip=1 |. chip=2 | chip=3 | +// | | |. | | +// |____________|____________|256_________|____________|______\ local z (cm) +// | | |. | | / +// | | |. | | +// | chip=7 | chip=6 |. chip=5 | chip=4 | CHANNEL (i.e. WING) = 0 +// | | |. | | +// | | |. | | +// |____________|____________|0___________|____________| +// 511 510 ... ^ .. 257 256 (anode numbers) +// |_ (time bins) +// // If kNSubWing = 1, i.e. no sub-wing subdivision, then the numbering scheme of the // unique key is the following, e.g. for the first detector (idet=0, ilayer=2) // @@ -507,53 +576,57 @@ UInt_t AliITSPlaneEffSDD::GetKeyFromDetLocCoord(Int_t ilay, Int_t idet, // | | | | | // | | | | | // | | | | | -// | key=1 | key=3 | key=5 | key=7 | +// | key=0 | key=2 | key=4 | key=6 | // | | | | | // |____________|____________|____________|____________|_0_____\ local z (cm) // | | | | | / // | | | | | -// | key=0 | key=2 | key=4 | key=6 | +// | key=7 | key=5 | key=3 | key=1 | // | | | | | // | | | | | // |____________|____________|____________|____________| -3.5085 //-3.7632 -1.8816 0 1.1186 3.7632 // -// for the second detector (idet=2, ilay=2), first key is 8 (bottom-left), -// last one is 15 (upper-right), and so on. +// for the second detector (idet=2, ilay=2), the same as above but +8: first one 8 (bottom-left), +// last one is 15 (lower-left), and so on. // -// If subwing division has been applied, then you count in each wing, starting from -// the one with negative local , from the anode side (outer part) towards the -// cathod strip (center). -// first column: -// bottom wing (from below): 0,1,..,kNSubWing-1, -// upper wing (from up): kNSubWing, ... , 2*kNSubWing-1 -// 2nd column -// bottom wing (from below): 2*kNSubWing, .. , 3*kNSubWing-1 -// upper wing (from up): 3*kNSubWing, ... ,4*kNSubWing-1 -// ... -// 4nd (last) column : -// bottom wing (from below): 6*kNSubWing, .. , 7*kNSubWing-1 -// upper wing (from up): 7*kNSubWing, ... ,8*kNSubWing-1 -// -// E.g. kNSubWing=2. +// If subwing division has been applied, then you count as in the schemes below +// E.g. kNSubWing=2. (It was much simpler with old AliITSsegmentation numbering!) // // ^x_loc (cm) // | // _________________________|__________________________ 3.5085 // | | | | | -// | key=2 | key=6 | key=10 | key=14 | -// |____________|____________|____________|____________| +// | key=0 | key=4 | key=8 | key=12 | +// |____________|____________|____________|____________| 1.75425 // | | | | | -// | key=3 | key=7 | key=11 | key=15 | +// | key=1 | key=5 | key=9 | key=13 | // |____________|____________|____________|____________|_0_____\ local z (cm) // | | | | | / -// | key=1 | key=5 | key=9 | key=13 | -// |____________|____________|____________|____________| +// | key=15 | key=11 | key=7 | key=3 | +// |____________|____________|____________|____________| -1.75425 // | | | | | -// | key=0 | key=4 | key=8 | key=12 | +// | key=14 | key=10 | key=6 | key=2 | // |____________|____________|____________|____________| -3.5085 //-3.7632 -1.8816 0 1.1186 3.7632 // +// E.g. kNSubWing=3 +// ^x_loc (cm) +// | +// _________________________|__________________________ 3.5085 +// | 0 | 6 | 12 | 18 | +// |____________|____________|____________|____________| 2.339 +// | 1 | 7 | 13 | 19 | +// |____________|____________|____________|____________| 1.1695 +// | 2 | 8 | 14 | 20 | +// |____________|____________|____________|____________|_0_____\ local z (cm) +// | 23 | 17 | 11 | 5 | / +// |____________|____________|____________|____________| -1.1695 +// | key=22 | key=16 | key=10 | key=4 | +// |____________|____________|____________|____________| -2.339 +// | 21 | 15 | 9 | 3 | +// |____________|____________|____________|____________| -3.5085 +//-3.7632 -1.8816 0 1.1186 3.7632 //___________________________________________________________________________ // UInt_t key=999999; @@ -576,9 +649,9 @@ return key; //_____________________________________________________________________________ void AliITSPlaneEffSDD::ChipAndWingAndSubWingFromLocCoor(Float_t xloc, Float_t zloc, UInt_t& chip, UInt_t& wing, UInt_t& subw) const { -AliITSgeom* geom=NULL; +//AliITSgeom* geom=NULL; //AliITSsegmentationSDD* sdd=new AliITSsegmentationSDD(geom); -AliITSsegmentationSDD sdd=AliITSsegmentationSDD(geom); +AliITSsegmentationSDD sdd; sdd.SetDriftSpeed(sdd.GetDriftSpeed()); // this only for setting fSetDriftSpeed=kTRUE !!! Int_t ix,iz; Int_t ntb; @@ -598,7 +671,7 @@ if(sdd.LocalToDet(xloc,zloc,ix,iz)) { wing=99; subw=9; } -delete geom; +//delete geom; } //__________________________________________________________________________________ UInt_t AliITSPlaneEffSDD::SubWingFromTimeBin(const Int_t tb, const Int_t ntb) const { @@ -628,13 +701,13 @@ Bool_t AliITSPlaneEffSDD::GetBlockBoundaries(const UInt_t key, Float_t& xmn,Floa // ^x_loc (cm) // for all: subw=0 | // _________________________|__________________________ 3.5085 -// | wing=1 | wing=1 | wing=1 | wing=1 | -// | chip=0 | chip=1 | chip=2 | chip=3 | -// | key=1 | key=3 | key=5 | key=7 | -// |____________|____________|____________|____________|_0_____\ local z (cm) -// | wing=0 | wing=0 | wing=0 | wing=0 | / +// | wing=0 | wing=0 | wing=0 | wing=0 | // | chip=0 | chip=1 | chip=2 | chip=3 | // | key=0 | key=2 | key=4 | key=6 | +// |____________|____________|____________|____________|_0_____\ local z (cm) +// | wing=1 | wing=1 | wing=1 | wing=1 | / +// | chip=3 | chip=2 | chip=1 | chip=0 | +// | key=7 | key=5 | key=3 | key=1 | // |____________|____________|____________|____________| -3.5085 //-3.7632 -1.8816 0 1.1186 3.7632 // @@ -643,37 +716,39 @@ Bool_t AliITSPlaneEffSDD::GetBlockBoundaries(const UInt_t key, Float_t& xmn,Floa // | // _________________________|__________________________ 3.5085 // | chip=0 | chip=1 | chip=2 | chip=3 | -// | key=2 | key=6 | key=10 | key=14 | subw=0 -// |____________|____________|____________|____________| wing=1 +// | key=0 | key=4 | key=8 | key=12 | subw=0 +// |____________|____________|____________|____________| wing=0 // | chip=0 | chip=1 | chip=2 | chip=3 | subw=1 -// | key=3 | key=7 | key=11 | key=15 | +// | key=1 | key=5 | key=9 | key=13 | // |____________|____________|____________|____________|_0________\ local z (cm) -// | chip=0 | chip=1 | chip=2 | chip=3 | / -// | key=1 | key=5 | key=9 | key=13 | subw=1 -// |____________|____________|____________|____________| wing=0 -// | chip=0 | chip=1 | chip=2 | chip=3 | subw=0 -// | key=0 | key=4 | key=8 | key=12 | +// | chip=3 | chip=2 | chip=1 | chip=0 | / +// | key=15 | key=11 | key=7 | key=3 | subw=1 +// |____________|____________|____________|____________| wing=1 +// | chip=3 | chip=2 | chip=1 | chip=0 | subw=0 +// | key=14 | key=10 | key=6 | key=2 | // |____________|____________|____________|____________| -3.5085 //-3.7632 -1.8816 0 1.1186 3.7632 // if(key>=kNModule*kNChip*kNWing*kNSubWing) {AliWarning("GetBlockBoundaries: you asked for a non existing key"); return kFALSE;} -// +// as it is now it is consistent with new AliITSsegmentationSDD numbering ! const Float_t kDxDefault = 35085.; // For Plane Eff. purpouses, default values const Float_t kDzDefault = 75264.; // are precise enough !!! const Float_t kconv = 1.0E-04; //converts microns to cm. UInt_t chip=GetChipFromKey(key); UInt_t wing=GetWingFromKey(key); UInt_t subw=GetSubWingFromKey(key); -zmn=kconv*(kDzDefault/kNChip*chip-0.5*kDzDefault); -zmx=kconv*(kDzDefault/kNChip*(chip+1)-0.5*kDzDefault); -if(wing==0) { // count from below -xmn=kconv*(kDxDefault/kNSubWing*subw-kDxDefault); -xmx=kconv*(kDxDefault/kNSubWing*(subw+1)-kDxDefault); +if(wing==1) { // count x from below, z from right + xmn=kconv*(kDxDefault/kNSubWing*subw-kDxDefault); + xmx=kconv*(kDxDefault/kNSubWing*(subw+1)-kDxDefault); + zmn=kconv*(kDzDefault*0.5-kDzDefault/kNChip*(chip+1)); + zmx=kconv*(kDzDefault*0.5-kDzDefault/kNChip*chip); } -else if(wing==1) { // count from top -xmx=kconv*(kDxDefault-kDxDefault/kNSubWing*subw); -xmn=kconv*(kDxDefault-kDxDefault/kNSubWing*(subw+1)); +else if(wing==0) { // count x from top, z from left + xmx=kconv*(kDxDefault-kDxDefault/kNSubWing*subw); + xmn=kconv*(kDxDefault-kDxDefault/kNSubWing*(subw+1)); + zmn=kconv*(kDzDefault/kNChip*chip-0.5*kDzDefault); + zmx=kconv*(kDzDefault/kNChip*(chip+1)-0.5*kDzDefault); } else {AliError("GetBlockBoundaries: you got wrong n. of wing"); return kFALSE;} return kTRUE; @@ -686,42 +761,55 @@ void AliITSPlaneEffSDD::InitHistos() { TString histnameResZ="HistResZ_mod_"; TString histnameResXZ="HistResXZ_mod_"; TString histnameClusterType="HistClusterType_mod_"; - TString histnameResXclu="HistResX_mod_"; +// TString histnameResXclu="HistResX_mod_"; + TString profnameResXvsCluSizeX="ProfResXvsCluSizeX_mod_"; TString histnameResZclu="HistResZ_mod_"; TString profnameResXvsX="ProfResXvsX_mod_"; TString profnameResZvsX="ProfResZvsX_mod_"; TString profnameClustSizeXvsX="ProfClustSizeXvsX_mod_"; TString profnameClustSizeZvsX="ProfClustSizeZvsX_mod_"; + TString histnameTrackErrX="HistTrackErrX_mod_"; + TString histnameTrackErrZ="HistTrackErrZ_mod_"; + TString histnameClusErrX="HistClusErrX_mod_"; + TString histnameClusErrZ="HistClusErrZ_mod_"; // + + TH1::AddDirectory(kFALSE); + fHisResX=new TH1F*[kNHisto]; fHisResZ=new TH1F*[kNHisto]; fHisResXZ=new TH2F*[kNHisto]; fHisClusterSize=new TH2I*[kNHisto]; - fHisResXclu=new TH1F**[kNHisto]; + fProfResXvsCluSizeX=new TProfile*[kNHisto]; + //fHisResXclu=new TH1F**[kNHisto]; fHisResZclu=new TH1F**[kNHisto]; fProfResXvsX=new TProfile*[kNHisto]; fProfResZvsX=new TProfile*[kNHisto]; fProfClustSizeXvsX=new TProfile*[kNHisto]; fProfClustSizeZvsX=new TProfile*[kNHisto]; + fHisTrackErrX=new TH1F*[kNHisto]; + fHisTrackErrZ=new TH1F*[kNHisto]; + fHisClusErrX=new TH1F*[kNHisto]; + fHisClusErrZ=new TH1F*[kNHisto]; for (Int_t nhist=0;nhistSetName(aux.Data()); fHisResX[nhist]->SetTitle(aux.Data()); aux=histnameResZ; aux+=nhist; - fHisResZ[nhist]=new TH1F("histname","histname",500,-0.05,0.05); // +-500 micron; 1 bin=2 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.1,0.1,30,-0.03,0.03); // binning: - // 40 micron in x; - // 20 micron in z; + 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()); fHisResXZ[nhist]->SetTitle(aux.Data()); @@ -731,55 +819,89 @@ void AliITSPlaneEffSDD::InitHistos() { fHisClusterSize[nhist]->SetName(aux.Data()); fHisClusterSize[nhist]->SetTitle(aux.Data()); - fHisResXclu[nhist]=new TH1F*[kNclu]; + aux=profnameResXvsCluSizeX; + aux+=nhist; + fProfResXvsCluSizeX[nhist]=new TProfile("histname","histname",10,0.5,10.5); + fProfResXvsCluSizeX[nhist]->SetName(aux.Data()); + fProfResXvsCluSizeX[nhist]->SetTitle(aux.Data()); + +// fHisResXclu[nhist]=new TH1F*[kNclu]; fHisResZclu[nhist]=new TH1F*[kNclu]; for(Int_t clu=0; clu cluster size 1 - aux=histnameResXclu; + /*aux=histnameResXclu; aux+=nhist; aux+="_clu_"; aux+=clu+1; // clu=0 --> cluster size 1 fHisResXclu[nhist][clu]=new TH1F("histname","histname",1500,-0.15,0.15);// +- 1500 micron; 1 bin=2 micron fHisResXclu[nhist][clu]->SetName(aux.Data()); - fHisResXclu[nhist][clu]->SetTitle(aux.Data()); + fHisResXclu[nhist][clu]->SetTitle(aux.Data());*/ aux=histnameResZclu; aux+=nhist; aux+="_clu_"; aux+=clu+1; // clu=0 --> cluster size 1 - fHisResZclu[nhist][clu]=new TH1F("histname","histname",500,-0.05,0.05); // +-500 micron; 1 bin=2 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=profnameResXvsX; aux+=nhist; - fProfResXvsX[nhist]=new TProfile("histname","histname",140,-3.5,-3.5); + fProfResXvsX[nhist]=new TProfile("histname","histname",140,-3.5,3.5); fProfResXvsX[nhist]->SetName(aux.Data()); fProfResXvsX[nhist]->SetTitle(aux.Data()); aux=profnameResZvsX; aux+=nhist; - fProfResZvsX[nhist]=new TProfile("histname","histname",140,-3.5,-3.5); + fProfResZvsX[nhist]=new TProfile("histname","histname",140,-3.5,3.5); fProfResZvsX[nhist]->SetName(aux.Data()); fProfResZvsX[nhist]->SetTitle(aux.Data()); aux=profnameClustSizeXvsX; aux+=nhist; - fProfClustSizeXvsX[nhist]=new TProfile("histname","histname",140,-3.5,-3.5); + fProfClustSizeXvsX[nhist]=new TProfile("histname","histname",140,-3.5,3.5); fProfClustSizeXvsX[nhist]->SetName(aux.Data()); fProfClustSizeXvsX[nhist]->SetTitle(aux.Data()); aux=profnameClustSizeZvsX; aux+=nhist; - fProfClustSizeZvsX[nhist]=new TProfile("histname","histname",140,-3.5,-3.5); + fProfClustSizeZvsX[nhist]=new TProfile("histname","histname",140,-3.5,3.5); fProfClustSizeZvsX[nhist]->SetName(aux.Data()); fProfClustSizeZvsX[nhist]->SetTitle(aux.Data()); + aux=histnameTrackErrX; + aux+=nhist; + 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=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.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",400,0.,0.32); // 0-3200 micron; 1 bin=8 micron + fHisClusErrZ[nhist]->SetName(aux.Data()); + fHisClusErrZ[nhist]->SetTitle(aux.Data()); + } + + TH1::AddDirectory(kTRUE); + return; } //__________________________________________________________ void AliITSPlaneEffSDD::DeleteHistos() { + // delete the histograms and clean the memory if(fHisResX) { for (Int_t i=0; i=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); - fProfResXvsX[id]->Fill(cXZ[0],resx); - fProfResZvsX[id]->Fill(cXZ[0],resz); - fProfClustSizeXvsX[id]->Fill(cXZ[0],(Double_t)ctXZ[0]); - fProfClustSizeZvsX[id]->Fill(cXZ[0],(Double_t)ctXZ[1]); + fHisClusterSize[id]->Fill((Double_t)csize[0],(Double_t)csize[1]); + fProfResXvsCluSizeX[id]->Fill((Double_t)csize[0],resx); + //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); + fProfResXvsX[id]->Fill(clu[0],resx); + fProfResZvsX[id]->Fill(clu[0],resz); + fProfClustSizeXvsX[id]->Fill(clu[0],(Double_t)csize[0]); + fProfClustSizeZvsX[id]->Fill(clu[0],(Double_t)csize[1]); } + fHisTrackErrX[id]->Fill(tr[2]); + fHisTrackErrZ[id]->Fill(tr[3]); + fHisClusErrX[id]->Fill(clu[2]); + fHisClusErrZ[id]->Fill(clu[3]); return kTRUE; } //__________________________________________________________ @@ -874,62 +1023,80 @@ Bool_t AliITSPlaneEffSDD::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 *SDDTree=new TTree("SDDTree","Tree whith Residuals and Cluster Type distributions for SDD"); TH1F *histZ,*histX; TH2F *histXZ; TH2I *histClusterType; - TH1F *histXclu[kNclu]; + TProfile *profileResXvsCluSizeX; + //TH1F *histXclu[kNclu]; TH1F *histZclu[kNclu]; TProfile *profileResXvsX, *profileResZvsX, *profileClSizXvsX, *profileClSizZvsX; + TH1F *histTrErrZ,*histTrErrX; + TH1F *histClErrZ,*histClErrX; histZ=new TH1F(); histX=new TH1F(); histXZ=new TH2F(); histClusterType=new TH2I(); + profileResXvsCluSizeX=new TProfile(); for(Int_t clu=0;cluBranch("histX","TH1F",&histX,128000,0); SDDTree->Branch("histZ","TH1F",&histZ,128000,0); SDDTree->Branch("histXZ","TH2F",&histXZ,128000,0); SDDTree->Branch("histClusterType","TH2I",&histClusterType,128000,0); + SDDTree->Branch("profileResXvsCluSizeX","TProfile",&profileResXvsCluSizeX,128000,0); for(Int_t clu=0;cluBranch(branchname,"TH1F",&histXclu[clu],128000,0); - sprintf(branchname,"histZclu_%d",clu+1); + //snprintf(branchname,50,"histXclu_%d",clu+1); + //SDDTree->Branch(branchname,"TH1F",&histXclu[clu],128000,0); + snprintf(branchname,50,"histZclu_%d",clu+1); SDDTree->Branch(branchname,"TH1F",&histZclu[clu],128000,0); } SDDTree->Branch("profileResXvsX","TProfile",&profileResXvsX,128000,0); SDDTree->Branch("profileResZvsX","TProfile",&profileResZvsX,128000,0); SDDTree->Branch("profileClSizXvsX","TProfile",&profileClSizXvsX,128000,0); SDDTree->Branch("profileClSizZvsX","TProfile",&profileClSizZvsX,128000,0); + SDDTree->Branch("histTrErrX","TH1F",&histTrErrX,128000,0); + SDDTree->Branch("histTrErrZ","TH1F",&histTrErrZ,128000,0); + SDDTree->Branch("histClErrX","TH1F",&histClErrX,128000,0); + SDDTree->Branch("histClErrZ","TH1F",&histClErrZ,128000,0); for(Int_t j=0;jFill(); } @@ -943,11 +1110,11 @@ Bool_t AliITSPlaneEffSDD::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; @@ -967,18 +1134,23 @@ Bool_t AliITSPlaneEffSDD::ReadHistosFromFile(TString filename) { TBranch *histZ = (TBranch*) tree->GetBranch("histZ"); TBranch *histXZ = (TBranch*) tree->GetBranch("histXZ"); TBranch *histClusterType = (TBranch*) tree->GetBranch("histClusterType"); - - TBranch *histXclu[kNclu], *histZclu[kNclu]; + TBranch *profileResXvsCluSizeX = (TBranch*) tree->GetBranch("profileResXvsCluSizeX"); + //TBranch *histXclu[kNclu], *histZclu[kNclu]; + TBranch *histZclu[kNclu]; for(Int_t clu=0; cluGetBranch(branchname); - sprintf(branchname,"histZclu_%d",clu+1); + //snprintf(branchname,50,"histXclu_%d",clu+1); + //histXclu[clu]= (TBranch*) tree->GetBranch(branchname); + snprintf(branchname,50,"histZclu_%d",clu+1); histZclu[clu]= (TBranch*) tree->GetBranch(branchname); } TBranch *profileResXvsX = (TBranch*) tree->GetBranch("profileResXvsX"); TBranch *profileResZvsX = (TBranch*) tree->GetBranch("profileResZvsX"); TBranch *profileClSizXvsX = (TBranch*) tree->GetBranch("profileClSizXvsX"); TBranch *profileClSizZvsX = (TBranch*) tree->GetBranch("profileClSizZvsX"); + TBranch *histTrErrX = (TBranch*) tree->GetBranch("histTrErrX"); + TBranch *histTrErrZ = (TBranch*) tree->GetBranch("histTrErrZ"); + TBranch *histClErrX = (TBranch*) tree->GetBranch("histClErrX"); + TBranch *histClErrZ = (TBranch*) tree->GetBranch("histClErrZ"); gROOT->cd(); @@ -987,7 +1159,6 @@ Bool_t AliITSPlaneEffSDD::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); } @@ -997,7 +1168,6 @@ Bool_t AliITSPlaneEffSDD::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); } @@ -1007,7 +1177,6 @@ Bool_t AliITSPlaneEffSDD::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); } @@ -1017,29 +1186,35 @@ Bool_t AliITSPlaneEffSDD::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); } + nevent = (Int_t)profileResXvsCluSizeX->GetEntries(); + if(nevent!=kNHisto) + {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} + profileResXvsCluSizeX->SetAddress(&p); + for(Int_t j=0;jGetEntry(j); + fProfResXvsCluSizeX[j]->Add(p); + } + for(Int_t clu=0; cluGetEntries(); + /*nevent = (Int_t)histXclu[clu]->GetEntries(); if(nevent!=kNHisto) {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); - } + }*/ nevent = (Int_t)histZclu[clu]->GetEntries(); if(nevent!=kNHisto) {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); } @@ -1050,7 +1225,6 @@ Bool_t AliITSPlaneEffSDD::ReadHistosFromFile(TString filename) { {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} profileResXvsX->SetAddress(&p); for(Int_t j=0;jGetEntry(j); fProfResXvsX[j]->Add(p); } @@ -1060,7 +1234,6 @@ Bool_t AliITSPlaneEffSDD::ReadHistosFromFile(TString filename) { {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} profileResZvsX->SetAddress(&p); for(Int_t j=0;jGetEntry(j); fProfResZvsX[j]->Add(p); } @@ -1070,7 +1243,6 @@ Bool_t AliITSPlaneEffSDD::ReadHistosFromFile(TString filename) { {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} profileClSizXvsX->SetAddress(&p); for(Int_t j=0;jGetEntry(j); fProfClustSizeXvsX[j]->Add(p); } @@ -1080,19 +1252,54 @@ Bool_t AliITSPlaneEffSDD::ReadHistosFromFile(TString filename) { {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} profileClSizZvsX->SetAddress(&p); for(Int_t j=0;jGetEntry(j); fProfClustSizeZvsX[j]->Add(p); } - delete h; h=0; - delete h2; h2=0; - delete h2i; h2i=0; - delete p; p=0; + 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); + } + + delete h; + delete h2; + delete h2i; + delete p; if (file) { file->Close(); + delete file; } return kTRUE; } -