/[PAMELA software]/yoda/techmodel/physics/AnticounterReader.cpp
ViewVC logotype

Annotation of /yoda/techmodel/physics/AnticounterReader.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download)
Tue Jul 20 13:27:07 2004 UTC (20 years, 4 months ago) by kusanagi
Branch: MAIN
*** empty log message ***

1 kusanagi 1.1 /** @file
2     * $Source: /home/cvsmanager/yoda/techmodel/physics/AnticounterReader.cpp,v $
3     * $Id: TrackerReader.cpp,v 1.1.1.1 2004/07/06 12:20:23 kusanagi Exp $
4     * $Author: kusanagi $
5     *
6     * Implementation of the AnticounterReader class.
7     */
8    
9     #include <string>
10     #include <log4cpp/Category.hh>
11     #include "AnticounterReader.h"
12    
13     extern "C" {
14     #include "../forroutines/anticounter/ACphysics.h"
15     extern int ACphysics(int length,unsigned short* datapointer,struct datastruct* physicspointer);
16     //Struct per il passaggio di dati da e verso la chiamata fortran
17     }
18    
19     using namespace pamela;
20     using namespace pamela::anticounter;
21    
22     static log4cpp::Category& cat = log4cpp::Category::getInstance("pamela.techmodel.anticounter.AnticounterReader");
23    
24     /**
25     * Constructor.
26     */
27     AnticounterReader::AnticounterReader(void):
28     TechmodelAlgorithm(PacketType::Physics, "TechmodelAnticounterReader") {
29     cat.debug("Constructor");
30     anticounter = new AnticounterEvent();
31     }
32    
33     /**
34     * Get a string with the version info of the algorithm.
35     */
36     std::string AnticounterReader::GetVersionInfo(void) const {
37     return
38     "$Header: /home/cvsmanager/yoda/techmodel/physics/AnticounterReader.cpp,v 1.1.1.1 2004/07/06 12:20:23 kusanagi Exp $";
39     }
40    
41     /**
42     * Initialize the algorithm with a special run. This will initialize the
43     * event reader routines for all packet types.
44     */
45     void AnticounterReader::Init(PamelaRun *run) {
46     SetInputStream(run);
47     run->WriteSubPacket(this, &anticounter, anticounter->Class());
48     }
49    
50     /**
51     * Unpack the anticounter event from an input file.
52     */
53     void AnticounterReader::RunEvent(int EventNumber) {
54    
55     }
56    
57     /**
58     * Unpack the Anticounter data event from the physical packet.
59     */
60     void AnticounterReader::RunEvent(int EventNumber, const char subData[], long int length) {
61     char data[length];
62     memcpy(data, subData, length);
63     int ERROR;
64     datastruct output;
65    
66     //Call to the routine that unpack anitocounter events
67     ERROR = ACphysics(length, (unsigned short*) data, &output);
68    
69     memcpy(anticounter->header, output.header, sizeof(anticounter->header));
70     anticounter->status = output.status;
71     anticounter->hitmap = output.hitmap;
72     memcpy(anticounter->regist, output.regist, sizeof(anticounter->regist));
73     memcpy(anticounter->shift, output.shift, sizeof(anticounter->shift));
74     memcpy(anticounter->counters, output.counters, sizeof(anticounter->counters));
75     memcpy(anticounter->coinc, output.coinc, sizeof(anticounter->coinc));
76     anticounter->trigg = output.trigg;
77     memcpy(anticounter->clock, output.clock, sizeof(anticounter->clock));
78     memcpy(anticounter->temp, output.temp, sizeof(anticounter->temp));
79     memcpy(anticounter->DAC, output.DAC, sizeof(anticounter->DAC));
80     anticounter->CRC = output.CRC;
81    
82     cat << log4cpp::Priority::ERROR
83     << "Fortran77 function ACPhysics error code = " << ERROR
84     << "\n " << log4cpp::CategoryStream::ENDLINE;
85     }

  ViewVC Help
Powered by ViewVC 1.1.23