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.
File:
1 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 
Note: See TracChangeset for help on using the changeset viewer.