Changeset 1425


Ignore:
Timestamp:
07/22/02 17:32:22 (22 years ago)
Author:
bigongia
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r1423 r1425  
    11                                                                  -*-*- END -*-*-
     2
     3 2002/07/22: Abelardo Moralejo
     4
     5   * manalysis/MCerPhotCalc2.[h,cc]:
     6     -added procedure SetWeights.
     7
     8   * macros/MagicHillas.C:
     9     -added example on how to use MCerPhotCalc2
    210
    311 2002/07/22: Thomas Bretz
  • trunk/MagicSoft/Mars/manalysis/MCerPhotCalc2.cc

    r1404 r1425  
    2828//                                                                          //
    2929//   This is a task which calculates the number of photons from the FADC    //
    30 //   time slices. It weights the each slice according to the fraction       //
    31 //   of signal which, in average, falls within it. This average has been    //
    32 //   determined over a run (about 1000 triggers, 0 deg z.a. gammas).        //
     30//   time slices. It weights the each slice according to the numbers in     //
     31//   the array fWeight. The default values (see end of this file) are       //
     32//   the fraction of signal which, in average, falls within each slice.     //
     33//   This averages have been determined over a run (about 1000 triggers,    //
     34//   0 deg z.a. gammas).                                                    //
    3335//                                                                          //
    3436//  Input Containers:                                                       //
    35 //   MRawEvtData, MPedestalCam                                             //
     37//   MRawRunHeader, MRawEvtData, MPedestalCam                               //
    3638//                                                                          //
    3739//  Output Containers:                                                      //
     
    6567{
    6668    fName  = name  ? name  : "MCerPhotCalc2";
    67     fTitle = title ? title : "Task to calculate Cerenkov photons from raw data";
     69    fTitle = title ? title : "Task to calculate pixel signal from raw data";
    6870
    6971    AddToBranchList("MRawEvtData.fHiGainPixId");
     
    7173    AddToBranchList("MRawEvtData.fHiGainFadcSamples");
    7274    AddToBranchList("MRawEvtData.fLoGainFadcSamples");
    73 
    74     fSumQuadWeights = fSumWeights = 0.;
    75     for (Int_t i = 0; i < 15; i++)
    76       {
    77         fSumQuadWeights += fWeight[i]*fWeight[i];
    78         fSumWeights += fWeight[i];
    79       }
    80     fSumQuadWeights = sqrt(fSumQuadWeights);
    81 
    8275}
    8376
     
    120113        return kFALSE;
    121114
     115    // Calculate quadratic sum of weights:
     116    fSumQuadWeights = 0.;
     117    for (Int_t i = 0; i < 15; i++)
     118      fSumQuadWeights += fWeight[i]*fWeight[i];
     119
     120    fSumQuadWeights = sqrt(fSumQuadWeights);
     121
    122122    return kTRUE;
    123123}
     
    138138    }
    139139
     140    if (fRunHeader->GetNumSamplesHiGain() != 15)
     141    {
     142        *fLog << dbginf << "Number of FADC slices (" << fRunHeader->GetNumSamplesHiGain() <<") is different from expected (15)... aborting." << endl;
     143        return kFALSE;
     144    }
     145
    140146    if (runheader->GetRunType() != kRTMonteCarlo)
    141147        return kTRUE;
     
    165171    MRawEvtPixelIter pixel(fRawEvt);
    166172
    167     Float_t ADCBins[15];
     173    Float_t BinSignal[15];
    168174
    169175    while (pixel.Next())
     
    187193
    188194        Float_t nphot = 0.;
    189         for(Int_t i = 0; i<15;i++)
     195
     196        for(Int_t i = 0; i<15; i++)
    190197          {
    191             ADCBins[i] = (Float_t) *(ptr+i);
    192             nphot += ADCBins[i] * fWeight[i];
     198            BinSignal[i] =  (Float_t) ptr[i] - mean;
     199            nphot       +=  BinSignal[i] * fWeight[i];
    193200          }
    194 
    195         //
    196         // We check that the pixel is not empty, if it is empty
    197         // we won't substract the pedestal. Empty means that it has
    198         // 0 signal in all the slices.
    199         //
    200         if (nphot!=0)
    201           nphot -= mean*fSumWeights;
    202201
    203202        Float_t nphoterr = ped.GetSigma()* fSumQuadWeights;
     
    213212}
    214213
    215 Float_t MCerPhotCalc2::fWeight[15] = {0, 0.0809835, 0.289593, 0.366926, 0.211665, 0.0508328, 0., 0., 0., 0., 0., 0., 0., 0., 0.};
     214// Default weights:
     215Float_t MCerPhotCalc2::fWeight[] = {0, 0.0809835, 0.289593, 0.366926, 0.211665, 0.0508328, 0., 0., 0., 0., 0., 0., 0., 0., 0.};
  • trunk/MagicSoft/Mars/manalysis/MCerPhotCalc2.h

    r1404 r1425  
    2525    MRawEvtData    *fRawEvt;     // raw event data (time slices)
    2626    MCerPhotEvt    *fCerPhotEvt; // Cerenkov Photon Event used for calculation
    27     MRawRunHeader  *fRunHeader;  //  RunHeader information
     27    MRawRunHeader  *fRunHeader;  // RunHeader information
    2828 
    2929    Bool_t          fEnableFix;  // fix for a bug in files from older camera versions (<=40)
    3030
    31     Float_t         fSumQuadWeights, fSumWeights;
    32     static Float_t  fWeight[15];
     31    static Float_t  fWeight[15];  // Weights for adding up the ADC slices
     32    Float_t         fSumQuadWeights;
    3333
    3434public:
     
    3737    Bool_t PreProcess(MParList *pList);
    3838    Bool_t Process();
     39    Bool_t ReInit(MParList *pList);
    3940
    40     Bool_t ReInit(MParList *pList);
     41    void   SetWeights(Float_t *w) {memcpy(fWeight,w,15*sizeof(Float_t));}
    4142
    4243    ClassDef(MCerPhotCalc2, 0)   // Task to calculate cerenkov photons from raw data
    4344};
    44 
     45 
    4546
    4647#endif
Note: See TracChangeset for help on using the changeset viewer.