Changeset 2910 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
01/26/04 11:30:37 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r2909 r2910  
    99   * mraw/MRawEvtPixelIter.[h,cc]:
    1010     - removed member function GetNumPixels. For more details see mantis.
     11
     12   * manalysis/MArrivalTime.[h,cc]:
     13     - reorganized includes
     14     - fixed InitSize and ClearArray (now Reset) to fit MParContainer
     15       definition
     16     - for the moment removed usage of fPixelChecked - THIS WILL CRASH YOUR
     17       PROGRAM
     18
     19   * manalysis/MArrivalTimeCalc.[h,cc]:
     20     - reorganized includes
     21     - removed many obsolete code, exspecially copy&paste relicts!
     22     - fixed usage of InitSize
     23     - removed CleanArray. Reset() is called automatically before Process()
    1124
    1225
  • trunk/MagicSoft/Mars/manalysis/MArrivalTime.cc

    r2903 r2910  
    1818!   Author(s): Sebastian Raducci, 12/2003 <mailto:raducci@fisica.uniud.it>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2003
     20!   Copyright: MAGIC Software Development, 2000-2004
    2121!
    2222!
     
    3232#include "MArrivalTime.h"
    3333
     34#include <TSpline.h>
     35
    3436#include "MGeomCam.h"
    3537#include "MGeomPix.h"
     
    4547using namespace std;
    4648
     49#warning Commented out all usage of fPixelCehcked - THIS WILL CRASH YOUR PROGRAM!
     50
    4751// --------------------------------------------------------------------------
    4852//
     
    5559}
    5660
     61// -------------------------------------------------------------------------
     62//
    5763// Sets every pixel arrival time to -1
    58 void MArrivalTime::CleanArray(const MGeomCam &geom)
    59 {
    60     fData.Set(geom.GetNumPixels());
    61     fData.Reset(-1.0);
     64//
     65void MArrivalTime::Reset()
     66{
     67    // Do not use 'TArray::Reset()' or memset. It sets all single
     68    // bytes to -1 (in other words, it fills the array with 0xff)
     69    for (int i=0; i<fData.GetSize(); i++)
     70        fData[i] = -1;
    6271}
    6372
    6473void MArrivalTime::InitSize(Int_t i)
    6574{
    66  
    67   if (fData.GetSize() >= i)
    68     return;
    69   else
    7075    fData.Set(i);
    7176}
    7277
     78// -------------------------------------------------------------------------
    7379//
    7480// Set the arrival time in one pixel
     
    7682void MArrivalTime::SetTime(Int_t i, Float_t t)
    7783{
    78 
    79   if (i >= fData.GetSize())
    80       fData.Set(i+1);
    81 
    82   fData.AddAt(t,i);
    83 }
    84 
     84    fData[i] = t;
     85}
     86
     87// -------------------------------------------------------------------------
    8588//
    8689// Calculates the arrival time for each pixel
     
    8992//
    9093//
    91 
    9294void MArrivalTime::Calc(const Byte_t *fadcSamples, const Short_t nSlice,
    93               const Short_t idx, const MGeomCam &geom)
     95                        const Short_t idx)
    9496{
    9597
     
    130132//               it becomes stable
    131133//
    132 
    133134void MArrivalTime::EvalClusters(const MRawEvtData &evt, const MGeomCam &geom)
    134135{
     
    148149// Array that says if a pixel has been already checked or not
    149150
    150     for (Int_t i = 0; i < n; i++)
    151         fPixelChecked[i] = kFALSE;
     151//    for (Int_t i = 0; i < n; i++)
     152//        fPixelChecked[i] = kFALSE;
    152153
    153154// This fakeData array will be subsituted with the fData Array.
     
    166167    while ( pixel.Next() )
    167168    {
     169        /*
    168170        if (!fPixelChecked[pixel.GetPixelId()])
    169171        {
     
    197199                    fData2[fCluster[i]]=fakeData[fCluster[i]];
    198200            }           
    199         }
     201        } */
    200202    }
    201203
     
    206208// Function to check the nearest neighbour pixels arrivaltime
    207209//
    208 
    209210void MArrivalTime::CheckNeighbours(const MRawEvtData &evt, const MGeomCam &geom,
    210211                                   Short_t idx, Short_t *dimCluster)
    211212{
    212213    Byte_t numNeighbors=geom[idx].GetNumNeighbors();
    213     fPixelChecked[idx] = kTRUE;
     214    //fPixelChecked[idx] = kTRUE;
    214215
    215216    for (Byte_t i=0x00; i < numNeighbors; i++)
    216217    {
    217        
     218
     219        /*
    218220        if (!fPixelChecked[geom[idx].GetNeighbor(i)] &&
    219221            fakeData[idx] == fakeData[geom[idx].GetNeighbor(i)])
     
    223225            CheckNeighbours(evt, geom,
    224226                            geom[idx].GetNeighbor(i), dimCluster);
    225         }
     227                            }
     228                            */
    226229    }
    227230}
     
    230233// Returns the arrival time value
    231234//
    232 
    233235Bool_t MArrivalTime::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
    234236{
  • trunk/MagicSoft/Mars/manalysis/MArrivalTime.h

    r2902 r2910  
    11#ifndef MARS_MArrivalTime
    22#define MARS_MArrivalTime
     3
     4#ifndef MARS_MCamEvent
     5#include "MCamEvent.h"
     6#endif
    37
    48#ifndef ROOT_TArrayF
     
    812#include <TArrayS.h>
    913#endif
    10 #ifndef ROOT_TSpline
    11 #include <TSpline.h>
    12 #endif
    13 #ifndef MARS_MCamEvent
    14 #include "MCamEvent.h"
    15 #endif
    1614
    17 class MGeomPix;
    1815class MRawEvtData;
    19 class MRawEvtPixelIter;
    2016
    2117class MArrivalTime : public MCamEvent
    2218{
    23 
    2419 private:
    2520    TArrayF fData;  // Stores the arrival times
     
    3025    TArrayF fData5; // Clusters with at most 5 pix
    3126
    32     Bool_t  *fPixelChecked; // For each pixel says if it's already been checked
     27    //Bool_t  *fPixelChecked; // For each pixel says if it's already been checked
    3328    TArrayS fCluster; // Idxs of the pixels in the current cluster
    3429    TArrayS fakeData; //Test purpose
     
    3934    ~MArrivalTime() { }
    4035
     36    void   Reset();
     37    void   InitSize(Int_t i);
    4138    UInt_t GetNumPixels() const { return fData.GetSize(); }
    4239
    43     void CleanArray(const MGeomCam &geom); //Sets every arr time to -1
     40    void SetTime(Int_t i, Float_t time);
     41    const TArrayF &GetData() const { return fData; }
     42    Double_t operator[](int i) { return fData[i]; }
    4443
    45     void Calc(const Byte_t *fadcSamples, const Short_t nSlice,
    46               const Short_t idx, const MGeomCam &geom); // Calculates arrival times
    47 
     44    void Calc(const Byte_t *fadcSamples, const Short_t nSlice, const Short_t idx);
    4845    void EvalClusters(const MRawEvtData &evt, const MGeomCam &geom);
    49 
    5046    void CheckNeighbours(const MRawEvtData &evt, const MGeomCam &geom,
    51                                        Short_t idx, Short_t *dimCluster);
    52 
    53     void SetTime(Int_t i, Float_t time);
    54     void InitSize(Int_t i);
    55    
    56     const TArrayF &GetData() const { return fData; }
    57 
    58     Double_t operator[](int i) { return fData[i]; }
     47                         Short_t idx, Short_t *dimCluster);
    5948
    6049    Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
  • trunk/MagicSoft/Mars/manalysis/MArrivalTimeCalc.cc

    r2785 r2910  
    1818!   Author(s): Sebastian Raducci 12/2003 <mailto:raducci@fisica.uniud.it>
    1919!
    20 !   Copyright: MAGIC Software Development, 2002-2003
     20!   Copyright: MAGIC Software Development, 2002-2004
    2121!
    2222!
     
    3737//   MArrivalTime
    3838//   MRawEvtData
     39//
    3940//////////////////////////////////////////////////////////////////////////////
    40 
    41 #include "MArrivalTime.h"
    4241#include "MArrivalTimeCalc.h"
    43 
    44 #include "MParList.h"
    4542
    4643#include "MLog.h"
    4744#include "MLogManip.h"
    4845
     46#include "MParList.h"
     47
    4948#include "MGeomCam.h"
    50 #include "MMcRunHeader.hxx"
    51 
    52 #include "MRawRunHeader.h"
    53 #include "MRawEvtData.h"       // MRawEvtData::GetNumPixels
    54 #include "MCameraData.h"
     49#include "MArrivalTime.h"
     50#include "MRawEvtData.h"     
    5551#include "MRawEvtPixelIter.h"
    5652
     
    6359// Default constructor.
    6460//
    65 
    6661MArrivalTimeCalc::MArrivalTimeCalc(const char *name, const char *title)
    6762{
    6863    fName  = name  ? name  : "MArrivalTimeCalc";
    6964    fTitle = title ? title : "Calculate photons arrival time";
    70 
    71 //    AddToBranchList("MRawEvtData.fHiGainPixId");
    72 //    AddToBranchList("MRawEvtData.fLoGainPixId");
    73 //    AddToBranchList("MRawEvtData.fHiGainFadcSamples");
    74 //    AddToBranchList("MRawEvtData.fLoGainFadcSamples");
    7565
    7666}
     
    7969//
    8070// The PreProcess searches for the following input containers:
    81 //  - MRawRunHeader
    8271//  - MRawEvtData
    8372//  - MArrivalTime
    84 //  - MGeomCam
    8573//
    8674// The following output containers are also searched and created if
    8775// they were not found:
    8876//  - MArrivalTime
    89 //  - MRawEvtData
    9077//
    91 
    9278Int_t MArrivalTimeCalc::PreProcess(MParList *pList)
    9379{
    94     fRunHeader = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
    95     if (!fRunHeader)
    96     {
    97         *fLog << err << "MRawRunHeader not found... aborting." << endl;
    98         return kFALSE;
    99     }
    100 
    10180    fRawEvt = (MRawEvtData*)pList->FindObject(AddSerialNumber("MRawEvtData"));
    10281    if (!fRawEvt)
    10382    {
    10483        *fLog << err << "MRawEvtData not found... aborting." << endl;
    105         return kFALSE;
    106     }
    107 
    108     fGeom = (MGeomCam*)pList->FindObject("MGeomCam");
    109     if (!fGeom)
    110     {
    111         *fLog << err << "MGeomCam not found... aborting." << endl;
    11284        return kFALSE;
    11385    }
     
    12092}
    12193
     94// --------------------------------------------------------------------------
     95//
     96// The ReInit searches for the following input containers:
     97//  - MGeomCam
     98//
     99Bool_t MArrivalTimeCalc::ReInit(MParList *pList)
     100{
     101    MGeomCam *cam = (MGeomCam*)pList->FindObject(AddSerialNumber("MGeomCam"));
     102    if (!cam)
     103    {
     104        *fLog << err << GetDescriptor() << ": No MGeomCam found... aborting." << endl;
     105        return kFALSE;
     106    }
     107
     108    fArrTime->InitSize(cam->GetNumPixels());
     109
     110    return kTRUE;
     111}
     112
    122113
    123114// --------------------------------------------------------------------------
     115//
    124116// Evaluation of the mean arrival times (spline interpolation)
    125117// per pixel and store them in the MArrivalTime container.
     
    129121    MRawEvtPixelIter pixel(fRawEvt);
    130122
    131 // Every pixel is set to -1
    132     fArrTime->CleanArray((const MGeomCam&) *fGeom);
    133 
    134123    while (pixel.Next())
    135124    {
    136125        const UInt_t idx = pixel.GetPixelId();
    137 // If pixel is saturated we use LoGains
     126
     127        // If pixel is saturated we use LoGains
    138128        if (pixel.GetMaxHiGainSample() == 0xff && pixel.HasLoGain())
    139129        {
    140130            const Byte_t *ptr = pixel.GetLoGainSamples();
    141131            const Short_t nSlice = fRawEvt->GetNumLoGainSamples();
    142             fArrTime->Calc(ptr, nSlice, idx, (const MGeomCam&) *fGeom);
     132            fArrTime->Calc(ptr, nSlice, idx);
    143133        }
    144 // Use HiGains
     134        // Use HiGains
    145135        else
    146136        {
    147137            const Byte_t *ptr = pixel.GetHiGainSamples();
    148138            const Short_t nSlice = fRawEvt->GetNumHiGainSamples();
    149             fArrTime->Calc(ptr, nSlice, idx, (const MGeomCam&) *fGeom);
     139            fArrTime->Calc(ptr, nSlice, idx);
    150140        }
    151 // If pixel is saturated and hasn't lo gains we do nothing, it's value remains -1
     141        // If pixel is saturated and hasn't lo gains we do nothing, it's value remains -1
    152142    }
    153143   
  • trunk/MagicSoft/Mars/manalysis/MArrivalTimeCalc.h

    r2752 r2910  
    11#ifndef MARS_MArrivalTimeCalc
    22#define MARS_MArrivalTimeCalc
    3 
    4 /////////////////////////////////////////////////////////////////////////////
    5 //                                                                         //
    6 // MArrivalTimeCalc                                                        //
    7 //                                                                         //
    8 // Evaluates the Arrival Times                                             //
    9 //                                                                         //
    10 //                                                                         //
    11 /////////////////////////////////////////////////////////////////////////////
    123
    134#ifndef MARS_MTask
     
    167
    178class MRawEvtData;
    18 class MCameraData;
    19 class MRawRunHeader;
    20 class MGeomCam;
    219class MArrivalTime;
    2210
    2311class MArrivalTimeCalc : public MTask
    2412{
    25     MRawEvtData    *fRawEvt;     // raw event data (time slices)
    26     MCameraData    *fCamData;    // Cerenkov Photon Event used for calculation
    27     MRawRunHeader  *fRunHeader;  // RunHeader information
    28     MGeomCam       *fGeom;       // Geometry information
    29     MArrivalTime   *fArrTime;    // Container with the photons arrival times
     13private:
     14    MRawEvtData  *fRawEvt;     // raw event data (time slices)
     15    MArrivalTime *fArrTime;    // Container with the photons arrival times
    3016
    31     Bool_t          fEnableFix;  // fix for a bug in files from older camera versions (<=40)
    32     Bool_t          fIsMcFile;
    33 
    34     Int_t PreProcess(MParList *pList);
    35     Int_t Process();
    36     Int_t PostProcess() {return kTRUE;}
    37     Bool_t ReInit(MParList *pList) {
    38         return kTRUE;
    39     }
     17    Bool_t ReInit(MParList *pList);
     18    Int_t  PreProcess(MParList *pList);
     19    Int_t  Process();
     20    Int_t  PostProcess() {return kTRUE;}
    4021
    4122public:
    4223    MArrivalTimeCalc(const char *name=NULL, const char *title=NULL);
    43 
    4424    ~MArrivalTimeCalc(){}
    4525
     
    4727};
    4828
    49 
    5029#endif
Note: See TracChangeset for help on using the changeset viewer.