Changeset 456 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
12/22/00 16:25:50 (24 years ago)
Author:
tbretz
Message:
2000/12/23: Thomas Bretz, changes see Changelog.
2000/12/23: Thomas Bretz, changes see Changelog.
2000/12/23: Thomas Bretz, changes see Changelog.
2000/12/23: Thomas Bretz, changes see Changelog.
2000/12/23: Thomas Bretz, changes see Changelog.
2000/12/23: Thomas Bretz, changes see Changelog.
2000/12/23: Thomas Bretz, changes see Changelog.
2000/12/23: Thomas Bretz, changes see Changelog.
2000/12/23: Thomas Bretz, changes see Changelog.
2000/12/23: Thomas Bretz, changes see Changelog.
2000/12/23: Thomas Bretz, changes see Changelog.
2000/12/23: Thomas Bretz, changes see Changelog.
2000/12/23: Thomas Bretz, changes see Changelog.
2000/12/23: Thomas Bretz, changes see Changelog.
2000/12/23: Thomas Bretz, changes see Changelog.
2000/12/23: Thomas Bretz, changes see Changelog.
2000/12/23: Thomas Bretz, changes see Changelog.
2000/12/23: Thomas Bretz, changes see Changelog.
2000/12/23: Thomas Bretz, changes see Changelog.
2000/12/23: Thomas Bretz, changes see Changelog.
Location:
trunk/MagicSoft/Mars
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/macros/dohtml.C

    r454 r456  
    1616
    1717  html.SetSourceDir("macros");
    18   html.Convert("merpp.C", "MARS - Merging and Preprocessing Macro");
    19   html.Convert("readraw.C", "MARS - Read a raw file macro");
     18  html.Convert("merpp.C", "MARS - Merging and Preprocessing");
     19  html.Convert("readraw.C", "MARS - How To Read A Raw");
    2020  html.Convert("rootlogon.C", "MARS - rootlogon.C");
    2121}
  • trunk/MagicSoft/Mars/mraw/MRawEvtData.cc

    r454 r456  
    127127void MRawEvtData::Draw(Option_t *opt)
    128128{
    129     TString str(opt);
    130 
    131     UInt_t num = 0;
    132 
    133     if (str.BeginsWith("GRAPH", TString::kIgnoreCase))
     129  // ----- AppendPad(opt);
     130   
     131  TString str(opt);
     132 
     133  UInt_t num = 0;
     134 
     135  if (str.BeginsWith("GRAPH", TString::kIgnoreCase))
     136  {
     137    if (str.Length()>5)
     138      sscanf(&str[5], "%d", &num);
     139   
     140    if (num>=GetNumPixels())
     141      num= GetNumPixels();
     142   
     143    cout << "Drawing Graph of Pixel " << num << endl;
     144   
     145    const Int_t n = GetNumHiGainSamples();
     146   
     147    Float_t *x = new Float_t[n];
     148    Float_t *y = new Float_t[n];
     149   
     150    for (int i=0; i<n; i++)
    134151    {
    135         if (str.Length()>5)
    136             sscanf(&str[5], "%d", &num);
    137 
    138         if (num>=GetNumPixels())
    139             num= GetNumPixels();
    140 
    141         cout << "Drawing Graph of Pixel " << num << endl;
    142 
    143         const Int_t n = GetNumHiGainSamples();
    144 
    145         Float_t *x = new Float_t[n];
    146         Float_t *y = new Float_t[n];
    147 
    148         for (int i=0; i<n; i++)
    149         {
    150             x[i] = i;
    151             y[i] = (*fHiGainFadcSamples)[i + num*GetNumHiGainSamples()];
    152         }
    153 
    154         TGraph *graph = new TGraph(n, x, y);
    155         graph->Draw("AC*");
    156 
    157         return;
     152      x[i] = i;
     153      y[i] = (*fHiGainFadcSamples)[i + num*GetNumHiGainSamples()];
    158154    }
    159 
    160     if (str.BeginsWith("HIST", TString::kIgnoreCase))
    161     {
    162         cout << "Length: " << str.Length() << endl;
    163 
    164         if (str.Length()>4)
    165             sscanf(&str[4], "%d", &num);
    166 
    167         if (num>=GetNumPixels())
    168             num= GetNumPixels();
    169 
    170         cout << "Drawing Histogram of Pixel " << num << endl;
    171 
    172         const Int_t n = GetNumHiGainSamples();
    173 
    174         char *name = new char[16];
    175 
    176         sprintf(name, "Pixel No.%d", (*fHiGainPixId)[num]);
    177 
    178         TH1F *hist = new TH1F(name, "Hi Gain Samples FADC", n, 0, n);
    179 
    180         for (int i=0; i<n; i++)
    181             hist->Fill(0.5+i, (*fHiGainFadcSamples)[i + num*GetNumHiGainSamples()]);
    182 
    183         hist->Draw();
    184 
    185         return;
    186     }
    187 
    188     cout << "MRawEvtData::Draw: Warning: You must specify either 'GRAPH' or 'HIST'" << endl;
     155   
     156    TGraph *graph = new TGraph(n, x, y);
     157    graph->Draw("AC*");
     158   
     159    return;
     160  }
     161 
     162  if (str.BeginsWith("HIST", TString::kIgnoreCase))
     163  {
     164    cout << "Length: " << str.Length() << endl;
     165   
     166    if (str.Length()>4)
     167      sscanf(&str[4], "%d", &num);
     168   
     169    if (num>=GetNumPixels())
     170      num= GetNumPixels();
     171   
     172    cout << "Drawing Histogram of Pixel " << num << endl;
     173   
     174    const Int_t n = GetNumHiGainSamples();
     175   
     176    char *name = new char[16];
     177   
     178    sprintf(name, "Pixel No.%d", (*fHiGainPixId)[num]);
     179   
     180    TH1F *hist = new TH1F(name, "Hi Gain Samples FADC", n, 0, n);
     181   
     182    for (int i=0; i<n; i++)
     183      hist->Fill(0.5+i, (*fHiGainFadcSamples)[i + num*GetNumHiGainSamples()]);
     184   
     185    hist->Draw();
     186
     187    return;
     188  }
     189 
     190  cout << "MRawEvtData::Draw: Warning: You must specify either 'GRAPH' or 'HIST'" << endl;
    189191}
    190192
  • trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.cc

    r454 r456  
     1///////////////////////////////////////////////////////////////////////////////
     2//
     3//  MRawEvtPixelIter
     4//
     5//  class to iterate over all pixels of one event.
     6//  The calling is similar to a root iterator:
     7// 
     8//  MRawEvtData *evtdata;            // must be filled with data from somewhere
     9//  MRawEvtPixelIter pixel(evtdata); // evtdata: ptr to event you want to iterate
     10//
     11//  while (pixel.Next())
     12//  {
     13//     // here you can access the actual time slices by using
     14//     //   pixel.GetPixelId();
     15//     //   pixel.GetHiGainFadcSamples()[i]; // i is the number of the slice
     16//     //   pixel.IsLoGain();                // check if pixel has
     17//     //   pixel.GetLoGainFadcSamples()[i]; // i is the number of the slice
     18//
     19//     // WARNING: Don't acces more time slices than available.
     20//     //   Get the numbers by calling: evtdata->GetNum[Lo,Hi]GainSamples()
     21//     //   This number is constant for one event
     22//  }
     23//
     24///////////////////////////////////////////////////////////////////////////////
    125#include "MRawEvtPixelIter.h"
    226
     
    832ClassImp(MRawEvtPixelIter)
    933
    10 TObject *MRawEvtPixelIter::Next()
     34MRawEvtData *MRawEvtPixelIter::Next()
    1135{
    1236    //
    1337    // if we are already at the last entry there is no 'next' entry anymore
    1438    //
    15     if (fNumHiGainEntry==fData->fHiGainPixId->GetSize()-1)
     39    if (fNumHiGainEntry==fData->fHiGainPixId->GetSize())
    1640        return NULL;
    1741
     
    1943    // if we are already at the last entry there is no 'next' entry anymore
    2044    //
    21     if (fNumLoGainEntry != fData->fLoGainPixId->GetSize()-1)
     45    if (fNumLoGainEntry != fData->fLoGainPixId->GetSize())
    2246        if (*fHiGainId == *fLoGainId)
    2347        {
     
    5680    // set pointer to first entry of arrays
    5781    //
    58     fHiGainId   = (UShort_t*)fData->fHiGainPixId->GetArray();
    59     fLoGainId   = (UShort_t*)fData->fLoGainPixId->GetArray();
    60     fHiGainPos  = (Byte_t*)fData->fHiGainFadcSamples->GetArray();
    61     fLoGainPos  = (Byte_t*)fData->fLoGainFadcSamples->GetArray();
     82    fHiGainId   = fData->fHiGainPixId->GetArray()-1;
     83    fLoGainId   = fData->fLoGainPixId->GetArray()-1;
     84    fHiGainPos  = fData->fHiGainFadcSamples->GetArray()-fData->GetNumHiGainSamples();
     85    fLoGainPos  = fData->fLoGainFadcSamples->GetArray()-fData->GetNumLoGainSamples();
    6286}
     87
     88void MRawEvtPixelIter::Draw(Option_t *t)
     89{
     90  //
     91  // Draw the actual pixel (for options see: MRawEvtData::Draw)
     92  //
     93  char *txt = new char[6+strlen(t)];
     94  sprintf(txt, "%s%d", t, *fHiGainId);
     95  fData->Draw(txt);
     96  delete txt;
     97}
     98
     99
     100
     101
     102
     103
  • trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.h

    r454 r456  
    11#ifndef MRAWEVTPIXELITER_H
    22#define MRAWEVTPIXELITER_H
    3 
     3///////////////////////////////////////////////////////////////////////////////
     4//
     5//  MRawEvtPixelIter
     6//
     7//  class to iterate over all pixels of one event.
     8//
     9///////////////////////////////////////////////////////////////////////////////
    410#ifndef MAGIC_H
    511#include "MAGIC.h"
    6 #endif
    7 #ifndef ROOT_TIterator
    8 #include <TIterator.h>
    912#endif
    1013
    1114class MRawEvtData;
    1215
    13 class MRawEvtPixelIter : public TIterator
     16class MRawEvtPixelIter
    1417{
    1518private:
     
    2831    MRawEvtPixelIter(MRawEvtData *dat) : fData(dat)
    2932    {
    30         //
    31         // WARNING: The Iterator now points to the FIRST entry.
    32         //          This means that you have to use a do...while loop
    33         //          NOT a while() loop.
    34         //
    3533        Reset();
    3634    }
    3735
    38     TObject *Next();
     36    MRawEvtData *Next();
    3937
    4038    UShort_t GetPixelId() const
     
    7674    void Reset();
    7775
    78     ClassDef(MRawEvtPixelIter, 1)
     76    void Draw(Option_t *t="GRAPH");
     77
     78    ClassDef(MRawEvtPixelIter, 1) // iterates over all pixels of one MRawEvtData object
    7979};
    8080
  • trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc

    r454 r456  
    1212#include <iomanip.h>
    1313
     14//#include <TClass.h>
     15
    1416#include "MArrayS.h"
    1517
     
    2224
    2325    fPixAssignment = new MArrayS(0);
     26
     27    // This is only valid for root > 3.0
     28    // IsA()->CanIgnoreTObjectStreamer();
    2429}
    2530
  • trunk/MagicSoft/Mars/readraw.cc

    r454 r456  
    1111#include "MEvtLoop.h"
    1212
     13#include "MTime.h"
    1314#include "MRawRunHeader.h"
    1415#include "MRawEvtHeader.h"
    1516#include "MRawEvtData.h"
    1617#include "MRawCrateArray.h"
    17 #include "MTime.h"
    1818#include "MInputStreamID.h"
    1919
    2020/////////////////////////////////////////////////////////////////////////////
    2121//
    22 // This is an easy implementation of the Merging process (as compilable prog)
    23 //
    24 // at the moment it reads a binary file ("rawtest.bin") which was written
    25 // in the DAQ raw format.
    26 //
    27 // The data are stored in root container objects (classes derived from
    28 // TObject like MRawRunHeader)
    29 //
    30 // This containers are written to a root file ("rawtest.root")
     22// This is an demonstration how to read in a merpped root file
    3123//
    3224/////////////////////////////////////////////////////////////////////////////
     
    3527{
    3628    cout << "==================================================" << endl ;
    37     cout << "                   MERPP v0.1" << endl;
     29    cout << "                   ReadRaw v0.1" << endl;
    3830    cout << "      MARS Merging and Preprocessing Program" << endl ;
    3931    cout << "            Compiled on <" << __DATE__ << ">" << endl ;
     
    4436    // check for the right usage of the program
    4537    //
     38    if (argc!=2)
     39    {
     40        cout << "Sorry the usage is:" << endl;
     41        cout << "   readraw inputfile" << endl << endl;
     42        return -1;
     43    }
    4644
    4745    //
    4846    //     initialize ROOT  (this is obligatory here)
    4947    //
    50     TROOT simple("Merpp","Mars - Merging and Preprocessing Program");
     48    TROOT simple("Readraw","Mars - Merging and Preprocessing Program");
     49
     50    //
     51    // check whether the given files are OK.
     52    //
     53    if (gSystem->AccessPathName(argv[1], kFileExists))
     54    {
     55        cout << "Sorry, the file '" << argv[1] << "' doesn't exist." << endl;
     56        return -1;
     57    }
    5158
    5259    MRawRunHeader  *runheader = new MRawRunHeader();
     
    8895    evttree->GetBranch("MRawCrateArray")->SetAddress(&evtcrate);
    8996
    90     Int_t iEnt = (Int_t)evttree->GetEntries();
    91     cout << " Entries in Tree Data: " << dec << iEnt << endl;
     97    Int_t nent = (Int_t)evttree->GetEntries();
     98    cout << " Entries in Tree Data: " << dec << nent << endl;
    9299
    93     for (Int_t i = 0; i<iEnt; i++)
     100    for (Int_t i = 0; i<nent; i++)
    94101    {
    95102        cout << "Entry: " << i << endl;
Note: See TracChangeset for help on using the changeset viewer.