source: trunk/MagicSoft/Mars/datacenter/macros/filldotrun.C@ 9474

Last change on this file since 9474 was 9469, checked in by hoehne, 16 years ago
*** empty log message ***
File size: 23.6 KB
Line 
1/* ======================================================================== *\
2!
3! *
4! * This file is part of MARS, the MAGIC Analysis and Reconstruction
5! * Software. It is distributed to you in the hope that it can be a useful
6! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
7! * It is distributed WITHOUT ANY WARRANTY.
8! *
9! * Permission to use, copy, modify and distribute this software and its
10! * documentation for any purpose is hereby granted without fee,
11! * provided that the above copyright notice appear in all copies and
12! * that both that copyright notice and this permission notice appear
13! * in supporting documentation. It is provided "as is" without express
14! * or implied warranty.
15! *
16!
17!
18! Author(s): Daniela Dorner, 08/2004 <mailto:dorner@astro.uni-wuerzburg.de>
19! Author(s): Thomas Bretz, 08/2004 <mailto:tbretz@astro.uni-wuerzburg.de>
20!
21! Copyright: MAGIC Software Development, 2000-2008
22!
23!
24\* ======================================================================== */
25
26/////////////////////////////////////////////////////////////////////////////
27//
28// filldotrun.C
29// ============
30//
31// This macro is used in the datacenter to automatically fill the run-database
32// with the information stored in the .run-files written by the central
33// control.
34//
35// To following Arehucas versions are Currently supported:
36// 040505-0, 040514-0,
37// 040518-0, 040727-0,
38// 041113-0, 041209-0, 041221-0
39// 050224-0, 050317-0, 050322-0, 050401-0, 050413-0, 050415-0, 050714-0,
40// 050719-0, 050829-0, 051025-0,
41// 060330-0, 060401-0, 060808-0
42// 070416-0,
43// 080220-0, 080519-0, 080912-0, 081204-0, 081214-0,
44// 090203-0, 090221-0, 090522-0, 090525-0, 090616-0
45//
46// Usage:
47// .x filldotrun.C+("/data/MAGIC/Period019/ccdata", kTRUE)
48//
49// While the first argument is the directory in which all subdirectories where
50// searches for CC_*.run files. All these files were analysed and the run
51// info will be put into the DB, eg:
52// "/magic/subsystemdata/cc" would do it for all data
53// "/magic/subsystemdata/cc/2005" for one year
54// "/magic/subsystemdata/cc/2005/11" for one month
55// "/magic/subsystemdata/cc/2005/11/11" for a single day
56// "/magic/subsystemdata/cc/2005/11/11/file.run" for a single file
57//
58// The second argument is the 'dummy-mode'. If it is kTRUE dummy-mode is
59// switched on and nothing will be written into the database. Instead
60// informations about the subtables are displayed. This is usefull for tests
61// when adding a new arehucas version support. If it is kFALSE the information
62// are written into the subtables and the runs info is written into the
63// rundatabase.
64//
65// In the automatic case it makes sense to check the logfiles to make sure
66// that everything is fine...
67//
68// Make sure, that database and password are corretly set in a resource
69// file called sql.rc and the resource file is found.
70//
71// Remark: Running it from the commandline looks like this:
72// root -q -l -b filldotrun.C+\(\"path\"\,kFALSE\) 2>&1 | tee filldotrun.log
73//
74// Returns 0 in case of failure and 1 in case of success.
75//
76/////////////////////////////////////////////////////////////////////////////
77#include <iostream>
78#include <iomanip>
79#include <fstream>
80
81#include <TMath.h>
82#include <TRegexp.h>
83
84#include "MTime.h"
85#include "MDirIter.h"
86#include "MSQLMagic.h"
87
88using namespace std;
89
90Int_t insert(MSQLMagic &serv, Bool_t dummy, TString filename)
91{
92 ifstream fin(filename);
93 if (!fin)
94 {
95 cout << "Could not open file " << filename << endl;
96 return -1;
97 }
98 //read the file a second time for the check for number of columns
99 ifstream fin2(filename);
100
101 TString strng;
102 TString strng2;
103 TObjArray *array = new TObjArray();
104 Int_t check=0;
105
106 strng.ReadLine(fin);
107 strng2.ReadLine(fin2);
108 if (strng!=TString("[CC Plain Run Summary File]"))
109 {
110 cout << filename << ": No Plain Run Summary File" << endl;
111 cout << "First Line: " << strng << endl;
112 cout << endl;
113 return -1;
114 }
115
116 strng.ReadLine(fin);
117 strng2.ReadLine(fin2);
118 TRegexp reg("[0-9][0-9][0-9][0-9][0-9][0-9]-[0-9]");
119 TString arehucas = strng(reg);
120 arehucas.Prepend("20");
121 arehucas.ReplaceAll("-", "");
122
123 Int_t version = atoi(arehucas.Data());
124 if (version!=200405050 && version!=200405140 && version!=200405180 &&
125 version!=200407270 && version!=200411130 && version!=200412090 &&
126 version!=200412210 &&
127 version!=200502240 && version!=200503170 && version!=200503220 &&
128 version!=200504010 && version!=200504130 && version!=200504150 &&
129 version!=200507140 && version!=200507190 && version!=200508290 &&
130 version!=200510250 &&
131 version!=200603300 && version!=200604010 && version!=200608080 &&
132 version!=200704160 &&
133 version!=200802200 && version!=200805190 && version!=200809120 &&
134 version!=200812040 && version!=200812140 &&
135 version!=200902030 && version!=200902210 && version!=200905220 &&
136 version!=200905250 && version!=200906160)
137 {
138 cout << filename << ": File Version unknown - please update the macro!" << endl;
139 cout << "Second Line: " << strng << endl;
140 cout << endl;
141 return -1;
142 }
143
144 if (version >= 200805190)
145 {
146 strng.ReadLine(fin);
147 strng2.ReadLine(fin2);
148 if (!strng.BeginsWith("Telescope M"))
149 {
150 cout << "WARNING - Line 3 doesn't start with 'Telescope M'." << endl;
151 cout << strng << endl;
152 }
153 }
154
155 if (version >= 200411130)
156 {
157 strng.ReadLine(fin);
158 strng2.ReadLine(fin2);
159 if (strng[0]!='#')
160 {
161 cout << "WARNING - '#' expected." << endl;
162 cout << strng << endl;
163 }
164 }
165
166 cout << " * V" << version << " " << endl;
167
168 Int_t cnt=0;
169 while (1)
170 {
171 // ===== Check for number of columns in file =====
172 // different arehucas versions provide a different number of columns:
173 // 200405050 - 200405140: 18 columns
174 // 200405180 - 200407270: 35 columns
175 // 200411130 - 200510250: 43 columns
176 // 200603300 - 200802200: 52 columns
177 // 200805190 - 200809120: 54 columns
178 // > 200812040: 55 columns
179 //
180
181 strng2.ReadLine(fin2);
182 //fill an array with the values separated by ' '
183 array=strng2.Tokenize(" ");
184 check=array->GetEntries();
185 cout << check << endl;
186 //check the number of columns for the different versions, if there is an empty line (check=0), do nothing
187 if (check != 0)
188 {
189 if ((version <= 200405140 && check != 18) ||
190 (version > 200405140 && version <= 200407270 && check != 35) ||
191 (version > 200407270 && version <= 200510250 && check != 43) ||
192 (version > 200510250 && version <= 200802200 && check != 52) ||
193 (version > 200802200 && version <= 200809120 && check != 54) ||
194 (version > 200809120 && check != 55))
195 {
196 strng.ReadLine(fin);
197 cout << "ERROR - Number of columns doesn't match number of required columns." << endl;
198 array->Delete();
199 continue;
200 }
201 }
202 array->Delete();
203
204
205 // ========== Col 1: Telescope Number =========
206 Int_t telnumber = 1; // FIXME: "NULL"?
207 if (version >=200805190)
208 {
209 strng.ReadToDelim(fin, ' ');
210 if (!fin)
211 break;
212 if (strng[0]!='M')
213 {
214 cout << "WARNING - First character is not an M." << endl;
215 cout << strng << endl;
216 strng.ReadLine(fin);
217 continue;
218 }
219 if (strng[1]!='1')
220 {
221 cout << "WARNING - Only MAGIC 1 implemented so far." << endl;
222 cout << strng << endl;
223 strng.ReadLine(fin);
224 continue;
225 }
226
227 telnumber = atoi(strng.Data()+1);
228 }
229
230 // ========== Col 2: Run Number =========
231 //Reading the line
232 //and converting some strings to ints/floats
233 strng.ReadToDelim(fin, ' ');
234 if (!fin)
235 break;
236
237 Int_t runnumber = atoi(strng.Data());
238
239 //runnumber=0 means no valid dataset
240 //-> continue
241 if (runnumber == 0)
242 {
243 strng.ReadLine(fin);
244 cout << "WARNING - Runnumber == 0" << endl;
245 cout << strng << endl;
246 continue;
247 }
248
249 // ========== Col 3: Subrun Number ========= starting with version 200805190
250 Int_t filenumber = 0; // FIXME: "NULL"?
251 if (version >=200805190)
252 {
253 strng.ReadToDelim(fin, ' ');
254 filenumber = atoi(strng.Data());
255 }
256
257 TString where = Form("fTelescopeNumber=%d AND fFileNumber=%d",
258 telnumber, filenumber);
259 if (serv.ExistStr("fRunNumber", "RunData", Form("%d", runnumber), where))
260 {
261 // FIXME: Maybe we can implement a switch to update mode?
262 cout << "WARNING - Entry M" << telnumber << ":" << runnumber << "/" << filenumber << " already existing... skipped." << endl;
263 strng.ReadLine(fin);
264 continue;
265 }
266
267 // ========== Col 4: Run Type =========
268 strng.ReadToDelim(fin, ' ');
269 if (strng.Contains("???"))
270 strng="n/a";
271
272 Int_t runtype = serv.QueryKeyOfName("RunType", strng, kFALSE);
273 if (runtype<0)
274 {
275 cout << "ERROR - RunType " << strng << " not available." << endl;
276 strng.ReadLine(fin);
277 continue;
278 }
279
280 //cout << runtype << " ";
281
282 // ========== Col 5,6: Start Time =========
283 TString startdate, starttime;
284 startdate.ReadToDelim(fin, ' ');
285 starttime.ReadToDelim(fin, ' ');
286 //cout << startdate << " " << starttime << " ";
287
288 // ========== Col 7,8: Stop Time =========
289 TString stopdate, stoptime;
290 stopdate.ReadToDelim(fin, ' ');
291 stoptime.ReadToDelim(fin, ' ');
292 //cout << stopdate << " " << stoptime << " ";
293
294 if (startdate.Contains("???"))
295 startdate="0000-00-00";
296 if (starttime.Contains("???"))
297 starttime="00:00:00";
298 if (stopdate.Contains("???"))
299 stopdate="0000-00-00";
300 if (stoptime.Contains("???"))
301 stoptime="00:00:00";
302
303 // ========== Col 9: Source Name =========
304 strng.ReadToDelim(fin, ' ');
305 if (strng.Contains("???"))
306 strng="Unavailable";
307
308 Int_t sourcekey = serv.QueryKeyOfName("Source", strng.Data());
309 if (sourcekey<0)
310 {
311 strng.ReadLine(fin);
312 continue;
313 }
314 //cout << sourcekey << " ";
315
316 // ========== Col 10,11: Local source position =========
317 strng.ReadToDelim(fin, ' ');
318 Float_t zd = atof(strng.Data());
319
320 strng.ReadToDelim(fin, ' ');
321 Float_t az = atof(strng.Data());
322
323 //cout << zd << " " << az << " ";
324
325 // ========== Col 12: Number of Events =========
326 strng.ReadToDelim(fin, ' ');
327 Int_t evtno = atoi(strng.Data());
328
329 //cout << evtno << " ";
330
331 // ========== Col 13: Project Name =========
332 strng.ReadToDelim(fin, ' ');
333 if (strng.Contains("???"))
334 strng="Unavailable";
335
336 Int_t projkey = serv.QueryKeyOfName("Project", strng);
337 if (projkey<0)
338 {
339 strng.ReadLine(fin);
340 continue;
341 }
342 //cout << projkey << " ";
343
344 // ========== Col 14: Trigger Table Name =========
345 // starting from version 200411130: Col 14,15: Trigger Table Name =========
346 strng.ReadToDelim(fin, ' ');
347 if (strng.Contains("???"))
348 strng="n/a";
349
350 Int_t l1triggerkey=1;
351 Int_t l2triggerkey=1;
352 if (version >=200411130)
353 {
354 l1triggerkey = serv.QueryKeyOfName("L1TriggerTable", strng);
355 if (l1triggerkey<0)
356 {
357 strng.ReadLine(fin);
358 continue;
359 }
360
361 strng.ReadToDelim(fin, ' ');
362 if (strng.Contains("???"))
363 strng="n/a";
364
365 l2triggerkey = serv.QueryKeyOfName("L2TriggerTable", strng);
366 if (l2triggerkey<0)
367 {
368 strng.ReadLine(fin);
369 continue;
370 }
371 }
372 else
373 {
374 Int_t c=0;
375
376 if (strng.Contains(":"))
377 c=1;
378
379 if (strng.Contains("L1_") && !(strng.Contains(":")))
380 c=2;
381
382 if (strng.Contains("n/a"))
383 c=3;
384
385 switch (c)
386 {
387 case 0:
388 {
389 l2triggerkey = serv.QueryKeyOfName("L2TriggerTable", strng);
390 if (l2triggerkey<0)
391 {
392 strng.ReadLine(fin);
393 continue;
394 }
395
396 strng="n/a";
397 l1triggerkey = 1;
398
399 break;
400 }
401 case 1:
402 {
403 TString L1TT, L2TT;
404 L2TT=strng(7,12);
405 L1TT=strng(0,6);
406
407 l1triggerkey = serv.QueryKeyOfName("L1TriggerTable", L1TT);
408 if (l1triggerkey<0)
409 {
410 strng.ReadLine(fin);
411 continue;
412 }
413
414 l2triggerkey = serv.QueryKeyOfName("L2TriggerTable", L2TT);
415 if (l2triggerkey<0)
416 {
417 strng.ReadLine(fin);
418 continue;
419 }
420
421 break;
422 }
423 case 2:
424 {
425 l1triggerkey = serv.QueryKeyOfName("L1TriggerTable", strng);
426 if (l1triggerkey<0)
427 {
428 strng.ReadLine(fin);
429 continue;
430 }
431
432 strng="n/a";
433 l2triggerkey = 1;
434
435 break;
436 }
437 case 3:
438 {
439 l1triggerkey = 1;
440 l2triggerkey = 1;
441 break;
442 }
443 default:
444 {
445 cout << "WARNING: neither L1 nor L2 Trigger table - please check what is happening." << strng << endl;
446 break;
447 }
448 }
449 }
450
451 // ========== Col 16-18: TrigRate, L2 UnPresc Rate, L2 Presc Rate ==========
452 strng.ReadToDelim(fin, ' ');
453 Float_t trigrate = atof(strng.Data());
454
455 strng.ReadToDelim(fin, ' ');
456 Float_t l2uprate = atof(strng.Data());
457
458 strng.ReadToDelim(fin, ' ');
459 Float_t l2prrate = atof(strng.Data());
460
461 // ========== Col 19,20: DaqRate, Storage Rate ==========
462 strng.ReadToDelim(fin, ' ');
463 Float_t daqrate = atof(strng.Data());
464
465 strng.ReadToDelim(fin, ' ');
466 Float_t storerate = atof(strng.Data());
467
468 // ========== Col 21: HV table =========
469 if (version==200405050 || version==200405140)
470 strng.ReadToDelim(fin, '\n');
471 else
472 strng.ReadToDelim(fin, ' ');
473 if (strng.Contains("???"))
474 strng="n/a";
475
476 Int_t hvkey = serv.QueryKeyOfName("HvSettings", strng);
477 if (hvkey<0)
478 {
479 //strng.ReadLine(fin);
480 continue;
481 }
482
483 if (version==200405180 || version==200407270)
484 strng.ReadLine(fin);
485
486 Int_t testflagkey=1;
487 Int_t lightcondkey=1;
488 Int_t dttablekey=1;
489 Int_t triggerdelaytablekey=1;
490 Int_t calibrationscriptkey=1;
491 if (version>=200411130)
492 {
493 // ========== Col 22-38: DC and HV-values, mjd =========
494 for (int i=0 ; i<17 ; i++)
495 {
496 strng.ReadToDelim(fin, ' ');
497 }
498
499 // ========== Col 39: test-flag =========
500 strng.ReadToDelim(fin, ' ');
501 if (strng.Contains("???"))
502 strng="n/a";
503
504 testflagkey = serv.QueryKeyOfName("TestFlag", strng);
505 if (testflagkey<0)
506 {
507 strng.ReadLine(fin);
508 continue;
509 }
510
511 // ========== Col 40: light conditions =========
512 strng.ReadToDelim(fin, ' ');
513 if (strng.Contains("???"))
514 strng="n/a";
515
516 lightcondkey = serv.QueryKeyOfName("LightConditions", strng);
517 if (lightcondkey<0)
518 {
519 strng.ReadLine(fin);
520 continue;
521 }
522
523 // ========== Col 41: discriminator threshold table =========
524 strng.ReadToDelim(fin, ' ');
525 if (strng.Contains("???"))
526 strng="n/a";
527
528 dttablekey = serv.QueryKeyOfName("DiscriminatorThresholdTable", strng);
529 if (dttablekey<0)
530 {
531 strng.ReadLine(fin);
532 continue;
533 }
534
535 // ========== Col 42: trigger delay table =========
536 strng.ReadToDelim(fin, ' ');
537 if (strng.Contains("???"))
538 strng="n/a";
539
540 triggerdelaytablekey = serv.QueryKeyOfName("TriggerDelayTable", strng);
541 if (triggerdelaytablekey<0)
542 {
543 strng.ReadLine(fin);
544 continue;
545 }
546
547 // ========== Col 43,44: Telescope RA and Dec sent to drive =========
548 strng.ReadToDelim(fin, ' ');
549 strng.ReadToDelim(fin, ' ');
550
551 // ========== Col 45: Calibration Script =========
552 if (version>=200411130 && version<=200510250)
553 strng.ReadToDelim(fin, '\n');
554 else
555 strng.ReadToDelim(fin, ' ');
556 if (strng.Contains("???"))
557 strng="n/a";
558
559 calibrationscriptkey = serv.QueryKeyOfName("CalibrationScript", strng);
560 if (calibrationscriptkey<0)
561 {
562 strng.ReadLine(fin);
563 continue;
564 }
565
566 }
567
568 Int_t observationmodekey=1;
569 if (version>=200603300)
570 {
571 // ========== Col 46: Observation Mode =========
572 strng.ReadToDelim(fin, ' ');
573 if (strng.Contains("???"))
574 strng="n/a";
575
576 observationmodekey = serv.QueryKeyOfName("ObservationMode", strng);
577 if (observationmodekey<0)
578 {
579 strng.ReadLine(fin);
580 continue;
581 }
582
583 // ========== Col 47-54: Source RA and Dec, DT's and IPR =========
584 for (int i=0 ; i<7 ; i++)
585 {
586 strng.ReadToDelim(fin, ' ');
587 }
588 if (version<=200809120)
589 strng.ReadToDelim(fin, '\n');
590 else
591 strng.ReadToDelim(fin, ' ');
592 }
593
594 Int_t sumtriggerflagkey=1;
595 if (version>=200812040)
596 {
597 // ========= Col 55: SumTrigger flag =========
598 strng.ReadToDelim(fin, '\n');
599 if (strng.Contains("???"))
600 strng="n/a";
601
602 sumtriggerflagkey = serv.QueryKeyOfName("SumTriggerFlag", strng);
603 if (sumtriggerflagkey<0)
604 {
605 strng.ReadLine(fin);
606 continue;
607 }
608
609 }
610
611
612 // ================================================================
613 // ========== Data read from file now access the database =========
614 // ================================================================
615
616 //assemble the query that is needed to insert the values of this run
617 TString query;
618 query += Form("fTelescopeNumber=%d, ", telnumber);
619 query += Form("fRunNumber=%d, ", runnumber);
620 query += Form("fFileNumber=%d, ", filenumber);
621 query += Form("fRunTypeKEY=%d, ", runtype);
622 query += Form("fProjectKEY=%d, ", projkey);
623 query += Form("fSourceKEY=%d, ", sourcekey);
624 query += Form("fNumEvents=%d, ", evtno);
625 query += Form("fRunStart=\"%s %s\", ", startdate.Data(), starttime.Data());
626 query += Form("fRunStop=\"%s %s\", ", stopdate.Data(), stoptime.Data());
627 query += Form("fL1TriggerTableKEY=%d, ", l1triggerkey);
628 query += Form("fL2TriggerTableKEY=%d, ", l2triggerkey);
629 query += Form("fTestFlagKEY=%d, ", testflagkey);
630 query += Form("fCalibrationScriptKEY=%d, ", calibrationscriptkey);
631 query += Form("fTriggerDelayTableKEY=%d, ", triggerdelaytablekey);
632 query += Form("fDiscriminatorThresholdTableKEY=%d, ", dttablekey);
633 query += Form("fLightConditionsKEY=%d, ", lightcondkey);
634 query += Form("fHvSettingsKEY=%d, ", hvkey);
635 query += Form("fObservationModeKEY=%d, ", observationmodekey);
636 query += Form("fSumTriggerFlagKEY=%d, ", sumtriggerflagkey);
637 if (!TMath::IsNaN(zd) && TMath::Finite(zd))
638 query += Form("fZenithDistance=%d, ", TMath::Nint(zd));
639 if (!TMath::IsNaN(az) && TMath::Finite(az))
640 query += Form("fAzimuth=%d, ", TMath::Nint(az));
641 if (!TMath::IsNaN(storerate) && TMath::Finite(storerate))
642 query += Form("fDaqStoreRate=%d, ", TMath::Nint(storerate));
643 if (!TMath::IsNaN(daqrate) && TMath::Finite(daqrate))
644 query += Form("fDaqTriggerRate=%d, ", TMath::Nint(daqrate));
645 if (!TMath::IsNaN(trigrate) && TMath::Finite(trigrate))
646 query += Form("fMeanTriggerRate=%d, ", TMath::Nint(trigrate));
647 if (!TMath::IsNaN(l2prrate) && TMath::Finite(l2prrate))
648 query += Form("fL2RatePresc=%d, ", TMath::Nint(l2prrate));
649 if (!TMath::IsNaN(l2uprate) && TMath::Finite(l2uprate))
650 query += Form("fL2RateUnpresc=%d, ", TMath::Nint(l2uprate));
651 query += "fMagicNumberKEY=1, fExcludedFDAKEY=1";
652
653 cnt++;
654
655 //send query, add dataset to DB
656 if (serv.Insert("RunData", query)==kFALSE)
657 return -1;
658
659 TString query2=Form("fTelescopeNumber=%d, fRunNumber=%d, fFileNumber=%d, "
660 "fPriority=%d, fTimingCorrection='1970-01-01 00:00:00', fCompmux='1970-01-01 00:00:00'",
661 telnumber, runnumber, filenumber, runnumber);
662 if (testflagkey==3)
663 query2+=" , fDataCheckDone='1970-01-01 00:00:00'";
664
665 //create entry in table RunProcessStatus for this runnumber
666 if (serv.Insert("RunProcessStatus", query2)==kFALSE)
667 return -1;
668 }
669
670 return cnt;
671}
672
673// This tool will work from Period017 (2004_05_17) on...
674int filldotrun(const TString path="/home/lapalma/transfer/ccdata", Bool_t dummy=kTRUE)
675{
676 MSQLMagic serv("sql.rc");
677 if (!serv.IsConnected())
678 {
679 cout << "ERROR - Connection to database failed." << endl;
680 return 0;
681 }
682
683 cout << "filldotrun" << endl;
684 cout << "----------" << endl;
685 cout << endl;
686 cout << "Connected to " << serv.GetName() << endl;
687 cout << "Search Path: " << path << endl;
688 cout << endl;
689
690 serv.SetIsDummy(dummy);
691
692 if (path.EndsWith(".run"))
693 {
694 cout << path(TRegexp("CC_.*.run", kFALSE)) << flush;
695 Int_t n = insert(serv, dummy, path);
696 cout << " <" << n << "> " << (dummy?"DUMMY":"") << endl;
697
698 return n<0 ? 2 : 1;
699 }
700
701 MDirIter Next(path, "CC_*.run", -1);
702 while (1)
703 {
704 TString name = Next();
705 if (name.IsNull())
706 break;
707
708 cout << " * " << name(TRegexp("CC_.*.run", kFALSE)) << endl;
709 Int_t n = insert(serv, dummy, name);
710 cout << " <" << n << "> " << (dummy?"DUMMY":"") << endl;
711
712 if (n<0)
713 return 2;
714 }
715
716 return 1;
717}
Note: See TracBrowser for help on using the repository browser.