Changeset 502 for trunk/MagicSoft


Ignore:
Timestamp:
01/15/01 12:33:34 (24 years ago)
Author:
magicsol
Message:
Some modifications have been done to use the new (Dec'2000) Raw data format.
There are also some minnors modifications to adapt the improvements in the
MTrigger class (overlaping time and trigger cells).
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Simulation/Detector/Camera/camera.cxx

    r438 r502  
    2121//
    2222// $RCSfile: camera.cxx,v $
    23 // $Revision: 1.13 $
     23// $Revision: 1.14 $
    2424// $Author: magicsol $
    25 // $Date: 2000-10-25 08:14:23 $
     25// $Date: 2001-01-15 12:33:34 $
    2626//
    2727////////////////////////////////////////////////////////////////////////
     
    5757#include "TCanvas.h"
    5858
     59#include "TArrayC.h"
     60
    5961#include "MTrigger.hxx"
    6062#include "MFadc.hxx"
    6163
    62 #include "MRawEvt.h"
     64#include "MRawEvtData.h"
     65#include "MRawEvtHeader.h"
     66#include "MRawCrateData.h"
    6367#include "MMcEvt.h"
    6468#include "MMcTrig.hxx"
     
    224228
    225229//@: Properties of the trigger
    226 static float Trigger_gate_length = 3.0;
     230static float Trigger_gate_length = 6.0;
    227231static float Trigger_response_ampl = 1.0;
    228232static float Trigger_response_fwhm = 2.0;
     233static float Trigger_overlaping_time= 0.25;
    229234
    230235//@: Trigger conditions for a single trigger mode
     
    448453  float fpixelthres[TRIGGER_PIXELS];
    449454
    450   float fadcValues[(Int_t) SLICES_MFADC];  //@< the analog Fadc siganl for pixels
     455  TArrayC *fadcValues;  //@< the analog Fadc siganl for pixels
    451456
    452457  float plateScale_cm2deg;    //@< plate scale (deg/cm)
     
    535540  Trigger_Scan = get_Trigger_Scan();
    536541
    537   get_Trigger_properties( &Trigger_gate_length, &Trigger_response_ampl, &Trigger_response_fwhm);
     542  get_Trigger_properties( &Trigger_gate_length, &Trigger_overlaping_time, &Trigger_response_ampl, &Trigger_response_fwhm);
    538543
    539544  Trigger_Loop = get_Trigger_Loop(&Trigger_loop_lthres, &Trigger_loop_uthres, &Trigger_loop_lmult, &Trigger_loop_umult, &Trigger_loop_ltop, &Trigger_loop_utop);
     
    677682
    678683  Int_t Lev0, Lev1, Lev2 ;
     684 
     685  fadcValues =  new TArrayC(FADC_SLICES);
    679686
    680687  // initialise ROOT
     
    684691  // initialise instance of Trigger and FADC classes
    685692
    686   MTrigger  Trigger(Trigger_gate_length, Trigger_response_ampl, Trigger_response_fwhm);         //@< A instance of the Class MTrigger
     693  MTrigger  Trigger(Trigger_gate_length, Trigger_overlaping_time,
     694                    Trigger_response_ampl, Trigger_response_fwhm);  //@< A instance of the Class MTrigger
    687695
    688696  //  Initialise McTrig information class if we want to save trigger informtion
     
    711719  // Prepare the raw data output
    712720
    713   MRawEvt **Evt;
     721       // Header file
     722
     723  MRawEvtHeader **EvtHeader;
    714724
    715725  if (Write_RawEvt) {
    716     Evt = new MRawEvt * [icontrigger];
     726    EvtHeader = new MRawEvtHeader * [icontrigger];
    717727
    718728    for (i=0;i<icontrigger;i++) {
    719       Evt[i] = new MRawEvt();
     729      EvtHeader[i] = new MRawEvtHeader();
     730    }
     731  }
     732
     733       // Header file
     734
     735  MRawEvtData **EvtData;    // Data branch
     736
     737  if (Write_RawEvt) {
     738    EvtData = new MRawEvtData * [icontrigger];
     739
     740    for (i=0;i<icontrigger;i++) {
     741      EvtData[i] = new MRawEvtData();
    720742    }
    721743  }
     
    800822   
    801823    if (Write_RawEvt){
    802       EvtTree.Branch("MRawEvt","MRawEvt",
    803                      &Evt[0], bsize, split);
     824      EvtTree.Branch("MRawEvtHeader","MRawEvtHeader",
     825             &EvtHeader[0], bsize, split);
     826      EvtTree.Branch("MRawEvtData","MRawEvtData",
     827                     &EvtData[0], bsize, split);
    804828    }
    805829    if (Write_McTrig){
     
    823847
    824848  if (Trigger_Loop && Write_RawEvt){
    825     for(char branchname[10],i=0;i<icontrigger;i++){
     849    for(char branchname[15],i=0;i<icontrigger;i++){
    826850     
    827851      sprintf(help,"%i",i+1);
    828       strcpy (branchname, "MRawEvt");
     852      strcpy (branchname, "MRawEvtHeader");
    829853      strcat (branchname, & help[0]);
    830854      strcat (branchname, ".");
    831       EvtTree.Branch(branchname,"MRawEvt",
    832                      &Evt[i], bsize, split);
     855      EvtTree.Branch(branchname,"MRawEvtHeader",
     856                     &EvtHeader[i], bsize, split);
     857    }
     858    for(char branchname[15],i=0;i<icontrigger;i++){
     859     
     860      sprintf(help,"%i",i+1);
     861      strcpy (branchname, "MRawEvtData");
     862      strcat (branchname, & help[0]);
     863      strcat (branchname, ".");
     864      EvtTree.Branch(branchname,"MRawEvtData",
     865                     &EvtData[i], bsize, split);
    833866    }
    834867  }
     
    12551288                      //
    12561289                     
    1257                       Evt[iconcount]->FillHeader ( (UInt_t) (ntshow + nshow),(Float_t) (nshow*10000+iconcount*100+ii),0 );
     1290                      EvtHeader[iconcount]->FillHeader ( (UInt_t) (ntshow + nshow),0);
    12581291                      //   fill pixel information
    12591292                      for(i=0;i<ct_NPixels;i++){
    1260                         for (j=0;j<SLICES_MFADC;j++){
    1261                           fadcValues[j]=fadc.GetFadcSignal(i,j);
     1293                        for (j=0;j<FADC_SLICES;j++){
     1294                          fadcValues->AddAt((Char_t) (fadc.GetFadcSignal(i,j)),j);
    12621295                        }
    1263                         Evt[iconcount]->FillPixel(i+1000*ii,&numPix,fadcValues);
     1296                        EvtData[iconcount]->AddPixel(i+1000*ii,fadcValues,0);
    12641297                      }
    12651298                    }
     
    13081341            if( Write_RawEvt ){
    13091342              for(i=0;i<icontrigger;i++){
    1310                 Evt[i]->Clear() ;
     1343                EvtHeader[i]->Clear() ;
     1344                EvtData[i]->DeletePixels();
    13111345              }
    13121346            }
     
    13791413              //
    13801414             
    1381               Evt[0]->FillHeader ( (UShort_t) (ntshow + nshow) ,  20 ) ;
     1415              EvtHeader[0]->FillHeader ( (UShort_t) (ntshow + nshow) ,  20 ) ;
    13821416             
    13831417              //   fill pixel information
    13841418             
    13851419              for(i=0;i<ct_NPixels;i++){
    1386                 for (j=0;j<SLICES_MFADC;j++){
    1387                   fadcValues[j]=fadc.GetFadcSignal(i,j);
     1420                for (j=0;j<FADC_SLICES;j++){
     1421                  fadcValues->AddAt((Char_t) (fadc.GetFadcSignal(i,j)),j);
    13881422                }
    1389                 Evt[0]->FillPixel(i,&numPix,fadcValues);
     1423                EvtData[0]->AddPixel(i+ii*1000,fadcValues,0);
    13901424              }
    13911425            }       
     
    14371471           
    14381472            //    clear all
    1439             if (Write_RawEvt) Evt[0]->Clear() ;
     1473            if (Write_RawEvt) EvtHeader[0]->Clear() ;
     1474            if (Write_RawEvt) EvtData[0]->DeletePixels();
    14401475            if (Write_McEvt) McEvt->Clear() ;
    14411476          }
     
    15171552  //--
    15181553
    1519   HeaderTree.Write() ;
    1520   EvtTree.Write() ;
    15211554  outfile_temp.Write() ;
    15221555  outfile_temp.Close() ;
    15231556 
    1524   // 
    1525   // initalize the ROOT file
    1526   //
    1527  
    1528   TFile outfile ( rootname , "RECREATE" );
    1529   HeaderTree.Write() ;
    1530   EvtTree.Write() ;
    1531   outfile.Write() ;
    1532   outfile.Close() ;
    15331557
    15341558  // close input file
     
    27922816  int i, j, k, ii; // counters
    27932817
    2794   MTrigger trigger(Trigger_gate_length, Trigger_response_ampl, Trigger_response_fwhm);
     2818  MTrigger trigger(Trigger_gate_length, Trigger_overlaping_time, Trigger_response_ampl, Trigger_response_fwhm);
    27952819  MFadc flashadc;
    27962820                     
     
    30723096//
    30733097// $Log: not supported by cvs2svn $
     3098// Revision 1.13  2000/10/25 08:14:23  magicsol
     3099// The routine that produce poisson random numbers to decide how many phe
     3100// form NSB are emmited in each pixel has been replaced. Now a ROOT routine
     3101// is used.
     3102//
    30743103// Revision 1.12  2000/09/22 17:40:18  harald
    30753104// Added a lot of changes done by oscar.
     
    30803109//
    30813110// $Log: not supported by cvs2svn $
     3111// Revision 1.13  2000/10/25 08:14:23  magicsol
     3112// The routine that produce poisson random numbers to decide how many phe
     3113// form NSB are emmited in each pixel has been replaced. Now a ROOT routine
     3114// is used.
     3115//
    30823116// Revision 1.10  2000/07/04 14:10:20  MagicSol
    30833117// Some changes have been done in the root output file. The RawEvt tree is only
Note: See TracChangeset for help on using the changeset viewer.