Adding the possibility, for raw data source, to give an event range (usefull e.g...
authorlaphecet <laphecet@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 20 May 2010 16:06:15 +0000 (16:06 +0000)
committerlaphecet <laphecet@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 20 May 2010 16:06:15 +0000 (16:06 +0000)
MUON/AliMUONMchViewApplication.cxx
MUON/AliMUONMchViewApplication.h
MUON/AliMUONPainterDataSourceFrame.cxx
MUON/AliMUONPainterDataSourceFrame.h
MUON/AliMUONVTrackerDataMaker.h

index ff4b78e..93d1bd7 100644 (file)
@@ -466,6 +466,12 @@ AliMUONMchViewApplication::ReleaseNotes()
   
   TGTextView* rn = new TGTextView(t);
 
+  rn->AddLine("1.05");
+  rn->AddLine("");
+  rn->AddLine("Added the possibility to select an event range when reading raw data");
+  rn->AddLine("Usefull e.g. to look at a single suspect event...");
+  rn->AddLine("");
+  
   rn->AddLine("1.04");
   rn->AddLine("");
   rn->AddLine("Changed the default OCDB to 2010 version");
index 627b968..d490165 100644 (file)
@@ -32,7 +32,7 @@ public:
   void HandleMenu(Int_t i);
 
   /// Return the version number of the mchview application
-  static const char* Version() { return "1.04"; }
+  static const char* Version() { return "1.05"; }
   
   /// Return the SVN revision  and version number of the mchview application
   static const char* FullVersion() { return Form("mchview Version %s ($Id$)",Version()); }
index cf5af55..946ca67 100644 (file)
@@ -76,12 +76,15 @@ AliMUONPainterDataSourceFrame::AliMUONPainterDataSourceFrame(const TGWindow* p,
   fHistogramButton(new TGCheckButton(fRawSelector23,"Histogram")),
   fHistoMin(new TGNumberEntry(fRawSelector23,0)),
   fHistoMax(new TGNumberEntry(fRawSelector23,4096)),
+  fEventRangeButton(new TGCheckButton(fRawSelector23,"Event range")),
+  fEventMin(new TGNumberEntry(fRawSelector23,-1,10)),
+  fEventMax(new TGNumberEntry(fRawSelector23,-1,10)),
   fRawOCDBPath(new TGTextEntry(fRawSelector22,"")),
   fOCDBSelector(new TGGroupFrame(this,"OCDB Path",kHorizontalFrame)),
   fDataReaders(new TGGroupFrame(this,"Data sources")),
   fFilePath(new TGTextEntry(fRawSelector21,"")),
   fOCDBPath(new TGTextEntry(fOCDBSelector,"alien://folder=/alice/data/2010/OCDB")),
-  fRunSelector(new TGNumberEntry(fOCDBSelector,0)),
+  fRunSelector(new TGNumberEntry(fOCDBSelector,0,10)),
   fOCDBTypes(new TGComboBox(fOCDBSelector)),
   fRecentSources(new TGComboBox(fRecentSourceSelector)),
   fItems(new TObjArray),
@@ -147,16 +150,25 @@ AliMUONPainterDataSourceFrame::AliMUONPainterDataSourceFrame(const TGWindow* p,
     fRawSelector22->AddFrame(fRawOCDBPath, new TGLayoutHints(kLHintsExpandX | kLHintsTop,5,5,5,5));
     fRawOCDBPath->SetEnabled(kFALSE);
     
-    fRawSelector23->AddFrame(fHistogramButton,new TGLayoutHints(kLHintsTop,5,5,5,5));
-    
+    fRawSelector23->AddFrame(fHistogramButton,new TGLayoutHints(kLHintsTop,5,5,5,5));    
     fHistogramButton->Connect("Clicked()","AliMUONPainterDataSourceFrame",this,"HistogramButtonClicked()");
-    
     fHistoMin->SetState(kFALSE);
-    fHistoMax->SetState(kFALSE);
-    
+    fHistoMax->SetState(kFALSE);    
     fRawSelector23->AddFrame(fHistoMin,new TGLayoutHints(kLHintsTop,5,5,5,5));
     fRawSelector23->AddFrame(fHistoMax,new TGLayoutHints(kLHintsTop,5,5,5,5));
     
+
+  fRawSelector23->AddFrame(fEventRangeButton,new TGLayoutHints(kLHintsTop,5,5,5,5));    
+  fEventRangeButton->Connect("Clicked()","AliMUONPainterDataSourceFrame",this,"EventRangeButtonClicked()");
+  fEventMin->SetState(kFALSE);
+  fEventMax->SetState(kFALSE);      
+  
+  fEventMin->SetFormat(TGNumberFormat::kNESInteger);
+  fEventMax->SetFormat(TGNumberFormat::kNESInteger);
+
+  fRawSelector23->AddFrame(fEventMin,new TGLayoutHints(kLHintsTop,5,5,5,5));
+  fRawSelector23->AddFrame(fEventMax,new TGLayoutHints(kLHintsTop,5,5,5,5));
+  
     TGButton* createRawButton = new TGTextButton(fRawSelector,"Create data source");
     
     fRawSelector->AddFrame(fRawSelector2, new TGLayoutHints(kLHintsExpandX | kLHintsTop,5,5,5,5));
@@ -188,7 +200,7 @@ AliMUONPainterDataSourceFrame::AliMUONPainterDataSourceFrame(const TGWindow* p,
   fOCDBTypes->AddEntry("Status",6);
   fOCDBTypes->AddEntry("Capacitances",2);
   fOCDBTypes->Select(0);
-  fOCDBTypes->Resize(100,20);
+  fOCDBTypes->Resize(80,20);
     
     TGButton* createOCDBButton = new TGTextButton(fOCDBSelector,"Create data source");
     createOCDBButton->Connect("Clicked()",
@@ -321,6 +333,26 @@ AliMUONPainterDataSourceFrame::HistogramButtonClicked()
   }
 }
 
+//_____________________________________________________________________________
+void
+AliMUONPainterDataSourceFrame::EventRangeButtonClicked()
+{
+  /// EventRange button was clicked.
+  
+  if ( fEventRangeButton->IsOn() )
+  {
+    fEventMin->SetState(kTRUE);
+    fEventMax->SetState(kTRUE);
+  }
+  else
+  {
+    fEventMin->SetIntNumber(-1);
+    fEventMax->SetIntNumber(-1);
+    fEventMin->SetState(kFALSE);
+    fEventMax->SetState(kFALSE);
+  }
+}
+
 //_____________________________________________________________________________
 void
 AliMUONPainterDataSourceFrame::CreateACFDataSource()
@@ -583,14 +615,16 @@ AliMUONPainterDataSourceFrame::CreateRawDataSource()
     name = "CALZ";
   }
   
-  uri = Form("%s%s%s;%s;%s;%s;%s;%s",
+  uri = Form("%s%s%s;%s;%s;%s;%s;%s;%s;%s",
              ( fHistogramButton->IsOn() ? "H":""),
              ( fromMemory ? "M" : ""),
              name.Data(),uri.Data(),
              ( strlen(fRawOCDBPath->GetText()) > 0 ? fRawOCDBPath->GetText() : " "),
              ( calibMode.Length() > 0 ? calibMode.Data() : " "),
              Form("%e",fHistoMin->GetNumber()),
-             Form("%e",fHistoMax->GetNumber()));
+             Form("%e",fHistoMax->GetNumber()),
+             Form("%d",(Int_t)(fEventMin->GetIntNumber())),
+             Form("%d",(Int_t)(fEventMax->GetIntNumber())));
   
   if ( CreateRawDataSource(uri) )
   {
@@ -610,6 +644,8 @@ AliMUONPainterDataSourceFrame::CreateRawDataSource(const TString& uri)
   TString calibMode;
   TString sxmin("0.0");
   TString sxmax("4096.0");
+  TString emin("-1");
+  TString emax("-1");
   
   TObjArray* a = uri.Tokenize(";");
   
@@ -637,6 +673,16 @@ AliMUONPainterDataSourceFrame::CreateRawDataSource(const TString& uri)
     sxmax = static_cast<TObjString*>(a->At(5))->String();
   }
   
+  if ( a->GetLast() > 5 )
+  {
+    emin = static_cast<TObjString*>(a->At(6))->String();
+  }
+
+  if ( a->GetLast() > 6 )
+  {
+    emax = static_cast<TObjString*>(a->At(7))->String();
+  }
+  
   AliRawReader* rawReader = 0x0;
 
   if ( filename.Contains(TRegexp("^alien")) )
@@ -692,9 +738,26 @@ AliMUONPainterDataSourceFrame::CreateRawDataSource(const TString& uri)
     reader = new AliMUONTrackerDataMaker(rawReader,histogram);
   }
 
+  reader->SetEventRange(emin.Atoi(),emax.Atoi());
+  
   reader->SetSource(filename.Data());
 
-  RegisterDataSource(reader,uri.Data());
+  TString dsName(uri);
+  
+  if ( emin.Atoi() <= emax.Atoi() )
+  {
+    // we have an event range
+    if ( emin.Atoi() == emax.Atoi())
+    {
+      dsName += Form("[%d]",emin.Atoi());
+    }
+    else
+    {
+      dsName += Form("[%d,%d]",emin.Atoi(),emax.Atoi());
+    }
+  }
+  
+  RegisterDataSource(reader,dsName.Data());
                        
   return kTRUE;
 }
index 29315a1..614aec4 100644 (file)
@@ -47,7 +47,9 @@ public:
   void DataMakerWasUnregistered(AliMUONVTrackerDataMaker* reader);
 
   void HistogramButtonClicked();
-  
+
+  void EventRangeButtonClicked();
+
   void OpenFileDialog();
   
   void OpenFileDialogACF();
@@ -100,9 +102,12 @@ private:
   TGCheckButton* fCalibrateGainConstantCapa; ///< to trig calibration of raw data (0-supp and gain w/ constant capacitance)
   TGCheckButton* fCalibrateGain; ///< to trig calibration of raw data (full blown calibration)
   TGCheckButton* fCalibrateEmelecGain; ///< to trig calibration of raw data (full blown calibration but with factory gains)
-  TGCheckButton* fHistogramButton; ///< to trig histogramming of raw data
+  TGCheckButton* fHistogramButton; ///< to trig histogramming of raw data  
   TGNumberEntry* fHistoMin; ///< xmin of histo to make
   TGNumberEntry* fHistoMax; ///< xmax of histo to make
+  TGCheckButton* fEventRangeButton; ///< to trig limitation of event range
+  TGNumberEntry* fEventMin; ///< min event number to consider
+  TGNumberEntry* fEventMax; ///< max event number to consider  
   TGTextEntry* fRawOCDBPath; ///< OCDB path for raw data calibration
   
   TGGroupFrame* fOCDBSelector; ///< to select a new OCDB data source
@@ -121,7 +126,7 @@ private:
   static const char* fgkNumberOfDataSourcesKey; ///< key used to store the # of data sources in the resource file
   static const char* fgkDataSourceURIKey; ///< key usde to store the data source URIs in the resource file
 
-  ClassDef(AliMUONPainterDataSourceFrame,4) // Data source selection frame
+  ClassDef(AliMUONPainterDataSourceFrame,5) // Data source selection frame
 };
 
 #endif
index 751c74b..69bc5ae 100644 (file)
@@ -70,6 +70,9 @@ public:
   /// Merge
   virtual Long64_t Merge(TCollection* list) = 0;
   
+  /// Set event range (if not event by event)
+  virtual void SetEventRange(Int_t /* firstevent */, Int_t /* lastevent */) {}
+  
   ClassDef(AliMUONVTrackerDataMaker,1) // Producer of AliMUONVTrackerData
 };