#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),
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;
+ }
}
}
}
void SetconfigDA(Int_t ind) {fConfig = ind;}
/// set Nb of evt threshold to calculate pedestal
void SetnEvthreshold(Int_t ind) {fNEvthreshold = ind;}
+ /// sorting flag
+ void SetnSorting(Int_t ind) {fSorting = ind;}
/// set specific DA prefixname
void SetprefixDA(const char* folder) { fPrefixDA=folder;}
/// set the index of calibration runs
// Int_t fN; ///<
Int_t fNCurrentEvents; ///< Number of current events
Int_t fNEvthreshold; ///< Nbevt threshold (pedestal calculation)
+ Int_t fSorting; ///< sorting flag (pedestal values)
Int_t fNEvents; ///< Number of events
Int_t fRunNumber; ///< run number
Int_t fNChannel; ///< Nb of channels (pads)
return 0;
}
+//_____________________________________________________________________________
+Int_t
+AliMUONVCalibParam::Compare(const TObject* object) const
+{
+ /// Compare AliMUONVCalibParam objects, trying to get as complete an order as possible.
+ /// We sort by ID0, then by ID1
+ ///
+ const AliMUONVCalibParam* param = static_cast<const AliMUONVCalibParam*>(object);
+
+ if ( ID0() == param->ID0() )
+ {
+ if ( ID1() == param->ID1() )
+ {
+ return 0;
+ }
+ else
+ return (ID1() >= param->ID1()) ? 1 : -1;
+ }
+ else
+ return ( ID0() >= param->ID0()) ? 1 : -1;
+}
+
+
virtual ~AliMUONVCalibParam();
virtual const char* GetName() const;
+
+ /// Advertise that we can be sorted in TCollections
+ virtual Bool_t IsSortable() const { return kTRUE; }
/// First id of this object
virtual Int_t ID0() const;
/// Second id of this object (might not be required)
virtual Int_t ID1() const;
+
+ /// method for sorting pedestal values ordered by ID0 and ID1
+ virtual Int_t Compare(const TObject* object) const;
/// whether or not the value we store are packed, e.g. as v = a*cste + b
virtual Bool_t IsPacked() const { return kFALSE; }
/*
-------------------------------------------------------------------------
- 2010-04-18 New version: MUONTRKPEDda.cxx,v 1.6
+ 2010-07-09 New version: MUONTRKPEDda.cxx,v 1.7
-------------------------------------------------------------------------
Version for MUONTRKPEDda MUON tracking
Int_t nEvents = 0;
UInt_t runNumber = 0;
Int_t nConfig = 1;
- Int_t nEvthreshold = 10; //below this nb_evt pedestal are not calculated and forced to 4085 (sigma)
+ Int_t nEvthreshold = 100; //below this nb_evt pedestal are not calculated and forced to 4085 (sigma)
+ Int_t nSorting = 0 ; // pedestal sorting (OFF by default)
ofstream filcout;
// decode the input line
// nConfig=1 : Reading configuration (or not) status via "mutrkpedvalues" file located in DetDB
if(nConfig)
{
+// Int_t maxEvts;
sprintf(dbfile,"mutrkpedvalues");
status=daqDA_DB_getFile(dbfile,dbfile);
if(status) {printf(" !!! Failed : input file %s is missing, status = %d\n",dbfile,status); return -1; }
ifstream filein(dbfile,ios::in);
filein >> nConfig;
- // filein >> nEvthreshold;
+ filein >> nSorting;
+ // filein >> maxEvts;
+// if(maxEvts!=0)maxEvents=maxEvts;
}
else printf(" *** Config= %d: no configuration ascii file is used \n",nConfig);
muonPedestal->SetconfigDA(nConfig);
muonPedestal->SetnEvthreshold(nEvthreshold);
+ muonPedestal->SetnSorting(nSorting);
// nConfig=1: configuration ascii file config_$DATE_ROLE_NAME read from DetDB
if(nConfig)