#include <TTree.h>
#include <TFile.h>
#include <TH1F.h>
+#include <THashList.h>
#include <Riostream.h>
#include <sstream>
//fN(0),
fNCurrentEvents(0),
fNEvthreshold(0),
+fSorting(0),
fNEvents(0),
fRunNumber(0),
fNChannel(0),
{
filein >> busPatchId >> manuId;
- AliMUONErrorCounter* manuCounter;
AliMUONVCalibParam* ped =
static_cast<AliMUONVCalibParam*>(fPedestalStore ->FindObject(busPatchId, manuId));
ped = new AliMUONCalibParamND(2, AliMpConstants::ManuNofChannels(),busPatchId, manuId, -1.); // put default wise -1, not connected channel
fPedestalStore ->Add(ped);
- if (!(manuCounter = static_cast<AliMUONErrorCounter*>(fManuBuspatchTable->FindObject(busPatchId,manuId))))
+ if ( ! fManuBuspatchTable->FindObject(busPatchId,manuId) )
{
// New (buspatch,manu)
- manuCounter = new AliMUONErrorCounter(busPatchId,manuId);
+ AliMUONErrorCounter* manuCounter = new AliMUONErrorCounter(busPatchId,manuId);
fManuBuspatchTable->Add(manuCounter);
}
}
out<<"// BP MANU CH. MEAN SIGMA"<<endl;
out<<"//---------------------------------------------------------------------------" << endl;
- // iterator over pedestal
- TIter next(fPedestalStore ->CreateIterator());
- AliMUONVCalibParam* ped;
-
- while ( ( ped = dynamic_cast<AliMUONVCalibParam*>(next() ) ) )
- {
- Int_t busPatchId = ped->ID0();
- Int_t manuId = ped->ID1();
+ TIter next(fPedestalStore->CreateIterator());
+ AliMUONVCalibParam* ped;
- for ( Int_t channelId = 0; channelId < ped->Size(); ++channelId )
+ // Sorting
+ if (fSorting)
+ {
+ cout << " ..... sorting pedestal values ....." << endl;
+ THashList pedtable(100,2);
+ while ( ( ped = dynamic_cast<AliMUONVCalibParam*>(next() ) ) )
+ {
+ pedtable.Add(ped);
+ }
+ pedtable.Sort();
+ // iterator over sorted pedestal
+ TIter nextSorted(&pedtable);
+ while ( (ped = (AliMUONVCalibParam*)(nextSorted()) ) )
+ {
+ Int_t busPatchId = ped->ID0();
+ Int_t manuId = ped->ID1();
+ for ( Int_t channelId = 0; channelId < ped->Size(); ++channelId )
+ {
+ Double_t pedMean = ped->ValueAsDouble(channelId, 0);
+ Double_t pedSigma = ped->ValueAsDouble(channelId, 1);
+ out << "\t" << busPatchId << "\t" << manuId <<"\t"<< channelId << "\t" << pedMean <<"\t"<< pedSigma << endl;
+ }
+ }
+ }
+ else
+ {
+ while ( ( ped = dynamic_cast<AliMUONVCalibParam*>(next() ) ) )
{
- Double_t pedMean = ped->ValueAsDouble(channelId, 0);
- Double_t pedSigma = ped->ValueAsDouble(channelId, 1);
-
- out << "\t" << busPatchId << "\t" << manuId <<"\t"<< channelId << "\t" << pedMean <<"\t"<< pedSigma << endl;
+ Int_t busPatchId = ped->ID0();
+ Int_t manuId = ped->ID1();
+ for ( Int_t channelId = 0; channelId < ped->Size(); ++channelId )
+ {
+ Double_t pedMean = ped->ValueAsDouble(channelId, 0);
+ Double_t pedSigma = ped->ValueAsDouble(channelId, 1);
+ out << "\t" << busPatchId << "\t" << manuId <<"\t"<< channelId << "\t" << pedMean <<"\t"<< pedSigma << endl;
+ }
}
}
}
fHistoFileName=Form("%s.root",fPrefixDA.Data());
histoFile = new TFile(fHistoFileName,"RECREATE","MUON Tracking pedestals");
- Char_t name[255];
- Char_t title[255];
- sprintf(name,"pedmean_allch");
- sprintf(title,"Pedestal mean all channels");
Int_t nx = ADCMax()+1;
Int_t xmin = 0;
Int_t xmax = ADCMax();
- pedMeanHisto = new TH1F(name,title,nx,xmin,xmax);
+ pedMeanHisto = new TH1F("pedmean_allch","Pedestal mean all channels",nx,xmin,xmax);
pedMeanHisto->SetDirectory(histoFile);
- sprintf(name,"pedsigma_allch");
- sprintf(title,"Pedestal sigma all channels");
nx = 201;
xmin = 0;
xmax = 200;
- pedSigmaHisto = new TH1F(name,title,nx,xmin,xmax);
+ pedSigmaHisto = new TH1F("pedsigma_allch","Pedestal sigma all channels",nx,xmin,xmax);
pedSigmaHisto->SetDirectory(histoFile);
tree = new TTree("t","Pedestal tree");