]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
New: Sorting pedestal values ordered by Buspatch and Manu (by default sorting is...
authorlaphecet <laphecet@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 15 Jul 2010 12:53:29 +0000 (12:53 +0000)
committerlaphecet <laphecet@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 15 Jul 2010 12:53:29 +0000 (12:53 +0000)
MUON/AliMUONPedestal.cxx
MUON/AliMUONPedestal.h
MUON/AliMUONVCalibParam.cxx
MUON/AliMUONVCalibParam.h
MUON/MUONTRKPEDda.cxx

index 70bd7296781adc96a70ab4d358f7e61cb2b950f0..691b96e4d0130af5066339c0fd159bf99e9e4f56 100644 (file)
@@ -27,6 +27,7 @@
 #include <TTree.h>
 #include <TFile.h>
 #include <TH1F.h>
+#include <THashList.h>
 #include <Riostream.h>
 
 #include <sstream>
@@ -52,6 +53,7 @@ AliMUONPedestal::AliMUONPedestal()
 //fN(0),
 fNCurrentEvents(0),
 fNEvthreshold(0),
+fSorting(0),
 fNEvents(0),
 fRunNumber(0),
 fNChannel(0),
@@ -347,21 +349,45 @@ void AliMUONPedestal::MakeASCIIoutput(ostream& out) const
   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;
+           }
        }
     }
 }
index 5de7f59c6e8d7bf746aa42a61e22445a8170901f..2b9fee4cc27cb6c3eff0af1dbb956307e312ae93 100644 (file)
@@ -54,6 +54,8 @@ class AliMUONPedestal : public TObject
     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
@@ -71,6 +73,7 @@ protected:
     //    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)
index d8a69affdb39aee62637477ba2f001ac9392ac8b..5cdafd09bb3cc2c4271c537906f76fd040c0f9a3 100644 (file)
@@ -152,3 +152,26 @@ AliMUONVCalibParam::ValueAsDoubleFast(Int_t , Int_t ) const
   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;
+}
+
+
index 6bc48e56b06f5d8ee48719f0e8c11e8de2085219..5901d16c1949b897ef779d868d3c5cb1c6a719e2 100644 (file)
@@ -25,12 +25,18 @@ public:
   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; }
index 5f48d712509b7cd2a98b5181b33dc5b094801bc7..f390e684f43a94580865e0a7f2d955b5446abd47 100644 (file)
@@ -29,7 +29,7 @@
 
 /*
        -------------------------------------------------------------------------
-        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
@@ -142,7 +142,8 @@ int main(Int_t argc, const char **argv)
   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
@@ -224,16 +225,20 @@ int main(Int_t argc, const char **argv)
   // 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)