Changeset 434 for trunk


Ignore:
Timestamp:
09/21/00 12:35:27 (24 years ago)
Author:
harald
Message:
Changed the format for root to store the raw data from the pixels.
This is the version that was discussed on the software meeting in
Goettingen.
Location:
trunk/MagicSoft/include-Classes
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/include-Classes/MRawEvt.cxx

    r374 r434  
    66#include "MRawEvt.h"
    77#include "MRawPixel.h"
     8#include "MRawCrate.h"
    89
    910#include "Mdefine.h"
     
    1415// (Photomultipliers) from the Camera of MAGIC. So all data (FADC) of the
    1516// interesting pixels are the modules of an event. To describe pixels the
    16 // class MRawPixel is used.  To define a single events
    17 // some other data members are needed (Time of the events, kind of event..).
    18 //
     17// class MRawPixel is used and the class MRawCrate to describe Crates.
     18// To define a single events some other data members are needed
     19// (Time of the events, tirgger pattern of event..)
     20//
    1921// To describe one event on the level of FADC values the Class MRawEvt is
    2022// created. It has the following data members:
     
    2224// ----------
    2325//
    24 // UInt_t    EvtNo   
     26// UInt_t    DAQEvtNumber   
    2527//
    2628// This it the number of the Event in one
     
    3739// ----------
    3840//
    39 // ULong_t   fTimeStamp
     41// UInt_t   AbsTime[2]
    4042//   
    4143// Time of the event.
     
    4345// the millenium. From that start point the time is
    4446// measured in 200ns-count. One day for example
    45 // contains 432.e9 counts. An unsigned Long is able to
     47// contains 432.e9 counts. An array of two unsigned Int is able to
    4648// contain 1.8e19 200ns-counts. This corresponds to 41.e6
    4749// days. This should be more than the livetime of MAGIC.
     
    4951// ----------
    5052//
    51 // UChar_t   EvtStatus
    52 //
    53 // Status of Event.
    54 // This is a Byte (8 bit) to indicated the status of
    55 // the event (Pedestal, Calibration, etc).
    56 //
    57 // ----------
    58 //
    59 // UShort_t  Trig1st
     53// UInt_t  FstLvlTrigNumber
    6054//
    6155// Number of first level trigger
     
    7064// ----------
    7165//
    72 // UShort_t  MultPixel
    73 //
    74 // Multiplicity of Pixels
    75 // Each event consists of a specific number of
    76 // pixels. This is the number of pixels in one event.
    77 // The array of ClonesPixels (taClonesArray) is of this
    78 // size.
    79 //
    80 // ----------
    81 //
    82 // TClonesArray  *Pixels
    83 //
    84 // Array of Pixels
     66// UInt_t  SecLvlTrigNumber
     67//
     68// Number of second level trigger
     69// This member counts the number of Second Level Trigger
     70// between the last and this event.
     71//
     72// ----------
     73//
     74// UInt_t  TriggerPattern[2]
     75//
     76// Trigger Pattern used for this event
     77// Each event triggers for a particular configuration and each 
     78// configuration shoul have an ID (which is not fixed yet).
     79//
     80// ----------
     81//
     82// Byte_t   TriggerType
     83//
     84// Type of Trigger.
     85// This is a Byte (8 bit) to indicated the status of
     86// the event (Normal (0), Pedestal (1), Calibration (2), etc).
     87//
     88// ----------
     89//
     90// Byte_t   AllLowGainOn
     91//
     92// Type of Trigger.
     93// This is a Byte (8 bit) to indicated if any of the pixels
     94// have a non-negligible low gain (1) or not (0)
     95//
     96// ----------
     97//
     98// TClonesArray  *Crates
     99//
     100// Array of Crates
     101// The Clones array is a list of the Crates used in one
     102// event with the information about the Crate.
     103//
     104// ----------
     105//
     106// TClonesArray  *PixelsHigh
     107//
     108// Array of Pixels for their high voltage channel
    85109// The Clones array is a list of the Pixels used in one
    86110// event with the information about the Pixels.
    87111//
    88112//
    89 
    90 //
    91 void GetFadcNoise ( UChar_t asF[] )
     113// ----------
     114//
     115// TClonesArray  *PixelsLow
     116//
     117// Array of Pixels for their low voltage channel
     118// The Clones array is a list of the Pixels used in one
     119// event that have a significant signal in the low gain channel
     120// with the information about the Pixels.
     121//
     122//
     123
     124//
     125void GetFadcNoise ( Byte_t asF[] )
    92126{
    93127  static TRandom Gen ;
     
    95129  for (Int_t i=0; i<FADC_SLICES; i++ ) {   
    96130    Gen.Rannor(z1, z2) ;
    97     asF[i] = 10 + (UChar_t)(z1*4) ; 
     131    asF[i] = 10 + (Byte_t)(z1*4) ; 
    98132    // if (asF[i] < 0 ) asF[i] = 0 ;
    99133  }
     
    108142  //   set all member to zero, init the pointer to ClonesArray,
    109143
    110   EvtNo      = 0 ;
    111   fTimeStamp  = 0 ;
    112   EvtStatus  = 0 ;
    113   Trig1st    = 0 ;
    114   MultPixel  = 0 ;
     144  DAQEvtNumber      = 0 ;
     145  AbsTime[0] = AbsTime [1]  = 0 ;
     146  FstLvlTrigNumber = 0 ;
     147  SecLvlTrigNumber = 0 ;
     148  TriggerPattern[0] = TriggerPattern[1] = 0 ;
     149  TriggerType = 0 ;
     150  AllLowGainOn = 0 ;
    115151
    116152  //
     
    120156  //   initialize the list to this global pointer
    121157 
    122   Pixels = new TClonesArray ("MRawPixel", 2*CAMERA_PIXELS ) ;
     158  PixelsHigh = new TClonesArray ("MRawPixel", 5*CAMERA_PIXELS ) ;
     159  PixelsLow = new TClonesArray ("MRawPixel", CAMERA_PIXELS ) ;
     160  Crates = new TClonesArray ("MRawCrate", 25 ) ;
    123161
    124162  cout << " default constructor " << endl ;
     
    130168  //   Implementation of the default destructor
    131169  //
    132   delete Pixels ;
     170  delete PixelsHigh ;
     171  delete PixelsLow ;
     172  delete Crates ;
    133173  cout << " default destructor " << endl ;
    134174}
     
    140180  //   Resets all members to zero, clear the list of Pixels
    141181  //
    142   EvtNo      = 0 ;
    143   fTimeStamp  = 0 ;
    144   EvtStatus  = 0 ;
    145   Trig1st    = 0 ;
    146   MultPixel  = 0 ;
    147 
    148   Pixels->Clear() ;
     182  DAQEvtNumber      = 0 ;
     183  AbsTime[0] = AbsTime [1]  = 0 ;
     184  FstLvlTrigNumber = 0 ;
     185  SecLvlTrigNumber = 0 ;
     186  TriggerPattern[0] = TriggerPattern[1] = 0 ;
     187  TriggerType = 0 ;
     188  AllLowGainOn = 0 ;
     189
     190  PixelsHigh->Clear() ;
     191  PixelsLow->Clear() ;
     192  Crates -> Clear() ;
    149193}
    150194
     
    156200  //
    157201
     202  Int_t i = 0;
     203
    158204  // Prints out the data of one Pixel
    159   cout << endl << "EventNumber      " << EvtNo          ;
    160   cout << endl << "Event Time Stamp " << fTimeStamp      ;
    161   cout << endl << "Event Status     " << (int) EvtStatus      ;
    162   cout << endl << "Trigger 1. Level " << Trig1st        ;
    163   cout << endl << "Number of Pixels " << MultPixel      ;
    164 
    165   for (Int_t i=0 ; i<MultPixel; i++ ) {
    166     ((MRawPixel *)Pixels->At(i))->Print() ;   
     205  cout << endl << "EventNumber      " << DAQEvtNumber          ;
     206  cout << endl << "Event Time Stamp " << (Float_t) AbsTime[0]*4294967296
     207    +AbsTime[1]    ;
     208  cout << endl << "Trigger 1. Level " << FstLvlTrigNumber        ;
     209  cout << endl << "Trigger 2. Level " << SecLvlTrigNumber        ;
     210  cout << endl << "Trigger Pattern " << (Float_t) TriggerPattern[0]*4294967296
     211    +TriggerPattern[1]    ;
     212  cout << endl << "Trigger Type ";
     213  switch (TriggerType){
     214  case 0:   
     215    cout<<" Normal Trigger ";
     216    break;
     217  case 1: 
     218    cout<<" Pedestal ";
     219    break;
     220  case 2:
     221    cout<<" Calibration ";
     222    break;
     223  default:
     224    cout<<TriggerType;
     225    break;
    167226  }
    168 }
    169 
    170 
    171 void MRawEvt::FillRandom ( UInt_t uiN, ULong_t ulT,  UShort_t usMuPi ) {
    172   //
    173   //  This is neccessary to fill the MRawEvt Class with randomized FADC
    174   //  values. The EventNumber, EventTime and the Number of Pixels are given
    175   //  as parameters.
    176   //
    177 
    178   EvtNo      = uiN ;
    179   fTimeStamp  = ulT ;
    180 
    181   UChar_t   ucA[FADC_SLICES] ;
    182 
    183   for (UShort_t i = 0 ; i< usMuPi; i++ ) {
    184     GetFadcNoise ( ucA ) ;   
    185  
    186     TClonesArray &caP = *Pixels ;
    187     new ( caP[MultPixel++] ) MRawPixel((MultPixel), 0, ucA) ;
     227
     228  cout<<"High Voltage channel"<<endl;
     229  while (PixelsHigh+i) {
     230    ((MRawPixel *)PixelsHigh->At(i))->Print() ;
     231    i++;   
    188232  }
    189 }
    190 
    191 void MRawEvt::FillHeader ( UInt_t uiN, ULong_t ulT, UChar_t ucSta ) {
     233  cout<<"Low Voltage channel"<<endl;
     234  while (PixelsLow+i) {
     235    ((MRawPixel *)PixelsLow->At(i))->Print() ;
     236    i++;   
     237  }
     238}
     239
     240void MRawEvt::FillHeader ( UInt_t uiN, Float_t ulT, Float_t ulTP ) {
    192241   
    193   EvtNo      = uiN ;
    194   fTimeStamp  = ulT ;
    195  
    196   EvtStatus  = ucSta ;
    197   Trig1st    = 0 ;
    198   MultPixel  = 0   ;
    199 
    200   Pixels->Clear()  ;
    201 }
    202 
    203 void MRawEvt::FillPixel ( UShort_t uiPix, Float_t *array ) {
     242  DAQEvtNumber = uiN ;
     243  AbsTime[0]  = (UInt_t) (ulT/4294967296) ;
     244  AbsTime[1]  = (UInt_t) (ulT-AbsTime[0]*4294967296) ;
     245  TriggerPattern[0]  = (UInt_t) (ulTP/4294967296) ;
     246  TriggerPattern[1] = (UInt_t) (ulTP-TriggerPattern[0]*4294967296) ;
     247
     248}
     249
     250void MRawEvt::FillPixel ( Short_t siPix, UShort_t *MultPixel, Float_t *array ) {
    204251  //
    205252  //  This is to fill the data of one pixel to the MRawEvt Class.
     
    207254  //
    208255
    209   UChar_t   ucA[FADC_SLICES] ;
    210 
    211   for (UShort_t i = 0 ; i< FADC_SLICES ; i++ ) {
    212     ucA[i] = (UShort_t) array[i] ;
     256  Int_t i = 0;
     257  Byte_t   ucA[FADC_SLICES] ;
     258
     259  for(i=0;i<FADC_SLICES;i++){
     260    ucA[i] = (Byte_t) array[i] ;
    213261  }
    214262 
    215   TClonesArray &caP = *Pixels ;
    216   new ( caP[MultPixel++] ) MRawPixel((uiPix), 0, ucA) ;
    217 }
    218 
    219 void MRawEvt::FillMontCarl ( UInt_t uiN, ULong_t ulT,  Float_t *array ) {
    220   //
    221   //  This is neccessary to fill the MRawEvt Class with randomized FADC
    222   //  values. The EventNumber, EventTime and the Number of Pixels are given
    223   //  as parameters.
     263  TClonesArray &caP = *PixelsHigh ;
     264  new ( caP[(*(MultPixel))++] ) MRawPixel((siPix), ucA) ;
     265}
     266
     267void MRawEvt::FillPixelLow ( Short_t siPix, UShort_t *MultPixel, Float_t *array ) {
     268  //
     269  //  This is to fill the data of one pixel to the MRawEvt Class.
     270  //  The parameters are the pixelnumber and the FADC_SLICES values of ADCs
    224271  //
    225272
    226   EvtNo      = uiN ;
    227   fTimeStamp  = ulT ;
    228 
    229   MultPixel = 0 ;
    230 
    231   UChar_t   ucA[FADC_SLICES] ;
    232 
    233   for (UShort_t i = 0 ; i< CAMERA_PIXELS; i++ ) {
    234 
    235     if ( array[i] > 0. ) {
    236       for ( Int_t ii = 0 ; ii < FADC_SLICES ; ii++ ) {
    237         ucA[ii] = 0 ;
    238       }
    239       ucA[5] = (UShort_t) (array[i]) ;
    240      
    241       TClonesArray &caP = *Pixels ;
    242       new ( caP[MultPixel++] ) MRawPixel(i, 0, ucA) ;
    243     }
    244   }
    245 }
    246 
    247 UShort_t MRawEvt::GetMultPixel() {
    248   //
    249   //  returns the pixel multiplicity of the Event
    250   //
    251   return MultPixel;
    252 }
    253 
     273  Int_t i = 0;
     274  Byte_t   ucA[FADC_SLICES] ;
     275
     276  for(i=0;i<FADC_SLICES;i++){
     277    ucA[i] = (Byte_t) array[i] ;
     278  }
     279 
     280  TClonesArray &caP = *PixelsLow ;
     281  new ( caP[(*(MultPixel))++] ) MRawPixel((siPix), ucA) ;
     282}
     283
     284UShort_t MRawEvt::GetMultPixel(){
     285  //
     286  // returns the number of pixells which are already in the list
     287  //
     288
     289  UShort_t i =0;
     290  while(PixelsHigh+i) i++;
     291  return (i);
     292}
    254293
    255294//  void MRawEvt::AddPixel ( UShort_t usP ) {
     
    261300//  }
    262301
    263 //  void MRawEvt::AddPixel ( UShort_t usP, UChar_t ucStat, UChar_t ausAR[] ) {
     302//  void MRawEvt::AddPixel ( UShort_t usP, UChar_t ucStat, Byte_t ausAR[] ) {
    264303//    cout << " need implementation 2 " << endl ; 
    265304//  }
    266 
    267 
    268 
  • trunk/MagicSoft/include-Classes/MRawEvt.h

    r422 r434  
    1111
    1212 private:
    13   UInt_t        EvtNo     ;  // Number of Event
     13  UInt_t        DAQEvtNumber ;      // Number of Event
    1414
    15   ULong_t       fTimeStamp ;  // Time of the Event
    16  
    17   UChar_t       EvtStatus ;  // Status of this event (DAQ, Pedestal, ..)
     15  UInt_t        AbsTime[2] ;        // Time of the Event
    1816 
    19   UShort_t      Trig1st  ;  // Number of 1st level tiggers between 2 events
     17  UInt_t        FstLvlTrigNumber ;  // Number of 1st level tiggers between 2 events
    2018
    21   UShort_t      MultPixel ;  // Multiplicity of the Pixels in this event   
     19  UInt_t        SecLvlTrigNumber ;  // Number of 2nd level tiggers between 2 events
    2220
    23   TClonesArray  *Pixels   ;  // list of the events
     21  UInt_t        TriggerPattern[2] ; // Trigger configuration
     22
     23  Byte_t       TriggerType ;       // Normal trigger 0, pedestal 1, calibration 2
     24
     25  Byte_t       AllLowGainOn ;         // Flag indicating if any of the pixels have a
     26                                    // non-negligible low gain signal (1) or not (0)
     27
     28  TClonesArray  *Crates ;          // list of crates
     29
     30  TClonesArray  *PixelsHigh   ;         // list of the events for the
     31                                        // high gain channel
     32
     33  TClonesArray  *PixelsLow   ;         // list of the events for the low gain
     34                                       // channel if it has signifcant signal
    2435
    2536 public:
     
    3344  void Print() ;
    3445
    35   void FillRandom( UInt_t, ULong_t, UShort_t  ) ;
     46  void FillHeader( UInt_t, Float_t, Float_t = 0 ) ;
    3647
    37   void FillHeader( UInt_t, ULong_t, UChar_t = 0  ) ;
    38 
    39   void FillPixel(  UShort_t, Float_t * ) ;
     48  void FillPixel(Short_t, UShort_t *, Float_t * ) ;
    4049 
    41   void FillMontCarl ( UInt_t, ULong_t, Float_t * ) ;
     50  void FillPixelLow(Short_t, UShort_t *, Float_t * ) ;
    4251
    4352  UShort_t GetMultPixel();
    44 
    45   UShort_t GetPixelId( Int_t  )
    46     {return 1 ) ;
    4753
    4854  TClonesArray *&GetPixelList() {
     
    5056    //   returns a Pointer to the pixel list
    5157    //
    52     return  Pixels ;
     58    return  PixelsHigh ;
    5359  }
    5460 
    5561  ULong_t GetTimeStamp() {
    56     return fTimeStamp ;
     62    return (ULong_t) AbsTime[0]*4294967296+AbsTime[1];
    5763  }
    5864 
    5965 
    60 /*    void AddPixel( UShort_t  ) ;  */
     66/*    void AddPixel( Short_t  ) ;  */
    6167
    62 /*    void AddPixel ( UShort_t, UChar_t, UChar_t * ) ;  */
     68/*    void AddPixel ( Short_t, Byte_t, Byte_t * ) ;  */
    6369
    6470
     
    6874
    6975#endif
    70 
    71 
    72 
    73 
    74 
    75  
    76 
    77 
    78 
    79 
    80  
    81 
    82 
    83 
    84 
  • trunk/MagicSoft/include-Classes/MRawPixel.cxx

    r371 r434  
    11#include <iostream.h>
    22
    3 #include "TClonesArray.h"
    43#include "TString.h"
    54#include "TRandom.h"
     
    2625// ---------
    2726//
    28 // UShort_t     PixelId     ;   
     27// Short_t     PixelId     ;   
    2928//
    3029// This is to identify the Pixel.
     
    3534// low-gain-branch of the Fadc´s only if there is a signal in. Then the
    3635// PixelId is:
    37 //                   PixelId = 10000 + PixelId   .
     36//                   PixelId = - PixelId   .
     37// if there is an entry in the low gain list.
    3838//
    39 // For the high gain Fadc values the rule is:
     39// Otherwise Fadc values the rule is:
    4040//                   PixelId = PixelId .
    4141//
     
    4343// ---------
    4444//
    45 // UChar_t      PixelStatus ;   
    46 //
    47 // The PixelStatus may contain information if the Pixel has triggered
    48 // this event. Also the kind of gain-branch (high or low) may be indicated
    49 // by one bit of the PixelStatus. etc
    50 //
    51 // ---------
    52 //
    53 // UChar_t      Fadc[ FADC_SLICES ]  ;
     45// Byte_t    FADCSamples[FADC_SLICES] ;
    5446//
    5547// The values of FADC_SLICES fadc-slices. This is the information of the
    5648// measured ADC values for one branch (high gain or low gain). The typ of
    5749// branch is indicated in the usPixelNumber and in the PixelStatus.
     50// In this first version the number of FADC_SLICES is going to be fixed
    5851
    5952ClassImp(MRawPixel)
     
    6659  //
    6760   
    68     PixelId     = 0 ;
    69     PixelStatus = 0 ;
    70    
    71     for (Int_t i = 0; i<FADC_SLICES; i++)
    72       Fadc[i]   = 0 ;
     61  PixelId     = 0 ;
     62
     63  for (Int_t i = 0; i<FADC_SLICES; i++)
     64    FADCSamples[i]   = 0 ;
     65
    7366}
    7467
    7568
    76 MRawPixel::MRawPixel(UShort_t PId) {
     69MRawPixel::MRawPixel(Short_t PId) {
    7770  //
    7871  //  constructor II  overloaded
     
    8174 
    8275  PixelId     = PId ;
    83   PixelStatus = 0 ;
    84  
    8576  for (Int_t i = 0; i<FADC_SLICES; i++)
    86     Fadc[i]   = 0 ;
     77     FADCSamples[i]   = 0 ;
     78
    8779}
    8880
    8981
    90 MRawPixel::MRawPixel(UShort_t usPId, UChar_t ucSt, UChar_t ucF[]) {
     82MRawPixel::MRawPixel(Short_t usPId, Byte_t ucF[]) {
    9183  //
    9284  // constructor III overloaded
    9385  //
    94   // parameters are PixelId, Status and an array with Fadc numbers.
     86  // parameters are PixelId and an array with Fadc values.
    9587 
    9688  PixelId     = usPId ;
    97   PixelStatus = ucSt  ;
    9889 
    99   for (Int_t i = 0; i<FADC_SLICES; i++)
    100     Fadc[i]   = ucF[i] ;
     90   for (Int_t i = 0; i<FADC_SLICES; i++)
     91    FADCSamples[i]   = ucF[i] ;
    10192}
     93
    10294MRawPixel::~MRawPixel(){
    10395  //
     
    111103  //
    112104  PixelId     = 0 ;
    113   PixelStatus = 0 ;
    114  
    115   for (Int_t i = 0; i<FADC_SLICES; i++)
    116     Fadc[i]   = 0 ;
     105
     106  for (Int_t i=0;i<FADC_SLICES; i++){
     107  FADCSamples[i] = 0;
     108  }
    117109}
    118 
    119110
    120111void MRawPixel::Print()
     
    125116
    126117  cout << endl << "PixId " << PixelId          ;
    127   cout << " Stat " << (Int_t) PixelStatus << " --> "     ;
    128118
    129119  for (Int_t i=0 ; i<FADC_SLICES ; i++ ) {
    130     cout<<" / " << (int) Fadc[i] ;
     120    cout<<" / " << FADCSamples[i];
    131121  }
    132122}
    133  
    134 UShort_t MRawPixel::GetPixelId() {
     123
     124void MRawPixel::FillPixel (Short_t usPId, Byte_t ucF[]){
     125  //
     126  //  Fills the event information
     127  //
     128
     129  PixelId= usPId;
     130
     131  for (Int_t i = 0; i<FADC_SLICES; i++){
     132    FADCSamples[i]= ucF[i];
     133  }
     134
     135}
     136
     137Short_t MRawPixel::GetPixelId() {
    135138  //
    136139  // returns back the PixelId of the Pixel
     
    139142}
    140143
    141 UChar_t MRawPixel::GetFadcSlice( Int_t iSli ) {
     144Byte_t MRawPixel::GetFadcSlice( Int_t iSli ) {
    142145  //
    143146  // returns back the fadc content of the slice iSli
    144147  //
    145   return ( Fadc[iSli] ) ;
     148
     149    return (FADCSamples[iSli]) ;
    146150}
    147 
    148 
    149 
    150 
    151 
    152 
  • trunk/MagicSoft/include-Classes/MRawPixel.h

    r371 r434  
    1313 private:
    1414
    15   UShort_t     PixelId     ;           //  Identification of PixelNumber and gain branch
     15  Short_t     PixelId      ; //  Identification of PixelNumber and
     16                             //  flag for existency of low  gain branch
    1617
    17   UChar_t      PixelStatus ;           //  The Status of the pixel
    18 
    19   UChar_t      Fadc[ FADC_SLICES ]  ;  // The values of fadc-slices.
     18  Byte_t      FADCSamples[FADC_SLICES] ; // The values of fadc-slices.
    2019
    2120 public:
     
    2322  MRawPixel() ;
    2423
    25   MRawPixel(UShort_t ) ;
     24  MRawPixel(Short_t ) ;
    2625
    27   MRawPixel(UShort_t , UChar_t , UChar_t * ) ;
     26  MRawPixel(Short_t ,  Byte_t* ) ;
    2827
    2928  ~MRawPixel() ;
     
    3332  void Print() ;
    3433
    35   UShort_t GetPixelId() ;
     34  void FillPixel( Short_t, Byte_t *);
    3635
    37   UChar_t GetFadcSlice( Int_t  ) ;
     36  Short_t GetPixelId() ;
     37
     38  Byte_t GetFadcSlice( Int_t  ) ;
    3839
    3940  ClassDef ( MRawPixel, 1 )
Note: See TracChangeset for help on using the changeset viewer.