]> git.uio.no Git - u/mrichter/AliRoot.git/blame - VZERO/AliVZEROTriggerMask.cxx
Coding conv viols fixed (Raphael)
[u/mrichter/AliRoot.git] / VZERO / AliVZEROTriggerMask.cxx
CommitLineData
a055ee24 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/* $Id$ */
2647fc37 17//-------------------------------------------
18// Class : AliVZEROTriggerMask
19//
20// Fill up the trigger mask word.
21//
22
a055ee24 23#include <Riostream.h>
24#include <TGeoManager.h>
25#include <TGeoMatrix.h>
26#include <TGeoPhysicalNode.h>
2647fc37 27#include <TTree.h>
28#include <TClonesArray.h>
29
a055ee24 30#include <AliGeomManager.h>
31#include "AliCDBManager.h"
32#include "AliCDBStorage.h"
33#include "AliCDBEntry.h"
34#include "AliLog.h"
35#include "AliVZEROTriggerMask.h"
36#include "AliVZEROdigit.h"
37
38//______________________________________________________________________
39ClassImp(AliVZEROTriggerMask)
40
41//______________________________________________________________________
42
43AliVZEROTriggerMask::AliVZEROTriggerMask()
44 :TObject(),
45 fAdcThresHold(0.0),
46 fTimeWindowWidthBBA(50.0),
47 fTimeWindowWidthBGA(20.0),
48 fTimeWindowWidthBBC(50.0),
49 fTimeWindowWidthBGC(20.0),
50 fBBtriggerV0A(0),
51 fBGtriggerV0A(0),
52 fBBtriggerV0C(0),
53 fBGtriggerV0C(0)
54
55{
56 SetAdcThreshold();
57}
58
59//________________________________________________________________________________
60Double_t AliVZEROTriggerMask::GetZPosition(const char* symname){
61// Get the global z coordinate of the given V0 alignable volume
62//
63 Double_t *tr;
64 TGeoPNEntry *pne = gGeoManager->GetAlignableEntry(symname);
65 if (!pne) return 0;
66
67
68 TGeoPhysicalNode *pnode = pne->GetPhysicalNode();
69 if(pnode){
70 TGeoHMatrix* hm = pnode->GetMatrix();
71 tr = hm->GetTranslation();
72 }else{
73 const char* path = pne->GetTitle();
74 if(!gGeoManager->cd(path)){
75 AliErrorClass(Form("Volume path %s not valid!",path));
76 return 0;
77 }
78 tr = gGeoManager->GetCurrentMatrix()->GetTranslation();
79 }
80 return tr[2];
81
82}
83
84//________________________________________________________________________________
85
86
87void AliVZEROTriggerMask::FillMasks(TTree* vzeroDigitsTree,
2647fc37 88 TClonesArray* const vzeroDigits)
a055ee24 89{
2647fc37 90// Fill up the trigger mask word using the TDC
91
92 const Double_t lightSpeed = 2.9979245800; // cm/100 ps
93 Float_t zV0A = TMath::Abs(GetZPosition("VZERO/V0A"));
94 Float_t zV0C = TMath::Abs(GetZPosition("VZERO/V0C"));
a055ee24 95
96 // distance in time units from nominal vertex to V0
2647fc37 97 Float_t v0aDist = zV0A/lightSpeed; // 100 of picoseconds
98 Float_t v0cDist = zV0C/lightSpeed; // 100 of picoseconds
99 Float_t bunchSeparation = 1000.0; // 100 of picoseconds
a055ee24 100
101 // mask
102 UInt_t one=1;
103
104 // loop over vzero entries
105 Int_t nEntries = (Int_t)vzeroDigitsTree->GetEntries();
106 for (Int_t e=0; e<nEntries; e++) {
107 vzeroDigitsTree->GetEvent(e);
108
109 Int_t nDigits = vzeroDigits->GetEntriesFast();
110
111 for (Int_t d=0; d<nDigits; d++) {
112 // vzeroDigitsTree->GetEvent(d);
113 AliVZEROdigit* digit = (AliVZEROdigit*)vzeroDigits->At(d);
114
2647fc37 115 Int_t pmNumber = digit->PMNumber();
a055ee24 116 Float_t adc = digit->ADC();
68f993cd 117 Float_t tdc = digit->Time()*10.0; // in 100 of picoseconds
a055ee24 118
119 if (adc>fAdcThresHold) {
2647fc37 120 if (pmNumber<32) { // in V0C
121 if (tdc>(v0cDist-fTimeWindowWidthBBC/2.0) &&
122 tdc<(v0cDist+fTimeWindowWidthBBC/2.0))
123 fBBtriggerV0C+=(one<<pmNumber);
124 if (tdc>(bunchSeparation-v0cDist-fTimeWindowWidthBGC/2.0) &&
125 tdc<(bunchSeparation-v0cDist+fTimeWindowWidthBGC/2.0))
126 fBGtriggerV0C+=(one<<pmNumber);
a055ee24 127 }
2647fc37 128 if (pmNumber>31) { // in V0A
129 Int_t shift = pmNumber-32;
130 if (tdc>(v0aDist-fTimeWindowWidthBBA/2.0) &&
131 tdc<(v0aDist+fTimeWindowWidthBBA/2.0))
a055ee24 132 fBBtriggerV0A+=(one<<shift);
2647fc37 133 if (tdc>(bunchSeparation-v0aDist-fTimeWindowWidthBGA/2.0) &&
134 tdc<(bunchSeparation-v0aDist+fTimeWindowWidthBGA/2.0))
a055ee24 135 fBGtriggerV0A+=(one<<shift);
136 }
137 }
138 } // end of loop over digits
139 } // end of loop over events in digits tree
140}