Ignore:
Timestamp:
02/28/02 15:04:52 (23 years ago)
Author:
blanch
Message:
A small back has been solved. Before, while not using the option
writte_all_images, not all triggered showers were stored. Now it is solved.
For that it is importatn taht the less restrictive trigger option is
checked first.
A new facility has been introduced and now one can choose the step size in
trigger loop mode for the discriminator threshold.
The close-compact topology for less than 3 pixels does not make sense. Before
the program was ignoring that, now it switch to simple neighbour condition.
File:
1 edited

Legend:

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

    r1195 r1223  
    2121//
    2222// $RCSfile: camera.cxx,v $
    23 // $Revision: 1.31 $
     23// $Revision: 1.32 $
    2424// $Author: blanch $
    25 // $Date: 2002-01-18 17:41:02 $
     25// $Date: 2002-02-28 15:04:52 $
    2626//
    2727////////////////////////////////////////////////////////////////////////
     
    253253
    254254//@: Upper and lower edges of the trigger loop
    255 static int Trigger_loop_lthres = 0;
    256 static int Trigger_loop_uthres = 10;
     255static float Trigger_loop_lthres = 2.0;
     256static float Trigger_loop_uthres = 10.0;
     257static float Trigger_loop_sthres = 1.0;
    257258static int Trigger_loop_lmult = 2;
    258259static int Trigger_loop_umult = 10;
     
    472473  int btrigger = 0;           //@< trigger flag
    473474  int ithrescount;            //@< counter for loop over threshold trigger
     475  float fthrescount;          //@< value for loop over threshold trigger
    474476  int imulticount;            //@< counter for loop over multiplicity trigger
    475477  int itopocount;             //@< counter for loop over topology trigger
     478  int isorttopo[3];           //@< sorting the topologies
    476479  int icontrigger;            //@< number of trigger conditions to be analised
    477480  UShort_t numPix;            //@< number of sets of fadc written counts
     
    599602  get_Trigger_properties( &Trigger_gate_length, &Trigger_overlaping_time, &Trigger_response_ampl, &Trigger_response_fwhm);
    600603
    601   Trigger_Loop = get_Trigger_Loop(&Trigger_loop_lthres, &Trigger_loop_uthres, &Trigger_loop_lmult, &Trigger_loop_umult, &Trigger_loop_ltop, &Trigger_loop_utop);
    602 
    603   icontrigger =(Trigger_loop_uthres-Trigger_loop_lthres+1)*
     604  Trigger_Loop = get_Trigger_Loop(&Trigger_loop_lthres, &Trigger_loop_uthres, &Trigger_loop_sthres, &Trigger_loop_lmult, &Trigger_loop_umult, &Trigger_loop_ltop, &Trigger_loop_utop);
     605
     606  icontrigger =((int)((Trigger_loop_uthres-Trigger_loop_lthres)
     607                /Trigger_loop_sthres)+1)*
    604608    (Trigger_loop_umult-Trigger_loop_lmult+1)*
    605609    (Trigger_loop_utop-Trigger_loop_ltop+1);
    606 
     610 
    607611  if (!Trigger_Loop){
    608612    get_Trigger_Single (qThreshold, &Trigger_multiplicity, &Trigger_topology);
     
    650654  if (Trigger_Loop) {
    651655    log(SIGNATURE,
    652         "%s:\n\t%20s: %i - %i\n\t%20s: %i - %i\n\t%20s: %i - %i\n\t%20s\n",
     656        "%s:\n\t%20s: from %5.2f to %5.2f by %5.2f step\n\t%20s: %i - %i\n\t%20s: %i - %i\n\t%20s\n",
    653657        "Trigger Loop mode",
    654         "Threshold",Trigger_loop_lthres,Trigger_loop_uthres,
     658        "Threshold",Trigger_loop_lthres,Trigger_loop_uthres,Trigger_loop_sthres,
    655659        "Multiplicity",Trigger_loop_lmult,Trigger_loop_umult,
    656660        "Topology",Trigger_loop_ltop,Trigger_loop_utop,
     
    711715  int ***ntriggerloop;
    712716
    713   ntriggerloop= new int ** [(int) (Trigger_loop_uthres+1-Trigger_loop_lthres)];
    714   for (ithrescount=0;ithrescount<=Trigger_loop_uthres-Trigger_loop_lthres;ithrescount++){
     717  ntriggerloop= new int ** [(int)((Trigger_loop_uthres-Trigger_loop_lthres)
     718                           /Trigger_loop_sthres)];
     719  for (ithrescount=0, fthrescount=Trigger_loop_lthres;fthrescount<=Trigger_loop_uthres;fthrescount+=Trigger_loop_sthres, ithrescount++){
    715720    ntriggerloop[ithrescount]= new int * [Trigger_loop_umult-Trigger_loop_lmult+1];
    716721    for (imulticount=0;imulticount<=Trigger_loop_umult-Trigger_loop_lmult;imulticount++){
     
    722727  }
    723728
     729  // We should be careful that topologies are sort from
     730  // the less to the more restrictive one.
     731
     732  if (Trigger_loop_utop==Trigger_loop_ltop)
     733    for(int is=0; is<3;is++)
     734      isorttopo[is]=is;
     735  else {
     736      isorttopo[0]=1;
     737      isorttopo[1]=0;
     738      isorttopo[2]=2;
     739  }   
     740
    724741  // set all random numbers seeds
    725742
     
    771788  MMcTrigHeader **HeaderTrig = NULL;
    772789  MMcFadcHeader **HeaderFadc = NULL;
     790
    773791
    774792  if (Write_McTrig){
     
    931949  if(Trigger_Loop && Write_McTrig){
    932950
    933     for (int iconcount=0,ithrescount=0;ithrescount<=Trigger_loop_uthres-Trigger_loop_lthres;ithrescount++){
     951    int iconcount;
     952    for (iconcount=0,ithrescount=0,fthrescount=Trigger_loop_lthres;fthrescount<=Trigger_loop_uthres;ithrescount++,fthrescount+=Trigger_loop_sthres){
    934953      for (imulticount=0;imulticount<=Trigger_loop_umult-Trigger_loop_lmult;imulticount++){
    935954        for(itopocount=0;itopocount<=Trigger_loop_utop-Trigger_loop_ltop;itopocount++){
    936           HeaderTrig[iconcount]->SetTopology((Short_t) itopocount+Trigger_loop_ltop);
     955          HeaderTrig[iconcount]->SetTopology((Short_t) isorttopo[itopocount+Trigger_loop_ltop]);
    937956          HeaderTrig[iconcount]->SetMultiplicity((Short_t) imulticount+Trigger_loop_lmult);
    938957          for(int i=0;i<TRIGGER_PIXELS;i++){
    939958            fpixelthres[i]=
    940               ((Float_t)(ithrescount+Trigger_loop_lthres)>=qThreshold[i])?
    941               (Float_t)(ithrescount+Trigger_loop_lthres):qThreshold[i];
    942           }
     959              ((Float_t)(fthrescount)>=qThreshold[i])?
     960              (Float_t)(fthrescount):qThreshold[i];
     961              }
    943962          HeaderTrig[iconcount]->SetThreshold( fpixelthres);
    944963          HeaderTrig[iconcount]->SetAmplitud(Trigger_response_ampl);
     
    969988  }
    970989  if(Trigger_Loop && Write_McFADC){
    971 
    972     for (int iconcount=0,ithrescount=0;ithrescount<=Trigger_loop_uthres-Trigger_loop_lthres;ithrescount++){
     990    int iconcount;
     991    for (iconcount=0,ithrescount=0,fthrescount=Trigger_loop_lthres;fthrescount<=Trigger_loop_uthres;ithrescount++, fthrescount+=Trigger_loop_sthres){
    973992      for (imulticount=0;imulticount<=Trigger_loop_umult-Trigger_loop_lmult;imulticount++){
    974993        for(itopocount=0;itopocount<=Trigger_loop_utop-Trigger_loop_ltop;itopocount++){
     
    14051424        //   We study several trigger conditons
    14061425        if(Trigger_Loop){
     1426
     1427          // Set to zero the flag to know if some conditon has triggered
     1428          btrigger=0;
    14071429          //  Loop over trigger threshold
    1408           for (int iconcount=0,ithrescount=Trigger_loop_lthres;ithrescount<=Trigger_loop_uthres;ithrescount++){
     1430          int iconcount;
     1431          for (iconcount=0, ithrescount=0, fthrescount=Trigger_loop_lthres;fthrescount<=Trigger_loop_uthres;ithrescount++, fthrescount+=Trigger_loop_sthres){
    14091432            for (i=0;i<TRIGGER_PIXELS;i++)
    14101433              fpixelthres[i]=
    1411                 ((Float_t)(ithrescount)>=qThreshold[i])?
    1412                 (Float_t)(ithrescount):qThreshold[i];
     1434                ((Float_t)(fthrescount)>=qThreshold[i])?
     1435                (Float_t)(fthrescount):qThreshold[i];
    14131436            Trigger.SetThreshold(fpixelthres);
    14141437
     
    14251448            //  Set trigger flags to zero
    14261449            Lev1=Lev2=0;
    1427             btrigger=0;
    14281450
    14291451            //  loop over multiplicity of trigger configuration
     
    14401462               
    14411463                  if(itopocount==0 && imulticount>7) continue;
    1442                   if(itopocount==2 && imulticount<3) continue;
    1443                   Trigger.SetTopology(itopocount);
     1464                  //COBB if(itopocount==2 && imulticount<3) continue;
     1465                  // It only makes to look for a different topology
     1466                  // if there are 3 or more N pixels.
     1467                  if(imulticount<3)
     1468                    Trigger.SetTopology(1);
     1469                  else
     1470                    {
     1471                      // We should be careful that topologies are sort from
     1472                      // the less to the more restrictive one.
     1473                      Trigger.SetTopology(isorttopo[itopocount]);
     1474                    }
    14441475                  Trigger.ClearFirst();
    14451476                 
     
    14511482                  if(Lev1>0) {
    14521483                    btrigger= 1;
    1453                     ntriggerloop[ithrescount-Trigger_loop_lthres][imulticount-Trigger_loop_lmult][itopocount-Trigger_loop_ltop]++;
     1484                    ntriggerloop[ithrescount][imulticount-Trigger_loop_lmult][itopocount-Trigger_loop_ltop]++;
    14541485                  }
    14551486                 
     
    17991830    log( SIGNATURE, "Fraction of triggers: \n");
    18001831    datafile<<"Fraction of triggers: "<<endl;
    1801     for (ithrescount=Trigger_loop_lthres;ithrescount<=Trigger_loop_uthres;ithrescount++){
     1832    for (ithrescount=0, fthrescount=Trigger_loop_lthres;fthrescount<=Trigger_loop_uthres;ithrescount++, fthrescount+=Trigger_loop_sthres){
    18021833      for (imulticount=Trigger_loop_lmult;imulticount<=Trigger_loop_umult;imulticount++){
    18031834        for(itopocount=Trigger_loop_ltop;itopocount<=Trigger_loop_utop;itopocount++){
    1804           log( SIGNATURE, "Thres %d, Multi %d, Topo %d: %5.1f%% (%d out of %d)\n",
    1805                ithrescount,imulticount,itopocount,((float)ntriggerloop[ithrescount-Trigger_loop_lthres][imulticount-Trigger_loop_lmult][itopocount-Trigger_loop_ltop] / ((float)ntshow) * 100.0), ntriggerloop[ithrescount-Trigger_loop_lthres][imulticount-Trigger_loop_lmult][itopocount-Trigger_loop_ltop], ntshow);
    1806           datafile<<"Thres "<<ithrescount<<", Multi "<<imulticount<<", Topo"<<itopocount<<": ";
    1807           datafile<<((float)ntriggerloop[ithrescount-Trigger_loop_lthres][imulticount-Trigger_loop_lmult][itopocount-Trigger_loop_ltop] / ((float)ntshow) * 100.0)<<"% ("<<ntriggerloop[ithrescount-Trigger_loop_lthres][imulticount-Trigger_loop_lmult][itopocount-Trigger_loop_ltop]<<" out of "<<ntshow<<")"<<endl;
     1835          log( SIGNATURE, "Thres %5.1f, Multi %d, Topo %d: %5.1f%% (%d out of %d)\n",
     1836               fthrescount,imulticount,isorttopo[itopocount],((float)ntriggerloop[ithrescount][imulticount-Trigger_loop_lmult][itopocount-Trigger_loop_ltop] / ((float)ntshow) * 100.0), ntriggerloop[ithrescount][imulticount-Trigger_loop_lmult][itopocount-Trigger_loop_ltop], ntshow);
     1837          datafile<<"Thres "<<fthrescount<<", Multi "<<imulticount<<", Topo"<<isorttopo[itopocount]<<": ";
     1838          datafile<<((float)ntriggerloop[ithrescount][imulticount-Trigger_loop_lmult][itopocount-Trigger_loop_ltop] / ((float)ntshow) * 100.0)<<"% ("<<ntriggerloop[ithrescount][imulticount-Trigger_loop_lmult][itopocount-Trigger_loop_ltop]<<" out of "<<ntshow<<")"<<endl;
    18081839        }
    18091840      }   
     
    33173348//
    33183349// $Log: not supported by cvs2svn $
     3350// Revision 1.31  2002/01/18 17:41:02  blanch
     3351// The option of adding noise to all pixels or to not adding the noise
     3352// has been added.
     3353// We removed the pixels larger than 577. When there were more than one
     3354// trigger in one shower, the pixel number was increasing. Now it is
     3355// flagged by the variable MMcTrig::fFirstLvlTrig.
     3356//
    33193357// Revision 1.30  2001/11/27 09:49:54  blanch
    33203358// Fixing bug which was treating wrongly the extension of star photons.
     
    34003438//
    34013439// $Log: not supported by cvs2svn $
     3440// Revision 1.31  2002/01/18 17:41:02  blanch
     3441// The option of adding noise to all pixels or to not adding the noise
     3442// has been added.
     3443// We removed the pixels larger than 577. When there were more than one
     3444// trigger in one shower, the pixel number was increasing. Now it is
     3445// flagged by the variable MMcTrig::fFirstLvlTrig.
     3446//
    34023447// Revision 1.30  2001/11/27 09:49:54  blanch
    34033448// Fixing bug which was treating wrongly the extension of star photons.
Note: See TracChangeset for help on using the changeset viewer.