]> git.uio.no Git - u/mrichter/AliRoot.git/blame - VZERO/AliVZEROTriggerMask.cxx
added verbosity in a Fatal call
[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$ */
17#include <Riostream.h>
18#include <TGeoManager.h>
19#include <TGeoMatrix.h>
20#include <TGeoPhysicalNode.h>
21#include <AliGeomManager.h>
22#include "AliCDBManager.h"
23#include "AliCDBStorage.h"
24#include "AliCDBEntry.h"
25#include "AliLog.h"
26#include "AliVZEROTriggerMask.h"
27#include "AliVZEROdigit.h"
28
29//______________________________________________________________________
30ClassImp(AliVZEROTriggerMask)
31
32//______________________________________________________________________
33
34AliVZEROTriggerMask::AliVZEROTriggerMask()
35 :TObject(),
36 fAdcThresHold(0.0),
37 fTimeWindowWidthBBA(50.0),
38 fTimeWindowWidthBGA(20.0),
39 fTimeWindowWidthBBC(50.0),
40 fTimeWindowWidthBGC(20.0),
41 fBBtriggerV0A(0),
42 fBGtriggerV0A(0),
43 fBBtriggerV0C(0),
44 fBGtriggerV0C(0)
45
46{
47 SetAdcThreshold();
48}
49
50//________________________________________________________________________________
51Double_t AliVZEROTriggerMask::GetZPosition(const char* symname){
52// Get the global z coordinate of the given V0 alignable volume
53//
54 Double_t *tr;
55 TGeoPNEntry *pne = gGeoManager->GetAlignableEntry(symname);
56 if (!pne) return 0;
57
58
59 TGeoPhysicalNode *pnode = pne->GetPhysicalNode();
60 if(pnode){
61 TGeoHMatrix* hm = pnode->GetMatrix();
62 tr = hm->GetTranslation();
63 }else{
64 const char* path = pne->GetTitle();
65 if(!gGeoManager->cd(path)){
66 AliErrorClass(Form("Volume path %s not valid!",path));
67 return 0;
68 }
69 tr = gGeoManager->GetCurrentMatrix()->GetTranslation();
70 }
71 return tr[2];
72
73}
74
75//________________________________________________________________________________
76
77
78void AliVZEROTriggerMask::FillMasks(TTree* vzeroDigitsTree,
79 TClonesArray* vzeroDigits)
80{
81 const Double_t LightSpeed = 2.9979245800; // cm/100 ps
82 Float_t Z_V0A = TMath::Abs(GetZPosition("VZERO/V0A"));
83 Float_t Z_V0C = TMath::Abs(GetZPosition("VZERO/V0C"));
84
85 // distance in time units from nominal vertex to V0
86 Float_t v0a_dist = Z_V0A/LightSpeed; // 100 of picoseconds
87 Float_t v0c_dist = Z_V0C/LightSpeed; // 100 of picoseconds
88 Float_t bunch_separation = 1000.0; // 100 of picoseconds
89
90 // mask
91 UInt_t one=1;
92
93 // loop over vzero entries
94 Int_t nEntries = (Int_t)vzeroDigitsTree->GetEntries();
95 for (Int_t e=0; e<nEntries; e++) {
96 vzeroDigitsTree->GetEvent(e);
97
98 Int_t nDigits = vzeroDigits->GetEntriesFast();
99
100 for (Int_t d=0; d<nDigits; d++) {
101 // vzeroDigitsTree->GetEvent(d);
102 AliVZEROdigit* digit = (AliVZEROdigit*)vzeroDigits->At(d);
103
104 Int_t PMNumber = digit->PMNumber();
105 Float_t adc = digit->ADC();
106 Float_t tdc = digit->Time(); // in 100 of picoseconds
107
108 if (adc>fAdcThresHold) {
109 if (PMNumber<32) { // in V0C
110 if (tdc>(v0c_dist-fTimeWindowWidthBBC/2.0) &&
111 tdc<(v0c_dist+fTimeWindowWidthBBC/2.0))
112 fBBtriggerV0C+=(one<<PMNumber);
113 if (tdc>(bunch_separation-v0c_dist-fTimeWindowWidthBGC/2.0) &&
114 tdc<(bunch_separation-v0c_dist+fTimeWindowWidthBGC/2.0))
115 fBGtriggerV0C+=(one<<PMNumber);
116 }
117 if (PMNumber>31) { // in V0A
118 Int_t shift = PMNumber-32;
119 if (tdc>(v0a_dist-fTimeWindowWidthBBA/2.0) &&
120 tdc<(v0a_dist+fTimeWindowWidthBBA/2.0))
121 fBBtriggerV0A+=(one<<shift);
122 if (tdc>(bunch_separation-v0a_dist-fTimeWindowWidthBGA/2.0) &&
123 tdc<(bunch_separation-v0a_dist+fTimeWindowWidthBGA/2.0))
124 fBGtriggerV0A+=(one<<shift);
125 }
126 }
127 } // end of loop over digits
128 } // end of loop over events in digits tree
129}