From 493c5a63062341136ca50861bc6f4f11d5339987 Mon Sep 17 00:00:00 2001 From: laphecet Date: Wed, 28 Nov 2012 14:57:23 +0000 Subject: [PATCH] adding histograms to check pedestal data OffLine --- MUON/AliMUONPedestal.cxx | 54 +++++++++++++++++++++++++++++++++------- MUON/AliMUONPedestal.h | 13 ++++++++-- MUON/MUONTRKPEDda.cxx | 15 +++++------ 3 files changed, 64 insertions(+), 18 deletions(-) diff --git a/MUON/AliMUONPedestal.cxx b/MUON/AliMUONPedestal.cxx index 58743e7372f..e1f36440e58 100644 --- a/MUON/AliMUONPedestal.cxx +++ b/MUON/AliMUONPedestal.cxx @@ -66,6 +66,7 @@ fNManu(0), fNManuConfig(0), fConfig(1), fStatusDA(0), +fHistos(0), fErrorBuspatchTable(new AliMUON2DMap(kFALSE)), fManuBuspatchTable(new AliMUON2DMap(kFALSE)), fManuBPoutofconfigTable(new AliMUON2DMap(kFALSE)), @@ -75,7 +76,9 @@ fHistoFileName(), fPedestalStore(new AliMUON2DMap(kTRUE)), fIndex(-1), fPrefixDA(), -fPrefixLDC() +fPrefixLDC(), +fHistoFile(0), +fTree(0) { /// Default constructor } @@ -93,6 +96,7 @@ fNManu(0), fNManuConfig(0), fConfig(1), fStatusDA(0), +fHistos(0), fErrorBuspatchTable(0), fManuBuspatchTable(0), fManuBPoutofconfigTable(0), @@ -102,7 +106,9 @@ fHistoFileName(), fPedestalStore(0), fIndex(-1), fPrefixDA(), -fPrefixLDC() +fPrefixLDC(), +fHistoFile(0), +fTree(0) { /// Root IO constructor } @@ -160,11 +166,29 @@ void AliMUONPedestal::LoadConfig(const char* dbfile) //______________________________________________________________________________ void AliMUONPedestal::MakePed(Int_t busPatchId, Int_t manuId, Int_t channelId, Int_t charge) { + static Int_t tree_charge=0; static Int_t warn=0; + Int_t DDL= busPatchId/100+2560; /// Compute pedestals values AliMUONVCalibParam* ped = static_cast(fPedestalStore ->FindObject(busPatchId, manuId)); + + if(!tree_charge && fHistos==2) + { + fTree = new TTree("tc","Charge tree"); + fTree->Branch("bp",&busPatchId,"bp/I"); + fTree->Branch("manu",&manuId,",manu/I"); + fTree->Branch("channel",&channelId,",channel/I"); + fTree->Branch("DDL",&DDL,",DDL/I"); + fTree->Branch("charge",&charge,"charge/I"); + // fTree->Branch("Pedestal",&Pedestal,"Pedestal/D"); + // fTree->Branch("chargetrue",&chargeminusPed,"chargetrue/D"); + // fTree->Branch("evt",&evt,"evt/I"); + tree_charge=1; + } + + if (!ped) { if(fConfig) @@ -191,6 +215,8 @@ void AliMUONPedestal::MakePed(Int_t busPatchId, Int_t manuId, Int_t channelId, I } if (ped->ValueAsDouble(channelId, 1) == -1) ped->SetValueAsDouble(channelId, 1, 0.); + if(fHistos==2) fTree->Fill(); + Double_t pedMean = ped->ValueAsDouble(channelId, 0) + (Double_t) charge; Double_t pedSigma = ped->ValueAsDouble(channelId, 1) + (Double_t) charge*charge; @@ -446,6 +472,13 @@ void AliMUONPedestal::MakeASCIIoutput(ostream& out) const } } +//______________________________________________________________________________ +void AliMUONPedestal::CreateControlHistos() +{ +// Create histo + fHistoFileName=Form("%s.root",fPrefixDA.Data()); + fHistoFile = new TFile(fHistoFileName,"RECREATE","MUON Tracking pedestals"); +} //______________________________________________________________________________ void AliMUONPedestal::MakeControlHistos() { @@ -458,29 +491,31 @@ void AliMUONPedestal::MakeControlHistos() Int_t busPatchId; Int_t manuId; Int_t channelId; + Int_t DDL; // histo - TFile* histoFile = 0; +// TFile* histoFile = 0; TTree* tree = 0; TH1F* pedMeanHisto = 0; TH1F* pedSigmaHisto = 0; - fHistoFileName=Form("%s.root",fPrefixDA.Data()); - histoFile = new TFile(fHistoFileName,"RECREATE","MUON Tracking pedestals"); + // fHistoFileName=Form("%s.root",fPrefixDA.Data()); + // histoFile = new TFile(fHistoFileName,"RECREATE","MUON Tracking pedestals"); Int_t nx = ADCMax()+1; Int_t xmin = 0; Int_t xmax = ADCMax(); pedMeanHisto = new TH1F("pedmean_allch","Pedestal mean all channels",nx,xmin,xmax); - pedMeanHisto->SetDirectory(histoFile); + pedMeanHisto->SetDirectory(fHistoFile); nx = 201; xmin = 0; xmax = 200; pedSigmaHisto = new TH1F("pedsigma_allch","Pedestal sigma all channels",nx,xmin,xmax); - pedSigmaHisto->SetDirectory(histoFile); + pedSigmaHisto->SetDirectory(fHistoFile); tree = new TTree("t","Pedestal tree"); + tree->Branch("DDL",&DDL,",DDL/I"); tree->Branch("bp",&busPatchId,"bp/I"); tree->Branch("manu",&manuId,",manu/I"); tree->Branch("channel",&channelId,",channel/I"); @@ -497,6 +532,7 @@ void AliMUONPedestal::MakeControlHistos() { busPatchId = ped->ID0(); manuId = ped->ID1(); + DDL= busPatchId/100+2560; for ( channelId = 0; channelId < ped->Size(); ++channelId ) { @@ -511,7 +547,7 @@ void AliMUONPedestal::MakeControlHistos() } } - histoFile->Write(); - histoFile->Close(); + fHistoFile->Write(); + fHistoFile->Close(); } diff --git a/MUON/AliMUONPedestal.h b/MUON/AliMUONPedestal.h index 98fce65ff3f..d0023b5b279 100644 --- a/MUON/AliMUONPedestal.h +++ b/MUON/AliMUONPedestal.h @@ -22,6 +22,8 @@ class AliMUONVStore; class TTimeStamp; +class TTree; +class TFile; using std::ofstream; using std::ostream; @@ -56,7 +58,9 @@ class AliMUONPedestal : public TObject /// set config flag void SetconfigDA(Int_t ind) {fConfig = ind;} - /// set Nb of evt threshold to calculate pedestal + /// set Histos flag + void SetHistos(Int_t ind) {fHistos = ind;} + /// set Nb of evt threshold to calculate pedestal void SetnEvthreshold(Int_t ind) {fNEvthreshold = ind;} /// set DA status (return code) void SetStatusDA(Int_t ind) {fStatusDA = ind;} @@ -74,6 +78,8 @@ class AliMUONPedestal : public TObject void Finalize(); /// Create String to be put into file or AMORE DB void MakeASCIIoutput(ostream& out) const; + /// Create Histograms + void CreateControlHistos(); /// Fill Histograms void MakeControlHistos(); @@ -91,6 +97,7 @@ protected: Int_t fNManuConfig; ///< Nb of Manu in the current detector configuration Int_t fConfig; ///< flag 1(0) for reading(or not) configuration ascii file Int_t fStatusDA; ///< DA return code (0=OK) + Int_t fHistos; ///< flag for Histograms (0,1=standard, 2=ntuple with charge) AliMUONVStore* fErrorBuspatchTable; ///< Table for buspatches with parity errors AliMUONVStore* fManuBuspatchTable; ///< Occupancy rate for each (buspatch, manu) AliMUONVStore* fManuBPoutofconfigTable; ///< (buspatch, manu) out of config @@ -102,6 +109,8 @@ protected: Int_t fIndex; ///< calibration run index TString fPrefixDA; ///< specific DA prefixname TString fPrefixLDC; ///< specific LDC prefixname + TFile* fHistoFile; ///< .root histo file + TTree* fTree ; ///< charge Tree static const Int_t fgkADCMax; ///< max channel count @@ -111,7 +120,7 @@ protected: /// Not implemented AliMUONPedestal& operator = (const AliMUONPedestal& rhs); - ClassDef(AliMUONPedestal,5) // Pedestal computing for DA + ClassDef(AliMUONPedestal,6) // Pedestal computing for DA }; #endif diff --git a/MUON/MUONTRKPEDda.cxx b/MUON/MUONTRKPEDda.cxx index 95f417662f7..cbfc63fe847 100644 --- a/MUON/MUONTRKPEDda.cxx +++ b/MUON/MUONTRKPEDda.cxx @@ -29,7 +29,7 @@ /* ------------------------------------------------------------------------- - 2012-02-16 New version: MUONTRKPEDda.cxx,v 1.8 + 2012-11-23 New version: MUONTRKPEDda.cxx,v 1.9 ------------------------------------------------------------------------- Version for MUONTRKPEDda MUON tracking @@ -268,7 +268,7 @@ int main(Int_t argc, const char **argv) filein >> line >> nConfig ; cout << "mutrkpedvalues: " << line << nConfig << " " ; filein >> line >> nEvthres ; if(nEvthres !=0)nEvthreshold=nEvthres; cout << line << nEvthreshold << " " ; filein >> line >> checkTokenlost ; cout << line << checkTokenlost << " " ; - filein >> line >> flag_histo ; if(flag_histo !=0) cout << line << flag_histo << " " ; + filein >> line >> flag_histo ; cout << line << flag_histo << " " ; // =0 , 1-> standard , 2-> ntuple charge filein >> line >> maxEvts ; if(maxEvts!=0){maxEvents=maxEvts; cout << line << maxEvents;} // filein >> line >> errorDetail ; cout << line << errorDetail << " " ; // filein >> line >> nSorting ; cout << line << nSorting << " " ; @@ -278,6 +278,7 @@ int main(Int_t argc, const char **argv) muonPedestal->SetconfigDA(nConfig); muonPedestal->SetnEvthreshold(nEvthreshold); muonPedestal->SetnSorting(nSorting); + muonPedestal->SetHistos(flag_histo); // nConfig=1: configuration ascii file config_$DATE_ROLE_NAME read from DetDB if(nConfig) @@ -288,6 +289,8 @@ int main(Int_t argc, const char **argv) muonPedestal->LoadConfig(dbfile); } + if(flag_histo)muonPedestal->CreateControlHistos(); /// Generate pedestal histo rootfile + // Rawdeader, RawStreamHP AliRawReader* rawReader = AliRawReader::Create(inputFile); AliMUONRawStreamTrackerHP* rawStream = new AliMUONRawStreamTrackerHP(rawReader); @@ -558,7 +561,6 @@ int main(Int_t argc, const char **argv) status1 = daqDA_FES_storeFile(shuttleFile.Data(),"PEDESTALS"); if (status1) { detail=Form("%s: !!! ERROR: Failed to export pedestal file : %s to FES \n",prefixLDC,shuttleFile.Data()); printf("%s",detail); filcout << detail ; status= -1; } - //else { detail=Form("%s : ***** STORE Pedestal FILE in FES : OK ****** \n",prefixLDC); printf("%s",detail); filcout << detail ;} // Transferring configuration file to FES (be sure that env variable DAQDALIB_PATH is set) if(nConfig) @@ -566,22 +568,22 @@ int main(Int_t argc, const char **argv) status1 = daqDA_FES_storeFile(dbfile,"CONFIG"); if (status1) { detail=Form("%s: !!! ERROR: Failed to export configuration file : %s to FES \n",prefixLDC,dbfile); printf("%s",detail); filcout << detail ; status=-1; } - // else {detail=Form("%s : ***** STORE Configuration FILE in FES : OK ****** \n",prefixLDC); printf("%s",detail); filcout << detail ;} } + filcout.close(); + // Copying files to local DB folder defined by DAQ_DETDB_LOCAL Char_t *dir; unsigned int nLastVersions=50; dir= getenv("DAQ_DETDB_LOCAL"); if(dir != NULL) { - unsigned int nLastVersions=50; + // unsigned int nLastVersions=50; printf("\n%s : --- Local DataBase: %s (Max= %d) ---\n",prefixLDC,dir,nLastVersions); if(!shuttleFile.IsNull())status1 = daqDA_localDB_storeFile(shuttleFile.Data(),nLastVersions); if(flag_histo)status1 = daqDA_localDB_storeFile(muonPedestal->GetHistoFileName(),nLastVersions); status1 = daqDA_localDB_storeFile(logOutputFile.Data(),nLastVersions); } - cout << " " << endl; #ifdef ALI_AMORE @@ -602,7 +604,6 @@ int main(Int_t argc, const char **argv) cout << prefixLDC << " : Warning: MCH DA not compiled with AMORE support" << endl; #endif - filcout.close(); if(!status)printf("\n%s : -------- End execution : %s -------- (status= %d) \n",prefixLDC,prefixDA,status); else { printf("\n%s : -------- %s ending in ERROR !!!! -------- (status= %d) \n",prefixLDC,prefixDA,status);} -- 2.39.3