From: prsnko Date: Tue, 15 Jan 2008 20:09:23 +0000 (+0000) Subject: Moved calibration and cleaning to RawDigiProducer X-Git-Url: http://git.uio.no/git/?a=commitdiff_plain;h=a28333c5a135d415fb2f965b830e74987a56fe2f;p=u%2Fmrichter%2FAliRoot.git Moved calibration and cleaning to RawDigiProducer --- diff --git a/PHOS/AliPHOSClusterizerv1.cxx b/PHOS/AliPHOSClusterizerv1.cxx index 086f09db0c8..c3fcae52557 100644 --- a/PHOS/AliPHOSClusterizerv1.cxx +++ b/PHOS/AliPHOSClusterizerv1.cxx @@ -17,7 +17,10 @@ /* History of cvs commits: * - * $Log$ + * $Log: AliPHOSClusterizerv1.cxx,v $ + * Revision 1.118 2007/12/11 21:23:26 kharlov + * Added possibility to swith off unfolding + * * Revision 1.117 2007/10/18 08:42:05 kharlov * Bad channels cleaned before clusterization * @@ -182,8 +185,8 @@ #include "AliCDBStorage.h" #include "AliCDBEntry.h" #include "AliPHOSRecoParam.h" -#include "AliPHOSCalibData.h" #include "AliPHOSReconstructor.h" +#include "AliPHOSCalibData.h" ClassImp(AliPHOSClusterizerv1) @@ -192,12 +195,9 @@ AliPHOSClusterizerv1::AliPHOSClusterizerv1() : AliPHOSClusterizer(), fDefaultInit(0), fEmcCrystals(0), fToUnfold(0), fWrite(0), fNumberOfEmcClusters(0), fNumberOfCpvClusters(0), - fADCchanelEmc(0), fADCpedestalEmc(0), - fADCchanelCpv(0), fADCpedestalCpv(0), fEmcClusteringThreshold(0), - fCpvClusteringThreshold(0), fEmcMinE(0), fCpvMinE(0), + fEmcClusteringThreshold(0), fCpvClusteringThreshold(0), fEmcLocMaxCut(0), fW0(0), fCpvLocMaxCut(0), - fW0CPV(0), fEmcTimeGate(0), - fIsOldRCUFormat(0) + fW0CPV(0), fEmcTimeGate(0) { // default ctor (to be used mainly by Streamer) @@ -210,12 +210,9 @@ AliPHOSClusterizerv1::AliPHOSClusterizerv1(AliPHOSGeometry *geom) : AliPHOSClusterizer(geom), fDefaultInit(0), fEmcCrystals(0), fToUnfold(0), fWrite(0), fNumberOfEmcClusters(0), fNumberOfCpvClusters(0), - fADCchanelEmc(0), fADCpedestalEmc(0), - fADCchanelCpv(0), fADCpedestalCpv(0), fEmcClusteringThreshold(0), - fCpvClusteringThreshold(0), fEmcMinE(0), fCpvMinE(0), + fEmcClusteringThreshold(0), fCpvClusteringThreshold(0), fEmcLocMaxCut(0), fW0(0), fCpvLocMaxCut(0), - fW0CPV(0), fEmcTimeGate(0), - fIsOldRCUFormat(0) + fW0CPV(0), fEmcTimeGate(0) { // ctor with the indication of the file where header Tree and digits Tree are stored @@ -230,58 +227,6 @@ AliPHOSClusterizerv1::AliPHOSClusterizerv1(AliPHOSGeometry *geom) : // dtor } - -//____________________________________________________________________________ -Float_t AliPHOSClusterizerv1::CalibrateEMC(Float_t amp, Int_t absId) -{ - // Convert EMC measured amplitude into real energy. - // Calibration parameters are taken from calibration data base for raw data, - // or from digitizer parameters for simulated data. - - if(fgCalibData){ - Int_t relId[4]; - fGeom->AbsToRelNumbering(absId,relId) ; - Int_t module = relId[0]; - Int_t column = relId[3]; - Int_t row = relId[2]; - if(absId <= fEmcCrystals) { // this is EMC - fADCchanelEmc = fgCalibData->GetADCchannelEmc (module,column,row); - return amp*fADCchanelEmc ; - } - } - else{ //simulation - if(absId <= fEmcCrystals) // this is EMC - return fADCpedestalEmc + amp*fADCchanelEmc ; - } - return 0; -} - -//____________________________________________________________________________ -Float_t AliPHOSClusterizerv1::CalibrateCPV(Int_t amp, Int_t absId) -{ - // Convert digitized CPV amplitude into charge. - // Calibration parameters are taken from calibration data base for raw data, - // or from digitizer parameters for simulated data. - - if(fgCalibData){ - Int_t relId[4]; - fGeom->AbsToRelNumbering(absId,relId) ; - Int_t module = relId[0]; - Int_t column = relId[3]; - Int_t row = relId[2]; - if(absId > fEmcCrystals) { // this is CPV - fADCchanelCpv = fgCalibData->GetADCchannelCpv (module,column,row); - fADCpedestalCpv = fgCalibData->GetADCpedestalCpv(module,column,row); - return fADCpedestalCpv + amp*fADCchanelCpv ; - } - } - else{ //simulation - if(absId > fEmcCrystals) // this is CPV - return fADCpedestalCpv+ amp*fADCchanelCpv ; - } - return 0; -} - //____________________________________________________________________________ void AliPHOSClusterizerv1::Digits2Clusters(Option_t *option) { @@ -408,24 +353,6 @@ Bool_t AliPHOSClusterizerv1::FindFit(AliPHOSEmcRecPoint * emcRP, AliPHOSDigit ** } -//____________________________________________________________________________ -void AliPHOSClusterizerv1::GetCalibrationParameters() -{ - // Set calibration parameters: - // if calibration database exists, they are read from database, - // otherwise, reconstruction stops in the constructor of AliPHOSCalibData - // - // It is a user responsilibity to open CDB before reconstruction, for example: - // AliCDBStorage* storage = AliCDBManager::Instance()->GetStorage("local://CalibDB"); - - if (!fgCalibData) - fgCalibData = new AliPHOSCalibData(-1); //use AliCDBManager's run number - if (fgCalibData->GetCalibDataEmc() == 0) - AliFatal("Calibration parameters for PHOS EMC not found. Stop reconstruction.\n"); - if (fgCalibData->GetCalibDataCpv() == 0) - AliFatal("Calibration parameters for PHOS CPV not found. Stop reconstruction.\n"); - -} //____________________________________________________________________________ void AliPHOSClusterizerv1::Init() @@ -438,7 +365,10 @@ void AliPHOSClusterizerv1::Init() if(!gMinuit) gMinuit = new TMinuit(100); - GetCalibrationParameters() ; + if (!fgCalibData) + fgCalibData = new AliPHOSCalibData(-1); //use AliCDBManager's run number + if (fgCalibData->GetCalibDataEmc() == 0) + AliFatal("Calibration parameters for PHOS EMC not found. Stop reconstruction.\n"); } @@ -461,9 +391,6 @@ void AliPHOSClusterizerv1::InitParameters() fEmcLocMaxCut = parEmc->GetLocalMaxCut(); fCpvLocMaxCut = parCpv->GetLocalMaxCut(); - fEmcMinE = parEmc->GetMinE(); - fCpvMinE = parCpv->GetMinE(); - fW0 = parEmc->GetLogWeight(); fW0CPV = parCpv->GetLogWeight(); @@ -472,8 +399,6 @@ void AliPHOSClusterizerv1::InitParameters() fToUnfold = parEmc->ToUnfold() ; fWrite = kTRUE ; - - fIsOldRCUFormat = kFALSE; } //____________________________________________________________________________ @@ -518,41 +443,6 @@ Int_t AliPHOSClusterizerv1::AreNeighbours(AliPHOSDigit * d1, AliPHOSDigit * d2)c return rv ; } -//____________________________________________________________________________ -void AliPHOSClusterizerv1::CleanDigits(TClonesArray * digits) -{ - // Remove digits with amplitudes below threshold. - // remove digits in bad channels - - Bool_t isBadMap = 0 ; - if(fgCalibData->GetNumOfEmcBadChannels()){ - isBadMap=1 ; - } - - Int_t inBadList=0 ; - for(Int_t i=0; iGetEntriesFast(); i++){ - AliPHOSDigit * digit = static_cast(digits->At(i)) ; - if ( (IsInEmc(digit) && CalibrateEMC(digit->GetEnergy(),digit->GetId()) < fEmcMinE) || - (IsInCpv(digit) && CalibrateCPV(digit->GetAmp() ,digit->GetId()) < fCpvMinE) ){ - digits->RemoveAt(i) ; - continue ; - } - if(isBadMap){ //check bad map now - Int_t relid[4] ; - fGeom->AbsToRelNumbering(digit->GetId(), relid) ; - if(fgCalibData->IsBadChannelEmc(relid[0],relid[2],relid[3])){ - digits->RemoveAt(i) ; - } - } - } - - digits->Compress() ; - for (Int_t i = 0 ; i < digits->GetEntriesFast() ; i++) { - AliPHOSDigit *digit = static_cast( digits->At(i) ) ; - digit->SetIndexInList(i) ; - } -} - //____________________________________________________________________________ Bool_t AliPHOSClusterizerv1::IsInEmc(AliPHOSDigit * digit) const { @@ -591,10 +481,11 @@ void AliPHOSClusterizerv1::WriteRecPoints() Int_t index ; //Evaluate position, dispersion and other RecPoint properties.. Int_t nEmc = fEMCRecPoints->GetEntriesFast(); + Float_t emcMinE= AliPHOSReconstructor::GetRecoParamEmc()->GetMinE(); //Minimal digit energy for(index = 0; index < nEmc; index++){ AliPHOSEmcRecPoint * rp = dynamic_cast( fEMCRecPoints->At(index) ); - rp->Purify(fEmcMinE) ; + rp->Purify(emcMinE) ; if(rp->GetMultiplicity()==0){ fEMCRecPoints->RemoveAt(index) ; delete rp ; @@ -641,9 +532,6 @@ void AliPHOSClusterizerv1::MakeClusters() // Steering method to construct the clusters stored in a list of Reconstructed Points // A cluster is defined as a list of neighbour digits - //Remove digits below threshold - CleanDigits(fDigitsArr) ; - TClonesArray * digitsC = static_cast( fDigitsArr->Clone() ) ; // Clusterization starts @@ -660,10 +548,8 @@ void AliPHOSClusterizerv1::MakeClusters() TArrayI clusterdigitslist(1500) ; Int_t index ; - if (( IsInEmc (digit) && - CalibrateEMC(digit->GetEnergy(),digit->GetId()) > fEmcClusteringThreshold ) || - ( IsInCpv (digit) && - CalibrateCPV(digit->GetAmp() ,digit->GetId()) > fCpvClusteringThreshold ) ) { + if (( IsInEmc(digit) && digit->GetEnergy() > fEmcClusteringThreshold ) || + ( IsInCpv(digit) && digit->GetEnergy() > fCpvClusteringThreshold ) ) { Int_t iDigitInCluster = 0 ; if ( IsInEmc(digit) ) { @@ -674,7 +560,7 @@ void AliPHOSClusterizerv1::MakeClusters() fEMCRecPoints->AddAt(new AliPHOSEmcRecPoint(""), fNumberOfEmcClusters) ; clu = dynamic_cast( fEMCRecPoints->At(fNumberOfEmcClusters) ) ; fNumberOfEmcClusters++ ; - clu->AddDigit(*digit, CalibrateEMC(digit->GetEnergy(),digit->GetId())) ; + clu->AddDigit(*digit, digit->GetEnergy()) ; clusterdigitslist[iDigitInCluster] = digit->GetIndexInList() ; iDigitInCluster++ ; digitsC->Remove(digit) ; @@ -689,7 +575,7 @@ void AliPHOSClusterizerv1::MakeClusters() clu = dynamic_cast( fCPVRecPoints->At(fNumberOfCpvClusters) ) ; fNumberOfCpvClusters++ ; - clu->AddDigit(*digit, CalibrateCPV(digit->GetAmp(),digit->GetId()) ) ; + clu->AddDigit(*digit, digit->GetEnergy()) ; clusterdigitslist[iDigitInCluster] = digit->GetIndexInList() ; iDigitInCluster++ ; digitsC->Remove(digit) ; @@ -722,11 +608,7 @@ void AliPHOSClusterizerv1::MakeClusters() case 0 : // not a neighbour break ; case 1 : // are neighbours - if (IsInEmc (digitN)) - clu->AddDigit(*digitN, CalibrateEMC( digitN->GetEnergy(), digitN->GetId() ) ); - else - clu->AddDigit(*digitN, CalibrateCPV( digitN->GetAmp() , digitN->GetId() ) ); - + clu->AddDigit(*digitN, digitN->GetEnergy()); clusterdigitslist[iDigitInCluster] = digitN->GetIndexInList() ; iDigitInCluster++ ; digitsC->Remove(digitN) ; @@ -777,6 +659,7 @@ void AliPHOSClusterizerv1::MakeUnfolding() if( nMax > 1 ) { // if cluster is very flat (no pronounced maximum) then nMax = 0 UnfoldCluster(emcRecPoint, nMax, maxAt, maxAtEnergy) ; + fEMCRecPoints->Remove(emcRecPoint); fEMCRecPoints->Compress() ; index-- ; @@ -859,6 +742,7 @@ void AliPHOSClusterizerv1::UnfoldCluster(AliPHOSEmcRecPoint * iniEmc, Float_t * fitparameters = new Float_t[nPar] ; Bool_t rv = FindFit(iniEmc, maxAt, maxAtEnergy, nPar, fitparameters) ; + if( !rv ) { // Fit failed, return and remove cluster iniEmc->SetNExMax(-1) ; @@ -900,7 +784,6 @@ void AliPHOSClusterizerv1::UnfoldCluster(AliPHOSEmcRecPoint * iniEmc, } } - // Now create new RecPoints and fill energy lists with efit corrected to fluctuations // so that energy deposited in each cell is distributed betwin new clusters proportionally // to its contribution to efit @@ -915,7 +798,7 @@ void AliPHOSClusterizerv1::UnfoldCluster(AliPHOSEmcRecPoint * iniEmc, epar = fitparameters[iparam+2] ; iparam += 3 ; // fGeom->GetIncidentVector(fVtx,iniEmc->GetPHOSMod(),xpar,zpar,vIncid) ; - + AliPHOSEmcRecPoint * emcRP = 0 ; if(iniEmc->IsEmc()){ //create new entries in fEMCRecPoints... diff --git a/PHOS/AliPHOSClusterizerv1.h b/PHOS/AliPHOSClusterizerv1.h index 9f9406fe043..05207a9e1ab 100644 --- a/PHOS/AliPHOSClusterizerv1.h +++ b/PHOS/AliPHOSClusterizerv1.h @@ -7,7 +7,10 @@ /* History of cvs commits: * - * $Log$ + * $Log: AliPHOSClusterizerv1.h,v $ + * Revision 1.54 2007/10/01 20:24:08 kharlov + * Memory leaks fixed + * * Revision 1.53 2007/08/28 12:55:07 policheh * Loaders removed from the reconstruction code (C.Cheshkov) * @@ -76,9 +79,6 @@ public: virtual Int_t AreNeighbours(AliPHOSDigit * d1, AliPHOSDigit * d2)const ; // Checks if digits are in neighbour cells - virtual Float_t CalibrateCPV(Int_t amp, Int_t absId) ; // Tranforms CPV Amp to energy - virtual Float_t CalibrateEMC(Float_t amp, Int_t absId) ; // Tranforms EMC Amp to energy - virtual void GetNumberOfClustersFound(int * numb )const{ numb[0] = fNumberOfEmcClusters ; numb[1] = fNumberOfCpvClusters ; } @@ -95,8 +95,6 @@ public: void Print(const Option_t * = "")const ; - void SetEmcMinE(Float_t e){fEmcMinE = e ;} - void SetCpvMinE(Float_t e){fCpvMinE = e ;} virtual void SetEmcClusteringThreshold(Float_t cluth) { fEmcClusteringThreshold = cluth ; } virtual void SetEmcLocalMaxCut(Float_t cut) { fEmcLocMaxCut = cut ; } virtual void SetEmcLogWeight(Float_t w) { fW0 = w ; } @@ -114,9 +112,6 @@ public: // void Unload() ; virtual const char * Version() const { return "clu-v1"; } - virtual void SetOldRCUFormat(Bool_t rcuFormat = kFALSE) - { fIsOldRCUFormat = rcuFormat; }; - protected: void WriteRecPoints() ; @@ -124,7 +119,6 @@ protected: virtual Bool_t IsInEmc (AliPHOSDigit * digit)const ; // Tells if id digit is in EMC virtual Bool_t IsInCpv (AliPHOSDigit * digit)const ; // Tells if id digit is in CPV void CleanDigits(TClonesArray * digits) ; - void GetCalibrationParameters(void); void SetDistancesToBadChannels(); private: @@ -152,16 +146,8 @@ private: Int_t fNumberOfEmcClusters ; // number of EMC clusters found Int_t fNumberOfCpvClusters ; // number of CPV clusters found - //Calibration parameters - Float_t fADCchanelEmc ; // width of one ADC channel in GeV - Float_t fADCpedestalEmc ; // - Float_t fADCchanelCpv ; // width of one ADC channel in CPV 'popugais' - Float_t fADCpedestalCpv ; // - Float_t fEmcClusteringThreshold ; // minimum energy to start EMC cluster Float_t fCpvClusteringThreshold ; // minimum energy to start CPV cluster - Float_t fEmcMinE ; // minimum energy of digit to be included into cluster - Float_t fCpvMinE ; // minimum energy of digit to be included into cluster Float_t fEmcLocMaxCut ; // minimum energy difference to distinguish local maxima in a cluster Float_t fW0 ; // logarithmic weight for the cluster center of gravity calculation Float_t fCpvLocMaxCut ; // minimum energy difference to distinguish local maxima in a CPV cluster @@ -169,9 +155,8 @@ private: // Int_t fRecPointsInRun ; //! Total number of recpoints in one run Float_t fEmcTimeGate ; // Maximum time difference between the digits in ont EMC cluster - Bool_t fIsOldRCUFormat; // assume old RCU raw data format - ClassDef(AliPHOSClusterizerv1,5) // Clusterizer implementation version 1 + ClassDef(AliPHOSClusterizerv1,6) // Clusterizer implementation version 1 }; diff --git a/PHOS/AliPHOSDigitizer.cxx b/PHOS/AliPHOSDigitizer.cxx index 86d465962fb..6a1c0b721d7 100644 --- a/PHOS/AliPHOSDigitizer.cxx +++ b/PHOS/AliPHOSDigitizer.cxx @@ -17,7 +17,10 @@ /* History of cvs commits: * - * $Log$ + * $Log: AliPHOSDigitizer.cxx,v $ + * Revision 1.104 2007/12/18 09:08:18 hristov + * Splitting of the QA maker into simulation and reconstruction dependent parts (Yves) + * * Revision 1.103 2007/11/07 11:25:06 schutz * Comment out the QA checking before starting digitization * @@ -515,7 +518,9 @@ void AliPHOSDigitizer::Digitize(Int_t event) //remove digits below thresholds for(i = 0 ; i < nEMC ; i++){ digit = dynamic_cast( digits->At(i) ) ; - DecalibrateEMC(digit); +//By default no decalibration should be applyed +// DecalibrateEMC(digit); + if(digit->GetEnergy() < fEMCDigitThreshold) digits->RemoveAt(i) ; else diff --git a/PHOS/AliPHOSOnlineMonitor.cxx b/PHOS/AliPHOSOnlineMonitor.cxx index d0b8f3c4b5e..cd93d5cf655 100644 --- a/PHOS/AliPHOSOnlineMonitor.cxx +++ b/PHOS/AliPHOSOnlineMonitor.cxx @@ -628,7 +628,7 @@ void AliPHOSOnlineMonitor::Go(){ if(fReconstruct){ //We will need calibation parameters clu = new AliPHOSClusterizerv1(gime->PHOSGeometry()) ; clu->SetWriting(0) ; //Do not write to file - clu->SetEmcMinE(0.05) ; //Minimal energy of the digit +// clu->SetEmcMinE(0.05) ; //Minimal energy of the digit clu->SetEmcLocalMaxCut(0.05) ; //Height of local maximum over environment clu->SetEmcClusteringThreshold(0.2) ; //Minimal energy to start cluster // clu->SetUnfolding(kFALSE) ; //Do not unfold diff --git a/PHOS/AliPHOSRawDecoder.cxx b/PHOS/AliPHOSRawDecoder.cxx index 2f214264de1..b6942da68ec 100644 --- a/PHOS/AliPHOSRawDecoder.cxx +++ b/PHOS/AliPHOSRawDecoder.cxx @@ -172,9 +172,6 @@ Bool_t AliPHOSRawDecoder::NextDigit() else return kFALSE; - if(fLowGainFlag) - fEnergy *= fPulseGenerator->GetRawFormatHighLowGainFactor(); // *16 - if (fEnergy < baseLine) fEnergy = 0; pedMean = 0; diff --git a/PHOS/AliPHOSRawDecoderv1.cxx b/PHOS/AliPHOSRawDecoderv1.cxx index 3488751548d..f773d9e2d71 100644 --- a/PHOS/AliPHOSRawDecoderv1.cxx +++ b/PHOS/AliPHOSRawDecoderv1.cxx @@ -308,8 +308,6 @@ Bool_t AliPHOSRawDecoderv1::NextDigit() fEnergy=0 ; //bad sample fTime=-999.; } - if(fLowGainFlag) - fEnergy *= fPulseGenerator->GetRawFormatHighLowGainFactor(); // *16 fTime*=fPulseGenerator->GetRawFormatTimeTrigger() ; diff --git a/PHOS/AliPHOSRawDecoderv2.cxx b/PHOS/AliPHOSRawDecoderv2.cxx index 8db22e81a8d..52e0b0a1a5a 100644 --- a/PHOS/AliPHOSRawDecoderv2.cxx +++ b/PHOS/AliPHOSRawDecoderv2.cxx @@ -182,17 +182,17 @@ Bool_t AliPHOSRawDecoderv2::NextDigit() fOverflow = kTRUE ; } - if(fOverflow) - return kTRUE ; //do not calculate energy and time for overflowed channels - +// if(fEnergy>1020.){ // printf("fE=%f \n",fEnergy) ; -// if(fEnergy>20.){ // cs->cd() ; // h->Draw() ; // cs->Update() ; // getchar() ; // } + if(fOverflow) + return kTRUE ; //do not calculate energy and time for overflowed channels + if(fEnergyGetRawFormatHighLowGainFactor(); // *16 fTime*=fPulseGenerator->GetRawFormatTimeTrigger() ; diff --git a/PHOS/AliPHOSReconstructor.cxx b/PHOS/AliPHOSReconstructor.cxx index 22568e4f493..0b2f9c72e20 100644 --- a/PHOS/AliPHOSReconstructor.cxx +++ b/PHOS/AliPHOSReconstructor.cxx @@ -374,31 +374,13 @@ void AliPHOSReconstructor::ConvertDigits(AliRawReader* rawReader, TTree* digits Int_t bufsize = 32000; digitsTree->Branch("PHOS", &digits, bufsize); - AliPHOSRawDigiProducer pr; + AliPHOSRawDigiProducer pr(fgkRecoParamEmc,fgkRecoParamCpv); pr.MakeDigits(digits,dc); delete dc ; - //ADC counts -> GeV - for(Int_t i=0; iGetEntries(); i++) { - AliPHOSDigit* digit = (AliPHOSDigit*)digits->At(i); - digit->SetEnergy(digit->GetEnergy()/AliPHOSPulseGenerator::GeV2ADC()); - } - - // Clean up digits below the noise threshold - // Assuming the digit noise to be 4 MeV, we suppress digits within - // 3-sigma of the noise. - // This parameter should be passed via AliPHOSRecoParamEmc later - - const Double_t emcDigitThreshold = 0.012; - for(Int_t i=0; iGetEntries(); i++) { - AliPHOSDigit* digit = (AliPHOSDigit*)digits->At(i); - if(digit->GetEnergy() < emcDigitThreshold) - digits->RemoveAt(i) ; - } - digits->Compress() ; - //!!!!for debug!!! +/* Int_t modMax=-111; Int_t colMax=-111; Int_t rowMax=-111; @@ -419,7 +401,7 @@ void AliPHOSReconstructor::ConvertDigits(AliRawReader* rawReader, TTree* digits AliDebug(1,Form("Digit with max. energy: modMax %d colMax %d rowMax %d eMax %f\n\n", modMax,colMax,rowMax,eMax)); - +*/ digitsTree->Fill(); digits->Delete(); delete digits;