Ignore:
Timestamp:
04/22/04 15:45:20 (21 years ago)
Author:
stamerra
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/manalysis
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/manalysis/MMcTriggerLvl2.cc

    r2918 r3795  
    6868// Correspondence TABLE between pixel numbering in the trigger cells and
    6969// the standard spiral counting
    70 // (Note: Pixels start to count from 1 instead of 0)
     70// (*Note*: Pixels start to count ** from 1 ** instead of 0)
    7171//
    7272// This correspondence is valid only for MAGIC-like geometries!
     
    812812void MMcTriggerLvl2::GetEnergy(MMcEvt *fMcEvt)
    813813{
    814   const MMcEvt &h = *(MMcEvt *)fMcEvt;
    815   fEnergy = h.GetEnergy();
    816   return;
     814   const MMcEvt &h = *(MMcEvt *)fMcEvt;
     815   fEnergy = h.GetEnergy();
     816   return;
    817817}
    818818
     
    10071007}
    10081008
     1009//---------------------------------------------------------------------
     1010//  Check if a given pixel is in the trigger region
     1011//
     1012Bool_t MMcTriggerLvl2::IsPixelInTrigger(Int_t pixel) const
     1013{
     1014  for (int cell=0; cell<gsNCells; cell++)
     1015    for (int i=0; i<gsNPixInCell; i++)
     1016      if ((gsPixelsInCell[i][cell]-1) == pixel)
     1017        return kTRUE;
     1018 
     1019  return kFALSE;
     1020}
     1021
     1022// --------------------------------------------------------------------------
     1023//
     1024// Returns, depending on the type flag:
     1025//
     1026//  0: 1,0 if the pixel is triggered (1) or not (0)
     1027//
     1028//
     1029Bool_t MMcTriggerLvl2::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
     1030{
     1031  // Pixel in no-trigger region are set to 0
     1032  val = this->IsPixelInTrigger(idx) ?  fFiredPixel[idx]+fCompactPixel[idx] : 0;
     1033
     1034  return kTRUE;
     1035}
     1036
     1037void MMcTriggerLvl2::DrawPixelContent(Int_t num) const
     1038{
     1039    *fLog << "MMcTriggerLvl2::DrawPixelContent - not available." << endl;
     1040}
  • trunk/MagicSoft/Mars/manalysis/MMcTriggerLvl2.h

    r2919 r3795  
    11#ifndef MARS_MMcTriggerLvl2
    22#define MARS_MMcTriggerLvl2
     3
     4#ifndef MARS_MCamEvent
     5#include "MCamEvent.h"
     6#endif
    37
    48#ifndef MARS_MParContainer
     
    1216class MGeomPix;
    1317
    14 class MMcTriggerLvl2 : public MParContainer
     18class MMcTriggerLvl2 : public MParContainer, public MCamEvent
    1519{
    1620 private:
     
    8690  Int_t GetTriggerPattern() const {return fTriggerPattern;}   
    8791
    88   void GetEnergy(MMcEvt *fMcEvt = NULL);   
    89   Double_t GetEnergy() const    {return fEnergy;}     
     92  void GetEnergy(MMcEvt *fMcEvt = NULL);     
     93  Double_t GetEnergy() const    {return fEnergy;}      
    9094
    9195  Bool_t IsPixelInCell(Int_t pixel, Int_t cell);   
     96  Bool_t IsPixelInTrigger(Int_t pixel) const;   
     97
     98  Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
     99  void DrawPixelContent(Int_t num) const;
     100
    92101
    93102  ClassDef(MMcTriggerLvl2,0) // Container for 2nd Level Trigger selection parameters
  • trunk/MagicSoft/Mars/manalysis/MMcTriggerLvl2Calc.cc

    r2446 r3795  
    4343#include "MLogManip.h"
    4444
    45 #include "MMcEvt.hxx"
     45//#include "MMcEvt.hxx"
    4646#include "MMcTrig.hxx"
     47#include "MRawRunHeader.h"
    4748#include "MMcRunHeader.hxx"
    4849
     
    6162{
    6263  fName  = name  ? name  : "MMcTriggerLvl2Calc";
    63   fTitle = title ? title : "Task to Fill the MMcTriggerLvl2 object";
     64  fTitle = title ? title : "Task to Fill the MMcTriggerLvl2 object"; 
     65}
     66
     67 // --------------------------------------------------------------------------
     68//
     69// Check for the run type. Return kTRUE if it is a MC run or if there
     70// is no MC run header (old camera files) kFALSE in case of a different
     71// run type
     72//
     73Bool_t MMcTriggerLvl2Calc::CheckRunType(MParList *pList) const
     74{
     75  const MRawRunHeader *run = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
     76  if (!run)
     77    {
     78      *fLog << warn << dbginf << "Warning - cannot check file type, MRawRunHeader not found." << endl;
     79      return kTRUE;
     80    }
    6481 
    65 }
    66 
    67 
    68 // --------------------------------------------------------------------------
    69 //                                                                         
    70 //  PreProcess
    71 //
    72 //
    73 Int_t MMcTriggerLvl2Calc::PreProcess (MParList *pList)
    74 {
    75     // connect the raw data with this task
    76 
     82  return run->IsMonteCarloRun();
     83}
     84
     85// --------------------------------------------------------------------------
     86//
     87// Check for the runtype.
     88// Search for .
     89//
     90Bool_t MMcTriggerLvl2Calc::ReInit(MParList *pList)
     91{
     92    //
     93    // If it is no MC file skip this function...
     94    //
     95    if (!CheckRunType(pList))
     96    {
     97        *fLog << inf << "This is no MC file... skipping." << endl;
     98        return kTRUE;
     99    }
     100       
     101    //
     102    // Check all necessary containers
     103    //
    77104    fMcEvt = (MMcEvt*)pList->FindObject("MMcEvt");
    78     if (!fMcEvt)
    79     {
    80         *fLog << err << dbginf << "MMcEvt not found... exit." << endl;
    81         return kFALSE;
    82     }
     105     if (!fMcEvt)
     106     {
     107         *fLog << err << dbginf << "MMcEvt not found... exit." << endl;
     108         return kFALSE;
     109     }
    83110
    84111    fMcTrig = (MMcTrig*)pList->FindObject("MMcTrig");
     
    102129        return kFALSE;
    103130      }
    104     fMMcTriggerLvl2 = (MMcTriggerLvl2*)pList->FindObject("MMcTriggerLvl2");
     131
     132    return kTRUE;
     133}
     134
     135
     136// --------------------------------------------------------------------------
     137//                                                                         
     138//  PreProcess
     139//  Check the exxistence of the MMcTriggerLvl2 containers and the correct
     140//    setting of the fCompactNN that defines a compact pixel
     141//
     142Int_t MMcTriggerLvl2Calc::PreProcess (MParList *pList)
     143{
     144
     145    //    fMMcTriggerLvl2 = (MMcTriggerLvl2*)pList->FindObject("MMcTriggerLvl2");
     146    fMMcTriggerLvl2 = (MMcTriggerLvl2*)pList->FindCreateObj("MMcTriggerLvl2");
    105147    if (!fMMcTriggerLvl2)
    106148    {
     
    138180Int_t MMcTriggerLvl2Calc::Process()
    139181{
    140   fMMcTriggerLvl2->GetEnergy(fMcEvt);
     182  //  fMMcTriggerLvl2->GetEnergy(fMcEvt);
    141183
    142184  fMMcTriggerLvl2->SetLv1(fMcTrig);
  • trunk/MagicSoft/Mars/manalysis/MMcTriggerLvl2Calc.h

    r2365 r3795  
    3232  Int_t PostProcess();
    3333
     34  Bool_t ReInit(MParList *pList);
     35  Bool_t CheckRunType(MParList *pList) const;
     36
    3437 public:
    3538    MMcTriggerLvl2Calc(const char *name=NULL, const char *title=NULL);   
Note: See TracChangeset for help on using the changeset viewer.