Ignore:
Timestamp:
07/30/04 16:11:20 (20 years ago)
Author:
galante
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mtemp/mpisa/macros/AnalCurrents.C

    r4435 r4436  
    4545void AnalCurrents(const TString filename)
    4646{
    47   //UInt_t numEvents = 1000000;
    48   UInt_t numEvents = 1;
    49 
    50   //
    51   // Create a empty Parameter List and an empty Task List
    52   // The tasklist is identified in the eventloop by its name
    53   //
    54   MParList  plist; 
    55   MTaskList tlist;
    56   plist.AddToList(&tlist);
    57 
    58 
    59   MCameraDC     dccam;
    60 
    61   plist.AddToList(&geomcam);
    62   plist.AddToList(&dccam);
    63 
    64   //
    65   // Now setup the tasks and tasklist:
    66   // ---------------------------------
    67   //
    68   // Reads the trees of the root file and the analysed branches
    69   MReadReports read;
    70   read.AddTree("Currents");
    71   read.AddFile(filename);     // after the reading of the trees!!!
    72   read.AddToBranchList("MReportCurrents.*");
    73 
    74   MGeomApply geomapl;
    75 
    76   tlist.AddToList(&geomapl);
    77   tlist.AddToList(&read);
    78 
    79   //
    80   // Create and setup the eventloop
    81   //
    82   MEvtLoop evtloop;
    83   evtloop.SetParList(&plist);
     47    //UInt_t numEvents = 1000000;
     48    UInt_t numEvents = 1;
     49   
     50    //
     51    // Create a empty Parameter List and an empty Task List
     52    // The tasklist is identified in the eventloop by its name
     53    //
     54    MParList  plist; 
     55    MTaskList tlist;
     56    plist.AddToList(&tlist);
     57   
     58   
     59    MCameraDC     dccam;
     60   
     61    plist.AddToList(&geomcam);
     62    plist.AddToList(&dccam);
     63   
     64    //
     65    // Now setup the tasks and tasklist:
     66    // ---------------------------------
     67    //
     68    // Reads the trees of the root file and the analysed branches
     69    MReadReports read;
     70    read.AddTree("Currents");
     71    read.AddFile(filename);     // after the reading of the trees!!!
     72    read.AddToBranchList("MReportCurrents.*");
     73   
     74    MGeomApply geomapl;
     75   
     76    tlist.AddToList(&geomapl);
     77    tlist.AddToList(&read);
     78
     79    //
     80    // Create and setup the eventloop
     81    //
     82    MEvtLoop evtloop;
     83    evtloop.SetParList(&plist);
    8484     
    85   MCerPhotEvt dcevt;
    86   Int_t count = 0;
    87   Double_t val;
    88   //
    89   // Execute your analysis
    90   //
    91   //if (!evtloop.Eventloop(numEvents))
    92   //  return kFALSE;
    93   if (!evtloop.PreProcess())
    94     return;
    95    
    96   while (tlist.Process())
    97     {
    98       //cout << "Evt #" << ++count << endl;
    99       for(Int_t i=0; i<gsNpix; i++){
    100         dcevt.AddPixel(i,dccam.GetCurrent(i)/geomcam.GetPixRatio(i),0);
    101         dcevt.GetPixelContent(val,i,geomcam,0);
    102         //cout << i << "-" << dccam.GetCurrent(i) << "-" << val << endl;
    103       }
    104       //cout << endl;
    105     }
    106   tlist.PrintStatistics();
    107 
    108   cout << "Calling test_findstar function" << endl;
    109   test_findstar(&dcevt);
     85    MCerPhotEvt dcevt;
     86   
     87    const Int_t NSteps = 5;  // Number of steps to average DC over events
     88    Int_t count = 0;         // counter for averaging NSteps events
     89    Int_t NumAverEvt = 1;    // counter for averaged events stored into dcevt
     90    Double_t val[gsNpix];    // array for managing the averaging of gsNpix
     91                             // DC values over NSteps events
     92   
     93    for(Int_t i=0; i<gsNpix; i++)
     94        val[i] = 0.0;
     95    //
     96    // Execute your analysis
     97    //
     98    //if (!evtloop.Eventloop(numEvents))
     99    //  return kFALSE;
     100    if (!evtloop.PreProcess())
     101        return;
     102   
     103    while (tlist.Process())
     104    {
     105        ++count;
     106        for(Int_t i=0; i<gsNpix; i++)
     107        {
     108            val[i] += dccam.GetCurrent(i);
     109            if(i==27)
     110                cout << "pixID #27 curr=" << dccam.GetCurrent(i) << endl;
     111            //dcevt.AddPixel(i,dccam.GetCurrent(i)/geomcam.GetPixRatio(i),0);
     112            if( (count%NSteps) == 0 )
     113            {
     114                dcevt.AddPixel(i,val[i]/(Double_t)NSteps,0);
     115                dcevt.GetPixelContent(val[i],i,geomcam,0);
     116                //cout << "Pixel #" << i << "  current=" << val[i] << endl;
     117                val[i] = 0.0;
     118            }
     119        }
     120
     121        // Reset count and call findstar function on this macroevent
     122        if( (count%NSteps) == 0 )
     123        {
     124            count = 0;
     125            ++NumAverEvt;
     126            cout << "Calling test_findstar function" << endl;
     127            test_findstar(&dcevt);
     128        }
     129    }
     130
     131    // Last loop overall pixels to fill with the average
     132    // of last count events
     133    if(count!=0)
     134    {
     135        for(Int_t i=0; i<gsNpix; i++)
     136        {
     137            dcevt.AddPixel(i,val[i]/(Double_t)count,0);
     138            dcevt.GetPixelContent(val[i],i,geomcam,0);
     139            //cout << "Pixel #" << i << "  current=" << val[i] << endl;
     140        }
     141    }
     142
     143    cout << "Calling test_findstar function" << endl;
     144    test_findstar(&dcevt);
     145
     146    cout << "Number of averaged events stored into container = " << NumAverEvt << endl;
     147    tlist.PrintStatistics();
     148   
    110149}
    111150
Note: See TracChangeset for help on using the changeset viewer.