Coder Social home page Coder Social logo

Comments (7)

gabrigarjim avatar gabrigarjim commented on September 24, 2024

Hi Antoine ,
First of all be sure that in your unpacking macro you are calling the reader that unpacks TPat information :

     source->AddReader(new R3BTrloiiTpatReader(
     &ucesb_struct.unpacktpat, offsetof(EXT_STR_h101, unpacktpat)));

Then get it in a proper way in your analysis macro ,

     TBranch  *tpatBranch = eventTree->GetBranch("EventHeader.");
     R3BEventHeader *fEventHeader;
     tpatBranch->SetAddress(&fEventHeader);

and read it in the main event loop :

Int_t fTpat, tpatbin;

if (fEventHeader->GetTpat() > 0)
    {
        for (Int_t i = 0; i < 16; i++)
        {
            tpatbin = (fEventHeader->GetTpat() & (1 << i));
            if (tpatbin != 0){
                fTPat=i+1;
               }
            }

cout<<"TPat for event "<<j<<" : "<<fTPat<<endl;

Hope this helps.

from r3broot.

bzhantoine avatar bzhantoine commented on September 24, 2024

Thank you for your answer.
The unpacker was already fine (path =/u/land/r3broot/202205_s522/R3BParams_S522/macros/exp/unpack/unpack_data.C ) and my macro, after adding your lines, doesnโ€™t crash anymore but the Tpat values returned by fEventHeader->GetTpat() are never > 0 but still = -1382216307 , so I couldn't enter in the loop you gave me.

However, if I draw the EventHeader.fTpat from the terminal I see several values...

(if someone want to use these lines, there is a little mistake: GetBranch("EventHeader**.**"); => GetBranch("EventHeader");

from r3broot.

gabrigarjim avatar gabrigarjim commented on September 24, 2024

In fact the branch must be called with the dot GetBranch("EventHeader."); , as this is how it appears in the root tree (it inherits from FairEventHeader, check https://github.com/FairRootGroup/FairRoot/blob/master/base/event/FairEventHeader.cxx). Try now and if its not working please write here the file you are using, so we can reproduce your error.

from r3broot.

bzhantoine avatar bzhantoine commented on September 24, 2024

Actually, I removed this dot because when I used it, my macro crashed when it reached "tree->GetEntry(i)", right at the beginning of my loop.

I use the following macro:
/u/land/r3broot/202205_s522/foot/macros/offline/WorkingDir/Antoine/analysis_Antoine_Gsi.C
(the root file are in the same folder)

Thank you in advance for your help.

from r3broot.

gabrigarjim avatar gabrigarjim commented on September 24, 2024

Hi, just put in that folder a couple of macros, the one you sent working and other one with general procedures for tpat analysis. I did not see anything wrong about the way you were getting the tpats but it was crashing, so I just rewrite the same stuff and it started working (I suppose there were some extra stuff coming from copying -pasting.... this I have to check ). Anyways, some remarks :

  1. /u/land/r3broot/202205_s522/ is a place for parameter development and tracing. User stuff should be placed on your folder in land and then commited to this repository (but definitely not in a folder called "Antoine". I can send you the proper scheme for this repository)
  2. I saw some .dat files with pedestals. This pedestals should go in a .par file that is loaded to fill a proper container. Please do not use .dat files or similar to hardcode parameter management.
  3. As a general recommendation : clear TCloneArray at the beggining of the eventloop (FootMappedData, in your case)

If you need help please don't hesitate to ask.

from r3broot.

bzhantoine avatar bzhantoine commented on September 24, 2024

Thank you again for your help.

I ran the macro with your changes and it crashed, but by adding the two lines you used in tpat_study.C it finally works.
I deleted these two lines from tpat_study.C and it crashed as well.

They were these:
eventTree->SetBranchStatus("*",0);
eventTree->SetBranchStatus("EventHeader.*",1);
(before the TBranch line)

Regarding your remarks (1 and 2), during the analysis meetings organized by Valerii Panin, we were made aware of it.
I use the .dat file (there is also a .par file in the folder) and I work in this folder only during the test phase.

from r3broot.

gabrigarjim avatar gabrigarjim commented on September 24, 2024

In principle this should not be necessary
eventTree->SetBranchStatus("*",0); eventTree->SetBranchStatus("EventHeader.*",1);
as they have to be on when you open a root tree. I will take a look to this.... maybe is related to what is happening to @ManuelXarepe

from r3broot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.